Function at 0x100065cf8
Capabilities:
Get common file path
Set current directory
Write file on windows

Disassembly:
mov qword [rsp + 0x20], r9
push rbx
push rbp
push rsi
push rdi
push r12
push r13
push r14
sub rsp, 0xe80
mov rax, qword [0x1000af140]
xor rax, rsp
mov qword [rsp + 0xe70], rax
mov rdi, r8
mov esi, edx
mov ebp, ecx
test dword [0x1000bb330], ecx
jne 0x100065d3b
test dword [0x1000bb334], ecx
je 0x100066087
mov r9d, dword [0x1000bb10c]
mov r12d, 0x400
lea r8, [0x100024898]
inc r9d
lea rcx, [rsp + 0x60]
mov rdx, r12
mov dword [0x1000bb10c], r9d
call sub.msvcrt.dll_swprintf_s
xor r13d, r13d
or r14, 0xffffffffffffffff
movsxd rbx, eax
cmp rdi, r13
je 0x100065da7
mov edx, r12d
lea rcx, [rsp + rbx*2 + 0x60]
mov r9, rdi
sub edx, ebx
cmp esi, r13d
je 0x100065d99
lea r8, [0x1000248a8]
mov dword [rsp + 0x20], esi
call sub.msvcrt.dll_swprintf_s
jmp 0x100065dc5
lea r8, [0x1000248c0]
call sub.msvcrt.dll_swprintf_s
jmp 0x100065dc5
cmp esi, r13d
je 0x100065df8
mov edx, r12d
lea rcx, [rsp + rbx*2 + 0x60]
lea r8, [0x100024898]
sub edx, ebx
mov r9d, esi
call sub.msvcrt.dll_swprintf_s
add ebx, eax
cmp rdi, r13
je 0x100065df8
lea rdx, [0x1000bb130]
sub rdx, rdi
movzx eax, byte [rdi]
movzx ecx, byte [rdi + rdx]
sub eax, ecx
jne 0x100065de8
inc rdi
test ecx, ecx
jne 0x100065dd6
cmp eax, r13d
jne 0x100065df8
cmp esi, r14d
jne 0x100065df8
call qword [sym.imp.KERNEL32.dll_DebugBreak]
cmp dword [0x1000bb10c], r14d
jne 0x100065e07
call qword [sym.imp.KERNEL32.dll_DebugBreak]
mov r9, qword [rsp + 0xed8]
movsxd rax, ebx
lea rdi, [rsp + 0xee0]
sub r12d, ebx
lea rcx, [rsp + rax*2 + 0x60]
mov r8, r14
mov edx, r12d
mov qword [rsp + 0x20], rdi
call sub.msvcrt.dll__vsnwprintf_s
xor eax, eax
lea rdi, [rsp + 0x60]
mov rcx, r14
repne scasw ax, word [rdi]
mov edi, 0xa
not rcx
dec rcx
lea eax, [rcx - 1]
cmp word [rsp + rax*2 + 0x60], di
je 0x100065e7f
cmp ecx, 0x3ff
jae 0x100065e6e
mov eax, ecx
mov word [rsp + rax*2 + 0x60], di
lea eax, [rcx + 1]
mov word [rsp + rax*2 + 0x60], r13w
jmp 0x100065e7f
mov word [rsp + 0x85c], di
mov word [rsp + 0x85e], r13w
mov esi, 0x80
test dword [0x1000bb330], ebp
je 0x100065f97
mov edi, 0x200
lea rdx, [rsp + 0xa70]
xor ecx, ecx
mov r8d, edi
call qword [sym.imp.KERNEL32.dll_GetModuleFileNameW]
cmp eax, edi
cmovae eax, edi
lea ecx, [rax - 1]
movsxd rdx, ecx
cmp ecx, eax
ja 0x100065ee0
lea rdx, [rsp + rdx*2 + 0xa70]
cmp word [rdx], 0x2f
je 0x100065ed7
cmp word [rdx], 0x5c
je 0x100065ed7
dec ecx
sub rdx, 2
cmp ecx, eax
jbe 0x100065ebf
jmp 0x100065ee0
mov word [rsp + rcx*2 + 0xa70], r13w
lea rdx, [rsp + 0x860]
mov ecx, 0x104
call qword [sym.imp.KERNEL32.dll_GetCurrentDirectoryW]
lea rcx, [rsp + 0xa70]
call qword [sym.imp.KERNEL32.dll_SetCurrentDirectoryW]
mov qword [rsp + 0x30], r13
lea rcx, [0x100024888]
xor r9d, r9d
xor r8d, r8d
mov edx, 0x40000000
mov dword [rsp + 0x28], esi
mov dword [rsp + 0x20], 4
call qword [sym.imp.KERNEL32.dll_CreateFileW]
lea rcx, [rsp + 0x860]
mov rbx, rax
call qword [sym.imp.KERNEL32.dll_SetCurrentDirectoryW]
cmp rbx, r14
je 0x100065f97
mov r9d, 2
xor r8d, r8d
xor edx, edx
mov rcx, rbx
call qword [sym.imp.KERNEL32.dll_SetFilePointer]
xor r8d, r8d
mov edx, ebp
mov rcx, rbx
call fcn.1000663d8
xor eax, eax
lea rdi, [rsp + 0x60]
mov rcx, r14
lea r9, [rsp + 0x40]
lea rdx, [rsp + 0x60]
repne scasw ax, word [rdi]
mov qword [rsp + 0x20], r13
not rcx
lea r8d, [rcx + rcx - 2]
mov rcx, rbx
call qword [sym.imp.KERNEL32.dll_WriteFile]
mov rcx, rbx
call qword [sym.imp.KERNEL32.dll_CloseHandle]
test dword [0x1000bb334], ebp
je 0x100066087
mov ecx, 0xfffffff5
call qword [sym.imp.KERNEL32.dll_GetStdHandle]
mov rbx, rax
cmp rax, r13
je 0x100066087
mov r8b, 1
mov edx, ebp
mov rcx, rax
call fcn.1000663d8
mov rcx, rbx
call qword [sym.imp.KERNEL32.dll_GetFileType]
cmp eax, 2
je 0x10006605b
mov qword [rsp + 0x30], r13
lea r9, [rsp + 0x48]
lea rcx, [0x1000248d0]
mov edx, 0xc0000000
mov r8d, 2
mov dword [rsp + 0x28], esi
mov dword [rsp + 0x48], 0x18
mov qword [rsp + 0x50], r13
mov dword [rsp + 0x58], 1
mov dword [rsp + 0x20], 3
call qword [sym.imp.KERNEL32.dll_CreateFileW]
mov rbx, rax
cmp rax, r13
je 0x100066087
xor eax, eax
lea rdi, [rsp + 0x60]
mov rcx, r14
repne scasw ax, word [rdi]
lea r9, [rsp + 0x40]
lea rdx, [rsp + 0x60]
not rcx
mov qword [rsp + 0x20], r13
lea r8, [rcx - 1]
mov rcx, rbx
call qword [sym.imp.KERNEL32.dll_WriteConsoleW]
mov rcx, rbx
call qword [sym.imp.KERNEL32.dll_CloseHandle]
jmp 0x100066087
xor eax, eax
lea rdi, [rsp + 0x60]
mov rcx, r14
repne scasw ax, word [rdi]
lea r9, [rsp + 0x40]
lea rdx, [rsp + 0x60]
not rcx
mov qword [rsp + 0x20], r13
lea r8, [rcx - 1]
mov rcx, rbx
call qword [sym.imp.KERNEL32.dll_WriteConsoleW]
mov rcx, qword [rsp + 0xe70]
xor rcx, rsp
call fcn.1000a2150
add rsp, 0xe80
pop r14
pop r13
pop r12
pop rdi
pop rsi
pop rbp
pop rbx
ret