//
// GJSmartTemplate::getTotalChanceForPrefab from 0x1402b2970 to 0x1402b2a30 (192 bytes)
//
// 4 xrefs:
// > GJSmartTemplate::getRandomPrefab @ 0x1402b2acc
// > BrowseSmartKeyLayer::init @ 0x14045b772
// > BrowseSmartKeyLayer::updateChanceValues @ 0x14045c37a
// > ??> @ 0x1406d2384
//
// 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
//
// Hidden C++ exception states: #wind=2
__int64 __fastcall GJSmartTemplate::getTotalChanceForPrefab(__int64 a1, __int64 a2)
{
cocos2d::CCArray *v4; // rdi
unsigned int v5; // ebx
cocos2d::ccArray *data; // rdx
__int64 num; // rax
cocos2d::CCObject **arr; // rdx
cocos2d::CCObject **i; // r9
__int64 v11; // [rsp+20h] [rbp-48h]
char v12[32]; // [rsp+28h] [rbp-40h] BYREF
__int64 v13; // [rsp+48h] [rbp-20h]
v13 = a2;
v11 = sub_14003BDB0((__int64)v12, a2);
v4 = (cocos2d::CCArray *)cocos2d::CCDictionary::objectForKey(*(_QWORD *)(a1 + 56), v11);
sub_14003A830(v11);
v5 = 0;
if ( v4 )
{
if ( cocos2d::CCArray::count(v4) )
{
data = v4->data;
num = data->num;
if ( (_DWORD)num )
{
arr = data->arr;
for ( i = &arr[num - 1]; arr <= i; ++arr )
{
if ( !*arr )
break;
v5 += (*arr)[2].m_nLuaID;
}
}
}
}
sub_14003A830(a2);
return v5;
}