//
// GameStatsManager::getTotalCollectedDiamonds from 0x8ce9a8 to 0x8cec0c (612 bytes)
//
// 2 xrefs:
// > GameStatsManager::recountSpecialStats @ 0x8ebb2c
// > ??> @ 0xf5830
//
// 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:37 +0000
//
__int64 __fastcall GameStatsManager::getTotalCollectedDiamonds(GameStatsManager *this)
{
__int64 v2; // x0
__int64 v3; // x0
__int64 v4; // x19
int v5; // w20
__int64 v6; // x0
__int64 v7; // x0
__int64 i; // x19
cocos2d::CCDictionary *v9; // x26
__int64 v10; // x27
int j; // w28
unsigned int v12; // w23
cocos2d::CCArray *v13; // x24
cocos2d::CCString *v14; // x0
const char *CString; // x0
size_t v16; // x0
cocos2d::CCString *v17; // x0
int v18; // w22
const char *v19; // x1
size_t v20; // x0
cocos2d::CCString *v21; // x0
int v22; // w1
char *v24; // [xsp+78h] [xbp+78h]
char *v25; // [xsp+78h] [xbp+78h]
int v26; // [xsp+78h] [xbp+78h]
__int64 v27[2]; // [xsp+88h] [xbp+88h] BYREF
void *v28; // [xsp+98h] [xbp+98h]
__int64 v29[2]; // [xsp+A0h] [xbp+A0h] BYREF
void *v30; // [xsp+B0h] [xbp+B0h]
v2 = *((_QWORD *)this + 89);
if ( v2 && (v3 = *(_QWORD *)(v2 + 56)) != 0 )
{
v4 = *(_QWORD *)(v3 + 288);
v5 = 0;
while ( 1 )
{
v5 += cocos2d::CCString::intValue(*(cocos2d::CCString **)(v3 + 264));
if ( !v4 )
break;
v3 = v4;
v4 = *(_QWORD *)(v4 + 288);
}
}
else
{
v5 = 0;
}
v6 = *((_QWORD *)this + 91);
if ( v6 )
{
v7 = *(_QWORD *)(v6 + 56);
if ( v7 )
{
for ( i = *(_QWORD *)(v7 + 288); ; i = *(_QWORD *)(i + 288) )
{
v5 += cocos2d::CCString::intValue(*(cocos2d::CCString **)(v7 + 264));
if ( !i )
break;
v7 = i;
}
}
}
v9 = *((cocos2d::CCDictionary **)this + 86);
v10 = *((_QWORD *)this + 84);
for ( j = 0; ; j = 1 )
{
v12 = 0;
v13 = (cocos2d::CCArray *)cocos2d::CCDictionary::allKeys(v9);
if ( (unsigned int)cocos2d::CCArray::count(v13) )
{
do
{
v14 = (cocos2d::CCString *)cocos2d::CCArray::stringAtIndex(v13, v12);
CString = (const char *)cocos2d::CCString::getCString(v14);
v27[0] = 0;
v27[1] = 0;
v28 = nullptr;
v24 = (char *)CString;
v16 = strlen(CString);
std::string::__init(v27, v24, v16);
v17 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(v9, v27);
v18 = cocos2d::CCString::intValue(v17);
v19 = (char *)v27 + 1;
if ( (v27[0] & 1) != 0 )
v19 = (const char *)v28;
v25 = (char *)v19;
v29[0] = 0;
v29[1] = 0;
v30 = nullptr;
v20 = strlen(v19);
std::string::__init(v29, v25, v20);
v21 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(v10, v29);
v22 = cocos2d::CCString::intValue(v21);
if ( (v29[0] & 1) != 0 )
{
v26 = v22;
operator delete(v30);
v22 = v26;
}
v5 = (int)(float)((float)v5
+ floorf((float)(int)GameStatsManager::getBaseDiamonds(this, v22) * (float)((float)v18 / 100.0)));
++v12;
if ( (v27[0] & 1) != 0 )
operator delete(v28);
}
while ( v12 < (unsigned int)cocos2d::CCArray::count(v13) );
}
if ( j )
break;
v9 = *((cocos2d::CCDictionary **)this + 87);
v10 = *((_QWORD *)this + 85);
}
return (unsigned int)v5;
}