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

Disassembly:
push ebp
mov ebp, esp
sub esp, 8
call fcn.004013c0
call fcn.004056b0
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 0x4051e4
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 0x4051c5
mov edx, dword [0x421010]
xor eax, eax
test edx, edx
je 0x4051f8
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 0x40536c
inc eax
je 0x40536c
mov eax, dword [esi + 8]
test eax, eax
je 0x405356
mov eax, dword [esi + 4]
test eax, eax
je 0x405356
push ebx
push ebx
push eax
push 0xd
call fcn.0040b6d0
add esp, 0x10
mov eax, dword [esi + 0xc]
test eax, eax
je 0x405397
push edx
push edx
push eax
push 0xd
call fcn.0040b6d0
add esp, 0x10
mov eax, dword [esi + 0x14]
test eax, eax
je 0x405349
mov dword [ebp - 0x20], 0
jmp 0x405288
cmp al, 0xa
je 0x405317
mov eax, dword [ebp - 0x20]
inc eax
mov dword [ebp - 0x20], eax
mov eax, dword [ebp - 0x20]
cmp dword [esi + 0x14], eax
jbe 0x405349
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.0040b6d0
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 0x4052fa
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 0x40526d
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 0x405320
cmp cl, 0xa
je 0x405320
mov eax, dword [ebp - 0x20]
inc eax
mov dword [ebp - 0x20], eax
mov eax, dword [ebp - 0x20]
cmp dword [esi + 0x14], eax
ja 0x405288
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.0040b6d0
add esp, 0x10
jmp 0x405241
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.00405190
add esp, 0x10
jmp 0x40521e
push ebx
push ebx
push 0x41bc2a
push 0xd
call fcn.0040b6d0
add esp, 0x10
jmp 0x405259