//
// ChanceTriggerGameObject::remapChanceObjects from 0x87aa70 to 0x87ab18 (168 bytes)
//
// 2 xrefs:
// > GJBaseGameLayer::applyRemap @ 0x9c7ae4
// > ??> @ 0xc4708
//
// 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 12:55:51 +0000
//
__int64 __fastcall ChanceTriggerGameObject::remapChanceObjects(__int64 result, _QWORD *a2)
{
int *v2; // x10
int *i; // x7
unsigned __int64 v4; // x4
int v5; // w5
unsigned __int64 v6; // x9
unsigned __int64 v7; // x6
unsigned __int64 v8; // x2
v2 = *(int **)(result + 1848);
for ( i = *(int **)(result + 1840); v2 != i; i += 4 )
{
LABEL_5:
v4 = a2[1];
v5 = *i;
if ( v4 )
{
v6 = v4 - 1;
v7 = ((v4 - 1) & v4) != 0 ? v5 % v4 : v5 & v6;
result = *(_QWORD *)(*a2 + 8 * v7);
if ( result )
{
while ( 1 )
{
result = *(_QWORD *)result;
if ( !result )
break;
v8 = *(_QWORD *)(result + 8);
if ( ((v4 - 1) & v4) != 0 )
{
if ( v7 != v8 % v4 )
break;
}
else if ( v7 != (v6 & v8) )
{
break;
}
if ( v5 == *(_DWORD *)(result + 16) )
{
result = *(unsigned int *)(result + 20);
i += 4;
*(i - 4) = result;
if ( v2 != i )
goto LABEL_5;
return result;
}
}
}
}
}
return result;
}