Function at 0x140039584
Capabilities:
Write file on windows

Disassembly:
mov qword [rsp + 0x10], rbx
mov qword [rsp + 0x18], rbp
mov qword [rsp + 0x20], rsi
push rdi
push r12
push r13
push r14
push r15
sub rsp, 0x40
xor r13d, r13d
mov rdi, rcx
mov rcx, qword [rcx]
mov ebx, r13d
mov rax, rcx
lea r15d, [r13 + 1]
test rcx, rcx
je 0x1400395d0
cmp dword [rdi + 0x10], r13d
je 0x1400395d0
cmp dword [rdi + 0x14], r13d
je 0x1400395d0
call qword [sym.imp.KERNEL32.dll_CloseHandle]
mov eax, r13d
mov qword [rdi], r13
mov rcx, rax
cmp dword [rdi + 0x10], r13d
je 0x140039625
test rax, rax
jne 0x140039625
mov rcx, qword [rdi + 8]
test rcx, rcx
je 0x140039843
mov qword [rsp + 0x30], r13
xor r9d, r9d
mov dword [rsp + 0x28], 0x80
mov edx, 0xc0000000
mov r8d, r15d
mov dword [rsp + 0x20], 2
call qword [sym.imp.KERNEL32.dll_CreateFileW]
mov qword [rdi], rax
mov rcx, rax
cmp rax, 0xffffffffffffffff
jne 0x140039625
mov qword [rdi], r13
jmp 0x140039843
test rcx, rcx
je 0x140039843
cmp dword [rdi + 0x10], r13d
je 0x140039843
test byte [rdi + 0x50], r15b
lea rax, [0x140138090]
mov r14, qword [rdi + 0x30]
lea r12, [0x140137e94]
cmove r12, rax
mov esi, 5
cmp dword [rdi + 0x28], 0xfde9
cmovne esi, r13d
jmp 0x1400396b8
mov rcx, qword [r14 + 0x18]
cmp qword [r14 + 0x10], r15
jne 0x14003968c
call fcn.140039ad0
add esi, 4
add esi, eax
test byte [rdi + 0x50], 2
je 0x1400396b5
lea rcx, [0x1401380dc]
call fcn.140039ad0
jmp 0x1400396b3
cmp qword [r14 + 0x10], 2
jne 0x14003969d
call fcn.140039ad0
add esi, 4
jmp 0x1400396b3
call fcn.140039ad0
mov rcx, qword [r14 + 0x10]
mov rbx, rax
call fcn.140039ad0
add eax, ebx
add esi, 5
add esi, eax
mov r14, qword [r14]
test r14, r14
jne 0x140039664
xor edx, edx
test esi, esi
jne 0x1400396e0
mov rcx, qword [rdi]
xor r9d, r9d
xor r8d, r8d
call qword [sym.imp.KERNEL32.dll_SetFilePointer]
mov rcx, qword [rdi]
call qword [sym.imp.KERNEL32.dll_SetEndOfFile]
jmp 0x14003983a
mov rcx, qword [0x140224818]
lea eax, [rsi + 1]
movsxd r8, eax
call qword [sym.imp.KERNEL32.dll_HeapAlloc]
mov rbp, rax
test rax, rax
je 0x14003983a
cmp dword [rdi + 0x28], 0xfde9
mov rbx, rax
jne 0x14003973b
test byte [rdi + 0x50], 4
jne 0x14003973b
lea rdx, [0x140137870]
mov rcx, rax
call fcn.140039a00
lea rdx, [0x1401380dc]
mov rcx, rbx
call fcn.140039960
mov rcx, rbx
call fcn.140039ad0
lea rbx, [rax + rbx]
mov rsi, qword [rdi + 0x30]
jmp 0x1400397ea
mov rdx, qword [rsi + 0x10]
cmp rdx, 1
jne 0x14003979a
test byte [rdi + 0x50], 2
je 0x140039773
test r15d, r15d
jne 0x140039773
lea rdx, [0x1401380dc]
mov rcx, rbx
call fcn.140039a00
mov rcx, rbx
call fcn.140039ad0
add rbx, rax
lea rdx, [0x140137c84]
mov rcx, rbx
call fcn.140039a00
mov rdx, qword [rsi + 0x18]
mov rcx, rbx
call fcn.140039960
lea rdx, [0x140137c7c]
mov r15d, r13d
jmp 0x1400397c5
mov rcx, rbx
cmp rdx, 2
jne 0x1400397b1
lea rdx, [0x140138094]
call fcn.140039a00
jmp 0x1400397c1
call fcn.140039a00
mov rdx, r12
mov rcx, rbx
call fcn.140039960
mov rdx, qword [rsi + 0x18]
mov rcx, rbx
call fcn.140039960
lea rdx, [0x1401380dc]
mov rcx, rbx
call fcn.140039960
mov rcx, rbx
call fcn.140039ad0
mov rsi, qword [rsi]
add rbx, rax
test rsi, rsi
jne 0x140039744
mov rcx, qword [rdi]
xor r9d, r9d
xor r8d, r8d
xor edx, edx
call qword [sym.imp.KERNEL32.dll_SetFilePointer]
mov rcx, qword [rdi]
lea r9, [rsp + 0x70]
sub ebx, ebp
mov qword [rsp + 0x20], r13
mov r8d, ebx
mov rdx, rbp
call qword [sym.imp.KERNEL32.dll_WriteFile]
mov rcx, qword [rdi]
call qword [sym.imp.KERNEL32.dll_SetEndOfFile]
mov rcx, qword [0x140224818]
mov r8, rbp
xor edx, edx
call qword [sym.imp.KERNEL32.dll_HeapFree]
mov ebx, 1
mov qword [rdi + 0x10], r13
lea r11, [rsp + 0x40]
mov rax, rbx
mov rbx, qword [r11 + 0x38]
mov rbp, qword [r11 + 0x40]
mov rsi, qword [r11 + 0x48]
mov rsp, r11
pop r15
pop r14
pop r13
pop r12
pop rdi
ret