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

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
sub esp, 0x7c
cmp dword [0xa958d4], 0xa957e4
push ebx
push esi
push edi
mov edi, dword [ebp + 8]
lea eax, [edi + 0x6ea4]
mov dword [esp + 0x18], eax
jbe 0x50284b
mov ebx, 0xa957f8
mov dword [esp + 0x20], 0
mov dword [esp + 0x54], ebx
lea ebx, [ebx]
fld dword [ebx - 4]
fld dword [ebx - 8]
fld dword [ebx]
fld st(1)
fmulp st(2)
fld st(2)
fmulp st(3)
fxch st(1)
faddp st(2)
fmul st(0), st(0)
faddp st(1)
fstp dword [esp + 0x50]
fld dword [esp + 0x50]
call fcn.004ad260
fstp dword [esp + 0x50]
movsx eax, word [ebx + 0xe]
fld dword [esp + 0x50]
movsx ecx, byte [ebx + 0x12]
fstp dword [esp + 0x14]
movzx edx, byte [ebx + 0x10]
movss xmm0, dword [ebx - 8]
movsx esi, word [ebx + 0xc]
mov dword [esp + 0x50], eax
movzx eax, byte [ebx + 0x11]
mov dword [esp + 0x74], ecx
mov ecx, dword [ebx + 4]
mov dword [esp + 0x5c], eax
lea eax, [esp + 0x78]
mov dword [esp + 0x80], ecx
mov dword [esp + 0x58], edx
mov edx, dword [ebx + 8]
push eax
mov ecx, eax
movss dword [esp + 0x7c], xmm0
movss xmm0, dword [ebx]
push ecx
mov dword [esp + 0x8c], edx
movss dword [esp + 0x84], xmm0
call sub.d3dx9_35.dll_D3DXVec2Normalize
fld dword [esp + 0x14]
call fcn.004ad260
fstp dword [esp + 0x4c]
fld dword [esp + 0x4c]
movss xmm0, dword [ebx - 0x10]
fstp dword [esp + 0x4c]
movss dword [esp + 0x28], xmm0
fld dword [esp + 0x4c]
movss xmm0, dword [ebx - 0xc]
fmul qword [0x6f9d28]
movss dword [esp + 0x24], xmm0
fstp dword [esp + 0x2c]
movss xmm0, dword [esp + 0x2c]
fld dword [esp + 0x2c]
comiss xmm0, dword [0x6b8770]
fstp dword [esp + 0x68]
movss dword [esp + 0x1c], xmm0
jbe 0x502403
fld qword [0x6f9ac8]
fld dword [esp + 0x1c]
fcompi st(1)
fstp st(0)
jbe 0x502306
movss xmm0, dword [0x6f9bdc]
movss dword [esp + 0x1c], xmm0
fld dword [esp + 0x78]
movss xmm0, dword [0x6f99f8]
fld st(0)
subss xmm0, dword [esp + 0x7c]
fld qword [0x6f9af0]
sub esp, 0x18
fmul st(1), st(0)
mov edx, dword [ebx - 0x14]
fld dword [esp + 0x40]
mov eax, dword [esp + 0x38]
faddp st(2)
fxch st(1)
fstp dword [esp + 0x4c]
fmul dword [esp + 0x94]
fadd dword [esp + 0x3c]
fstp dword [esp + 0x48]
fld dword [esp + 0x2c]
fadd qword [0x6f9bb0]
fstp dword [esp + 0x44]
fld dword [esp + 0x34]
fstp dword [esp + 0x14]
fld dword [esp + 0x44]
fstp dword [esp + 0x10]
fstp dword [esp + 0xc]
movss dword [esp + 8], xmm0
fld dword [esp + 0x48]
fldz
fsub st(1), st(0)
fxch st(1)
fstp dword [esp + 0x64]
fld dword [esp + 0x64]
fstp dword [esp + 4]
fsubr dword [esp + 0x4c]
fstp dword [esp + 0x64]
fld dword [esp + 0x64]
fstp dword [esp]
push edx
push edi
call fcn.00501fc0
fld dword [esp + 0x1c]
movss xmm0, dword [0x6f99f8]
subss xmm0, dword [esp + 0x78]
sub esp, 0x18
fstp dword [esp + 0x14]
mov eax, dword [ebx - 0x14]
fld dword [esp + 0x44]
fstp dword [esp + 0x10]
movss dword [esp + 0xc], xmm0
fld dword [esp + 0x94]
fstp dword [esp + 8]
fld dword [esp + 0x48]
fldz
fadd st(1), st(0)
fxch st(1)
fstp dword [esp + 0x64]
fld dword [esp + 0x64]
fstp dword [esp + 4]
fadd dword [esp + 0x4c]
fstp dword [esp + 0x64]
fld dword [esp + 0x64]
fstp dword [esp]
push eax
mov eax, dword [esp + 0x3c]
add eax, 1
push edi
call fcn.00501fc0
fld dword [esp + 0x80]
add dword [esp + 0x20], 2
cmp esi, dword [esp + 0x50]
fld st(0)
fld qword [0x6f9f90]
mov eax, esi
fmul st(1), st(0)
mov dword [esp + 0x2c], eax
fld dword [esp + 0x28]
faddp st(2)
fxch st(1)
fstp dword [esp + 0x28]
fld dword [esp + 0x84]
fld st(0)
fmulp st(2)
fld dword [esp + 0x24]
faddp st(2)
fxch st(1)
fstp dword [esp + 0x24]
fld st(0)
fld dword [esp + 0x24]
fld st(0)
fmulp st(2)
fxch st(1)
fstp dword [esp + 0x4c]
fld dword [esp + 0x4c]
fld st(3)
fld dword [esp + 0x28]
fld st(0)
fmulp st(2)
fxch st(1)
fstp dword [esp + 0x4c]
fld dword [esp + 0x4c]
faddp st(2)
fxch st(1)
fstp dword [esp + 0x60]
fld st(3)
fchs
fmulp st(2)
fxch st(1)
fstp dword [esp + 0x4c]
fld dword [esp + 0x4c]
fld st(2)
fmulp st(2)
fxch st(1)
fstp dword [esp + 0x4c]
fadd dword [esp + 0x4c]
fstp dword [esp + 0x64]
je 0x50282d
fld qword [0x6f9d00]
xorps xmm6, xmm6
movss xmm5, dword [0x6f99f8]
fld qword [0x6f9c68]
movss xmm2, dword [0x6cc5ec]
movss xmm3, dword [0x6f9f88]
movss xmm4, dword [0x6d54d4]
mov ebx, eax
imul ebx, ebx, 0x88
add ebx, dword [0xa6f96c]
cmp word [ebx + 0x76], 0
mov dword [esp + 0x44], ebx
jl 0x5027fd
mov ecx, dword [ebx + 0x78]
movzx eax, byte [ecx + 0x13]
mov edx, dword [esp + 0x58]
mov esi, dword [esp + 0x5c]
lea eax, [eax + edx + 1]
lea eax, [eax + eax*2]
shl eax, 4
add eax, ecx
movzx ecx, byte [ebx + 0x6c]
cmp esi, ecx
jl 0x502511
sub ecx, edx
jmp 0x502518
mov ecx, esi
sub ecx, edx
add ecx, 1
test ecx, ecx
jle 0x5027fd
add eax, 0x1c
mov dword [esp + 0x48], eax
mov dword [esp + 0x4c], ecx
mov eax, dword [eax]
test eax, eax
jl 0x5027e7
mov ecx, dword [edi + 0x46cc]
lea edx, [ecx + eax*4 - 4]
mov eax, 0xffff9158
sub eax, edi
mov dword [esp + 0x70], eax
mov eax, dword [edx + 4]
add edx, 4
mov ecx, eax
shr ecx, 8
and ecx, 0x1f
cmp ecx, 0x1f
mov dword [esp + 0x30], edx
je 0x5027db
cmp dword [edi + ecx*4 + 0x6b68], 0
je 0x5027db
mov esi, dword [edi + 0x6ea0]
imul esi, ecx
movsx ecx, word [ebx + 0x76]
shr eax, 0xd
add esi, ecx
mov ecx, dword [edi + 0x6e9c]
and eax, 0x3ff
shl eax, 4
add eax, dword [ecx + esi*8]
mov ecx, eax
fld dword [ecx + 8]
fmul st(2)
fld dword [ecx]
fmul st(3)
fld st(5)
fmul st(1)
fld st(5)
fmul st(3)
faddp st(1)
fsub dword [esp + 0x60]
fchs
fstp dword [esp + 0x34]
fmul st(4)
fld st(5)
fmulp st(2)
fsubrp st(1)
fsub dword [esp + 0x64]
fstp dword [esp + 0x14]
fldz
fld dword [esp + 0x34]
fcomi st(1)
fstp st(1)
jbe 0x5027d9
movss xmm1, dword [esp + 0x34]
movss xmm0, dword [0x6f9f84]
comiss xmm0, xmm1
jbe 0x5027d9
movss xmm0, dword [esp + 0x14]
comiss xmm6, xmm0
jbe 0x502607
movaps xmm7, xmm5
subss xmm7, xmm0
movaps xmm0, xmm7
movss dword [esp + 0x14], xmm0
movss xmm7, dword [0x6f9f80]
comiss xmm7, xmm0
jbe 0x5027d9
fld dword [esp + 0x14]
mov edi, 0x800000
fld qword [0x6f9f78]
movss dword [esp + 0x38], xmm2
fcompi st(1)
jbe 0x50263f
fld st(0)
fsubr qword [0x6f9f70]
fadd st(0), st(0)
fstp dword [esp + 0x38]
comiss xmm1, xmm3
movss dword [esp + 0x3c], xmm2
jbe 0x502658
fld st(1)
fsubr qword [0x6f9f68]
fadd st(0), st(0)
fstp dword [esp + 0x3c]
comiss xmm4, xmm1
movss dword [esp + 0x40], xmm2
jbe 0x50266f
fld st(1)
fdiv qword [0x6f9e08]
fstp dword [esp + 0x40]
fld dword [esp + 0x38]
fmul dword [esp + 0x68]
fmul dword [esp + 0x3c]
fmul dword [esp + 0x40]
fstp dword [esp + 0x34]
cvttss2si eax, dword [esp + 0x34]
mov ebx, eax
cmp ebx, 0xff
jle 0x502698
mov ebx, 0xff
mov eax, dword [esp + 0x18]
movss xmm7, dword [0x6d5a2c]
comiss xmm7, xmm0
mov dword [eax], ecx
fld dword [ecx + 0xc]
fstp dword [eax + 4]
jbe 0x50275f
fxch st(1)
fcomi st(2)
jbe 0x502763
movss xmm0, dword [0x6f9f60]
comiss xmm0, xmm1
jbe 0x502763
fld qword [0x6f9f58]
movss dword [esp + 0x10], xmm2
fxch st(2)
fcomi st(2)
fstp st(2)
jbe 0x5026f6
fld qword [0x6f9f50]
fsubrp st(2)
fxch st(1)
fdiv st(2)
fstp dword [esp + 0x10]
jmp 0x5026f8
fstp st(1)
fld qword [0x6f9f48]
fxch st(1)
fcomi st(1)
fstp st(1)
jbe 0x50272e
fsubr qword [0x6f9f40]
fdiv st(1)
fstp dword [esp + 0x14]
fld dword [esp + 0x14]
fld dword [esp + 0x10]
fcompi st(1)
fstp st(0)
jbe 0x50273e
movss xmm0, dword [esp + 0x14]
movss dword [esp + 0x10], xmm0
jmp 0x50273e
fld qword [0x6f9eb0]
fcompi st(1)
jbe 0x50273c
fsub st(1)
jmp 0x50270c
fstp st(0)
fld dword [esp + 0x10]
fmul qword [0x6f9f38]
fsubr qword [0x6f9eb8]
fstp dword [esp + 0x34]
cvttss2si eax, dword [esp + 0x34]
shl eax, 0x11
mov edi, eax
jmp 0x502767
fstp st(1)
jmp 0x502765
fstp st(0)
fstp st(0)
movss xmm0, dword [ecx + 0xc]
movss dword [esp + 0x6c], xmm0
cvttss2si eax, dword [esp + 0x6c]
mov edx, eax
mov esi, eax
and edx, 0xfffe0000
and esi, 0xff
cmp edx, edi
cmovb edi, edx
cmp esi, ebx
cmovg ebx, esi
and eax, 0x1ff00
or eax, ebx
or eax, edi
test eax, eax
mov dword [esp + 0x34], eax
fild dword [esp + 0x34]
jge 0x5027ad
fadd dword [0x6f9a18]
mov edx, dword [esp + 0x70]
fstp dword [ecx + 0xc]
mov eax, dword [esp + 0x18]
mov ebx, dword [esp + 0x44]
mov edi, dword [ebp + 8]
lea ecx, [edx + eax + 4]
mov edx, dword [esp + 0x30]
and ecx, 0xfffffff8
cmp ecx, 0xc80
jge 0x5027db
add dword [esp + 0x18], 8
jmp 0x5027db
fstp st(0)
test dword [edx], 0x80000000
jne 0x50254a
mov eax, dword [esp + 0x48]
add eax, 0x30
sub dword [esp + 0x4c], 1
mov dword [esp + 0x48], eax
jne 0x50252b
mov edx, dword [esp + 0x74]
add dword [esp + 0x2c], edx
jns 0x502813
mov eax, dword [0xa6f970]
add eax, 0xffffffff
mov dword [esp + 0x2c], eax
mov eax, dword [esp + 0x2c]
cmp eax, dword [esp + 0x50]
jne 0x5024cd
mov ebx, dword [esp + 0x54]
fstp st(3)
fstp st(1)
fstp st(0)
jmp 0x50282f
fstp st(1)
add ebx, 0x28
fstp st(0)
lea ecx, [ebx - 0x14]
cmp ecx, dword [0xa958d4]
mov dword [esp + 0x54], ebx
jb 0x502200
mov eax, dword [esp + 0x18]
sub eax, edi
sub eax, 0x6ea4
sar eax, 3
mov dword [edi + 0x7b24], eax
pop edi
pop esi
mov dword [0xa958d4], 0xa957e4
pop ebx
mov esp, ebp
pop ebp
ret 4