//
// sub_D14588 from 0xd14588 to 0xd1461c (148 bytes)
//
// 1 xrefs:
// > ??> @ 0x111f260
//
// 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
//
__int64 __fastcall sub_D14588(__int64 a1)
{
__int64 v1; // x19
void *v2; // x0
unsigned int *v4; // x2
int v5; // w1
__int64 v6; // [xsp+28h] [xbp+28h] BYREF
(*(void (__fastcall **)(__int64 *__return_ptr, _QWORD, _QWORD))(**(_QWORD **)(a1 + 24) + 24LL))(
&v6,
*(_QWORD *)(a1 + 24),
*(unsigned int *)(a1 + 16));
v1 = v6;
v2 = (void *)(v6 - 24);
if ( (__int64 *)(v6 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v4 = (unsigned int *)(v6 - 8);
do
v5 = __ldaxr(v4);
while ( __stlxr(v5 - 1, v4) );
}
else
{
v5 = *(_DWORD *)(v6 - 8);
*(_DWORD *)(v6 - 8) = v5 - 1;
}
if ( v5 <= 0 )
operator delete(v2);
}
return v1;
}