//
// GJSmartTemplate::saveRemapToDict from 0x100423480 to 0x10042366e (494 bytes)
//
// 7 xrefs:
// > GJSmartTemplate::saveRemap @ 0x10042242d
// > GJSmartTemplate::saveRemap @ 0x1004224f4
// > GJSmartTemplate::saveRemap @ 0x1004225d9
// > GJSmartTemplate::saveRemap @ 0x10042277c
// > GJSmartTemplate::saveRemap @ 0x100422849
// > GJSmartTemplate::saveRemap @ 0x100422998
// > GJSmartTemplate::saveRemap @ 0x100422a95
//
// 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
//
void __fastcall GJSmartTemplate::saveRemapToDict(double a1, __int64 a2, char *a3, unsigned __int8 *a4, __int64 a5)
{
unsigned int v6; // eax
__int64 v8; // rax
cocos2d::CCArray *v9; // rbx
unsigned int v10; // r15d
cocos2d::CCString *v11; // rax
const char *CString; // r13
size_t v13; // rax
size_t v14; // r12
char *v15; // rbx
__int64 v16; // rax
size_t v17; // r14
unsigned int v18; // eax
void *v19; // r12
size_t v20; // rdx
char *v21; // rdi
size_t v22; // rax
unsigned __int8 *v23; // rsi
bool v24; // zf
bool v25; // r14
bool v26; // r13
__int64 v27; // rax
cocos2d::CCArray *v28; // [rsp+8h] [rbp-58h]
unsigned __int8 *v29; // [rsp+10h] [rbp-50h]
size_t __dst; // [rsp+18h] [rbp-48h] BYREF
size_t v31; // [rsp+20h] [rbp-40h]
void *__p; // [rsp+28h] [rbp-38h]
unsigned __int8 *v33; // [rsp+30h] [rbp-30h]
v33 = a4;
v6 = (unsigned __int8)*a3;
if ( (v6 & 1) == 0 )
{
if ( !(v6 >> 1) )
return;
goto LABEL_5;
}
if ( *((_QWORD *)a3 + 1) )
{
LABEL_5:
v8 = cocos2d::CCDictionary::objectForKey_1(a5, a3);
v9 = (cocos2d::CCArray *)v8;
if ( v8 )
{
if ( !(unsigned int)sub_100720070(v8) )
goto LABEL_29;
}
else
{
v9 = (cocos2d::CCArray *)sub_10071F9E0(a5, a3);
cocos2d::CCDictionary::setObject_1(a5, v9, a3);
if ( !(unsigned int)sub_100720070(v9) )
{
LABEL_29:
v27 = sub_1007AB360(v33);
sub_10071FCD0(v9, v27);
return;
}
}
v29 = v33 + 1;
v10 = 0;
v28 = v9;
while ( 1 )
{
v11 = cocos2d::CCArray::stringAtIndex(v9, v10);
CString = cocos2d::CCString::getCString(v11);
v13 = strlen(CString);
if ( v13 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(a1);
v14 = v13;
if ( v13 >= 0x17 )
break;
LOBYTE(__dst) = 2 * v13;
v15 = (char *)&__dst + 1;
if ( v13 )
goto LABEL_17;
LABEL_18:
v15[v14] = 0;
v18 = *v33;
v19 = __p;
if ( (__dst & 1) != 0 )
{
v20 = v31;
v21 = (char *)__p;
if ( (v18 & 1) == 0 )
goto LABEL_20;
}
else
{
v20 = (unsigned __int8)__dst >> 1;
v21 = (char *)&__dst + 1;
if ( (v18 & 1) == 0 )
{
LABEL_20:
v22 = v18 >> 1;
v23 = v29;
goto LABEL_23;
}
}
v22 = *((_QWORD *)v33 + 1);
v23 = *((unsigned __int8 **)v33 + 2);
LABEL_23:
v24 = v22 == v20;
if ( v22 < v20 )
v20 = v22;
v25 = v24;
v26 = memcmp(v21, v23, v20) == 0;
if ( (__dst & 1) != 0 )
operator delete(v19);
if ( v25 && v26 )
return;
++v10;
v9 = v28;
if ( v10 >= (unsigned int)sub_100720070(v28) )
goto LABEL_29;
}
v16 = v13 | 7;
v17 = 26;
if ( (v14 | 7) != 0x17 )
v17 = v16 + 1;
v15 = (char *)operator new(v17);
__p = v15;
__dst = v17 + 1;
v31 = v14;
LABEL_17:
memmove(v15, CString, v14);
goto LABEL_18;
}
}