Function at 0x4089e2
Capabilities:
Get common file path
Resolve function by parsing pe exports
Set current directory

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
mov eax, 0x2cac
call fcn.004666e0
inc dword [0x492408]
cmp dword [0x492408], 0x30
push ebx
push esi
push edi
mov edi, ecx
mov dword [esp + 0x18], edi
jl 0x408a2e
push dword [ebp + 0x14]
push str.include_depth_exceeded.__Make_sure_there_are_no_recursive_includes
push dword [ebp + 0x18]
push dword [ebp + 0x10]
call fcn.00408214
dec dword [0x492408]
xor al, al
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 0x14
and dword [esp + 0x14], 0
lea eax, [esp + 0x38]
mov byte [esp + 0x11], 1
mov byte [esp + 0x12], 1
mov byte [esp + 0x13], 0
call fcn.0040d291
push dword [ebp + 8]
lea esi, [esp + 0x2c]
call fcn.00401983
mov eax, esi
push eax
mov eax, 0x2000
lea ecx, [esp + 0x3c]
call fcn.0040d2dd
mov bl, al
neg bl
mov ecx, esi
sbb bl, bl
call fcn.00401a04
inc bl
je 0x408aa1
push dword [ebp + 0x14]
push str.Error_opening_the_file
push dword [ebp + 0x18]
push dword [ebp + 0x10]
call fcn.00408214
xor bl, bl
lea eax, [esp + 0x38]
call fcn.0040d2bd
dec dword [0x492408]
mov al, bl
jmp 0x408a25
lea eax, [esp + 0x490]
push eax
mov esi, 0x104
push esi
call dword [sym.imp.KERNEL32.dll_GetCurrentDirectoryW]
lea eax, [esp + 0x1c]
push eax
lea eax, [esp + 0x74]
push eax
push esi
push dword [ebp + 8]
call dword [sym.imp.KERNEL32.dll_GetFullPathNameW]
lea eax, [esp + 0xab0]
push eax
lea eax, [esp + 0x8ac]
push eax
lea eax, [esp + 0x6a8]
push eax
lea eax, [esp + 0x2c]
push eax
lea eax, [esp + 0x80]
push eax
call fcn.00457a9e
add esp, 0x14
lea eax, [esp + 0x20]
push eax
lea eax, [esp + 0x284]
push eax
call fcn.004555f7
lea eax, [esp + 0x6a8]
push eax
lea eax, [esp + 0x28c]
push eax
call fcn.004555c6
add esp, 0x10
lea eax, [esp + 0x280]
push eax
call dword [sym.imp.KERNEL32.dll_SetCurrentDirectoryW]
cmp byte [esp + 0x12], 1
jne 0x408cb2
lea ebx, [esp + 0xcb8]
lea eax, [esp + 0x38]
call fcn.0040d824
test al, al
je 0x408cb2
inc dword [esp + 0x14]
mov esi, ebx
call fcn.00408833
mov eax, ebx
call fcn.00408868
test al, al
je 0x408c90
mov edi, ebx
call fcn.00408805
mov eax, edi
push eax
xor bl, bl
call fcn.00455251
mov esi, eax
pop ecx
cmp esi, 2
jle 0x408bb2
mov ax, word [esp + esi*2 + 0xcb4]
and ax, 0x7f
movzx eax, ax
push eax
call fcn.004572b5
pop ecx
test eax, eax
je 0x408bb2
lea eax, [esp + esi*2 + 0xcb6]
cmp word [eax], 0x5f
jne 0x408bb2
xor ecx, ecx
mov word [eax], cx
inc bl
cmp byte [esp + 0x13], 1
mov esi, dword [esp + 0x18]
jne 0x408c2a
cmp dword [esi + 0x10], 0
je 0x408c7b
mov eax, dword [esi + 0xc]
push dword [eax]
call fcn.00455251
mov edi, eax
pop ecx
lea eax, [esp + 0xcb8]
push eax
call fcn.00455251
pop ecx
xor ecx, ecx
push 2
lea eax, [eax + edi + 1]
pop edx
mul edx
seto cl
neg ecx
or ecx, eax
push ecx
call fcn.00455667
mov edi, eax
mov eax, dword [esi + 0xc]
pop ecx
push dword [eax]
push edi
call fcn.004555f7
lea eax, [esp + 0xcc0]
push eax
push edi
call fcn.004555c6
mov eax, dword [esi + 0xc]
push dword [eax]
call fcn.0045526c
mov eax, dword [esi + 0xc]
add esp, 0x14
mov dword [eax], edi
jmp 0x408c7b
lea eax, [esp + 0x38]
push eax
lea eax, [esp + 0x18]
push eax
lea eax, [esp + 0x78]
push eax
push esi
lea ecx, [esp + 0xcc8]
call fcn.00408cdc
test eax, eax
je 0x408c76
cmp eax, 1
jle 0x408c7b
cmp eax, 3
jle 0x408c60
cmp eax, 4
jne 0x408c7b
mov byte [esp + 0x12], 0
jmp 0x408c7b
push dword [ebp + 0xc]
lea eax, [esp + 0xcbc]
push eax
push dword [esp + 0x1c]
call fcn.004084b1
jmp 0x408c7b
mov byte [esp + 0x11], 0
cmp bl, 1
sete byte [esp + 0x13]
cmp byte [esp + 0x11], 1
je 0x408b2e
jmp 0x408cb2
mov edi, dword [esp + 0x18]
lea eax, [esp + 0xcb8]
push eax
push str.Unterminated_string
push dword [esp + 0x1c]
push dword [ebp + 0x10]
call fcn.00408214
mov byte [esp + 0x11], 0
lea esi, [esp + 0x38]
call fcn.0040db48
and dword [esp + 0x64], 0
and dword [esp + 0x68], 0
lea eax, [esp + 0x490]
push eax
call dword [sym.imp.KERNEL32.dll_SetCurrentDirectoryW]
mov bl, byte [esp + 0x11]
jmp 0x408a8e