//
// GameStatsManager::getAwardedDiamondsForLevel from 0x100071650 to 0x1000717c5 (373 bytes)
//
// 2 xrefs:
// > LevelCell::loadCustomLevelCell @ 0x100250934
// > LevelInfoLayer::setupLevelInfo @ 0x1002c0a24
//
// 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::getAwardedDiamondsForLevel(GameStatsManager *a1, GJGameLevel *a2)
{
double v2; // xmm0_8
__m128 v3; // xmm1
int result; // eax
char *v5; // r15
__int64 v6; // r14
size_t v7; // rax
size_t v8; // r12
char *v9; // r13
size_t v10; // r14
cocos2d::CCString *v11; // rax
int v12; // r14d
int v13; // eax
unsigned int v14; // ecx
int v15; // eax
int v16; // edx
float v17; // xmm0_4
char *v18[2]; // [rsp+0h] [rbp-60h] BYREF
char *__s; // [rsp+10h] [rbp-50h]
_QWORD __dst[2]; // [rsp+18h] [rbp-48h] BYREF
void *__p; // [rsp+28h] [rbp-38h]
float v22[12]; // [rsp+30h] [rbp-30h]
if ( a2->m_dailyID.random <= a2->m_dailyID.seed )
{
result = 0;
if ( !a2->m_gauntletLevel )
return result;
}
GameStatsManager::getCurrencyKey(v18, v2);
if ( ((__int64)v18[0] & 1) != 0 )
v5 = __s;
else
v5 = (char *)v18 + 1;
v6 = *((_QWORD *)&a1->m_gauntletDiamondScores + (a2->m_dailyID.random > a2->m_dailyID.seed));
v7 = strlen(v5);
if ( v7 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(v2);
v8 = v7;
if ( v7 >= 0x17 )
{
*(_QWORD *)v22 = *((_QWORD *)&a1->m_gauntletDiamondScores + (a2->m_dailyID.random > a2->m_dailyID.seed));
v10 = 26;
if ( (v7 | 7) != 0x17 )
v10 = (v7 | 7) + 1;
v9 = (char *)operator new(v10);
__p = v9;
__dst[0] = v10 | 1;
__dst[1] = v8;
v6 = *(_QWORD *)v22;
}
else
{
LOBYTE(__dst[0]) = 2 * v7;
v9 = (char *)__dst + 1;
if ( !v7 )
goto LABEL_14;
}
memmove(v9, v5, v8);
LABEL_14:
v9[v8] = 0;
v11 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey_1(v6, __dst);
v12 = cocos2d::CCString::intValue(v11);
if ( (__dst[0] & 1) != 0 )
operator delete(__p);
v13 = a2->m_stars.random - a2->m_stars.seed;
v14 = v13 - 11;
v15 = v13 + 2;
v16 = 0;
if ( v14 >= 0xFFFFFFF7 )
v16 = v15;
v3.f32[0] = (float)((float)v12 / 100.0) * (float)v16;
v17 = _mm_round_ss((__m128)0LL, v3, 9).f32[0];
if ( ((__int64)v18[0] & 1) != 0 )
{
v22[0] = v17;
operator delete(__s);
return (int)v22[0];
}
return (int)v17;
}