//
// sub_4DC4F0 from 0x4dc4f0 to 0x4dc5f0 (256 bytes)
//
// 3 xrefs:
// > ColorAction::setupFromString @ 0x8b4074
// > GJEffectManager::loadPersistentStateString @ 0x8b6d14
// > GJEffectManager::loadPersistentStateString @ 0x8b6d4c
//
// 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 sub_4DC4F0(__int64 *a1)
{
__int64 v1; // x1
void *v3; // x0
unsigned int *v4; // x1
int v5; // w2
__int64 v6; // x1
__int64 *v7; // x0
unsigned int *v8; // x1
int v9; // w2
v1 = a1[1];
v3 = (void *)(v1 - 24);
if ( (__int64 *)(v1 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v4 = (unsigned int *)(v1 - 8);
do
v5 = __ldaxr(v4);
while ( __stlxr(v5 - 1, v4) );
}
else
{
v5 = *(_DWORD *)(v1 - 8);
*(_DWORD *)(v1 - 8) = v5 - 1;
}
if ( v5 <= 0 )
operator delete(v3);
}
v6 = *a1;
v7 = (__int64 *)(*a1 - 24);
if ( v7 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v8 = (unsigned int *)(v6 - 8);
do
v9 = __ldaxr(v8);
while ( __stlxr(v9 - 1, v8) );
}
else
{
v9 = *(_DWORD *)(v6 - 8);
*(_DWORD *)(v6 - 8) = v9 - 1;
}
if ( v9 <= 0 )
operator delete(v7);
}
return _stack_chk_guard;
}