//
// sub_4DD220 from 0x4dd220 to 0x4dd260 (64 bytes)
//
// 9 xrefs:
// > SetupRandTriggerPopup::updateChanceLabel @ 0x96c764
// > SetupRandTriggerPopup::updateTextInputLabel @ 0x96c9a0
// > SetupRandTriggerPopup::updateTextInputLabel @ 0x96c9bc
// > SetupRandTriggerPopup::updateTextInputLabel2 @ 0x96cb50
// > SetupRandTriggerPopup::updateTextInputLabel2 @ 0x96cb6c
// > SetupRandTriggerPopup::init @ 0x96d824
// > SetupRandTriggerPopup::init @ 0x96d854
// > SetupRandTriggerPopup::init @ 0x96d87c
// > SetupRandTriggerPopup::init @ 0x96d8a8
//
// 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_4DD220(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);
}