C++反汇编四(SWITCH语句)
来源:互联网 发布:剪歌拼歌软件 编辑:程序博客网 时间:2024/05/29 14:41
004015D0 push ebp004015D1 mov ebp,esp004015D3 sub esp,48h004015D6 push ebx004015D7 push esi004015D8 push edi004015D9 lea edi,[ebp-48h]004015DC mov ecx,12h004015E1 mov eax,0CCCCCCCCh004015E6 rep stos dword ptr [edi]// 初始化堆栈49: int x=5;004015E8 mov dword ptr [ebp-4],5// 局部变量ebp-4赋值550: switch (x)51: {004015EF mov eax,dword ptr [ebp-4]004015F2 mov dword ptr [ebp-8],eax// 拷贝局部变量004015F5 cmp dword ptr [ebp-8],0// 局部变量和0比较004015F9 je Grammer_switch+39h (00401609)// 相等则跳向case 0,否则继续和case 1 比较004015FB cmp dword ptr [ebp-8],1// 和1比较004015FF je Grammer_switch+59h (00401629)// 相等则跳向case 1,否则继续和case 2 比较00401601 cmp dword ptr [ebp-8],2// 和2比较00401605 je Grammer_switch+79h (00401649)// 相等则跳向case 2,否则继续和case 3 比较00401607 jmp Grammer_switch+99h (00401669)// 以上条件都不满足,则跳向default处52: case 0:53: {54: cout<<"x=0"<<endl;00401609 push offset @ILT+45(std::endl) (00401032)0040160E push offset string "x=0" (0043204c)00401613 push offset std::cout (00439528)00401618 call @ILT+175(std::operator<<) (004010b4)0040161D add esp,800401620 mov ecx,eax00401622 call @ILT+125(std::basic_ostream<char,std::char_traits<char> >::operator<<) (00401082)55: }56: break;00401627 jmp Grammer_switch+0B7h (00401687)//跳出switch语句57: case 1:58: {59: cout<<"x=1"<<endl;00401629 push offset @ILT+45(std::endl) (00401032)0040162E push offset string "x=1" (00432048)00401633 push offset std::cout (00439528)00401638 call @ILT+175(std::operator<<) (004010b4)0040163D add esp,800401640 mov ecx,eax00401642 call @ILT+125(std::basic_ostream<char,std::char_traits<char> >::operator<<) (00401082)60: }61: break;00401647 jmp Grammer_switch+0B7h (00401687)//跳出switch语句62: case 2:63: {64: cout<<"x=2"<<endl;00401649 push offset @ILT+45(std::endl) (00401032)0040164E push offset string "x=2" (00432044)00401653 push offset std::cout (00439528)00401658 call @ILT+175(std::operator<<) (004010b4)0040165D add esp,800401660 mov ecx,eax00401662 call @ILT+125(std::basic_ostream<char,std::char_traits<char> >::operator<<) (00401082)65: }66: break;00401667 jmp Grammer_switch+0B7h (00401687)//跳出switch语句67: default:68: {69: cout<<"x未知"<<endl;00401669 push offset @ILT+45(std::endl) (00401032)0040166E push offset string "x\xce\xb4\xd6\xaa" (0043203c)00401673 push offset std::cout (00439528)00401678 call @ILT+175(std::operator<<) (004010b4)0040167D add esp,800401680 mov ecx,eax00401682 call @ILT+125(std::basic_ostream<char,std::char_traits<char> >::operator<<) (00401082)70: }71: break;72: }73:74: }00401687 pop edi00401688 pop esi00401689 pop ebx0040168A add esp,48h0040168D cmp ebp,esp0040168F call __chkesp (004092e0)00401694 mov esp,ebp00401696 pop ebp00401697 ret