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

Disassembly:
mov qword [rsp + 0x10], rdx
mov qword [rsp + 0x18], r8
mov qword [rsp + 0x20], r9
push rbx
push rbp
push rsi
push rdi
push r12
sub rsp, 0xe80
mov rax, qword [0x1000a5140]
xor rax, rsp
mov qword [rsp + 0xe70], rax
mov ebx, ecx
test dword [0x1000b11d4], ecx
jne 0x10005e4a8
test dword [0x1000b11d8], ecx
je 0x10005e765
mov r9d, dword [0x1000b11bc]
or r12, 0xffffffffffffffff
inc r9d
mov dword [0x1000b11bc], r9d
cmp r9d, r12d
jne 0x10005e4cf
call qword [sym.imp.KERNEL32.dll_DebugBreak]
mov r9d, dword [0x1000b11bc]
mov edi, 0x400
lea r8, [0x1000203c8]
lea rcx, [rsp + 0x60]
mov rdx, rdi
call sub.msvcrt.dll_swprintf_s
mov r9, qword [rsp + 0xeb8]
lea r8, [rsp + 0xec0]
sub edi, eax
cdqe
mov qword [rsp + 0x20], r8
lea rcx, [rsp + rax*2 + 0x60]
mov edx, edi
mov r8, r12
call sub.msvcrt.dll__vsnwprintf_s
xor eax, eax
xor ebp, ebp
lea rdi, [rsp + 0x60]
mov rcx, r12
repne scasw ax, word [rdi]
lea edi, [rbp + 0xa]
not rcx
dec rcx
lea eax, [rcx - 1]
cmp word [rsp + rax*2 + 0x60], di
je 0x10005e55b
cmp ecx, 0x3ff
jae 0x10005e54b
mov eax, ecx
mov word [rsp + rax*2 + 0x60], di
lea eax, [rcx + 1]
mov word [rsp + rax*2 + 0x60], bp
jmp 0x10005e55b
mov word [rsp + 0x85c], di
mov word [rsp + 0x85e], bp
test dword [0x1000b11d4], ebx
je 0x10005e671
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 0x10005e5b6
lea rdx, [rsp + rdx*2 + 0xa70]
cmp word [rdx], 0x2f
je 0x10005e5ae
cmp word [rdx], 0x5c
je 0x10005e5ae
dec ecx
sub rdx, 2
cmp ecx, eax
jbe 0x10005e596
jmp 0x10005e5b6
mov word [rsp + rcx*2 + 0xa70], bp
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], rbp
lea rcx, [0x1000203b8]
xor r9d, r9d
xor r8d, r8d
mov edx, 0x40000000
mov dword [rsp + 0x28], 0x80
mov dword [rsp + 0x20], 4
call qword [sym.imp.KERNEL32.dll_CreateFileW]
lea rcx, [rsp + 0x860]
mov rsi, rax
call qword [sym.imp.KERNEL32.dll_SetCurrentDirectoryW]
cmp rsi, r12
je 0x10005e671
mov r9d, 2
xor r8d, r8d
xor edx, edx
mov rcx, rsi
call qword [sym.imp.KERNEL32.dll_SetFilePointer]
xor r8d, r8d
mov edx, ebx
mov rcx, rsi
call fcn.10005e78c
xor eax, eax
lea rdi, [rsp + 0x60]
mov rcx, r12
lea r9, [rsp + 0x40]
lea rdx, [rsp + 0x60]
repne scasw ax, word [rdi]
mov qword [rsp + 0x20], rbp
not rcx
lea r8d, [rcx + rcx - 2]
mov rcx, rsi
call qword [sym.imp.KERNEL32.dll_WriteFile]
mov rcx, rsi
call qword [sym.imp.KERNEL32.dll_CloseHandle]
test dword [0x1000b11d8], ebx
je 0x10005e765
mov ecx, 0xfffffff5
call qword [sym.imp.KERNEL32.dll_GetStdHandle]
mov rsi, rax
cmp rax, rbp
je 0x10005e765
mov r8b, 1
mov edx, ebx
mov rcx, rax
call fcn.10005e78c
mov rcx, rsi
call qword [sym.imp.KERNEL32.dll_GetFileType]
cmp eax, 2
je 0x10005e739
mov qword [rsp + 0x30], rbp
lea r9, [rsp + 0x48]
lea rcx, [0x100020400]
mov edx, 0xc0000000
mov r8d, 2
mov dword [rsp + 0x28], 0x80
mov dword [rsp + 0x48], 0x18
mov qword [rsp + 0x50], rbp
mov dword [rsp + 0x58], 1
mov dword [rsp + 0x20], 3
call qword [sym.imp.KERNEL32.dll_CreateFileW]
mov rbx, rax
cmp rax, rbp
je 0x10005e765
xor eax, eax
lea rdi, [rsp + 0x60]
mov rcx, r12
repne scasw ax, word [rdi]
lea r9, [rsp + 0x40]
lea rdx, [rsp + 0x60]
not rcx
mov qword [rsp + 0x20], rbp
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 0x10005e765
xor eax, eax
lea rdi, [rsp + 0x60]
mov rcx, r12
repne scasw ax, word [rdi]
lea r9, [rsp + 0x40]
lea rdx, [rsp + 0x60]
not rcx
mov qword [rsp + 0x20], rbp
lea r8, [rcx - 1]
mov rcx, rsi
call qword [sym.imp.KERNEL32.dll_WriteConsoleW]
mov rcx, qword [rsp + 0xe70]
xor rcx, rsp
call fcn.1000995a0
add rsp, 0xe80
pop r12
pop rdi
pop rsi
pop rbp
pop rbx
ret