//
// GameStatsManager::awardDiamondsForLevel from 0x100332cc4 to 0x100332f38 (628 bytes)
//
// 2 xrefs:
// > PlayLayer::levelComplete @ 0x10011a018
// > PlayLayer::destroyPlayer @ 0x10011f078
//
// 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
//
void __fastcall GameStatsManager::awardDiamondsForLevel(GameStatsManager *a1, GJGameLevel *a2)
{
int v4; // w24
int v5; // w8
int v7; // w23
__int64 v8; // x8
__int64 v9; // x22
char *v10; // x1
cocos2d::CCString *v11; // x0
int v12; // w20
float32x2_t v13; // d2
int32x2_t v14; // d0
int v15; // w20
cocos2d::CCObject *v16; // x23
char *v17; // x1
__int64 v18; // x8
__int64 v19; // x21
char *v20; // x1
cocos2d::CCString *v21; // x0
int v22; // w22
cocos2d::CCObject *v23; // x22
char *v24; // x1
void *__p[2]; // [xsp+10h] [xbp-60h] BYREF
char v26; // [xsp+27h] [xbp-49h]
void *v27[2]; // [xsp+28h] [xbp-48h] BYREF
char v28; // [xsp+3Fh] [xbp-31h]
if ( a2->m_dailyID.random > a2->m_dailyID.seed || a2->m_gauntletLevel )
{
v4 = a2->m_stars.random - a2->m_stars.seed;
v5 = a2->m_orbCompletion.random - a2->m_orbCompletion.seed;
if ( (unsigned int)(v4 - 11) >= 0xFFFFFFF7 && v5 >= 1 )
{
if ( (unsigned int)v5 >= 0x64 )
v7 = 100;
else
v7 = a2->m_orbCompletion.random - a2->m_orbCompletion.seed;
GameStatsManager::getCurrencyKey(a2, v27);
v8 = 688;
if ( a2->m_dailyID.random > a2->m_dailyID.seed )
v8 = 696;
v9 = *(__int64 *)((char *)&a1->__vftable + v8);
if ( v28 >= 0 )
v10 = (char *)v27;
else
v10 = (char *)v27[0];
sub_100009900(__p, v10);
v11 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey_1(v9, __p);
v12 = cocos2d::CCString::intValue(v11);
if ( v26 < 0 )
operator delete(__p[0]);
if ( v12 < v7 )
{
v13.f32[0] = (float)(unsigned int)v7;
v13.f32[1] = (float)v12;
v14 = vcvt_s32_f32(vrndm_f32(vmul_n_f32(vdiv_f32(v13, (float32x2_t)vdup_n_s32(0x42C80000u)), (float)(unsigned int)(v4 + 2))));
v15 = vsub_s32(v14, vdup_lane_s32(v14, 1)).u32[0];
if ( v15 >= 1 )
{
v16 = sub_100268F4C("%i", v7);
if ( v28 >= 0 )
v17 = (char *)v27;
else
v17 = (char *)v27[0];
sub_100009900(__p, v17);
cocos2d::CCDictionary::setObject_1(v9, v16, __p);
if ( v26 < 0 )
operator delete(__p[0]);
v18 = 672;
if ( a2->m_dailyID.random > a2->m_dailyID.seed )
v18 = 680;
v19 = *(__int64 *)((char *)&a1->__vftable + v18);
if ( v28 >= 0 )
v20 = (char *)v27;
else
v20 = (char *)v27[0];
sub_100009900(__p, v20);
v21 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey_1(v19, __p);
v22 = cocos2d::CCString::intValue(v21);
if ( v26 < 0 )
operator delete(__p[0]);
if ( v22 < v4 )
{
v23 = sub_100268F4C("%i", v4);
if ( v28 >= 0 )
v24 = (char *)v27;
else
v24 = (char *)v27[0];
sub_100009900(__p, v24);
cocos2d::CCDictionary::setObject_1(v19, v23, __p);
if ( v26 < 0 )
operator delete(__p[0]);
}
GameStatsManager::incrementStat(a1, "13", v15);
}
}
if ( v28 < 0 )
operator delete(v27[0]);
}
}
}