I wrote a statement in visual studio.
int sum(int a, int b){
return a + b;
}
int main(){
tong(3,4);
return 0;
}
And aften i use ida pro Disassembly it. And my function tong has registers, such as: esi, edi, that i think them willn't be used, i think it use only registers: eax, ebp, esp. Why does ida use them?
.text:004113C0 ; int __cdecl tong(int a, int b)
.text:004113C0 ?tong@@YAHHH@Z proc near ; CODE XREF: tong(int,int)j
.text:004113C0
.text:004113C0 var_C0 = byte ptr -0C0h
.text:004113C0 a = dword ptr 8
.text:004113C0 b = dword ptr 0Ch
.text:004113C0
.text:004113C0 push ebp
.text:004113C1 mov ebp, esp
.text:004113C3 sub esp, 0C0h
.text:004113C9 push ebx
.text:004113CA push esi
.text:004113CB push edi
.text:004113CC lea edi, [ebp+var_C0]
.text:004113D2 mov ecx, 30h
.text:004113D7 mov eax, 0CCCCCCCCh
.text:004113DC rep stosd
.text:004113DE mov eax, [ebp+a]
.text:004113E1 add eax, [ebp+b]
.text:004113E4 pop edi
.text:004113E5 pop esi
.text:004113E6 pop ebx
.text:004113E7 mov esp, ebp
.text:004113E9 pop ebp
.text:004113EA retn
.text:004113EA ?tong@@YAHHH@Z endp
Can anyone explain their meaning?
UPDATE 1
.text:00411400 ; int __cdecl main()
.text:00411400 _main proc near ; CODE XREF: j__mainj
.text:00411400
.text:00411400 var_C0 = byte ptr -0C0h
.text:00411400
.text:00411400 push ebp
.text:00411401 mov ebp, esp
.text:00411403 sub esp, 0C0h
.text:00411409 push ebx
.text:0041140A push esi
.text:0041140B push edi
.text:0041140C lea edi, [ebp+var_C0]
.text:00411412 mov ecx, 30h
.text:00411417 mov eax, 0CCCCCCCCh
.text:0041141C rep stosd
.text:0041141E push 4 ; b
.text:00411420 push 3 ; a
.text:00411422 call j_?tong@@YAHHH@Z ; tong(int,int)
.text:00411427 add esp, 8
.text:0041142A xor eax, eax
.text:0041142C pop edi
.text:0041142D pop esi
.text:0041142E pop ebx
.text:0041142F add esp, 0C0h
.text:00411435 cmp ebp, esp
.text:00411437 call j___RTC_CheckEsp
.text:0041143C mov esp, ebp
.text:0041143E pop ebp
.text:0041143F retn
.text:0041143F _main endp