Function at 0x140008740
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.14000bb5c
mov rcx, rax
xor r14d, r14d
mov eax, r14d
test rcx, rcx
setne al
test eax, eax
jne 0x140008789
mov ecx, 0x80004005
call fcn.140002330
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 0x1400087e3
test rsi, 0xffffffffffff0000
jne 0x1400087d0
movzx edi, si
mov ecx, edi
call fcn.14000c1b8
test rax, rax
je 0x1400087fb
mov r8d, edi
mov rdx, rax
lea rcx, [rsp + 0x40]
call fcn.140001e70
mov rbx, qword [rsp + 0x40]
jmp 0x1400087fb
xor eax, eax
mov rcx, r12
mov rdi, rsi
repne scasw ax, word [rdi]
not rcx
dec rcx
jmp 0x1400087e6
mov ecx, r14d
mov r8d, ecx
mov rdx, rsi
lea rcx, [rsp + 0x40]
call fcn.140002180
mov rbx, qword [rsp + 0x40]
mov rcx, qword [r13 + 0x40]
call qword [sym.imp.KERNEL32.dll_FlushFileBuffers]
cmp dword [r13 + 0x48], 0
je 0x14000891c
mov rcx, qword [r13 + 0x40]
call qword [sym.imp.KERNEL32.dll_GetFileType]
test al, 1
jne 0x1400088ec
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.14000b2a8
mov rbp, rax
mov r8, rdi
xor edx, edx
mov rcx, rax
call fcn.140023140
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.14000b2a0
jmp 0x1400089e3
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 0x1400089e3
call fcn.14000bb5c
mov rdx, rax
mov ecx, r14d
test rax, rax
setne cl
test ecx, ecx
jne 0x14000893c
mov ecx, 0x80004005
call fcn.140002330
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 0x140008982
test rbx, 0xffffffffffff0000
jne 0x140008982
movzx ebx, bx
mov ecx, ebx
call fcn.14000c1b8
test rax, rax
je 0x140008994
mov r8d, ebx
mov rdx, rax
lea rcx, [rsp + 0x48]
call fcn.14000ad60
mov rdi, qword [rsp + 0x48]
jmp 0x140008994
mov rdx, rbx
lea rcx, [rsp + 0x48]
call fcn.14000ab50
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 0x1400089de
mov rcx, qword [rdx]
mov rax, qword [rcx]
call qword [rax + reloc.OLEAUT32.dll_VariantClear]
mov rbx, qword [rsp + 0x40]
jmp 0x1400089e3
mov rbx, qword [rsp + 0x40]
lea rdx, [rbx - 0x18]
lock xadd dword [rdx + 0x10], r12d
dec r12d
test r12d, r12d
jg 0x1400089fe
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