//
// sub_4DB6A0 from 0x4db6a0 to 0x4db768 (200 bytes)
//
// 6 xrefs:
// > DrawGridLayer::loadTimeMarkers @ 0x66be14
// > LevelEditorLayer::createObjectsFromSetup @ 0x670d74
// > LevelEditorLayer::createObjectsFromSetup @ 0x67129c
// > LevelEditorLayer::createObjectsFromString @ 0x671874
// > LevelEditorLayer::createObjectsFromString @ 0x671bc0
// > LevelEditorLayer::init @ 0x67d398
//
// 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_4DB6A0(__int64 *a1, __int64 *a2)
{
__int64 v4; // x1
__int64 *v5; // x0
unsigned int *v6; // x1
int v7; // w2
while ( a1 != a2 )
{
v4 = *a1;
v5 = (__int64 *)(*a1 - 24);
if ( v5 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v6 = (unsigned int *)(v4 - 8);
do
v7 = __ldaxr(v6);
while ( __stlxr(v7 - 1, v6) );
}
else
{
v7 = *(_DWORD *)(v4 - 8);
*(_DWORD *)(v4 - 8) = v7 - 1;
}
if ( v7 <= 0 )
operator delete(v5);
}
++a1;
}
return _stack_chk_guard;
}