//
// GameStatsManager::createReward from 0x51de7c to 0x51df66 (234 bytes)
//
// 2 xrefs:
// > GameLevelManager::rewardItemFromResponse @ 0x4c9660
// > GameLevelManager::parseEventReward @ 0x4ca3e4
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:51:50 +0000
//
cocos2d::CCObject *__fastcall GameStatsManager::createReward(int a1, GJRewardItem *a2, int a3, unsigned __int8 *a4)
{
cocos2d::CCArray *v5; // r0
cocos2d::CCArray *v6; // r7
unsigned int i; // r5
int v8; // r0
const char *v9; // r0
int v10; // r8
unsigned int v11; // r0
const char *v12; // r0
int v13; // r1
cocos2d::CCObject *ItemUnlock; // r0
cocos2d::CCObject *v15; // r0
int v16; // r2
int v17; // r3
cocos2d::CCObject *v18; // r5
int v21; // [sp+4h] [bp-18h]
int v22; // [sp+8h] [bp-14h] BYREF
int v23; // [sp+Ch] [bp-10h]
int v24; // [sp+10h] [bp-Ch]
v22 = 0;
v23 = 0;
v24 = 0;
v5 = (cocos2d::CCArray *)sub_51DD24(a4, ",", &v22);
v6 = (cocos2d::CCArray *)cocos2d::CCArray::create(v5);
for ( i = 0; i < -1431655765 * ((v23 - v22) >> 2) - 1; i += 2 )
{
v21 = v22;
v8 = v22 + 12 * i;
if ( (*(_BYTE *)v8 & 1) != 0 )
v9 = *(const char **)(v8 + 8);
else
v9 = (const char *)(v8 + 1);
v10 = atoi(v9);
v11 = v21 + 12 * i + 12;
if ( (*(_BYTE *)v11 & 1) != 0 )
v12 = *(const char **)(v11 + 8);
else
v12 = (const char *)(v11 + 1);
v13 = atoi(v12);
if ( v10 > 1000 )
{
ItemUnlock = GJRewardObject::createItemUnlock(v10 - 1000, v13);
goto LABEL_14;
}
if ( (unsigned int)(v10 - 1) <= 0xE && v10 != 9 )
{
ItemUnlock = GJRewardObject::create(v10, v13, 0);
LABEL_14:
if ( ItemUnlock )
cocos2d::CCArray::addObject(v6, ItemUnlock);
continue;
}
}
v15 = (cocos2d::CCObject *)cocos2d::CCArray::count(v6);
if ( v15 )
{
v15 = GJRewardItem::createWithObjects(a2, v6, v16, v17);
*((_DWORD *)v15 + 13) = a3;
}
v18 = v15;
std::__vector_base::~__vector_base((int)&v22);
return v18;
}