//
// GameStatsManager::getTotalCollectedDiamonds from 0x10003b560 to 0x10003ba63 (1283 bytes)
//
// 1 xrefs:
// > GameStatsManager::recountSpecialStats @ 0x10003bc57
//
// 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:33 +0000
//
__int64 __fastcall GameStatsManager::getTotalCollectedDiamonds(_QWORD *a1, double a2, __m128 a3)
{
__int64 v4; // rax
unsigned int v5; // r15d
__int64 v6; // rbx
__int64 v7; // rdi
__int64 v8; // rax
__int64 i; // rbx
__int64 v10; // rdi
__int64 v11; // rbx
unsigned int v12; // r14d
float v13; // xmm0_4
__int64 v14; // rax
const char *CString; // r12
size_t v16; // rax
size_t v17; // r15
char *v18; // rbx
size_t v19; // r13
__int64 v20; // rax
int v21; // r15d
const char *v22; // r12
size_t v23; // rax
size_t v24; // r13
char *v25; // rbx
unsigned int v26; // r12d
int v27; // r14d
size_t v28; // r15
__int64 v29; // rax
int v30; // r12d
unsigned int v31; // eax
int v32; // r12d
__int64 v33; // rbx
unsigned int v34; // r13d
float v35; // xmm0_4
__int64 v36; // rax
const char *v37; // r15
size_t v38; // rax
size_t v39; // r14
char *v40; // rbx
size_t v41; // r12
__int64 v42; // rax
int v43; // r15d
const char *v44; // r14
size_t v45; // rax
size_t v46; // r12
char *v47; // rbx
unsigned int v48; // r14d
int v49; // r13d
size_t v50; // r15
__int64 v51; // rax
int v52; // r14d
int v53; // ebx
unsigned int v54; // eax
int v55; // r14d
_QWORD *v57; // [rsp+8h] [rbp-88h]
__int64 v58; // [rsp+10h] [rbp-80h]
__int64 v59; // [rsp+10h] [rbp-80h]
__int64 v60; // [rsp+18h] [rbp-78h]
__int64 v61; // [rsp+18h] [rbp-78h]
__int64 v62; // [rsp+20h] [rbp-70h]
__int64 v63; // [rsp+20h] [rbp-70h]
__int64 v64; // [rsp+28h] [rbp-68h] BYREF
size_t v65; // [rsp+30h] [rbp-60h]
void *__p; // [rsp+38h] [rbp-58h]
int v67; // [rsp+44h] [rbp-4Ch]
size_t __dst; // [rsp+48h] [rbp-48h] BYREF
size_t v69; // [rsp+50h] [rbp-40h]
void *v70; // [rsp+58h] [rbp-38h]
const char *v71; // [rsp+60h] [rbp-30h]
v4 = a1[89];
v5 = 0;
if ( v4 )
{
v6 = *(_QWORD *)(v4 + 56);
if ( v6 )
{
v5 = 0;
do
{
v7 = *(_QWORD *)(v6 + 264);
v6 = *(_QWORD *)(v6 + 288);
v5 += cocos2d::CCString::intValue(v7);
}
while ( v6 );
}
}
v8 = a1[91];
if ( v8 )
{
for ( i = *(_QWORD *)(v8 + 56); i; v5 += cocos2d::CCString::intValue(v10) )
{
v10 = *(_QWORD *)(i + 264);
i = *(_QWORD *)(i + 288);
}
}
v60 = a1[84];
v57 = a1;
v58 = a1[86];
v11 = cocos2d::CCDictionary::allKeys(v58);
if ( (unsigned int)sub_1007FEF90(v11) )
{
v12 = 0;
v62 = v11;
while ( 1 )
{
v67 = v5;
v14 = cocos2d::CCArray::stringAtIndex(v11, v12);
CString = (const char *)cocos2d::CCString::getCString(v14);
v16 = strlen(CString);
if ( v16 >= 0xFFFFFFFFFFFFFFF8LL )
LABEL_63:
sub_100003630();
v17 = v16;
if ( v16 >= 0x17 )
break;
LOBYTE(__dst) = 2 * v16;
v18 = (char *)&__dst + 1;
if ( v16 )
goto LABEL_18;
LABEL_19:
v18[v17] = 0;
v20 = cocos2d::CCDictionary::valueForKey(v58, &__dst);
v21 = cocos2d::CCString::intValue(v20);
v22 = (char *)&__dst + 1;
if ( (__dst & 1) != 0 )
v22 = (const char *)v70;
v23 = strlen(v22);
if ( v23 >= 0xFFFFFFFFFFFFFFF8LL )
LABEL_64:
sub_100003630();
v24 = v23;
if ( v23 >= 0x17 )
{
v71 = v22;
v26 = v12;
v27 = v21;
v28 = (v23 | 7) + 1;
if ( (v23 | 7) == 0x17 )
v28 = 26;
v25 = (char *)operator new(v28);
__p = v25;
v64 = v28 | 1;
v65 = v24;
v21 = v27;
v12 = v26;
v22 = v71;
}
else
{
LOBYTE(v64) = 2 * v23;
v25 = (char *)&v64 + 1;
if ( !v23 )
goto LABEL_29;
}
memmove(v25, v22, v24);
LABEL_29:
v25[v24] = 0;
v29 = cocos2d::CCDictionary::valueForKey(v60, &v64);
v30 = cocos2d::CCString::intValue(v29);
v11 = v62;
if ( (v64 & 1) != 0 )
operator delete(__p);
v31 = v30 - 11;
v32 = v30 + 2;
if ( v31 < 0xFFFFFFF7 )
v32 = 0;
a3.f32[0] = (float)v21 / 100.0;
if ( (__dst & 1) != 0 )
{
*(float *)&v71 = (float)v21 / 100.0;
operator delete(v70);
a3 = (__m128)(unsigned int)v71;
}
a3.f32[0] = a3.f32[0] * (float)v32;
v13 = _mm_round_ss((__m128)0LL, a3, 9).f32[0];
a3 = 0;
v5 = (int)(float)((float)v67 + v13);
if ( ++v12 >= (unsigned int)sub_1007FEF90(v62) )
goto LABEL_35;
}
v19 = (v16 | 7) + 1;
if ( (v16 | 7) == 0x17 )
v19 = 26;
v18 = (char *)operator new(v19);
v70 = v18;
__dst = v19 + 1;
v69 = v17;
LABEL_18:
memmove(v18, CString, v17);
goto LABEL_19;
}
LABEL_35:
v61 = v57[85];
v59 = v57[87];
v33 = cocos2d::CCDictionary::allKeys(v59);
if ( (unsigned int)sub_1007FEF90(v33) )
{
v34 = 0;
v63 = v33;
while ( 1 )
{
v67 = v5;
v36 = cocos2d::CCArray::stringAtIndex(v33, v34);
v37 = (const char *)cocos2d::CCString::getCString(v36);
v38 = strlen(v37);
if ( v38 > 0xFFFFFFFFFFFFFFF7LL )
goto LABEL_63;
v39 = v38;
if ( v38 >= 0x17 )
break;
LOBYTE(__dst) = 2 * v38;
v40 = (char *)&__dst + 1;
if ( v38 )
goto LABEL_45;
LABEL_46:
v40[v39] = 0;
v42 = cocos2d::CCDictionary::valueForKey(v59, &__dst);
v43 = cocos2d::CCString::intValue(v42);
v44 = (char *)&__dst + 1;
if ( (__dst & 1) != 0 )
v44 = (const char *)v70;
v45 = strlen(v44);
if ( v45 > 0xFFFFFFFFFFFFFFF7LL )
goto LABEL_64;
v46 = v45;
if ( v45 >= 0x17 )
{
v71 = v44;
v48 = v34;
v49 = v43;
v50 = (v45 | 7) + 1;
if ( (v45 | 7) == 0x17 )
v50 = 26;
v47 = (char *)operator new(v50);
__p = v47;
v64 = v50 | 1;
v65 = v46;
v43 = v49;
v34 = v48;
v44 = v71;
}
else
{
LOBYTE(v64) = 2 * v45;
v47 = (char *)&v64 + 1;
if ( !v45 )
goto LABEL_56;
}
memmove(v47, v44, v46);
LABEL_56:
v47[v46] = 0;
v51 = cocos2d::CCDictionary::valueForKey(v61, &v64);
v52 = cocos2d::CCString::intValue(v51);
v53 = v67;
if ( (v64 & 1) != 0 )
operator delete(__p);
v54 = v52 - 11;
v55 = v52 + 2;
if ( v54 < 0xFFFFFFF7 )
v55 = 0;
a3.f32[0] = (float)v43 / 100.0;
if ( (__dst & 1) != 0 )
{
*(float *)&v71 = (float)v43 / 100.0;
operator delete(v70);
a3 = (__m128)(unsigned int)v71;
}
a3.f32[0] = a3.f32[0] * (float)v55;
v35 = _mm_round_ss((__m128)0LL, a3, 9).f32[0];
a3 = 0;
v5 = (int)(float)((float)v53 + v35);
++v34;
v33 = v63;
if ( v34 >= (unsigned int)sub_1007FEF90(v63) )
return v5;
}
v41 = (v38 | 7) + 1;
if ( (v38 | 7) == 0x17 )
v41 = 26;
v40 = (char *)operator new(v41);
v70 = v40;
__dst = v41 + 1;
v69 = v39;
LABEL_45:
memmove(v40, v37, v39);
goto LABEL_46;
}
return v5;
}