Function at 0x408790
Capabilities:
Check if file exists
Get common file path

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
sub esp, 0x784
mov eax, dword [0x42a040]
xor eax, esp
mov dword [esp + 0x780], eax
push ebx
push esi
push edi
push 0x208
lea eax, [esp + 0x584]
mov ebx, ecx
push 0
push eax
call fcn.00412cc0
add esp, 0xc
lea ecx, [esp + 0x580]
call fcn.00401970
lea eax, [ebx + 0x62e]
push eax
lea eax, [esp + 0x584]
push eax
call dword [sym.imp.SHLWAPI.dll_PathAppendW]
lea ecx, [esp + 0x580]
lea edx, [ecx + 2]
mov ax, word [ecx]
add ecx, 2
test ax, ax
jne 0x4087f1
sub ecx, edx
lea eax, [ebx + 0x6e4]
sar ecx, 1
push ecx
lea ecx, [esp + 0x584]
mov dword [esp + 0x14], eax
push ecx
mov ecx, eax
call fcn.00401dd0
lea esi, [ebx + 0x578]
mov ecx, 0x53
lea edi, [esp + 0x18]
rep movsd dword es:[edi], dword [esi]
movsw word es:[edi], word [esi]
mov eax, dword [esp + 0x1a]
and eax, 1
or eax, 0
je 0x408846
xor eax, eax
cmp word [esp + 0x46], ax
setne al
inc eax
jmp 0x408848
xor eax, eax
push 0x564
mov dword [ebx + 0x6c8], eax
lea eax, [esp + 0x1c]
push 0
push eax
call fcn.00412cc0
lea edi, [ebx + 0x6e4]
add esp, 0xc
cmp dword [edi + 0x14], 7
mov ecx, edi
jbe 0x408872
mov ecx, dword [edi]
lea edx, [esp + 0x18]
call fcn.00405dd0
movzx eax, word [esp + 0xd2]
mov ecx, 0x2800000
shl eax, 0x14
test eax, eax
cmove eax, ecx
cmp dword [ebx + 0x6c8], 1
je 0x4088ae
movzx eax, word [esp + 0xde]
mov ecx, 0x5000000
shl eax, 0x14
test eax, eax
cmove eax, ecx
lea ecx, [ebx + 0xc]
add eax, 0x200000
lea esi, [ebx + 8]
mov dword [esp + 0xc], ecx
mov dword [ebx + 0x904], eax
lea eax, [ebx + 0x6fc]
push eax
push 0x104
call dword [sym.imp.KERNEL32.dll_GetTempPathW]
push str.Iime_imc.map
lea eax, [ebx + 0x6fc]
push eax
call dword [sym.imp.SHLWAPI.dll_PathAppendW]
mov eax, dword [esp + 0xc]
mov dword [esp + 0xc], eax
lea eax, [ebx + 0x6fc]
push eax
call dword [sym.imp.SHLWAPI.dll_PathFileExistsW]
test eax, eax
je 0x408915
lea ecx, [ebx + 0x6fc]
call fcn.00401b50
lea eax, [ebx + 0xc]
lea esi, [ebx + 8]
mov dword [esp + 0xc], eax
push 0
push 2
push 2
push 0
push 0
push 0xc0000000
lea eax, [ebx + 0x6fc]
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov dword [ebx + 4], eax
cmp eax, 0xffffffff
je 0x408a0a
push str.Iime_Trie_Codetable
push dword [ebx + 0x904]
push 0
push 4
push 0
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileMappingW]
mov dword [esi], eax
test eax, eax
jne 0x408970
push dword [ebx + 4]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov dword [ebx + 4], 0xffffffff
jmp 0x408a0a
push 0
push 0
push 0
push 0xf001f
push eax
call dword [sym.imp.KERNEL32.dll_MapViewOfFile]
mov ecx, dword [esp + 0xc]
mov dword [ecx], eax
test eax, eax
jne 0x40899c
push dword [esi]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov dword [esi], 0
jmp 0x40895b
cmp dword [edi + 0x14], 7
mov eax, edi
jbe 0x4089a6
mov eax, dword [edi]
push 0
push eax
mov ecx, ebx
call fcn.0040add0
test eax, eax
je 0x408a0a
mov eax, dword [ebx + 0x6c8]
test eax, eax
je 0x4089c7
cmp eax, 2
jne 0x408ae8
push 0x208
lea eax, [esp + 0x1c]
push 0
push eax
call fcn.00412cc0
add esp, 0xc
lea ecx, [esp + 0x18]
call fcn.00401970
push str.Iime.pyc
lea eax, [esp + 0x1c]
push eax
call dword [sym.imp.SHLWAPI.dll_PathAppendW]
push 1
lea eax, [esp + 0x1c]
mov ecx, ebx
push eax
call fcn.0040add0
test eax, eax
jne 0x408ae8
mov eax, dword [esp + 0xc]
cmp dword [eax], 0
je 0x408b6f
cmp dword [esi], 0
je 0x408b6f
cmp dword [ebx + 4], 0xffffffff
je 0x408b6f
mov eax, dword [ebx + 0x90c]
mov ecx, dword [ebx + 0x904]
mov dword [esp + 0x14], ecx
cmp eax, dword [ebx + 0x908]
jb 0x408a53
imul ecx, ecx, 0x19
mov eax, 0x51eb851f
mul ecx
shr edx, 5
add dword [esp + 0x14], edx
mov eax, dword [ebx + 0x10]
test eax, eax
je 0x408a6f
push 0x8000
push 0
push eax
call dword [sym.imp.KERNEL32.dll_VirtualFree]
mov dword [ebx + 0x10], 0
mov eax, dword [esp + 0xc]
mov eax, dword [eax]
test eax, eax
je 0x408a90
push eax
call dword [sym.imp.KERNEL32.dll_UnmapViewOfFile]
mov eax, dword [esp + 0xc]
mov dword [ebx], 0
mov dword [eax], 0
mov eax, dword [esi]
test eax, eax
je 0x408aa3
push eax
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov dword [esi], 0
mov eax, dword [ebx + 4]
cmp eax, 0xffffffff
je 0x408ad5
push eax
call dword [sym.imp.KERNEL32.dll_CloseHandle]
lea eax, [ebx + 0x6fc]
mov dword [ebx + 4], 0
push eax
call dword [sym.imp.SHLWAPI.dll_PathFileExistsW]
test eax, eax
je 0x408ad5
lea ecx, [ebx + 0x6fc]
call fcn.00401b50
mov eax, dword [esp + 0x14]
mov dword [ebx + 0x90c], 0
jmp 0x4088bd
mov eax, dword [ebx + 0x90c]
mov dword [ebx + 0xd4], eax
shr eax, 0x14
add eax, 2
cmp dword [ebx + 0x6c8], 1
jne 0x408b15
cmp word [ebx + 0xce], ax
je 0x408b55
mov word [ebx + 0xce], ax
jmp 0x408b25
cmp word [ebx + 0xda], ax
je 0x408b55
mov word [ebx + 0xda], ax
cmp dword [edi + 0x14], 7
jbe 0x408b31
mov edi, dword [edi]
mov dword [esp + 0x10], edi
sub esp, 0x564
lea esi, [ebx + 0x14]
mov ecx, 0x159
mov edi, esp
rep movsd dword es:[edi], dword [esi]
mov ecx, dword [esp + 0x574]
call fcn.00405e60
add esp, 0x564
mov eax, 1
pop edi
pop esi
pop ebx
mov ecx, dword [esp + 0x780]
xor ecx, esp
call fcn.004113fe
mov esp, ebp
pop ebp
ret
mov eax, dword [ebx + 0x10]
test eax, eax
je 0x408b8b
push 0x8000
push 0
push eax
call dword [sym.imp.KERNEL32.dll_VirtualFree]
mov dword [ebx + 0x10], 0
mov edi, dword [esp + 0xc]
mov eax, dword [edi]
test eax, eax
je 0x408ba8
push eax
call dword [sym.imp.KERNEL32.dll_UnmapViewOfFile]
mov dword [edi], 0
mov dword [ebx], 0
mov eax, dword [esi]
mov edi, dword [sym.imp.KERNEL32.dll_CloseHandle]
test eax, eax
je 0x408bbd
push eax
call edi
mov dword [esi], 0
mov eax, dword [ebx + 4]
cmp eax, 0xffffffff
je 0x408be7
push eax
call edi
lea esi, [ebx + 0x6fc]
mov dword [ebx + 4], 0
push esi
call dword [sym.imp.SHLWAPI.dll_PathFileExistsW]
test eax, eax
je 0x408be7
mov ecx, esi
call fcn.00401b50
mov ecx, dword [esp + 0x78c]
xor eax, eax
pop edi
pop esi
mov dword [ebx + 0x904], 0
mov dword [ebx + 0x90c], 0
pop ebx
xor ecx, esp
call fcn.004113fe
mov esp, ebp
pop ebp
ret