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

Disassembly:
push ebp
push edi
push esi
push ebx
mov ebx, ecx
sub esp, 0x5c
cmp byte [esp + 0x78], 0
mov esi, dword [esp + 0x70]
je 0x516760
movsx eax, word [ebx + 0x52]
cmp eax, esi
je 0x5167a8
fld dword [ebx + 0x58]
fstp dword [esp + 0x4c]
fld dword [esp + 0x4c]
fldz
fcompi st(1)
fstp st(0)
jae 0x516754
cmp byte [ebx + 0x3b], 0xd
je 0x516754
movzx ebp, byte [ebx + 9]
mov eax, ebp
cmp al, 8
je 0x516754
movzx eax, word [ebx + 0x1c]
mov edx, dword [0x59ad30]
movzx ecx, word [ebx + 0x1a]
mov edi, dword [0x5b39d0]
sar ax, 5
cwde
sar cx, 5
imul eax, edx
movsx ecx, cx
imul edx, dword [esp + 0x74]
add eax, ecx
add edx, esi
imul eax, eax, 0xe
imul edx, edx, 0xe
movzx edx, byte [edi + edx + 0xc]
cmp byte [edi + eax + 0xc], dl
jne 0x5167c0
cmp byte [ebx + 0x42], 0xc
je 0x516810
movzx eax, word [esp + 0x74]
xor edx, edx
mov byte [ebx + 0x42], 0xc
mov word [ebx + 0x43], dx
mov word [esp + 0x2a], si
mov word [ebx + 0x45], si
mov word [esp + 0x34], ax
mov word [ebx + 0x47], ax
mov eax, dword [ebx]
mov ecx, ebx
mov dword [esp], 0
call dword [eax + 0x78]
movzx edi, word [ebx + 0x1a]
mov ecx, esi
sub esp, 4
mov eax, edi
sar ax, 5
cwde
sub ecx, eax
mov edx, ecx
neg edx
cmovs edx, ecx
cmp edx, 1
jg 0x516611
movzx edx, word [ebx + 0x1c]
mov ecx, dword [esp + 0x74]
mov word [esp + 0x2c], dx
sar dx, 5
movsx ebp, dx
sub ecx, ebp
mov edx, ecx
neg edx
cmovs edx, ecx
cmp edx, 1
jle 0x516850
mov eax, dword [esp + 0x74]
mov dword [esp + 0x1c], 0
mov ecx, ebx
mov dword [esp + 0x18], 1
mov dword [esp + 0x14], 1
mov dword [esp + 0x10], 0
mov dword [esp + 0xc], 2
mov dword [esp + 8], 1
mov dword [esp + 4], eax
mov dword [esp], esi
call fcn.0052d7d0
movsx eax, word [ebx + 0x52]
sub esp, 0x20
cmp eax, esi
jne 0x516738
movsx eax, word [ebx + 0x54]
cmp eax, dword [esp + 0x74]
jne 0x516738
mov eax, dword [ebx + 0x77]
test eax, eax
je 0x516738
mov ebp, dword [ebx + 0x7b]
test ebp, ebp
je 0x516738
lea edx, [ebp*4 - 4]
lea edi, [eax + edx]
lea edx, [eax + edx - 4]
movzx ecx, word [edx]
movsx eax, word [edi]
mov dword [esp + 0x3c], edx
movsx edx, word [edx + 2]
mov dword [esp + 0x30], eax
mov word [esp + 0x36], ax
movsx eax, cx
mov word [esp + 0x3a], cx
movsx ecx, word [edi + 2]
mov word [esp + 0x38], cx
sub ecx, edx
xor edx, edx
mov dword [esp + 0x2c], ecx
mov ecx, dword [esp + 0x30]
sub ecx, eax
mov dword [esp + 0x30], ecx
mov eax, ecx
je 0x5166da
sar eax, 0x1f
mov edx, eax
or edx, 1
mov eax, dword [esp + 0x2c]
xor ecx, ecx
test eax, eax
je 0x5166ec
mov ecx, eax
sar ecx, 0x1f
or ecx, 1
cmp ebp, 2
jle 0x516890
mov esi, dword [esp + 0x30]
mov eax, esi
neg eax
cmovs eax, esi
cmp eax, 1
jle 0x5168c1
movzx eax, word [esp + 0x36]
sub eax, edx
movzx edx, word [esp + 0x38]
mov word [edi], ax
sub edx, ecx
mov word [edi + 2], dx
mov word [ebx + 0x52], ax
movzx eax, word [edi + 2]
sub word [ebx + 0x81], 1
mov word [ebx + 0x54], ax
lea esi, [esi]
xor eax, eax
mov byte [ebx + 0x3b], 0xc
mov word [ebx + 0x3c], ax
movzx eax, word [esp + 0x2a]
mov word [ebx + 0x3e], ax
movzx eax, word [esp + 0x34]
mov word [ebx + 0x40], ax
add esp, 0x5c
pop ebx
pop esi
pop edi
pop ebp
ret 0xc
mov ecx, 0x5b8ac0
call fcn.004ba5f0
test eax, eax
je 0x516518
mov dword [esp + 4], 6
mov ecx, 0x5b8ac0
mov dword [esp], 0x25e6
call fcn.004ba910
movzx edx, word [ebx + 6]
sub esp, 8
mov word [eax + 2], si
movzx edi, word [esp + 0x74]
mov word [eax], dx
mov word [eax + 4], di
jmp 0x516754
movsx eax, word [ebx + 0x54]
cmp eax, dword [esp + 0x74]
jne 0x516524
jmp 0x516754
mov edi, dword [esp + 0x74]
mov eax, dword [ebx]
mov dword [esp], esi
mov ecx, ebx
mov dword [esp + 0x1c], 0
mov dword [esp + 4], edi
mov dword [esp + 0x18], 1
mov dword [esp + 0x14], 1
mov dword [esp + 0x10], 0
mov dword [esp + 0xc], 1
mov dword [esp + 8], 0
call dword [eax + 0x7c]
sub esp, 0x20
add esp, 0x5c
pop ebx
pop esi
pop edi
pop ebp
ret 0xc
movsx eax, word [ebx + 0x45]
cmp eax, esi
jne 0x51659e
movsx eax, word [ebx + 0x47]
cmp eax, dword [esp + 0x74]
jne 0x51659e
mov eax, ebp
cmp al, 1
jne 0x516754
movzx eax, word [esp + 0x74]
mov word [esp + 0x2a], si
mov word [esp + 0x34], ax
jmp 0x5165bf
cmp word [ebx + 0x12], di
jne 0x516670
movzx edi, word [esp + 0x2c]
cmp word [ebx + 0x14], di
jne 0x516670
mov edi, dword [esp + 0x74]
mov dword [esp + 8], esi
mov ecx, ebx
mov dword [esp + 4], ebp
mov dword [esp + 0xc], edi
mov dword [esp], eax
call fcn.004de540
sub esp, 0x10
jmp 0x516670
movzx eax, word [esp + 0x36]
sub eax, edx
movzx edx, word [esp + 0x38]
mov word [edi], ax
sub edx, ecx
mov word [edi + 2], dx
movzx edx, word [ebx + 0x16]
sar dx, 5
movsx edx, dx
cmp edx, esi
je 0x5168f1
mov word [ebx + 0x52], ax
movzx eax, word [edi + 2]
jmp 0x516726
mov esi, dword [esp + 0x2c]
mov eax, esi
neg eax
cmovs eax, esi
cmp eax, 1
jg 0x516709
movzx eax, word [esp + 0x3a]
sub ebp, 1
mov dword [ebx + 0x7b], ebp
mov word [ebx + 0x52], ax
mov eax, dword [esp + 0x3c]
movzx eax, word [eax + 2]
jmp 0x516726
movzx edx, word [ebx + 0x18]
sar dx, 5
movsx edx, dx
cmp edx, dword [esp + 0x74]
jne 0x5168b4
shl eax, 5
mov word [ebx + 0x16], ax
movzx eax, word [edi + 2]
shl eax, 5
mov word [ebx + 0x18], ax
movzx eax, word [edi]
jmp 0x5168b4