//
// sub_D15750 from 0xd15750 to 0xd157a8 (88 bytes)
//
// 5 xrefs:
// > sub_4E0CD4 @ 0x4e0d48
// > sub_4E9680 @ 0x4e9724
// > sub_4E9EB0 @ 0x4e9ecc
// > sub_4EA580 @ 0x4ea628
// > ??> @ 0x122a4a8
//
// 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_D15750(__int64 *a1)
{
__int64 v1; // x2
__int64 *v2; // x0
unsigned int *v3; // x2
int v4; // w1
v1 = *a1;
v2 = (__int64 *)(*a1 - 24);
if ( v2 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v3 = (unsigned int *)(v1 - 8);
do
v4 = __ldaxr(v3);
while ( __stlxr(v4 - 1, v3) );
}
else
{
v4 = *(_DWORD *)(v1 - 8);
*(_DWORD *)(v1 - 8) = v4 - 1;
}
if ( v4 <= 0 )
operator delete(v2);
}
}