//
// SetupSmartBlockLayer::onCreateAll from 0x140458120 to 0x1404583c5 (677 bytes)
//
// 2 xrefs:
// > SetupSmartBlockLayer::init @ 0x1404570ef
// > ??> @ 0x1406daa24
//
// 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
//
// Hidden C++ exception states: #wind=4
void SetupSmartBlockLayer::onCreateAll(SetupSmartBlockLayer *a1, cocos2d::CCObject *a2)
{
__int64 v2; // rax
__int64 v3; // r12
cocos2d::CCDictionary *v4; // rsi
cocos2d::CCArray *v5; // rdi
unsigned int v6; // ebx
cocos2d::CCString *v7; // rax
const char *CString; // rax
size_t v9; // r8
cocos2d::CCArray *v10; // r15
unsigned int v11; // r14d
__int64 v12; // rdx
__int64 v13; // rcx
__int64 v14; // r8
__int64 v15; // r9
struct cocos2d::CCObject *v16; // r13
void **v17; // rsi
unsigned __int64 v18; // rdi
unsigned __int64 v19; // rbx
__int64 v20; // rcx
unsigned int i; // [rsp+20h] [rbp-39h]
void *v22; // [rsp+28h] [rbp-31h]
cocos2d::CCDictionary *v23; // [rsp+28h] [rbp-31h]
__int128 v24; // [rsp+30h] [rbp-29h] BYREF
unsigned __int64 v25; // [rsp+40h] [rbp-19h]
__int64 v26; // [rsp+48h] [rbp-11h]
cocos2d::CCArray *v27; // [rsp+50h] [rbp-9h]
__int128 *v28; // [rsp+58h] [rbp-1h]
void *v29; // [rsp+60h] [rbp+7h]
void *Src[2]; // [rsp+68h] [rbp+Fh] BYREF
unsigned __int64 v31; // [rsp+78h] [rbp+1Fh]
unsigned __int64 v32; // [rsp+80h] [rbp+27h]
v2 = qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v22 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v22);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v2 = qword_1406C2EC0;
}
v3 = *(_QWORD *)(v2 + 960);
if ( v3 )
{
*(_DWORD *)(v3 + 204) = 0;
v4 = *(cocos2d::CCDictionary **)(v3 + 56);
v23 = v4;
if ( v4 )
{
v5 = cocos2d::CCDictionary::allKeys(v4);
v27 = v5;
v6 = 0;
for ( i = 0; v6 < cocos2d::CCArray::count(v5); i = v6 )
{
v7 = cocos2d::CCArray::stringAtIndex(v5, v6);
CString = cocos2d::CCString::getCString(v7);
*(_OWORD *)Src = 0;
v31 = 0;
v32 = 0;
v9 = -1;
do
++v9;
while ( CString[v9] );
sub_14003A930(Src, CString, v9);
v10 = (cocos2d::CCArray *)cocos2d::CCDictionary::objectForKey(v4, Src);
v11 = 0;
if ( cocos2d::CCArray::count(v10) )
{
do
{
v16 = cocos2d::CCArray::objectAtIndex(v10, v11);
v28 = &v24;
v24 = 0;
v25 = 0;
v26 = 0;
v17 = Src;
if ( v32 > 0xF )
v17 = (void **)Src[0];
v18 = v31;
if ( v31 > 0x7FFFFFFFFFFFFFFFLL )
sub_140007B50(v13, v12, v14, v15);
v26 = 15;
if ( v31 > 0xF )
{
v19 = v31 | 0xF;
if ( (v31 | 0xF) <= 0x7FFFFFFFFFFFFFFFLL )
{
if ( v19 < 0x16 )
v19 = 22;
}
else
{
v19 = 0x7FFFFFFFFFFFFFFFLL;
}
*(_QWORD *)&v24 = sub_14003AA10(v19 + 1);
v25 = v18;
v26 = v19;
memcpy((void *)v24, v17, v18 + 1);
}
else
{
v25 = v31;
v24 = *(_OWORD *)v17;
}
v20 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v29 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v29);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v20 = qword_1406C2ED8;
}
EditorUI::createPrefab(*(EditorUI **)(*(_QWORD *)(v20 + 528) + 14496LL), v3, &v24, v16[2].m_uID);
++v11;
}
while ( v11 < cocos2d::CCArray::count(v10) );
v6 = i;
v5 = v27;
v4 = v23;
}
sub_14003A830((__int64)Src);
++v6;
}
}
}
}