//
// ChanceTriggerGameObject::remapChanceObjects from 0x1001a3540 to 0x1001a3681 (321 bytes)
//
// 1 xrefs:
// > GJBaseGameLayer::applyRemap @ 0x10010ab1e
//
// This function is hookable on this platform (idp: pc, 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:26:00 +0000
//
void __fastcall ChanceTriggerGameObject::remapChanceObjects(__int64 a1, __int64 *a2)
{
int *v2; // r8
int *v3; // rdi
unsigned __int64 v4; // r10
unsigned __int64 v5; // rax
__int64 v6; // r9
__int64 v7; // rcx
__int64 *v8; // rsi
__int64 v9; // r10
unsigned __int64 v10; // rcx
unsigned __int64 v11; // rsi
__int64 **v12; // rax
__int64 *v13; // r11
unsigned __int64 v14; // rax
v2 = *(int **)(a1 + 1840);
v3 = *(int **)(a1 + 1848);
if ( v2 == v3 )
return;
v4 = a2[1];
v5 = v4 - 1;
if ( !v4 )
return;
v6 = *a2;
if ( ((v4 - 1) & v4) != 0 )
{
while ( 1 )
{
v10 = *v2;
v11 = v10;
if ( v4 <= v10 )
{
if ( !((v4 | v10) >> 32) )
{
v11 = (unsigned int)v10 % (unsigned int)v4;
v12 = *(__int64 ***)(v6 + 8 * v11);
if ( !v12 )
goto LABEL_14;
LABEL_19:
v13 = *v12;
while ( 2 )
{
if ( !v13 )
goto LABEL_14;
v14 = v13[1];
if ( v14 == v10 )
{
if ( *((_DWORD *)v13 + 4) == (_DWORD)v10 )
{
*v2 = *((_DWORD *)v13 + 5);
goto LABEL_14;
}
}
else if ( v14 < v4 )
{
LABEL_27:
if ( v14 != v11 )
goto LABEL_14;
}
else
{
if ( (v4 | v14) >> 32 )
{
v14 %= v4;
goto LABEL_27;
}
if ( (unsigned int)v14 % (unsigned int)v4 != v11 )
goto LABEL_14;
}
v13 = (__int64 *)*v13;
continue;
}
}
v11 = v10 % v4;
}
v12 = *(__int64 ***)(v6 + 8 * v11);
if ( v12 )
goto LABEL_19;
LABEL_14:
v2 += 4;
if ( v2 == v3 )
return;
}
}
do
{
v7 = *v2;
v8 = *(__int64 **)(v6 + 8 * (v7 & v5));
if ( v8 )
{
while ( 1 )
{
v8 = (__int64 *)*v8;
if ( !v8 )
break;
v9 = v8[1];
if ( v9 == v7 )
{
if ( *((_DWORD *)v8 + 4) == (_DWORD)v7 )
{
*v2 = *((_DWORD *)v8 + 5);
break;
}
}
else if ( (v5 & v9) != (v7 & v5) )
{
break;
}
}
}
v2 += 4;
}
while ( v2 != v3 );
}