debug
23: int nsum = 0;00a572ae c7 45 f8 00
0000
00mov dword ptr [nsum],0
24: int nindex = 0
;00a572b5 c7 45 ec 00
0000
00mov dword ptr [nindex],0
25: do
26: while(nindex <= ncount);
00a572ce 8b 45 ec mov
eax,dword ptr [nindex]
00a572d1 3b 45
08cmp
eax,dword ptr [ncount]//先執行迴圈體,後判斷
00a572d4 7e e6 jle
loopdo+2ch (0a572bch)
30: return nsum;
00a572d6 8b 45 f8 mov eax,dword ptr [nsum]
34: int nsum = 0;00a5738e c7 45 f8 00
0000
00mov dword ptr [nsum],0
35: int nindex = 0
;00a57395 c7 45 ec 00
0000
00mov dword ptr [nindex],0
36: while (nindex <= ncount)
00a5739c 8b 45 ec mov
eax,dword ptr [nindex]
00a5739f 3b 45
08cmp
eax,dword ptr [ncount] //先判斷,後迴圈
00a573a2 7f 14
jgloopwhile+48h (0a573b8h)
37:
00a573b6 eb e4 jmp
loopwhile+2ch (0a5739ch)
41: return nsum;
00a573b8 8b 45 f8 mov eax,dword ptr [nsum]
46: int nsum = 0;00a5731e c7 45 f8 00
0000
00mov dword ptr [nsum],0
47: for (int nindex = 0
;nindex <= ncount; ++nindex)
00a57325 c7 45 ec 00
0000
00mov dword ptr [ebp-14h],0
//先初始化計數器變數
00a5732c eb 09
jmploopfor+37h (0a57337h)
00a5732e 8b 45 ec mov
eax,dword ptr [ebp-14h]
00a57331
83 c0 01
add eax,1 //步長
00a57334
8945 ec mov
dword ptr [ebp-14h],eax
00a57337 8b 45 ec mov
eax,dword ptr [ebp-14h]
00a5733a 3b 45
08cmp
eax,dword ptr [ncount] //判斷迴圈條件
00a5733d 7f 0b
jgloopfor+4ah (0a5734ah)
48:
00a57348 eb e4 jmp
loopfor+2eh (0a5732eh)
51: return nsum;
00a5734a 8b 45 f8 mov eax,dword ptr [nsum]
release
int gotodo(int ncount)
return nsum;
}printf("%d \r\n", gotodo(5));
00d01143 | 33c9 | xor ecx,ecx | looptype.cpp:int loopdo(int ncount)8300d01145 | 33c0 | xor
eax,eax |
00d01147 | 03c8 | add
ecx,eax |
00d01149 | 40 | inc
eax |
00d0114a | 83f8 05 | cmp
eax,0x5 |
00d0114d | 7e f8 | jle
looptype.d01147 |
00d0114f | 51 | push
ecx |
00d01150 | 68 9401d400 | push looptype.d40194 | d40194:
"%d \r\n
"00d01155 | e8 76000000 | call
|00d0115a | 83c4 08 | add
esp,0x8 |
while(nindex <= ncount);
return nsum;
}printf("%d \r\n", loopdo(5));
00d0115d | 33c9 | xor ecx,ecx | looptype.cpp:// 強度降低8400d0115f | 33c0 | xor
eax,eax |
00d01161 | 03c8 | add
ecx,eax |
00d01163 | 40 | inc
eax |
00d01164 | 83f8 05 | cmp
eax,0x5 |
00d01167 | 7e f8 | jle
looptype.d01161 |
00d01169 | 51 | push
ecx |
00d0116a | 68 9401d400 | push looptype.d40194 | d40194:
"%d \r\n
"00d0116f | e8 5c000000 | call
|
void dorate(int argc)
printf("%d", t);
00d011a6 | 8b55 08 | mov edx,dword ptr ss:[eb | looptype.cpp:8800d011a9 | 83c4 08 | add esp,0x8 | looptype.cpp:
8700d011ac | 33c9 | xor ecx,ecx |
00d011ae | 85d2 | test
edx,edx |//while優化為do···while結構,新增乙個判斷
00d011b0 | 7e 0b | jle
looptype.d011bd |
00d011b2 | 33c0 | xor eax,eax |
00d011b4 | 8bc8 | mov ecx,eax |
00d011b6 | 83c0 63 | add
eax,0x63 |迴圈體, *99優化為+99
00d011b9 | 3bca | cmp
ecx,edx |
00d011bb | 7c f7 |jl
looptype.d011b4 |
00d011bd | 51 | push
ecx |
00d011be | 68 9001d400 | push looptype.d40190 | d40190:"%d
"00d011c3 | e8 08000000 | call
|00d011c8 | 83c4 08 | add esp,0x8 |
反彙編 迴圈
includeint main 00401010 55 push ebp 00401011 8bec mov ebp,esp 00401013 83ec 44 sub esp,44 00401016 53 push ebx 00401017 56 push esi 00401018 57 push ...
C語言反彙編
這裡使用的是keil4軟體,將編寫的c語言程式彙編成組合語言。這裡只用最簡單的c語言做了一下參考,所舉的例子是最簡單的,只能用於了解一下彙編的表達方式。如圖所示,條件判斷語句的彙編語句表達是賦值後與進行異或比較,再判斷是否進行跳轉。將立即數03賦值給累加器a,然後將累加器a的值與立即數05進行異或 ...
C 反彙編 if語句分析
include void main std cout hello world 7?1 4 if b 1 std cout b equal 1 判斷語句有幾種 1.條件表示式 表示式1?表示式2 表示式3 2.if語句 3.switch語句 首先來分析if語句吧 debug版 0040117d 68 ...