//
// sub_58E1F0 from 0x58e1f0 to 0x58e234 (68 bytes)
//
// 30 xrefs:
// > SpriteAnimationManager::callAnimationFinished @ 0x58e5bc
// > SpriteAnimationManager::callAnimationFinished @ 0x58e5e4
// > SpriteAnimationManager::createAnimations @ 0x58f290
// > SpriteAnimationManager::createAnimations @ 0x58f2ac
// > SpriteAnimationManager::createAnimations @ 0x58f2c8
// > SpriteAnimationManager::createAnimations @ 0x58f2e4
// > SpriteAnimationManager::createAnimations @ 0x58f31c
// > SpriteAnimationManager::createAnimations @ 0x58f348
// > SpriteAnimationManager::createAnimations @ 0x58f36c
// > SpriteAnimationManager::createAnimations @ 0x58f398
// > SpriteAnimationManager::createAnimations @ 0x58f3fc
// > SpriteAnimationManager::createAnimations @ 0x58f420
// > SpriteAnimationManager::createAnimations @ 0x58f460
// > SpriteAnimationManager::storeAnimation @ 0x58f79c
// > SpriteAnimationManager::playSoundForAnimation @ 0x58f9d8
// > SpriteAnimationManager::queueAnimation @ 0x58fd14
// > SpriteAnimationManager::queueAnimation @ 0x58fd3c
// > SpriteAnimationManager::executeAnimation @ 0x5901f0
// > SpriteAnimationManager::executeAnimation @ 0x590214
// > SpriteAnimationManager::runAnimation @ 0x590540
// > SpriteAnimationManager::runAnimation @ 0x590564
// > SpriteAnimationManager::runQueuedAnimation @ 0x59075c
// > SpriteAnimationManager::switchToFirstFrameOfAnimation @ 0x590af0
// > SpriteAnimationManager::loadAnimations @ 0x591598
// > SpriteAnimationManager::loadAnimations @ 0x5915d8
// > SpriteAnimationManager::loadAnimations @ 0x591600
// > SpriteAnimationManager::loadAnimations @ 0x59162c
// > SpriteAnimationManager::loadAnimations @ 0x591654
// > SpriteAnimationManager::initWithOwner @ 0x5919a8
// > SpriteAnimationManager::createWithOwner @ 0x591b38
//
// 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 __fastcall sub_58E1F0(void *p)
{
unsigned int *v1; // x3
int v2; // w2
int v3; // w2
if ( !&pthread_create )
{
v3 = *((_DWORD *)p + 4);
*((_DWORD *)p + 4) = v3 - 1;
if ( v3 > 0 )
return;
LABEL_7:
operator delete(p);
return;
}
v1 = (unsigned int *)((char *)p + 16);
do
v2 = __ldaxr(v1);
while ( __stlxr(v2 - 1, v1) );
if ( v2 <= 0 )
goto LABEL_7;
}