//
// sub_8CF0E8 from 0x8cf0e8 to 0x8cf3f0 (776 bytes)
//
// 3 xrefs:
// > GJRewardItem::init @ 0x8cf450
// > GameStatsManager::getCompletedMapPacks @ 0x8d5f10
// > GJChallengeItem::createFromString @ 0x8d8da8
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:56:38 +0000
//
cocos2d::CCArray *__fastcall sub_8CF0E8(unsigned __int8 *a1, const char *a2)
{
__int64 v4; // x0
int v5; // w27
cocos2d::CCArray *v6; // x25
unsigned __int8 *v7; // x23
__int64 v8; // x20
size_t v9; // x0
__int64 v10; // x23
__int64 v11; // x24
int v12; // w20
size_t v13; // x0
unsigned __int64 v14; // x28
int v15; // w26
const char *v16; // x1
size_t v17; // x0
cocos2d::CCObject *v18; // x0
unsigned __int8 *v19; // x23
unsigned __int64 v20; // x27
size_t v21; // x0
unsigned __int8 *v22; // x5
unsigned __int8 *v23; // x27
unsigned __int8 *v24; // x0
int v25; // w3
const char *v26; // x1
__int64 v28; // x24
const char *v29; // x2
unsigned __int8 *v30; // x0
int v31; // w20
const char *v32; // x21
char *v33; // [xsp+68h] [xbp+68h]
__int64 v34[2]; // [xsp+78h] [xbp+78h] BYREF
void *v35; // [xsp+88h] [xbp+88h]
__int64 v36[2]; // [xsp+90h] [xbp+90h] BYREF
void *v37; // [xsp+A0h] [xbp+A0h]
v4 = cocos2d::CCArray::create(_stack_chk_guard);
v5 = *a1;
v6 = (cocos2d::CCArray *)v4;
if ( (v5 & 1) != 0 )
{
v7 = *((unsigned __int8 **)a1 + 2);
v8 = *((_QWORD *)a1 + 1);
v9 = strlen(a2);
if ( !v9 || !v8 || (v28 = (__int64)&v7[v8], v29 = &a2[v9], v7 == &v7[v8]) )
{
v10 = -1;
v11 = v8;
goto LABEL_8;
}
}
else
{
v12 = v5 >> 1;
v13 = strlen(a2);
v11 = v5 >> 1;
if ( !v13 || !v12 )
{
v10 = -1;
goto LABEL_8;
}
v7 = a1 + 1;
v29 = &a2[v13];
v28 = (__int64)&a1[v12 + 1];
if ( a1 + 1 == (unsigned __int8 *)v28 )
{
v10 = -1;
goto LABEL_51;
}
}
v30 = v7;
while ( a2 == v29 )
{
LABEL_47:
if ( (unsigned __int8 *)v28 == ++v30 )
{
v10 = -1;
goto LABEL_53;
}
}
v31 = *v30;
if ( *(unsigned __int8 *)a2 != v31 )
{
v32 = a2;
while ( v29 != ++v32 )
{
if ( *(unsigned __int8 *)v32 == v31 )
goto LABEL_52;
}
goto LABEL_47;
}
LABEL_52:
v10 = v30 - v7;
LABEL_53:
v12 = v5 >> 1;
if ( (v5 & 1) == 0 )
{
LABEL_51:
v11 = v12;
goto LABEL_8;
}
v11 = *((_QWORD *)a1 + 1);
LABEL_8:
v14 = 0;
while ( 2 )
{
std::string::basic_string(v34, (__int64)a1, v14, v10 - v14);
v15 = v34[0] & 1;
if ( v15 )
{
if ( v14 != v11 || (v15 = 1, v34[1]) )
{
v16 = (const char *)v35;
goto LABEL_13;
}
}
else if ( v14 != v11 || (int)LOBYTE(v34[0]) >> 1 )
{
v16 = (char *)v34 + 1;
LABEL_13:
v36[0] = 0;
v36[1] = 0;
v37 = nullptr;
v33 = (char *)v16;
v17 = strlen(v16);
std::string::__init(v36, v33, v17);
v18 = (cocos2d::CCObject *)cocos2d::CCString::create(v36);
cocos2d::CCArray::addObject(v6, v18);
if ( (v36[0] & 1) != 0 )
operator delete(v37);
v15 = v34[0] & 1;
}
if ( v10 != -1 )
{
v14 = v10 + 1;
if ( (*a1 & 1) != 0 )
{
v19 = *((unsigned __int8 **)a1 + 2);
v20 = *((_QWORD *)a1 + 1);
}
else
{
v19 = a1 + 1;
v20 = *a1 >> 1;
}
v21 = strlen(a2);
if ( v21 )
{
if ( v14 < v20 )
{
v22 = &v19[v14];
v23 = &v19[v20];
v24 = (unsigned __int8 *)&a2[v21];
if ( &v19[v14] != v23 )
{
while ( 1 )
{
if ( a2 != (const char *)v24 )
{
v25 = *v22;
if ( *(unsigned __int8 *)a2 == v25 )
{
LABEL_36:
v10 = v22 - v19;
goto LABEL_22;
}
v26 = a2;
while ( v24 != (unsigned __int8 *)++v26 )
{
if ( *(unsigned __int8 *)v26 == v25 )
goto LABEL_36;
}
}
if ( v23 == ++v22 )
{
v10 = -1;
goto LABEL_22;
}
}
}
}
}
v10 = -1;
LABEL_22:
if ( v15 )
operator delete(v35);
continue;
}
break;
}
if ( v15 )
operator delete(v35);
return v6;
}