//
// GameToolbox::stringSetupToDict from 0x6a01ac to 0x6a0614 (1128 bytes)
//
// 3 xrefs:
// > LevelSettingsObject::objectFromString @ 0x7ae1d4
// > StartPosObject::loadSettingsFromString @ 0x879284
// > ??> @ 0xa6de0
//
// 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:50:42 +0000
//
__int64 __fastcall GameToolbox::stringSetupToDict(char *a1, const char *a2)
{
char *v5; // x19
char v6; // t1
size_t v7; // x0
cocos2d::CCArray *v8; // x0
cocos2d::CCArray *v9; // x26
unsigned __int8 *v10; // x19
unsigned __int64 v11; // x20
size_t v12; // x0
int v13; // w1
int v14; // w2
__int64 v15; // x25
unsigned __int64 v16; // x27
int v17; // w20
size_t v18; // x0
unsigned __int64 v19; // x20
int v20; // w28
const char *v21; // x1
size_t v22; // x0
cocos2d::CCObject *v23; // x0
unsigned __int8 *v24; // x25
unsigned __int64 v25; // x19
size_t v26; // x0
char *v27; // x5
unsigned __int8 *v28; // x19
unsigned __int8 *v29; // x0
int v30; // w3
const char *v31; // x1
unsigned int v32; // w19
unsigned int v33; // w20
cocos2d::CCString *v34; // x0
char *CString; // x0
char *v36; // x20
cocos2d::CCObject *v37; // x22
size_t v38; // x0
__int64 *v40; // x27
const char *v41; // x23
unsigned __int8 *v42; // x25
int v43; // w0
const char *v44; // x20
int v45; // [xsp+68h] [xbp+68h]
int v46[2]; // [xsp+70h] [xbp+70h]
unsigned __int64 v47; // [xsp+78h] [xbp+78h]
__int64 v48; // [xsp+80h] [xbp+80h] BYREF
unsigned __int64 v49; // [xsp+88h] [xbp+88h]
void *v50; // [xsp+90h] [xbp+90h]
__int64 v51[2]; // [xsp+98h] [xbp+98h] BYREF
void *v52; // [xsp+A8h] [xbp+A8h]
__int64 v53; // [xsp+B0h] [xbp+B0h] BYREF
__int64 v54; // [xsp+B8h] [xbp+B8h]
void *v55; // [xsp+C0h] [xbp+C0h]
*(_QWORD *)v46 = cocos2d::CCDictionary::create(_stack_chk_guard);
v6 = *a1;
v5 = a1 + 1;
if ( (v6 & 1) != 0 )
v5 = *((char **)a1 + 2);
v48 = 0;
v49 = 0;
v50 = nullptr;
v7 = strlen(v5);
v8 = (cocos2d::CCArray *)std::string::__init(&v48, v5, v7);
v9 = (cocos2d::CCArray *)cocos2d::CCArray::create(v8);
v45 = v48 & 1;
if ( v45 )
{
v47 = (unsigned __int8)v48;
v10 = (unsigned __int8 *)v50;
v11 = v49;
v12 = strlen(a2);
if ( !v12 || (v13 = v47, v14 = v45, !v11) || (v40 = (__int64 *)&v10[v11], v41 = &a2[v12], v10 == &v10[v11]) )
{
v15 = -1;
v16 = v11;
goto LABEL_10;
}
}
else
{
v17 = (int)(unsigned __int8)v48 >> 1;
v47 = (unsigned __int8)v48;
v16 = v17;
v18 = strlen(a2);
if ( !v18 || (v13 = v47, v14 = v45, !v17) )
{
v15 = -1;
goto LABEL_10;
}
v10 = (unsigned __int8 *)&v48 + 1;
v41 = &a2[v18];
v40 = (__int64 *)((char *)&v48 + v17 + 1);
v15 = -1;
if ( v40 == (__int64 *)((char *)&v48 + 1) )
goto LABEL_62;
}
v42 = v10;
while ( a2 == v41 )
{
LABEL_59:
if ( v40 == (__int64 *)++v42 )
{
v15 = -1;
goto LABEL_64;
}
}
v43 = *v42;
if ( *(unsigned __int8 *)a2 != v43 )
{
v44 = a2;
while ( v41 != ++v44 )
{
if ( *(unsigned __int8 *)v44 == v43 )
goto LABEL_63;
}
goto LABEL_59;
}
LABEL_63:
v15 = v42 - v10;
LABEL_64:
v17 = v13 >> 1;
if ( !v14 )
{
LABEL_62:
v16 = v17;
goto LABEL_10;
}
v16 = v49;
LABEL_10:
v19 = 0;
while ( 2 )
{
std::string::basic_string(v51, (__int64)&v48, v19, v15 - v19);
v20 = v51[0] & 1;
if ( v20 )
{
if ( v19 != v16 || (v20 = 1, v51[1]) )
{
v21 = (const char *)v52;
goto LABEL_15;
}
}
else if ( v19 != v16 || (int)LOBYTE(v51[0]) >> 1 )
{
v21 = (char *)v51 + 1;
LABEL_15:
v53 = 0;
v54 = 0;
v55 = nullptr;
v47 = (unsigned __int64)v21;
v22 = strlen(v21);
std::string::__init(&v53, (void *)v47, v22);
v23 = (cocos2d::CCObject *)cocos2d::CCString::create(&v53);
cocos2d::CCArray::addObject(v9, v23);
if ( (v53 & 1) != 0 )
operator delete(v55);
v20 = v51[0] & 1;
}
if ( v15 != -1 )
{
v19 = v15 + 1;
if ( (v48 & 1) != 0 )
{
v24 = (unsigned __int8 *)v50;
v25 = v49;
}
else
{
v25 = (unsigned __int8)v48 >> 1;
v24 = (unsigned __int8 *)&v48 + 1;
}
v26 = strlen(a2);
if ( v26 )
{
if ( v19 < v25 )
{
v27 = (char *)&v24[v19];
v28 = &v24[v25];
v29 = (unsigned __int8 *)&a2[v26];
if ( &v24[v19] != v28 )
{
while ( 1 )
{
if ( a2 != (const char *)v29 )
{
v30 = (unsigned __int8)*v27;
if ( *(unsigned __int8 *)a2 == v30 )
{
LABEL_38:
v15 = v27 - (char *)v24;
goto LABEL_24;
}
v31 = a2;
while ( v29 != (unsigned __int8 *)++v31 )
{
if ( *(unsigned __int8 *)v31 == v30 )
goto LABEL_38;
}
}
if ( v28 == (unsigned __int8 *)++v27 )
{
v15 = -1;
goto LABEL_24;
}
}
}
}
}
v15 = -1;
LABEL_24:
if ( v20 )
operator delete(v52);
continue;
}
break;
}
if ( v20 )
operator delete(v52);
if ( (v48 & 1) != 0 )
operator delete(v50);
v32 = 0;
LABEL_44:
v33 = v32;
if ( v32 >= (unsigned int)cocos2d::CCArray::count(v9) )
return *(_QWORD *)v46;
while ( 1 )
{
v32 += 2;
if ( (unsigned int)cocos2d::CCArray::count(v9) < v32 )
return 0;
v34 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v9, v33);
CString = (char *)cocos2d::CCString::getCString(v34);
v36 = CString;
if ( !CString )
goto LABEL_44;
if ( !*CString )
goto LABEL_44;
v37 = (cocos2d::CCObject *)cocos2d::CCArray::objectAtIndex(v9, v32 - 1);
v53 = 0;
v54 = 0;
v55 = nullptr;
v38 = strlen(v36);
std::string::__init(&v53, v36, v38);
cocos2d::CCDictionary::setObject(v46[0], v37);
if ( (v53 & 1) == 0 )
goto LABEL_44;
v33 = v32;
operator delete(v55);
if ( v32 >= (unsigned int)cocos2d::CCArray::count(v9) )
return *(_QWORD *)v46;
}
}