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

Disassembly:
sub esp, 0x5c
push ebx
push ebp
mov ebp, dword [esp + 0x74]
push esi
push edi
xor edi, edi
cmp ebp, edi
mov ebx, ecx
mov dword [esp + 0x14], edi
mov dword [esp + 0x20], edi
mov dword [esp + 0x18], edi
mov dword [esp + 0x1c], edi
mov byte [esp + 0x13], 0
je 0x4898cf
mov esi, dword [esp + 0x74]
mov eax, dword [esp + 0x78]
lea ecx, [esi + eax + 1]
push ecx
mov ecx, dword [esp + 0x74]
lea edx, [ecx + eax + 1]
sub ecx, eax
push edx
mov edx, esi
sub edx, eax
lea eax, [esp + 0x64]
dec edx
dec ecx
push edx
push ecx
push eax
call fcn.004012b0
mov eax, dword [ebx + 0x3e5]
mov ecx, dword [eax + 0x78]
mov edx, dword [eax + 0x74]
dec ecx
dec edx
push ecx
push edx
push edi
lea eax, [esp + 0x6c]
push edi
push eax
call fcn.004012b0
lea ecx, [esp + 0x74]
lea edx, [esp + 0x84]
push ecx
lea eax, [esp + 0x68]
push edx
push eax
call fcn.004011d0
add esp, 0x34
test eax, eax
je 0x489904
mov eax, dword [esp + 0x40]
mov ecx, dword [esp + 0x48]
cmp eax, ecx
mov dword [ebp], edi
mov dword [esp + 0x28], eax
jg 0x489904
mov ebp, dword [esp + 0x44]
mov edi, dword [esp + 0x3c]
sub esi, eax
mov eax, esi
mov dword [esp + 0x2c], eax
cmp edi, ebp
mov dword [esp + 0x24], edi
jg 0x48984d
mov ecx, dword [esp + 0x78]
imul eax, eax
mov esi, dword [esp + 0x70]
inc ecx
mov dword [esp + 0x30], eax
mov dword [esp + 0x38], ecx
sub esi, edi
jmp 0x489653
mov eax, dword [esp + 0x30]
mov edx, esi
imul edx, esi
add edx, eax
mov dword [esp + 0x34], edx
fild dword [esp + 0x34]
fsqrt
fadd qword [0x4f0458]
call fcn.004ecc00
cmp eax, dword [esp + 0x38]
jg 0x489837
mov edx, dword [esp + 0x28]
lea eax, [esp + 0x13]
lea ecx, [esp + 0x14]
push eax
mov eax, dword [esp + 0x28]
push ecx
mov ecx, dword [ebx + 0x3e1]
push 0
push edx
push eax
call fcn.00438a20
test al, al
je 0x48982f
mov eax, dword [esp + 0x14]
test eax, eax
je 0x48982f
push eax
mov ecx, ebx
call fcn.00489970
test al, al
je case.0x489740.5
mov ecx, ebx
call fcn.004be3d0
test al, al
je 0x4896da
mov ecx, dword [esp + 0x14]
call fcn.004be240
test al, 2
jne 0x4898b9
mov ecx, ebx
call fcn.004be3d0
test al, al
jne 0x4896f6
mov ecx, dword [esp + 0x14]
call fcn.004be240
test al, 1
jne 0x48988d
mov eax, dword [esp + 0x20]
mov ecx, dword [esp + 0x14]
test eax, eax
jne 0x489706
mov dword [esp + 0x20], ecx
mov eax, dword [esp + 0x18]
test eax, eax
jne 0x48971f
call fcn.004be3f0
mov ecx, dword [esp + 0x14]
test al, al
je 0x48971f
mov dword [esp + 0x18], ecx
mov eax, dword [esp + 0x1c]
test eax, eax
jne case.0x489740.5
xor eax, eax
mov ax, word [ecx + 0x36b]
add eax, 0xfffffffc
cmp eax, 0x23
ja case.0x489740.5
xor edx, edx
mov dl, byte [eax + 0x489918]
jmp dword [edx*4 + 0x489910]
mov dword [esp + 0x1c], ecx
mov al, byte [esp + 0x13]
test al, al
je 0x48982f
mov ecx, dword [ebx + 0x3e1]
lea eax, [esp + 0x14]
push 0
push eax
call fcn.0043a440
cmp eax, 0xffffffff
je 0x4898cf
mov ecx, dword [esp + 0x14]
test ecx, ecx
je 0x4898cf
test eax, eax
je 0x48982f
push ecx
mov ecx, ebx
call fcn.00489970
test al, al
je case.0x489818.5
mov ecx, ebx
call fcn.004be3d0
test al, al
je 0x4897b2
mov ecx, dword [esp + 0x14]
call fcn.004be240
test al, 2
jne 0x4898a3
mov ecx, ebx
call fcn.004be3d0
test al, al
jne 0x4897ce
mov ecx, dword [esp + 0x14]
call fcn.004be240
test al, 1
jne 0x4898b9
mov eax, dword [esp + 0x20]
mov ecx, dword [esp + 0x14]
test eax, eax
jne 0x4897de
mov dword [esp + 0x20], ecx
mov eax, dword [esp + 0x18]
test eax, eax
jne 0x4897f7
call fcn.004be3f0
mov ecx, dword [esp + 0x14]
test al, al
je 0x4897f7
mov dword [esp + 0x18], ecx
mov eax, dword [esp + 0x1c]
test eax, eax
jne case.0x489818.5
xor eax, eax
mov ax, word [ecx + 0x36b]
add eax, 0xfffffffc
cmp eax, 0x23
ja case.0x489818.5
xor edx, edx
mov dl, byte [eax + 0x489944]
jmp dword [edx*4 + 0x48993c]
mov dword [esp + 0x1c], ecx
mov al, byte [esp + 0x13]
test al, al
jne 0x489757
mov ebp, dword [esp + 0x44]
mov edi, dword [esp + 0x3c]
mov eax, dword [esp + 0x24]
inc eax
dec esi
cmp eax, ebp
mov dword [esp + 0x24], eax
jle 0x48964f
mov eax, dword [esp + 0x2c]
mov ecx, dword [esp + 0x28]
mov edx, dword [esp + 0x48]
inc ecx
dec eax
cmp ecx, edx
mov dword [esp + 0x28], ecx
mov dword [esp + 0x2c], eax
jle 0x48962b
mov eax, dword [esp + 0x18]
test eax, eax
jne 0x4898fe
mov eax, dword [esp + 0x1c]
test eax, eax
je 0x4898f6
mov ecx, dword [esp + 0x7c]
pop edi
pop esi
pop ebp
mov dword [ecx], eax
mov al, 1
pop ebx
add esp, 0x5c
ret 0x10
mov eax, dword [esp + 0x7c]
mov edx, dword [esp + 0x14]
pop edi
pop esi
mov dword [eax], edx
pop ebp
mov al, 1
pop ebx
add esp, 0x5c
ret 0x10
mov edx, dword [esp + 0x7c]
mov ecx, dword [esp + 0x14]
pop edi
pop esi
pop ebp
mov dword [edx], ecx
mov al, 1
pop ebx
add esp, 0x5c
ret 0x10
mov ecx, dword [esp + 0x7c]
mov eax, dword [esp + 0x14]
pop edi
pop esi
mov dword [ecx], eax
pop ebp
mov al, 1
pop ebx
add esp, 0x5c
ret 0x10
add ebx, 4
push str.GetSuitableUnit__:_Error_occurs.
push ebx
mov dword [0x8210d4], 1
call fcn.004331c0
add esp, 8
xor al, al
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x5c
ret 0x10
mov eax, dword [esp + 0x20]
test eax, eax
je 0x489904
mov edx, dword [esp + 0x7c]
mov dword [edx], eax
pop edi
pop esi
pop ebp
mov al, 1
pop ebx
add esp, 0x5c
ret 0x10