Function at 0x40ca80
Capabilities:
Read file on windows

Disassembly:
push 0xffffffffffffffff
mov eax, dword fs:[0]
push 0x427c78
push eax
mov dword fs:[0], esp
sub esp, 0xc
push ebx
push ebp
mov ebp, dword [esp + 0x28]
push esi
push edi
xor edi, edi
cmp ebp, edi
jne 0x40cafb
mov ebp, dword [esp + 0x2c]
cmp byte [ebp + 0x2c], 0
jne 0x40cae4
mov byte [ebp + 0x2c], 1
mov dword [ebp + 0x30], 2
mov ebx, dword [str.Failed_to_open_file]
mov eax, ebx
lea edx, [eax + 1]
mov cl, byte [eax]
add eax, 1
test cl, cl
jne 0x40cac6
sub eax, edx
lea edi, [ebp + 0x34]
mov esi, eax
call fcn.0040fac0
or eax, 0xffffffff
mov dword [ebp + 0x40], eax
mov dword [ebp + 0x3c], eax
pop edi
pop esi
pop ebp
xor al, al
pop ebx
mov ecx, dword [esp + 0xc]
mov dword fs:[0], ecx
add esp, 0x18
ret 0xc
mov ebx, dword [esp + 0x2c]
mov esi, dword [ebx + 0x18]
cmp esi, edi
je 0x40cb17
mov ecx, esi
mov eax, dword [ecx]
mov edx, dword [eax]
mov esi, dword [esi + 0x28]
push 1
call edx
cmp esi, edi
jne 0x40cb06
push 2
mov dword [ebx + 0x18], edi
mov dword [ebx + 0x1c], edi
or eax, 0xffffffff
push edi
mov edi, dword [sym.imp.MSVCR80.dll_fseek]
push ebp
mov dword [ebx + 8], eax
mov dword [ebx + 4], eax
call edi
push ebp
call dword [sym.imp.MSVCR80.dll_ftell]
push 0
push 0
push ebp
mov esi, eax
call edi
add esp, 0x1c
test esi, esi
jg 0x40cba0
cmp byte [ebx + 0x2c], 0
jne 0x40cb89
mov byte [ebx + 0x2c], 1
mov dword [ebx + 0x30], 0xd
mov edx, dword [str.Error_document_empty.]
mov eax, edx
lea esi, [eax + 1]
mov cl, byte [eax]
add eax, 1
test cl, cl
jne 0x40cb65
sub eax, esi
lea edi, [ebx + 0x34]
mov esi, eax
mov ebx, edx
call fcn.0040fac0
mov eax, dword [esp + 0x2c]
or ecx, 0xffffffff
mov dword [eax + 0x40], ecx
mov dword [eax + 0x3c], ecx
pop edi
pop esi
pop ebp
xor al, al
pop ebx
mov ecx, dword [esp + 0xc]
mov dword fs:[0], ecx
add esp, 0x18
ret 0xc
mov dword [esp + 0x10], 0x445a58
lea eax, [esp + 0x10]
push eax
mov edi, esi
mov dword [esp + 0x28], 0
call fcn.0040fa10
lea ecx, [esi + 1]
push ecx
call sub.MSVCR80.dll_void____cdecl_operator_new_unsigned_int_
push ebp
mov edi, eax
push 1
push esi
push edi
mov dword [esp + 0x28], edi
mov byte [edi], 0
call dword [sym.imp.MSVCR80.dll_fread]
add esp, 0x14
cmp eax, 1
je 0x40cc55
push edi
call sub.MSVCR80.dll_void___cdecl_operator_delete_void__
add esp, 4
cmp byte [ebx + 0x2c], 0
jne 0x40cc2a
mov byte [ebx + 0x2c], 1
mov dword [ebx + 0x30], 2
mov edx, dword [str.Failed_to_open_file]
mov eax, edx
lea esi, [eax + 1]
mov cl, byte [eax]
add eax, 1
test cl, cl
jne 0x40cc06
sub eax, esi
lea edi, [ebx + 0x34]
mov esi, eax
mov ebx, edx
call fcn.0040fac0
mov eax, dword [esp + 0x2c]
or ecx, 0xffffffff
mov dword [eax + 0x40], ecx
mov dword [eax + 0x3c], ecx
mov eax, dword [esp + 0x10]
cmp eax, 0x445a58
je 0x40cc3e
push eax
call sub.MSVCR80.dll_void___cdecl_operator_delete___void__
add esp, 4
pop edi
pop esi
pop ebp
xor al, al
pop ebx
mov ecx, dword [esp + 0xc]
mov dword fs:[0], ecx
add esp, 0x18
ret 0xc
mov byte [edi + esi], 0
cmp byte [edi], 0
mov esi, dword [esp + 0x10]
mov ecx, edi
mov dword [esp + 0x30], ecx
mov ebp, edi
je 0x40cd61
mov edi, edi
mov al, byte [ebp]
cmp al, 0xa
jne 0x40ccd5
mov ebx, dword [esi]
mov eax, ebp
sub eax, ecx
add eax, 1
add ebx, eax
cmp ebx, dword [esi + 4]
mov dword [esp + 0x18], eax
jbe 0x40ccaa
mov edi, dword [esi + 4]
lea edx, [esp + 0x10]
add edi, ebx
push edx
call fcn.0040fa10
mov esi, dword [esp + 0x10]
mov edi, dword [esp + 0x14]
mov eax, dword [esp + 0x18]
mov ecx, dword [esp + 0x30]
push eax
mov eax, dword [esi]
push ecx
lea ecx, [eax + esi + 8]
push ecx
call dword [sym.imp.MSVCR80.dll_memmove]
add esp, 0xc
mov dword [esi], ebx
add ebp, 1
mov byte [ebx + esi + 8], 0
mov ebx, dword [esp + 0x2c]
mov dword [esp + 0x30], ebp
mov ecx, ebp
jmp 0x40cd57
cmp al, 0xd
jne 0x40cd54
mov eax, ebp
sub eax, ecx
test eax, eax
jle 0x40ccf0
push eax
push ecx
lea ebx, [esp + 0x18]
call fcn.0040fb90
mov esi, dword [esp + 0x10]
mov byte [esp + 0x30], 0xa
mov ebx, dword [esi]
add ebx, 1
cmp ebx, dword [esi + 4]
jbe 0x40cd16
mov edi, dword [esi + 4]
lea edx, [esp + 0x10]
add edi, ebx
push edx
call fcn.0040fa10
mov esi, dword [esp + 0x10]
mov edi, dword [esp + 0x14]
mov ecx, dword [esi]
push 1
lea eax, [esp + 0x34]
push eax
lea edx, [ecx + esi + 8]
push edx
call dword [sym.imp.MSVCR80.dll_memmove]
mov dword [esi], ebx
mov byte [ebx + esi + 8], 0
mov ebx, dword [esp + 0x38]
add esp, 0xc
cmp byte [ebp + 1], 0xa
jne 0x40cd49
add ebp, 2
mov dword [esp + 0x30], ebp
mov ecx, ebp
jmp 0x40cd57
add ebp, 1
mov dword [esp + 0x30], ebp
mov ecx, ebp
jmp 0x40cd57
add ebp, 1
cmp byte [ebp], 0
jne 0x40cc70
sub ebp, ecx
je 0x40cd78
push ebp
push ecx
lea ebx, [esp + 0x18]
call fcn.0040fb90
mov esi, dword [esp + 0x10]
mov ebx, dword [esp + 0x2c]
push edi
call sub.MSVCR80.dll_void___cdecl_operator_delete_void__
mov ecx, dword [esp + 0x38]
mov eax, dword [ebx]
mov eax, dword [eax + 8]
add esp, 4
push ecx
push 0
lea edx, [esi + 8]
push edx
mov ecx, ebx
call eax
cmp byte [ebx + 0x2c], 0
je 0x40cdc7
cmp esi, 0x445a58
je 0x40cc3e
push esi
call sub.MSVCR80.dll_void___cdecl_operator_delete___void__
add esp, 4
pop edi
pop esi
pop ebp
xor al, al
pop ebx
mov ecx, dword [esp + 0xc]
mov dword fs:[0], ecx
add esp, 0x18
ret 0xc
cmp esi, 0x445a58
je 0x40cdd8
push esi
call sub.MSVCR80.dll_void___cdecl_operator_delete___void__
add esp, 4
mov ecx, dword [esp + 0x1c]
pop edi
pop esi
pop ebp
mov al, 1
pop ebx
mov dword fs:[0], ecx
add esp, 0x18
ret 0xc