//
// cocos2d::CCDictMaker::startElement from 0xb08acc to 0xb08fcc (1280 bytes)
//
// 2 xrefs:
// > ??> @ 0x56b98
// > ??> @ 0x1217a60
//
// 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 __fastcall cocos2d::CCDictMaker::startElement(cocos2d::CCDictMaker *this, void *a2, char *a3, const char **a4)
{
cocos2d::CCDictionary *v5; // x23
__int64 v6; // x0
__int64 v7; // x1
cocos2d::CCObject *v8; // x2
int v9; // w0
char *v10; // x0
_DWORD *v11; // x1
char *v12; // x0
_QWORD *v13; // x1
__int64 v14; // x1
void *v15; // x0
unsigned int *v17; // x1
int v18; // w2
__int64 v19; // x1
__int64 v20; // x24
char *v21; // x0
cocos2d::CCObject *v22; // x23
unsigned int *v23; // x1
int v24; // w2
cocos2d::CCArray *v25; // x21
__int64 v26; // x0
int v27; // w0
_DWORD *v28; // x1
_QWORD *v29; // x1
__int64 v30; // x0
cocos2d::CCObject *v31; // x2
__int64 v32; // x24
cocos2d::CCObject *v33; // x23
__int64 v34; // [xsp+58h] [xbp+58h] BYREF
const char *v35; // [xsp+60h] [xbp+60h] BYREF
sub_D153B8((int)&v34, a3);
if ( !(unsigned int)sub_D171E0((int)&v34, "dict") )
{
v5 = (cocos2d::CCDictionary *)operator new(0x48u);
cocos2d::CCDictionary::CCDictionary(v5);
*((_QWORD *)this + 4) = v5;
if ( *((_DWORD *)this + 2) == 1 && !*((_QWORD *)this + 3) )
{
*((_QWORD *)this + 3) = v5;
cocos2d::CCObject::retain(v5);
v5 = *((cocos2d::CCDictionary **)this + 4);
}
v6 = *((_QWORD *)this + 35);
v7 = *((_QWORD *)this + 31);
*((_DWORD *)this + 34) = 2;
if ( v6 != v7 )
{
v8 = *((cocos2d::CCObject **)this + 36);
if ( (cocos2d::CCObject *)v6 == v8 )
v6 = *(_QWORD *)(*((_QWORD *)this + 38) - 8LL) + 512LL;
v9 = *(_DWORD *)(v6 - 4);
if ( v9 == 6 )
{
cocos2d::CCArray::addObject(*((cocos2d::CCArray **)this + 18), (cocos2d::_ccArray *)v5, v8);
v5 = *((cocos2d::CCDictionary **)this + 4);
}
else if ( v9 == 2 )
{
v19 = *((_QWORD *)this + 11);
if ( v19 == *((_QWORD *)this + 12) )
v19 = *(_QWORD *)(*((_QWORD *)this + 14) - 8LL) + 512LL;
v20 = *(_QWORD *)(v19 - 8);
sub_D153B8((int)&v35, *((char **)this + 15));
cocos2d::CCDictionary::setObject(v20, v5, &v35);
v21 = (char *)(v35 - 24);
if ( v35 - 24 == (const char *)&qword_124B6B0 )
goto LABEL_33;
if ( &pthread_create )
{
v23 = (unsigned int *)(v35 - 8);
do
v24 = __ldaxr(v23);
while ( __stlxr(v24 - 1, v23) );
}
else
{
v24 = *((_DWORD *)v35 - 2);
*((_DWORD *)v35 - 2) = v24 - 1;
}
if ( v24 > 0 )
{
LABEL_33:
v22 = *((cocos2d::CCObject **)this + 4);
}
else
{
operator delete(v21);
v22 = *((cocos2d::CCObject **)this + 4);
}
cocos2d::CCObject::release(v22);
v10 = (char *)this + 232;
v11 = *((_DWORD **)this + 35);
if ( v11 != (_DWORD *)(*((_QWORD *)this + 37) - 4LL) )
goto LABEL_9;
goto LABEL_37;
}
}
cocos2d::CCObject::release(v5);
v10 = (char *)this + 232;
v11 = *((_DWORD **)this + 35);
if ( v11 != (_DWORD *)(*((_QWORD *)this + 37) - 4LL) )
{
LABEL_9:
if ( v11 )
*v11 = *((_DWORD *)this + 34);
*((_QWORD *)v10 + 6) = v11 + 1;
goto LABEL_12;
}
LABEL_37:
std::deque::_M_push_back_aux((__int64)v10, (_DWORD *)this + 34);
LABEL_12:
v12 = (char *)this + 40;
v13 = *((_QWORD **)this + 11);
if ( v13 != (_QWORD *)(*((_QWORD *)this + 13) - 8LL) )
{
if ( !v13 )
{
LABEL_16:
*((_QWORD *)v12 + 6) = v13 + 1;
goto LABEL_17;
}
*v13 = *((_QWORD *)this + 4);
LABEL_15:
v13 = *((_QWORD **)v12 + 6);
goto LABEL_16;
}
std::deque::_M_push_back_aux(
(__int64)v12,
(_QWORD *)this + 4);
goto LABEL_17;
}
if ( (unsigned int)sub_D171E0((int)&v34, "key") )
{
if ( (unsigned int)sub_D171E0((int)&v34, "integer") )
{
if ( (unsigned int)sub_D171E0((int)&v34, "real") )
{
if ( (unsigned int)sub_D171E0((int)&v34, "string") )
{
if ( (unsigned int)sub_D171E0((int)&v34, "array") )
{
*((_DWORD *)this + 34) = 0;
}
else
{
*((_DWORD *)this + 34) = 6;
v25 = (cocos2d::CCArray *)operator new(0x40u);
cocos2d::CCArray::CCArray(v25);
*((_QWORD *)this + 18) = v25;
if ( *((_DWORD *)this + 2) == 2 && !*((_QWORD *)this + 2) )
{
*((_QWORD *)this + 2) = v25;
cocos2d::CCObject::retain(v25);
}
v26 = *((_QWORD *)this + 35);
if ( v26 != *((_QWORD *)this + 31) )
{
if ( v26 == *((_QWORD *)this + 36) )
v26 = *(_QWORD *)(*((_QWORD *)this + 38) - 8LL) + 512LL;
v27 = *(_DWORD *)(v26 - 4);
if ( v27 == 2 )
{
v32 = *((_QWORD *)this + 4);
v33 = *((cocos2d::CCObject **)this + 18);
sub_D153B8((int)&v35, *((char **)this + 15));
cocos2d::CCDictionary::setObject(v32, v33, &v35);
if ( v35 - 24 != (const char *)&qword_124B6B0 )
sub_4DDDE8((void *)(v35 - 24));
}
else if ( v27 == 6 )
{
v30 = *((_QWORD *)this + 25);
v31 = *((cocos2d::CCObject **)this + 26);
if ( (cocos2d::CCObject *)v30 == v31 )
v30 = *(_QWORD *)(*((_QWORD *)this + 28) - 8LL) + 512LL;
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(v30 - 8), *((cocos2d::_ccArray **)this + 18), v31);
}
}
cocos2d::CCObject::release(*((cocos2d::CCObject **)this + 18));
v28 = *((_DWORD **)this + 35);
if ( v28 == (_DWORD *)(*((_QWORD *)this + 37) - 4LL) )
{
std::deque::_M_push_back_aux(
(__int64)this + 232,
(_DWORD *)this + 34);
}
else
{
if ( v28 )
*v28 = *((_DWORD *)this + 34);
*((_QWORD *)this + 35) = v28 + 1;
}
v12 = (char *)this + 152;
v29 = *((_QWORD **)this + 25);
if ( v29 != (_QWORD *)(*((_QWORD *)this + 27) - 8LL) )
{
if ( v29 )
*v29 = *((_QWORD *)this + 18);
goto LABEL_15;
}
std::deque::_M_push_back_aux(
(__int64)v12,
(_QWORD *)this + 18);
}
}
else
{
*((_DWORD *)this + 34) = 5;
}
}
else
{
*((_DWORD *)this + 34) = 4;
}
}
else
{
*((_DWORD *)this + 34) = 3;
}
LABEL_17:
v14 = v34;
v15 = (void *)(v34 - 24);
if ( (__int64 *)(v34 - 24) == &qword_124B6B0 )
return _stack_chk_guard;
goto LABEL_21;
}
*((_DWORD *)this + 34) = 1;
v14 = v34;
v15 = (void *)(v34 - 24);
if ( (__int64 *)(v34 - 24) == &qword_124B6B0 )
return _stack_chk_guard;
LABEL_21:
if ( &pthread_create )
{
v17 = (unsigned int *)(v14 - 8);
do
v18 = __ldaxr(v17);
while ( __stlxr(v18 - 1, v17) );
}
else
{
v18 = *(_DWORD *)(v14 - 8);
*(_DWORD *)(v14 - 8) = v18 - 1;
}
if ( v18 <= 0 )
operator delete(v15);
return _stack_chk_guard;
}