//
// GJSmartTemplate::getTotalChanceForPrefab from 0x100007020 to 0x1000070e8 (200 bytes)
//
// 3 xrefs:
// > GJSmartTemplate::getRandomPrefab @ 0x100006164
// > BrowseSmartKeyLayer::init @ 0x100072c94
// > BrowseSmartKeyLayer::updateChanceValues @ 0x100073990
//
// 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 GJSmartTemplate::getTotalChanceForPrefab(__int64 a1, __int64 a2)
{
__int64 v3; // x0
__int64 v4; // x19
__int64 result; // x0
unsigned int *v6; // x8
__int64 v7; // x9
unsigned __int64 v8; // x8
unsigned __int64 v9; // x9
void *__p[2]; // [xsp+0h] [xbp-30h] BYREF
__int64 v11; // [xsp+10h] [xbp-20h]
if ( *(char *)(a2 + 23) < 0 )
{
sub_1000097D0(__p, *(void **)a2);
}
else
{
*(_OWORD *)__p = *(_OWORD *)a2;
v11 = *(_QWORD *)(a2 + 16);
}
v3 = cocos2d::CCDictionary::objectForKey_1(*(_QWORD *)(a1 + 56), __p);
v4 = v3;
if ( SHIBYTE(v11) < 0 )
{
operator delete(__p[0]);
if ( !v4 )
return 0;
}
else if ( !v3 )
{
return 0;
}
result = sub_10024A36C(v4);
if ( !(_DWORD)result )
return result;
v6 = *(unsigned int **)(v4 + 56);
v7 = *v6;
if ( !(_DWORD)v7 )
return 0;
result = 0;
v8 = *((_QWORD *)v6 + 2);
v9 = v8 + 8 * v7 - 8;
do
{
if ( !*(_QWORD *)v8 )
break;
result = (unsigned int)(*(_DWORD *)(*(_QWORD *)v8 + 108LL) + result);
v8 += 8LL;
}
while ( v8 <= v9 );
return result;
}