//
// GameStatsManager::collectReward from 0x7bb9e8 to 0x7bbb18 (304 bytes)
//
// 2 xrefs:
// > RewardsPage::rewardsStatusFinished @ 0x93a408
// > ??> @ 0x8f028
//
// 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 GameStatsManager::collectReward(GameStatsManager *a1, GJRewardType a2, GJRewardItem *a3)
{
cocos2d::CCDictionary *m_dailyChests; // x24
void *v7; // x0
unsigned int *v8; // x2
int v9; // w1
__int64 v10; // [xsp+50h] [xbp+50h] BYREF
if ( a3 )
{
if ( !GameStatsManager::hasRewardBeenCollected(a1, a2, a3->m_chestID) )
{
GameStatsManager::registerRewardsFromItem(a1, a3);
m_dailyChests = a1->m_dailyChests;
GameStatsManager::getRewardKey(a2, a3->m_chestID, (__int64)&v10);
cocos2d::CCDictionary::setObject((int)m_dailyChests, a3);
v7 = (void *)(v10 - 24);
if ( (__int64 *)(v10 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v8 = (unsigned int *)(v10 - 8);
do
v9 = __ldaxr(v8);
while ( __stlxr(v9 - 1, v8) );
}
else
{
v9 = *(_DWORD *)(v10 - 8);
*(_DWORD *)(v10 - 8) = v9 - 1;
}
if ( v9 <= 0 )
operator delete(v7);
}
}
}
}