Function at 0x405480
Capabilities:
Check if file exists
Query environment variable
Set current directory

Disassembly:
push ebp
mov ebp, esp
push 0xffffffffffffffff
push 0x598680
mov eax, dword fs:[0]
push eax
sub esp, 0x90
mov eax, dword [0x6041c0]
xor eax, ebp
push eax
lea eax, [ebp - 0xc]
mov dword fs:[0], eax
mov dword [ebp - 0x1c], ecx
mov dword [ebp - 0x24], 0
lea ecx, [ebp - 0x14]
call fcn.00402220
mov dword [ebp - 4], 0
lea ecx, [ebp - 0x10]
call fcn.00402220
mov byte [ebp - 4], 1
mov eax, dword [ebp + 0xc]
cmp dword [eax + 0x28], 0
jne 0x4054f8
mov ecx, dword [ebp + 0xc]
add ecx, 0x34
push ecx
lea ecx, [ebp - 0x10]
call fcn.004025b0
lea edx, [ebp - 0x10]
push edx
mov ecx, 0x608c40
call fcn.00415c40
jmp 0x4058c6
push ecx
mov ecx, esp
mov dword [ebp - 0x90], esp
mov eax, dword [ebp + 0xc]
add eax, 0x24
push eax
call fcn.00401fd0
call fcn.00407390
add esp, 4
mov dword [ebp - 0x28], eax
cmp dword [ebp - 0x28], 0
je 0x40567e
mov ecx, dword [ebp + 0xc]
add ecx, 0x24
push ecx
lea ecx, [ebp - 0x14]
call fcn.004025b0
lea ecx, [ebp - 0x18]
call fcn.00402220
mov byte [ebp - 4], 2
mov edx, dword [ebp - 0x1c]
mov eax, dword [edx]
cmp dword [eax + 0x18], 0
jne 0x40557b
lea ecx, [ebp - 0x34]
push ecx
call fcn.00416050
add esp, 4
mov dword [ebp - 0x2c], eax
mov edx, dword [ebp - 0x2c]
mov dword [ebp - 0x30], edx
mov byte [ebp - 4], 3
mov eax, dword [ebp - 0x30]
push eax
lea ecx, [ebp - 0x18]
call fcn.004025b0
mov byte [ebp - 4], 2
lea ecx, [ebp - 0x34]
call fcn.004023e0
jmp 0x4055f7
mov ecx, dword [ebp - 0x1c]
add ecx, 4
push ecx
lea ecx, [ebp - 0x18]
call fcn.004025b0
push 0
lea ecx, [ebp - 0x18]
call fcn.00402790
push eax
call fcn.0056ca98
test eax, eax
je 0x4055f7
push 0x5ab544
lea ecx, [ebp - 0x48]
call fcn.00402040
mov dword [ebp - 0x38], eax
mov edx, dword [ebp - 0x38]
mov dword [ebp - 0x3c], edx
mov byte [ebp - 4], 4
mov ecx, dword [ebp - 0x3c]
call fcn.00402790
mov dword [ebp - 0x40], eax
push 0
lea ecx, [ebp - 0x18]
call fcn.00402790
push eax
call fcn.0056ca98
mov dword [ebp - 0x44], eax
push 0x2cb
mov eax, dword [ebp - 0x40]
push eax
mov ecx, dword [ebp - 0x44]
push ecx
call fcn.004348f0
add esp, 0xc
mov byte [ebp - 4], 2
lea ecx, [ebp - 0x48]
call fcn.004023e0
mov edx, dword [ebp - 0x14]
push edx
push str.downloading__s
call fcn.00436950
add esp, 8
lea eax, [ebp - 0x18]
push eax
push ecx
mov ecx, esp
mov dword [ebp - 0x94], esp
lea edx, [ebp - 0x14]
push edx
call fcn.00401fd0
call fcn.00404af0
add esp, 8
mov dword [ebp - 0x4c], eax
mov eax, dword [ebp - 0x4c]
mov dword [ebp - 0x20], eax
cmp dword [ebp - 0x20], 0
je 0x40564c
push 0
lea ecx, [ebp - 0x14]
call fcn.00402790
push eax
mov ecx, dword [ebp - 0x20]
push ecx
call fcn.004348f0
add esp, 0xc
mov edx, dword [ebp - 0x1c]
add edx, 0x14
mov dword [ebp - 0x50], edx
lea eax, [ebp - 0x18]
push eax
mov ecx, dword [ebp - 0x50]
call fcn.00403a10
lea ecx, [ebp - 0x18]
push ecx
lea ecx, [ebp - 0x10]
call fcn.004025b0
mov byte [ebp - 4], 1
lea ecx, [ebp - 0x18]
call fcn.004023e0
jmp 0x4058c6
push ecx
mov ecx, esp
mov dword [ebp - 0x98], esp
mov edx, dword [ebp + 0xc]
add edx, 0x24
push edx
call fcn.00401fd0
call fcn.00407460
add esp, 4
mov dword [ebp - 0x54], eax
cmp dword [ebp - 0x54], 0
je 0x4058a9
mov eax, dword [ebp + 0xc]
add eax, 0x24
push eax
lea ecx, [ebp - 0x14]
call fcn.004025b0
push 0x104
lea ecx, [ebp - 0x10]
call fcn.00405a80
mov dword [ebp - 0x58], eax
lea ecx, [ebp - 0x14]
call fcn.00402790
mov dword [ebp - 0x5c], eax
push 0x104
mov ecx, dword [ebp - 0x58]
push ecx
mov edx, dword [ebp - 0x5c]
push edx
call dword [sym.imp.KERNEL32.dll_ExpandEnvironmentStringsW]
push 0xffffffffffffffff
lea ecx, [ebp - 0x10]
call fcn.00408ec0
mov ecx, 0x608bb4
call fcn.00402790
push eax
call dword [sym.imp.KERNEL32.dll_SetCurrentDirectoryW]
test eax, eax
jne 0x405753
push 0x5ab594
lea ecx, [ebp - 0x70]
call fcn.00402040
mov dword [ebp - 0x60], eax
mov eax, dword [ebp - 0x60]
mov dword [ebp - 0x64], eax
mov byte [ebp - 4], 5
mov ecx, dword [ebp - 0x64]
call fcn.00402790
mov dword [ebp - 0x68], eax
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov dword [ebp - 0x6c], eax
push 0x2e0
mov ecx, dword [ebp - 0x68]
push ecx
mov edx, dword [ebp - 0x6c]
push edx
call fcn.004348f0
add esp, 0xc
mov byte [ebp - 4], 1
lea ecx, [ebp - 0x70]
call fcn.004023e0
lea eax, [ebp - 0x10]
push eax
lea ecx, [ebp - 0x14]
call fcn.004025b0
lea ecx, [ebp - 0x10]
call fcn.00404f20
lea ecx, [ebp - 0x14]
call fcn.00402790
mov dword [ebp - 0x74], eax
push 0x104
lea ecx, [ebp - 0x10]
call fcn.00405a80
mov dword [ebp - 0x78], eax
push 0x104
mov ecx, dword [ebp - 0x74]
push ecx
mov edx, dword [ebp - 0x78]
push edx
call fcn.0057d736
add esp, 0xc
test eax, eax
jne 0x4057b3
push 0
mov ecx, dword [ebp + 0xc]
add ecx, 0x24
call fcn.00402790
push eax
push 2
call fcn.004348f0
add esp, 0xc
push 0xffffffffffffffff
lea ecx, [ebp - 0x10]
call fcn.00408ec0
lea ecx, [ebp - 0x10]
call fcn.00402790
push eax
call dword [sym.imp.SHLWAPI.dll_PathFileExistsW]
test eax, eax
jne 0x40581e
mov eax, dword [ebp + 0xc]
add eax, 0x24
push eax
lea ecx, [ebp - 0x10]
call fcn.004025b0
push 0
push 0
push 0x104
lea ecx, [ebp - 0x10]
call fcn.00405a80
push eax
call dword [sym.imp.SHELL32.dll_PathResolve]
mov dword [ebp - 0x9c], eax
push 0xffffffffffffffff
lea ecx, [ebp - 0x10]
call fcn.00408ec0
mov ecx, dword [ebp - 0x1c]
add ecx, 4
call fcn.00402790
push eax
call dword [sym.imp.KERNEL32.dll_SetCurrentDirectoryW]
jmp 0x4058a7
mov ecx, dword [ebp + 0xc]
add ecx, 0x40
call fcn.00407360
movzx ecx, al
test ecx, ecx
jne 0x4058a7
mov ecx, dword [ebp - 0x1c]
add ecx, 4
call fcn.00402790
push eax
call dword [sym.imp.KERNEL32.dll_SetCurrentDirectoryW]
test eax, eax
jne 0x4058a7
push 0x5ab5c4
lea ecx, [ebp - 0x8c]
call fcn.00402040
mov dword [ebp - 0x7c], eax
mov edx, dword [ebp - 0x7c]
mov dword [ebp - 0x80], edx
mov byte [ebp - 4], 6
mov ecx, dword [ebp - 0x80]
call fcn.00402790
mov dword [ebp - 0x84], eax
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov dword [ebp - 0x88], eax
push 0x2f7
mov eax, dword [ebp - 0x84]
push eax
mov ecx, dword [ebp - 0x88]
push ecx
call fcn.004348f0
add esp, 0xc
mov byte [ebp - 4], 1
lea ecx, [ebp - 0x8c]
call fcn.004023e0
jmp 0x4058c6
mov edx, dword [ebp + 0xc]
add edx, 0x24
push edx
lea ecx, [ebp - 0x10]
call fcn.004025b0
lea eax, [ebp - 0x10]
push eax
mov ecx, 0x608c40
call fcn.00415f70
lea ecx, [ebp - 0x10]
call fcn.00402790
push eax
call dword [sym.imp.SHLWAPI.dll_PathFileExistsW]
test eax, eax
jne 0x4058ee
push 0
lea ecx, [ebp - 0x10]
call fcn.00402790
push eax
push 2
call fcn.004348f0
add esp, 0xc
lea ecx, [ebp - 0x10]
push ecx
mov ecx, dword [ebp + 8]
call fcn.00401fd0
mov edx, dword [ebp - 0x24]
or edx, 1
mov dword [ebp - 0x24], edx
mov byte [ebp - 4], 0
lea ecx, [ebp - 0x10]
call fcn.004023e0
mov dword [ebp - 4], 0xffffffff
lea ecx, [ebp - 0x14]
call fcn.004023e0
mov eax, dword [ebp + 8]
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
pop ecx
mov esp, ebp
pop ebp
ret 8