//
// sub_D19D4C from 0xd19d4c to 0xd19e54 (264 bytes)
//
// 2 xrefs:
// > sub_D19E54 @ 0xd19ed8
// > sub_D19E54 @ 0xd19ee4
//
// 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_D19D4C(__int64 *a1)
{
__int64 v1; // x2
unsigned int *v2; // x19
unsigned int *v3; // x0
unsigned int v4; // w1
unsigned int v6; // w0
unsigned int v7; // w0
unsigned int *v8; // x1
v1 = *a1;
a1[1] = 0;
v2 = (unsigned int *)a1[2];
a1[2] = 0;
(*(void (**)(void))(v1 + 16))();
if ( v2 )
{
if ( &pthread_create )
{
v3 = v2 + 2;
do
v4 = __ldaxr(v3);
while ( __stlxr(v4 - 1, v3) );
if ( v4 != 1 )
return 0;
(*(void (__fastcall **)(unsigned int *))(*(_QWORD *)v2 + 16LL))(v2);
v8 = v2 + 3;
do
v7 = __ldaxr(v8);
while ( __stlxr(v7 - 1, v8) );
}
else
{
v6 = v2[2];
v2[2] = v6 - 1;
if ( v6 != 1 )
return 0;
(*(void (__fastcall **)(unsigned int *))(*(_QWORD *)v2 + 16LL))(v2);
v7 = v2[3];
v2[3] = v7 - 1;
}
if ( v7 == 1 )
(*(void (__fastcall **)(unsigned int *))(*(_QWORD *)v2 + 24LL))(v2);
}
return 0;
}