Function at 0x40f540
Capabilities:
Read file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x34
push ebx
mov ebx, dword [ebp + 8]
lea eax, [ebx + 0x3c]
mov dword [ebp - 8], eax
mov dword [eax], 0
lea eax, [ebx + 0x38]
push esi
push edi
mov dword [ebp - 0x10], eax
mov dword [eax], 0
jmp 0x40f570
mov ebx, dword [ebp + 8]
lea esp, [esp]
lea edi, [ebp - 0x14]
mov esi, ebx
call fcn.0040e9d0
test eax, eax
je 0x40f7b1
mov ecx, dword [ebp - 0x14]
mov eax, ecx
sub eax, 2
je 0x40f661
sub eax, 1
jne 0x40f79b
mov eax, dword [ebx + 0x48]
test byte [eax], 8
je 0x40f7ba
mov ecx, dword [eax + 0x3c]
test ecx, ecx
je 0x40f5ba
push 1
lea eax, [ebp - 1]
push eax
push ebx
call ecx
add esp, 0xc
jmp 0x40f5ce
mov ecx, dword [eax + 0x38]
push ecx
push 1
lea edx, [ebp - 1]
push 1
push edx
call sub.MSVCR90.dll_fread
add esp, 0x10
cmp eax, 1
jne 0x40f7ca
mov esi, dword [ebp + 8]
movzx edi, byte [ebp - 1]
lea ebx, [ebp - 0xc]
call fcn.0040ed70
test eax, eax
je 0x40f7b1
mov eax, dword [ebp - 0xc]
test eax, eax
je 0x40f566
mov edx, dword [ebp - 8]
movzx ebx, byte [eax]
lea ecx, [eax + 1]
push ecx
push edi
mov edi, dword [ebp - 0x10]
push edx
call fcn.0040f8d0
add esp, 0xc
test eax, eax
je 0x40f7b1
jmp 0x40f620
mov esi, dword [ebp + 8]
lea ebx, [ebp - 0xc]
call fcn.0040ed70
test eax, eax
je 0x40f7b1
mov eax, dword [ebp - 0xc]
test eax, eax
je 0x40f566
mov edx, dword [ebp - 8]
movzx ebx, byte [eax]
mov edi, dword [ebp - 0x10]
lea ecx, [eax + 1]
push ecx
push 0
push edx
call fcn.0040f8d0
add esp, 0xc
test eax, eax
jne 0x40f620
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
call fcn.0040ea80
test eax, eax
je 0x40f7b1
mov esi, dword [ebp + 8]
mov eax, dword [esi + 0x18]
mov ecx, dword [esi + 0x34]
lea eax, [eax + eax*8]
lea edi, [ecx + eax*4 - 0x24]
mov ecx, dword [edi + 8]
test ecx, ecx
jge 0x40f69c
mov ebx, dword [edi + 0xc]
test ebx, ebx
jge 0x40f69c
mov eax, SysReAllocString
cdq
idiv ebx
cmp ecx, eax
jg 0x40f7b1
mov ebx, dword [edi + 0xc]
imul ebx, ecx
cmp ebx, 0xffffffff
ja 0x40f7b1
cmp ebx, 0x10000
jb 0x40f6d2
test ebx, ebx
jbe 0x40f6d2
or eax, 0xffffffff
xor edx, edx
div ebx
cmp eax, 1
jae 0x40f6d2
call sub.MSVCR90.dll__errno
mov dword [eax], 0xc
xor eax, eax
jmp 0x40f6dd
push ebx
push 0
call sub.MSVCR90.dll_realloc
add esp, 8
mov dword [edi + 0x18], eax
test eax, eax
je 0x40f7b1
cmp dword [edi + 0x10], 0
je 0x40f75e
mov edx, 4
mov ecx, 2
mov eax, 8
mov dword [ebp - 0x24], 0
mov dword [ebp - 0x20], edx
mov dword [ebp - 0x1c], ecx
mov dword [ebp - 0x18], 1
mov dword [ebp - 0x34], eax
mov dword [ebp - 0x30], eax
mov dword [ebp - 0x2c], edx
mov dword [ebp - 0x28], ecx
xor esi, esi
nop
mov ebx, dword [ebp + esi - 0x24]
cmp ebx, dword [edi + 0xc]
jge 0x40f754
lea esp, [esp]
mov eax, dword [edi + 8]
mov ecx, dword [ebp + 8]
mov edx, eax
imul edx, ebx
add edx, dword [edi + 0x18]
push edx
call fcn.0040ece0
add esp, 4
test eax, eax
je 0x40f7b1
add ebx, dword [ebp + esi - 0x34]
cmp ebx, dword [edi + 0xc]
jl 0x40f730
add esi, 4
cmp esi, 0x10
jl 0x40f720
jmp 0x40f76f
push eax
mov eax, ebx
mov ecx, esi
call fcn.0040ece0
add esp, 4
test eax, eax
je 0x40f7b1
mov eax, dword [ebp - 8]
mov eax, dword [eax]
test eax, eax
je 0x40f566
mov edx, dword [ebp - 8]
mov dword [edi + 0x20], eax
mov eax, dword [ebp - 0x10]
mov ecx, dword [eax]
mov dword [edi + 0x1c], ecx
mov dword [edx], 0
mov dword [eax], 0
jmp 0x40f566
cmp ecx, 4
jne 0x40f570
cmp dword [ebx + 0x18], 0
jne 0x40f7da
mov dword [ebx + 0x40], 0x69
pop edi
pop esi
xor eax, eax
pop ebx
mov esp, ebp
pop ebp
ret
pop edi
pop esi
mov dword [ebx + 0x40], 0x6f
xor eax, eax
pop ebx
mov esp, ebp
pop ebp
ret
pop edi
pop esi
mov dword [ebx + 0x40], 0x66
xor eax, eax
pop ebx
mov esp, ebp
pop ebp
ret
pop edi
pop esi
mov eax, 1
pop ebx
mov esp, ebp
pop ebp
ret