C语言冒泡算法汇编解读

C语言 码拜 6年前 (2015-07-10) 387次浏览 0个评论

3:    void _sort(int arr[], int n ) {
004010B0   push        ebp
004010B1   mov         ebp,esp
004010B3   sub         esp,50h
004010B6   push        ebx
004010B7   push        esi
004010B8   push        edi
004010B9   lea         edi,[ebp-50h]
004010BC   mov         ecx,14h
004010C1   mov         eax,0CCCCCCCCh
004010C6   rep stos    dword ptr [edi]
4:        int len =   n,
004010C8   mov         eax,dword ptr [ebp+0Ch]
004010CB   mov         dword ptr [ebp-4],eax
5:            _i  =   0,
004010CE   mov         dword ptr [ebp-8],0
6:            _j  =   0,
004010D5   mov         dword ptr [ebp-0Ch],0
7:            _t  =   0;
004010DC   mov         dword ptr [ebp-10h],0
8:    //  len =   sizeof(arr) / sizeof(int);
9:        for(_i ; _i < len; _i++)  {
004010E3   jmp         _sort+3Eh (004010ee)
004010E5   mov         ecx,dword ptr [ebp-8]
004010E8   add         ecx,1
004010EB   mov         dword ptr [ebp-8],ecx
004010EE   mov         edx,dword ptr [ebp-8]
004010F1   cmp         edx,dword ptr [ebp-4]
004010F4   jge         _sort+0A1h (00401151)
10:           for(_j = _i; _j < len; _j++) {
004010F6   mov         eax,dword ptr [ebp-8]
004010F9   mov         dword ptr [ebp-0Ch],eax
004010FC   jmp         _sort+57h (00401107)
004010FE   mov         ecx,dword ptr [ebp-0Ch]
00401101   add         ecx,1
00401104   mov         dword ptr [ebp-0Ch],ecx
00401107   mov         edx,dword ptr [ebp-0Ch]
0040110A   cmp         edx,dword ptr [ebp-4]
0040110D   jge         _sort+9Fh (0040114f)
11:               if (arr[_i] > arr[_j]) {
0040110F   mov         eax,dword ptr [ebp-8]
00401112   mov         ecx,dword ptr [ebp+8]
00401115   mov         edx,dword ptr [ebp-0Ch]
00401118   mov         esi,dword ptr [ebp+8]
0040111B   mov         eax,dword ptr [ecx+eax*4]
0040111E   cmp         eax,dword ptr [esi+edx*4]
00401121   jle         _sort+9Dh (0040114d)
12:                   _t = arr[_j];
00401123   mov         ecx,dword ptr [ebp-0Ch]
00401126   mov         edx,dword ptr [ebp+8]
00401129   mov         eax,dword ptr [edx+ecx*4]
0040112C   mov         dword ptr [ebp-10h],eax
13:                   arr[_j] =   arr[_i];
0040112F   mov         ecx,dword ptr [ebp-0Ch]
00401132   mov         edx,dword ptr [ebp+8]
00401135   mov         eax,dword ptr [ebp-8]
00401138   mov         esi,dword ptr [ebp+8]
0040113B   mov         eax,dword ptr [esi+eax*4]
0040113E   mov         dword ptr [edx+ecx*4],eax
14:                   arr[_i] =   _t;
00401141   mov         ecx,dword ptr [ebp-8]
00401144   mov         edx,dword ptr [ebp+8]
00401147   mov         eax,dword ptr [ebp-10h]
0040114A   mov         dword ptr [edx+ecx*4],eax
15:               }
16:           }
0040114D   jmp         _sort+4Eh (004010fe)
17:       }
0040114F   jmp         _sort+35h (004010e5)
18:       //return ;
19:   }

请各位大礼告知如何解读汇编代码。

20分

《The Intel 64 and IA-32 Architectures Software Developer””s Manual》

20分

上面有c还要看汇编

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明C语言冒泡算法汇编解读
喜欢 (0)
[1034331897@qq.com]
分享 (0)

文章评论已关闭!