//
// sub_CF3D40 from 0xcf3d40 to 0xcf3e20 (224 bytes)
//
// 3 xrefs:
// > sub_CF3E20 @ 0xcf3e24
// > sub_CF3E28 @ 0xcf3e34
// > ??> @ 0x111e710
//
// 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_CF3D40(void *a1)
{
__int64 v2; // x2
void *v3; // x0
unsigned int *v4; // x2
int v5; // w1
*(_QWORD *)a1 = off_111E708;
*((_QWORD *)a1 + 13) = off_111E758;
v2 = *((_QWORD *)a1 + 12);
*((_QWORD *)a1 + 2) = off_111E730;
*((_QWORD *)a1 + 3) = off_121DA60;
v3 = (void *)(v2 - 24);
if ( (__int64 *)(v2 - 24) != &qword_124B6D0 )
{
if ( &pthread_create )
{
v4 = (unsigned int *)(v2 - 8);
do
v5 = __ldaxr(v4);
while ( __stlxr(v5 - 1, v4) );
}
else
{
v5 = *(_DWORD *)(v2 - 8);
*(_DWORD *)(v2 - 8) = v5 - 1;
}
if ( v5 <= 0 )
operator delete(v3);
}
*((_QWORD *)a1 + 3) = off_111E9B0;
sub_CEA56C((unsigned int **)a1 + 10);
*((_QWORD *)a1 + 13) = off_111DB90;
sub_CCFDF8((_QWORD *)a1 + 13);
operator delete(a1);
}