Function at 0x5031fb
Capabilities:
Read file on windows

Disassembly:
mov edi, edi
push ebp
mov ebp, esp
sub esp, 0x28
push ebx
mov ebx, dword [ebp + 8]
push esi
push edi
cmp ebx, 0xfffffffe
jne 0x503226
call fcn.004e7680
and dword [eax], 0
call fcn.004e7693
mov dword [eax], 9
jmp 0x503596
test ebx, ebx
js 0x50357e
cmp ebx, dword [0x564030]
jae 0x50357e
mov eax, ebx
mov edi, ebx
sar edi, 6
and eax, 0x3f
imul eax, eax, 0x30
xor ecx, ecx
inc ecx
mov dword [ebp - 0x10], edi
mov dword [ebp - 0x20], ecx
mov esi, dword [edi*4 + 0x563e30]
mov dword [ebp - 8], eax
mov dl, byte [esi + eax + 0x28]
test cl, dl
je 0x50357e
mov ecx, dword [ebp + 0x10]
cmp ecx, 0x7fffffff
jbe 0x503289
call fcn.004e7680
and dword [eax], 0
call fcn.004e7693
mov dword [eax], 0x16
jmp 0x503591
test ecx, ecx
je 0x50357a
test dl, 2
jne 0x50357a
mov edx, dword [ebp + 0xc]
test edx, edx
je 0x503271
mov ebx, dword [esi + eax + 0x18]
mov al, byte [esi + eax + 0x29]
xor esi, esi
mov byte [ebp - 1], al
movsx eax, al
mov dword [ebp - 0x18], ebx
mov ebx, dword [ebp + 8]
sub eax, 1
je 0x5032d4
sub eax, 1
jne 0x5032c9
mov eax, ecx
not eax
test al, 1
je 0x5032dc
mov dword [ebp - 0xc], ecx
mov dword [ebp - 0x14], edx
jmp 0x50336a
mov eax, ecx
not eax
test al, 1
jne 0x5032f8
call fcn.004e7680
and dword [eax], esi
call fcn.004e7693
mov dword [eax], 0x16
call fcn.004e75b9
jmp 0x5034b2
push 4
pop eax
shr ecx, 1
mov dword [ebp - 0xc], eax
cmp ecx, eax
jb 0x503309
mov eax, ecx
mov dword [ebp - 0xc], ecx
push eax
call fcn.004fd78a
push 0
mov esi, eax
call fcn.004fd750
push 0
call fcn.004fd750
add esp, 0xc
mov dword [ebp - 0x14], esi
test esi, esi
jne 0x503344
call fcn.004e7693
mov dword [eax], 0xc
call fcn.004e7680
mov dword [eax], 8
jmp 0x5034b2
push 1
push 0
push 0
push ebx
call fcn.004f7a5f
mov ecx, dword [edi*4 + 0x563e30]
add esp, 0x10
mov edi, dword [ebp - 8]
mov dword [ecx + edi + 0x20], eax
mov dword [ecx + edi + 0x24], edx
mov edx, esi
mov ecx, dword [ebp - 0xc]
mov eax, dword [ebp - 0x10]
xor edi, edi
mov ebx, dword [ebp - 8]
mov dword [ebp - 0x24], edx
mov eax, dword [eax*4 + 0x563e30]
test byte [eax + ebx + 0x28], 0x48
mov ebx, dword [ebp + 8]
je 0x503453
mov eax, dword [ebp - 0x10]
mov ebx, dword [ebp - 8]
mov eax, dword [eax*4 + 0x563e30]
mov al, byte [eax + ebx + 0x2a]
mov ebx, dword [ebp + 8]
cmp al, 0xa
je 0x503453
test ecx, ecx
je 0x503453
mov ebx, dword [ebp - 8]
inc edi
mov byte [edx], al
inc edx
mov eax, dword [ebp - 0x10]
dec ecx
cmp byte [ebp - 1], 0
mov dword [ebp - 0x14], edx
mov dword [ebp - 0xc], ecx
mov eax, dword [eax*4 + 0x563e30]
mov byte [eax + ebx + 0x2a], 0xa
mov ebx, dword [ebp + 8]
je 0x503453
mov eax, dword [ebp - 0x10]
mov ebx, dword [ebp - 8]
mov eax, dword [eax*4 + 0x563e30]
mov al, byte [eax + ebx + 0x2b]
mov ebx, dword [ebp + 8]
cmp al, 0xa
je 0x503453
test ecx, ecx
je 0x503453
mov ebx, dword [ebp - 8]
mov byte [edx], al
inc edx
mov eax, dword [ebp - 0x10]
dec ecx
cmp byte [ebp - 1], 1
push 2
mov dword [ebp - 0x14], edx
mov eax, dword [eax*4 + 0x563e30]
pop edi
mov dword [ebp - 0xc], ecx
mov byte [eax + ebx + 0x2b], 0xa
mov ebx, dword [ebp + 8]
jne 0x503453
mov eax, dword [ebp - 0x10]
mov ebx, dword [ebp - 8]
mov eax, dword [eax*4 + 0x563e30]
mov al, byte [eax + ebx + 0x2c]
mov ebx, dword [ebp + 8]
cmp al, 0xa
je 0x503453
test ecx, ecx
je 0x503453
mov byte [edx], al
inc edx
mov eax, dword [ebp - 0x10]
dec ecx
mov dword [ebp - 0xc], ecx
mov ecx, dword [ebp - 8]
push 3
mov eax, dword [eax*4 + 0x563e30]
mov dword [ebp - 0x14], edx
pop edi
mov byte [eax + ecx + 0x2c], 0xa
push ebx
call fcn.005035a0
pop ecx
test eax, eax
je 0x5034ce
mov eax, dword [ebp - 0x10]
mov ecx, dword [ebp - 8]
mov eax, dword [eax*4 + 0x563e30]
cmp byte [eax + ecx + 0x28], 0
jge 0x5034ce
lea eax, [ebp - 0x28]
push eax
push dword [ebp - 0x18]
call dword [sym.imp.KERNEL32.dll_GetConsoleMode]
test eax, eax
je 0x5034ce
cmp byte [ebp - 1], 2
jne 0x5034d2
push 0
lea eax, [ebp - 0x1c]
push eax
mov eax, dword [ebp - 0xc]
shr eax, 1
push eax
push dword [ebp - 0x14]
push dword [ebp - 0x18]
call dword [sym.imp.KERNEL32.dll_ReadConsoleW]
test eax, eax
jne 0x5034c3
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
call fcn.004e765d
pop ecx
or edi, 0xffffffff
push esi
call fcn.004fd750
pop ecx
mov eax, edi
jmp 0x503599
mov eax, dword [ebp - 0x1c]
mov ecx, dword [ebp + 0x10]
lea edi, [edi + eax*2]
jmp 0x5034f7
mov byte [ebp - 0x20], 0
push 0
lea eax, [ebp - 0x1c]
push eax
mov eax, dword [ebp - 0xc]
push eax
push dword [ebp - 0x14]
push dword [ebp - 0x18]
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x503546
mov ecx, dword [ebp + 0x10]
cmp dword [ebp - 0x1c], ecx
ja 0x503546
add edi, dword [ebp - 0x1c]
mov eax, dword [ebp - 0x10]
mov edx, dword [ebp - 8]
mov eax, dword [eax*4 + 0x563e30]
cmp byte [eax + edx + 0x28], 0
jge 0x5034b5
cmp byte [ebp - 1], 2
je 0x503528
shr ecx, 1
push ecx
push dword [ebp + 0xc]
push edi
push dword [ebp - 0x14]
push ebx
call fcn.00503031
add esp, 0x14
mov edi, eax
jmp 0x5034b5
shr edi, 1
cmp byte [ebp - 0x20], 0
push edi
push dword [ebp - 0x24]
push ebx
je 0x50353f
call fcn.00503185
add esp, 0xc
jmp 0x503524
call fcn.00502e86
jmp 0x50353a
call dword [sym.imp.KERNEL32.dll_GetLastError]
push 5
pop edi
cmp eax, edi
jne 0x50356a
call fcn.004e7693
mov dword [eax], 9
call fcn.004e7680
mov dword [eax], edi
jmp 0x5034b2
cmp eax, 0x6d
jne 0x5034ab
xor edi, edi
jmp 0x5034b5
xor eax, eax
jmp 0x503599
call fcn.004e7680
and dword [eax], 0
call fcn.004e7693
mov dword [eax], 9
call fcn.004e75b9
or eax, 0xffffffff
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret