//
// sub_4DC058 from 0x4dc058 to 0x4dc098 (64 bytes)
//
// 16 xrefs:
// > sub_82052C @ 0x8207b8
// > sub_82052C @ 0x8207d4
// > GJRateLevelLayer::uploadActionFailed @ 0x820904
// > GJRateLevelLayer::FLAlert_Clicked @ 0x820a80
// > GJRateLevelLayer::onCustomButton @ 0x820d04
// > GJRateLevelLayer::uploadActionFinished @ 0x820e28
// > GJRateLevelLayer::onRate @ 0x820f9c
// > GJRateLevelLayer::setupRateInfo @ 0x822844
// > GJRateLevelLayer::setupRateInfo @ 0x822868
// > GJRateLevelLayer::setupRateInfo @ 0x822884
// > GJRateLevelLayer::setupRateInfo @ 0x8228b0
// > GJRateLevelLayer::setupRateInfo @ 0x8228d8
// > GJRateLevelLayer::setupRateInfo @ 0x8228fc
// > GJRateLevelLayer::rateInfoFinished @ 0x822a40
// > GJRateLevelLayer::init @ 0x8233f8
// > GJRateLevelLayer::init @ 0x823424
//
// 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_4DC058(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);
}