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

Disassembly:
push ebp
mov ebp, esp
add esp, 0xfffff688
push ebx
push esi
push edi
mov edi, edx
mov dword [ebp - 0x34], eax
mov eax, 0x4997fc
call fcn.0048d8c4
push 0x4997a5
call sub.KERNEL32.DLL_LoadLibraryA
mov dword [ebp - 0x38], eax
cmp dword [ebp - 0x38], 0
jne 0x40f4c7
xor eax, eax
mov edx, dword [ebp - 0x30]
mov dword fs:[0], edx
jmp 0x40f749
push 0x4997b0
push dword [ebp - 0x38]
call sub.KERNEL32.DLL_GetProcAddress
mov dword [ebp - 0x3c], eax
cmp dword [ebp - 0x3c], 0
jne 0x40f4f6
push dword [ebp - 0x38]
call sub.KERNEL32.DLL_FreeLibrary
xor eax, eax
mov edx, dword [ebp - 0x30]
mov dword fs:[0], edx
jmp 0x40f749
test edi, edi
je 0x40f503
xor ecx, ecx
mov cl, byte [edi]
cmp ecx, 0x2e
je 0x40f507
xor eax, eax
jmp 0x40f50c
mov eax, 1
mov byte [ebp - 0x3d], al
cmp byte [ebp - 0x3d], 0
je 0x40f51d
inc edi
cmp byte [edi], 0
jne 0x40f51d
xor edi, edi
lea eax, [ebp - 0x44]
push eax
lea edx, [ebp - 0x148]
push edx
push 0x104
push dword [ebp - 0x34]
call sub.KERNEL32.DLL_GetFullPathNameA
push 0x18
push 0
lea ecx, [ebp - 0x160]
push ecx
call fcn.0048d2a4
mov dword [ebp - 0x158], 0xffffffff
lea eax, [ebp - 0x148]
add esp, 0xc
mov dword [ebp - 0x154], eax
lea ecx, [ebp - 0x190]
mov edx, dword [ebp - 0x44]
mov dword [ebp - 0x150], edx
push 0x30
push 0
push ecx
call fcn.0048d2a4
mov dword [ebp - 0x168], 1
lea eax, [ebp - 0x160]
add esp, 0xc
mov dword [ebp - 0x164], eax
lea eax, [ebp - 0xc]
mov word [ebp - 0x20], 8
call fcn.0040f7a4
inc dword [ebp - 0x14]
mov word [ebp - 0x20], 0x14
test edi, edi
je 0x40f68e
mov ebx, edi
test ebx, ebx
je 0x40f676
lea eax, [ebp - 0xc]
mov edx, 1
call fcn.0040f838
mov esi, dword [ebp - 0x170]
shl esi, 3
lea esi, [esi + esi*2]
add esi, dword [ebp - 0xc]
mov word [ebp - 0x20], 0x14
push 0x18
push 0
push esi
call fcn.0048d2a4
add esp, 0xc
push 0x4997bd
lea eax, [ebp - 0x578]
push eax
call fcn.0048d424
add esp, 8
push ebx
lea edx, [ebp - 0x578]
push edx
call fcn.0048d348
add esp, 8
push 0x4997c3
push ebx
call fcn.0048d56d
add esp, 8
mov ebx, eax
test ebx, ebx
je 0x40f630
inc ebx
xor ecx, ecx
mov cl, byte [ebx]
push ecx
call fcn.00491198
pop ecx
test eax, eax
jne 0x40f620
push 0x4997c3
lea eax, [ebp - 0x578]
push eax
call fcn.0048d56d
add esp, 8
mov word [ebp - 0x20], 0x14
test eax, eax
je 0x40f651
mov byte [eax], 0
mov dword [esi + 4], 1
lea edx, [ebp - 0x578]
push edx
call fcn.0048d5f8
pop ecx
mov dword [esi + 0xc], eax
inc dword [ebp - 0x170]
test ebx, ebx
jne 0x40f5b9
mov ecx, dword [ebp - 0xc]
mov dword [ebp - 0x16c], ecx
mov eax, dword [ebp - 0x44]
mov dword [ebp - 0x188], eax
mov dword [ebp - 0x18c], eax
lea edx, [ebp - 0x978]
push edx
push 0x400
call sub.KERNEL32.DLL_GetCurrentDirectoryA
push 0
test edi, edi
je 0x40f6ac
mov ecx, 1
jmp 0x40f6b1
mov ecx, 9
push ecx
lea eax, [ebp - 0x190]
push eax
push 0
push 0
call dword [ebp - 0x3c]
test eax, eax
sete bl
mov word [ebp - 0x20], 0x14
and ebx, 1
xor esi, esi
jmp 0x40f6e3
lea eax, [esi + esi*2]
mov edx, dword [ebp - 0xc]
push dword [edx + eax*8 + 0xc]
call fcn.0048c1c4
pop ecx
inc esi
cmp esi, dword [ebp - 8]
jl 0x40f6d2
lea ecx, [ebp - 0x978]
push ecx
call sub.KERNEL32.DLL_SetCurrentDirectoryA
push dword [ebp - 0x38]
call sub.KERNEL32.DLL_FreeLibrary
test bl, bl
je 0x40f70f
cmp byte [ebp - 0x3d], 0
je 0x40f70f
push dword [ebp - 0x34]
call fcn.00490058
pop ecx
test bl, bl
jne 0x40f72b
push dword [ebp - 0x34]
mov eax, 0x4de
call fcn.004117b8
push eax
push 0
call fcn.00444944
add esp, 0xc
mov eax, ebx
mov edx, 2
push eax
lea eax, [ebp - 0xc]
dec dword [ebp - 0x14]
call fcn.0040f80c
pop eax
mov edx, dword [ebp - 0x30]
mov dword fs:[0], edx
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret