C + + Disassembly instance (1)-Output multiple lines

Source: Internet
Author: User

111

1 //Program Description: Output multi-line content, the content is as follows2 /*3    *4   ***5  *****6 *******7  *****8   ***9    *Ten */ One#include <iostream> A using namespacestd; - intMain () - { thecout <<"   *"<<Endl; -cout <<"  ***"<<Endl; -cout <<" *****"<<Endl; -cout <<"*******"<<Endl; +cout <<" *****"<<Endl; -cout <<"  ***"<<Endl; +cout <<"   *"<<Endl; ASystem"Pause"); at     return 0; -}

Debug version of Disassembly code

intMain () {00f55e70 push ebp //Enter function after first thing, save stack bottom pointer ebp, Exit function when restore stack bottom 00f55e71 mov ebp,esp //adjust stack bottom finger Pin to stack top 00f55e73 sub esp,0c0h //For local variable request space 00f55e79 push ebx 00f55e7a push esi 00f55e7 B push EDI //Register press stack, save site 00f55e7c Lea EDI,[EBP-0c0h] //will place the initial address (offset) of the space requested for the local variable into EDI 00f55e82 mov ecx,30h //Set Rep stos cycle times 00f55e87 mov EAX,0CCCCCCCCH //debug, for debugging convenience, local variables are initialized to OCCCCCCCCH. 00f55e8c Rep stos dword ptr Es:[edi] //With the value of eax initialized to Es:[edi] points to the address, in DWORD (4 bytes), the number of cycles is ECX value. cout<<"   *"<<endl;00f55e8e mov esi,esp 00f55e90 push 0f513deh 00f55e95 push 0f5cc70h 00f55e9a mov Eax,dword PTR ds:[00f6009ch] 00f55e9f push eax 00f55ea0 call std::operator<<<std::char_traits<Char> >(0f512a8h) //Call the member function of the cout object operator<< (overloaded operator <<). 00f55ea5 add ESP,800F55EA8 mov ecx,eax 00F55EAA call dword ptr ds:[0f60090h] 00f55eb0 cmp esi,esp 00F55EB 2 Call __rtc_checkesp (0F5132FH) //debug a function that detects stack balance and uses it when all functions exit. cout<<"  ***"<<Endl;...............................................................................................system ("Pause"); 00F55FAD mov esi,esp 00F55FAF push 0f5cc94h 00f55fb4 call DWORD ptr ds:[0f601d0h] 00f55f BA add ESP,400F55FBD cmp esi,esp 00F55FBF call __RTC_CHECKESP (0F5132FH)return 0; 00f55fc4 xor eax,eax}00f55fc6 pop edi 00f55fc7 pop esi 00f55fc8 pop ebx  Recovery site. 00f55fc9 Add esp,0c0h // the function calling convention for C/s + + is _cdecl called by default, and the balance stack is placed by the call. 

Restore the stack bottom pointer

Release release disassembly code

C + + Disassembly instance (1)-Output multiple lines

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.