//
// GameStatsManager::getTotalCollectedDiamonds from 0x100075660 to 0x100075b63 (1283 bytes)
//
// 1 xrefs:
// > GameStatsManager::recountSpecialStats @ 0x100075d57
//
// 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)
{
double v1; // xmm0_8
__m128 v2; // xmm1
cocos2d::CCDictionary *m_challengeDiamonds; // rax
int v5; // r15d
cocos2d::CCDictElement *m_pElements; // rbx
cocos2d::CCString *m_pObject; // rdi
cocos2d::CCDictionary *m_completedLists; // rax
cocos2d::CCDictElement *i; // rbx
cocos2d::CCString *v10; // rdi
cocos2d::CCArray *v11; // rbx
unsigned int v12; // r14d
cocos2d::CCString *v13; // rax
const char *CString; // r12
size_t v15; // rax
size_t v16; // r15
char *v17; // rbx
size_t v18; // r13
cocos2d::CCString *v19; // rax
int v20; // r15d
const char *v21; // r12
size_t v22; // rax
size_t v23; // r13
char *v24; // rbx
unsigned int v25; // r12d
int v26; // r14d
size_t v27; // r15
cocos2d::CCString *v28; // rax
int v29; // r12d
unsigned int v30; // eax
int v31; // r12d
cocos2d::CCArray *v32; // rbx
unsigned int v33; // r13d
cocos2d::CCString *v34; // rax
const char *v35; // r15
size_t v36; // rax
size_t v37; // r14
char *v38; // rbx
size_t v39; // r12
cocos2d::CCString *v40; // rax
int v41; // r15d
const char *v42; // r14
size_t v43; // rax
size_t v44; // r12
char *v45; // rbx
unsigned int v46; // r14d
int v47; // r13d
size_t v48; // r15
cocos2d::CCString *v49; // rax
int v50; // r14d
int v51; // ebx
unsigned int v52; // eax
int v53; // r14d
GameStatsManager *v55; // [rsp+8h] [rbp-88h]
cocos2d::CCDictionary *m_gauntletDiamondScores; // [rsp+10h] [rbp-80h]
cocos2d::CCDictionary *m_timelyDiamondScores; // [rsp+10h] [rbp-80h]
cocos2d::CCDictionary *m_onlineStars; // [rsp+18h] [rbp-78h]
cocos2d::CCDictionary *m_timelyStars; // [rsp+18h] [rbp-78h]
cocos2d::CCArray *v60; // [rsp+20h] [rbp-70h]
cocos2d::CCArray *v61; // [rsp+20h] [rbp-70h]
__int64 v62; // [rsp+28h] [rbp-68h] BYREF
size_t v63; // [rsp+30h] [rbp-60h]
void *__p; // [rsp+38h] [rbp-58h]
int v65; // [rsp+44h] [rbp-4Ch]
size_t __dst; // [rsp+48h] [rbp-48h] BYREF
size_t v67; // [rsp+50h] [rbp-40h]
void *v68; // [rsp+58h] [rbp-38h]
const char *v69; // [rsp+60h] [rbp-30h]
m_challengeDiamonds = a1->m_challengeDiamonds;
v5 = 0;
if ( m_challengeDiamonds )
{
m_pElements = m_challengeDiamonds->m_pElements;
if ( m_pElements )
{
v5 = 0;
do
{
m_pObject = (cocos2d::CCString *)m_pElements->m_pObject;
m_pElements = (cocos2d::CCDictElement *)m_pElements->hh.next;
v5 += cocos2d::CCString::intValue(m_pObject);
}
while ( m_pElements );
}
}
m_completedLists = a1->m_completedLists;
if ( m_completedLists )
{
for ( i = m_completedLists->m_pElements; i; v5 += cocos2d::CCString::intValue(v10) )
{
v10 = (cocos2d::CCString *)i->m_pObject;
i = (cocos2d::CCDictElement *)i->hh.next;
}
}
m_onlineStars = a1->m_onlineStars;
v55 = a1;
m_gauntletDiamondScores = a1->m_gauntletDiamondScores;
v11 = cocos2d::CCDictionary::allKeys(m_gauntletDiamondScores);
if ( (unsigned int)sub_100720070(v11) )
{
v12 = 0;
v60 = v11;
while ( 1 )
{
v65 = v5;
v13 = cocos2d::CCArray::stringAtIndex(v11, v12);
CString = cocos2d::CCString::getCString(v13);
v15 = strlen(CString);
if ( v15 >= 0xFFFFFFFFFFFFFFF8LL )
LABEL_63:
sub_100006BF0(v1);
v16 = v15;
if ( v15 >= 0x17 )
break;
LOBYTE(__dst) = 2 * v15;
v17 = (char *)&__dst + 1;
if ( v15 )
goto LABEL_18;
LABEL_19:
v17[v16] = 0;
v19 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey_1(m_gauntletDiamondScores, &__dst);
v20 = cocos2d::CCString::intValue(v19);
v21 = (char *)&__dst + 1;
if ( (__dst & 1) != 0 )
v21 = (const char *)v68;
v22 = strlen(v21);
if ( v22 >= 0xFFFFFFFFFFFFFFF8LL )
LABEL_64:
sub_100006BF0(v1);
v23 = v22;
if ( v22 >= 0x17 )
{
v69 = v21;
v25 = v12;
v26 = v20;
v27 = (v22 | 7) + 1;
if ( (v22 | 7) == 0x17 )
v27 = 26;
v24 = (char *)operator new(v27);
__p = v24;
v62 = v27 | 1;
v63 = v23;
v20 = v26;
v12 = v25;
v21 = v69;
}
else
{
LOBYTE(v62) = 2 * v22;
v24 = (char *)&v62 + 1;
if ( !v22 )
goto LABEL_29;
}
memmove(v24, v21, v23);
LABEL_29:
v24[v23] = 0;
v28 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey_1(m_onlineStars, &v62);
v29 = cocos2d::CCString::intValue(v28);
v11 = v60;
if ( (v62 & 1) != 0 )
operator delete(__p);
v30 = v29 - 11;
v31 = v29 + 2;
if ( v30 < 0xFFFFFFF7 )
v31 = 0;
v2.f32[0] = (float)v20 / 100.0;
if ( (__dst & 1) != 0 )
{
*(float *)&v69 = (float)v20 / 100.0;
operator delete(v68);
v2 = (__m128)(unsigned int)v69;
}
v2.f32[0] = v2.f32[0] * (float)v31;
*(_QWORD *)&v1 = _mm_round_ss((__m128)0LL, v2, 9).u64[0];
v2 = 0;
v5 = (int)(float)((float)v65 + *(float *)&v1);
if ( ++v12 >= (unsigned int)sub_100720070(v60) )
goto LABEL_35;
}
v18 = (v15 | 7) + 1;
if ( (v15 | 7) == 0x17 )
v18 = 26;
v17 = (char *)operator new(v18);
v68 = v17;
__dst = v18 + 1;
v67 = v16;
LABEL_18:
memmove(v17, CString, v16);
goto LABEL_19;
}
LABEL_35:
m_timelyStars = v55->m_timelyStars;
m_timelyDiamondScores = v55->m_timelyDiamondScores;
v32 = cocos2d::CCDictionary::allKeys(m_timelyDiamondScores);
if ( (unsigned int)sub_100720070(v32) )
{
v33 = 0;
v61 = v32;
while ( 1 )
{
v65 = v5;
v34 = cocos2d::CCArray::stringAtIndex(v32, v33);
v35 = cocos2d::CCString::getCString(v34);
v36 = strlen(v35);
if ( v36 > 0xFFFFFFFFFFFFFFF7LL )
goto LABEL_63;
v37 = v36;
if ( v36 >= 0x17 )
break;
LOBYTE(__dst) = 2 * v36;
v38 = (char *)&__dst + 1;
if ( v36 )
goto LABEL_45;
LABEL_46:
v38[v37] = 0;
v40 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey_1(m_timelyDiamondScores, &__dst);
v41 = cocos2d::CCString::intValue(v40);
v42 = (char *)&__dst + 1;
if ( (__dst & 1) != 0 )
v42 = (const char *)v68;
v43 = strlen(v42);
if ( v43 > 0xFFFFFFFFFFFFFFF7LL )
goto LABEL_64;
v44 = v43;
if ( v43 >= 0x17 )
{
v69 = v42;
v46 = v33;
v47 = v41;
v48 = (v43 | 7) + 1;
if ( (v43 | 7) == 0x17 )
v48 = 26;
v45 = (char *)operator new(v48);
__p = v45;
v62 = v48 | 1;
v63 = v44;
v41 = v47;
v33 = v46;
v42 = v69;
}
else
{
LOBYTE(v62) = 2 * v43;
v45 = (char *)&v62 + 1;
if ( !v43 )
goto LABEL_56;
}
memmove(v45, v42, v44);
LABEL_56:
v45[v44] = 0;
v49 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey_1(m_timelyStars, &v62);
v50 = cocos2d::CCString::intValue(v49);
v51 = v65;
if ( (v62 & 1) != 0 )
operator delete(__p);
v52 = v50 - 11;
v53 = v50 + 2;
if ( v52 < 0xFFFFFFF7 )
v53 = 0;
v2.f32[0] = (float)v41 / 100.0;
if ( (__dst & 1) != 0 )
{
*(float *)&v69 = (float)v41 / 100.0;
operator delete(v68);
v2 = (__m128)(unsigned int)v69;
}
v2.f32[0] = v2.f32[0] * (float)v53;
*(_QWORD *)&v1 = _mm_round_ss((__m128)0LL, v2, 9).u64[0];
v2 = 0;
v5 = (int)(float)((float)v51 + *(float *)&v1);
++v33;
v32 = v61;
if ( v33 >= (unsigned int)sub_100720070(v61) )
return v5;
}
v39 = (v36 | 7) + 1;
if ( (v36 | 7) == 0x17 )
v39 = 26;
v38 = (char *)operator new(v39);
v68 = v38;
__dst = v39 + 1;
v67 = v37;
LABEL_45:
memmove(v38, v35, v37);
goto LABEL_46;
}
return v5;
}