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

Disassembly:
mov qword [rsp + 0x10], rbx
push rbp
push rsi
push rdi
push r12
push r13
push r14
push r15
sub rsp, 0x40
xor r12d, r12d
mov rdi, rcx
mov esi, r12d
lea r13d, [r12 + 1]
cmp dword [rcx + 0x28], r12d
jle 0x140002e5f
mov ebx, r12d
mov rcx, qword [rdi + 0x30]
lea rdx, [0x140065603]
mov rcx, qword [rbx + rcx]
call fcn.1400396c4
add esi, r13d
lea rbx, [rbx + 8]
cmp esi, dword [rdi + 0x28]
jl 0x140002e3f
cmp qword [rdi + 0x28], r12
je 0x140002e8e
cmp dword [0x140085620], r12d
je 0x140002e75
xor eax, eax
jmp 0x1400030ae
mov ecx, 0xfffffff6
call qword [sym.imp.KERNEL32.dll_GetStdHandle]
mov r14, rax
cmp rax, 0xffffffffffffffff
jne 0x140002e96
jmp 0x1400030d5
mov r14, qword [rsp + 0x80]
cmp dword [rdi + 0x10], r12d
je 0x140002ea6
cmp qword [rdi + 8], r12
jne 0x140002f7d
cmp qword [rdi + 0x18], r12
jne 0x140002f7d
cmp qword [rdi + 0x28], r12
jne 0x140002f7d
mov rsi, qword [rsp + 0x80]
cmp dword [rdi + 0x10], r12d
je 0x140002f05
mov rcx, qword [rdi + 8]
test rcx, rcx
je 0x140002f05
call fcn.14004bdc0
mov rdx, qword [rdi + 8]
mov r8d, eax
mov rcx, rsi
mov rbx, rax
call fcn.140002df8
mov rcx, qword [rdi + 8]
cmp byte [rcx + rbx - 1], 0xa
je 0x140002f05
mov r8d, r13d
lea rdx, [0x140066dbc]
mov rcx, rsi
call fcn.140002df8
mov rcx, qword [rdi + 0x18]
test rcx, rcx
je 0x140002f42
call fcn.14004bdc0
mov rdx, qword [rdi + 0x18]
mov r8d, eax
mov rcx, rsi
mov rbx, rax
call fcn.140002df8
mov rcx, qword [rdi + 0x18]
cmp byte [rcx + rbx - 1], 0xa
je 0x140002f42
mov r8d, r13d
lea rdx, [0x140066dbc]
mov rcx, rsi
call fcn.140002df8
mov r15, r12
cmp qword [rdi + 0x28], r12
jbe 0x1400030ab
mov rax, qword [rdi + 0x30]
lea rdx, [rsp + 0x98]
mov rcx, r14
mov rbx, qword [rax + r15*8]
call qword [sym.imp.KERNEL32.dll_GetConsoleMode]
mov edx, dword [rsp + 0x98]
or edx, 3
cmp dword [rbx + 8], r12d
jne 0x140002f9a
and edx, 0xfffffffb
jmp 0x140002f9d
mov ecx, 0xfffffff5
call qword [sym.imp.KERNEL32.dll_GetStdHandle]
mov rsi, rax
cmp rax, 0xffffffffffffffff
jne 0x140002ec2
jmp 0x1400030f7
or edx, 4
mov rcx, r14
call qword [sym.imp.KERNEL32.dll_SetConsoleMode]
mov rcx, qword [rbx]
call fcn.14004bdc0
mov rdx, qword [rbx]
mov r8, rax
mov rcx, rsi
call fcn.140002df8
mov edx, 0x200
mov dword [rsp + 0x80], r12d
mov rcx, rbx
mov ebp, r12d
call fcn.140039648
mov r8d, dword [rbx + 0x18]
mov rdx, qword [rbx + 0x10]
jmp 0x140003035
mov eax, dword [rsp + 0x80]
test eax, eax
je 0x140003052
add ebp, eax
mov rax, qword [rbx + 0x10]
lea edx, [rbp - 1]
movsxd rcx, edx
cmp byte [rcx + rax], 0xa
je 0x1400030c6
lea eax, [rbp*4]
mov dword [rsp + 0x80], r12d
add eax, ebp
mov rcx, rbx
cdq
and edx, 3
add edx, eax
sar edx, 2
add edx, 0x200
call fcn.140039648
mov r8d, dword [rbx + 0x18]
sub r8d, ebp
movsxd rdx, ebp
add rdx, qword [rbx + 0x10]
lea r9, [rsp + 0x80]
mov qword [rsp + 0x20], r12
sub r8d, r13d
mov rcx, r14
call qword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
jne 0x140002fde
or ebp, 0xffffffff
mov edx, dword [rsp + 0x98]
mov rcx, r14
call qword [sym.imp.KERNEL32.dll_SetConsoleMode]
cmp dword [rbx + 8], r12d
jne 0x14000308b
lea r9, [rsp + 0x30]
mov qword [rsp + 0x20], r12
mov r8d, 2
lea rdx, [0x140066dc0]
mov rcx, rsi
call qword [sym.imp.KERNEL32.dll_WriteFile]
test ebp, ebp
js 0x140002e6e
mov rax, qword [rbx + 0x10]
add r15, r13
movsxd rcx, ebp
mov byte [rcx + rax], r12b
cmp r15, qword [rdi + 0x28]
jb 0x140002f4f
mov eax, r13d
mov rbx, qword [rsp + 0x88]
add rsp, 0x40
pop r15
pop r14
pop r13
pop r12
pop rdi
pop rsi
pop rbp
ret
lea ebp, [rdx - 1]
movsxd rcx, ebp
cmp byte [rcx + rax], 0xd
cmovne ebp, edx
jmp 0x140003055
mov ecx, 2
call fcn.140049b58
mov rcx, rax
lea rdx, str.Cannot_get_standard_input_handle_n
call fcn.140001008
mov ecx, r13d
call fcn.140002ddc
int3
mov ecx, 2
call fcn.140049b58
mov rcx, rax
lea rdx, str.Cannot_get_standard_output_handle_n
call fcn.140001008
mov ecx, r13d
call fcn.140002ddc
int3