//
// GameStatsManager::getBaseCurrencyForLevel from 0x7a30b4 to 0x7a32a8 (500 bytes)
//
// 6 xrefs:
// > LevelCell::loadCustomLevelCell @ 0x610eb8
// > LevelInfoLayer::updateLabelValues @ 0x6d9a80
// > LevelPage::updateDynamicPage @ 0x79fde4
// > GameStatsManager::getAwardedCurrencyForLevel @ 0x7a334c
// > GameStatsManager::awardCurrencyForLevel @ 0x7bab2c
// > ??> @ 0x80a48
//
// 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 GameStatsManager::getBaseCurrencyForLevel(GameStatsManager *a1, GJGameLevel *a2)
{
bool v3; // w24
int v5; // w20
int random; // w23
int seed; // w26
bool v8; // cc
cocos2d::CCDictionary *m_timelyStars; // x23
cocos2d::CCString *v10; // x0
int v11; // w26
char *v12; // x0
char *v13; // x0
unsigned int *v15; // x1
int v16; // w2
unsigned int *v17; // x1
int v18; // w2
char *v19; // [xsp+68h] [xbp+68h] BYREF
std::string v20; // [xsp+70h] [xbp+70h] BYREF
v3 = a2->m_levelType == Main;
v5 = a2->m_stars.random - a2->m_stars.seed;
random = a2->m_dailyID.random;
seed = a2->m_dailyID.seed;
if ( a2->m_levelType != Main )
{
GameStatsManager::getCurrencyKey(a1, a2, (__int64)&v19);
v8 = random - seed <= 0;
m_timelyStars = a1->m_timelyStars;
if ( v8 )
m_timelyStars = a1->m_onlineStars;
sub_D153B8((int)&v20, v19);
v10 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(m_timelyStars, &v20);
v11 = cocos2d::CCString::intValue(v10);
v12 = (char *)v20.m_data.m_data - 24;
if ( (__int64 *)v20.m_data.m_data - 3 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v15 = (unsigned int *)((char *)v20.m_data.m_data - 8);
do
v16 = __ldaxr(v15);
while ( __stlxr(v16 - 1, v15) );
}
else
{
v16 = *((_DWORD *)v20.m_data.m_data - 2);
*((_DWORD *)v20.m_data.m_data - 2) = v16 - 1;
}
if ( v16 <= 0 )
operator delete(v12);
}
if ( v5 < v11 )
v5 = v11;
v13 = v19 - 24;
if ( v19 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v17 = (unsigned int *)(v19 - 8);
do
v18 = __ldaxr(v17);
while ( __stlxr(v18 - 1, v17) );
}
else
{
v18 = *((_DWORD *)v19 - 2);
*((_DWORD *)v19 - 2) = v18 - 1;
}
if ( v18 <= 0 )
operator delete(v13);
}
}
return GameStatsManager::getBaseCurrency(a1, v5, v3, a2->m_levelID.random - a2->m_levelID.seed);
}