//
// ChanceTriggerGameObject::remapChanceObjects from 0x4e8c80 to 0x4e8d02 (130 bytes)
//
// 1 xrefs:
// > GJBaseGameLayer::applyRemap @ 0x5a7ac0
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 11:51:07 +0000
//
unsigned int __fastcall ChanceTriggerGameObject::remapChanceObjects(unsigned int result, _DWORD *a2)
{
int v3; // r4
unsigned int v4; // r6
unsigned int v5; // r10
unsigned int v6; // r7
int v7; // r11
_DWORD *v8; // r2
_DWORD *i; // r5
int v10; // r1
int v11; // [sp+4h] [bp-8h]
v3 = *(_DWORD *)(result + 1648);
v11 = *(_DWORD *)(result + 1652);
LABEL_2:
while ( 1 )
{
v3 += 16;
if ( v11 == v3 - 16 )
return result;
v4 = a2[1];
v5 = *(_DWORD *)(v3 - 16);
if ( v4 )
{
v6 = v4 - 1;
if ( ((v4 - 1) & v4) != 0 )
{
result = v5 / v4;
v7 = v5 % v4;
}
else
{
v7 = v5 & v6;
}
v8 = *(_DWORD **)(*a2 + 4 * v7);
if ( v8 )
{
for ( i = (_DWORD *)*v8; i; i = (_DWORD *)*i )
{
result = i[1];
if ( ((v4 - 1) & v4) != 0 )
{
v10 = result % v4;
result /= v4;
}
else
{
v10 = v6 & result;
}
if ( v10 != v7 )
break;
if ( i[2] == v5 )
{
*(_DWORD *)(v3 - 16) = i[3];
goto LABEL_2;
}
}
}
}
}
}