//
// GameStatsManager::removeErrorFromSpecialChests from 0x8e78b0 to 0x8e7a38 (392 bytes)
//
// 3 xrefs:
// > GameStatsManager::dataLoaded @ 0x8e8edc
// > GameStatsManager::recountSpecialStats @ 0x8ebb98
// > ??> @ 0x95d88
//
// 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:53 +0000
//
__int64 __fastcall GameStatsManager::removeErrorFromSpecialChests(cocos2d::CCDictionary **this)
{
unsigned int v2; // w21
cocos2d::CCArray *v3; // x23
cocos2d::CCString *v4; // x0
const char *CString; // x0
const char *v6; // x25
size_t v7; // x0
size_t v8; // x20
char *v9; // x3
unsigned __int64 v11; // x0
__int64 v12; // x22
char *v13; // x0
__int64 v14; // [xsp+50h] [xbp+50h] BYREF
size_t v15; // [xsp+58h] [xbp+58h]
void *v16; // [xsp+60h] [xbp+60h]
v2 = 0;
GameStatsManager::processOnlineChests(this);
v3 = (cocos2d::CCArray *)cocos2d::CCDictionary::allKeys(*(this + 98));
if ( (unsigned int)cocos2d::CCArray::count(v3) )
{
do
{
v4 = (cocos2d::CCString *)cocos2d::CCArray::stringAtIndex(v3, v2);
CString = (const char *)cocos2d::CCString::getCString(v4);
v14 = 0;
v15 = 0;
v6 = CString;
v16 = nullptr;
v7 = strlen(CString);
v8 = v7;
if ( v7 > 0xFFFFFFFFFFFFFFEFLL )
sub_62CC1C();
if ( v7 > 0x16 )
{
v11 = (v7 + 16) & 0xFFFFFFFFFFFFFFF0LL;
v12 = v11 | 1;
v13 = (char *)operator new(v11);
v14 = v12;
v9 = v13;
v16 = v13;
v15 = v8;
}
else
{
LOBYTE(v14) = 2 * v7;
v9 = (char *)&v14 + 1;
if ( !v7 )
goto LABEL_5;
}
v9 = (char *)memcpy(v9, v6, v8);
LABEL_5:
v9[v8] = 0;
if ( !cocos2d::CCDictionary::objectForKey(*(this + 45), &v14)
&& !cocos2d::CCDictionary::objectForKey(*(this + 100), &v14) )
{
cocos2d::CCDictionary::removeObjectForKey(*(this + 98), &v14);
}
++v2;
if ( (v14 & 1) != 0 )
operator delete(v16);
}
while ( v2 < (unsigned int)cocos2d::CCArray::count(v3) );
}
return _stack_chk_guard;
}