//
// GameStatsManager::storeRewardState from 0x7a6e40 to 0x7a6fb8 (376 bytes)
//
// 3 xrefs:
// > GameLevelManager::onGetGJRewardsCompleted @ 0x6fdab0
// > GameLevelManager::onGetGJRewardsCompleted @ 0x6fdaf8
// > ??> @ 0x87de0
//
// 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
//
__int64 __fastcall GameStatsManager::storeRewardState(__int64 a1, unsigned int a2, int a3, int a4)
{
int v7; // w20
__int64 v8; // x20
void *v9; // x0
cocos2d::CCDictionary *v10; // x0
unsigned int *v12; // x2
int v13; // w1
_QWORD v15[2]; // [xsp+58h] [xbp+58h] BYREF
if ( a4 <= 0 )
{
v7 = 0;
}
else
{
clock_gettime(0, (struct timespec *)v15);
v7 = (int)((double)v15[0] + (double)v15[1] / 1000000000.0) + a4;
}
sub_D18D28(v15);
v8 = GJRewardItem::create(a3, v7);
v9 = (void *)(v15[0] - 24LL);
if ( (__int64 *)(v15[0] - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v12 = (unsigned int *)(v15[0] - 8LL);
do
v13 = __ldaxr(v12);
while ( __stlxr(v13 - 1, v12) );
}
else
{
v13 = *(_DWORD *)(v15[0] - 8LL);
*(_DWORD *)(v15[0] - 8LL) = v13 - 1;
}
if ( v13 <= 0 )
operator delete(v9);
}
v10 = *(cocos2d::CCDictionary **)(a1 + 504);
*(_BYTE *)(v8 + 80) = 1;
*(_DWORD *)(v8 + 64) = a2;
cocos2d::CCDictionary::setObject(v10, (cocos2d::CCObject *)v8, a2);
return _stack_chk_guard;
}