//
// GameStatsManager::removeErrorFromSpecialChests from 0x1402f8450 to 0x1402f85af (351 bytes)
//
// 3 xrefs:
// > GameStatsManager::recountSpecialStats @ 0x1402e8058
// > GameStatsManager::dataLoaded @ 0x1402f8147
// > ??> @ 0x14091e1a0
//
// 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:30:05 +0000
//
// Hidden C++ exception states: #wind=1
unsigned int __fastcall GameStatsManager::removeErrorFromSpecialChests(__int64 a1)
{
cocos2d::CCArray *v2; // rsi
unsigned int v3; // ebx
unsigned int result; // eax
cocos2d::CCString *v5; // rax
const char *CString; // rax
size_t v7; // r8
void *v8; // rcx
__int128 v9; // [rsp+30h] [rbp-38h] BYREF
__int128 v10; // [rsp+40h] [rbp-28h]
GameStatsManager::processOnlineChests(a1);
v2 = cocos2d::CCDictionary::allKeys(*(cocos2d::CCDictionary **)(a1 + 888));
v3 = 0;
result = cocos2d::CCArray::count(v2);
if ( result )
{
do
{
v5 = cocos2d::CCArray::stringAtIndex(v2, v3);
CString = cocos2d::CCString::getCString(v5);
v9 = 0;
v10 = 0;
v7 = -1;
do
++v7;
while ( CString[v7] );
sub_14003D230(&v9, CString, v7);
if ( !cocos2d::CCDictionary::objectForKey(*(_QWORD *)(a1 + 368), &v9)
&& !cocos2d::CCDictionary::objectForKey(*(_QWORD *)(a1 + 904), &v9) )
{
cocos2d::CCDictionary::removeObjectForKey(*(_QWORD *)(a1 + 888), &v9);
}
if ( *((_QWORD *)&v10 + 1) > 0xFu )
{
v8 = (void *)v9;
if ( (unsigned __int64)(*((_QWORD *)&v10 + 1) + 1LL) >= 0x1000 )
{
v8 = *(void **)(v9 - 8);
if ( (unsigned __int64)(v9 - (_QWORD)v8 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v8);
}
++v3;
result = cocos2d::CCArray::count(v2);
}
while ( v3 < result );
}
return result;
}