c代码
int add(int x, int y)
{
return x + y;
}
int main()
{
int i = 3, j=4, k;
k = add(i, j);
printf("%d %d", j, k);
return 0;
}
对应汇编代码
int add(int x, int y)
{
00472050 push ebp
00472051 mov ebp,esp
00472053 sub esp,0C0h
00472059 push ebx
0047205A push esi
0047205B push edi
0047205C lea edi,[ebp-0C0h]
00472062 mov ecx,30h
00472067 mov eax,0CCCCCCCCh
0047206C rep stos dword ptr es:[edi]
0047206E mov ecx,offset _E4390A93_ConsoleApplication3@cpp (047C026h)
00472073 call @__CheckForDebuggerJustMyCode@4 (0471221h)
return x + y;
00472078 mov eax,dword ptr [x]
0047207B add eax,dword ptr [y]
}
0047207E pop edi
0047207F pop esi
}
00472080 pop ebx
00472081 add esp,0C0h
00472087 cmp ebp,esp
00472089 call __RTC_CheckEsp (047122Bh)
0047208E mov esp,ebp
00472090 pop ebp
00472091 ret
}
int main()
{
00471990 push ebp
00471991 mov ebp,esp
00471993 sub esp,0E4h
00471999 push ebx
0047199A push esi
0047199B push edi
0047199C lea edi,[ebp-0E4h]
004719A2 mov ecx,39h
004719A7 mov eax,0CCCCCCCCh
004719AC rep stos dword ptr es:[edi]
004719AE mov ecx,offset _E4390A93_ConsoleApplication3@cpp (047C026h)
004719B3 call @__CheckForDebuggerJustMyCode@4 (0471221h)
int i = 3, j=4, k;
004719B8 mov dword ptr [i],3
004719BF mov dword ptr [j],4
k = add(i, j);
004719C6 mov eax,dword ptr [j]
004719C9 push eax
004719CA mov ecx,dword ptr [i]
004719CD push ecx
004719CE call add (0471393h)
004719D3 add esp,8
004719D6 mov dword ptr [k],eax
printf("%d %d", j, k);
004719D9 mov eax,dword ptr [k]
004719DC push eax
004719DD mov ecx,dword ptr [j]
004719E0 push ecx
004719E1 push offset string "%d %d" (0477B30h)
004719E6 call _printf (0471046h)
004719EB add esp,0Ch
return 0;
004719EE xor eax,eax
}
004719F0 pop edi
004719F1 pop esi
004719F2 pop ebx
004719F3 add esp,0E4h
004719F9 cmp ebp,esp
004719FB call __RTC_CheckEsp (047122Bh)
00471A00 mov esp,ebp
00471A02 pop ebp
00471A03 ret
函数开始调用:
调用函数开始:
函数结束:
[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课