//
// GJRewardItem::getRewardObjectForType from 0x100038720 to 0x100038812 (242 bytes)
//
// 1 xrefs:
// > GameStatsManager::preProcessReward @ 0x100038553
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// 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 12:19:32 +0000
//
__int64 __fastcall GJRewardItem::getRewardObjectForType(__int64 a1, int a2)
{
__int64 v3; // rdi
__int64 v4; // rax
unsigned int v5; // r15d
__int64 result; // rax
_DWORD *v7; // r15
v3 = *(_QWORD *)(a1 + 72);
if ( v3 )
goto LABEL_8;
v3 = sub_1007FE900(0);
v4 = *(_QWORD *)(a1 + 72);
if ( v4 != v3 )
{
if ( v3 )
{
cocos2d::CCObject::retain(v3);
v4 = *(_QWORD *)(a1 + 72);
}
if ( v4 )
cocos2d::CCObject::release(v4);
*(_QWORD *)(a1 + 72) = v3;
LABEL_8:
if ( (unsigned int)sub_1007FEF90(v3) )
goto LABEL_9;
LABEL_12:
v7 = operator new(0x48u);
cocos2d::CCObject::CCObject(v7);
*(_QWORD *)v7 = off_100AB6EA8;
v7[14] = a2;
*((_QWORD *)v7 + 8) = 0;
cocos2d::CCObject::autorelease(v7);
sub_1007FEBF0(*(_QWORD *)(a1 + 72), v7);
return (__int64)v7;
}
if ( !(unsigned int)sub_1007FEF90(*(_QWORD *)(a1 + 72)) )
goto LABEL_12;
LABEL_9:
v5 = 0;
while ( 1 )
{
result = sub_1007FEFE0(*(_QWORD *)(a1 + 72), v5);
if ( *(_DWORD *)(result + 56) == a2 )
return result;
if ( ++v5 >= (unsigned int)sub_1007FEF90(*(_QWORD *)(a1 + 72)) )
goto LABEL_12;
}
}