Function at 0x4083d0
Capabilities:
Get common file path
Query environment variable
Set environment variable

Disassembly:
push ebp
mov eax, 0x402c
push edi
push esi
push ebx
call fcn.0040f380
sub esp, eax
mov ecx, dword [esp + 0x4044]
test ecx, ecx
je 0x408600
mov dword [esp], 0x41b3d2
call fcn.00408260
mov dword [esp + 8], 0
mov dword [esp + 0x14], eax
mov eax, dword [esp + 0x4044]
mov dword [esp], 0
mov dword [esp + 4], eax
call fcn.004097f0
mov ebx, eax
test eax, eax
je 0x4086e8
lea ebp, [esp + 0x20]
mov dword [esp + 8], 0x1000
mov dword [esp + 4], ebp
mov dword [esp], eax
call dword [sym.imp.KERNEL32.dll_ExpandEnvironmentStringsW]
sub esp, 0xc
mov esi, eax
mov dword [esp], ebx
call sub.msvcrt.dll_free
test esi, esi
je 0x4086b0
mov dword [esp], ebp
call fcn.00409bb0
test eax, eax
jne 0x4085f0
mov dword [esp + 8], 0x1000
mov dword [esp + 4], ebp
mov dword [esp], 0
call dword [sym.imp.msvcrt.dll__wfullpath]
mov esi, eax
test esi, esi
je 0x4086f9
lea ebx, [esp + 0x2020]
xor eax, eax
mov ecx, 0x800
mov edi, ebx
rep stosd dword es:[edi], eax
mov dword [esp + 4], 0x5c
mov dword [esp], esi
call sub.msvcrt.dll_wcschr
mov edi, eax
mov eax, dword [sym.imp.KERNEL32.dll_CreateDirectoryW]
mov dword [esp + 0x18], eax
test edi, edi
je 0x408510
mov dword [esp + 0x1c], ebp
mov ebp, esi
mov esi, eax
lea esi, [esi]
mov eax, edi
mov dword [esp + 4], ebp
add edi, 2
sub eax, ebp
mov dword [esp], ebx
sar eax, 1
add eax, 1
mov dword [esp + 8], eax
call sub.msvcrt.dll_wcsncpy
mov dword [esp + 4], 0
mov dword [esp], ebx
call esi
sub esp, 8
mov dword [esp], edi
mov dword [esp + 4], 0x5c
call sub.msvcrt.dll_wcschr
mov edi, eax
test eax, eax
jne 0x4084c8
mov esi, ebp
mov ebp, dword [esp + 0x1c]
mov dword [esp + 4], 0
mov eax, dword [esp + 0x18]
mov dword [esp], esi
call eax
sub esp, 8
mov dword [esp + 4], esi
mov dword [esp], 0x41b4a0
call dword [sym.imp.msvcrt.dll__wputenv_s]
mov dword [esp], esi
mov edi, eax
call sub.msvcrt.dll_free
test edi, edi
jne 0x4086d0
mov dword [esp + 4], ebx
mov esi, 5
mov dword [esp], 0x1000
call dword [sym.imp.KERNEL32.dll_GetTempPathW]
sub esp, 8
call sub.msvcrt.dll__getpid
mov dword [esp + 8], str._MEI_d
mov dword [esp + 0xc], eax
mov dword [esp + 4], 0x10
mov dword [esp], ebp
call fcn.00408120
mov dword [esp + 4], ebp
mov dword [esp], ebx
call dword [sym.imp.msvcrt.dll__wtempnam]
mov dword [esp], eax
mov edi, eax
call fcn.00409ad0
test eax, eax
je 0x408620
mov dword [esp], edi
call sub.msvcrt.dll_free
sub esi, 1
jne 0x408581
mov eax, dword [esp + 0x4044]
xor ebx, ebx
test eax, eax
je 0x4085de
mov esi, dword [esp + 0x14]
test esi, esi
je 0x40865f
mov dword [esp + 4], esi
mov dword [esp], 0x41b3d2
call fcn.00408310
mov dword [esp], esi
call sub.msvcrt.dll_free
add esp, 0x402c
mov eax, ebx
pop ebx
pop esi
pop edi
pop ebp
ret
mov dword [esp], ebp
call dword [sym.imp.msvcrt.dll__wcsdup]
mov esi, eax
jmp 0x408481
mov dword [esp + 0x14], 0
lea ebp, [esp + 0x20]
lea ebx, [esp + 0x2020]
jmp 0x408547
mov eax, dword [esp + 0x4040]
mov dword [esp + 4], edi
mov ebx, 1
mov dword [esp + 8], 0x1000
mov dword [esp], eax
call fcn.00409610
mov dword [esp], edi
call sub.msvcrt.dll_free
mov edx, dword [esp + 0x4044]
test edx, edx
je 0x4085de
mov esi, dword [esp + 0x14]
test esi, esi
jne 0x4085c6
mov dword [esp + 8], 0
mov dword [esp + 4], 0x41b3d2
mov dword [esp], 0
call fcn.004097f0
mov dword [esp + 4], 0
mov esi, eax
mov dword [esp], eax
call dword [sym.imp.KERNEL32.dll_SetEnvironmentVariableW]
sub esp, 8
mov dword [esp], esi
call sub.msvcrt.dll_free
add esp, 0x402c
mov eax, ebx
pop ebx
pop esi
pop edi
pop ebp
ret
mov dword [esp], str.LOADER:_Failed_to_expand_environment_variables_in_the_runtime_tmpdir._n
xor ebx, ebx
call fcn.00403030
add esp, 0x402c
mov eax, ebx
pop ebx
pop esi
pop edi
pop ebp
ret
mov dword [esp], str.LOADER:_Failed_to_set_the_TMP_environment_variable._n
xor ebx, ebx
call fcn.00403030
jmp 0x4085de
mov dword [esp], str.LOADER:_Failed_to_convert_runtime_tmpdir_to_a_wide_string._n
call fcn.00403030
jmp 0x4085de
mov dword [esp], str.LOADER:_Failed_to_obtain_the_absolute_path_of_the_runtime_tmpdir._n
xor ebx, ebx
call fcn.00403030
jmp 0x4085de