int func1(int a, int b) { int x, y; x = a + b; y = 2*x - b; return x*y; } func1: pushl %ebp movl %esp,%ebp movl 12(%ebp),%eax movl 8(%ebp),%ecx addl %eax,%ecx leal (%ecx,%ecx),%edx subl %eax,%edx movl %ecx,%eax imull %edx,%eax movl %ebp,%esp popl %ebp ret Dump of assembler code for function func1: 0x8048420 : push %ebp 0x8048421 : mov %esp,%ebp 0x8048423 : mov 0xc(%ebp),%eax 0x8048426 : mov 0x8(%ebp),%ecx 0x8048429 : add %eax,%ecx 0x804842b : lea (%ecx,%ecx,1),%edx 0x804842e : sub %eax,%edx 0x8048430 : mov %ecx,%eax 0x8048432 : imul %edx,%eax 0x8048435 : mov %ebp,%esp 0x8048437 : pop %ebp 0x8048438 : ret 0x8048439 : lea 0x0(%esi),%esi End of assembler dump. int func2(int a, int b) { if(a>b) return a; else return b; } func2: pushl %ebp movl %esp,%ebp movl 8(%ebp),%edx movl 12(%ebp),%eax cmpl %eax,%edx jle .L21 movl %edx,%eax .L21: movl %ebp,%esp popl %ebp ret Dump of assembler code for function func2: 0x804843c : push %ebp 0x804843d : mov %esp,%ebp 0x804843f : mov 0x8(%ebp),%edx 0x8048442 : mov 0xc(%ebp),%eax 0x8048445 : cmp %eax,%edx 0x8048447 : jle 0x804844b 0x8048449 : mov %edx,%eax 0x804844b : mov %ebp,%esp 0x804844d : pop %ebp 0x804844e : ret 0x804844f : nop End of assembler dump. int func3(int a, int b) { int r = 0xDEADBEEF; switch(a) { case 0: r = a; break; case 1: r = b; break; case 2: r = a+b; break; case 3: r = a-b; break; case 4: r = a*b; break; } return r; } func3: pushl %ebp movl %esp,%ebp movl 8(%ebp),%edx movl 12(%ebp),%ecx movl $-559038737,%eax cmpl $4,%edx ja .L23 jmp *.L29(,%edx,4) .p2align 4,,7 .section .rodata .align 4 .align 4 .L29: .long .L24 .long .L25 .long .L26 .long .L27 .long .L28 .text .p2align 4,,7 .L24: movl %edx,%eax jmp .L23 .p2align 4,,7 .L25: movl %ecx,%eax jmp .L23 .p2align 4,,7 .L26: leal (%ecx,%edx),%eax jmp .L23 .p2align 4,,7 .L27: movl %edx,%eax subl %ecx,%eax jmp .L23 .p2align 4,,7 .L28: movl %edx,%eax imull %ecx,%eax .L23: movl %ebp,%esp popl %ebp ret Dump of assembler code for function func3: 0x8048450 : push %ebp 0x8048451 : mov %esp,%ebp 0x8048453 : mov 0x8(%ebp),%edx 0x8048456 : mov 0xc(%ebp),%ecx 0x8048459 : mov $0xdeadbeef,%eax 0x804845e : cmp $0x4,%edx 0x8048461 : ja 0x804848b 0x8048463 : jmp *0x8048578(,%edx,4) 0x804846a : lea 0x0(%esi),%esi 0x8048470 : mov %edx,%eax 0x8048472 : jmp 0x804848b 0x8048474 : mov %ecx,%eax 0x8048476 : jmp 0x804848b 0x8048478 : lea (%ecx,%edx,1),%eax 0x804847b : jmp 0x804848b 0x804847d : lea 0x0(%esi),%esi 0x8048480 : mov %edx,%eax 0x8048482 : sub %ecx,%eax 0x8048484 : jmp 0x804848b 0x8048486 : mov %edx,%eax 0x8048488 : imul %ecx,%eax 0x804848b : mov %ebp,%esp 0x804848d : pop %ebp 0x804848e : ret 0x804848f : nop End of assembler dump. Dump of assembler code for function func4: func4: pushl %ebp movl %esp,%ebp movl 8(%ebp),%ecx xorl %eax,%eax xorl %edx,%edx cmpl %ecx,%eax jge .L4 .L6: addl %edx,%eax incl %edx cmpl %ecx,%edx jl .L6 .L4: movl %ebp,%esp popl %ebp ret Dump of assembler code for function func4: 0x80483c0 : push %ebp 0x80483c1 : mov %esp,%ebp 0x80483c3 : mov 0x8(%ebp),%ecx 0x80483c6 : xor %eax,%eax 0x80483c8 : xor %edx,%edx 0x80483ca : cmp %ecx,%eax 0x80483cc : jge 0x80483d7 0x80483ce : mov %esi,%esi 0x80483d0 : add %edx,%eax 0x80483d2 : inc %edx 0x80483d3 : cmp %ecx,%edx 0x80483d5 : jl 0x80483d0 0x80483d7 : mov %ebp,%esp 0x80483d9 : pop %ebp 0x80483da : ret 0x80483db : nop End of assembler dump.