Function at 0x140008850
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.14000bcac
mov rcx, rax
xor r14d, r14d
mov eax, r14d
test rcx, rcx
setne al
test eax, eax
jne 0x140008899
mov ecx, 0x80004005
call fcn.140002350
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 0x1400088f3
test rsi, 0xffffffffffff0000
jne 0x1400088e0
movzx edi, si
mov ecx, edi
call fcn.14000c328
test rax, rax
je 0x14000890b
mov r8d, edi
mov rdx, rax
lea rcx, [rsp + 0x40]
call fcn.140001ea0
mov rbx, qword [rsp + 0x40]
jmp 0x14000890b
xor eax, eax
mov rcx, r12
mov rdi, rsi
repne scasw ax, word [rdi]
not rcx
dec rcx
jmp 0x1400088f6
mov ecx, r14d
mov r8d, ecx
mov rdx, rsi
lea rcx, [rsp + 0x40]
call fcn.1400021a0
mov rbx, qword [rsp + 0x40]
mov rcx, qword [r13 + 0x40]
call qword [sym.imp.KERNEL32.dll_FlushFileBuffers]
cmp dword [r13 + 0x48], 0
je 0x140008a2c
mov rcx, qword [r13 + 0x40]
call qword [sym.imp.KERNEL32.dll_GetFileType]
test al, 1
jne 0x1400089fc
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.14000b3f8
mov rbp, rax
mov r8, rdi
xor edx, edx
mov rcx, rax
call fcn.140023340
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.14000b3f0
jmp 0x140008af3
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 0x140008af3
call fcn.14000bcac
mov rdx, rax
mov ecx, r14d
test rax, rax
setne cl
test ecx, ecx
jne 0x140008a4c
mov ecx, 0x80004005
call fcn.140002350
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 0x140008a92
test rbx, 0xffffffffffff0000
jne 0x140008a92
movzx ebx, bx
mov ecx, ebx
call fcn.14000c328
test rax, rax
je 0x140008aa4
mov r8d, ebx
mov rdx, rax
lea rcx, [rsp + 0x48]
call fcn.14000aeb0
mov rdi, qword [rsp + 0x48]
jmp 0x140008aa4
mov rdx, rbx
lea rcx, [rsp + 0x48]
call fcn.14000ac90
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 0x140008aee
mov rcx, qword [rdx]
mov rax, qword [rcx]
call qword [rax + reloc.OLEAUT32.dll_VariantClear]
mov rbx, qword [rsp + 0x40]
jmp 0x140008af3
mov rbx, qword [rsp + 0x40]
lea rdx, [rbx - 0x18]
lock xadd dword [rdx + 0x10], r12d
dec r12d
test r12d, r12d
jg 0x140008b0e
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