//
// sub_46C4DA from 0x46c4da to 0x46c570 (150 bytes)
//
// 3 xrefs:
// > GJBaseGameLayer::reAddToStickyGroup @ 0x48c662
// > GJBaseGameLayer::generateTargetGroups @ 0x48d8a4
// > GJBaseGameLayer::prepareSavePositionObjects @ 0x495176
//
// 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
//
void **__fastcall sub_46C4DA(int *a1, _DWORD *a2)
{
unsigned int v2; // r9
int v4; // r6
void **result; // r0
int v6; // r8
void **v7; // r7
_DWORD *v8; // r10
int v9; // r1
int v10; // r2
int v11; // r1
v2 = a1[1];
v4 = *a2 % v2;
result = (void **)sub_46C49C(a1, v4, a2);
if ( result )
{
v6 = *a1;
v7 = (void **)*result;
if ( result != *(void ***)(*a1 + 4 * v4) )
{
if ( *v7 )
{
v11 = *((_DWORD *)*v7 + 1) % v2;
if ( v11 != v4 )
*(_DWORD *)(v6 + 4 * v11) = result;
}
goto LABEL_12;
}
v8 = *v7;
if ( *v7 )
{
v9 = v8[1] % v2;
if ( v9 == v4 )
{
LABEL_12:
*result = *v7;
operator delete(v7);
--a1[3];
return (void **)(&dword_0 + 1);
}
*(_DWORD *)(v6 + 4 * v9) = result;
}
v10 = *a1;
if ( *(int **)(*a1 + 4 * v4) == a1 + 2 )
a1[2] = (int)v8;
*(_DWORD *)(v10 + 4 * v4) = 0;
goto LABEL_12;
}
return result;
}