//
// GameStatsManager::storeQueuedChallenge from 0x7a3a38 to 0x7a3b48 (272 bytes)
//
// 3 xrefs:
// > GameLevelManager::onGetGJChallengesCompleted @ 0x6fe780
// > GameStatsManager::processChallengeQueue @ 0x7a4364
// > ??> @ 0x37728
//
// 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
//
// local variable allocation has failed, the output may be wrong!
void GameStatsManager::storeQueuedChallenge(GameStatsManager *a1, int a2, GJChallengeItem *a3)
{
cocos2d::CCDictionary *m_upcomingChallenges; // x22
cocos2d::CCString *v5; // x0
char *CString; // x0
void *v7; // x0
unsigned int *v8; // x2
int v9; // w1
__int64 v10; // [xsp+40h] [xbp+40h] BYREF
m_upcomingChallenges = a1->m_upcomingChallenges;
a3->m_position = a2;
v5 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%i", *(const char **)&a2);
CString = (char *)cocos2d::CCString::getCString(v5);
sub_D153B8((int)&v10, CString);
cocos2d::CCDictionary::setObject((int)m_upcomingChallenges, 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);
}
}