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

Disassembly:
push ebp
mov ebp, esp
and esp, 0xffffffc0
push 0xffffffffffffffff
push 0x6540c7
mov eax, dword fs:[0]
push eax
sub esp, 0x34
mov eax, 0x4bb8
call fcn.0062ab60
push esi
push edi
mov eax, dword [0x6af168]
xor eax, esp
push eax
lea eax, [esp + 0x4bf8]
mov dword fs:[0], eax
mov esi, dword [ebp + 0x10]
mov edi, dword [ebp + 8]
fld1
fcom dword [ebx + 0x34]
fnstsw ax
test ah, 1
jne 0x505c2f
fcom dword [ebx + 0x38]
fnstsw ax
test ah, 1
jne 0x505c2f
mov eax, dword [ebx + 4]
fstp st(0)
test eax, eax
je 0x5058cc
mov ecx, dword [ebx + 8]
sub ecx, eax
mov eax, 0x2aaaaaab
imul ecx
sar edx, 1
mov eax, edx
shr eax, 0x1f
add eax, edx
jne 0x5058d1
call fcn.0062492b
mov eax, dword [ebx + 4]
mov edx, dword [eax]
mov ecx, dword [edi]
mov eax, dword [ecx + 0x8c]
push edx
push 0
push edi
call eax
push eax
mov edi, str.SetTexture_gTexture
call fcn.00502b30
xor eax, eax
add esp, 4
cmp esi, eax
mov dword [esp + 0xc], eax
mov dword [esp + 0x14], eax
jle 0x50632a
mov ecx, dword [ebp + 0xc]
fld dword [ebp + 0x1c]
fld dword [ebp + 0x18]
add ecx, 0x10
fldz
mov dword [esp + 0x10], ecx
jmp 0x505924
fld dword [ebp + 0x18]
fldz
fld dword [ebp + 0x1c]
fxch st(2)
fxch st(1)
mov eax, dword [esp + 0xc]
lea esi, [eax + eax*2]
add eax, 1
mov dword [esp + 0xc], eax
mov eax, dword [esp + 0x10]
fld dword [eax - 0x10]
mov ecx, dword [eax]
fadd st(2)
shl esi, 5
lea esi, [esp + esi + 0x2644]
xor edi, edi
cmp ecx, edi
fstp dword [esi]
fld dword [eax - 0xc]
fadd st(3)
fstp dword [esi + 4]
fst dword [esi + 8]
fld1
fst dword [esi + 0xc]
jne 0x505962
mov ecx, dword [ebp + 0x14]
fld dword [eax - 8]
mov dword [esi + 0x10], ecx
fmul dword [ebx + 0x34]
lea ecx, [esi + 0x20]
mov dword [esp + 0x24], ecx
mov dword [esi + 0x14], edi
fstp dword [esi + 0x18]
fld dword [eax - 4]
fmul dword [ebx + 0x38]
fstp dword [esi + 0x1c]
fld dword [eax + 4]
fadd st(3)
fstp dword [ecx]
mov ecx, dword [eax + 0x14]
cmp ecx, edi
fld dword [eax + 8]
fadd st(4)
fstp dword [esi + 0x24]
fxch st(1)
fst dword [esi + 0x28]
fxch st(1)
fst dword [esi + 0x2c]
jne 0x5059a4
mov ecx, dword [ebp + 0x14]
fld dword [eax + 0xc]
lea edx, [esi + 0x40]
fmul dword [ebx + 0x34]
mov dword [esi + 0x30], ecx
mov ecx, dword [eax + 0x28]
cmp ecx, edi
fstp dword [esi + 0x38]
mov dword [esi + 0x34], edi
fld dword [eax + 0x10]
fmul dword [ebx + 0x38]
fstp dword [esi + 0x3c]
fld dword [eax + 0x18]
faddp st(3)
fxch st(2)
fstp dword [edx]
fld dword [eax + 0x1c]
faddp st(3)
fxch st(2)
fstp dword [esi + 0x44]
fxch st(1)
fstp dword [esi + 0x48]
fstp dword [esi + 0x4c]
jne 0x5059e4
mov ecx, dword [ebp + 0x14]
cmp dword [ebp + 0x20], edi
fld dword [eax + 0x20]
fmul dword [ebx + 0x34]
mov dword [esi + 0x50], ecx
mov dword [esi + 0x54], edi
fstp dword [esi + 0x58]
fld dword [eax + 0x24]
fmul dword [ebx + 0x38]
fstp dword [esi + 0x5c]
je 0x505bb2
lea eax, [esp + 0xd24]
mov dword [esp + 0x19a4], eax
mov eax, 0x64
mov dword [esp + 0x19ac], eax
xor ecx, ecx
mov dword [esp + 0x4c00], ecx
lea edi, [esp + 0x94]
mov dword [esp + 0xd14], edi
mov dword [esp + 0xd18], ecx
mov dword [esp + 0xd1c], eax
mov byte [esp + 0x4c00], 1
mov ecx, 8
lea edi, [esp + 0xd24]
rep movsd dword es:[edi], dword [esi]
mov esi, dword [esp + 0x24]
mov ecx, 8
lea edi, [esp + 0xd44]
rep movsd dword es:[edi], dword [esi]
mov esi, edx
mov edx, dword [ebp + 0x20]
mov ecx, 8
lea edi, [esp + 0xd64]
rep movsd dword es:[edi], dword [esi]
lea ecx, [esp + 0x94]
push ecx
push 4
lea ecx, [esp + 0xd2c]
mov dword [esp + 0x19b0], 3
call fcn.00504e30
mov ecx, dword [esp + 0xd20]
mov eax, 0x55555556
imul ecx
mov eax, edx
shr eax, 0x1f
add esp, 8
add eax, edx
je 0x505b71
sub dword [esp + 0xc], 1
test eax, eax
jle 0x505b71
mov edx, dword [esp + 0xd14]
add edx, 0x40
mov dword [esp + 0x20], edx
mov dword [esp + 0x18], eax
lea ecx, [ecx]
mov ecx, dword [esp + 0xc]
lea eax, [ecx + ecx*2]
add ecx, 1
mov dword [esp + 0xc], ecx
shl eax, 5
cmp dword [esp + 0xc], 0x64
lea eax, [esp + eax + 0x2644]
lea esi, [edx - 0x40]
mov ecx, 8
mov edi, eax
rep movsd dword es:[edi], dword [esi]
lea esi, [edx - 0x20]
lea edi, [eax + 0x20]
mov ecx, 8
rep movsd dword es:[edi], dword [esi]
lea edi, [eax + 0x40]
mov ecx, 8
mov esi, edx
rep movsd dword es:[edi], dword [esi]
jne 0x505b5f
mov eax, dword [ebp + 8]
mov edx, dword [eax]
mov edx, dword [edx + 0x64]
push 0
push 0x12c
lea ecx, [esp + 0x264c]
push ecx
push 0x1c4
push 4
push eax
call edx
push eax
mov edi, str.DrawPrimitive__TriList_clipped_
call fcn.00502b30
mov edx, dword [esp + 0x24]
add esp, 4
mov dword [esp + 0xc], 0
add edx, 0x60
sub dword [esp + 0x18], 1
mov dword [esp + 0x20], edx
jne 0x505ae0
mov eax, dword [esp + 0xd14]
lea ecx, [esp + 0x94]
cmp eax, ecx
je 0x505b8c
push eax
call fcn.0062493b
add esp, 4
mov dword [esp + 0x4c00], 0xffffffff
mov eax, dword [esp + 0x19a4]
lea edx, [esp + 0xd24]
cmp eax, edx
je 0x505bb2
push eax
call fcn.0062493b
add esp, 4
cmp dword [esp + 0xc], 0x64
je 0x505bc5
mov eax, dword [ebp + 0x10]
add eax, 0xffffffff
cmp dword [esp + 0x14], eax
jne 0x505bff
mov eax, dword [esp + 0xc]
mov ecx, dword [ebp + 8]
mov edx, dword [ecx]
push 0
lea eax, [eax + eax*2]
push eax
lea eax, [esp + 0x264c]
push eax
push 0x1c4
push 4
push ecx
mov ecx, dword [edx + 0x64]
call ecx
push eax
mov edi, str.DrawPrimitive__TriList_
call fcn.00502b30
add esp, 4
mov dword [esp + 0xc], 0
mov eax, dword [esp + 0x14]
add dword [esp + 0x10], 0x3c
add eax, 1
cmp eax, dword [ebp + 0x10]
mov dword [esp + 0x14], eax
jl 0x505918
mov ecx, dword [esp + 0x4bf8]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
mov esp, ebp
pop ebp
ret 0x1c
test esi, esi
jle 0x506328
mov edx, dword [ebp + 0xc]
fld dword [ebp + 0x1c]
fld dword [ebp + 0x18]
add edx, 0x10
fldz
mov dword [esp + 0x20], edx
mov dword [esp + 0x24], esi
jmp 0x505c5e
fldz
fld1
fld dword [ebp + 0x18]
fld dword [ebp + 0x1c]
fxch st(2)
fxch st(3)
mov eax, dword [esp + 0x20]
fld dword [eax - 0x10]
mov ecx, dword [eax]
mov esi, dword [ebp + 0x14]
fadd st(2)
xor edx, edx
cmp ecx, edx
fstp dword [esp + 0x34]
mov dword [esp + 0x44], ecx
fld dword [eax - 0xc]
fadd st(3)
fstp dword [esp + 0x38]
fst dword [esp + 0x3c]
fxch st(3)
fst dword [esp + 0x40]
jne 0x505c91
mov dword [esp + 0x44], esi
fld dword [eax - 8]
mov ecx, dword [eax + 0x14]
cmp ecx, edx
fmul dword [ebx + 0x34]
mov dword [esp + 0x48], edx
mov dword [esp + 0x64], ecx
fstp dword [esp + 0x4c]
fld dword [eax - 4]
fmul dword [ebx + 0x38]
fstp dword [esp + 0x50]
fld dword [eax + 4]
fadd st(2)
fstp dword [esp + 0x54]
fld dword [eax + 8]
fadd st(3)
fstp dword [esp + 0x58]
fxch st(3)
fst dword [esp + 0x5c]
fxch st(3)
fst dword [esp + 0x60]
jne 0x505cd6
mov dword [esp + 0x64], esi
fld dword [eax + 0xc]
mov ecx, dword [eax + 0x28]
cmp ecx, edx
fmul dword [ebx + 0x34]
mov dword [esp + 0x68], edx
mov dword [esp + 0x84], ecx
fstp dword [esp + 0x6c]
fld dword [eax + 0x10]
fmul dword [ebx + 0x38]
fstp dword [esp + 0x70]
fld dword [eax + 0x18]
faddp st(2)
fxch st(1)
fstp dword [esp + 0x74]
fld dword [eax + 0x1c]
faddp st(2)
fxch st(1)
fstp dword [esp + 0x78]
fxch st(1)
fst dword [esp + 0x7c]
fxch st(1)
fstp dword [esp + 0x80]
jne 0x505d28
mov dword [esp + 0x84], esi
fld dword [eax + 0x20]
mov dword [esp + 0x88], edx
fmul dword [ebx + 0x34]
fstp dword [esp + 0x8c]
fld dword [eax + 0x24]
fmul dword [ebx + 0x38]
fstp dword [esp + 0x90]
fld dword [ebx + 0x34]
fstp dword [esp + 0xc]
fld dword [ebx + 0x38]
fstp dword [esp + 0x18]
fst dword [esp + 0x10]
fst dword [esp + 0x14]
fld dword [esp + 0x4c]
fld dword [esp + 0xc]
fcomp st(1)
fnstsw ax
test ah, 0x41
jne 0x505d74
fst dword [esp + 0xc]
fld dword [esp + 0x50]
fld dword [esp + 0x18]
fcomp st(1)
fnstsw ax
test ah, 0x41
jne 0x505d89
fst dword [esp + 0x18]
fxch st(1)
fcom st(2)
fnstsw ax
test ah, 0x41
jne 0x505d9a
fstp dword [esp + 0x10]
jmp 0x505d9c
fstp st(0)
fcom st(1)
fnstsw ax
fstp st(1)
test ah, 0x41
jne 0x505dad
fstp dword [esp + 0x14]
jmp 0x505daf
fstp st(0)
fld dword [esp + 0x6c]
fld dword [esp + 0xc]
fcomp st(1)
fnstsw ax
test ah, 0x41
jne 0x505dc4
fst dword [esp + 0xc]
fld dword [esp + 0x70]
fld dword [esp + 0x18]
fcomp st(1)
fnstsw ax
test ah, 0x41
jne 0x505dd9
fst dword [esp + 0x18]
fld dword [esp + 0x10]
fcomp st(2)
fnstsw ax
test ah, 5
jp 0x505dee
fxch st(1)
fstp dword [esp + 0x10]
jmp 0x505df0
fstp st(1)
fld dword [esp + 0x14]
fcomp st(1)
fnstsw ax
test ah, 5
jp 0x505e03
fstp dword [esp + 0x14]
jmp 0x505e05
fstp st(0)
fld dword [esp + 0x8c]
fld dword [esp + 0xc]
fcomp st(1)
fnstsw ax
test ah, 0x41
jne 0x505e1d
fst dword [esp + 0xc]
fld dword [esp + 0x90]
fld dword [esp + 0x18]
fcomp st(1)
fnstsw ax
test ah, 0x41
jne 0x505e35
fst dword [esp + 0x18]
fld dword [esp + 0x10]
fcomp st(2)
fnstsw ax
test ah, 5
jp 0x505e4a
fxch st(1)
fstp dword [esp + 0x10]
jmp 0x505e4c
fstp st(1)
fld dword [esp + 0x14]
fcomp st(1)
fnstsw ax
test ah, 5
jp 0x505e5f
fstp dword [esp + 0x14]
jmp 0x505e61
fstp st(0)
lea eax, [esp + 0xd24]
mov dword [esp + 0x19a4], eax
mov eax, 0x64
mov dword [esp + 0x19ac], eax
mov dword [esp + 0x4c00], 2
mov ecx, 8
lea esi, [esp + 0x34]
lea edi, [esp + 0xd24]
rep movsd dword es:[edi], dword [esi]
mov ecx, 8
lea esi, [esp + 0x54]
lea edi, [esp + 0xd44]
rep movsd dword es:[edi], dword [esi]
mov ecx, 8
lea esi, [esp + 0x74]
lea edi, [esp + 0xd64]
rep movsd dword es:[edi], dword [esi]
lea ecx, [esp + 0x19b4]
mov dword [esp + 0x19a8], 3
mov dword [esp + 0x2634], ecx
mov dword [esp + 0x2638], 0
mov dword [esp + 0x263c], eax
sub esp, 8
fld dword [esp + 0x14]
mov byte [esp + 0x4c08], 3
fstp qword [esp]
call fcn.00645050
fstp dword [esp + 0x24]
fld dword [esp + 0x24]
call fcn.0062a660
fld dword [esp + 0x20]
mov edi, eax
fstp qword [esp]
mov dword [esp + 0x34], edi
call fcn.00645050
fstp dword [esp + 0x24]
fld dword [esp + 0x24]
call fcn.0062a660
fld dword [esp + 0x18]
fstp qword [esp]
mov esi, eax
call fcn.00624b10
fstp dword [esp + 0x24]
fld dword [esp + 0x24]
call fcn.0062a660
fld dword [esp + 0x1c]
fstp qword [esp]
mov dword [esp + 0x20], eax
call fcn.00624b10
fstp dword [esp + 0x24]
fld dword [esp + 0x24]
add esp, 8
call fcn.0062a660
test edi, edi
mov dword [esp + 0xc], eax
jge 0x505f75
mov dword [esp + 0x2c], 0
test esi, esi
jge 0x505f7b
xor esi, esi
mov eax, dword [ebx + 0x1c]
cmp dword [esp + 0x18], eax
jle 0x505f88
mov dword [esp + 0x18], eax
mov eax, dword [ebx + 0x20]
mov edi, dword [esp + 0xc]
cmp edi, eax
jle 0x505f99
mov edi, eax
mov dword [esp + 0xc], edi
mov eax, dword [ebx + 4]
test eax, eax
je 0x505fb7
mov ecx, dword [ebx + 8]
sub ecx, eax
mov eax, 0x2aaaaaab
imul ecx
sar edx, 1
mov eax, edx
shr eax, 0x1f
add eax, edx
jne 0x505fbc
call fcn.0062492b
cmp esi, edi
mov ecx, dword [ebx + 4]
mov dword [esp + 0x1c], ecx
mov dword [esp + 0x10], esi
jge 0x5062c0
nop
mov eax, dword [esp + 0x2c]
cmp eax, dword [esp + 0x18]
mov dword [esp + 0x14], eax
jge 0x5062ab
fild dword [esp + 0x10]
fstp dword [esp + 0x28]
lea ebx, [ebx]
mov esi, dword [ebx + 0x1c]
imul esi, dword [esp + 0x10]
mov eax, dword [ebx + 4]
add esi, dword [esp + 0x14]
test eax, eax
je 0x50601c
mov ecx, dword [ebx + 8]
sub ecx, eax
mov eax, 0x2aaaaaab
imul ecx
sar edx, 1
mov eax, edx
shr eax, 0x1f
add eax, edx
cmp esi, eax
jb 0x506021
call fcn.0062492b
mov eax, dword [ebx + 4]
mov edi, dword [esp + 0x19a8]
cmp edi, 0x64
lea edx, [esi + esi*2]
lea esi, [eax + edx*4]
lea ecx, [esp + 0x94]
mov eax, edi
mov dword [esp + 0xd14], ecx
mov dword [esp + 0xd18], eax
mov dword [esp + 0xd1c], 0x64
jle 0x5060c1
xor ecx, ecx
mov edx, 0x20
mul edx
seto cl
mov dword [esp + 0xd1c], edi
neg ecx
or ecx, eax
push ecx
call fcn.00613caa
mov ecx, dword [esp + 0xd18]
mov edi, eax
mov eax, dword [esp + 0xd1c]
add esp, 4
shl eax, 5
push eax
push ecx
push edi
call fcn.0062a790
mov eax, dword [esp + 0xd20]
lea edx, [esp + 0xa0]
add esp, 0xc
cmp eax, edx
je 0x5060b1
push eax
call fcn.0062493b
add esp, 4
mov eax, dword [esp + 0xd18]
mov ecx, edi
mov dword [esp + 0xd14], ecx
shl eax, 5
push eax
mov eax, dword [esp + 0x19a8]
push eax
push ecx
call fcn.0062a790
add esp, 0xc
fild dword [esp + 0x14]
mov byte [esp + 0x4c00], 4
mov eax, dword [esp + 0xd14]
fstp dword [esp + 0x30]
mov edx, dword [esp + 0x10]
fld dword [eax + 0x18]
fld dword [esp + 0x30]
fld st(0)
fsubp st(2)
fxch st(1)
fstp dword [eax + 0x18]
mov eax, dword [esp + 0xd14]
fld dword [eax + 0x1c]
fld dword [esp + 0x28]
fld st(0)
fsubp st(2)
fxch st(1)
fstp dword [eax + 0x1c]
mov ecx, dword [ebx + 0x20]
sub ecx, 1
cmp edx, ecx
mov ecx, dword [esp + 0x1c]
jne 0x506139
fild dword [ecx + 8]
mov eax, dword [esp + 0xd14]
fidiv dword [esi + 8]
fmul dword [eax + 0x1c]
fstp dword [eax + 0x1c]
mov eax, dword [ebx + 0x1c]
mov edi, dword [esp + 0x14]
sub eax, 1
cmp edi, eax
jne 0x50615a
fild dword [ecx + 4]
mov eax, dword [esp + 0xd14]
fidiv dword [esi + 4]
fmul dword [eax + 0x18]
fstp dword [eax + 0x18]
mov eax, dword [esp + 0xd14]
fld dword [eax + 0x38]
fsub st(2)
fstp dword [eax + 0x38]
mov eax, dword [esp + 0xd14]
fld dword [eax + 0x3c]
fsub st(1)
fstp dword [eax + 0x3c]
mov eax, dword [ebx + 0x20]
sub eax, 1
cmp edx, eax
jne 0x506195
fild dword [ecx + 8]
mov eax, dword [esp + 0xd14]
fidiv dword [esi + 8]
fmul dword [eax + 0x3c]
fstp dword [eax + 0x3c]
mov eax, dword [ebx + 0x1c]
sub eax, 1
cmp edi, eax
jne 0x5061b2
fild dword [ecx + 4]
mov eax, dword [esp + 0xd14]
fidiv dword [esi + 4]
fmul dword [eax + 0x38]
fstp dword [eax + 0x38]
mov eax, dword [esp + 0xd14]
fld dword [eax + 0x58]
fsubrp st(2)
fxch st(1)
fstp dword [eax + 0x58]
mov eax, dword [esp + 0xd14]
fsubr dword [eax + 0x5c]
fstp dword [eax + 0x5c]
mov eax, dword [ebx + 0x20]
sub eax, 1
cmp edx, eax
jne 0x5061ed
fild dword [ecx + 8]
mov eax, dword [esp + 0xd14]
fidiv dword [esi + 8]
fmul dword [eax + 0x5c]
fstp dword [eax + 0x5c]
mov edx, dword [ebx + 0x1c]
sub edx, 1
cmp edi, edx
jne 0x50620a
fild dword [ecx + 4]
mov eax, dword [esp + 0xd14]
fidiv dword [esi + 4]
fmul dword [eax + 0x58]
fstp dword [eax + 0x58]
lea edi, [esp + 0x94]
call fcn.005051d0
cmp dword [esp + 0xd18], 3
jl 0x506273
mov edx, dword [esi]
mov eax, dword [ebp + 8]
mov ecx, dword [eax]
push edx
push 0
push eax
mov eax, dword [ecx + 0x8c]
call eax
push eax
mov edi, str.SetTexture_gTexture
call fcn.00502b30
mov edx, dword [esp + 0xd1c]
mov eax, dword [ebp + 8]
mov ecx, dword [eax]
add esp, 4
push 0
push edx
mov edx, dword [esp + 0xd1c]
push edx
push 0x1c4
push 6
push eax
mov eax, dword [ecx + 0x64]
call eax
push eax
mov edi, str.DrawPrimitive__Tri__4
call fcn.00502b30
add esp, 4
mov byte [esp + 0x4c00], 3
mov eax, dword [esp + 0xd14]
lea ecx, [esp + 0x94]
cmp eax, ecx
je 0x506296
push eax
call fcn.0062493b
add esp, 4
mov eax, dword [esp + 0x14]
add eax, 1
cmp eax, dword [esp + 0x18]
mov dword [esp + 0x14], eax
jl 0x505ff0
mov eax, dword [esp + 0x10]
add eax, 1
cmp eax, dword [esp + 0xc]
mov dword [esp + 0x10], eax
jl 0x505fd0
mov eax, dword [esp + 0x2634]
lea edx, [esp + 0x19b4]
cmp eax, edx
je 0x5062db
push eax
call fcn.0062493b
add esp, 4
mov dword [esp + 0x4c00], 0xffffffff
mov eax, dword [esp + 0x19a4]
lea ecx, [esp + 0xd24]
cmp eax, ecx
je 0x506301
push eax
call fcn.0062493b
add esp, 4
add dword [esp + 0x20], 0x3c
sub dword [esp + 0x24], 1
jne 0x505c50
mov ecx, dword [esp + 0x4bf8]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
mov esp, ebp
pop ebp
ret 0x1c
fstp st(0)
mov ecx, dword [esp + 0x4bf8]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
mov esp, ebp
pop ebp
ret 0x1c