intel 64bitgcc a.c -O3
Code:
00000000004004b0 <test>:
4004b0: 8d 47 01 lea 0x1(%rdi),%eax
4004b3: 89 05 6f 0b 20 00 mov %eax,0x200b6f(%rip) # 601028 <global>
4004b9: c3 retq
4004ba: 66 0f 1f 44 00 00 nopw 0x0(%rax,%rax,1)
gcc a.c -O3 -fPIC
Code:
0000000000400500 <test>:
400500: 48 8b 15 d9 0a 20 00 mov 0x200ad9(%rip),%rdx # 600fe0 <_DYNAMIC+0x1a8>
400507: 8d 47 01 lea 0x1(%rdi),%eax
40050a: 89 02 mov %eax,(%rdx)
40050c: c3 retq
40050d: 0f 1f 00 nopl (%rax)
btw, without optimization : gcc a.out
Code:
00000000004004ac <test>:
4004ac: 55 push %rbp
4004ad: 48 89 e5 mov %rsp,%rbp
4004b0: 89 7d fc mov %edi,-0x4(%rbp)
4004b3: 8b 45 fc mov -0x4(%rbp),%eax
4004b6: 89 05 6c 0b 20 00 mov %eax,0x200b6c(%rip) # 601028 <global>
4004bc: 8b 05 66 0b 20 00 mov 0x200b66(%rip),%eax # 601028 <global>
4004c2: 83 c0 01 add $0x1,%eax
4004c5: 89 05 5d 0b 20 00 mov %eax,0x200b5d(%rip) # 601028 <global>
4004cb: 8b 05 57 0b 20 00 mov 0x200b57(%rip),%eax # 601028 <global>
4004d1: c9 leaveq
4004d2: c3 retq