//
// sub_4DBDD0 from 0x4dbdd0 to 0x4dbe10 (64 bytes)
//
// 14 xrefs:
// > EndLevelLayer::onMenu @ 0x7d3360
// > EndLevelLayer::onReplay @ 0x7d3514
// > EndLevelLayer::onRestartCheckpoint @ 0x7d3744
// > EndLevelLayer::getCoinString @ 0x7d3b80
// > EndLevelLayer::coinEnterFinished @ 0x7d436c
// > EndLevelLayer::playEndEffect @ 0x7d4f8c
// > EndLevelLayer::playEndEffect @ 0x7d4fb0
// > EndLevelLayer::customSetup @ 0x7d72ac
// > EndLevelLayer::customSetup @ 0x7d737c
// > EndLevelLayer::customSetup @ 0x7d73a8
// > EndLevelLayer::customSetup @ 0x7d73c8
// > EndLevelLayer::customSetup @ 0x7d74e8
// > EndLevelLayer::customSetup @ 0x7d7534
// > EndLevelLayer::customSetup @ 0x7d7540
//
// 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_4DBDD0(void *p)
{
unsigned int *v1; // x3
int v2; // w2
if ( &pthread_create )
{
v1 = (unsigned int *)((char *)p + 16);
do
v2 = __ldaxr(v1);
while ( __stlxr(v2 - 1, v1) );
}
else
{
v2 = *((_DWORD *)p + 4);
*((_DWORD *)p + 4) = v2 - 1;
}
if ( v2 <= 0 )
operator delete(p);
}