Function at 0x140012f50
Capabilities:
Write file on windows

Disassembly:
mov rax, rsp
push rsi
push rdi
push r12
push r14
push r15
sub rsp, 0x60
mov qword [rax - 0x38], 0xfffffffffffffffe
mov qword [rax + 8], rbx
mov qword [rax + 0x10], rbp
mov rdi, rdx
mov rbp, rcx
call fcn.140015d90
mov rcx, rax
test rax, rax
jne 0x140012f8d
mov ecx, 0x80004005
call fcn.140002430
int3
mov rax, qword [rax]
call qword [rax + 0x18]
lea rbx, [rax + 0x18]
mov qword [rsp + 0x40], rbx
or r14, 0xffffffffffffffff
xor r12d, r12d
test rdi, rdi
je 0x140012fe1
test rdi, 0xffffffffffff0000
jne 0x140012fd2
movzx edi, di
mov ecx, edi
call fcn.140016424
test rax, rax
je 0x140012ff9
mov r8d, edi
mov rdx, rax
lea rcx, [rsp + 0x40]
call fcn.140001ea0
jmp 0x140012ff4
mov rax, r14
inc rax
cmp word [rdi + rax*2], r12w
jne 0x140012fd5
jmp 0x140012fe4
mov eax, r12d
mov r8d, eax
mov rdx, rdi
lea rcx, [rsp + 0x40]
call fcn.1400022a0
mov rbx, qword [rsp + 0x40]
mov rcx, qword [rbp + 0x40]
call qword [sym.imp.KERNEL32.dll_FlushFileBuffers]
cmp dword [rbp + 0x48], 0
je 0x140013123
mov rcx, qword [rbp + 0x40]
call qword [sym.imp.KERNEL32.dll_GetFileType]
test al, 1
jne 0x1400130f3
mov qword [rsp + 0x38], r12
mov qword [rsp + 0x30], r12
mov dword [rsp + 0x28], r12d
mov qword [rsp + 0x20], r12
mov r9d, r14d
mov r8, rbx
xor edx, edx
mov ecx, 0xfde9
call qword [sym.imp.KERNEL32.dll_WideCharToMultiByte]
movsxd rsi, eax
mov rcx, rsi
call fcn.140015344
mov r15, rax
mov r8, rsi
xor edx, edx
mov rcx, rax
call fcn.14003a1f0
mov qword [rsp + 0x38], r12
mov qword [rsp + 0x30], r12
mov dword [rsp + 0x28], esi
mov qword [rsp + 0x20], r15
mov r9d, r14d
mov r8, rbx
xor edx, edx
mov ecx, 0xfde9
call qword [sym.imp.KERNEL32.dll_WideCharToMultiByte]
lea eax, [rsi - 1]
cdqe
mov byte [rax + r15], 0
call qword [sym.imp.KERNEL32.dll_GetConsoleOutputCP]
mov edi, eax
mov ecx, 0xfde9
call qword [sym.imp.KERNEL32.dll_SetConsoleOutputCP]
mov r8, r14
nop word [rax + rax]
inc r8
cmp byte [r15 + r8], 0
jne 0x1400130b0
mov qword [rsp + 0x20], r12
lea r9, [rsp + 0xa8]
mov rdx, r15
mov rcx, qword [rbp + 0x40]
call qword [sym.imp.KERNEL32.dll_WriteFile]
mov rcx, qword [rbp + 0x40]
call qword [sym.imp.KERNEL32.dll_FlushFileBuffers]
mov ecx, edi
call qword [sym.imp.KERNEL32.dll_SetConsoleOutputCP]
mov rcx, r15
call fcn.14001533c
jmp 0x1400131d2
mov r8d, dword [rbx - 0x10]
add r8d, r8d
mov qword [rsp + 0x20], r12
lea r9, [rsp + 0xa0]
mov rdx, rbx
mov rcx, qword [rbp + 0x40]
call qword [sym.imp.KERNEL32.dll_WriteFile]
mov rcx, qword [rbp + 0x40]
call qword [sym.imp.KERNEL32.dll_FlushFileBuffers]
jmp 0x1400131d2
call fcn.140015d90
mov rcx, rax
test rax, rax
jne 0x14001313b
mov ecx, 0x80004005
call fcn.140002430
int3
mov rax, qword [rax]
call qword [rax + 0x18]
lea rdi, [rax + 0x18]
mov qword [rsp + 0x48], rdi
test rbx, rbx
je 0x140013179
test rbx, 0xffffffffffff0000
jne 0x140013179
movzx ebx, bx
mov ecx, ebx
call fcn.140016424
test rax, rax
je 0x14001318b
mov r8d, ebx
mov rdx, rax
lea rcx, [rsp + 0x48]
call fcn.14000f5c0
jmp 0x140013186
mov rdx, rbx
lea rcx, [rsp + 0x48]
call fcn.14000f400
mov rdi, qword [rsp + 0x48]
mov qword [rsp + 0x20], r12
lea r9, [rsp + 0xa0]
mov r8d, dword [rdi - 0x10]
mov rdx, rdi
mov rcx, qword [rbp + 0x40]
call qword [sym.imp.KERNEL32.dll_WriteFile]
mov rcx, qword [rbp + 0x40]
call qword [sym.imp.KERNEL32.dll_FlushFileBuffers]
lea rdx, [rdi - 0x18]
mov eax, r14d
lock xadd dword [rdx + 0x10], eax
sub eax, 1
jg 0x1400131cd
mov rcx, qword [rdx]
mov rax, qword [rcx]
call qword [rax + reloc.OLEAUT32.dll_VariantClear]
mov rbx, qword [rsp + 0x40]
lea rdx, [rbx - 0x18]
lock xadd dword [rdx + 0x10], r14d
sub r14d, 1
jg 0x1400131eb
mov rcx, qword [rdx]
mov rax, qword [rcx]
call qword [rax + reloc.OLEAUT32.dll_VariantClear]
lea r11, [rsp + 0x60]
mov rbx, qword [r11 + 0x30]
mov rbp, qword [r11 + 0x38]
mov rsp, r11
pop r15
pop r14
pop r12
pop rdi
pop rsi
ret