//
// sub_CF6E68 from 0xcf6e68 to 0xcf6f30 (200 bytes)
//
// 0 xrefs:
//
// 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_CF6E68(__int64 a1, __int64 *a2)
{
__int64 v3; // x1
__int64 v5; // x2
void *v6; // x0
__int64 v7; // x0
__int64 result; // x0
unsigned int *v9; // x2
int v10; // w1
v3 = *a2;
*(_QWORD *)a1 = v3;
v5 = *(_QWORD *)(a1 + 88);
v6 = (void *)(v5 - 24);
*(_QWORD *)(a1 + *(_QWORD *)(v3 - 24)) = a2[3];
*(_QWORD *)(a1 + 16) = off_121DA60;
if ( (__int64 *)(v5 - 24) != &qword_124B6D0 )
{
if ( &pthread_create )
{
v9 = (unsigned int *)(v5 - 8);
do
v10 = __ldaxr(v9);
while ( __stlxr(v10 - 1, v9) );
}
else
{
v10 = *(_DWORD *)(v5 - 8);
*(_DWORD *)(v5 - 8) = v10 - 1;
}
if ( v10 <= 0 )
operator delete(v6);
}
*(_QWORD *)(a1 + 16) = off_111E9B0;
sub_CEA56C((unsigned int **)(a1 + 72));
v7 = a2[1];
*(_QWORD *)a1 = v7;
result = *(_QWORD *)(v7 - 24);
*(_QWORD *)(a1 + result) = a2[2];
return result;
}