//
// CCAnimatedSprite::runAnimation from 0x5712e0 to 0x5713cc (236 bytes)
//
// 27 xrefs:
// > CCAnimatedSprite::tweenToAnimationFinished @ 0x57140c
// > PlayerObject::animationFinished @ 0x621330
// > PlayerObject::animationFinished @ 0x621438
// > PlayerObject::animationFinished @ 0x62146c
// > PlayerObject::animationFinished @ 0x6215f8
// > PlayerObject::animationFinished @ 0x621798
// > PlayerObject::createRobot @ 0x6222dc
// > PlayerObject::createSpider @ 0x622670
// > PlayerObject::updateDashArt @ 0x625f3c
// > PlayerObject::updateDashArt @ 0x626218
// > PlayerObject::propellPlayer @ 0x6297dc
// > PlayerObject::propellPlayer @ 0x629874
// > PlayerObject::playDynamicSpiderRun @ 0x62aeb4
// > PlayerObject::playDynamicSpiderRun @ 0x62afa4
// > PlayerObject::playDynamicSpiderRun @ 0x62b068
// > PlayerObject::updateMove @ 0x62bbe0
// > PlayerObject::updateMove @ 0x62be84
// > PlayerObject::updateMove @ 0x62c460
// > PlayerObject::stopDashing @ 0x62ce34
// > PlayerObject::hitGround @ 0x62d4ac
// > PlayerObject::updateRobotAnimationSpeed @ 0x62d898
// > PlayerObject::toggleSpiderMode @ 0x630e58
// > PlayerObject::toggleRobotMode @ 0x6319e0
// > PlayerObject::toggleRobotMode @ 0x631b50
// > PlayerObject::ringJump @ 0x63c3bc
// > GJRobotSprite::init @ 0x8e39e4
// > ??> @ 0x2b488
//
// 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
//
__int64 __fastcall CCAnimatedSprite::runAnimation(__int64 a1, __int64 a2)
{
SpriteAnimationManager *v2; // x21
void *v3; // x0
unsigned int *v5; // x2
int v6; // w1
__int64 v7; // [xsp+40h] [xbp+40h] BYREF
v2 = *(SpriteAnimationManager **)(a1 + 616);
sub_D18D28(&v7, a2);
SpriteAnimationManager::runAnimation(v2, (std::string)&v7);
v3 = (void *)(v7 - 24);
if ( (__int64 *)(v7 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v5 = (unsigned int *)(v7 - 8);
do
v6 = __ldaxr(v5);
while ( __stlxr(v6 - 1, v5) );
}
else
{
v6 = *(_DWORD *)(v7 - 8);
*(_DWORD *)(v7 - 8) = v6 - 1;
}
if ( v6 <= 0 )
operator delete(v3);
}
return _stack_chk_guard;
}