Function at 0x4051d0
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]
mov esi, dword [ebp + 0x10]
mov eax, dword [0x40be7c]
cmp ebx, eax
jae 0x405200
mov eax, ebx
and eax, 0x1f
mov edx, ebx
sar edx, 5
mov edx, dword [edx*4 + 0x40bd7c]
test byte [edx + eax*8 + 4], 1
jne 0x405212
mov dword [0x40b8e0], 9
or eax, 0xffffffff
jmp 0x4054d7
test esi, esi
je 0x40522e
mov eax, ebx
and eax, 0x1f
mov edx, ebx
sar edx, 5
mov edx, dword [edx*4 + 0x40bd7c]
test byte [edx + eax*8 + 4], 2
je 0x405235
xor eax, eax
jmp 0x4054d7
mov eax, dword [ebp + 0xc]
mov edi, eax
mov eax, ebx
and eax, 0x1f
mov edx, ebx
sar edx, 5
mov edx, dword [edx*4 + 0x40bd7c]
lea eax, [edx + eax*8]
mov dword [ebp - 0xc], 0
test byte [eax + 4], 0x48
je 0x40529e
mov dword [ebp - 0xc], 0
cmp byte [eax + 5], 0xa
je 0x40529e
mov eax, ebx
and eax, 0x1f
mov edx, ebx
sar edx, 5
mov edx, dword [edx*4 + 0x40bd7c]
mov al, byte [edx + eax*8 + 5]
mov byte [edi], al
inc edi
dec esi
mov eax, ebx
and eax, 0x1f
mov edx, ebx
sar edx, 5
mov edx, dword [edx*4 + 0x40bd7c]
mov byte [edx + eax*8 + 5], 0xa
mov dword [ebp - 0xc], 1
push ebx
call fcn.00406df0
pop ecx
push 0
lea edx, [ebp - 4]
push edx
push esi
push edi
push eax
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
jne 0x4052f2
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov edx, eax
cmp eax, 5
jne 0x4052d7
mov dword [0x40b8e0], 9
or eax, 0xffffffff
jmp 0x4054d7
cmp edx, 0x6d
jne 0x4052e3
xor eax, eax
jmp 0x4054d7
push edx
call fcn.00406fc0
pop ecx
or eax, 0xffffffff
jmp 0x4054d7
mov eax, dword [ebp - 0xc]
add eax, dword [ebp - 4]
mov dword [ebp - 0xc], eax
mov eax, ebx
and eax, 0x1f
mov edx, ebx
sar edx, 5
mov edx, dword [edx*4 + 0x40bd7c]
test byte [edx + eax*8 + 4], 0x80
je 0x4054d4
cmp dword [ebp - 4], 0
je 0x40533f
mov eax, dword [ebp + 0xc]
cmp byte [eax], 0xa
jne 0x40533f
mov eax, ebx
and eax, 0x1f
mov edx, ebx
sar edx, 5
mov edx, dword [edx*4 + 0x40bd7c]
lea eax, [edx + eax*8 + 4]
or byte [eax], 4
jmp 0x405357
mov eax, ebx
and eax, 0x1f
mov edx, ebx
sar edx, 5
mov edx, dword [edx*4 + 0x40bd7c]
lea eax, [edx + eax*8 + 4]
and byte [eax], 0xfb
mov eax, dword [ebp + 0xc]
mov esi, eax
mov eax, dword [ebp + 0xc]
mov edi, eax
jmp 0x405471
cmp byte [edi], 0x1a
jne 0x4053a4
mov eax, ebx
and eax, 0x1f
mov edx, ebx
sar edx, 5
mov edx, dword [edx*4 + 0x40bd7c]
test byte [edx + eax*8 + 4], 0x40
jne 0x40547f
mov eax, ebx
and eax, 0x1f
mov edx, ebx
sar edx, 5
mov edx, dword [edx*4 + 0x40bd7c]
lea eax, [edx + eax*8 + 4]
or byte [eax], 2
jmp 0x40547f
cmp byte [edi], 0xd
je 0x4053b4
mov al, byte [edi]
mov byte [esi], al
inc edi
inc esi
jmp 0x405471
mov eax, dword [ebp - 0xc]
add eax, dword [ebp + 0xc]
dec eax
cmp edi, eax
jae 0x4053dc
cmp byte [edi + 1], 0xa
jne 0x4053d1
add edi, 2
mov byte [esi], 0xa
inc esi
jmp 0x405471
mov al, byte [edi]
mov byte [esi], al
inc edi
inc esi
jmp 0x405471
inc edi
push ebx
call fcn.00406df0
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 0x405401
cmp dword [ebp - 4], 0
jne 0x405407
mov byte [esi], 0xd
inc esi
jmp 0x405471
mov eax, ebx
and eax, 0x1f
mov edx, ebx
sar edx, 5
mov edx, dword [edx*4 + 0x40bd7c]
test byte [edx + eax*8 + 4], 0x48
je 0x405449
cmp byte [ebp - 5], 0xa
jne 0x40542b
mov byte [esi], 0xa
inc esi
jmp 0x405471
mov byte [esi], 0xd
inc esi
mov edx, ebx
and edx, 0x1f
mov eax, ebx
sar eax, 5
mov ecx, dword [eax*4 + 0x40bd7c]
mov al, byte [ebp - 5]
mov byte [ecx + edx*8 + 5], al
jmp 0x405471
cmp esi, dword [ebp + 0xc]
jne 0x40545a
cmp byte [ebp - 5], 0xa
jne 0x40545a
mov byte [esi], 0xa
inc esi
jmp 0x405471
push 1
push 0xffffffffffffffff
push ebx
call fcn.00406b60
add esp, 0xc
cmp byte [ebp - 5], 0xa
je 0x405471
mov byte [esi], 0xd
inc esi
mov eax, dword [ebp - 0xc]
add eax, dword [ebp + 0xc]
cmp edi, eax
jb 0x405366
mov eax, dword [ebp + 0xc]
neg eax
add eax, esi
mov dword [ebp - 0xc], eax
mov eax, ebx
and eax, 0x1f
mov edx, ebx
sar edx, 5
mov edx, dword [edx*4 + 0x40bd7c]
test byte [edx + eax*8 + 4], 0x40
je 0x4054d4
push ebx
call fcn.00406df0
pop ecx
lea edx, [ebp - 4]
push edx
push eax
call dword [sym.imp.KERNEL32.dll_GetConsoleMode]
test eax, eax
je 0x4054d4
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 [0x40b8d8]
push eax
call fcn.00406f10
add esp, 0x10
mov eax, dword [ebp - 0xc]
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret