//
// GJEffectManager::toggleGroup from 0xa11cb0 to 0xa11f64 (692 bytes)
//
// 8 xrefs:
// > LevelEditorLayer::toggleGroupPreview @ 0x78cd60
// > LevelEditorLayer::toggleGroupPreview @ 0x78cdc0
// > GJBaseGameLayer::toggleGroup @ 0x9a0868
// > GJBaseGameLayer::toggleGroup @ 0x9a08c8
// > GJEffectManager::handleObjectCollision @ 0xa120b8
// > GJEffectManager::playerButton @ 0xa125d8
// > GJEffectManager::updateCountForItem @ 0xa12a14
// > ??> @ 0xe93b0
//
// 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:59:31 +0000
//
__int64 __fastcall GJEffectManager::toggleGroup(GJEffectManager *this, int a2, char a3)
{
int v4; // w22
__int64 v5; // x4
__int64 v6; // x3
__int64 v7; // x5
unsigned __int64 v9; // x26
unsigned __int64 v10; // x20
unsigned __int64 v11; // x24
__int64 v12; // x23
unsigned __int64 v13; // x3
__int64 v14; // x25
__int64 *v15; // x0
unsigned __int64 v16; // x1
unsigned __int64 v17; // x1
float v18; // s2
float v19; // s0
bool v20; // cc
__int64 v21; // x26
unsigned __int64 v22; // x26
unsigned __int64 v23; // x1
_QWORD *v24; // x0
__int64 v25; // x1
unsigned __int64 v26; // x1
unsigned __int64 v27; // x24
_BOOL8 v28; // x2
int v29; // [xsp+5Ch] [xbp+5Ch] BYREF
void *v30[3]; // [xsp+60h] [xbp+60h] BYREF
v29 = a2;
if ( a2 > 9998 )
{
v6 = 0x8000;
v5 = 1248;
v4 = 9999;
}
else
{
if ( a2 < 0 )
v4 = 0;
else
v4 = a2;
v5 = ((__int64)v4 >> 3) & 0x1FFFFFFFFFFFFFF8LL;
v6 = 1LL << (v4 & 0x3F);
}
v29 = v4;
v7 = *((_QWORD *)this + 126);
if ( !a3 )
{
*(_QWORD *)(v7 + v5) &= ~v6;
v9 = *((_QWORD *)this + 130);
v10 = v29;
if ( v9 )
{
v11 = v9 - 1;
v12 = (v9 - 1) & v9;
v13 = (v9 - 1) & v29;
if ( v12 )
v13 = v29 % v9;
v14 = 8 * v13;
v15 = *(__int64 **)(*((_QWORD *)this + 129) + 8 * v13);
if ( v15 )
{
while ( 1 )
{
v15 = (__int64 *)*v15;
if ( !v15 )
break;
v16 = v15[1];
v17 = v12 ? v16 % v9 : v11 & v16;
if ( v13 != v17 )
break;
if ( v29 == *((_DWORD *)v15 + 4) )
return _stack_chk_guard;
}
}
std::__hash_table,std::equal_to,std::allocator>::__construct_node_hash(
(__int64)this + 1032,
v29,
&v29,
(__int64)v30);
v18 = *((float *)this + 266);
v19 = (float)(unsigned __int64)(*((_QWORD *)this + 132) + 1LL);
if ( v19 <= (float)((float)v9 * v18) )
goto LABEL_29;
v20 = v9 > 2;
v21 = 2 * v9;
v28 = !v20 || v12 != 0;
}
else
{
v21 = 0;
std::__hash_table,std::equal_to,std::allocator>::__construct_node_hash(
(__int64)this + 1032,
v29,
&v29,
(__int64)v30);
v28 = 1;
v18 = *((float *)this + 266);
v19 = (float)(unsigned __int64)(*((_QWORD *)this + 132) + 1LL);
}
v22 = v28 + v21;
v23 = vcvtps_u32_f32(v19 / v18);
if ( v23 < v22 )
v23 = v22;
std::__hash_table,std::equal_to,std::allocator>::rehash(
(unsigned __int64)this + 1032,
v23);
v9 = *((_QWORD *)this + 130);
v11 = v9 - 1;
if ( ((v9 - 1) & v9) == 0 )
{
v14 = 8 * (v11 & v10);
v24 = *(_QWORD **)(*((_QWORD *)this + 129) + v14);
if ( v24 )
goto LABEL_30;
goto LABEL_34;
}
v14 = 8 * (v10 % v9);
LABEL_29:
v24 = *(_QWORD **)(*((_QWORD *)this + 129) + v14);
if ( v24 )
{
LABEL_30:
*(_QWORD *)v30[0] = *v24;
*v24 = v30[0];
LABEL_31:
++*((_QWORD *)this + 132);
return _stack_chk_guard;
}
LABEL_34:
*(_QWORD *)v30[0] = *((_QWORD *)this + 131);
v25 = *((_QWORD *)this + 129);
*((void **)this + 131) = v30[0];
*(_QWORD *)(v25 + v14) = (char *)this + 1048;
if ( *(_QWORD *)v30[0] )
{
v26 = *(_QWORD *)(*(_QWORD *)v30[0] + 8LL);
if ( (v11 & v9) != 0 )
v27 = v26 % v9;
else
v27 = v11 & v26;
*(void **)(*((_QWORD *)this + 129) + 8 * v27) = v30[0];
}
goto LABEL_31;
}
*(_QWORD *)(v7 + v5) |= v6;
std::__hash_table,std::equal_to,std::allocator>::__erase_unique(
(__int64 *)this + 129,
&v29);
return _stack_chk_guard;
}