Function at 0x140008670
Capabilities:
Write file on windows

Disassembly:
mov rax, rsp
push rsi
push rdi
push r12
push r13
push r14
sub rsp, 0x60
mov qword [rsp + 0x50], 0xfffffffffffffffe
mov qword [rax + 8], rbx
mov qword [rax + 0x10], rbp
mov rsi, rdx
mov r13, rcx
call fcn.14000ba9c
mov rcx, rax
xor r14d, r14d
mov eax, r14d
test rcx, rcx
setne al
test eax, eax
jne 0x1400086b9
mov ecx, 0x80004005
call fcn.140001fe0
int3
mov rax, qword [rcx]
call qword [rax + 0x18]
lea rbx, [rax + 0x18]
mov qword [rsp + 0x40], rbx
or r12, 0xffffffffffffffff
test rsi, rsi
je 0x140008713
test rsi, 0xffffffffffff0000
jne 0x140008700
movzx edi, si
mov ecx, edi
call fcn.14000c120
test rax, rax
je 0x14000872b
mov r8d, edi
mov rdx, rax
lea rcx, [rsp + 0x40]
call fcn.140001b30
mov rbx, qword [rsp + 0x40]
jmp 0x14000872b
xor eax, eax
mov rcx, r12
mov rdi, rsi
repne scasw ax, word [rdi]
not rcx
dec rcx
jmp 0x140008716
mov ecx, r14d
mov r8d, ecx
mov rdx, rsi
lea rcx, [rsp + 0x40]
call fcn.140001e30
mov rbx, qword [rsp + 0x40]
mov rcx, qword [r13 + 0x40]
call qword [sym.imp.KERNEL32.dll_FlushFileBuffers]
cmp dword [r13 + 0x48], 0
je 0x14000884c
mov rcx, qword [r13 + 0x40]
call qword [sym.imp.KERNEL32.dll_GetFileType]
test al, 1
jne 0x14000881c
mov qword [rsp + 0x38], r14
mov qword [rsp + 0x30], r14
mov dword [rsp + 0x28], r14d
mov qword [rsp + 0x20], r14
mov r9d, r12d
mov r8, rbx
xor edx, edx
mov ecx, 0xfde9
call qword [sym.imp.KERNEL32.dll_WideCharToMultiByte]
movsxd rdi, eax
mov rcx, rdi
call fcn.14000b1e8
mov rbp, rax
mov r8, rdi
xor edx, edx
mov rcx, rax
call fcn.140022e00
mov qword [rsp + 0x38], r14
mov qword [rsp + 0x30], r14
mov dword [rsp + 0x28], edi
mov qword [rsp + 0x20], rbp
mov r9d, r12d
mov r8, rbx
xor edx, edx
mov ecx, 0xfde9
call qword [sym.imp.KERNEL32.dll_WideCharToMultiByte]
mov byte [rdi + rbp - 1], 0
call qword [sym.imp.KERNEL32.dll_GetConsoleOutputCP]
mov esi, eax
mov ecx, 0xfde9
call qword [sym.imp.KERNEL32.dll_SetConsoleOutputCP]
xor eax, eax
mov rcx, r12
mov rdi, rbp
repne scasb al, byte [rdi]
not rcx
lea r8, [rcx - 1]
mov qword [rsp + 0x20], r14
lea r9, [rsp + 0xa8]
mov rdx, rbp
mov rcx, qword [r13 + 0x40]
call qword [sym.imp.KERNEL32.dll_WriteFile]
mov rcx, qword [r13 + 0x40]
call qword [sym.imp.KERNEL32.dll_FlushFileBuffers]
mov ecx, esi
call qword [sym.imp.KERNEL32.dll_SetConsoleOutputCP]
mov rcx, rbp
call fcn.14000b1e0
jmp 0x140008913
mov r8d, dword [rbx - 0x10]
add r8d, r8d
mov qword [rsp + 0x20], r14
lea r9, [rsp + 0xa0]
mov rdx, rbx
mov rcx, qword [r13 + 0x40]
call qword [sym.imp.KERNEL32.dll_WriteFile]
mov rcx, qword [r13 + 0x40]
call qword [sym.imp.KERNEL32.dll_FlushFileBuffers]
jmp 0x140008913
call fcn.14000ba9c
mov rdx, rax
mov ecx, r14d
test rax, rax
setne cl
test ecx, ecx
jne 0x14000886c
mov ecx, 0x80004005
call fcn.140001fe0
int3
mov rax, qword [rax]
mov rcx, rdx
call qword [rax + 0x18]
lea rdi, [rax + 0x18]
mov qword [rsp + 0x48], rdi
test rbx, rbx
je 0x1400088b2
test rbx, 0xffffffffffff0000
jne 0x1400088b2
movzx ebx, bx
mov ecx, ebx
call fcn.14000c120
test rax, rax
je 0x1400088c4
mov r8d, ebx
mov rdx, rax
lea rcx, [rsp + 0x48]
call fcn.14000aca0
mov rdi, qword [rsp + 0x48]
jmp 0x1400088c4
mov rdx, rbx
lea rcx, [rsp + 0x48]
call fcn.14000aa80
mov rdi, qword [rsp + 0x48]
mov qword [rsp + 0x20], r14
lea r9, [rsp + 0xa0]
mov r8d, dword [rdi - 0x10]
mov rdx, rdi
mov rcx, qword [r13 + 0x40]
call qword [sym.imp.KERNEL32.dll_WriteFile]
mov rcx, qword [r13 + 0x40]
call qword [sym.imp.KERNEL32.dll_FlushFileBuffers]
lea rdx, [rdi - 0x18]
mov eax, r12d
lock xadd dword [rdx + 0x10], eax
dec eax
test eax, eax
jg 0x14000890e
mov rcx, qword [rdx]
mov rax, qword [rcx]
call qword [rax + reloc.OLEAUT32.dll_VariantClear]
mov rbx, qword [rsp + 0x40]
jmp 0x140008913
mov rbx, qword [rsp + 0x40]
lea rdx, [rbx - 0x18]
lock xadd dword [rdx + 0x10], r12d
dec r12d
test r12d, r12d
jg 0x14000892e
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 r14
pop r13
pop r12
pop rdi
pop rsi
ret