Function at 0x405640
Capabilities:
Read file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x3c
xor eax, eax
push ebx
mov ebx, dword [ebp + 8]
mov dword [ebp - 0x24], eax
mov dword [ebp - 0x20], eax
mov dword [ebp - 0x1c], eax
mov dword [ebp - 0x18], eax
mov dword [ebp - 0x38], eax
mov dword [ebp - 0x34], eax
mov dword [ebp - 0x30], eax
mov dword [ebp - 0x2c], eax
mov dword [ebp - 0x28], eax
mov dword [ebp - 0x14], eax
push esi
lea eax, [ebp - 4]
push edi
xor edi, edi
mov dword [ebp - 0x24], eax
lea ecx, [ebp - 8]
lea edx, [ebp - 0x10]
lea eax, [ebp - 0xc]
mov dword [ebp - 4], edi
mov dword [ebp - 8], edi
mov dword [ebp - 0x10], edi
mov dword [ebp - 0xc], edi
mov dword [ebp - 0x3c], edi
mov dword [ebp - 0x20], ecx
mov dword [ebp - 0x1c], edx
mov dword [ebp - 0x18], eax
cmp ebx, edi
je 0x405a3d
mov esi, dword [ebp + 0x18]
cmp esi, edi
je 0x405a3d
cmp dword [ebp + 0x1c], edi
je 0x405a3d
mov eax, dword [ebp + 0xc]
cmp eax, 0xffffffff
je 0x405a3d
cmp dword [esi + 0xc], 0x100
je 0x4056e0
mov eax, dword [ebp + 0x24]
cmp eax, edi
je 0x405a4a
pop edi
pop esi
mov dword [eax], 8
xor eax, eax
pop ebx
mov esp, ebp
pop ebp
ret
mov ecx, dword [esi + 4]
sub ecx, dword [ebp + 0x10]
push 2
push ecx
push eax
call dword [sym.imp.MSVCR100.dll__lseek]
add esp, 0xc
cmp eax, 0xffffffff
jne 0x40571e
mov eax, dword [ebp + 0x24]
cmp eax, edi
je 0x405705
mov dword [eax], 3
mov edx, dword [ebp + 0x28]
push edx
lea eax, [ebp - 0x3c]
push eax
call fcn.00404cd0
add esp, 8
pop edi
pop esi
xor eax, eax
pop ebx
mov esp, ebp
pop ebp
ret
mov edi, dword [sym.imp.MSVCR100.dll_malloc]
push 0xc
call edi
add esp, 4
mov dword [ebp - 4], eax
test eax, eax
jne 0x405758
mov eax, dword [ebp + 0x24]
test eax, eax
je 0x40573f
mov dword [eax], 3
mov ecx, dword [ebp + 0x28]
push ecx
lea edx, [ebp - 0x3c]
push edx
call fcn.00404cd0
add esp, 8
pop edi
pop esi
xor eax, eax
pop ebx
mov esp, ebp
pop ebp
ret
xor ecx, ecx
mov dword [eax], ecx
mov eax, dword [ebp - 4]
mov dword [eax + 4], ecx
mov al, byte [ebp + 0x14]
mov edx, dword [ebp - 4]
mov dword [edx + 8], ecx
cmp al, 0x42
jne 0x4057f5
mov eax, dword [esi + 0xc]
push eax
call edi
mov ecx, dword [ebp - 4]
mov dword [ecx], eax
mov eax, dword [ebp - 4]
add esp, 4
cmp dword [eax], 0
jne 0x405793
mov eax, dword [ebp + 0x24]
test eax, eax
jmp 0x4056fd
mov ecx, dword [esi + 0xc]
mov edx, dword [eax]
push ecx
push 0
push edx
call sub.MSVCR100.dll_memset
mov eax, dword [esi + 0xc]
mov ecx, dword [ebp - 4]
mov dword [ecx + 4], eax
mov edx, dword [esi + 0xc]
mov eax, dword [ebp - 4]
mov ecx, dword [eax]
push edx
mov edx, dword [ebp + 0xc]
push ecx
push edx
call dword [sym.imp.MSVCR100.dll__read]
add esp, 0x18
cmp eax, 0xffffffff
je 0x4057cf
cmp eax, dword [esi + 0xc]
je 0x4058d0
mov eax, dword [ebp + 0x24]
test eax, eax
je 0x4057dc
mov dword [eax], 0xd
mov eax, dword [ebp + 0x28]
push eax
lea ecx, [ebp - 0x3c]
push ecx
call fcn.00404cd0
add esp, 8
pop edi
pop esi
xor eax, eax
pop ebx
mov esp, ebp
pop ebp
ret
cmp al, 0x54
jne 0x405a17
push 0xc
call edi
add esp, 4
mov dword [ebp - 8], eax
test eax, eax
je 0x405789
xor ecx, ecx
mov dword [eax], ecx
mov edx, dword [ebp - 8]
mov dword [edx + 4], ecx
mov eax, dword [ebp - 8]
mov dword [eax + 8], ecx
mov ecx, dword [esi + 0xc]
mov edx, dword [ebp - 8]
add ecx, ecx
mov dword [edx + 4], ecx
mov esi, dword [ebp - 8]
mov eax, dword [esi + 4]
push eax
call edi
mov dword [esi], eax
mov eax, dword [ebp - 8]
add esp, 4
cmp dword [eax], 0
jne 0x405866
mov eax, dword [ebp + 0x24]
test eax, eax
je 0x40584d
mov dword [eax], 3
mov ecx, dword [ebp + 0x28]
push ecx
lea edx, [ebp - 0x3c]
push edx
call fcn.00404cd0
add esp, 8
pop edi
pop esi
xor eax, eax
pop ebx
mov esp, ebp
pop ebp
ret
mov ecx, dword [eax + 4]
mov edx, dword [eax]
push ecx
push 0
push edx
call sub.MSVCR100.dll_memset
mov eax, dword [ebp - 8]
mov ecx, dword [eax + 4]
mov edx, dword [eax]
mov eax, dword [ebp + 0xc]
push ecx
push edx
push eax
call dword [sym.imp.MSVCR100.dll__read]
add esp, 0x18
cmp eax, 0xffffffff
je 0x405a01
mov ecx, dword [ebp - 8]
cmp eax, dword [ecx + 4]
jne 0x405a01
mov esi, dword [ebp + 0x28]
mov edx, dword [ebp + 0x24]
mov eax, dword [ebp - 4]
push esi
push edx
push eax
push ecx
call fcn.004071b0
add esp, 0x10
test ax, ax
jne 0x4058d0
lea ecx, [ebp - 0x3c]
push esi
push ecx
call fcn.00404cd0
add esp, 8
pop edi
pop esi
xor eax, eax
pop ebx
mov esp, ebp
pop ebp
ret
mov edi, dword [ebp + 0x20]
lea esi, [edi*8]
push esi
call dword [sym.imp.MSVCR100.dll_malloc]
add esp, 4
mov dword [ebp - 0x10], eax
test eax, eax
je 0x405789
push esi
push 0
push eax
call sub.MSVCR100.dll_memset
push edi
call dword [sym.imp.MSVCR100.dll_malloc]
add esp, 0x10
mov dword [ebp - 0xc], eax
test eax, eax
je 0x405840
push edi
push 0
push eax
call sub.MSVCR100.dll_memset
mov edi, dword [ebp + 0x28]
mov eax, dword [ebp - 0x10]
mov ecx, dword [ebp + 0x1c]
mov edx, dword [ebp - 0xc]
push edi
push eax
mov eax, dword [ebp - 4]
push esi
push ecx
mov ecx, dword [eax]
push edx
push ecx
call fcn.00407310
mov eax, dword [ebp - 0xc]
mov edx, dword [eax]
mov dword [ebx], edx
mov cx, word [eax + 4]
add esp, 0x24
mov word [ebx + 4], cx
cmp dword [ebx], 0x49535641
jne 0x4059de
cmp cl, 0x47
jne 0x4059de
cmp byte [ebx + 5], 0x4e
jne 0x4059de
mov edx, dword [eax + 6]
mov dword [ebx + 8], edx
mov ecx, dword [eax + 0xa]
mov dword [ebx + 0xc], ecx
mov edx, dword [eax + 0xe]
mov dword [ebx + 0x10], edx
mov ecx, dword [eax + 0x12]
mov dword [ebx + 0x14], ecx
mov edx, dword [eax + 0x16]
mov dword [ebx + 0x18], edx
mov ecx, dword [eax + 0x1a]
mov dword [ebx + 0x1c], ecx
mov edx, dword [eax + 0x1e]
mov dword [ebx + 0x20], edx
mov ecx, dword [eax + 0x22]
mov dword [ebx + 0x24], ecx
mov edx, dword [eax + 0x26]
mov dword [ebx + 0x28], edx
mov ecx, dword [eax + 0x2a]
mov edx, dword [ebp + 0x28]
mov dword [ebx + 0x2c], ecx
lea esi, [eax + 0x2e]
lea edi, [ebx + 0x30]
mov ecx, 8
rep movsd dword es:[edi], dword [esi]
lea esi, [eax + 0x4e]
lea edi, [ebx + 0x50]
mov ecx, 8
rep movsd dword es:[edi], dword [esi]
lea esi, [eax + 0x6e]
push edx
lea eax, [ebp - 0x3c]
lea edi, [ebx + 0x70]
mov ecx, 0x10
push eax
rep movsd dword es:[edi], dword [esi]
call fcn.00404cd0
add esp, 8
pop edi
pop esi
mov eax, 1
pop ebx
mov esp, ebp
pop ebp
ret
mov eax, dword [ebp + 0x24]
test eax, eax
je 0x4059eb
mov dword [eax], 8
lea ecx, [ebp - 0x3c]
push edi
push ecx
call fcn.00404cd0
add esp, 8
pop edi
pop esi
xor eax, eax
pop ebx
mov esp, ebp
pop ebp
ret
mov eax, dword [ebp + 0x24]
test eax, eax
je 0x405705
mov dword [eax], 0xd
jmp 0x405705
mov eax, dword [ebp + 0x24]
test eax, eax
je 0x405a24
mov dword [eax], 8
mov ecx, dword [ebp + 0x28]
push ecx
lea edx, [ebp - 0x3c]
push edx
call fcn.00404cd0
add esp, 8
pop edi
pop esi
xor eax, eax
pop ebx
mov esp, ebp
pop ebp
ret
mov eax, dword [ebp + 0x24]
cmp eax, edi
je 0x405a4a
mov dword [eax], 4
pop edi
pop esi
xor eax, eax
pop ebx
mov esp, ebp
pop ebp
ret