Function at 0x508e90
Capabilities:
Read file on windows

Disassembly:
mov eax, dword [esp + 4]
sub esp, 0x190
push esi
mov esi, ecx
push edi
lea edi, [esi + 0x40]
push eax
mov ecx, edi
call fcn.005be130
cmp dword [esi + 0x14], 0
jne 0x508eb5
cmp dword [esi + 0x1c], 0
je 0x508ebc
mov ecx, esi
call fcn.005087e0
mov eax, dword [edi]
push 0x5f571c
push eax
call dword [sym.imp.MSVCR90.dll_fopen]
add esp, 8
mov dword [esi + 0x14], eax
test eax, eax
je 0x508f00
push eax
push 0x60
lea ecx, [esp + 0x10]
push 1
push ecx
call dword [sym.imp.MSVCR90.dll_fread]
add esp, 0x10
cmp eax, 0x60
jae 0x508f0e
mov edx, dword [esi + 0x14]
push edx
call dword [sym.imp.MSVCR90.dll_fclose]
add esp, 4
mov dword [esi + 0x14], 0
pop edi
or eax, 0xffffffff
pop esi
add esp, 0x190
ret 4
mov ecx, dword [esp + 0x18]
mov eax, ecx
shr ecx, 8
mov edx, ecx
shr ecx, 8
and edx, 0xff
and eax, 0xff
shl eax, 8
or edx, eax
mov eax, ecx
shl edx, 8
shr ecx, 8
and ecx, 0xff
and eax, 0xff
or eax, edx
shl eax, 8
or eax, ecx
mov ecx, dword [esp + 0x1c]
mov edi, ecx
and edi, 0xff
shl edi, 8
shr ecx, 8
mov edx, ecx
shr ecx, 8
and edx, 0xff
or edx, edi
mov edi, ecx
and edi, 0xff
shl edx, 8
or edi, edx
shl edi, 8
shr ecx, 8
and ecx, 0xff
or edi, ecx
mov ecx, dword [esp + 0x20]
mov dword [esi + 0x30], edi
mov edi, ecx
and edi, 0xff
shl edi, 8
shr ecx, 8
mov edx, ecx
and edx, 0xff
or edx, edi
shr ecx, 8
mov edi, ecx
and edi, 0xff
shl edx, 8
or edi, edx
shl edi, 8
shr ecx, 8
and ecx, 0xff
or edi, ecx
mov ecx, dword [esp + 0x24]
mov dword [esi + 0x34], edi
mov edi, ecx
shr ecx, 8
and edi, 0xff
shl edi, 8
mov edx, ecx
and edx, 0xff
or edx, edi
shr ecx, 8
mov edi, ecx
shl edx, 8
and edi, 0xff
or edi, edx
shr ecx, 8
and ecx, 0xff
shl edi, 8
or edi, ecx
mov ecx, dword [esp + 0x28]
mov edx, ecx
shr ecx, 8
mov dword [esi + 0x38], edi
and edx, 0xff
push ebx
mov edi, ecx
shl edx, 8
push ebp
mov dword [esi + 0x20], eax
and edi, 0xff
or edi, edx
shr ecx, 8
mov edx, ecx
shl edi, 8
shr ecx, 8
and edx, 0xff
or edx, edi
and ecx, 0xff
shl edx, 8
or edx, ecx
mov ecx, dword [esp + 0x34]
mov ebx, ecx
and ebx, 0xff
shr ecx, 8
shl ebx, 8
mov edi, ecx
and edi, 0xff
or edi, ebx
shr ecx, 8
mov ebx, ecx
and ebx, 0xff
shl edi, 8
or ebx, edi
shr ecx, 8
shl ebx, 8
and ecx, 0xff
or ebx, ecx
mov dword [esi + 0x24], edx
mov dword [esi + 0x28], ebx
test al, 2
je 0x50909f
mov ecx, eax
and ecx, 0xffff
cmp ecx, 2
je 0x50909f
mov ecx, eax
and ecx, 0xfff8
mov dword [esi + 0x2c], ecx
not ecx
and ecx, eax
mov dword [esi + 0x20], ecx
mov ebp, dword [sym.imp.MSVCR90.dll_malloc]
lea edx, [edx*4 + 4]
push edx
call ebp
push 0
mov dword [esi + 0x18], eax
mov eax, dword [esi + 0x14]
push 0xa0
push eax
call dword [sym.imp.MSVCR90.dll_fseek]
mov eax, dword [esi + 0x24]
mov ecx, dword [esi + 0x14]
cdq
and edx, 3
add eax, edx
mov edx, dword [esi + 0x18]
push ecx
sar eax, 2
push eax
push 4
push edx
call dword [sym.imp.MSVCR90.dll_fread]
mov eax, dword [esi + 0x24]
mov ebx, dword [esi + 0x18]
cdq
and edx, 3
add eax, edx
sar eax, 2
add esp, 0x20
xor edi, edi
test eax, eax
jle 0x509144
mov eax, dword [ebx + edi*4]
mov edx, eax
shr eax, 8
and edx, 0xff
mov ecx, eax
shl edx, 8
shr eax, 8
and ecx, 0xff
or ecx, edx
mov edx, eax
and edx, 0xff
shr eax, 8
shl ecx, 8
or edx, ecx
and eax, 0xff
shl edx, 8
or edx, eax
mov dword [ebx + edi*4], edx
mov eax, dword [esi + 0x24]
cdq
and edx, 3
add eax, edx
inc edi
sar eax, 2
cmp edi, eax
jl 0x5090f8
cmp dword [esi + 0x10], 1
jne 0x509192
mov eax, dword [esi + 0x28]
inc eax
push eax
call ebp
mov ecx, dword [esi + 0x24]
mov edx, dword [esi + 0x14]
push 0
add ecx, 0xa0
push ecx
push edx
mov dword [esi + 0x1c], eax
call dword [sym.imp.MSVCR90.dll_fseek]
mov eax, dword [esi + 0x14]
mov ecx, dword [esi + 0x28]
mov edx, dword [esi + 0x1c]
push eax
push ecx
push 1
push edx
call dword [sym.imp.MSVCR90.dll_fread]
mov eax, dword [esi + 0x14]
push eax
call dword [sym.imp.MSVCR90.dll_fclose]
add esp, 0x24
mov dword [esi + 0x14], 0
mov eax, dword [esi + 0x20]
pop ebp
pop ebx
pop edi
pop esi
add esp, 0x190
ret 4