; ; +-------------------------------------------------------------------------+ ; ¦ This file is generated by The Interactive Disassembler (IDA) ¦ ; ¦ Copyright (c) 2005 by DataRescue sa/nv, <ida@datarescue.com> ¦ ; ¦ Licensed to: Sebastian Porst, 1 user std, 05/2005 ¦ ; +-------------------------------------------------------------------------+ ; .text:00401020 .text:00401020 ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ .text:00401020 .text:00401020 .text:00401020 sub_401020 proc near ; CODE XREF: _main+4p .text:00401020 .text:00401020 arg_0 = dword ptr 4 .text:00401020 arg_4 = dword ptr 8 .text:00401020 .text:00401020 mov ecx, [esp+arg_4] .text:00401024 push ebx .text:00401025 push ebp .text:00401026 push esi .text:00401027 xor eax, eax .text:00401029 push edi .text:0040102A mov edi, [esp+10h+arg_0] .text:0040102E mov dword ptr [edi+8], 0 .text:00401035 mov dl, [ecx+1] .text:00401038 movzx ebx, byte ptr [ecx+3] .text:0040103C mov al, dl .text:0040103E and dl, 0F0h .text:00401041 shr ebx, 6 .text:00401044 shr eax, 3 .text:00401047 and eax, 1 .text:0040104A mov ebp, eax .text:0040104C movzx eax, byte ptr [ecx+2] .text:00401050 mov esi, eax .text:00401052 mov [esp+10h+arg_0], ebp .text:00401056 shr eax, 4 .text:00401059 shl ebp, 4 .text:0040105C add eax, ebp .text:0040105E mov eax, ds:dword_4050D8[eax*4] .text:00401065 mov ebp, [esp+10h+arg_0] .text:00401069 shr esi, 2 .text:0040106C and esi, 3 .text:0040106F cmp dl, 0E0h .text:00401072 mov [esp+10h+arg_4], eax .text:00401076 jnz short loc_401081 .text:00401078 mov edx, ds:dword_4051B8[esi*4] .text:0040107F jmp short loc_40108B .text:00401081 ; --------------------------------------------------------------------------- .text:00401081 .text:00401081 loc_401081: ; CODE XREF: sub_401020+56j .text:00401081 lea eax, [esi+ebp*4] .text:00401084 mov edx, ds:dword_405198[eax*4] .text:0040108B .text:0040108B loc_40108B: ; CODE XREF: sub_401020+5Fj .text:0040108B test ebp, ebp .text:0040108D mov [edi+4], edx .text:00401090 jz short loc_40109C .text:00401092 cmp ebx, 3 .text:00401095 jz short loc_4010A1 .text:00401097 add ecx, 24h .text:0040109A jmp short loc_4010A9 .text:0040109C ; --------------------------------------------------------------------------- .text:0040109C .text:0040109C loc_40109C: ; CODE XREF: sub_401020+70j .text:0040109C cmp ebx, 3 .text:0040109F jz short loc_4010A6 .text:004010A1 .text:004010A1 loc_4010A1: ; CODE XREF: sub_401020+75j .text:004010A1 add ecx, 15h .text:004010A4 jmp short loc_4010A9 .text:004010A6 ; --------------------------------------------------------------------------- .text:004010A6 .text:004010A6 loc_4010A6: ; CODE XREF: sub_401020+7Fj .text:004010A6 add ecx, 0Dh .text:004010A9 .text:004010A9 loc_4010A9: ; CODE XREF: sub_401020+7Aj .text:004010A9 ; sub_401020+84j .text:004010A9 mov al, [ecx] .text:004010AB cmp al, 58h .text:004010AD jz short loc_4010B3 .text:004010AF cmp al, 49h .text:004010B1 jnz short loc_4010D4 .text:004010B3 .text:004010B3 loc_4010B3: ; CODE XREF: sub_401020+8Dj .text:004010B3 mov al, [ecx+1] .text:004010B6 cmp al, 69h .text:004010B8 jz short loc_4010BE .text:004010BA cmp al, 6Eh .text:004010BC jnz short loc_4010D4 .text:004010BE .text:004010BE loc_4010BE: ; CODE XREF: sub_401020+98j .text:004010BE mov al, [ecx+2] .text:004010C1 cmp al, 6Eh .text:004010C3 jz short loc_4010C9 .text:004010C5 cmp al, 66h .text:004010C7 jnz short loc_4010D4 .text:004010C9 .text:004010C9 loc_4010C9: ; CODE XREF: sub_401020+A3j .text:004010C9 mov al, [ecx+3] .text:004010CC cmp al, 67h .text:004010CE jz short loc_4010DB .text:004010D0 cmp al, 6Fh .text:004010D2 jz short loc_4010DB .text:004010D4 .text:004010D4 loc_4010D4: ; CODE XREF: sub_401020+91j .text:004010D4 ; sub_401020+9Cj ... .text:004010D4 pop edi .text:004010D5 pop esi .text:004010D6 pop ebp .text:004010D7 xor eax, eax .text:004010D9 pop ebx .text:004010DA retn .text:004010DB ; --------------------------------------------------------------------------- .text:004010DB .text:004010DB loc_4010DB: ; CODE XREF: sub_401020+AEj .text:004010DB ; sub_401020+B2j .text:004010DB xor edx, edx .text:004010DD add ecx, 4 .text:004010E0 mov [edi], ebp .text:004010E2 mov dh, [ecx] .text:004010E4 movzx eax, byte ptr [ecx+2] .text:004010E8 add ecx, 4 .text:004010EB mov dl, [ecx-3] .text:004010EE shl edx, 8 .text:004010F1 or edx, eax .text:004010F3 movzx eax, byte ptr [ecx-1] .text:004010F7 shl edx, 8 .text:004010FA or edx, eax .text:004010FC test dl, 1 .text:004010FF mov [edi+8], edx .text:00401102 jz short loc_401123 .text:00401104 movzx esi, byte ptr [ecx+2] .text:00401108 xor eax, eax .text:0040110A mov ah, [ecx] .text:0040110C mov al, [ecx+1] .text:0040110F shl eax, 8 .text:00401112 or eax, esi .text:00401114 movzx esi, byte ptr [ecx+3] .text:00401118 shl eax, 8 .text:0040111B or eax, esi .text:0040111D mov [edi+0Ch], eax .text:00401120 add ecx, 4 .text:00401123 .text:00401123 loc_401123: ; CODE XREF: sub_401020+E2j .text:00401123 test dl, 2 .text:00401126 jz short loc_401147 .text:00401128 movzx esi, byte ptr [ecx+2] .text:0040112C xor eax, eax .text:0040112E mov ah, [ecx] .text:00401130 mov al, [ecx+1] .text:00401133 shl eax, 8 .text:00401136 or eax, esi .text:00401138 movzx esi, byte ptr [ecx+3] .text:0040113C shl eax, 8 .text:0040113F or eax, esi .text:00401141 mov [edi+10h], eax .text:00401144 add ecx, 4 .text:00401147 .text:00401147 loc_401147: ; CODE XREF: sub_401020+106j .text:00401147 test dl, 4 .text:0040114A jz short loc_401164 .text:0040114C lea esi, [edi+18h] .text:0040114F test esi, esi .text:00401151 jz short loc_401161 .text:00401153 xor eax, eax .text:00401155 .text:00401155 loc_401155: ; CODE XREF: sub_401020+13Fj .text:00401155 mov bl, [eax+ecx] .text:00401158 mov [esi+eax], bl .text:0040115B inc eax .text:0040115C cmp eax, 64h .text:0040115F jl short loc_401155 .text:00401161 .text:00401161 loc_401161: ; CODE XREF: sub_401020+131j .text:00401161 add ecx, 64h .text:00401164 .text:00401164 loc_401164: ; CODE XREF: sub_401020+12Aj .text:00401164 test dl, 8 .text:00401167 mov dword ptr [edi+14h], 0FFFFFFFFh .text:0040116E jz short loc_40118F .text:00401170 movzx eax, byte ptr [ecx+2] .text:00401174 xor edx, edx .text:00401176 mov dh, [ecx] .text:00401178 mov dl, [ecx+1] .text:0040117B shl edx, 8 .text:0040117E or edx, eax .text:00401180 movzx eax, byte ptr [ecx+3] .text:00401184 shl edx, 8 .text:00401187 or edx, eax .text:00401189 mov [edi+14h], edx .text:0040118C add ecx, 4 .text:0040118F .text:0040118F loc_40118F: ; CODE XREF: sub_401020+14Ej .text:0040118F lea eax, [ebp+1] .text:00401192 imul eax, [esp+10h+arg_4] .text:00401197 imul eax, 11940h .text:0040119D cdq .text:0040119E idiv dword ptr [edi+4] .text:004011A1 add ecx, 15h .text:004011A4 mov [edi+7Ch], eax .text:004011A7 movzx eax, byte ptr [ecx+1] .text:004011AB movzx esi, byte ptr [ecx] .text:004011AE movzx ecx, byte ptr [ecx+2] .text:004011B2 mov edx, eax .text:004011B4 and eax, 0Fh .text:004011B7 shr edx, 4 .text:004011BA shl esi, 4 .text:004011BD shl eax, 8 .text:004011C0 add edx, esi .text:004011C2 add eax, ecx .text:004011C4 test edx, edx .text:004011C6 jl short loc_4011D0 .text:004011C8 cmp edx, 0BB8h .text:004011CE jle short loc_4011D3 .text:004011D0 .text:004011D0 loc_4011D0: ; CODE XREF: sub_401020+1A6j .text:004011D0 or edx, 0FFFFFFFFh .text:004011D3 .text:004011D3 loc_4011D3: ; CODE XREF: sub_401020+1AEj .text:004011D3 test eax, eax .text:004011D5 jl short loc_4011DE .text:004011D7 cmp eax, 0BB8h .text:004011DC jle short loc_4011E1 .text:004011DE .text:004011DE loc_4011DE: ; CODE XREF: sub_401020+1B5j .text:004011DE or eax, 0FFFFFFFFh .text:004011E1 .text:004011E1 loc_4011E1: ; CODE XREF: sub_401020+1BCj .text:004011E1 mov [edi+84h], eax .text:004011E7 mov [edi+80h], edx .text:004011ED pop edi .text:004011EE pop esi .text:004011EF pop ebp .text:004011F0 mov eax, 1 .text:004011F5 pop ebx .text:004011F6 retn .text:004011F6 sub_401020 endp .text:004011F6 .text:004011F6 ; ---------------------------------------------------------------------------