//
// sub_CEBFFC from 0xcebffc to 0xcec1b0 (436 bytes)
//
// 51 xrefs:
// > GJGameLevel::scoreStringToVector @ 0x72e9a8
// > formatTags @ 0x7de874
// > cocos2d::ZipUtils::hexToChar @ 0xb298cc
// > cocos2d::ZipUtils::urlDecode @ 0xb29ae4
// > cocos2d::CCTMXMapInfo::startElement @ 0xb3d85c
// > DS_Dictionary::setVec2ForKey @ 0xb43f5c
// > DS_Dictionary::setRectForKey @ 0xb44614
// > DS_Dictionary::setVec2ArrayForKey @ 0xb450bc
// > DS_Dictionary::setRectArrayForKey @ 0xb458a0
// > sub_CCFA58 @ 0xccfadc
// > sub_CCFEB0 @ 0xccff60
// > sub_CCFEB0 @ 0xccffb4
// > sub_CCFEB0 @ 0xccffec
// > sub_CCFEB0 @ 0xcd01b8
// > sub_CCFEB0 @ 0xcd020c
// > sub_CCFEB0 @ 0xcd0244
// > sub_CD0878 @ 0xcd08a4
// > sub_CECAE0 @ 0xcecb20
// > sub_CECB54 @ 0xcecb94
// > sub_CF3E38 @ 0xcf3e78
// > sub_CF41D8 @ 0xcf4224
// > sub_CF4540 @ 0xcf45dc
// > sub_CF4684 @ 0xcf4750
// > sub_CF47F4 @ 0xcf489c
// > sub_CF4994 @ 0xcf4a64
// > sub_CF4E30 @ 0xcf4ec4
// > sub_CF4F6C @ 0xcf5034
// > sub_CF50D8 @ 0xcf5178
// > sub_CF5270 @ 0xcf533c
// > sub_CF5708 @ 0xcf57ec
// > sub_CF589C @ 0xcf5994
// > sub_CF5A48 @ 0xcf5b34
// > sub_CF5C38 @ 0xcf5d34
// > sub_CF6150 @ 0xcf6190
// > sub_CF64F4 @ 0xcf6540
// > sub_CF684C @ 0xcf68e8
// > sub_CF6990 @ 0xcf6a5c
// > sub_CF6B00 @ 0xcf6ba8
// > sub_CF6CA0 @ 0xcf6d70
// > sub_CF713C @ 0xcf71d0
// > sub_CF7278 @ 0xcf7340
// > sub_CF73E4 @ 0xcf7484
// > sub_CF757C @ 0xcf7648
// > sub_CF7A14 @ 0xcf7af8
// > sub_CF7BA8 @ 0xcf7ca0
// > sub_CF7D54 @ 0xcf7e40
// > sub_CF7F44 @ 0xcf8040
// > sub_CF9944 @ 0xcf9970
// > sub_CF9E00 @ 0xcf9e2c
// > sub_D0D394 @ 0xd0d3e0
// > sub_D105B8 @ 0xd10604
//
// 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_CEBFFC(_QWORD *a1)
{
unsigned int *result; // x0
unsigned __int8 v3; // w0
unsigned int *v4; // x0
unsigned int v5; // w1
unsigned int v6; // w1
*a1 = 0;
if ( &pthread_create )
pthread_once(dword_124A200, (void (*)(void))sub_CEBC48);
if ( qword_124A210 )
{
result = (unsigned int *)qword_124A218;
}
else
{
sub_CEAFF4((__int64)&unk_124AC10, 2);
result = (unsigned int *)&unk_124AC10;
qword_124A210 = (__int64)&unk_124AC10;
qword_124A218 = (__int64)&unk_124AC10;
}
*a1 = result;
if ( (unsigned int *)qword_124A210 == result )
{
if ( &pthread_create )
{
do
v6 = __ldaxr(result);
while ( __stlxr(v6 + 1, result) );
}
else
{
++*result;
}
}
else
{
v3 = atomic_load((unsigned __int8 *)&byte_124A6B0);
if ( (v3 & 1) != 0 || !_cxa_guard_acquire((__guard *)&byte_124A6B0) )
{
if ( !&pthread_create )
{
LABEL_15:
result = (unsigned int *)qword_124A218;
++*(_DWORD *)qword_124A218;
*a1 = result;
return result;
}
}
else
{
qword_124B310 = 0;
qword_124B318 = 0;
qword_124B320 = 0;
qword_124B328 = 0;
qword_124B330 = 0;
_cxa_guard_release((__guard *)&byte_124A6B0);
if ( !&pthread_create )
goto LABEL_15;
}
if ( pthread_mutex_lock((pthread_mutex_t *)&qword_124B310) )
sub_CEAFC4();
v4 = (unsigned int *)qword_124A218;
do
v5 = __ldaxr(v4);
while ( __stlxr(v5 + 1, v4) );
*a1 = qword_124A218;
result = (unsigned int *)pthread_mutex_unlock((pthread_mutex_t *)&qword_124B310);
if ( (_DWORD)result )
sub_CE9C50();
}
return result;
}