Function at 0x4058be
Capabilities:
Get file size
Print debug messages
Read file on windows
Read file via mapping

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x60
push ebx
push esi
push edi
xor ebx, ebx
push ebx
push ebx
push 3
push ebx
push 1
push 0x80000000
push 0x41b5d8
mov byte [ebp - 1], bl
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov dword [ebp - 0x14], eax
cmp eax, 0xffffffff
je 0x405bdf
push ebx
push ebx
push ebx
push 2
push ebx
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileMappingW]
mov dword [ebp - 0x34], eax
cmp eax, ebx
je 0x405bce
push ebx
push ebx
push ebx
push 4
push eax
call dword [sym.imp.KERNEL32.dll_MapViewOfFile]
mov ecx, eax
mov dword [ebp - 0x30], ecx
cmp ecx, ebx
je 0x405bc6
mov eax, dword [ecx + 0x3c]
add eax, ecx
movzx ecx, word [eax + 0x14]
movzx edx, word [eax + 6]
lea ecx, [ecx + eax + 0x18]
xor eax, eax
xor edi, edi
xor esi, esi
cmp ax, dx
jae 0x405952
lea eax, [ecx + 0x14]
mov ecx, dword [eax]
cmp ecx, edi
jbe 0x40594c
mov esi, dword [eax - 4]
mov edi, ecx
add esi, edi
add eax, 0x28
dec edx
jne 0x40593f
push ebx
push dword [ebp - 0x14]
call dword [sym.imp.KERNEL32.dll_GetFileSize]
mov edi, eax
cmp edi, esi
jbe 0x405bbd
push ebx
push ebx
lea eax, [edi - 5]
push eax
push dword [ebp - 0x14]
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
push ebx
lea eax, [ebp - 0x28]
push eax
push 5
lea eax, [ebp - 0x3c]
push eax
push dword [ebp - 0x14]
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x405bbd
mov eax, edi
sub eax, esi
mov dword [ebp - 0x10], eax
add eax, 0xfffffffb
push ebx
call fcn.00408cd8
mov esi, eax
pop ecx
mov dword [ebp - 0x1c], esi
cmp esi, ebx
je 0x405bbd
sub edi, dword [ebp - 0x10]
push ebx
push ebx
push edi
push dword [ebp - 0x14]
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
push ebx
lea eax, [ebp - 0x28]
push eax
mov eax, dword [ebp - 0x10]
add eax, 0xfffffffb
push eax
push esi
push dword [ebp - 0x14]
call dword [sym.imp.KERNEL32.dll_ReadFile]
xor eax, eax
mov byte [ebp - 8], bl
lea edi, [ebp - 7]
stosw word es:[edi], ax
mov eax, dword [ebp - 0x10]
mov cl, byte [eax + esi - 9]
mov byte [ebp - 8], cl
mov al, byte [eax + esi - 8]
push ebx
mov byte [ebp - 7], al
push 2
lea eax, [ebp - 8]
push eax
lea eax, [ebp - 0x3c]
push 5
push eax
call fcn.004096f7
add esp, 0x14
lea eax, [ebp - 0x18]
lea ecx, [ebp - 8]
mov dword [ebp - 0x18], ebx
call fcn.0040c5b5
xor eax, eax
mov byte [ebp - 0xc], bl
lea edi, [ebp - 0xb]
stosw word es:[edi], ax
mov eax, dword [ebp - 0x10]
mov cl, byte [eax + esi - 7]
mov byte [ebp - 0xc], cl
mov al, byte [eax + esi - 6]
push ebx
mov byte [ebp - 0xb], al
push 2
lea eax, [ebp - 0xc]
push eax
lea eax, [ebp - 0x3c]
push 5
push eax
call fcn.004096f7
add esp, 0x14
lea eax, [ebp - 0x24]
lea ecx, [ebp - 0xc]
mov dword [ebp - 0x24], ebx
call fcn.0040c5b5
mov eax, dword [ebp - 0x10]
push ebx
add eax, 0xfffffff7
push eax
push esi
lea eax, [ebp - 0x3c]
push 5
push eax
call fcn.004096f7
add esp, 0x14
push dword [ebp + 8]
call fcn.00406f63
pop ecx
test al, al
je 0x405ac5
movzx eax, word [ebp - 0x18]
push esi
call fcn.0040c817
pop ecx
push ebx
push 0xa48346ab
push 0x28
push 0x416004
mov edi, eax
call fcn.0040a2d3
movzx ecx, word [ebp - 0x24]
push edi
push ecx
movzx ecx, word [ebp - 0x18]
push ecx
push eax
lea ecx, [ebp - 0x20]
call fcn.0040c9f8
add esp, 0x20
push dword [ebp - 0x20]
call dword [sym.imp.KERNEL32.dll_OutputDebugStringA]
mov esi, dword [ebp - 0x20]
call fcn.00408de5
mov esi, edi
call fcn.00408de5
mov esi, dword [ebp - 0x1c]
movzx edi, word [ebp - 0x18]
lea eax, [ebp - 0x10]
push eax
push esi
call fcn.0041383d
pop ecx
pop ecx
mov dword [ebp - 0x20], eax
cmp eax, ebx
je 0x405bb8
push ebx
push 0x4ec3d7b4
push 1
push 0x416030
call fcn.0040a2d3
push eax
mov eax, dword [ebp - 0x20]
call fcn.0041365f
add esp, 0x14
mov edi, eax
call fcn.00413782
push eax
xor eax, eax
call fcn.0040c817
pop ecx
mov dword [0x41b7e4], eax
cmp eax, ebx
je 0x405bb0
push ebx
push 0x62c5fc2a
push 1
push 0x416034
call fcn.0040a2d3
push eax
mov eax, dword [ebp - 0x20]
call fcn.0041365f
mov edi, eax
add esp, 0x14
mov dword [ebp - 0x2c], edi
cmp edi, ebx
je 0x405bb0
call fcn.00413602
cmp eax, 5
jbe 0x405b51
push 5
pop eax
jmp 0x405b58
mov eax, edi
call fcn.00413602
mov dword [0x41b7e8], eax
shl eax, 2
push 8
call fcn.00408cd8
pop ecx
mov dword [0x41b7e0], eax
mov dword [ebp - 0x1c], ebx
cmp dword [0x41b7e8], ebx
jbe 0x405bac
push dword [ebp - 0x1c]
mov eax, dword [ebp - 0x2c]
call fcn.00413629
pop ecx
mov edi, eax
call fcn.00413782
push eax
xor eax, eax
call fcn.0040c817
mov edx, dword [0x41b7e0]
pop ecx
mov ecx, dword [ebp - 0x1c]
mov dword [edx + ecx*4], eax
inc ecx
mov dword [ebp - 0x1c], ecx
cmp ecx, dword [0x41b7e8]
jb 0x405b78
mov byte [ebp - 1], 1
mov eax, dword [ebp - 0x20]
call fcn.0041354c
call fcn.00408de5
push dword [ebp - 0x30]
call dword [sym.imp.KERNEL32.dll_UnmapViewOfFile]
mov esi, dword [ebp - 0x34]
call fcn.00409a17
mov esi, dword [ebp - 0x14]
call fcn.00409a17
cmp byte [ebp - 1], bl
jne 0x405cb4
push ebx
push 0x5f9ec7b4
push 7
push str.__K_O
call fcn.0040a2d3
push eax
mov eax, dword [ebp + 8]
call fcn.0041365f
add esp, 0x14
mov dword [ebp - 0x24], eax
cmp eax, ebx
je 0x405cb4
push ebx
push 0xa31c6856
push 3
push 0x416040
call fcn.0040a2d3
push eax
mov eax, dword [ebp - 0x24]
call fcn.0041365f
add esp, 0x14
mov edi, eax
call fcn.00413782
push eax
xor eax, eax
call fcn.0040c817
pop ecx
push 8
mov dword [0x41b7e4], eax
push 0x14
pop eax
mov dword [0x41b7e8], 5
call fcn.00408cd8
xor esi, esi
inc esi
pop ecx
mov dword [0x41b7e0], eax
cmp dword [0x41b7e8], esi
jb 0x405cb4
push esi
push ebx
push 0xff4c4a6e
push 7
push 0x416044
call fcn.0040a2d3
add esp, 0x10
push eax
lea eax, [ebp - 0x5c]
push eax
call dword [sym.imp.USER32.dll_wsprintfA]
lea eax, [ebp - 0x5c]
add esp, 0xc
push eax
mov eax, dword [ebp - 0x24]
call fcn.0041365f
pop ecx
mov edi, eax
call fcn.00413782
push eax
xor eax, eax
call fcn.0040c817
pop ecx
mov ecx, dword [0x41b7e0]
mov dword [ecx + esi*4 - 4], eax
inc esi
cmp esi, dword [0x41b7e8]
jbe 0x405c60
pop edi
pop esi
pop ebx
leave
ret