|
//这里是测试用的一段c程序
#include <stdio.h>
int main()
{
int a=1;
int b=2;
int c=a+b;
printf("C is %d",c);
return 0;
}
以上代码用gcc反汇编出来如下(未加优化选项)
.file "testadd.c"
.section .rodata
.LC0:
.string "C is %d"
.text
.globl main
.type main,@function
main:
pushl %ebp
movl %esp, %ebp
subl $24, %esp ;
andl $-16, %esp ;请问这句什么意思?谢谢:-)
movl $0, %eax ;
subl %eax, %esp
movl $1, -4(%ebp)
movl $2, -8(%ebp)
movl -8(%ebp), %eax
addl -4(%ebp), %eax
movl %eax, -12(%ebp)
subl $8, %esp
pushl -12(%ebp)
pushl $.LC0
call printf
addl $16, %esp
movl $0, %eax
leave
ret
.Lfe1:
.size main,.Lfe1-main
.ident "GCC: (GNU) 3.2.2 20030222 (Red Hat Linux 3.2.2-5)" |
|