Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - Please explain the above assembly code in detail.
Please explain the above assembly code in detail.

5: #include ; header file

6: #include ; header file

7: int main( void); Main function without type parameters, the return value is an integer

8: {

00401010 push ebp; ebp is pushed onto the stack

00401011 mov ebp,esp; Send esp content to ebp

00401013 sub esp,40h; esp=esp-40H

00401016 push ebx; ebx push into stack

00401017 push esi; esi into stack

00401018 push edi; push edi onto the stack

00401019 lea edi,[ebp-40h]; edi=ebp-40h

0040101C mov ecx,10h; ecx=10h

00401021 mov eax,0CCCCCCCh; eax=CCCCCCCCH

00401026 rep stos dword ptr [edi]; Initialize the area pointed to by edi

to CCCCCCCh ;That is, define edi as a pointer function of

12h*4 bytes.

9: printf("hello word"); //Output hello word (the following 5 sentences are all input

disassembly of hello word)

00401028 push offset string "hello word" (0042201c)

0040102D call printf (00401060)

00401032 add esp,4

10: getch();< /p>

00401035 call _getch (0040d700)

11: return 0; //No return value

0040103A xor eax,eax; assign eax a value of 0

12: }

0040103C pop edi; edi pops

0040103D pop esi; esi pops

0040103E pop ebx; ebx pops

p>

0040103F add esp,40h; esp=esp+40h

00401042 cmp ebp,esp; Compare the contents in ebp and esp, that is, ebp-esp

Then affect PSW The value in esp

00401044 call __chkesp (004010e0); call _chkesp

00401049 mov esp,ebp; send the value in ebp to esp

0040104B pop ebp; ebp pops out of the stack

0040104C ret; returns