//
// GJSmartTemplate::saveRemapToDict from 0x1403b7350 to 0x1403b7534 (484 bytes)
//
// 8 xrefs:
// > GJSmartTemplate::saveRemap @ 0x1403b6fed
// > GJSmartTemplate::saveRemap @ 0x1403b7031
// > GJSmartTemplate::saveRemap @ 0x1403b7076
// > GJSmartTemplate::saveRemap @ 0x1403b7173
// > GJSmartTemplate::saveRemap @ 0x1403b71b7
// > GJSmartTemplate::saveRemap @ 0x1403b729f
// > GJSmartTemplate::saveRemap @ 0x1403b72e3
// > ??> @ 0x140923cfc
//
// 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 11:31:25 +0000
//
// Hidden C++ exception states: #wind=2
void __fastcall GJSmartTemplate::saveRemapToDict(__int64 a1, __int64 a2, const void **a3, __int64 a4)
{
__int64 v7; // rcx
cocos2d::CCArray *v8; // r12
unsigned int v9; // r15d
cocos2d::CCString *v10; // rax
const char *CString; // rax
size_t v12; // r8
const void *v13; // rdx
void **v14; // rcx
char *v15; // rdi
unsigned __int64 v16; // r13
const void *v17; // r14
size_t v18; // rbp
size_t v19; // r8
int v20; // ebx
char *v21; // rax
struct cocos2d::CCObject *v22; // rax
void *Buf1[2]; // [rsp+48h] [rbp-60h] BYREF
size_t v25; // [rsp+58h] [rbp-50h]
unsigned __int64 v26; // [rsp+60h] [rbp-48h]
if ( *(_QWORD *)(a2 + 16) )
{
v8 = (cocos2d::CCArray *)cocos2d::CCDictionary::objectForKey(a4, a2);
if ( !v8 )
{
v8 = (cocos2d::CCArray *)cocos2d::CCArray::create(v7);
cocos2d::CCDictionary::setObject(a4, v8, a2);
}
v9 = 0;
if ( cocos2d::CCArray::count(v8) )
{
while ( 1 )
{
v10 = cocos2d::CCArray::stringAtIndex(v8, v9);
CString = cocos2d::CCString::getCString(v10);
*(_OWORD *)Buf1 = 0;
v25 = 0;
v26 = 0;
v12 = -1;
do
++v12;
while ( CString[v12] );
sub_14003D230(Buf1, CString, v12);
v13 = a3;
if ( (unsigned __int64)a3[3] > 0xF )
v13 = *a3;
v14 = Buf1;
v15 = (char *)Buf1[0];
v16 = v26;
if ( v26 > 0xF )
v14 = (void **)Buf1[0];
v17 = a3[2];
v18 = v25;
v19 = v25;
if ( (unsigned __int64)v17 < v25 )
v19 = (size_t)a3[2];
v20 = memcmp(v14, v13, v19);
if ( !v20 )
{
if ( v18 >= (unsigned __int64)v17 )
v20 = v18 > (unsigned __int64)v17;
else
v20 = -1;
}
if ( v16 > 0xF )
{
v21 = v15;
if ( v16 + 1 >= 0x1000 )
{
v15 = *((char **)v15 - 1);
if ( (unsigned __int64)(v21 - v15 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v15);
}
if ( !v20 )
break;
if ( ++v9 >= cocos2d::CCArray::count(v8) )
goto LABEL_25;
}
}
else
{
LABEL_25:
v22 = (struct cocos2d::CCObject *)cocos2d::CCString::create(a3);
cocos2d::CCArray::addObject(v8, v22);
}
}
sub_14003D310(a2);
sub_14003D310((__int64)a3);
}