//
// sub_934CB4 from 0x934cb4 to 0x934ed0 (540 bytes)
//
// 4 xrefs:
// > GJChestSprite::switchToState @ 0x936d58
// > GJChestSprite::switchToState @ 0x936e4c
// > GJChestSprite::switchToState @ 0x936ed4
// > GJChestSprite::switchToState @ 0x93713c
//
// 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 __usercall sub_934CB4@(char *a1@, char *a2@, __int64 a3@)
{
__int64 v5; // x19
void *v6; // x0
char *v7; // x0
unsigned int *v9; // x1
int v10; // w2
unsigned int *v11; // x1
int v12; // w2
char *v13; // [xsp+48h] [xbp+48h] BYREF
__int64 v14; // [xsp+50h] [xbp+50h] BYREF
sub_D153B8(a3, a1);
sub_D153B8((int)&v13, "_001");
sub_D153B8((int)&v14, a2);
while ( 1 )
{
v5 = sub_D1641C(a3, v13);
if ( v5 == -1 )
break;
sub_D1861C(a3, v5, *((_QWORD *)v13 - 3), v14, *(_QWORD *)(v14 - 24));
}
v6 = (void *)(v14 - 24);
if ( (__int64 *)(v14 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v9 = (unsigned int *)(v14 - 8);
do
v10 = __ldaxr(v9);
while ( __stlxr(v10 - 1, v9) );
}
else
{
v10 = *(_DWORD *)(v14 - 8);
*(_DWORD *)(v14 - 8) = v10 - 1;
}
if ( v10 <= 0 )
operator delete(v6);
}
v7 = v13 - 24;
if ( v13 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v11 = (unsigned int *)(v13 - 8);
do
v12 = __ldaxr(v11);
while ( __stlxr(v12 - 1, v11) );
}
else
{
v12 = *((_DWORD *)v13 - 2);
*((_DWORD *)v13 - 2) = v12 - 1;
}
if ( v12 <= 0 )
operator delete(v7);
}
return a3;
}