//
// sub_519534 from 0x519534 to 0x5196a2 (366 bytes)
//
// 3 xrefs:
// > GJRewardItem::init @ 0x5196ce
// > GameStatsManager::getCompletedMapPacks @ 0x51db90
// > GJChallengeItem::createFromString @ 0x51dc60
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 11:51:45 +0000
//
cocos2d::CCArray *__fastcall sub_519534(_DWORD *a1, const char *a2)
{
cocos2d::CCArray *v4; // r0
int v5; // r4
unsigned __int8 *v6; // r9
int v7; // r6
size_t v8; // r0
int v9; // r4
unsigned __int8 *v10; // r6
unsigned __int8 *first_of; // r0
int v12; // r6
unsigned int v13; // r11
int v14; // r6
const char *v15; // r11
size_t v16; // r0
cocos2d::CCObject *v17; // r0
int v18; // r2
int v19; // r2
unsigned __int8 *v20; // r4
size_t v21; // r0
unsigned __int8 *v22; // r0
cocos2d::CCArray *v24; // [sp+Ch] [bp-30h]
unsigned int v25; // [sp+14h] [bp-28h]
unsigned __int8 *v26; // [sp+14h] [bp-28h]
int v27[3]; // [sp+1Ch] [bp-20h] BYREF
int v28[3]; // [sp+28h] [bp-14h] BYREF
v4 = (cocos2d::CCArray *)cocos2d::CCArray::create((cocos2d::CCArray *)a1);
v5 = *(unsigned __int8 *)a1;
if ( (v5 & 1) != 0 )
{
v6 = (unsigned __int8 *)a1[2];
v7 = a1[1];
}
else
{
v6 = (unsigned __int8 *)a1 + 1;
v7 = v5 >> 1;
}
v24 = v4;
v8 = strlen(a2);
if ( v7
&& v8
&& (v10 = &v6[v7],
first_of = std::__find_first_of_ce(
v6,
v10,
(int)a2,
(int)&a2[v8],
(int (__fastcall *)(_DWORD, int))std::char_traits::eq),
first_of != v10) )
{
v9 = first_of - v6;
}
else
{
v9 = -1;
}
v12 = *(unsigned __int8 *)a1;
v13 = 0;
if ( (v12 & 1) != 0 )
v14 = a1[1];
else
v14 = v12 >> 1;
while ( 1 )
{
std::string::basic_string(v27, (unsigned __int8 *)a1, v13, v9 - v13);
if ( (v27[0] & 1) != 0 )
{
if ( v27[1] || v13 != v14 )
{
v15 = (const char *)v27[2];
LABEL_21:
memset(v28, 0, sizeof(v28));
v16 = strlen(v15);
std::string::__init(v28, v15, v16);
v17 = (cocos2d::CCObject *)cocos2d::CCString::create(v28);
cocos2d::CCArray::addObject(v24, v17);
std::string::~string((int)v28);
}
}
else if ( LOBYTE(v27[0]) >> 1 || v13 != v14 )
{
v15 = (char *)v27 + 1;
goto LABEL_21;
}
if ( v9 == -1 )
break;
v18 = *(unsigned __int8 *)a1;
v13 = v9 + 1;
if ( (v18 & 1) != 0 )
{
v19 = a1[1];
v20 = (unsigned __int8 *)a1[2];
}
else
{
v19 = v18 >> 1;
v20 = (unsigned __int8 *)a1 + 1;
}
v25 = v19;
v21 = strlen(a2);
if ( v13 >= v25
|| !v21
|| (v26 = &v20[v25],
v22 = std::__find_first_of_ce(
&v20[v13],
v26,
(int)a2,
(int)&a2[v21],
(int (__fastcall *)(_DWORD, int))std::char_traits::eq),
v22 == v26) )
{
v9 = -1;
}
else
{
v9 = v22 - v20;
}
std::string::~string((int)v27);
}
std::string::~string((int)v27);
return v24;
}