Function at 0x4089ec
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.004664c0
inc dword [0x4923c8]
cmp dword [0x4923c8], 0x30
push ebx
push esi
push edi
mov edi, ecx
mov dword [esp + 0x18], edi
jl 0x408a38
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.0040821e
dec dword [0x4923c8]
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.0040d2b9
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.0040d305
mov bl, al
neg bl
mov ecx, esi
sbb bl, bl
call fcn.00401a04
inc bl
je 0x408aab
push dword [ebp + 0x14]
push str.Error_opening_the_file
push dword [ebp + 0x18]
push dword [ebp + 0x10]
call fcn.0040821e
xor bl, bl
lea eax, [esp + 0x38]
call fcn.0040d2e5
dec dword [0x4923c8]
mov al, bl
jmp 0x408a2f
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.0045787e
add esp, 0x14
lea eax, [esp + 0x20]
push eax
lea eax, [esp + 0x284]
push eax
call fcn.004553d7
lea eax, [esp + 0x6a8]
push eax
lea eax, [esp + 0x28c]
push eax
call fcn.004553a6
add esp, 0x10
lea eax, [esp + 0x280]
push eax
call dword [sym.imp.KERNEL32.dll_SetCurrentDirectoryW]
cmp byte [esp + 0x12], 1
jne 0x408cbc
lea ebx, [esp + 0xcb8]
lea eax, [esp + 0x38]
call fcn.0040d84c
test al, al
je 0x408cbc
inc dword [esp + 0x14]
mov esi, ebx
call fcn.0040883d
mov eax, ebx
call fcn.00408872
test al, al
je 0x408c9a
mov edi, ebx
call fcn.0040880f
mov eax, edi
push eax
xor bl, bl
call fcn.00455031
mov esi, eax
pop ecx
cmp esi, 2
jle 0x408bbc
mov ax, word [esp + esi*2 + 0xcb4]
and ax, 0x7f
movzx eax, ax
push eax
call fcn.00457095
pop ecx
test eax, eax
je 0x408bbc
lea eax, [esp + esi*2 + 0xcb6]
cmp word [eax], 0x5f
jne 0x408bbc
xor ecx, ecx
mov word [eax], cx
inc bl
cmp byte [esp + 0x13], 1
mov esi, dword [esp + 0x18]
jne 0x408c34
cmp dword [esi + 0x10], 0
je 0x408c85
mov eax, dword [esi + 0xc]
push dword [eax]
call fcn.00455031
mov edi, eax
pop ecx
lea eax, [esp + 0xcb8]
push eax
call fcn.00455031
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.00455447
mov edi, eax
mov eax, dword [esi + 0xc]
pop ecx
push dword [eax]
push edi
call fcn.004553d7
lea eax, [esp + 0xcc0]
push eax
push edi
call fcn.004553a6
mov eax, dword [esi + 0xc]
push dword [eax]
call fcn.0045504c
mov eax, dword [esi + 0xc]
add esp, 0x14
mov dword [eax], edi
jmp 0x408c85
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.00408ce6
test eax, eax
je 0x408c80
cmp eax, 1
jle 0x408c85
cmp eax, 3
jle 0x408c6a
cmp eax, 4
jne 0x408c85
mov byte [esp + 0x12], 0
jmp 0x408c85
push dword [ebp + 0xc]
lea eax, [esp + 0xcbc]
push eax
push dword [esp + 0x1c]
call fcn.004084bb
jmp 0x408c85
mov byte [esp + 0x11], 0
cmp bl, 1
sete byte [esp + 0x13]
cmp byte [esp + 0x11], 1
je 0x408b38
jmp 0x408cbc
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.0040821e
mov byte [esp + 0x11], 0
lea esi, [esp + 0x38]
call fcn.0040db70
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 0x408a98