#include <stdio.h>
int main() {
int x, y, z;
x = 2222;
y = 3333;
z = x + y;
printf("z is %d\n", z);
return 0;
}
gcc -S -fverbose-asm -fomit-frame-pointer sum.c
.LFB0:
.cfi_startproc
pushq %rbp #
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp #,
.cfi_def_cfa_register 6
subq $16, %rsp #,
# sum.c:6: x = 2222;
movl $2222, -12(%rbp) #, x
# sum.c:7: y = 3333;
movl $3333, -8(%rbp) #, y
# sum.c:8: z = x + y;
movl -12(%rbp), %edx # x, tmp88
movl -8(%rbp), %eax # y, tmp89
addl %edx, %eax # tmp88, tmp87
movl %eax, -4(%rbp) # tmp87, z
# sum.c:10: printf("z is %d\n", z);
movl -4(%rbp), %eax # z, tmp90
movl %eax, %esi # tmp90,
leaq .LC0(%rip), %rax #, tmp91
movq %rax, %rdi # tmp91,
movl $0, %eax #,
call printf@PLT #
# sum.c:11: return 0;
movl $0, %eax #, _6
# sum.c:12: }
leave
.cfi_def_cfa 7, 8
ret
.cfi_endproc