//
// GJSmartTemplate::logTemplateStatus from 0x9da654 to 0x9daa84 (1072 bytes)
//
// 3 xrefs:
// > EditorUI::addObjectsToSmartTemplate @ 0x6b46e8
// > SetupSmartTemplateLayer::init @ 0x9de1d0
// > ??> @ 0x8c448
//
// 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
//
__int64 *__usercall GJSmartTemplate::logTemplateStatus@(__int64 *__return_ptr a1@, GJSmartTemplate *this@)
{
unsigned int v3; // w28
unsigned int v4; // w20
cocos2d::CCDictionary *v5; // x25
cocos2d::CCNode *v6; // x0
cocos2d::CCArray *v7; // x26
stl::StringData::Internal *m_data; // x1
char *v9; // x0
__int64 v10; // x1
void *v11; // x0
cocos2d::CCString *v12; // x0
char *CString; // x0
void *v14; // x0
unsigned __int8 *v15; // x0
cocos2d::CCArray *v16; // x0
cocos2d::CCArray *v17; // x25
_BOOL4 v18; // w0
unsigned int *v19; // x1
int v20; // w2
unsigned int *v21; // x1
int v22; // w2
cocos2d::CCString *v23; // x0
char *v24; // x0
unsigned int *v26; // x1
int v27; // w2
unsigned int *v28; // x1
int v29; // w2
unsigned int v31; // [xsp+68h] [xbp+68h]
unsigned int v32; // [xsp+6Ch] [xbp+6Ch]
unsigned int v33; // [xsp+78h] [xbp+78h]
_BOOL4 isUnrequired; // [xsp+7Ch] [xbp+7Ch]
__int64 v35; // [xsp+88h] [xbp+88h] BYREF
std::string v36; // [xsp+90h] [xbp+90h] BYREF
__int64 v37; // [xsp+98h] [xbp+98h] BYREF
unsigned __int8 *v38; // [xsp+A0h] [xbp+A0h] BYREF
int v39[8]; // [xsp+A8h] [xbp+A8h] BYREF
v3 = 0;
v4 = 0;
v33 = 0;
v31 = 0;
v32 = 0;
v5 = cocos2d::CCDictionary::create();
v6 = cocos2d::CCNode::create();
generateAllBinaryStrings(8, v39, 0, v5, v6);
v7 = cocos2d::CCDictionary::allKeys(v5);
while ( v4 < (unsigned int)cocos2d::CCArray::count(v7) )
{
v12 = cocos2d::CCArray::stringAtIndex(v7, v4);
CString = (char *)cocos2d::CCString::getCString(v12);
sub_D153B8((int)&v35, CString);
sub_D18D28(&v37);
prefabKeyFromBinary((__int64)&v37, (__int64)&v36);
v14 = (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(v14);
}
sub_D18D28(&v38);
isUnrequired = GJSmartTemplate::isUnrequired((__int64)this, &v38);
v15 = v38 - 24;
if ( v38 - 24 != (unsigned __int8 *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v26 = (unsigned int *)(v38 - 8);
do
v27 = __ldaxr(v26);
while ( __stlxr(v27 - 1, v26) );
}
else
{
v27 = *((_DWORD *)v38 - 2);
*((_DWORD *)v38 - 2) = v27 - 1;
}
if ( v27 <= 0 )
operator delete(v15);
}
v16 = (cocos2d::CCArray *)cocos2d::CCDictionary::objectForKey(this->m_prefabArrays, &v36);
v17 = v16;
if ( v16 )
{
++v4;
v18 = cocos2d::CCArray::count(v16) != 0;
if ( isUnrequired )
{
if ( v18 )
{
LABEL_25:
++v32;
v31 += cocos2d::CCArray::count(v17);
}
LABEL_3:
m_data = v36.m_data.m_data;
v9 = (char *)v36.m_data.m_data - 24;
if ( (__int64 *)v36.m_data.m_data - 3 == &qword_124B6B0 )
goto LABEL_4;
goto LABEL_12;
}
++v3;
if ( v18 )
goto LABEL_25;
}
else
{
++v4;
if ( isUnrequired )
goto LABEL_3;
++v3;
}
m_data = v36.m_data.m_data;
++v33;
v9 = (char *)v36.m_data.m_data - 24;
if ( (__int64 *)v36.m_data.m_data - 3 == &qword_124B6B0 )
goto LABEL_4;
LABEL_12:
if ( &pthread_create )
{
v19 = (unsigned int *)((char *)m_data - 8);
do
v20 = __ldaxr(v19);
while ( __stlxr(v20 - 1, v19) );
}
else
{
v20 = *((_DWORD *)m_data - 2);
*((_DWORD *)m_data - 2) = v20 - 1;
}
if ( v20 > 0 )
{
LABEL_4:
v10 = v35;
v11 = (void *)(v35 - 24);
if ( (__int64 *)(v35 - 24) == &qword_124B6B0 )
continue;
goto LABEL_17;
}
operator delete(v9);
v10 = v35;
v11 = (void *)(v35 - 24);
if ( (__int64 *)(v35 - 24) == &qword_124B6B0 )
continue;
LABEL_17:
if ( &pthread_create )
{
v21 = (unsigned int *)(v10 - 8);
do
v22 = __ldaxr(v21);
while ( __stlxr(v22 - 1, v21) );
}
else
{
v22 = *(_DWORD *)(v10 - 8);
*(_DWORD *)(v10 - 8) = v22 - 1;
}
if ( v22 > 0 )
continue;
operator delete(v11);
}
v23 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"Defined: %i / %i(%i), Variations : %i, Required Missing : %i",
(const char *)v32,
v3,
v4,
v31,
v33);
v24 = (char *)cocos2d::CCString::getCString(v23);
sub_D153B8((int)a1, v24);
return a1;
}