Function at 0x405130
Capabilities:
Read file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0xc
push esi
push edi
mov eax, dword [ebp + 8]
cmp eax, dword [0x40c1f4]
jae 0x405410
mov edx, eax
and edx, 0x1f
shr eax, 5
mov eax, dword [eax*4 + 0x40c0f4]
test byte [eax + edx*8 + 4], 1
je 0x405410
cmp dword [ebp + 0x10], 0
je 0x4053d1
mov eax, dword [ebp + 8]
mov edx, eax
and edx, 0x1f
shr eax, 5
mov eax, dword [eax*4 + 0x40c0f4]
test byte [eax + edx*8 + 4], 2
jne 0x4053d1
mov eax, dword [ebp + 0xc]
mov esi, eax
mov eax, dword [ebp + 8]
mov edx, eax
and edx, 0x1f
shr eax, 5
mov eax, dword [eax*4 + 0x40c0f4]
lea edx, [eax + edx*8]
test byte [edx + 4], 0x48
je 0x4051ae
cmp byte [edx + 5], 0xa
jne 0x4051b7
mov dword [ebp - 0xc], 0
jmp 0x4051f3
mov eax, esi
inc esi
mov edx, dword [ebp + 8]
mov ecx, edx
and ecx, 0x1f
shr edx, 5
mov edx, dword [edx*4 + 0x40c0f4]
mov dl, byte [edx + ecx*8 + 5]
mov byte [eax], dl
dec dword [ebp + 0x10]
mov eax, dword [ebp + 8]
mov edx, eax
and edx, 0x1f
shr eax, 5
mov eax, dword [eax*4 + 0x40c0f4]
mov byte [eax + edx*8 + 5], 0xa
mov dword [ebp - 0xc], 1
mov eax, dword [ebp + 8]
push eax
call fcn.00406da0
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 0x4053bf
mov eax, dword [ebp - 0xc]
add eax, dword [ebp - 4]
mov dword [ebp - 0xc], eax
mov eax, dword [ebp + 8]
mov edx, eax
and edx, 0x1f
shr eax, 5
mov eax, dword [eax*4 + 0x40c0f4]
test byte [eax + edx*8 + 4], 0x80
je 0x4053ba
cmp dword [ebp - 4], 0
je 0x405266
mov eax, dword [ebp + 0xc]
cmp byte [eax], 0xa
jne 0x405266
mov eax, dword [ebp + 8]
mov edx, eax
and edx, 0x1f
shr eax, 5
mov eax, dword [eax*4 + 0x40c0f4]
lea edx, [eax + edx*8 + 4]
or byte [edx], 4
jmp 0x40527f
mov eax, dword [ebp + 8]
mov edx, eax
and edx, 0x1f
shr eax, 5
mov eax, dword [eax*4 + 0x40c0f4]
lea edx, [eax + edx*8 + 4]
and byte [edx], 0xfb
mov eax, dword [ebp + 0xc]
mov edi, eax
mov eax, dword [ebp + 0xc]
mov esi, eax
jmp 0x405355
cmp byte [esi], 0x1a
je 0x4053d5
cmp byte [esi], 0xd
jne 0x4052b9
mov eax, dword [ebp + 0xc]
add eax, dword [ebp - 0xc]
dec eax
cmp esi, eax
jae 0x4052c4
cmp byte [esi + 1], 0xa
jne 0x4052b9
add esi, 2
mov byte [edi], 0xa
inc edi
jmp 0x405355
mov al, byte [esi]
mov byte [edi], al
inc esi
inc edi
jmp 0x405355
inc esi
mov eax, dword [ebp + 8]
push eax
call fcn.00406da0
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 0x405351
cmp dword [ebp - 4], 0
je 0x405351
mov eax, dword [ebp + 8]
mov edx, eax
and edx, 0x1f
shr eax, 5
mov eax, dword [eax*4 + 0x40c0f4]
test byte [eax + edx*8 + 4], 0x48
je 0x40532a
cmp byte [ebp - 5], 0xa
je 0x405335
mov byte [edi], 0xd
inc edi
mov eax, dword [ebp + 8]
mov edx, eax
and edx, 0x1f
shr eax, 5
mov eax, dword [eax*4 + 0x40c0f4]
mov cl, byte [ebp - 5]
mov byte [eax + edx*8 + 5], cl
jmp 0x405355
cmp edi, dword [ebp + 0xc]
jne 0x40533b
cmp byte [ebp - 5], 0xa
jne 0x40533b
mov byte [edi], 0xa
inc edi
jmp 0x405355
push 1
push 0xffffffffffffffff
mov eax, dword [ebp + 8]
push eax
call fcn.00406b40
add esp, 0xc
cmp byte [ebp - 5], 0xa
je 0x405355
mov byte [edi], 0xd
inc edi
mov eax, dword [ebp + 0xc]
add eax, dword [ebp - 0xc]
cmp esi, eax
jb 0x40528e
mov eax, edi
sub eax, dword [ebp + 0xc]
mov dword [ebp - 0xc], eax
mov eax, dword [ebp + 8]
mov edx, eax
and edx, 0x1f
shr eax, 5
mov eax, dword [eax*4 + 0x40c0f4]
test byte [eax + edx*8 + 4], 0x40
je 0x4053ba
mov eax, dword [ebp + 8]
push eax
call fcn.00406da0
pop ecx
lea edx, [ebp - 4]
push edx
push eax
call dword [sym.imp.KERNEL32.dll_GetConsoleMode]
test eax, eax
je 0x4053ba
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 [0x40b868]
push eax
call fcn.00406ec0
add esp, 0x10
mov eax, dword [ebp - 0xc]
jmp 0x405429
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov edx, eax
cmp eax, 5
je 0x405410
cmp edx, 0x6d
jne 0x40541f
xor eax, eax
jmp 0x405429
mov eax, dword [ebp + 8]
mov ecx, eax
and ecx, 0x1f
shr eax, 5
mov eax, dword [eax*4 + 0x40c0f4]
test byte [eax + ecx*8 + 4], 0x40
jne 0x405363
mov eax, dword [ebp + 8]
mov ecx, eax
and ecx, 0x1f
shr eax, 5
mov eax, dword [eax*4 + 0x40c0f4]
lea ecx, [eax + ecx*8 + 4]
or byte [ecx], 2
jmp 0x405363
mov dword [0x40b870], 9
or eax, 0xffffffff
jmp 0x405429
push edx
call fcn.00406f80
pop ecx
or eax, 0xffffffff
pop edi
pop esi
mov esp, ebp
pop ebp
ret