//
// SetupRandAdvTriggerPopup::addChanceToObject from 0xaeea38 to 0xaeeaf4 (188 bytes)
//
// 3 xrefs:
// > SetupRandAdvTriggerPopup::addChance @ 0xaf0ff4
// > SetupRandAdvTriggerPopup::addChance @ 0xaf102c
// > ??> @ 0xd3558
//
// This function is hookable on this platform (idp: arm, 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 13:01:11 +0000
//
__int64 __fastcall SetupRandAdvTriggerPopup::addChanceToObject(
SetupRandAdvTriggerPopup *this,
RandTriggerGameObject *a2,
unsigned int a3,
int a4)
{
unsigned int *v4; // x6
unsigned int *v5; // x5
unsigned int *v6; // x3
unsigned int v7; // t1
__int64 result; // x0
int v9; // w2
int v10; // [xsp+18h] [xbp+18h] BYREF
unsigned int v11; // [xsp+1Ch] [xbp+1Ch] BYREF
v4 = *((unsigned int **)a2 + 230);
v5 = *((unsigned int **)a2 + 231);
v11 = a3;
v10 = a4;
if ( v4 != v5 )
{
v6 = v4 + 4;
if ( *v4 == a3 )
{
LABEL_10:
result = v4[2] + v10;
v4[2] = result;
return result;
}
while ( 1 )
{
v4 = v6;
if ( v5 == v6 )
break;
v7 = *v6;
v6 += 4;
if ( v7 == a3 )
goto LABEL_10;
}
}
if ( (unsigned __int64)v5 >= *((_QWORD *)a2 + 232) )
return std::vector::__emplace_back_slow_path((__int16 **)a2 + 230, (int *)&v11, &v10);
result = v11;
v9 = v10;
if ( v5 )
{
*v5 = v11;
v5[1] = result;
v5[2] = v9;
v5[3] = 0;
v5 = *((unsigned int **)a2 + 231);
}
*((_QWORD *)a2 + 231) = v5 + 4;
return result;
}