Function at 0x509ca7
Capabilities:
Read file on windows

Disassembly:
mov edi, edi
push ebp
mov ebp, esp
mov edx, dword [ebp + 8]
sub esp, 0x24
push ebx
push edi
cmp edx, 0xfffffffe
jne 0x509cd1
call fcn.004ba498
and dword [eax], 0
call fcn.004ba4ab
mov dword [eax], 9
jmp 0x50a02b
test edx, edx
js 0x50a013
cmp edx, dword [0x59f948]
jae 0x50a013
mov eax, edx
mov ecx, edx
shr ecx, 6
and eax, 0x3f
imul edi, eax, 0x38
xor ebx, ebx
mov dword [ebp - 8], ecx
inc ebx
mov dword [ebp - 0x1c], ebx
mov eax, dword [ecx*4 + 0x59f748]
mov dword [ebp - 0x10], edi
mov cl, byte [edi + eax + 0x28]
mov byte [ebp - 1], cl
test bl, cl
je 0x50a013
mov ecx, dword [ebp + 0x10]
cmp ecx, 0x7fffffff
jbe 0x509d37
call fcn.004ba498
and dword [eax], 0
call fcn.004ba4ab
mov dword [eax], 0x16
jmp 0x50a026
test ecx, ecx
je 0x50a00f
test byte [ebp - 1], 2
jne 0x50a00f
cmp dword [ebp + 0xc], 0
je 0x509d1f
push esi
mov esi, dword [edi + eax + 0x18]
mov al, byte [edi + eax + 0x29]
mov byte [ebp - 1], al
mov dword [ebp - 0x14], esi
xor esi, esi
movsx eax, al
sub eax, 1
je 0x509d9b
sub eax, 1
jne 0x509d91
mov eax, ecx
not eax
test bl, al
jne 0x509d91
call fcn.004ba498
and dword [eax], esi
call fcn.004ba4ab
mov dword [eax], 0x16
call fcn.004ba334
jmp 0x509f46
mov ebx, ecx
mov ecx, dword [ebp + 0xc]
mov dword [ebp - 0xc], ecx
jmp 0x509e0e
mov eax, ecx
not eax
test bl, al
je 0x509d75
push 4
shr ecx, 1
pop ebx
cmp ecx, ebx
jb 0x509dae
mov ebx, ecx
push ebx
call fcn.004f3813
push 0
mov esi, eax
call fcn.004f37d9
push 0
call fcn.004f37d9
add esp, 0xc
mov dword [ebp - 0xc], esi
test esi, esi
jne 0x509de9
call fcn.004ba4ab
mov dword [eax], 0xc
call fcn.004ba498
mov dword [eax], 8
jmp 0x509f46
push 1
push 0
push 0
push dword [ebp + 8]
call fcn.0050b4d8
mov ecx, dword [ebp - 8]
add esp, 0x10
mov ecx, dword [ecx*4 + 0x59f748]
mov dword [edi + ecx + 0x20], eax
mov dword [edi + ecx + 0x24], edx
mov ecx, esi
mov eax, dword [ebp - 8]
xor edi, edi
mov dword [ebp - 0x20], ecx
mov eax, dword [eax*4 + 0x59f748]
mov dword [ebp - 0x18], eax
mov edx, eax
mov eax, dword [ebp - 0x10]
test byte [eax + edx + 0x28], 0x48
mov edx, dword [ebp + 8]
je 0x509ee9
mov ecx, dword [ebp - 0x18]
mov al, byte [eax + ecx + 0x2a]
mov ecx, dword [ebp - 0xc]
cmp al, 0xa
je 0x509ee9
test ebx, ebx
je 0x509ee9
mov edx, dword [ebp - 0x10]
inc edi
mov byte [ecx], al
inc ecx
mov eax, dword [ebp - 8]
dec ebx
cmp byte [ebp - 1], 0
mov dword [ebp - 0xc], ecx
mov eax, dword [eax*4 + 0x59f748]
mov byte [edx + eax + 0x2a], 0xa
mov edx, dword [ebp + 8]
je 0x509ee9
mov eax, dword [ebp - 8]
mov edx, dword [ebp - 0x10]
mov eax, dword [eax*4 + 0x59f748]
mov al, byte [edx + eax + 0x2b]
mov edx, dword [ebp + 8]
cmp al, 0xa
je 0x509ee9
test ebx, ebx
je 0x509ee9
mov edx, dword [ebp - 0x10]
mov byte [ecx], al
inc ecx
mov eax, dword [ebp - 8]
dec ebx
cmp byte [ebp - 1], 1
push 2
mov dword [ebp - 0xc], ecx
mov eax, dword [eax*4 + 0x59f748]
pop edi
mov byte [edx + eax + 0x2b], 0xa
mov edx, dword [ebp + 8]
jne 0x509ee9
mov eax, dword [ebp - 8]
mov edx, dword [ebp - 0x10]
mov eax, dword [eax*4 + 0x59f748]
mov al, byte [edx + eax + 0x2c]
mov edx, dword [ebp + 8]
cmp al, 0xa
je 0x509ee9
test ebx, ebx
je 0x509ee9
mov byte [ecx], al
inc ecx
mov eax, dword [ebp - 8]
dec ebx
mov dword [ebp - 0xc], ecx
mov ecx, dword [ebp - 0x10]
push 3
mov eax, dword [eax*4 + 0x59f748]
pop edi
mov byte [ecx + eax + 0x2c], 0xa
push edx
call fcn.0050942f
pop ecx
test eax, eax
je 0x509f63
mov eax, dword [ebp - 8]
mov ecx, dword [ebp - 0x10]
mov eax, dword [eax*4 + 0x59f748]
cmp byte [ecx + eax + 0x28], 0
jge 0x509f63
lea eax, [ebp - 0x24]
push eax
push dword [ebp - 0x14]
call dword [sym.imp.KERNEL32.dll_GetConsoleMode]
test eax, eax
je 0x509f63
cmp byte [ebp - 1], 2
jne 0x509f67
push 0
lea eax, [ebp - 0x18]
shr ebx, 1
push eax
push ebx
mov ebx, dword [ebp - 0xc]
push ebx
push dword [ebp - 0x14]
call dword [sym.imp.KERNEL32.dll_ReadConsoleW]
test eax, eax
jne 0x509f58
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
call fcn.004ba451
pop ecx
or edi, 0xffffffff
push esi
call fcn.004f37d9
pop ecx
mov eax, edi
pop esi
jmp 0x50a02e
mov eax, dword [ebp - 0x18]
mov ecx, dword [ebp + 0x10]
lea edi, [edi + eax*2]
jmp 0x509f8a
mov byte [ebp - 0x1c], 0
push 0
lea eax, [ebp - 0x18]
push eax
push ebx
mov ebx, dword [ebp - 0xc]
push ebx
push dword [ebp - 0x14]
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x509fdb
mov ecx, dword [ebp + 0x10]
cmp dword [ebp - 0x18], ecx
ja 0x509fdb
add edi, dword [ebp - 0x18]
mov eax, dword [ebp - 8]
mov edx, dword [ebp - 0x10]
mov eax, dword [eax*4 + 0x59f748]
cmp byte [edx + eax + 0x28], 0
jge 0x509f49
cmp byte [ebp - 1], 2
je 0x509fbb
shr ecx, 1
push ecx
push dword [ebp + 0xc]
push edi
push ebx
push dword [ebp + 8]
call fcn.005099b9
add esp, 0x14
mov edi, eax
jmp 0x509f49
shr edi, 1
cmp byte [ebp - 0x1c], 0
push edi
push dword [ebp - 0x20]
push dword [ebp + 8]
je 0x509fd4
call fcn.00509b10
add esp, 0xc
jmp 0x509fb7
call fcn.0050979d
jmp 0x509fcf
call dword [sym.imp.KERNEL32.dll_GetLastError]
push 5
pop edi
cmp eax, edi
jne 0x509fff
call fcn.004ba4ab
mov dword [eax], 9
call fcn.004ba498
mov dword [eax], edi
jmp 0x509f46
cmp eax, 0x6d
jne 0x509f3f
xor edi, edi
jmp 0x509f49
xor eax, eax
jmp 0x50a02e
call fcn.004ba498
and dword [eax], 0
call fcn.004ba4ab
mov dword [eax], 9
call fcn.004ba334
or eax, 0xffffffff
pop edi
pop ebx
leave
ret