Function at 0x140031d30
Capabilities:
Create directory
Get common file path
Query environment variable
Query or enumerate registry value

Disassembly:
mov qword [rsp + 0x18], rbx
push rbp
push rsi
push rdi
push r12
push r13
push r14
push r15
lea rbp, [rsp - 0x370]
sub rsp, 0x470
mov rax, qword [0x140051580]
xor rax, rsp
mov qword [rbp + 0x360], rax
xor r15d, r15d
mov r14d, edx
mov qword [rsp + 0x38], r15
mov r12d, 0x80004005
mov rsi, rcx
mov ebx, r12d
test rcx, rcx
jne 0x140031d86
lea eax, [r12 - 2]
jmp 0x140031fbc
lea rax, [rsp + 0x38]
mov r9d, 1
xor r8d, r8d
mov qword [rsp + 0x20], rax
lea rdx, str.SoftwareMicrosoftWindowsCurrentVersion
mov rcx, 0xffffffff80000002
call qword [sym.imp.ADVAPI32.dll_RegOpenKeyExW]
nop dword [rax + rax]
test eax, eax
jne 0x140031fba
mov ecx, 0x208
mov dword [rsp + 0x30], 1
cmp r14d, ecx
lea r9, [rsp + 0x30]
mov eax, r14d
lea rdx, [0x140049088]
cmova eax, ecx
mov rcx, qword [rsp + 0x38]
mov dword [rsp + 0x34], eax
xor r8d, r8d
lea rax, [rsp + 0x34]
mov qword [rsp + 0x28], rax
lea rax, [rsp + 0x40]
mov qword [rsp + 0x20], rax
call qword [sym.imp.ADVAPI32.dll_RegQueryValueExW]
nop dword [rax + rax]
or rdi, 0xffffffffffffffff
mov r13d, 0x104
test eax, eax
jne 0x140031e93
mov ecx, dword [rsp + 0x30]
lea eax, [rcx - 1]
cmp eax, 1
ja 0x140031e93
cmp ecx, 2
jne 0x140031e5c
mov r8d, r13d
lea rdx, [rbp + 0x150]
lea rcx, [rsp + 0x40]
call qword [sym.imp.KERNEL32.dll_ExpandEnvironmentStringsW]
nop dword [rax + rax]
test eax, eax
je 0x140031e93
lea r8, [rbp + 0x150]
lea edx, [r13 - 1]
lea rcx, [rsp + 0x40]
call fcn.1400104bc
lea rcx, [rsp + 0x40]
call fcn.140019df8
test eax, eax
jne 0x140031f64
xor edx, edx
lea rcx, [rsp + 0x40]
call qword [sym.imp.KERNEL32.dll_CreateDirectoryW]
nop dword [rax + rax]
lea rcx, [rsp + 0x40]
call fcn.140019df8
test eax, eax
jne 0x140031f64
mov edx, r13d
lea rcx, [rbp + 0x150]
call qword [sym.imp.KERNEL32.dll_GetWindowsDirectoryW]
nop dword [rax + rax]
test eax, eax
je 0x140031fa9
mov r8d, r13d
lea rdx, [rsp + 0x40]
lea rcx, [rbp + 0x150]
call qword [sym.imp.KERNEL32.dll_ExpandEnvironmentStringsW]
nop dword [rax + rax]
lea rdx, [0x140043758]
lea rcx, [rsp + 0x40]
call qword [sym.imp.api_ms_win_crt_private_l1_1_0.dll_wcsstr]
nop dword [rax + rax]
test rax, rax
je 0x140031fa9
mov rcx, rdi
inc rcx
cmp word [rax + rcx*2], r15w
jne 0x140031ef0
cmp rcx, 4
jbe 0x140031fa9
mov rcx, qword [0x140051e60]
lea r8, [rbp + 0x150]
mov r9d, r13d
mov word [rax + 4], r15w
mov edx, 0x26fc
call qword [sym.imp.USER32.dll_LoadStringW]
nop dword [rax + rax]
test eax, eax
je 0x140031fa9
lea r8, [rbp + 0x150]
mov rdx, r13
lea rcx, [rsp + 0x40]
call fcn.140010470
xor edx, edx
lea rcx, [rsp + 0x40]
call qword [sym.imp.KERNEL32.dll_CreateDirectoryW]
nop dword [rax + rax]
lea rcx, [rsp + 0x40]
call fcn.140019df8
test eax, eax
je 0x140031fa9
mov rdx, r14
lea rax, [rsp + 0x40]
shr rdx, 1
mov ebx, r15d
inc rdi
cmp word [rax + rdi*2], r15w
jne 0x140031f72
inc rdi
cmp rdx, rdi
jbe 0x140031f93
lea r8, [rsp + 0x40]
mov rcx, rsi
call fcn.1400104bc
jmp 0x140031fa9
mov ecx, 0x8007007a
mov ebx, 0x8007007a
call qword [sym.imp.KERNEL32.dll_SetLastError]
nop dword [rax + rax]
mov rcx, qword [rsp + 0x38]
call qword [sym.imp.ADVAPI32.dll_RegCloseKey]
nop dword [rax + rax]
mov eax, ebx
mov rcx, qword [rbp + 0x360]
xor rcx, rsp
call fcn.140001660
mov rbx, qword [rsp + 0x4c0]
add rsp, 0x470
pop r15
pop r14
pop r13
pop r12
pop rdi
pop rsi
pop rbp
ret