source code :
- int accum = 0;
- int sum(int a,int b)
- {
- int t=a+b;
- accum += 0;
- return t;
- }
- int main()
- {
- return sum(1,3);
- }
code.o 汇编语言
- 00000000 :
- 0: 8b 44 24 08 mov 0x8(%esp),%eax
- 4: 03 44 24 04 add 0x4(%esp),%eax
- 8: c3 ret
main.o
汇编语言:
- 080483b4 :
- 80483b4: 8b 44 24 08 mov 0x8(%esp),%eax
- 80483b8: 03 44 24 04 add 0x4(%esp),%eax
- 80483bc: c3 ret
- 80483bd: 90 nop
- 80483be: 90 nop
- 80483bf: 90 nop
- 080483c0 :
- 80483c0: 55 push %ebp
- 80483c1: 89 e5 mov %esp,%ebp
- 80483c3: 83 e4 f0 and $0xfffffff0,%esp
- 80483c6: 83 ec 10 sub $0x10,%esp
- 80483c9: c7 44 24 04 03 00 00 movl $0x3,0x4(%esp)
- 80483d0: 00
- 80483d1: c7 04 24 01 00 00 00 movl $0x1,(%esp)
- 80483d8: e8 d7 ff ff ff call 80483b4
- 80483dd: c9 leave
- 80483de: c3 ret
- 80483df: 90 nop
需要注意的函数sum编译成汇编语言以后,以及在link以后的在反汇编回来是不一样的,需要主要的变量accum 的值。
C 想说爱你真的不容易啊
阅读(1360) | 评论(0) | 转发(0) |