//
// LevelTools::createStarPackDict from 0x100501ec0 to 0x10050229f (991 bytes)
//
// 1 xrefs:
// > GameManager::recountUserStats @ 0x100385ec0
//
// 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
//
cocos2d::CCDictionary *__fastcall LevelTools::createStarPackDict()
{
double v0; // xmm0_8
char *v1; // r15
__int64 v2; // rax
__int64 v3; // r14
unsigned __int64 v4; // rbx
bool v5; // zf
unsigned __int64 v6; // r12
char *v7; // r13
size_t v8; // r12
char *v9; // r15
char v10; // al
cocos2d::CCArray *v11; // r12
const char *v12; // r12
unsigned __int64 v13; // r14
size_t v14; // rbx
size_t v15; // rax
size_t v16; // r13
char *v17; // r15
__int64 v18; // r12
unsigned __int64 v19; // r14
size_t v20; // rbx
__int64 v21; // rax
__int64 v22; // r15
__int64 v23; // rbx
char *v24; // rax
unsigned __int64 v25; // rsi
char *v26; // rdx
unsigned __int64 v27; // rdi
unsigned int v28; // r15d
cocos2d::CCString *v29; // rax
int v30; // ebx
cocos2d::CCString *v31; // rax
unsigned int v32; // eax
unsigned int v33; // ecx
cocos2d::CCDictionary *v35; // [rsp+8h] [rbp-88h]
_QWORD v36[2]; // [rsp+10h] [rbp-80h] BYREF
void *__p; // [rsp+20h] [rbp-70h]
cocos2d::CCArray *v38; // [rsp+28h] [rbp-68h]
const char *v39; // [rsp+30h] [rbp-60h]
__int64 __dst; // [rsp+38h] [rbp-58h] BYREF
size_t v41; // [rsp+40h] [rbp-50h]
void *v42; // [rsp+48h] [rbp-48h]
__int64 v43; // [rsp+50h] [rbp-40h] BYREF
unsigned __int64 v44; // [rsp+58h] [rbp-38h]
void *v45; // [rsp+60h] [rbp-30h]
v35 = cocos2d::CCDictionary::create();
v1 = (char *)operator new(0x118u);
v45 = v1;
v43 = 281;
v44 = 279;
strcpy(
v1,
"1,3,2,4,3,4,5,5,6,6,7,6,8,7,9,8,10,8,11,9,19,10,20,10,21,10,22,10,26,10,27,10,28,10,29,10,30,10,31,10,32,4,33,5,34,6"
",35,8,36,8,37,5,38,5,39,6,40,7,41,8,42,8,43,8,44,9,45,6,46,10,47,10,48,10,49,10,50,10,52,4,53,3,54,4,55,4,56,5,57,6,"
"58,7,59,8,60,8,61,8,62,9,63,9,64,10,65,10,66,10");
v2 = sub_10071F9E0(
v1,
"1,3,2,4,3,4,5,5,6,6,7,6,8,7,9,8,10,8,11,9,19,10,20,10,21,10,22,10,26,10,27,10,28,10,29,10,30,10,31,10,32,4,33,5"
",34,6,35,8,36,8,37,5,38,5,39,6,40,7,41,8,42,8,43,8,44,9,45,6,46,10,47,10,48,10,49,10,50,10,52,4,53,3,54,4,55,4,"
"56,5,57,6,58,7,59,8,60,8,61,8,62,9,63,9,64,10,65,10,66,10");
v3 = 2;
while ( 1 )
{
if ( v1[v3 - 2] == 44 )
{
v3 -= 2;
LABEL_8:
if ( v3 != 279 )
goto LABEL_10;
LABEL_9:
v3 = -1;
goto LABEL_10;
}
if ( v1[v3 - 1] == 44 )
break;
if ( v1[v3] == 44 )
goto LABEL_8;
v3 += 3;
if ( v3 == 281 )
goto LABEL_9;
}
if ( --v3 == 279 )
goto LABEL_9;
LABEL_10:
v4 = 0;
v38 = (cocos2d::CCArray *)v2;
do
{
if ( (v43 & 1) != 0 )
{
v6 = v44;
if ( v44 < v4 )
LABEL_65:
sub_1000547C0();
v7 = (char *)v45;
}
else
{
v6 = (unsigned __int8)v43 >> 1;
v7 = (char *)&v43 + 1;
if ( v4 > v6 )
goto LABEL_65;
}
v8 = v6 - v4;
if ( v8 >= v3 - v4 )
v8 = v3 - v4;
if ( v8 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(v0);
if ( v8 >= 0x17 )
{
v39 = (const char *)v3;
v13 = v4;
v14 = (v8 | 7) + 1;
if ( (v8 | 7) == 0x17 )
v14 = 26;
v9 = (char *)operator new(v14);
v42 = v9;
__dst = v14 | 1;
v41 = v8;
v4 = v13;
v3 = (__int64)v39;
}
else
{
LOBYTE(__dst) = 2 * v8;
v9 = (char *)&__dst + 1;
if ( !v8 )
{
BYTE1(__dst) = 0;
v10 = __dst;
if ( (__dst & 1) == 0 )
goto LABEL_23;
goto LABEL_30;
}
}
memmove(v9, &v7[v4], v8);
v9[v8] = 0;
v10 = __dst;
if ( (__dst & 1) == 0 )
{
LABEL_23:
v11 = v38;
if ( !v10 && v4 == 279 )
goto LABEL_43;
v12 = (char *)&__dst + 1;
goto LABEL_33;
}
LABEL_30:
v11 = v38;
if ( !v41 && v4 == 279 )
goto LABEL_43;
v12 = (const char *)v42;
LABEL_33:
v15 = strlen(v12);
if ( v15 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(v0);
v16 = v15;
if ( v15 >= 0x17 )
{
v39 = v12;
v18 = v3;
v19 = v4;
v20 = (v15 | 7) + 1;
if ( (v15 | 7) == 0x17 )
v20 = 26;
v17 = (char *)operator new(v20);
__p = v17;
v36[0] = v20 | 1;
v36[1] = v16;
v4 = v19;
v3 = v18;
v12 = v39;
LABEL_40:
memmove(v17, v12, v16);
goto LABEL_41;
}
LOBYTE(v36[0]) = 2 * v15;
v17 = (char *)v36 + 1;
if ( v15 )
goto LABEL_40;
LABEL_41:
v17[v16] = 0;
v21 = sub_1007AB360(v36);
v11 = v38;
sub_10071FCD0(v38, v21);
if ( (v36[0] & 1) != 0 )
operator delete(__p);
LABEL_43:
v22 = v4;
v23 = -1;
if ( v3 == -1 )
goto LABEL_44;
if ( (v43 & 1) != 0 )
{
v24 = (char *)v45;
v25 = v44;
v22 = v3 + 1;
if ( v44 <= v3 + 1 )
goto LABEL_44;
}
else
{
v25 = (unsigned __int8)v43 >> 1;
v24 = (char *)&v43 + 1;
v22 = v3 + 1;
if ( v25 <= v3 + 1 )
goto LABEL_44;
}
v26 = &v24[v22];
v27 = v25 + ~v3;
while ( *v26 != 44 )
{
++v26;
if ( !--v27 )
{
v26 = &v24[v25];
break;
}
}
v23 = v26 - v24;
if ( v26 == &v24[v25] )
v23 = -1;
LABEL_44:
if ( (__dst & 1) != 0 )
operator delete(v42);
v5 = v3 == -1;
v3 = v23;
v4 = v22;
}
while ( !v5 );
if ( (v43 & 1) != 0 )
operator delete(v45);
if ( (unsigned int)sub_100720070(v11) >= 2 )
{
v28 = 0;
do
{
v29 = cocos2d::CCArray::stringAtIndex(v11, v28);
v30 = cocos2d::CCString::intValue(v29);
v31 = cocos2d::CCArray::stringAtIndex(v11, v28 + 1);
cocos2d::CCDictionary::setObject(v35, v31, v30);
v32 = sub_100720070(v11);
v33 = v28 + 3;
v28 += 2;
}
while ( v33 < v32 );
}
return v35;
}