//
// sub_100018610 from 0x100018610 to 0x1000186c0 (176 bytes)
//
// 2 xrefs:
// > sub_10000ECA0 @ 0x10000ed90
// > GJEffectManager::resetToggledGroups @ 0x100010044
//
// 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
//
_QWORD *__fastcall sub_100018610(_QWORD *result, unsigned __int64 a2)
{
unsigned __int64 v2; // x21
_QWORD *v3; // x20
int v4; // w8
_QWORD *v5; // x19
unsigned __int64 v6; // x10
unsigned __int64 v7; // x22
_QWORD *v8; // x9
v2 = a2;
v3 = result;
v4 = *((_DWORD *)result + 2);
v5 = (_QWORD *)*result;
if ( v4 )
{
if ( (unsigned int)(64 - v4) >= a2 )
v6 = a2;
else
v6 = (unsigned int)(64 - v4);
*v5++ |= (0xFFFFFFFFFFFFFFFFLL >> (64 - (unsigned __int8)v4 - (unsigned __int8)v6)) & (-1LL << v4);
v2 = a2 - v6;
*result = v5;
}
v7 = v2 >> 6;
if ( v2 >= 0x40 )
result = memset(v5, 255, 8 * v7);
if ( (v2 & 0x3F) != 0 )
{
v8 = &v5[v7];
*v3 = v8;
*v8 |= 0xFFFFFFFFFFFFFFFFLL >> -(v2 & 0x3F);
}
return result;
}