//
// GJRewardItem::getRandomNonMaxShardType from 0x7b3fec to 0x7b4130 (324 bytes)
//
// 2 xrefs:
// > GameStatsManager::completedDailyLevel @ 0x7c5c04
// > ??> @ 0x3a920
//
// 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
//
SpecialRewardItem GJRewardItem::getRandomNonMaxShardType()
{
int v0; // w21
SpecialRewardItem RandomShardType; // w19
SpecialRewardItem result; // w0
GameStatsManager *v3; // x26
int Stat; // w26
char *v5; // x0
unsigned int *v6; // x1
int v7; // w2
const char *v8; // [xsp+60h] [xbp+60h] BYREF
v0 = 10;
RandomShardType = GJRewardItem::getRandomShardType();
do
{
v3 = GameStatsManager::sharedState();
GJRewardItem::rewardItemToStat(RandomShardType, (__int64)&v8);
Stat = GameStatsManager::getStat(v3, v8);
v5 = (char *)(v8 - 24);
if ( v8 - 24 == (const char *)&qword_124B6B0 )
goto LABEL_2;
if ( &pthread_create )
{
v6 = (unsigned int *)(v8 - 8);
do
v7 = __ldaxr(v6);
while ( __stlxr(v7 - 1, v6) );
}
else
{
v7 = *((_DWORD *)v8 - 2);
*((_DWORD *)v8 - 2) = v7 - 1;
}
if ( v7 > 0 )
{
LABEL_2:
result = RandomShardType;
if ( Stat <= 99 )
return result;
}
else
{
operator delete(v5);
result = RandomShardType;
if ( Stat <= 99 )
return result;
}
RandomShardType = GJRewardItem::getNextShardType(result);
--v0;
}
while ( v0 );
return 0;
}