//
// GameStatsManager::storeUserCoin from 0x8caef8 to 0x8cb01c (292 bytes)
//
// 4 xrefs:
// > GameStatsManager::checkCoinsForLevel @ 0x8e8760
// > GameStatsManager::dataLoaded @ 0x8e91b0
// > GJBaseGameLayer::processItems @ 0x9aea10
// > ??> @ 0xb01b8
//
// 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 12:56:36 +0000
//
__int64 __fastcall GameStatsManager::storeUserCoin(GameStatsManager *this, const char *a2)
{
__int64 v2; // x23
cocos2d::CCObject *v3; // x24
size_t v4; // x0
size_t v5; // x19
const char *v6; // x1
unsigned __int64 v7; // x0
__int64 v8; // x22
char *v9; // x0
char *v10; // x3
__int64 v13; // [xsp+50h] [xbp+50h] BYREF
size_t v14; // [xsp+58h] [xbp+58h]
void *v15; // [xsp+60h] [xbp+60h]
v2 = *((_QWORD *)this + 77);
v3 = *((cocos2d::CCObject **)this + 40);
v13 = 0;
v14 = 0;
v15 = nullptr;
v4 = strlen(a2);
v5 = v4;
v6 = a2;
if ( v4 > 0xFFFFFFFFFFFFFFEFLL )
sub_62CC1C();
if ( v4 > 0x16 )
{
v7 = (v4 + 16) & 0xFFFFFFFFFFFFFFF0LL;
v8 = v7 | 1;
v9 = (char *)operator new(v7);
v13 = v8;
v6 = a2;
v10 = v9;
v15 = v9;
v14 = v5;
LABEL_4:
v10 = (char *)memcpy(v10, v6, v5);
goto LABEL_5;
}
LOBYTE(v13) = 2 * v4;
v10 = (char *)&v13 + 1;
if ( v4 )
goto LABEL_4;
LABEL_5:
v10[v5] = 0;
cocos2d::CCDictionary::setObject(v2, v3);
if ( (v13 & 1) != 0 )
operator delete(v15);
return _stack_chk_guard;
}