Function at 0x4059a9
Capabilities:
Get common file path
Set current directory

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x65c
push ebx
push esi
mov dword [ebp - 0x20], ecx
push edi
mov ecx, dword [ebp + 8]
push 1
call fcn.00402301
mov ecx, eax
call fcn.004018ad
xor ebx, ebx
cmp dword [ebp + 0xc], 3
push 2
mov esi, eax
mov dword [ebp - 0xc], ebx
pop edi
jb 0x405a14
mov ecx, dword [ebp + 8]
push edi
call fcn.00402301
mov ecx, eax
call fcn.004018d3
test eax, eax
jl 0x405a14
mov ecx, dword [ebp + 8]
push edi
call fcn.00402301
mov ecx, eax
call fcn.004018d3
cmp eax, edi
jg 0x405a14
mov ecx, dword [ebp + 8]
push edi
call fcn.00402301
mov ecx, eax
call fcn.004018d3
mov dword [ebp - 0xc], eax
cmp dword [ebp + 0xc], 4
jb 0x405a34
mov ecx, dword [ebp + 8]
push 3
call fcn.00402301
mov ecx, eax
call fcn.004018d3
cmp eax, 1
mov byte [ebp + 0xc], 1
je 0x405a37
mov byte [ebp + 0xc], bl
mov word [ebp - 0x1a], 1
mov word [ebp - 0x16], 1
mov word [ebp - 0x18], bx
mov word [ebp - 0x14], bx
mov word [ebp - 0x12], bx
mov word [ebp - 0x10], bx
mov word [ebp - 0xe], bx
cmp byte [esi], bl
je 0x405b6b
push esi
call fcn.00417850
cmp eax, 4
pop ecx
jb 0x405c6d
push 4
lea eax, [ebp - 8]
push esi
push eax
call fcn.00418210
lea eax, [ebp - 8]
mov byte [ebp - 4], bl
push eax
call fcn.00417c21
add esi, 4
mov word [ebp - 0x1c], ax
push esi
call fcn.00417850
add esp, 0x14
cmp eax, edi
jb 0x405b75
push edi
lea eax, [ebp - 8]
push esi
push eax
call fcn.00418210
lea eax, [ebp - 8]
mov byte [ebp - 6], bl
push eax
call fcn.00417c21
add esi, edi
mov word [ebp - 0x1a], ax
push esi
call fcn.00417850
add esp, 0x14
cmp eax, edi
jb 0x405b75
push edi
lea eax, [ebp - 8]
push esi
push eax
call fcn.00418210
lea eax, [ebp - 8]
mov byte [ebp - 6], bl
push eax
call fcn.00417c21
add esi, edi
mov word [ebp - 0x16], ax
push esi
call fcn.00417850
add esp, 0x14
cmp eax, edi
jb 0x405b75
push edi
lea eax, [ebp - 8]
push esi
push eax
call fcn.00418210
lea eax, [ebp - 8]
mov byte [ebp - 6], bl
push eax
call fcn.00417c21
add esi, edi
mov word [ebp - 0x14], ax
push esi
call fcn.00417850
add esp, 0x14
cmp eax, edi
jb 0x405b75
push edi
lea eax, [ebp - 8]
push esi
push eax
call fcn.00418210
lea eax, [ebp - 8]
mov byte [ebp - 6], bl
push eax
call fcn.00417c21
add esi, edi
mov word [ebp - 0x12], ax
push esi
call fcn.00417850
add esp, 0x14
cmp eax, edi
jb 0x405b75
push edi
lea eax, [ebp - 8]
push esi
push eax
call fcn.00418210
lea eax, [ebp - 8]
mov byte [ebp - 6], bl
push eax
call fcn.00417c21
add esp, 0x10
mov word [ebp - 0x10], ax
jmp 0x405b75
lea eax, [ebp - 0x1c]
push eax
call dword [sym.imp.KERNEL32.DLL_GetSystemTime]
lea eax, [ebp - 0x28]
push eax
lea eax, [ebp - 0x1c]
push eax
call dword [sym.imp.KERNEL32.DLL_SystemTimeToFileTime]
mov ecx, dword [ebp + 8]
mov esi, 0x104
push esi
push ebx
call fcn.00402301
mov ecx, eax
call fcn.004018ad
push eax
lea eax, [ebp - 0x23c]
push eax
call fcn.00418210
lea eax, [ebp - 0x23c]
mov byte [ebp - 0x138], bl
push eax
call fcn.0041517d
add esp, 0x10
lea eax, [ebp - 0x2c]
push eax
lea eax, [ebp - 0x23c]
push eax
lea eax, [ebp - 0x23c]
push esi
push eax
call dword [sym.imp.KERNEL32.DLL_GetFullPathNameA]
lea eax, [ebp - 0x554]
push eax
lea eax, [ebp - 0x134]
push eax
lea eax, [ebp - 0x44c]
push eax
lea eax, [ebp - 0x344]
push eax
lea eax, [ebp - 0x23c]
push eax
call fcn.004180be
lea eax, [ebp - 0x44c]
push eax
lea eax, [ebp - 0x344]
push eax
call fcn.00417760
lea eax, [ebp - 0x554]
push eax
lea eax, [ebp - 0x134]
push eax
call fcn.00417760
add esp, 0x24
lea eax, [ebp - 0x65c]
push eax
push esi
call dword [sym.imp.KERNEL32.DLL_GetCurrentDirectoryA]
mov esi, dword [sym.imp.KERNEL32.DLL_SetCurrentDirectoryA]
lea eax, [ebp - 0x344]
push eax
call esi
lea eax, [ebp - 0x134]
push eax
call fcn.004152f5
test al, al
pop ecx
je 0x405c99
push dword [ebp - 0xc]
lea eax, [ebp - 0x28]
push eax
lea eax, [ebp - 0x134]
push eax
call fcn.0041519e
add esp, 0xc
test al, al
jne 0x405c78
mov ecx, dword [ebp + 0x10]
push ebx
call fcn.00401aa7
jmp 0x405cc8
cmp byte [ebp + 0xc], bl
je 0x405cc8
lea eax, [ebp - 0x134]
push eax
call esi
lea eax, [ebp - 0x134]
push 0x42651c
push eax
call fcn.00417750
pop ecx
pop ecx
push dword [ebp + 0xc]
mov ecx, dword [ebp - 0x20]
lea eax, [ebp - 0x28]
push dword [ebp - 0xc]
push eax
lea eax, [ebp - 0x134]
push eax
call fcn.00405cd1
test al, al
jne 0x405cbf
mov ecx, dword [ebp + 0x10]
push ebx
call fcn.00401aa7
lea eax, [ebp - 0x65c]
push eax
call esi
pop edi
pop esi
xor eax, eax
pop ebx
leave
ret 0xc