//
// GJRewardItem::init from 0x10008efe0 to 0x10008f23f (607 bytes)
//
// 1 xrefs:
// > GJRewardItem::create @ 0x10007227d
//
// 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
//
char __fastcall GJRewardItem::init(__int64 a1, int a2, int a3, unsigned __int8 *a4, double a5)
{
unsigned int v6; // eax
cocos2d::CCArray *v7; // r14
int v8; // r15d
cocos2d::CCString *v9; // rax
int v10; // r12d
cocos2d::CCString *v11; // rax
cocos2d::CCString *v12; // rax
int v13; // r13d
cocos2d::CCString *v14; // rdi
int v15; // eax
int v16; // r14d
int v17; // r13d
bool v18; // cc
cocos2d::CCObject *v19; // r12
cocos2d::CCObject *v20; // r15
cocos2d::CCObject *v21; // r15
cocos2d::CCObject *v22; // r15
cocos2d::CCObject *v23; // r15
cocos2d::CCObject *v24; // rdi
int v26; // [rsp+8h] [rbp-38h]
int v27; // [rsp+Ch] [rbp-34h]
int v28; // [rsp+10h] [rbp-30h]
bool v29; // [rsp+17h] [rbp-29h]
*(_DWORD *)(a1 + 56) = a2;
*(_DWORD *)(a1 + 60) = a3;
v6 = *a4;
if ( (v6 & 1) != 0 )
{
if ( !*((_QWORD *)a4 + 1) )
return 1;
}
else if ( !(v6 >> 1) )
{
return 1;
}
v7 = (cocos2d::CCArray *)sub_10006EE30(a4, ",", a5);
if ( (unsigned int)sub_100720070(v7) >= 4 )
{
v8 = 0;
v9 = cocos2d::CCArray::stringAtIndex(v7, 0);
v10 = cocos2d::CCString::intValue(v9);
v11 = cocos2d::CCArray::stringAtIndex(v7, 1u);
v28 = cocos2d::CCString::intValue(v11);
v12 = cocos2d::CCArray::stringAtIndex(v7, 2u);
v13 = cocos2d::CCString::intValue(v12);
v14 = cocos2d::CCArray::stringAtIndex(v7, 3u);
v15 = cocos2d::CCString::intValue(v14);
v16 = 0;
v26 = v13;
v29 = v13 == v15;
if ( v13 != v15 )
v8 = v15;
v27 = v8;
v17 = v10;
v18 = v10 <= 0;
v19 = (cocos2d::CCObject *)sub_10071F9E0(v14, 3);
if ( !v18 )
{
v20 = (cocos2d::CCObject *)operator new(0x48u);
cocos2d::CCObject::CCObject(v20);
v20->__vftable = (cocos2d::CCObject_vtbl *)off_1008B38A8;
LODWORD(v20[1].__vftable) = 7;
v20[1].m_uID = 0;
v20[1].m_nLuaID = v17;
cocos2d::CCObject::autorelease(v20);
sub_10071FCD0(v19, v20);
}
if ( v28 > 0 )
{
v21 = (cocos2d::CCObject *)operator new(0x48u);
cocos2d::CCObject::CCObject(v21);
v21->__vftable = (cocos2d::CCObject_vtbl *)off_1008B38A8;
LODWORD(v21[1].__vftable) = 8;
v21[1].m_uID = 0;
v21[1].m_nLuaID = v28;
cocos2d::CCObject::autorelease(v21);
sub_10071FCD0(v19, v21);
}
if ( v26 )
{
v22 = (cocos2d::CCObject *)operator new(0x48u);
cocos2d::CCObject::CCObject(v22);
LOBYTE(v16) = v29;
v22->__vftable = (cocos2d::CCObject_vtbl *)off_1008B38A8;
LODWORD(v22[1].__vftable) = v26;
v22[1].m_uID = 0;
v22[1].m_nLuaID = v16 + 1;
cocos2d::CCObject::autorelease(v22);
sub_10071FCD0(v19, v22);
}
if ( v27 )
{
v23 = (cocos2d::CCObject *)operator new(0x48u);
cocos2d::CCObject::CCObject(v23);
v23->__vftable = (cocos2d::CCObject_vtbl *)off_1008B38A8;
LODWORD(v23[1].__vftable) = v27;
*(_QWORD *)&v23[1].m_uID = &_mh_execute_header;
cocos2d::CCObject::autorelease(v23);
sub_10071FCD0(v19, v23);
}
if ( (unsigned int)sub_100720070(v19) )
{
v24 = *(cocos2d::CCObject **)(a1 + 72);
if ( v24 != v19 )
{
if ( v19 )
{
cocos2d::CCObject::retain(v19);
v24 = *(cocos2d::CCObject **)(a1 + 72);
}
if ( v24 )
cocos2d::CCObject::release(v24);
*(_QWORD *)(a1 + 72) = v19;
}
}
}
return 1;
}