Function at 0x4051a0
Capabilities:
Read file on windows
Write file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 8
call fcn.004013c0
call fcn.00405690
sub esp, 0xc
mov eax, dword [ebp + 8]
push eax
call sub.msvcrt.dll_exit
lea esi, [esi]
push ebp
mov ebp, esp
push edi
push esi
push ebx
sub esp, 0x1c
mov esi, dword [ebp + 8]
mov ecx, dword [esi + 0x14]
test ecx, ecx
jle 0x4051d4
xor ebx, ebx
mov eax, dword [esi + 0x18]
mov eax, dword [eax + ebx*4]
push edx
inc ebx
mov edi, dword [eax + 0xc]
push edi
push 0
mov ecx, dword [eax + 8]
push ecx
call sub.msvcrt.dll_memset
add esp, 0x10
cmp dword [esi + 0x14], ebx
jg 0x4051b5
mov edx, dword [0x421008]
xor eax, eax
test edx, edx
je 0x4051e8
lea esp, [ebp - 0xc]
pop ebx
pop esi
pop edi
pop ebp
ret
sub esp, 0xc
push 0xfffffffffffffff6
call sub.KERNEL32.dll_GetStdHandle
mov edi, eax
push 0xfffffffffffffff5
call sub.KERNEL32.dll_GetStdHandle
add esp, 0xc
cmp edi, 0xffffffff
je 0x40535c
inc eax
je 0x40535c
mov eax, dword [esi + 8]
test eax, eax
je 0x405346
mov eax, dword [esi + 4]
test eax, eax
je 0x405346
push ebx
push ebx
push eax
push 0xd
call fcn.0040b6e0
add esp, 0x10
mov eax, dword [esi + 0xc]
test eax, eax
je 0x405387
push edx
push edx
push eax
push 0xd
call fcn.0040b6e0
add esp, 0x10
mov eax, dword [esi + 0x14]
test eax, eax
je 0x405339
mov dword [ebp - 0x20], 0
jmp 0x405278
cmp al, 0xa
je 0x405307
mov eax, dword [ebp - 0x20]
inc eax
mov dword [ebp - 0x20], eax
mov eax, dword [ebp - 0x20]
cmp dword [esi + 0x14], eax
jbe 0x405339
mov edx, dword [ebp - 0x20]
mov eax, dword [esi + 0x18]
mov dword [ebp - 0x14], 0
mov ebx, dword [eax + edx*4]
lea eax, [ebp - 0x10]
push ecx
push ecx
push eax
push edi
call sub.KERNEL32.dll_GetConsoleMode
mov eax, dword [ebp - 0x10]
or eax, 3
and eax, 0xfffffffb
push eax
push edi
call sub.KERNEL32.dll_SetConsoleMode
pop eax
mov eax, dword [ebx]
pop edx
push eax
push 0
push str._d_s_n
push 8
call fcn.0040b6e0
lea edx, [ebp - 0x14]
mov dword [esp], 0
push edx
mov eax, dword [ebx + 0xc]
dec eax
push eax
mov eax, dword [ebx + 8]
push eax
push edi
call sub.KERNEL32.dll_ReadFile
pop eax
mov eax, dword [ebp - 0x10]
push eax
push edi
call sub.KERNEL32.dll_SetConsoleMode
mov eax, dword [ebx + 0xc]
pop edx
cmp eax, dword [ebp - 0x14]
pop ecx
jae 0x4052ea
dec eax
mov dword [ebp - 0x14], eax
mov edx, dword [ebp - 0x14]
mov ecx, dword [ebx + 8]
lea eax, [edx - 1]
mov byte [ecx + edx], 0
mov dword [ebp - 0x14], eax
lea ebx, [ecx + eax]
mov al, byte [ebx]
cmp al, 0xd
jne 0x40525d
lea eax, [edx - 2]
lea edx, [ecx + eax]
lea esi, [esi]
mov byte [ebx], 0
mov dword [ebp - 0x14], eax
mov cl, byte [edx]
mov ebx, edx
dec eax
dec edx
cmp cl, 0xd
je 0x405310
cmp cl, 0xa
je 0x405310
mov eax, dword [ebp - 0x20]
inc eax
mov dword [ebp - 0x20], eax
mov eax, dword [ebp - 0x20]
cmp dword [esi + 0x14], eax
ja 0x405278
lea esp, [ebp - 0xc]
mov eax, 1
pop ebx
pop esi
pop edi
pop ebp
ret
push ecx
push ecx
push 0x41bc2a
push 0xd
call fcn.0040b6e0
add esp, 0x10
jmp 0x405231
mov eax, dword [sym.imp.msvcrt.dll__iob]
add eax, 0x40
push eax
push 0x29
push 1
push str.Cannot_get_standard_input_output_handles_n
call sub.msvcrt.dll_fwrite
mov dword [esp], 1
call fcn.00405180
add esp, 0x10
jmp 0x40520e
push ebx
push ebx
push 0x41bc2a
push 0xd
call fcn.0040b6e0
add esp, 0x10
jmp 0x405249