//
// GJSmartTemplate::getTemplateState from 0x6720bc to 0x6722d8 (540 bytes)
//
// 1 xrefs:
// > BrowseSmartTemplateLayer::init @ 0x675604
//
// 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:55:53 +0000
//
unsigned int __fastcall GJSmartTemplate::getTemplateState(cocos2d::CCDictionary *a1, int *a2)
{
unsigned int v3; // r8
cocos2d::CCNode *v4; // r5
cocos2d::CCNode *v5; // r0
unsigned int result; // r0
cocos2d::CCString *v7; // r0
const char *CString; // r0
const char *v9; // r5
size_t v10; // r0
cocos2d::CCArray *v11; // r6
cocos2d::CCArray *v12; // r0
int v13; // r0
int v14; // r1
_BYTE *v15; // r3
int v16; // r0
int v17; // r1
SmartPrefabResult *v18; // r0
cocos2d::CCArray *v20; // [sp+18h] [bp-20h]
int v21[3]; // [sp+20h] [bp-18h] BYREF
int v22[3]; // [sp+2Ch] [bp-Ch] BYREF
int v23[3]; // [sp+38h] [bp+0h] BYREF
int v24[3]; // [sp+44h] [bp+Ch] BYREF
int v25[3]; // [sp+50h] [bp+18h] BYREF
int v26[8]; // [sp+5Ch] [bp+24h] BYREF
int v27; // [sp+7Ch] [bp+44h] BYREF
int v28; // [sp+80h] [bp+48h] BYREF
int v29; // [sp+84h] [bp+4Ch]
_BYTE *v30; // [sp+88h] [bp+50h]
int v31; // [sp+8Ch] [bp+54h] BYREF
int v32; // [sp+90h] [bp+58h]
_BYTE *v33; // [sp+94h] [bp+5Ch]
int v34; // [sp+98h] [bp+60h]
char isUnrequired; // [sp+9Ch] [bp+64h]
int v36; // [sp+A0h] [bp+68h]
char v37; // [sp+A4h] [bp+6Ch]
char v38; // [sp+A5h] [bp+6Dh]
char v39; // [sp+A6h] [bp+6Eh]
int v40; // [sp+A8h] [bp+70h] BYREF
int v41; // [sp+ACh] [bp+74h]
int v42; // [sp+B0h] [bp+78h]
_BYTE *v43; // [sp+B4h] [bp+7Ch]
int v44; // [sp+B8h] [bp+80h]
int v45; // [sp+BCh] [bp+84h]
_BYTE *v46; // [sp+C0h] [bp+88h]
int v47; // [sp+C4h] [bp+8Ch]
char v48; // [sp+C8h] [bp+90h]
int v49; // [sp+CCh] [bp+94h]
char v50; // [sp+D0h] [bp+98h]
char v51; // [sp+D1h] [bp+99h]
char v52; // [sp+D2h] [bp+9Ah]
v3 = 0;
v4 = (cocos2d::CCNode *)cocos2d::CCDictionary::create(a1);
v5 = (cocos2d::CCNode *)cocos2d::CCNode::create(v4);
generateAllBinaryStrings(8, v26, 0, v4, v5);
v20 = (cocos2d::CCArray *)cocos2d::CCDictionary::allKeys(v4);
while ( 1 )
{
result = cocos2d::CCArray::count(v20);
if ( v3 >= result )
break;
v7 = (cocos2d::CCString *)cocos2d::CCArray::stringAtIndex(v20, v3);
CString = (const char *)cocos2d::CCString::getCString(v7);
memset(v21, 0, sizeof(v21));
v9 = CString;
v10 = strlen(CString);
std::string::__init(v21, v9, v10);
std::string::basic_string(v23, (int)v21);
prefabKeyFromBinary(v22, (unsigned __int8 *)v23);
std::string::~string((int)v23);
v11 = (cocos2d::CCArray *)cocos2d::CCDictionary::objectForKey(*((_DWORD *)a1 + 13), v22);
SmartPrefabResult::SmartPrefabResult((SmartPrefabResult *)&v27);
std::string::operator=((unsigned __int8 *)&v28, (unsigned __int8 *)v22);
std::string::operator=((unsigned __int8 *)&v31, (unsigned __int8 *)v22);
v12 = v11;
if ( v11 )
v12 = (cocos2d::CCArray *)cocos2d::CCArray::count(v11);
v34 = (int)v12;
std::string::basic_string(v24, (int)v22);
isUnrequired = GJSmartTemplate::isUnrequired((int)a1, (unsigned __int8 *)v24);
std::string::~string((int)v24);
if ( v34 <= 0 && !isUnrequired )
{
std::string::basic_string(v25, (int)v22);
GJSmartTemplate::scanForPrefab((SmartPrefabResult *)&v40, (int)a1, v25);
v27 = v40;
if ( (v28 & 1) != 0 )
{
*v30 = 0;
v29 = 0;
}
else
{
LOWORD(v28) = 0;
}
std::string::reserve(&v28, 0);
v13 = v41;
v14 = v42;
v41 = 0;
v42 = 0;
v28 = v13;
v29 = v14;
v30 = v43;
v43 = nullptr;
v15 = (_BYTE *)(v31 & 1);
if ( (v31 & 1) != 0 )
v15 = v33;
else
BYTE1(v31) = v31 & 1;
if ( (v31 & 1) != 0 )
{
*v15 = 0;
v32 = 0;
}
else
{
LOBYTE(v31) = (_BYTE)v15;
}
std::string::reserve(&v31, 0);
v16 = v44;
v17 = v45;
v44 = 0;
v45 = 0;
v31 = v16;
v32 = v17;
v33 = v46;
v46 = nullptr;
v34 = v47;
isUnrequired = v48;
v36 = v49;
v37 = v50;
v38 = v51;
v39 = v52;
SmartPrefabResult::~SmartPrefabResult((SmartPrefabResult *)&v40);
std::string::~string((int)v25);
}
v18 = (SmartPrefabResult *)a2[1];
if ( v18 == (SmartPrefabResult *)a2[2] )
{
std::vector::__push_back_slow_path(
a2,
(const SmartPrefabResult *)&v27);
}
else
{
if ( v18 )
SmartPrefabResult::SmartPrefabResult(v18, (const SmartPrefabResult *)&v27);
a2[1] += 44;
}
++v3;
SmartPrefabResult::~SmartPrefabResult((SmartPrefabResult *)&v27);
std::string::~string((int)v22);
std::string::~string((int)v21);
}
return result;
}