Function at 0x140040e10
Capabilities:
Write file on windows

Disassembly:
mov qword [rsp + 8], rbx
push rbp
push rsi
push rdi
push r12
push r13
push r14
push r15
mov rbp, rsp
sub rsp, 0x70
mov rax, qword [0x140087710]
xor rax, rsp
mov qword [rbp - 8], rax
movsxd rsi, edx
mov rbx, rcx
mov rdx, rsi
mov r12d, r9d
lea rcx, [0x14008bd50]
and edx, 0x3f
shl rdx, 6
mov rax, rsi
sar rax, 6
mov r13, r8
add r12, r8
mov rax, qword [rcx + rax*8]
mov rax, qword [rax + rdx + 0x28]
mov qword [rbp - 0x20], rax
call qword [sym.imp.KERNEL32.dll_GetConsoleCP]
xor ecx, ecx
mov dword [rbp - 0x24], eax
mov dword [rbx], ecx
mov rdi, r13
mov r15d, eax
xor eax, eax
mov qword [rbx + 4], rax
cmp r13, r12
jae 0x14004104b
lea r14, [r13 + 1]
mov r8b, byte [rdi]
lea r9, [0x14008bd50]
mov word [rbp - 0x30], cx
mov rax, rsi
sar rax, 6
mov rcx, rsi
and ecx, 0x3f
mov byte [rbp - 0x2c], r8b
shl rcx, 6
mov rdx, qword [r9 + rax*8]
test byte [rdx + rcx + 0x3d], 4
je 0x140040eee
mov al, byte [rdx + rcx + 0x3e]
mov rcx, rsi
mov byte [rbp - 0x18], al
lea rdx, [rbp - 0x18]
and ecx, 0x3f
mov byte [rbp - 0x17], r8b
mov rax, rsi
shl rcx, 6
sar rax, 6
mov r8d, 2
mov rax, qword [r9 + rax*8]
and byte [rax + rcx + 0x3d], 0xfb
jmp 0x140040f31
call fcn.140038a58
movzx ecx, byte [rdi]
xor edx, edx
cmp word [rax + rcx*2], dx
jge 0x140040f28
cmp r14, r12
jae 0x14004100a
lea r8d, [rdx + 2]
mov rdx, rdi
lea rcx, [rbp - 0x30]
call fcn.14003cefc
cmp eax, 0xffffffff
je 0x14004104b
inc rdi
inc r14
jmp 0x140040f43
mov r8d, 1
mov rdx, rdi
lea rcx, [rbp - 0x30]
call fcn.14003cefc
cmp eax, 0xffffffff
je 0x14004104b
xor eax, eax
lea r8, [rbp - 0x30]
mov qword [rsp + 0x38], rax
mov r9d, 1
mov qword [rsp + 0x30], rax
xor edx, edx
lea rax, [rbp - 0x10]
mov dword [rsp + 0x28], 5
mov ecx, r15d
mov qword [rsp + 0x20], rax
inc rdi
inc r14
call qword [sym.imp.KERNEL32.dll_WideCharToMultiByte]
mov r15d, eax
xor eax, eax
test r15d, r15d
je 0x14004104b
mov rcx, qword [rbp - 0x20]
lea r9, [rbp - 0x28]
mov r8d, r15d
mov qword [rsp + 0x20], rax
lea rdx, [rbp - 0x10]
call qword [sym.imp.KERNEL32.dll_WriteFile]
xor ecx, ecx
test eax, eax
je 0x140041043
mov eax, dword [rbx + 8]
sub eax, r13d
add eax, edi
mov dword [rbx + 4], eax
cmp dword [rbp - 0x28], r15d
jb 0x14004104b
cmp byte [rbp - 0x2c], 0xa
jne 0x140040ffc
lea eax, [rcx + 0xd]
mov qword [rsp + 0x20], rcx
lea r8d, [rcx + 1]
mov word [rbp - 0x2c], ax
mov rcx, qword [rbp - 0x20]
lea r9, [rbp - 0x28]
lea rdx, [rbp - 0x2c]
call qword [sym.imp.KERNEL32.dll_WriteFile]
xor ecx, ecx
test eax, eax
je 0x140041043
cmp dword [rbp - 0x28], 1
jb 0x14004104b
inc dword [rbx + 8]
inc dword [rbx + 4]
cmp rdi, r12
jae 0x14004104b
mov r15d, dword [rbp - 0x24]
jmp 0x140040e8f
mov al, byte [rdi]
lea r9, [0x14008bd50]
mov r8, rsi
and esi, 0x3f
sar r8, 6
mov edx, esi
shl rdx, 6
shl rsi, 6
mov rcx, qword [r9 + r8*8]
mov byte [rdx + rcx + 0x3e], al
mov rax, qword [r9 + r8*8]
mov cl, byte [rdx + rax + 0x3d]
or cl, 4
mov byte [rax + rsi + 0x3d], cl
inc dword [rbx + 4]
jmp 0x14004104b
call qword [sym.imp.KERNEL32.dll_GetLastError]
mov dword [rbx], eax
mov rax, rbx
mov rcx, qword [rbp - 8]
xor rcx, rsp
call fcn.14002ad40
mov rbx, qword [rsp + 0xb0]
add rsp, 0x70
pop r15
pop r14
pop r13
pop r12
pop rdi
pop rsi
pop rbp
ret