//
// SpriteAnimationManager::overridePrio from 0x58f9e0 to 0x58fb28 (328 bytes)
//
// 3 xrefs:
// > CCAnimatedSprite::runAnimationForced @ 0x571504
// > SpriteAnimationManager::stopAnimations @ 0x58fb38
// > ??> @ 0x696f0
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
void SpriteAnimationManager::overridePrio(SpriteAnimationManager *a1)
{
_DWORD *v2; // x22
unsigned __int64 v3; // x25
stl::StringData::Internal *m_data; // x0
unsigned __int64 v5; // x20
size_t v6; // x2
int v7; // w19
__int64 v8; // x20
__int64 *v9; // x0
unsigned int *v10; // x22
int v11; // w1
void *v12; // [xsp+60h] [xbp+60h] BYREF
sub_D153B8((int)&v12, "not_used");
v2 = v12;
v3 = *((_QWORD *)v12 - 3);
m_data = a1->m_currentAnimation.m_data.m_data;
v5 = *((_QWORD *)m_data - 3);
if ( v3 > v5 )
v6 = *((_QWORD *)m_data - 3);
else
v6 = *((_QWORD *)v12 - 3);
v7 = memcmp(m_data, v12, v6);
if ( v7 || (v7 = 0x7FFFFFFF, v8 = v5 - v3, v8 > 0x7FFFFFFF) )
{
v9 = (__int64 *)(v2 - 6);
if ( v2 - 6 == (_DWORD *)&qword_124B6B0 )
goto LABEL_7;
}
else
{
v9 = (__int64 *)(v2 - 6);
if ( v8 >= (__int64)0xFFFFFFFF80000000LL )
v7 = v8;
else
v7 = 0x80000000;
if ( v9 == &qword_124B6B0 )
goto LABEL_7;
}
if ( &pthread_create )
{
v10 = v2 - 2;
do
v11 = __ldaxr(v10);
while ( __stlxr(v11 - 1, v10) );
}
else
{
v11 = *(v2 - 2);
*(v2 - 2) = v11 - 1;
}
if ( v11 <= 0 )
operator delete(v9);
LABEL_7:
if ( v7 )
{
sub_D18EA8(&a1->m_nextAnimation, &a1->m_currentAnimation);
sub_D1798C(&a1->m_currentAnimation, "not_used", 8);
}
}