//
// GameStatsManager::removeErrorFromSpecialChests from 0x10003cd80 to 0x10003cef0 (368 bytes)
//
// 2 xrefs:
// > GameStatsManager::recountSpecialStats @ 0x10003bcb4
// > GameStatsManager::dataLoaded @ 0x100055200
//
// 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 12:19:34 +0000
//
__int64 __fastcall GameStatsManager::removeErrorFromSpecialChests(_QWORD *a1)
{
_QWORD *v1; // r14
__int64 v2; // rbx
__int64 result; // rax
unsigned int v4; // r15d
__int64 v5; // rax
const char *CString; // r12
size_t v7; // rax
size_t v8; // r13
char *v9; // rbx
__int64 v10; // rax
size_t v11; // r14
__int64 v12; // [rsp+0h] [rbp-50h]
_QWORD __dst[2]; // [rsp+10h] [rbp-40h] BYREF
void *__p; // [rsp+20h] [rbp-30h]
v1 = a1;
GameStatsManager::processOnlineChests();
v2 = cocos2d::CCDictionary::allKeys(a1[98]);
result = sub_1007FEF90(v2);
if ( (_DWORD)result )
{
v4 = 0;
v12 = v2;
while ( 1 )
{
v5 = cocos2d::CCArray::stringAtIndex(v2, v4);
CString = (const char *)cocos2d::CCString::getCString(v5);
v7 = strlen(CString);
if ( v7 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v8 = v7;
if ( v7 >= 0x17 )
break;
LOBYTE(__dst[0]) = 2 * v7;
v9 = (char *)__dst + 1;
if ( v7 )
goto LABEL_11;
LABEL_12:
v9[v8] = 0;
if ( !cocos2d::CCDictionary::objectForKey(v1[45], __dst) && !cocos2d::CCDictionary::objectForKey(v1[100], __dst) )
cocos2d::CCDictionary::removeObjectForKey(v1[98], __dst);
v2 = v12;
if ( (__dst[0] & 1) != 0 )
operator delete(__p);
++v4;
result = sub_1007FEF90(v12);
if ( v4 >= (unsigned int)result )
return result;
}
v10 = v7 | 7;
v11 = 26;
if ( (v8 | 7) != 0x17 )
v11 = v10 + 1;
v9 = (char *)operator new(v11);
__p = v9;
__dst[0] = v11 + 1;
__dst[1] = v8;
v1 = a1;
LABEL_11:
memmove(v9, CString, v8);
goto LABEL_12;
}
return result;
}