//
// GJSmartTemplate::generateRemapDict from 0x9db3f0 to 0x9dba50 (1632 bytes)
//
// 1 xrefs:
// > ??> @ 0xaf2a8
//
// 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 *GJSmartTemplate::generateRemapDict()
{
unsigned int v0; // w20
cocos2d::CCDictionary *v1; // x21
cocos2d::CCNode *v2; // x0
cocos2d::CCString *v3; // x0
char *CString; // x0
unsigned __int8 *v5; // x1
unsigned __int64 v6; // x2
unsigned int v7; // w21
unsigned int v8; // w23
_BOOL4 v9; // w24
_BOOL4 v10; // w22
int v11; // w28
_BOOL4 v12; // w26
_BOOL4 v13; // w0
unsigned __int8 v14; // w25
unsigned __int8 *v15; // x21
unsigned int *v17; // x1
int v18; // w0
void *v19; // x0
const std::string *v20; // x1
cocos2d::CCObject *v21; // x0
void *v22; // x0
void *v23; // x0
unsigned int *v24; // x1
int v25; // w2
unsigned int *v26; // x1
int v27; // w2
unsigned int *v28; // x1
int v29; // w2
bool v30; // [xsp+0h] [xbp+0h]
cocos2d::CCDictionary *v31; // [xsp+70h] [xbp+70h]
cocos2d::CCArray *v32; // [xsp+80h] [xbp+80h]
unsigned __int8 v33; // [xsp+88h] [xbp+88h]
_BOOL4 v34; // [xsp+8Ch] [xbp+8Ch]
unsigned __int8 *v35; // [xsp+A0h] [xbp+A0h] BYREF
__int64 v36; // [xsp+A8h] [xbp+A8h] BYREF
__int64 v37; // [xsp+B0h] [xbp+B0h] BYREF
int v38[8]; // [xsp+B8h] [xbp+B8h] BYREF
v0 = 0;
v31 = cocos2d::CCDictionary::create();
v1 = cocos2d::CCDictionary::create();
v2 = cocos2d::CCNode::create();
generateAllBinaryStrings(8, v38, 0, v1, v2);
v32 = cocos2d::CCDictionary::allKeys(v1);
if ( (unsigned int)cocos2d::CCArray::count(v32) )
{
while ( 1 )
{
v3 = cocos2d::CCArray::stringAtIndex(v32, v0);
CString = (char *)cocos2d::CCString::getCString(v3);
sub_D153B8((int)&v35, CString);
v5 = v35;
v6 = *((_QWORD *)v35 - 3);
if ( !v6 )
sub_D13C5C("basic_string::at: __n (which is %zu) >= this->size() (which is %zu)", 0, 0);
if ( (*((_DWORD *)v35 - 2) & 0x80000000) != 0 )
break;
sub_D176A8(&v35);
v5 = v35;
v6 = *((_QWORD *)v35 - 3);
v7 = *v35 != 48;
if ( v6 <= 1 )
goto LABEL_76;
if ( (*((_DWORD *)v35 - 2) & 0x80000000) != 0 )
goto LABEL_49;
sub_D176A8(&v35);
v5 = v35;
v6 = *((_QWORD *)v35 - 3);
v8 = v35[1] != 48;
if ( v6 <= 2 )
goto LABEL_80;
if ( (*((_DWORD *)v35 - 2) & 0x80000000) != 0 )
goto LABEL_50;
sub_D176A8(&v35);
v5 = v35;
v6 = *((_QWORD *)v35 - 3);
v34 = v35[2] != 48;
if ( v6 <= 3 )
goto LABEL_79;
if ( (*((_DWORD *)v35 - 2) & 0x80000000) != 0 )
goto LABEL_51;
sub_D176A8(&v35);
v5 = v35;
v6 = *((_QWORD *)v35 - 3);
v9 = v35[3] != 48;
if ( v6 <= 4 )
goto LABEL_82;
if ( (*((_DWORD *)v35 - 2) & 0x80000000) != 0 )
goto LABEL_52;
sub_D176A8(&v35);
v5 = v35;
v6 = *((_QWORD *)v35 - 3);
v10 = v35[4] != 48;
if ( v6 <= 5 )
goto LABEL_81;
if ( (*((_DWORD *)v35 - 2) & 0x80000000) != 0 )
goto LABEL_53;
sub_D176A8(&v35);
v5 = v35;
v6 = *((_QWORD *)v35 - 3);
v11 = v35[5];
if ( v6 <= 6 )
goto LABEL_78;
if ( (*((_DWORD *)v35 - 2) & 0x80000000) == 0 )
{
sub_D176A8(&v35);
v5 = v35;
v6 = *((_QWORD *)v35 - 3);
v12 = v35[6] != 48;
if ( v6 <= 7 )
goto LABEL_55;
if ( (*((_DWORD *)v35 - 2) & 0x80000000) == 0 )
{
sub_D176A8(&v35);
v5 = v35;
}
goto LABEL_19;
}
LABEL_54:
v12 = v5[6] != 48;
if ( v6 == 7 )
LABEL_55:
sub_D13C5C("basic_string::at: __n (which is %zu) >= this->size() (which is %zu)", 7u, v6);
LABEL_19:
v13 = 0;
v14 = v5[7] != 48;
if ( v10 )
{
v13 = !v34 >= v7;
if ( !v34 >= v7 )
LOBYTE(v10) = 0;
}
v33 = 0;
if ( v11 != 48 )
{
if ( !v9 >= v7 )
v13 = 1;
v33 = !v9 < v7;
}
if ( v12 && v8 <= !v34 )
{
LOBYTE(v12) = 0;
if ( v5[7] == 48 )
goto LABEL_44;
v13 = 1;
LOBYTE(v12) = 0;
if ( v8 <= !v9 )
{
LABEL_43:
v14 = 0;
LABEL_44:
sub_D18D28(&v37);
prefabKeyFromBinary((__int64)&v37, (__int64)&v36);
v19 = (void *)(v37 - 24);
if ( (__int64 *)(v37 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v28 = (unsigned int *)(v37 - 8);
do
v29 = __ldaxr(v28);
while ( __stlxr(v29 - 1, v28) );
}
else
{
v29 = *(_DWORD *)(v37 - 8);
*(_DWORD *)(v37 - 8) = v29 - 1;
}
if ( v29 <= 0 )
operator delete(v19);
}
GJSmartTemplate::keyFromNeighborsOld(
(GJSmartTemplate *)v7,
v8,
v34,
v9,
v10,
v33,
v12,
v14,
(__int64)&v37,
v30);
v21 = (cocos2d::CCObject *)cocos2d::CCString::create((cocos2d::CCString *)&v37, v20);
cocos2d::CCDictionary::setObject((int)v31, v21);
v22 = (void *)(v37 - 24);
if ( (__int64 *)(v37 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v26 = (unsigned int *)(v37 - 8);
do
v27 = __ldaxr(v26);
while ( __stlxr(v27 - 1, v26) );
}
else
{
v27 = *(_DWORD *)(v37 - 8);
*(_DWORD *)(v37 - 8) = v27 - 1;
}
if ( v27 <= 0 )
operator delete(v22);
}
v23 = (void *)(v36 - 24);
if ( (__int64 *)(v36 - 24) == &qword_124B6B0 )
goto LABEL_47;
if ( &pthread_create )
{
v24 = (unsigned int *)(v36 - 8);
do
v25 = __ldaxr(v24);
while ( __stlxr(v25 - 1, v24) );
}
else
{
v25 = *(_DWORD *)(v36 - 8);
*(_DWORD *)(v36 - 8) = v25 - 1;
}
if ( v25 > 0 )
{
LABEL_47:
v5 = v35;
}
else
{
operator delete(v23);
v5 = v35;
}
goto LABEL_32;
}
goto LABEL_30;
}
if ( v5[7] != 48 )
{
if ( v8 <= !v9 )
goto LABEL_43;
LABEL_30:
v14 = 1;
}
if ( v13 )
goto LABEL_44;
LABEL_32:
v15 = v5 - 24;
if ( v5 - 24 == (unsigned __int8 *)&qword_124B6B0 )
goto LABEL_33;
if ( &pthread_create )
{
v17 = (unsigned int *)(v5 - 8);
do
v18 = __ldaxr(v17);
while ( __stlxr(v18 - 1, v17) );
}
else
{
v18 = *((_DWORD *)v5 - 2);
*((_DWORD *)v5 - 2) = v18 - 1;
}
if ( v18 > 0 )
{
LABEL_33:
++v0;
}
else
{
++v0;
operator delete(v15);
}
if ( v0 >= (unsigned int)cocos2d::CCArray::count(v32) )
return v31;
}
v7 = *v35 != 48;
if ( v6 <= 1 )
{
v6 = 1;
LABEL_76:
sub_D13C5C("basic_string::at: __n (which is %zu) >= this->size() (which is %zu)", 1u, v6);
}
LABEL_49:
v8 = v5[1] != 48;
if ( v6 == 2 )
LABEL_80:
sub_D13C5C("basic_string::at: __n (which is %zu) >= this->size() (which is %zu)", 2u, v6);
LABEL_50:
v34 = v5[2] != 48;
if ( v6 == 3 )
LABEL_79:
sub_D13C5C("basic_string::at: __n (which is %zu) >= this->size() (which is %zu)", 3u, v6);
LABEL_51:
v9 = v5[3] != 48;
if ( v6 == 4 )
LABEL_82:
sub_D13C5C("basic_string::at: __n (which is %zu) >= this->size() (which is %zu)", 4u, v6);
LABEL_52:
v10 = v5[4] != 48;
if ( v6 == 5 )
LABEL_81:
sub_D13C5C("basic_string::at: __n (which is %zu) >= this->size() (which is %zu)", 5u, v6);
LABEL_53:
v11 = v5[5];
if ( v6 == 6 )
LABEL_78:
sub_D13C5C("basic_string::at: __n (which is %zu) >= this->size() (which is %zu)", 6u, v6);
goto LABEL_54;
}
return v31;
}