Function at 0x140040510
Capabilities:
Get common file path
Write file on windows

Disassembly:
mov qword [rsp + 0x18], rbx
push rbp
push rsi
push rdi
push r12
push r13
push r14
push r15
lea rbp, [rsp - 0x3a0]
sub rsp, 0x4a0
mov rax, qword [0x1400c7100]
xor rax, rsp
mov qword [rbp + 0x390], rax
mov rdi, rdx
mov r13, rcx
xor edx, edx
mov r8d, 0x200
lea rcx, [rbp - 0x70]
call fcn.140098980
xor ebx, ebx
mov dword [rsp + 0x78], ebx
mov qword [rsp + 0x40], 0x38
xorps xmm0, xmm0
movdqu xmmword [rsp + 0x50], xmm0
xorps xmm1, xmm1
movdqu xmmword [rsp + 0x60], xmm1
mov qword [rsp + 0x70], rbx
lea rsi, [r13 + 0x50]
mov r8, rsi
lea rdx, [rsp + 0x78]
mov rcx, r13
call fcn.1400408b0
mov r14, rax
test rax, rax
je 0x140040822
test rdi, rdi
jne 0x14004085f
xor edx, edx
mov r8d, 0x200
lea rcx, [rbp + 0x190]
call fcn.140098980
lea rdx, [rbp + 0x190]
mov ecx, 0x100
call qword [sym.imp.KERNEL32.dll_GetTempPathW]
lea r9, [rbp - 0x70]
xor r8d, r8d
lea rdx, str.ImageManifest
lea rcx, [rbp + 0x190]
call qword [sym.imp.KERNEL32.dll_GetTempFileNameW]
test eax, eax
jne 0x1400405f5
mov eax, 0xc0150002
jmp 0x140040824
mov qword [rsp + 0x30], rbx
mov dword [rsp + 0x28], ebx
mov dword [rsp + 0x20], 4
xor r9d, r9d
xor r8d, r8d
mov edx, 0x120116
lea rcx, [rbp - 0x70]
call qword [sym.imp.KERNEL32.dll_CreateFileW]
mov rdi, rax
test rax, rax
setg sil
test rax, rax
jle 0x14004084e
mov dword [rbp - 0x80], ebx
mov qword [rsp + 0x20], rbx
lea r9, [rbp - 0x80]
mov r8d, dword [rsp + 0x78]
mov rdx, r14
mov rcx, rax
call qword [sym.imp.KERNEL32.dll_WriteFile]
test sil, sil
je 0x140040659
mov rcx, rdi
call qword [sym.imp.KERNEL32.dll_CloseHandle]
mov qword [rsp + 0x78], rbx
lea rax, [rbp - 0x70]
mov qword [rsp + 0x48], rax
lea r14, [r13 + 0x118]
lea rax, [rbp - 0x70]
mov rdi, 0xffffffffffffffff
nop dword [rax]
inc rdi
cmp word [rax + rdi*2], 0
jne 0x140040680
mov r12, qword [r14 + 0x18]
cmp rdi, r12
ja 0x1400406be
mov rsi, r14
cmp r12, 7
jbe 0x14004069f
mov rsi, qword [r14]
mov qword [r14 + 0x10], rdi
add rdi, rdi
mov r8, rdi
lea rdx, [rbp - 0x70]
mov rcx, rsi
call fcn.1400982e0
mov word [rdi + rsi], bx
jmp 0x1400407d9
movabs r15, 0x7ffffffffffffffe
cmp rdi, r15
ja 0x1400408a3
mov rcx, rdi
or rcx, 7
cmp rcx, r15
jbe 0x1400406ed
movabs rax, 0x7fffffffffffffff
lea rcx, [rax + rax]
jmp 0x14004073f
mov rdx, r12
shr rdx, 1
mov rax, r15
sub rax, rdx
cmp r12, rax
jbe 0x14004070e
movabs rax, 0x7fffffffffffffff
lea rcx, [rax + rax]
jmp 0x14004073f
lea rax, [rdx + r12]
mov r15, rcx
cmp rcx, rax
cmovb r15, rax
lea rcx, [r15 + 1]
movabs rax, 0x7fffffffffffffff
cmp rcx, rax
ja 0x14004089d
add rcx, rcx
cmp rcx, 0x1000
jb 0x14004076b
lea rax, [rcx + 0x27]
cmp rax, rcx
jbe 0x14004089d
mov rcx, rax
call fcn.14006c698
test rax, rax
je 0x1400408a9
lea rsi, [rax + 0x27]
and rsi, 0xffffffffffffffe0
mov qword [rsi - 8], rax
jmp 0x14004077d
test rcx, rcx
je 0x14004077a
call fcn.14006c698
mov rsi, rax
jmp 0x14004077d
mov rsi, rbx
mov qword [r14 + 0x10], rdi
mov qword [r14 + 0x18], r15
add rdi, rdi
mov r8, rdi
lea rdx, [rbp - 0x70]
mov rcx, rsi
call fcn.1400982e0
mov word [rdi + rsi], bx
cmp r12, 7
jbe 0x1400407d6
mov rcx, qword [r14]
lea rdx, [r12*2 + 2]
cmp rdx, 0x1000
jb 0x1400407d1
add rdx, 0x27
mov r8, qword [rcx - 8]
sub rcx, r8
lea rax, [rcx - 8]
cmp rax, 0x1f
ja 0x1400408a9
mov rcx, r8
call fcn.14006c690
mov qword [r14], rsi
lea rsi, [r13 + 0x50]
lea rcx, [rsp + 0x40]
call qword [sym.imp.KERNEL32.dll_CreateActCtxW]
mov rdi, rax
mov rcx, qword [r13 + 0x48]
cmp rax, rcx
je 0x140040806
test rcx, rcx
jle 0x1400407ff
call qword [sym.imp.KERNEL32.dll_ReleaseActCtx]
mov qword [r13 + 0x48], rdi
mov rcx, rdi
test rcx, rcx
jg 0x140040822
mov rax, qword gs:[0x30]
cmp dword [rax + 0x1250], 0xc0000022
jne 0x14004088c
mov dword [rsi], ebx
xor eax, eax
mov rcx, qword [rbp + 0x390]
xor rcx, rsp
call fcn.14006c670
mov rbx, qword [rsp + 0x4f0]
add rsp, 0x4a0
pop r15
pop r14
pop r13
pop r12
pop rdi
pop rsi
pop rbp
ret
mov rax, qword gs:[0x30]
mov eax, dword [rax + 0x1250]
jmp 0x140040824
mov dword [rsp + 0x44], 8
movzx eax, word [rsi]
mov qword [rsp + 0x60], rax
mov qword [rsp + 0x48], rdi
lea rdx, [r13 + 0xf8]
lea rcx, [r13 + 0x118]
call fcn.140018650
jmp 0x1400407dd
mov rax, qword gs:[0x30]
mov eax, dword [rax + 0x1250]
jmp 0x140040824
call fcn.140001150
nop
call fcn.1400012b0
int3
call fcn.14007da9c
int3