//
// GJSmartTemplate::saveRemapToDict from 0x1004100f0 to 0x1004102de (494 bytes)
//
// 7 xrefs:
// > GJSmartTemplate::saveRemap @ 0x10040f09d
// > GJSmartTemplate::saveRemap @ 0x10040f164
// > GJSmartTemplate::saveRemap @ 0x10040f249
// > GJSmartTemplate::saveRemap @ 0x10040f3ec
// > GJSmartTemplate::saveRemap @ 0x10040f4b9
// > GJSmartTemplate::saveRemap @ 0x10040f608
// > GJSmartTemplate::saveRemap @ 0x10040f705
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// 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 12:30:09 +0000
//
void __fastcall GJSmartTemplate::saveRemapToDict(__int64 a1, char *a2, unsigned __int8 *a3, __int64 a4)
{
unsigned int v5; // eax
__int64 v7; // rax
__int64 v8; // rbx
unsigned int v9; // r15d
__int64 v10; // rax
const char *CString; // r13
size_t v12; // rax
size_t v13; // r12
char *v14; // rbx
__int64 v15; // rax
size_t v16; // r14
unsigned int v17; // eax
void *v18; // r12
size_t v19; // rdx
char *v20; // rdi
size_t v21; // rax
unsigned __int8 *v22; // rsi
bool v23; // zf
bool v24; // r14
bool v25; // r13
__int64 v26; // rax
__int64 v27; // [rsp+8h] [rbp-58h]
unsigned __int8 *v28; // [rsp+10h] [rbp-50h]
size_t __dst; // [rsp+18h] [rbp-48h] BYREF
size_t v30; // [rsp+20h] [rbp-40h]
void *__p; // [rsp+28h] [rbp-38h]
unsigned __int8 *v32; // [rsp+30h] [rbp-30h]
v32 = a3;
v5 = (unsigned __int8)*a2;
if ( (v5 & 1) == 0 )
{
if ( !(v5 >> 1) )
return;
goto LABEL_5;
}
if ( *((_QWORD *)a2 + 1) )
{
LABEL_5:
v7 = cocos2d::CCDictionary::objectForKey(a4, a2);
v8 = v7;
if ( v7 )
{
if ( !(unsigned int)sub_1007FEF90(v7) )
goto LABEL_29;
}
else
{
v8 = sub_1007FE900(a4);
cocos2d::CCDictionary::setObject(a4, v8, a2);
if ( !(unsigned int)sub_1007FEF90(v8) )
{
LABEL_29:
v26 = sub_10088E600(v32);
sub_1007FEBF0(v8, v26);
return;
}
}
v28 = v32 + 1;
v9 = 0;
v27 = v8;
while ( 1 )
{
v10 = cocos2d::CCArray::stringAtIndex(v8, v9);
CString = (const char *)cocos2d::CCString::getCString(v10);
v12 = strlen(CString);
if ( v12 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v13 = v12;
if ( v12 >= 0x17 )
break;
LOBYTE(__dst) = 2 * v12;
v14 = (char *)&__dst + 1;
if ( v12 )
goto LABEL_17;
LABEL_18:
v14[v13] = 0;
v17 = *v32;
v18 = __p;
if ( (__dst & 1) != 0 )
{
v19 = v30;
v20 = (char *)__p;
if ( (v17 & 1) == 0 )
goto LABEL_20;
}
else
{
v19 = (unsigned __int8)__dst >> 1;
v20 = (char *)&__dst + 1;
if ( (v17 & 1) == 0 )
{
LABEL_20:
v21 = v17 >> 1;
v22 = v28;
goto LABEL_23;
}
}
v21 = *((_QWORD *)v32 + 1);
v22 = *((unsigned __int8 **)v32 + 2);
LABEL_23:
v23 = v21 == v19;
if ( v21 < v19 )
v19 = v21;
v24 = v23;
v25 = memcmp(v20, v22, v19) == 0;
if ( (__dst & 1) != 0 )
operator delete(v18);
if ( v24 && v25 )
return;
++v9;
v8 = v27;
if ( v9 >= (unsigned int)sub_1007FEF90(v27) )
goto LABEL_29;
}
v15 = v12 | 7;
v16 = 26;
if ( (v13 | 7) != 0x17 )
v16 = v15 + 1;
v14 = (char *)operator new(v16);
__p = v14;
__dst = v16 + 1;
v30 = v13;
LABEL_17:
memmove(v14, CString, v13);
goto LABEL_18;
}
}