//
// GameStatsManager::getTotalCollectedDiamonds from 0x518350 to 0x5184f0 (416 bytes)
//
// 1 xrefs:
// > GameStatsManager::recountSpecialStats @ 0x52b0fc
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:51:44 +0000
//
int __fastcall GameStatsManager::getTotalCollectedDiamonds(GameStatsManager *this)
{
int v2; // r4
int v3; // r3
int v4; // r6
int v5; // r2
int v6; // r3
int v7; // r10
cocos2d::CCDictionary *v8; // r11
int i; // r3
int v10; // r3
int v11; // r6
int v12; // r2
cocos2d::CCString *v13; // r0
const char *CString; // r0
const char *v15; // r8
size_t v16; // r0
cocos2d::CCString *v17; // r0
char *v18; // r1
int v19; // s16
size_t v20; // r0
cocos2d::CCString *v21; // r0
int BaseDiamonds; // r0
unsigned int v23; // r9
unsigned int j; // r0
int v26; // [sp+0h] [bp-34h]
cocos2d::CCArray *v27; // [sp+4h] [bp-30h]
char *v28; // [sp+Ch] [bp-28h]
int v29; // [sp+Ch] [bp-28h]
int v30[2]; // [sp+14h] [bp-20h] BYREF
char *v31; // [sp+1Ch] [bp-18h]
int v32[3]; // [sp+20h] [bp-14h] BYREF
v2 = *((_DWORD *)this + 116);
if ( v2 )
{
v3 = *(_DWORD *)(v2 + 52);
if ( v3 )
v4 = *(_DWORD *)(v3 + 272);
else
v4 = 0;
v2 = 0;
while ( v3 )
{
v2 += cocos2d::CCString::intValue(*(cocos2d::CCString **)(v3 + 260));
if ( v4 )
v5 = *(_DWORD *)(v4 + 272);
else
v5 = 0;
v3 = v4;
v4 = v5;
}
}
v6 = *((_DWORD *)this + 118);
if ( v6 )
{
v10 = *(_DWORD *)(v6 + 52);
if ( v10 )
v11 = *(_DWORD *)(v10 + 272);
else
v11 = 0;
while ( v10 )
{
v2 += cocos2d::CCString::intValue(*(cocos2d::CCString **)(v10 + 260));
if ( v11 )
v12 = *(_DWORD *)(v11 + 272);
else
v12 = 0;
v10 = v11;
v11 = v12;
}
}
v7 = 0;
v8 = *((cocos2d::CCDictionary **)this + 113);
for ( i = *((_DWORD *)this + 111); ; i = *((_DWORD *)this + 112) )
{
v26 = i;
v23 = 0;
v27 = (cocos2d::CCArray *)cocos2d::CCDictionary::allKeys(v8);
for ( j = cocos2d::CCArray::count(v27); v23 < j; j = cocos2d::CCArray::count(v27) )
{
v13 = (cocos2d::CCString *)cocos2d::CCArray::stringAtIndex(v27, v23);
CString = (const char *)cocos2d::CCString::getCString(v13);
v30[0] = 0;
v30[1] = 0;
v31 = nullptr;
v15 = CString;
v16 = strlen(CString);
std::string::__init(v30, v15, v16);
v17 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(v8, v30);
v19 = cocos2d::CCString::intValue(v17);
v32[0] = 0;
v32[1] = 0;
if ( (v30[0] & 1) == 0 )
v18 = (char *)v30 + 1;
v32[2] = 0;
if ( (v30[0] & 1) != 0 )
v18 = v31;
v28 = v18;
v20 = strlen(v18);
std::string::__init(v32, v28, v20);
v21 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(v26, v32);
v29 = cocos2d::CCString::intValue(v21);
std::string::~string((int)v32);
BaseDiamonds = GameStatsManager::getBaseDiamonds(this, v29);
++v23;
v2 = (int)(float)((float)v2 + floorf((float)BaseDiamonds * (float)((float)v19 / 100.0)));
std::string::~string((int)v30);
}
if ( v7 )
break;
v8 = *((cocos2d::CCDictionary **)this + 114);
v7 = 1;
}
return v2;
}