Function at 0x140016640
Capabilities:
Write file on windows

Disassembly:
mov qword [rsp + 8], rbx
mov qword [rsp + 0x18], rbp
push rsi
push rdi
push r12
push r14
push r15
sub rsp, 0x40
mov rbx, rcx
call fcn.14001678c
mov ecx, 1
call fcn.140012530
mov r8d, dword [rbx + 0xc]
xor r15d, r15d
mov rdi, qword [rbx + 0x18]
test eax, eax
jne 0x14001fac8
add r8d, r8d
lea r9, [rsp + 0x78]
mov rdx, rdi
lea ecx, [rax + 1]
call fcn.1400126bc
test eax, eax
je 0x14001fc1e
mov edx, dword [rbx + 0xc]
mov eax, dword [rsp + 0x78]
add rdx, rdx
cmp rax, rdx
jne 0x14001fc1e
mov ecx, 1
call fcn.140012530
mov ecx, 1
test eax, eax
jne 0x14001fbcc
call qword [sym.imp.msvcrt.dll__get_osfhandle]
cmp byte [0x140054694], r15b
mov rsi, rax
jne 0x14001fbf8
mov ecx, dword [0x14003fbc4]
lea rbp, [0x140039970]
mov qword [rsp + 0x38], r15
lea r8, [0x140030688]
mov qword [rsp + 0x30], r15
or r9d, 0xffffffff
mov dword [rsp + 0x28], 0x2000
xor edx, edx
mov qword [rsp + 0x20], rbp
call qword [sym.imp.api_ms_win_core_string_l1_1_0.dll_WideCharToMultiByte]
lea r9, [rsp + 0x78]
mov qword [rsp + 0x20], r15
mov rdx, rbp
mov rcx, rsi
lea edi, [rax - 1]
mov r8d, edi
call qword [sym.imp.api_ms_win_core_file_l1_1_0.dll_WriteFile]
test eax, eax
je 0x14001673b
cmp dword [rsp + 0x78], edi
jne 0x14001673b
mov dword [rsp + 0x78], 4
mov rdx, qword [rbx + 0x18]
mov rcx, rbx
call fcn.140016804
inc eax
mov rcx, rbx
add dword [rbx + 8], eax
call fcn.14001678c
mov eax, dword [rbx + 0x28]
cmp dword [rbx + 8], eax
ja 0x140016784
mov rax, qword [rbx + 0x18]
mov rbp, qword [rsp + 0x80]
mov word [rax], r15w
xor eax, eax
mov dword [rbx + 0xc], r15d
mov rbx, qword [rsp + 0x70]
add rsp, 0x40
pop r15
pop r14
pop r12
pop rdi
pop rsi
ret
mov dword [rbx + 8], r15d
jmp 0x14001675c
lea rbp, [rdi + r8*2]
cmp rdi, rbp
jae 0x1400166a9
mov r12d, 0x2022
mov rax, rdi
cmp rdi, rbp
jae 0x1400166a9
movzx ecx, word [rax]
mov rdx, rax
cmp cx, r12w
je 0x14001fafc
add rax, 2
cmp rax, rbp
jb 0x14001fae7
cmp cx, r12w
lea rsi, [rdx + 2]
cmove rsi, rdx
cmp rsi, rdi
je 0x14001fb50
mov r14, rsi
mov ecx, 1
sub r14, rdi
sar r14, 1
call qword [sym.imp.msvcrt.dll__get_osfhandle]
lea r9, [rsp + 0x78]
mov qword [rsp + 0x20], r15
mov rcx, rax
mov r8d, r14d
mov rdx, rdi
call qword [sym.imp.api_ms_win_core_console_l1_1_0.dll_WriteConsoleW]
test eax, eax
je 0x14001fc1e
cmp dword [rsp + 0x78], r14d
jne 0x14001fc1e
mov rdi, rsi
cmp rsi, rbp
jae 0x14001fb64
cmp word [rsi], r12w
jne 0x14001fb64
add rsi, 2
cmp rsi, rbp
jb 0x14001fb55
cmp rsi, rdi
je 0x14001fbbe
mov rcx, qword [rbx]
test rcx, rcx
je 0x14001fb7c
mov edx, 2
call qword [sym.imp.api_ms_win_core_console_l1_1_0.dll_SetConsoleMode]
mov r14, rsi
mov ecx, 1
sub r14, rdi
sar r14, 1
call qword [sym.imp.msvcrt.dll__get_osfhandle]
lea r9, [rsp + 0x78]
mov qword [rsp + 0x20], r15
mov rcx, rax
mov r8d, r14d
mov rdx, rdi
call qword [sym.imp.api_ms_win_core_console_l1_1_0.dll_WriteConsoleW]
mov edi, eax
call fcn.14000fef0
test edi, edi
je 0x14001fc1e
cmp dword [rsp + 0x78], r14d
jne 0x14001fc1e
mov rdi, rsi
cmp rdi, rbp
jb 0x14001fadb
jmp 0x1400166a9
call qword [sym.imp.msvcrt.dll__get_osfhandle]
lea r9, [rsp + 0x78]
mov qword [rsp + 0x20], r15
mov rcx, rax
lea rdx, [0x140030688]
mov r8d, 2
call qword [sym.imp.api_ms_win_core_console_l1_1_0.dll_WriteConsoleW]
nop
jmp 0x14001673b
lea r9, [rsp + 0x78]
mov qword [rsp + 0x20], r15
mov r8d, 4
lea rdx, [0x140030688]
mov rcx, rsi
call qword [sym.imp.api_ms_win_core_file_l1_1_0.dll_WriteFile]
nop
jmp 0x14001673b
mov ecx, 1
call fcn.14000f518
test eax, eax
je 0x14001fc33
mov ecx, 0x1d
jmp 0x14001fc44
mov ecx, 1
call fcn.14002b730
test eax, eax
jne 0x14001fc4b
lea ecx, [rax + 0x70]
xor edx, edx
call fcn.140014d90
call fcn.14002ae20
int3