- 论坛徽章:
- 0
|
- [liuqi@ljjk code]$ cat cc.s
- .file "cc.c"
- .section .rodata
- .LC0:
- .string "%d,%d\n"
- .text
- .globl main
- .type main,@function
- main:
- pushl %ebp
- movl %esp, %ebp
- subl $8, %esp
- andl $-16, %esp
- movl $0, %eax
- subl %eax, %esp
- movl $0, -4(%ebp) //付值从这里开始i=0;
- movl $0, -8(%ebp) //j=0
- leal -4(%ebp), %eax //还是i=0(把i原来在的地址存到一个寄存器中 %eax中)
- incl (%eax) //%eax中的值自加1
- leal -4(%ebp), %eax //把%eax中的自加1的值寻址付值给%eax 这个时候i=1
- incl (%eax) //%eax中存的值自加一
- movl -4(%ebp), %eax //把%eax中的自加1的值寻址付值给%eax 这个时候i=2
- movl -4(%ebp), %edx //把%eax中的自加1的值寻址付值给%edx 这个也是i=2
- addl %eax, %edx //%eax+%edx (++i)+(++i) 这个时候 2+2
- leal -4(%ebp), %eax //把%eax中的自加1的值寻址付值给%eax
- incl (%eax) //这个时候i=3
- movl %edx, %eax //把以前的2+2的值给%eax
- addl -4(%ebp), %eax //这个时候是3+4
- movl %eax, -8(%ebp) //把3+4的值给变量j
- subl $4, %esp //调用函数返回操作,栈指针操作
- pushl -4(%ebp) //i入栈保护
- pushl -8(%ebp) //j入栈保护
- pushl $.LC0 参数"%d,%d"的字符串保护
- call printf //把上面的保护的参数都扔到这里,就是扔到printf函数里
- addl $16, %esp
- leave
- ret
- .Lfe1:
- .size main,.Lfe1-main
- .ident "GCC: (GNU) 3.2.2 20030222 (Red Hat Linux 3.2.2-5)"
- [liuqi@ljjk code]$
复制代码
但愿我没有误人子弟
其实前辈们传授技术经验要好好的考虑和辨别好坏的,我觉得技术上的可以去吸取别人的,这样才会有进步,否则不要说华为,就连捡破烂都不会有人要的!
[ 本帖最后由 1jjk 于 2006-11-24 08:54 编辑 ] |
|