//
// GJSmartTemplate::saveRemapToDict from 0xb0bfbc to 0xb0c184 (456 bytes)
//
// 8 xrefs:
// > GJSmartTemplate::saveRemap @ 0xb0f1cc
// > GJSmartTemplate::saveRemap @ 0xb0f254
// > GJSmartTemplate::saveRemap @ 0xb0f2e4
// > GJSmartTemplate::saveRemap @ 0xb0f3b4
// > GJSmartTemplate::saveRemap @ 0xb0f43c
// > GJSmartTemplate::saveRemap @ 0xb0f50c
// > GJSmartTemplate::saveRemap @ 0xb0f598
// > ??> @ 0x51b98
//
// This function is hookable on this platform (idp: arm, 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 13:01:26 +0000
//
__int64 __fastcall GJSmartTemplate::saveRemapToDict(__int64 a1, char *a2, __int64 a3, __int64 a4)
{
unsigned __int8 v6; // w0
__int64 v7; // x1
cocos2d::CCObject *v9; // x23
unsigned int i; // w21
cocos2d::CCString *v11; // x0
const char *CString; // x0
const char *v13; // x24
size_t v14; // x0
size_t v15; // x20
char *v16; // x3
_BOOL4 v17; // w20
cocos2d::CCObject *v18; // x1
unsigned __int64 v19; // x0
__int64 v20; // x22
char *v21; // x0
int v22; // [xsp+58h] [xbp+58h]
__int64 v23; // [xsp+60h] [xbp+60h] BYREF
size_t v24; // [xsp+68h] [xbp+68h]
void *v25; // [xsp+70h] [xbp+70h]
v6 = *a2;
v7 = (unsigned __int8)*a2 >> 1;
if ( (v6 & 1) != 0 )
v7 = *((_QWORD *)a2 + 1);
if ( !v7 )
return _stack_chk_guard;
v22 = a4;
v9 = (cocos2d::CCObject *)cocos2d::CCDictionary::objectForKey(a4, a2);
if ( !v9 )
{
v9 = (cocos2d::CCObject *)cocos2d::CCArray::create(nullptr);
cocos2d::CCDictionary::setObject(v22, v9);
}
for ( i = 0; i < (unsigned int)cocos2d::CCArray::count(v9); ++i )
{
v11 = (cocos2d::CCString *)cocos2d::CCArray::stringAtIndex(v9, i);
CString = (const char *)cocos2d::CCString::getCString(v11);
v23 = 0;
v24 = 0;
v13 = CString;
v25 = nullptr;
v14 = strlen(CString);
v15 = v14;
if ( v14 > 0xFFFFFFFFFFFFFFEFLL )
sub_62ECBC();
if ( v14 > 0x16 )
{
v19 = (v14 + 16) & 0xFFFFFFFFFFFFFFF0LL;
v20 = v19 | 1;
v21 = (char *)operator new(v19);
v23 = v20;
v16 = v21;
v25 = v21;
v24 = v15;
}
else
{
LOBYTE(v23) = 2 * v14;
v16 = (char *)&v23 + 1;
if ( !v14 )
goto LABEL_11;
}
v16 = (char *)memcpy(v16, v13, v15);
LABEL_11:
v16[v15] = 0;
v17 = sub_B0BDB0((__int64)&v23, a3);
if ( (v23 & 1) != 0 )
operator delete(v25);
if ( v17 )
return _stack_chk_guard;
}
v18 = (cocos2d::CCObject *)cocos2d::CCString::create(a3);
return cocos2d::CCArray::addObject(v9, v18);
}