Function at 0x507be0
Capabilities:
Read file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x2c
mov dword [ebp - 0xc], esi
mov esi, dword [ebp + 8]
mov dword [ebp - 8], ebx
push 0
mov eax, dword [esi + 0xec]
mov ebx, dword [esi + 0x98]
mov dword [ebp - 4], eax
mov eax, ebx
add eax, 0xffffffff
mov edx, dword [esi + 0x9c]
mov ecx, dword [esi + 0xf8]
mov dword [ebp - 0x1c], edx
adc edx, 0xffffffff
push ecx
push edx
push eax
mov dword [ebp - 0x10], edi
mov dword [ebp - 0x20], ecx
call fcn.00529a80
mov ecx, eax
mov edi, edx
test byte [esi + 0x171], 0x40
je 0x507c90
mov edx, dword [esi + 0xa0]
mov dword [ebp - 0x24], ebx
sub ebx, edx
mov dword [ebp - 0x2c], edx
mov eax, dword [esi + 0xa4]
mov edx, dword [ebp - 0x1c]
mov ebx, dword [ebp - 0x24]
sbb edx, eax
mov dword [ebp - 0x28], eax
jl 0x507c90
mov edx, ebx
sub edx, dword [esi + 0xa8]
mov edx, dword [ebp - 0x1c]
sbb edx, dword [esi + 0xac]
jge 0x507c90
mov dword [esi + 0xe8], 0
sub ebx, dword [ebp - 0x2c]
mov eax, dword [ebp - 0x1c]
push 0
sbb eax, dword [ebp - 0x28]
push dword [ebp - 0x20]
push eax
push ebx
call fcn.00529a80
add eax, dword [esi + 0x38]
mov dword [esi + 0x50], eax
jmp 0x508098
push 0
mov dword [ebp - 0x18], ecx
lea edx, [ebp - 0x14]
push edx
push ecx
push dword [esi + 0xe4]
mov dword [ebp - 0x24], ecx
mov dword [ebp - 0x14], edi
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov ecx, dword [ebp - 0x24]
mov dword [ebp - 0x18], eax
cmp eax, 0xffffffff
je 0x5081e6
mov ebx, dword [ebp - 0x14]
mov edx, 0xffffffff
sub eax, edx
sub ebx, edx
or eax, ebx
je 0x5081c8
mov edx, 0xffffffff
sub ecx, edx
sub edi, edx
mov dword [esi + 0xe8], 0
or ecx, edi
je 0x508199
movzx eax, byte [esi + 0x16a]
test eax, 0x80
movzx edx, byte [esi + 0x170]
jne 0x507d0d
test dl, 1
jne 0x507d0d
test dl, 2
je 0x507eab
mov ebx, dword [esi + 0x80]
test ebx, ebx
je 0x507eab
mov eax, dword [ebp - 4]
cmp eax, dword [esi + 0x134]
jne 0x507eab
and edx, 0x80
movzx ecx, byte [esi + 0x171]
mov eax, dword [esi + 0xe4]
shr edx, 7
mov dword [ebp - 0x1c], ecx
mov dword [ebp - 0x20], eax
mov ecx, dword [esi + 0x140]
cmp dword [0x587060], 0
je 0x507df2
cmp ecx, 2
je 0x507d63
cmp ecx, 1
jne 0x507d6f
xor edi, edi
mov eax, 0xffffffff
jmp 0x507e9a
test edx, edx
je 0x507d7c
cmp ecx, 0xfffffffa
je 0x5080b1
test ecx, ecx
je 0x5080c7
xor eax, eax
mov dword [ebp - 0x2c], eax
mov dword [ebp - 0x24], eax
test edx, edx
je 0x507daf
test byte [ebp - 0x1c], 1
je 0x507daf
push dword [ebp - 0x24]
mov dword [ebp - 0x28], ecx
call fcn.005504e0
push dword [ebp - 0x24]
call fcn.00550500
mov ecx, dword [ebp - 0x28]
add esp, 8
cmp dword [ebp - 0x2c], 0
je 0x507df2
push dword [ebp - 0x24]
push dword [ebp - 4]
push ebx
call fcn.005504e0
add esp, 0xc
mov edi, eax
cmp edi, 0xffffffff
je 0x5080c0
push 0
push dword [ebp - 0x24]
push 2
push 0x56895c
call fcn.005504e0
add esp, 0x10
mov byte [edi + ebx], 0xa
inc edi
mov eax, 1
jmp 0x507e9a
mov dword [ebp - 0x28], ecx
push 0
call dword [sym.imp.KERNEL32.dll_SetLastError]
mov eax, dword [esi + 0x13c]
test eax, eax
mov ecx, dword [ebp - 0x28]
jne 0x507e0f
mov eax, 0x20000
cmp eax, dword [ebp - 4]
jae 0x507e18
test ecx, ecx
jne 0x507e30
push 0
lea eax, [ebp - 0x28]
push eax
push dword [ebp - 4]
push ebx
push dword [ebp - 0x20]
call dword [sym.imp.KERNEL32.dll_ReadFile]
mov edi, dword [ebp - 0x28]
jmp 0x507e9a
xor edi, edi
mov dword [ebp - 0x2c], edi
mov edi, ebx
mov ebx, eax
push 0
mov esi, ebx
lea edx, [ebp - 0x28]
push edx
push ebx
push edi
push dword [ebp - 0x20]
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x507e7d
mov ecx, dword [ebp - 0x2c]
add ecx, dword [ebp - 0x28]
mov dword [ebp - 0x2c], ecx
mov ecx, dword [ebp + 8]
mov edx, dword [ebp - 4]
sub edx, dword [ebp - 0x28]
mov ecx, dword [ecx + 0x13c]
test ecx, ecx
mov dword [ebp - 4], edx
jne 0x507e74
mov ecx, 0x20000
cmp edx, ecx
ja 0x507e7a
mov ebx, edx
add edi, dword [ebp - 0x28]
cmp dword [ebp - 4], 0
je 0x5080f4
cmp esi, dword [ebp - 0x28]
jne 0x5080f4
test eax, eax
jne 0x507e39
mov edi, dword [ebp - 0x2c]
mov esi, dword [ebp + 8]
or byte [esi + 0x16f], 0x40
mov edx, 1
jmp 0x50800f
and edx, 0x80
mov ebx, dword [esi + 0xe4]
movzx eax, byte [esi + 0x171]
shr edx, 7
mov dword [ebp - 0x20], ebx
mov ebx, dword [esi + 0x38]
mov dword [ebp - 0x24], eax
mov edi, dword [esi + 0x140]
cmp dword [0x587060], 0
je 0x507f70
cmp edi, 2
je 0x507ee7
cmp edi, 1
jne 0x507ef3
xor edi, edi
mov eax, 0xffffffff
jmp 0x50800d
test edx, edx
je 0x507f00
cmp edi, 0xfffffffa
je 0x5080ff
test edi, edi
je 0x508118
xor eax, eax
mov dword [ebp - 0x2c], eax
mov dword [ebp - 0x28], eax
test edx, edx
je 0x507f2d
test byte [ebp - 0x24], 1
je 0x507f2d
push dword [ebp - 0x28]
call fcn.005504e0
push dword [ebp - 0x28]
call fcn.00550500
add esp, 8
cmp dword [ebp - 0x2c], 0
je 0x507f70
push dword [ebp - 0x28]
push dword [ebp - 4]
push ebx
call fcn.005504e0
add esp, 0xc
mov edi, eax
cmp edi, 0xffffffff
je 0x508111
push 0
push dword [ebp - 0x28]
push 2
push 0x56895c
call fcn.005504e0
add esp, 0x10
mov byte [edi + ebx], 0xa
inc edi
mov eax, 1
jmp 0x50800d
push 0
call dword [sym.imp.KERNEL32.dll_SetLastError]
mov eax, dword [esi + 0x13c]
test eax, eax
jne 0x507f87
mov eax, 0x20000
cmp eax, dword [ebp - 4]
jae 0x507f90
test edi, edi
jne 0x507fa8
push 0
lea eax, [ebp - 0x24]
push eax
push dword [ebp - 4]
push ebx
push dword [ebp - 0x20]
call dword [sym.imp.KERNEL32.dll_ReadFile]
mov edi, dword [ebp - 0x24]
jmp 0x50800d
xor edi, edi
mov dword [ebp - 0x2c], edi
mov edi, ebx
mov ebx, eax
push 0
mov esi, ebx
lea edx, [ebp - 0x24]
push edx
push ebx
push edi
push dword [ebp - 0x20]
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x507ff0
mov ecx, dword [ebp - 0x24]
add edi, ecx
mov edx, dword [ebp - 4]
add dword [ebp - 0x2c], ecx
sub edx, ecx
mov ecx, dword [ebp + 8]
mov dword [ebp - 4], edx
mov ecx, dword [ecx + 0x13c]
test ecx, ecx
jne 0x507fea
mov ecx, 0x20000
cmp edx, ecx
ja 0x507ff0
mov ebx, edx
cmp dword [ebp - 4], 0
je 0x50818e
cmp esi, dword [ebp - 0x24]
jne 0x50818e
test eax, eax
jne 0x507fb1
mov edi, dword [ebp - 0x2c]
mov esi, dword [ebp + 8]
xor edx, edx
test eax, eax
je 0x508164
test edi, edi
je 0x508152
test byte [esi + 0x168], 1
je 0x508035
cmp byte [esi + 0x155], 2
je 0x50813f
test edx, edx
jne 0x508098
mov eax, dword [esi + 0xf8]
xor edx, edx
mov dword [ebp - 0x2c], eax
mov eax, edi
mov edi, dword [ebp - 0x2c]
div edi
mov ecx, dword [esi + 0x38]
mov dword [esi + 0x50], ecx
mov ecx, dword [esi + 0x98]
add eax, ecx
mov ebx, dword [esi + 0x9c]
mov edx, ebx
adc edx, 0
mov dword [esi + 0xa0], ecx
sub ecx, eax
mov dword [esi + 0xa4], ebx
sub ebx, edx
or ecx, ebx
jne 0x50808c
add eax, 1
mov dword [esi + 0xa8], eax
adc edx, 0
mov dword [esi + 0xac], edx
jmp 0x508098
mov dword [esi + 0xa8], eax
mov dword [esi + 0xac], edx
xor eax, eax
mov dword [esi + 0x108], 0
mov ebx, dword [ebp - 8]
mov esi, dword [ebp - 0xc]
mov edi, dword [ebp - 0x10]
mov esp, ebp
pop ebp
ret
mov dword [ebp - 0x24], eax
mov dword [ebp - 0x2c], 1
jmp 0x507d90
xor eax, eax
jmp 0x507e9a
mov dword [ebp - 0x28], ecx
mov dword [ebp - 0x2c], edx
call fcn.00550500
mov edx, dword [ebp - 0x2c]
mov ecx, dword [ebp - 0x28]
mov dword [ebp - 0x24], eax
cmp dword [0x587060], 0
je 0x507db5
mov dword [ebp - 0x2c], 1
jmp 0x507d8c
mov edi, dword [ebp - 0x2c]
mov esi, dword [ebp + 8]
jmp 0x507e9a
mov eax, dword [ebp - 0x20]
mov dword [ebp - 0x28], eax
mov dword [ebp - 0x2c], 1
jmp 0x507f14
xor eax, eax
jmp 0x50800d
mov dword [ebp - 0x2c], edx
call fcn.00550500
mov edx, dword [ebp - 0x2c]
mov dword [ebp - 0x28], eax
cmp dword [0x587060], 0
je 0x507f33
mov dword [ebp - 0x2c], 1
jmp 0x507f10
mov eax, dword [esi + 0x38]
movsx eax, byte [eax]
test eax, eax
je 0x508152
cmp eax, 0x40
jne 0x508035
mov eax, 0x24
mov ebx, dword [ebp - 8]
mov esi, dword [ebp - 0xc]
mov edi, dword [ebp - 0x10]
mov esp, ebp
pop ebp
ret
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov edx, 0x24
cmp eax, 0x26
mov dword [esi + 0xe8], eax
je 0x50817f
mov edx, 0x27
mov eax, edx
mov ebx, dword [ebp - 8]
mov esi, dword [ebp - 0xc]
mov edi, dword [ebp - 0x10]
mov esp, ebp
pop ebp
ret
mov edi, dword [ebp - 0x2c]
mov esi, dword [ebp + 8]
jmp 0x50800d
mov eax, dword [esi + 0x9c]
mov ecx, dword [esi + 0xa0]
mov edi, dword [esi + 0xa4]
mov edx, dword [esi + 0xf8]
mov ebx, dword [esi + 0x98]
mov dword [ebp - 0x1c], eax
mov dword [ebp - 0x20], edx
mov dword [ebp - 0x2c], ecx
mov dword [ebp - 0x28], edi
jmp 0x507c70
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov dword [esi + 0xe8], eax
mov eax, 0x27
mov ebx, dword [ebp - 8]
mov esi, dword [ebp - 0xc]
mov edi, dword [ebp - 0x10]
mov esp, ebp
pop ebp
ret
mov dword [ebp - 0x24], ecx
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov ecx, dword [ebp - 0x24]
test eax, eax
je 0x508203
mov eax, 0xffffffff
mov dword [ebp - 0x18], eax
mov dword [ebp - 0x14], eax
jmp 0x5081c8
mov eax, dword [ebp - 0x18]
mov ebx, dword [ebp - 0x14]
jmp 0x507cbe