Function at 0x408c20
Capabilities:
Resolve function by parsing pe exports

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
sub esp, 0xcc
mov eax, dword [0x4f4008]
xor eax, esp
mov dword [esp + 0xc8], eax
mov eax, dword [0x4fbe54]
push ebx
push esi
mov esi, dword [ebp + 8]
mov ebx, ecx
mov eax, dword [eax + 0x264]
mov dword [esp + 0xc], ebx
mov dword [esp + 0x24], esi
push edi
test eax, eax
je 0x409063
mov edi, dword [eax + 0x24]
imul edi, dword [eax + 0x20]
mov eax, dword [ebx + 0x18]
mov dword [ebx + 0x2c], 0
mov dword [esp + 0x2c], edi
test eax, eax
je 0x408c84
push eax
call dword [sym.imp.KERNEL32.dll_HeapDestroy]
mov dword [ebx + 0x18], 0
push 0
push 0x1000
push 0
call dword [sym.imp.KERNEL32.dll_HeapCreate]
mov dword [ebx + 0x18], eax
mov dword [esp + 0x1c], 0
mov dword [esp + 0x20], 0
test esi, esi
je 0x408d86
cmp dword [esi + 0xa8], 0
je 0x408d86
push dword [esi + 0x138]
call fcn.00412a60
mov ecx, eax
mov dword [esp + 0x18], ecx
test ecx, ecx
jne 0x408cd9
mov dword [esp + 0x1c], eax
jmp 0x408d86
mov eax, dword [ecx + 0xa8]
mov eax, dword [eax + 4]
mov ebx, dword [eax + 4]
test ebx, ebx
je 0x408d6e
nop dword [eax]
mov edi, dword [ebx + 0x14]
mov edx, edi
mov eax, dword [ebx + 0x10]
shr edx, 0x10
movzx esi, ax
cmp dx, 1
push 0
sete al
xor ecx, ecx
mov byte [esp + 0x20], al
cmp dx, 1
lea eax, [esp + 0x24]
push eax
mov eax, 0x2000
lea edx, [esp + 0x2c]
cmovne ecx, eax
movzx eax, di
or ecx, eax
shl ecx, 0x10
or ecx, esi
call fcn.0048a310
mov ecx, dword [esp + 0x2c]
add esp, 8
test ecx, ecx
je 0x408d5b
mov eax, dword [esp + 0x20]
test eax, eax
je 0x408d5b
push dword [esp + 0x1c]
mov dx, word [eax + 8]
mov cx, word [ecx + 8]
call fcn.0048a500
add esp, 4
mov dword [ebx + 0x18], eax
mov ebx, dword [ebx + 4]
test ebx, ebx
jne 0x408cf0
mov esi, dword [esp + 0x28]
mov edi, dword [esp + 0x2c]
mov ecx, dword [esp + 0x18]
mov eax, dword [ecx + 0xa4]
mov ebx, dword [esp + 0x10]
mov dword [esp + 0x20], eax
mov eax, dword [ecx + 0xa8]
mov dword [esp + 0x1c], eax
mov eax, dword [ebx + 4]
test eax, eax
je 0x408da4
push eax
push 0
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call dword [sym.imp.KERNEL32.dll_HeapFree]
mov dword [ebx + 4], 0
mov ecx, 0x9ce
call fcn.00459ad0
lea ecx, [edi + edi*8]
mov dword [esp + 0x24], eax
shl ecx, 2
push ecx
push 8
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
xor ecx, ecx
mov edx, eax
mov dword [esp + 0x18], edx
mov dword [ebx + 4], edx
mov dword [esp + 0x14], ecx
lea eax, [ecx + 9]
test esi, esi
je 0x408ea0
cmp dword [ebx + 0x1c], ecx
je 0x408ea0
mov word [esp + 0x60], ax
lea edx, [esp + 0x34]
mov eax, dword [esi + 0x1a8]
mov dword [esp + 0x68], eax
mov eax, dword [0x4fbe54]
push edx
push 0x400
push 1
mov eax, dword [eax + 0x56f84]
lea edx, [esp + 0x3c]
push edx
push 0x4bf520
mov dword [esp + 0x44], str.ScriptCall_GetSimulationFilterFlag
mov eax, dword [eax + 4]
mov ecx, dword [eax]
push ecx
mov dword [esp + 0x28], ecx
mov eax, dword [ecx]
call dword [eax + 0x14]
test eax, eax
js 0x408e7e
mov ecx, dword [esp + 0x10]
lea edx, [esp + 0x70]
push 0
push 0
push edx
lea edx, [esp + 0x4c]
mov dword [esp + 0x54], 1
push edx
push 1
push 0x800
lea eax, [esp + 0x78]
mov dword [esp + 0x64], 0
push 0x4bf520
push dword [esp + 0x50]
mov dword [esp + 0x60], eax
mov eax, dword [ecx]
push ecx
mov dword [esp + 0x68], 0
call dword [eax + 0x18]
cmp word [esp + 0x70], 3
mov ecx, 0
mov dword [ebx + 0x38], 0
mov eax, 9
cmove ecx, dword [esp + 0x78]
mov dword [esp + 0x14], ecx
jmp 0x408eab
mov dword [ebx + 0x38], ecx
test esi, esi
je 0x409087
cmp dword [ebx + 0x1c], 0
je 0x408f5e
mov word [esp + 0x80], ax
lea edx, [esp + 0x3c]
mov eax, dword [esi + 0x1a8]
mov dword [esp + 0x88], eax
mov eax, dword [0x4fbe54]
push edx
push 0x400
push 1
mov eax, dword [eax + 0x56f84]
lea edx, [esp + 0x44]
push edx
push 0x4bf520
mov dword [esp + 0x4c], str.ScriptCall_GetMoveCostArray
mov eax, dword [eax + 4]
mov ecx, dword [eax]
push ecx
mov dword [esp + 0x28], ecx
mov eax, dword [ecx]
call dword [eax + 0x14]
test eax, eax
js 0x408f54
mov ecx, dword [esp + 0x10]
lea edx, [esp + 0x90]
push 0
push 0
push edx
lea edx, [esp + 0x5c]
mov dword [esp + 0x64], 1
push edx
push 1
push 0x800
lea eax, [esp + 0x98]
mov dword [esp + 0x74], 0
push 0x4bf520
push dword [esp + 0x58]
mov dword [esp + 0x70], eax
mov eax, dword [ecx]
push ecx
mov dword [esp + 0x78], 0
call dword [eax + 0x18]
mov eax, dword [esp + 0x98]
mov dword [ebx + 0x38], eax
mov eax, dword [ebp + 0xc]
mov dword [esp + 0x10], eax
cmp eax, edi
jl 0x408f8c
cmp dword [ebx + 0x28], 0
je 0x40907a
push esi
lea eax, [esp + 0xa8]
push eax
call fcn.004153c0
mov eax, dword [esp + 0xc8]
mov dword [esp + 0x10], eax
mov ecx, dword [esp + 0x14]
mov edx, dword [esp + 0x18]
xor edi, edi
cmp dword [esp + 0x2c], edi
jle 0x409009
mov eax, dword [esp + 0x28]
lea esi, [edx + 0xc]
push ecx
push dword [esp + 0x28]
xor edx, edx
mov dword [esi - 0xc], 0x1f4
push dword [esp + 0x24]
mov ecx, ebx
mov dword [esi - 8], 0
push dword [esp + 0x2c]
mov dword [esi - 4], 0
push edi
push eax
mov dword [esi], edi
mov word [esi + 6], dx
mov dword [esi + 0xc], 0x1f4
mov dword [esi + 0x10], edx
mov dword [esi + 0x14], edx
call fcn.004090a0
mov eax, dword [esp + 0x28]
test eax, eax
je 0x408ffb
mov ecx, dword [esp + 0x10]
cmp dword [esi - 4], ecx
jle 0x408ffb
mov dword [esi - 4], 0
mov ecx, dword [esp + 0x14]
inc edi
add esi, 0x24
cmp edi, dword [esp + 0x2c]
jl 0x408fa3
mov edi, dword [esp + 0x24]
mov ecx, dword [edi + 4]
test ecx, ecx
je 0x409038
mov ecx, dword [ecx + 4]
test ecx, ecx
je 0x40902e
nop dword [eax + eax]
mov eax, dword [ecx]
mov esi, dword [ecx + 4]
call dword [eax + 0x10]
mov ecx, esi
test esi, esi
jne 0x409020
mov eax, dword [edi + 4]
mov dword [eax + 4], 0
mov ecx, dword [edi + 4]
test ecx, ecx
je 0x409044
mov eax, dword [ecx]
call dword [eax + 0x10]
push 0x30
push edi
call fcn.00495890
mov ecx, dword [ebx + 0x38]
add esp, 8
test ecx, ecx
je 0x409063
mov eax, dword [ecx]
push ecx
call dword [eax + 8]
mov dword [ebx + 0x38], 0
mov ecx, dword [esp + 0xd4]
pop edi
pop esi
pop ebx
xor ecx, esp
call fcn.00495852
mov esp, ebp
pop ebp
ret 8
mov dword [esp + 0x10], 6
jmp 0x408f8c
mov eax, dword [ebp + 0xc]
mov dword [esp + 0x10], eax
jmp 0x408f94