//
// GJSmartTemplate::getTotalChanceForPrefab from 0x100425dd0 to 0x100425e6f (159 bytes)
//
// 3 xrefs:
// > GJSmartTemplate::getRandomPrefab @ 0x1004246fc
// > BrowseSmartKeyLayer::init @ 0x1004eae97
// > BrowseSmartKeyLayer::updateChanceValues @ 0x1004ebddb
//
// 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, __int128 *a2, double a3)
{
__int64 v3; // r14
unsigned int v4; // ebx
unsigned int *v5; // rax
__int64 v6; // rcx
unsigned __int64 v7; // rax
unsigned __int64 v8; // rcx
__int128 v10; // [rsp+0h] [rbp-30h] BYREF
void *__p; // [rsp+10h] [rbp-20h]
if ( (*(_BYTE *)a2 & 1) != 0 )
{
sub_100006B70(&v10, *((const void **)a2 + 2), *((_QWORD *)a2 + 1), a3);
}
else
{
__p = *((void **)a2 + 2);
v10 = *a2;
}
v3 = cocos2d::CCDictionary::objectForKey_1(*(_QWORD *)(a1 + 56), (char *)&v10);
if ( (v10 & 1) != 0 )
operator delete(__p);
v4 = 0;
if ( v3 )
{
if ( (unsigned int)sub_100720070(v3) )
{
v5 = *(unsigned int **)(v3 + 56);
v6 = *v5;
if ( *v5 )
{
v7 = *((_QWORD *)v5 + 2);
v8 = v7 + 8 * v6 - 8;
v4 = 0;
do
{
if ( !*(_QWORD *)v7 )
break;
v4 += *(_DWORD *)(*(_QWORD *)v7 + 108LL);
v7 += 8LL;
}
while ( v7 <= v8 );
}
}
}
return v4;
}