=================================================================== cis-lclient02:~/2012/intel64>more max.c int max(int a, int b); main () { int a, b; a = 5; b = 10; return max(a, b); } int max(int a, int b) { int x; x = a; if (b > a) x = b; return x; } =================================================================== cis-lclient02:~/2012/intel64>gcc -O0 -omax0.s -S max.c cis-lclient02:~/2012/intel64>more max0.s .file "max.c" .text .globl main .type main, @function main: pushl %ebp movl %esp, %ebp andl $-16, %esp subl $32, %esp movl $5, 24(%esp) movl $10, 28(%esp) movl 28(%esp), %eax movl %eax, 4(%esp) movl 24(%esp), %eax movl %eax, (%esp) call max leave ret .size main, .-main .globl max .type max, @function max: pushl %ebp movl %esp, %ebp subl $16, %esp movl 8(%ebp), %eax movl %eax, -4(%ebp) movl 12(%ebp), %eax cmpl 8(%ebp), %eax jle .L4 movl 12(%ebp), %eax movl %eax, -4(%ebp) .L4: movl -4(%ebp), %eax leave ret .size max, .-max .ident "GCC: (GNU) 4.4.4 20100630 (Red Hat 4.4.4-10)" .section .note.GNU-stack,"",@progbits =================================================================== cis-lclient02:~/2012/intel64>gcc -O1 -omax1.s -S max.c cis-lclient02:~/2012/intel64>more max1.s .file "max.c" .text .globl max .type max, @function max: pushl %ebp movl %esp, %ebp movl 8(%ebp), %eax movl 12(%ebp), %edx cmpl %eax, %edx cmovge %edx, %eax popl %ebp ret .size max, .-max .globl main .type main, @function main: pushl %ebp movl %esp, %ebp subl $8, %esp movl $10, 4(%esp) movl $5, (%esp) call max leave ret .size main, .-main .ident "GCC: (GNU) 4.4.4 20100630 (Red Hat 4.4.4-10)" .section .note.GNU-stack,"",@progbits =================================================================== cis-lclient02:~/2012/intel64>more max2.s .file "max.c" .text .p2align 4,,15 .globl main .type main, @function main: pushl %ebp movl $10, %eax movl %esp, %ebp popl %ebp ret .size main, .-main .p2align 4,,15 .globl max .type max, @function max: pushl %ebp movl %esp, %ebp movl 8(%ebp), %eax movl 12(%ebp), %edx popl %ebp cmpl %eax, %edx cmovge %edx, %eax ret .size max, .-max .ident "GCC: (GNU) 4.4.4 20100630 (Red Hat 4.4.4-10)" .section .note.GNU-stack,"",@progbits cis-lclient02:~/2012/intel64> =================================================================== cis-lclient02:~/2012/intel64>gcc -O3 -omax3.s -S max.c cis-lclient02:~/2012/intel64>more max3.s .file "max.c" .text .p2align 4,,15 .globl main .type main, @function main: pushl %ebp movl $10, %eax movl %esp, %ebp popl %ebp ret .size main, .-main .p2align 4,,15 .globl max .type max, @function max: pushl %ebp movl %esp, %ebp movl 8(%ebp), %eax movl 12(%ebp), %edx popl %ebp cmpl %eax, %edx cmovge %edx, %eax ret .size max, .-max .ident "GCC: (GNU) 4.4.4 20100630 (Red Hat 4.4.4-10)" .section .note.GNU-stack,"",@progbits cis-lclient02:~/2012/intel64> ===================================================================