//
// sub_CEA4CC from 0xcea4cc to 0xcea56c (160 bytes)
//
// 8 xrefs:
// > sub_CCEE84 @ 0xccef0c
// > sub_CCEF54 @ 0xccf0a4
// > sub_CCF764 @ 0xccf7ec
// > sub_CCF834 @ 0xccf994
// > sub_CD0878 @ 0xcd08b0
// > sub_CD08C8 @ 0xcd08fc
// > sub_CF95F4 @ 0xcf963c
// > sub_CF9AAC @ 0xcf9af4
//
// 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
//
unsigned int **__fastcall sub_CEA4CC(unsigned int **a1, unsigned int **a2)
{
unsigned int *v3; // x2
unsigned int v4; // w0
unsigned int *v5; // x19
unsigned int v6; // w0
unsigned int **v8; // [xsp+28h] [xbp+28h]
v3 = *a2;
if ( &pthread_create )
{
do
v4 = __ldaxr(v3);
while ( __stlxr(v4 + 1, v3) );
v5 = *a1;
do
v6 = __ldaxr(v5);
while ( __stlxr(v6 - 1, v5) );
}
else
{
v5 = *a1;
++*v3;
v6 = (*v5)--;
}
if ( v6 == 1 && v5 )
{
v8 = a2;
sub_CEA32C(v5);
operator delete(v5);
a2 = v8;
}
*a1 = *a2;
return a1;
}