Function at 0x404fa0
Capabilities:
Read file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0xc
push ebx
push esi
push edi
mov ebx, dword [ebp + 8]
cmp ebx, dword [0x40c27c]
jae 0x40528b
mov eax, ebx
and eax, 0x1f
mov edx, ebx
shr edx, 5
mov edx, dword [edx*4 + 0x40c17c]
test byte [edx + eax*8 + 4], 1
je 0x40528b
cmp dword [ebp + 0x10], 0
je 0x40524e
mov eax, ebx
and eax, 0x1f
mov edx, ebx
shr edx, 5
mov edx, dword [edx*4 + 0x40c17c]
test byte [edx + eax*8 + 4], 2
jne 0x40524e
mov eax, dword [ebp + 0xc]
mov esi, eax
mov eax, ebx
and eax, 0x1f
mov edx, ebx
shr edx, 5
mov edx, dword [edx*4 + 0x40c17c]
lea eax, [edx + eax*8]
test byte [eax + 4], 0x48
jne 0x405022
mov dword [ebp - 0xc], 0
jmp 0x40506b
cmp byte [eax + 5], 0xa
jne 0x405031
mov dword [ebp - 0xc], 0
jmp 0x40506b
mov edx, esi
inc esi
mov eax, ebx
and eax, 0x1f
mov ecx, ebx
shr ecx, 5
mov ecx, dword [ecx*4 + 0x40c17c]
mov al, byte [ecx + eax*8 + 5]
mov byte [edx], al
dec dword [ebp + 0x10]
mov eax, ebx
and eax, 0x1f
mov edx, ebx
shr edx, 5
mov edx, dword [edx*4 + 0x40c17c]
mov byte [edx + eax*8 + 5], 0xa
mov dword [ebp - 0xc], 1
push ebx
call fcn.00406c10
pop ecx
push 0
lea edx, [ebp - 4]
push edx
mov edx, dword [ebp + 0x10]
push edx
push esi
push eax
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x40523c
mov eax, dword [ebp - 0xc]
add eax, dword [ebp - 4]
mov dword [ebp - 0xc], eax
mov eax, ebx
and eax, 0x1f
mov edx, ebx
shr edx, 5
mov edx, dword [edx*4 + 0x40c17c]
test byte [edx + eax*8 + 4], 0x80
je 0x405237
cmp dword [ebp - 4], 0
je 0x4050d9
mov eax, dword [ebp + 0xc]
cmp byte [eax], 0xa
jne 0x4050d9
mov eax, ebx
and eax, 0x1f
mov edx, ebx
shr edx, 5
mov edx, dword [edx*4 + 0x40c17c]
lea eax, [edx + eax*8 + 4]
or byte [eax], 4
jmp 0x4050f1
mov eax, ebx
and eax, 0x1f
mov edx, ebx
shr edx, 5
mov edx, dword [edx*4 + 0x40c17c]
lea eax, [edx + eax*8 + 4]
and byte [eax], 0xfb
mov eax, dword [ebp + 0xc]
mov edi, eax
mov eax, dword [ebp + 0xc]
mov esi, eax
jmp 0x4051d6
cmp byte [esi], 0x1a
je 0x405252
cmp byte [esi], 0xd
je 0x405119
mov al, byte [esi]
mov byte [edi], al
inc esi
inc edi
jmp 0x4051d6
mov eax, dword [ebp + 0xc]
add eax, dword [ebp - 0xc]
dec eax
cmp esi, eax
jae 0x405141
cmp byte [esi + 1], 0xa
jne 0x405136
add esi, 2
mov byte [edi], 0xa
inc edi
jmp 0x4051d6
mov al, byte [esi]
mov byte [edi], al
inc esi
inc edi
jmp 0x4051d6
inc esi
push ebx
call fcn.00406c10
pop ecx
push 0
lea edx, [ebp - 4]
push edx
push 1
lea edx, [ebp - 5]
push edx
push eax
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x405166
cmp dword [ebp - 4], 0
jne 0x40516c
mov byte [edi], 0xd
inc edi
jmp 0x4051d6
mov eax, ebx
and eax, 0x1f
mov edx, ebx
shr edx, 5
mov edx, dword [edx*4 + 0x40c17c]
test byte [edx + eax*8 + 4], 0x48
je 0x4051ae
cmp byte [ebp - 5], 0xa
jne 0x405190
mov byte [edi], 0xa
inc edi
jmp 0x4051d6
mov byte [edi], 0xd
inc edi
mov edx, ebx
and edx, 0x1f
mov eax, ebx
shr eax, 5
mov ecx, dword [eax*4 + 0x40c17c]
mov al, byte [ebp - 5]
mov byte [ecx + edx*8 + 5], al
jmp 0x4051d6
cmp edi, dword [ebp + 0xc]
jne 0x4051bf
cmp byte [ebp - 5], 0xa
jne 0x4051bf
mov byte [edi], 0xa
inc edi
jmp 0x4051d6
push 1
push 0xffffffffffffffff
push ebx
call fcn.00406f70
add esp, 0xc
cmp byte [ebp - 5], 0xa
je 0x4051d6
mov byte [edi], 0xd
inc edi
mov eax, dword [ebp + 0xc]
add eax, dword [ebp - 0xc]
cmp esi, eax
jb 0x405100
mov eax, edi
sub eax, dword [ebp + 0xc]
mov dword [ebp - 0xc], eax
mov eax, ebx
and eax, 0x1f
mov edx, ebx
shr edx, 5
mov edx, dword [edx*4 + 0x40c17c]
test byte [edx + eax*8 + 4], 0x40
je 0x405237
push ebx
call fcn.00406c10
pop ecx
lea edx, [ebp - 4]
push edx
push eax
call dword [sym.imp.KERNEL32.dll_GetConsoleMode]
test eax, eax
je 0x405237
call dword [sym.imp.KERNEL32.dll_GetConsoleCP]
mov edx, dword [ebp - 0xc]
push edx
mov edx, dword [ebp + 0xc]
push edx
push eax
mov eax, dword [0x40b888]
push eax
call fcn.00406d30
add esp, 0x10
mov eax, dword [ebp - 0xc]
jmp 0x4052a4
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov edx, eax
cmp eax, 5
je 0x40528b
cmp edx, 0x6d
jne 0x40529a
xor eax, eax
jmp 0x4052a4
mov eax, ebx
and eax, 0x1f
mov ecx, ebx
shr ecx, 5
mov ecx, dword [ecx*4 + 0x40c17c]
test byte [ecx + eax*8 + 4], 0x40
jne 0x4051e4
mov eax, ebx
and eax, 0x1f
mov ecx, ebx
shr ecx, 5
mov ecx, dword [ecx*4 + 0x40c17c]
lea eax, [ecx + eax*8 + 4]
or byte [eax], 2
jmp 0x4051e4
mov dword [0x40b890], 9
or eax, 0xffffffff
jmp 0x4052a4
push edx
call fcn.00406df0
pop ecx
or eax, 0xffffffff
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret