//
// GameStatsManager::getTotalCollectedDiamonds from 0x100334f70 to 0x100335134 (452 bytes)
//
// 1 xrefs:
// > GameStatsManager::recountSpecialStats @ 0x1003351c8
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
int __fastcall GameStatsManager::getTotalCollectedDiamonds(GameStatsManager *a1)
{
cocos2d::CCDictionary *m_challengeDiamonds; // x8
cocos2d::CCDictElement *m_pElements; // x8
int v3; // w20
cocos2d::CCDictElement *next; // x19
cocos2d::CCDictionary *m_completedLists; // x8
cocos2d::CCDictElement *v6; // x8
cocos2d::CCDictElement *v7; // x19
char v8; // w8
char v9; // w19
bool v10; // zf
__int64 v11; // x8
cocos2d::CCDictionary *v12; // x21
__int64 v13; // x8
__int64 v14; // x22
cocos2d::CCArray *v15; // x23
unsigned int v16; // w24
cocos2d::CCString *v17; // x0
char *CString; // x0
cocos2d::CCString *v19; // x0
int v20; // w25
char *v21; // x1
cocos2d::CCString *v22; // x0
int v23; // w26
unsigned int v24; // w26
void *__p[2]; // [xsp+10h] [xbp-80h] BYREF
char v28; // [xsp+27h] [xbp-69h]
void *v29[2]; // [xsp+28h] [xbp-68h] BYREF
char v30; // [xsp+3Fh] [xbp-51h]
m_challengeDiamonds = a1->m_challengeDiamonds;
if ( m_challengeDiamonds && (m_pElements = m_challengeDiamonds->m_pElements) != nullptr )
{
v3 = 0;
do
{
next = (cocos2d::CCDictElement *)m_pElements->hh.next;
v3 += cocos2d::CCString::intValue((cocos2d::CCString *)m_pElements->m_pObject);
m_pElements = next;
}
while ( next );
}
else
{
v3 = 0;
}
m_completedLists = a1->m_completedLists;
if ( m_completedLists )
{
v6 = m_completedLists->m_pElements;
if ( v6 )
{
do
{
v7 = (cocos2d::CCDictElement *)v6->hh.next;
v3 += cocos2d::CCString::intValue((cocos2d::CCString *)v6->m_pObject);
v6 = v7;
}
while ( v7 );
}
}
v8 = 1;
do
{
v9 = v8;
v10 = (v8 & 1) == 0;
v11 = 696;
if ( !v10 )
v11 = 688;
v12 = *(cocos2d::CCDictionary **)((char *)&a1->__vftable + v11);
v13 = 680;
if ( !v10 )
v13 = 672;
v14 = *(__int64 *)((char *)&a1->__vftable + v13);
v15 = cocos2d::CCDictionary::allKeys(v12);
if ( (unsigned int)sub_10024A36C((__int64)v15) )
{
v16 = 0;
do
{
v17 = cocos2d::CCArray::stringAtIndex(v15, v16);
CString = (char *)cocos2d::CCString::getCString(v17);
sub_100009900(v29, CString);
v19 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey_1(v12, v29);
v20 = cocos2d::CCString::intValue(v19);
if ( v30 >= 0 )
v21 = (char *)v29;
else
v21 = (char *)v29[0];
sub_100009900(__p, v21);
v22 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey_1(v14, __p);
v23 = cocos2d::CCString::intValue(v22);
if ( v28 < 0 )
operator delete(__p[0]);
if ( (unsigned int)(v23 - 11) >= 0xFFFFFFF7 )
v24 = v23 + 2;
else
v24 = 0;
if ( v30 < 0 )
operator delete(v29[0]);
v3 = (int)(float)(floorf((float)((float)v20 / 100.0) * (float)v24) + (float)v3);
++v16;
}
while ( v16 < (unsigned int)sub_10024A36C((__int64)v15) );
}
v8 = 0;
}
while ( (v9 & 1) != 0 );
return v3;
}