Created
March 20, 2019 10:18
-
-
Save nabeen/bce1a1afef31037dd8c3dc95870d5a91 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int calc(int a, int b) | |
{ | |
return a + b; | |
} | |
int main(void) | |
{ | |
int a = 1; | |
int b = 2; | |
int num = calc(a, b); | |
printf("%d", num); | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
./calc.o: ファイル形式 mach-o-x86-64 | |
セクション .text の逆アセンブル: | |
0000000000000000 <_calc>: | |
#include <stdio.h> | |
int calc(int a, int b) | |
{ | |
0: 55 push rbp | |
1: 48 89 e5 mov rbp,rsp | |
4: 89 7d fc mov DWORD PTR [rbp-0x4],edi | |
7: 89 75 f8 mov DWORD PTR [rbp-0x8],esi | |
return a + b; | |
a: 8b 75 fc mov esi,DWORD PTR [rbp-0x4] | |
d: 03 75 f8 add esi,DWORD PTR [rbp-0x8] | |
10: 89 f0 mov eax,esi | |
12: 5d pop rbp | |
13: c3 ret | |
14: 66 66 66 2e 0f 1f 84 data16 data16 nop WORD PTR cs:[rax+rax*1+0x0] | |
1b: 00 00 00 00 00 | |
0000000000000020 <_main>: | |
} | |
int main(void) | |
{ | |
20: 55 push rbp | |
21: 48 89 e5 mov rbp,rsp | |
24: 48 83 ec 20 sub rsp,0x20 | |
28: c7 45 fc 00 00 00 00 mov DWORD PTR [rbp-0x4],0x0 | |
int a = 1; | |
2f: c7 45 f8 01 00 00 00 mov DWORD PTR [rbp-0x8],0x1 | |
int b = 2; | |
36: c7 45 f4 02 00 00 00 mov DWORD PTR [rbp-0xc],0x2 | |
int num = calc(a, b); | |
3d: 8b 7d f8 mov edi,DWORD PTR [rbp-0x8] | |
40: 8b 75 f4 mov esi,DWORD PTR [rbp-0xc] | |
43: e8 00 00 00 00 call 48 <_main+0x28> | |
48: 48 8d 3d 1a 00 00 00 lea rdi,[rip+0x1a] # 69 <_main+0x49> | |
4f: 89 45 f0 mov DWORD PTR [rbp-0x10],eax | |
printf("%d", num); | |
52: 8b 75 f0 mov esi,DWORD PTR [rbp-0x10] | |
55: b0 00 mov al,0x0 | |
57: e8 00 00 00 00 call 5c <_main+0x3c> | |
5c: 31 f6 xor esi,esi | |
return 0; | |
5e: 89 45 ec mov DWORD PTR [rbp-0x14],eax | |
61: 89 f0 mov eax,esi | |
63: 48 83 c4 20 add rsp,0x20 | |
67: 5d pop rbp | |
68: c3 ret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main(void) | |
{ | |
printf("hello world."); | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
./hello.o: ファイル形式 mach-o-x86-64 | |
セクション .text の逆アセンブル: | |
0000000000000000 <_main>: | |
#include <stdio.h> | |
int main(void) | |
{ | |
0: 55 push rbp | |
1: 48 89 e5 mov rbp,rsp | |
4: 48 83 ec 10 sub rsp,0x10 | |
8: 48 8d 3d 1b 00 00 00 lea rdi,[rip+0x1b] # 2a <_main+0x2a> | |
f: c7 45 fc 00 00 00 00 mov DWORD PTR [rbp-0x4],0x0 | |
printf("hello world."); | |
16: b0 00 mov al,0x0 | |
18: e8 00 00 00 00 call 1d <_main+0x1d> | |
1d: 31 c9 xor ecx,ecx | |
return 0; | |
1f: 89 45 f8 mov DWORD PTR [rbp-0x8],eax | |
22: 89 c8 mov eax,ecx | |
24: 48 83 c4 10 add rsp,0x10 | |
28: 5d pop rbp | |
29: c3 ret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main(void) | |
{ | |
int a = 1; | |
if (a > 0) | |
{ | |
printf("Positive."); | |
} | |
else if (a == 0) | |
{ | |
printf("Zero."); | |
} | |
else | |
{ | |
printf("Negative."); | |
} | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
./if.o: ファイル形式 mach-o-x86-64 | |
セクション .text の逆アセンブル: | |
0000000000000000 <_main>: | |
#include <stdio.h> | |
int main(void) | |
{ | |
0: 55 push rbp | |
1: 48 89 e5 mov rbp,rsp | |
4: 48 83 ec 20 sub rsp,0x20 | |
8: c7 45 fc 00 00 00 00 mov DWORD PTR [rbp-0x4],0x0 | |
int a = 1; | |
f: c7 45 f8 01 00 00 00 mov DWORD PTR [rbp-0x8],0x1 | |
if (a > 0) | |
16: 83 7d f8 00 cmp DWORD PTR [rbp-0x8],0x0 | |
1a: 0f 8e 16 00 00 00 jle 36 <_main+0x36> | |
20: 48 8d 3d 4d 00 00 00 lea rdi,[rip+0x4d] # 74 <_main+0x74> | |
{ | |
printf("Positive."); | |
27: b0 00 mov al,0x0 | |
29: e8 00 00 00 00 call 2e <_main+0x2e> | |
} | |
2e: 89 45 f4 mov DWORD PTR [rbp-0xc],eax | |
31: e9 36 00 00 00 jmp 6c <_main+0x6c> | |
else if (a == 0) | |
36: 83 7d f8 00 cmp DWORD PTR [rbp-0x8],0x0 | |
3a: 0f 85 16 00 00 00 jne 56 <_main+0x56> | |
40: 48 8d 3d 37 00 00 00 lea rdi,[rip+0x37] # 7e <_main+0x7e> | |
{ | |
printf("Zero."); | |
47: b0 00 mov al,0x0 | |
49: e8 00 00 00 00 call 4e <_main+0x4e> | |
} | |
4e: 89 45 f0 mov DWORD PTR [rbp-0x10],eax | |
51: e9 11 00 00 00 jmp 67 <_main+0x67> | |
56: 48 8d 3d 27 00 00 00 lea rdi,[rip+0x27] # 84 <_main+0x84> | |
else | |
{ | |
printf("Negative."); | |
5d: b0 00 mov al,0x0 | |
5f: e8 00 00 00 00 call 64 <_main+0x64> | |
64: 89 45 ec mov DWORD PTR [rbp-0x14],eax | |
67: e9 00 00 00 00 jmp 6c <_main+0x6c> | |
6c: 31 c0 xor eax,eax | |
} | |
return 0; | |
6e: 48 83 c4 20 add rsp,0x20 | |
72: 5d pop rbp | |
73: c3 ret |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment