//
// GameStatsManager::getCollectedCoinsForLevel from 0x1401ddba0 to 0x1401ddd18 (376 bytes)
//
// 8 xrefs:
// > GameStatsManager::checkCoinAchievement @ 0x1401dd85b
// > GameStatsManager::checkCoinAchievement @ 0x1401dd8d2
// > GameStatsManager::checkCoinAchievement @ 0x1401dd949
// > GameStatsManager::checkCoinAchievement @ 0x1401dd9c0
// > GameStatsManager::checkCoinAchievement @ 0x1401dda47
// > GameStatsManager::checkCoinAchievement @ 0x1401ddab1
// > GameStatsManager::checkCoinAchievement @ 0x1401ddb18
// > ??> @ 0x1406cc3b4
//
// 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::getCollectedCoinsForLevel(GameStatsManager *a1, GJGameLevel *a2)
{
SeedValueRSV *p_m_dailyID; // r12
int *p_seed; // r15
int v5; // r9d
SeedValueRSV *p_m_levelID; // rsi
int *v7; // rdi
__int64 v9; // rdx
cocos2d::CCString *v10; // rax
const char *v11; // rcx
const char *CString; // rax
bool *p_m_gauntletLevel; // rbp
bool hasSecretCoin; // al
__int64 v15; // rdx
BOOL v16; // r13d
cocos2d::CCString *v17; // rax
const char *v18; // rcx
const char *v19; // rax
int v20; // ebx
int v21; // r9d
__int64 v22; // rdx
cocos2d::CCString *v23; // rax
const char *v24; // rcx
const char *v25; // rax
bool v26; // al
int v27; // ecx
p_m_dailyID = &a2->m_dailyID;
p_seed = &a2->m_dailyID.seed;
v5 = a2->m_dailyID.random - a2->m_dailyID.seed;
p_m_levelID = &a2->m_levelID;
v7 = &a2->m_levelID.seed;
v9 = (unsigned int)(a2->m_levelID.random - a2->m_levelID.seed);
if ( v5 <= 0 )
{
v11 = "%i_%i_g";
if ( !a2->m_gauntletLevel )
v11 = "%i_%i";
v10 = cocos2d::CCString::createWithFormat(v11, v9, 1);
}
else
{
v10 = cocos2d::CCString::createWithFormat("%i_%i_%i", v9, 1, v5);
}
CString = cocos2d::CCString::getCString(v10);
p_m_gauntletLevel = &a2->m_gauntletLevel;
hasSecretCoin = GameStatsManager::hasSecretCoin(a1, CString);
v15 = (unsigned int)(p_m_levelID->random - *v7);
v16 = hasSecretCoin;
if ( p_m_dailyID->random - *p_seed <= 0 )
{
v18 = "%i_%i_g";
if ( !*p_m_gauntletLevel )
v18 = "%i_%i";
v17 = cocos2d::CCString::createWithFormat(v18, v15, 2);
}
else
{
v17 = cocos2d::CCString::createWithFormat("%i_%i_%i", v15, 2, p_m_dailyID->random - *p_seed);
}
v19 = cocos2d::CCString::getCString(v17);
v20 = v16 + 1;
if ( !GameStatsManager::hasSecretCoin(a1, v19) )
v20 = v16;
v21 = p_m_dailyID->random - *p_seed;
v22 = (unsigned int)(p_m_levelID->random - *v7);
if ( v21 <= 0 )
{
v24 = "%i_%i_g";
if ( !*p_m_gauntletLevel )
v24 = "%i_%i";
v23 = cocos2d::CCString::createWithFormat(v24, v22, 3);
}
else
{
v23 = cocos2d::CCString::createWithFormat("%i_%i_%i", v22, 3, v21);
}
v25 = cocos2d::CCString::getCString(v23);
v26 = GameStatsManager::hasSecretCoin(a1, v25);
v27 = v20 + 1;
if ( !v26 )
return v20;
return v27;
}