Function at 0x140039520
Capabilities:
Check if file exists
Write file on windows

Disassembly:
mov qword [rsp + 8], rbx
mov qword [rsp + 0x10], rsi
mov qword [rsp + 0x18], rdi
mov qword [rsp + 0x20], r12
push rbp
push r14
push r15
lea rbp, [rsp - 0x8820]
mov eax, 0x8920
call fcn.1400a85a0
sub rsp, rax
mov rax, qword [0x1400d4080]
xor rax, rsp
mov qword [rbp + 0x8810], rax
mov rdi, qword [0x140229bd8]
mov eax, dword [rdi + 8]
cmp eax, 3
je 0x1400398ed
xor r14d, r14d
test eax, eax
jne 0x140039698
mov rbx, qword [rdi]
movups xmm0, xmmword [str._pipediscord_ipc_0]
movups xmmword [rbp + 0x87e0], xmm0
movups xmm1, xmmword [0x1400bfb48]
movups xmmword [rbp + 0x87f0], xmm1
movsd xmm0, qword [0x1400bfb58]
movsd qword [rbp + 0x8800], xmm0
mov eax, dword [0x1400bfb60]
mov dword [rbp + 0x8808], eax
movzx eax, word [0x1400bfb64]
mov word [rbp + 0x880c], ax
mov eax, Ordinal_50
mov word [rbp + 0x880a], ax
mov qword [rsp + 0x30], r14
mov dword [rsp + 0x28], r14d
mov dword [rsp + 0x20], 3
xor r9d, r9d
xor r8d, r8d
mov edx, 0xc0000000
lea rcx, [rbp + 0x87e0]
call qword [sym.imp.KERNEL32.dll_CreateFileW]
mov qword [rbx + 8], rax
cmp rax, 0xffffffffffffffff
jne 0x140039695
nop word [rax + rax]
call qword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 2
jne 0x140039638
movzx eax, word [rbp + 0x880a]
cmp ax, 0x39
jae 0x1400398ed
inc ax
mov word [rbp + 0x880a], ax
jmp 0x14003965d
cmp eax, 0xe7
jne 0x1400398ed
mov edx, 0x2710
lea rcx, [rbp + 0x87e0]
call qword [sym.imp.KERNEL32.dll_WaitNamedPipeW]
test eax, eax
je 0x1400398ed
mov qword [rsp + 0x30], r14
mov dword [rsp + 0x28], r14d
mov dword [rsp + 0x20], 3
xor r9d, r9d
xor r8d, r8d
mov edx, 0xc0000000
lea rcx, [rbp + 0x87e0]
call qword [sym.imp.KERNEL32.dll_CreateFileW]
mov qword [rbx + 8], rax
cmp rax, 0xffffffffffffffff
je 0x140039610
mov byte [rbx], 1
cmp dword [rdi + 8], 1
jne 0x14003984d
xor edx, edx
mov r8d, 0x8890
lea rcx, [rsp + 0x50]
call sub.VCRUNTIME140.dll_memset
lea rcx, [rsp + 0x50]
call fcn.140037500
nop
lea rdx, [rsp + 0x50]
mov rcx, rdi
call fcn.140039a20
test al, al
je 0x1400397ec
mov qword [rsp + 0x40], r14
lea r8, [0x1400bfd60]
lea rdx, [rsp + 0x40]
lea rcx, [rsp + 0x50]
call fcn.140039180
mov eax, dword [rsp + 0x50]
shl rax, 5
mov rcx, qword [rsp + 0x58]
movabs r15, 0xffffffffffff
and rcx, r15
add rax, rcx
mov r12d, 0x1000
mov rcx, qword [rsp + 0x40]
cmp rcx, rax
je 0x14003973c
movzx eax, word [rcx + 0x1e]
shr ax, 0xa
test al, 1
je 0x14003973c
lea rsi, [rcx + 0x10]
test word [rsi + 0xe], r12w
jne 0x14003973f
mov rsi, qword [rsi + 8]
and rsi, r15
jmp 0x14003973f
mov rsi, r14
mov qword [rsp + 0x40], r14
lea r8, [0x1400bfcb0]
lea rdx, [rsp + 0x40]
lea rcx, [rsp + 0x50]
call fcn.140039180
mov eax, dword [rsp + 0x50]
shl rax, 5
mov rcx, qword [rsp + 0x58]
and rcx, r15
add rax, rcx
mov rcx, qword [rsp + 0x40]
cmp rcx, rax
je 0x140039797
movzx eax, word [rcx + 0x1e]
shr ax, 0xa
test al, 1
je 0x140039797
lea rbx, [rcx + 0x10]
test word [rbx + 0xe], r12w
jne 0x14003979a
mov rbx, qword [rbx + 8]
and rbx, r15
jmp 0x14003979a
mov rbx, r14
test rsi, rsi
je 0x1400397ec
test rbx, rbx
je 0x1400397ec
lea rdx, str.DISPATCH
mov rcx, rsi
call sub.api_ms_win_crt_string_l1_1_0.dll_strcmp
test eax, eax
jne 0x1400397ec
mov rcx, r14
lea rdx, str.READY
movzx eax, byte [rbx + rcx]
inc rcx
cmp al, byte [rdx + rcx - 1]
jne 0x1400397ec
cmp rcx, 6
jne 0x1400397c1
mov dword [rdi + 8], 3
mov rax, qword [rdi + 0x10]
test rax, rax
je 0x1400397ec
lea rcx, [rsp + 0x50]
call rax
nop
lea rcx, [rbp + 0x7fb8]
call fcn.1400390f0
mov rbx, qword [rsp + 0x68]
test rbx, rbx
je 0x140039839
lea rcx, [rsp + 0x50]
call fcn.140001c70
xorps xmm0, xmm0
movups xmmword [rsp + 0x50], xmm0
mov word [rsp + 0x5e], r14w
mov rbx, qword [rsp + 0x68]
test rbx, rbx
je 0x140039839
mov rcx, rbx
call fcn.1400390f0
mov edx, Ordinal_26
mov rcx, rbx
call fcn.1400a8168
mov edx, 0x810
mov rcx, qword [rsp + 0x78]
call fcn.1400a8168
jmp 0x1400398ed
lea rbx, [rdi + 0x164]
mov dword [rbx], r14d
lea r9, [rdi + 0x20]
lea rcx, [rdi + 0x16c]
call fcn.14003da10
mov dword [rdi + 0x168], eax
mov rcx, qword [rdi]
test rcx, rcx
je 0x1400398b2
mov rcx, qword [rcx + 8]
cmp rcx, 0xffffffffffffffff
je 0x1400398b2
test rbx, rbx
je 0x1400398b2
lea esi, [rax + 8]
mov dword [rsp + 0x40], r14d
mov qword [rsp + 0x20], r14
lea r9, [rsp + 0x40]
mov r8d, esi
mov rdx, rbx
call qword [sym.imp.KERNEL32.dll_WriteFile]
cmp eax, 1
jne 0x1400398b2
cmp dword [rsp + 0x40], esi
jne 0x1400398b2
mov dword [rdi + 8], eax
jmp 0x1400398ed
mov r8, qword [rdi + 0x18]
test r8, r8
je 0x1400398d1
mov eax, dword [rdi + 8]
dec eax
test eax, 0xfffffffd
jne 0x1400398d1
lea rdx, [rdi + 0x64]
mov ecx, dword [rdi + 0x60]
call r8
mov rbx, qword [rdi]
mov rcx, qword [rbx + 8]
call qword [sym.imp.KERNEL32.dll_CloseHandle]
mov qword [rbx + 8], 0xffffffffffffffff
mov byte [rbx], r14b
mov dword [rdi + 8], r14d
mov rcx, qword [rbp + 0x8810]
xor rcx, rsp
call fcn.1400a7a40
lea r11, [rsp + 0x8920]
mov rbx, qword [r11 + 0x20]
mov rsi, qword [r11 + 0x28]
mov rdi, qword [r11 + 0x30]
mov r12, qword [r11 + 0x38]
mov rsp, r11
pop r15
pop r14
pop rbp
ret