Âîéíà ìèðîâ - àññåìáëåð ïðîòèâ ñè

         

êëþ÷åâîé ôðàãìåíò äåìîíñòðàöèîííîé ïðîãðàììû CRC.c


Êîìïèëèðóåì åå Microsoft Visual C++ â ðåæèìå ìàêñèìàëüíîé îïòèìèçàöèè (êëþ÷ Ox — "cl.exe /Ox crc.c") è çàãðóæàåì ïîëó÷åííûé obj â äèçàññåìáëåð:

.text:00000000             _CRC   proc near

.text:00000000

.text:00000000             var_1  = dword ptr -1

.text:00000000             arg_0  = dword ptr  7

.text:00000000             arg_4  = dword ptr  0Bh

.text:00000000

.text:00000000 51          push   ecx

.text:00000001 8B 54 24 0C mov    edx, [esp+1+arg_4]

.text:00000005 32 C9       xor    cl, cl

.text:00000007 33 C0       xor    eax, eax

.text:00000009 88 4C 24 00 mov    byte ptr [esp+1+var_1], cl

.text:0000000D 85 D2       test   edx, edx



.text:0000000F 7E 16       jle    short loc_27

.text:00000011 53          push   ebx

.text:00000012 56          push   esi

.text:00000013 8B 74 24 10 mov    esi, [esp+9+arg_0]

.text:00000017

.text:00000017       loc_17:

.text:00000017 8A 1C 30    mov    bl, [eax+esi]

.text:0000001A 02 CB       add    cl, bl

.text:0000001C 40          inc    eax

.text:0000001D 3B C2       cmp    eax, edx

.text:0000001F 7C F6       jl     short loc_17

.text:00000021 5E          pop    esi

.text:00000022 88 4C 24 04 mov    byte ptr [esp+5+var_1], cl

.text:00000026 5B          pop    ebx

.text:00000027

.text:00000027       loc_27:

.text:00000027 8B 44 24 00 mov    eax, [esp+1+var_1]

.text:0000002B 25 FF 00 00+ and    eax, 0FFh

.text:00000030 F7 D8       neg    eax

.text:00000032 59          pop    ecx

.text:00000033 C3          retn

.text:00000033 _CRC  endp



Ñîäåðæàíèå ðàçäåëà