额..那我就不知道再怎么解释了...不好意思哦..我也能力有限
直接去check 汇编,就知道是怎么出来的了。
2009-08-07 17:34
2009-08-07 17:36
2009-08-07 17:36
2009-08-07 17:36
2009-08-07 17:37
程序代码:
.file "test.c"
.section .rodata
.LC0:
.string "n=%d\n"
.text
.globl main
.type main, @function
main:
leal 4(%esp), %ecx
andl $-16, %esp
pushl -4(%ecx)
pushl %ebp
movl %esp, %ebp
pushl %ecx
subl $36, %esp
movl $3, -8(%ebp)
movl $0, -12(%ebp)
addl $1, -8(%ebp)
movl -8(%ebp), %eax
movl %eax, %edx
imull -8(%ebp), %edx
subl $1, -8(%ebp)
movl -8(%ebp), %eax
imull -8(%ebp), %eax
leal (%edx,%eax), %eax
movl %eax, -12(%ebp)
addl $1, -8(%ebp)
subl $1, -8(%ebp)
movl -12(%ebp), %eax
movl %eax, 4(%esp)
movl $.LC0, (%esp)
call printf
addl $36, %esp
popl %ecx
popl %ebp
leal -4(%ecx), %esp
ret
.size main, .-main
.ident "GCC: (Ubuntu 4.3.3-5ubuntu4) 4.3.3"
.section .note.GNU-stack,"",@progbits

2009-08-07 17:43
2009-08-07 17:43
2009-08-07 17:44
2009-08-07 17:46
2009-08-07 17:46