//
// sub_4DBE50 from 0x4dbe50 to 0x4dbe90 (64 bytes)
//
// 17 xrefs:
// > SupportLayer::onEmail @ 0x7db494
// > SupportLayer::onGetReward @ 0x7db5d4
// > SupportLayer::onRequestAccess @ 0x7db70c
// > SupportLayer::onLowDetail @ 0x7db860
// > SupportLayer::onSFX @ 0x7dbf60
// > SupportLayer::onSFX @ 0x7dbf9c
// > SupportLayer::onSFX @ 0x7dbfcc
// > SupportLayer::onLinks @ 0x7dcab0
// > SupportLayer::onLinks @ 0x7dcaec
// > SupportLayer::onLinks @ 0x7dcb1c
// > SupportLayer::uploadActionFinished @ 0x7dcd74
// > SupportLayer::uploadActionFailed @ 0x7dce88
// > SupportLayer::customSetup @ 0x7ddc34
// > SupportLayer::customSetup @ 0x7ddc5c
// > SupportLayer::sendSupportMail @ 0x7ddeb4
// > SupportLayer::sendSupportMail @ 0x7ddee0
// > SupportLayer::sendSupportMail @ 0x7ddefc
//
// 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_4DBE50(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);
}