//
// GameStatsManager::getAwardedDiamondsForLevel from 0x517eac to 0x517fb2 (262 bytes)
//
// 2 xrefs:
// > LevelCell::loadCustomLevelCell @ 0x42fb22
// > LevelInfoLayer::setupLevelInfo @ 0x49ca8c
//
// 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::getAwardedDiamondsForLevel(GameStatsManager *this, GJGameLevel *a2)
{
int v4; // r8
char *v5; // r10
size_t v6; // r0
cocos2d::CCString *v7; // r0
int v8; // s16
int BaseDiamonds; // r0
int v11; // [sp+4h] [bp-24h]
char v12; // [sp+Ch] [bp-1Ch] BYREF
char v13; // [sp+Dh] [bp-1Bh] BYREF
char *v14; // [sp+14h] [bp-14h]
int v15[3]; // [sp+18h] [bp-10h] BYREF
if ( *((_DWORD *)a2 + 186) - *((_DWORD *)a2 + 187) <= 0 && !*((_BYTE *)a2 + 477) )
return *((unsigned __int8 *)a2 + 477);
GameStatsManager::getCurrencyKey((GameStatsManager *)&v12, this, a2);
v4 = *((_DWORD *)this + 114);
if ( *((_DWORD *)a2 + 186) - *((_DWORD *)a2 + 187) <= 0 )
v4 = *((_DWORD *)this + 113);
if ( (v12 & 1) != 0 )
v5 = v14;
else
v5 = &v13;
memset(v15, 0, sizeof(v15));
v6 = strlen(v5);
std::string::__init(v15, v5, v6);
v7 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(v4, v15);
v8 = cocos2d::CCString::intValue(v7);
std::string::~string((int)v15);
BaseDiamonds = GameStatsManager::getBaseDiamonds(this, *((_DWORD *)a2 + 193) - *((_DWORD *)a2 + 194));
v11 = (int)floorf((float)BaseDiamonds * (float)((float)v8 / 100.0));
std::string::~string((int)&v12);
return v11;
}