//
// GameObject::createColorGroupContainer from 0x646c60 to 0x646d6c (268 bytes)
//
// 2 xrefs:
// > GameObject::addToColorGroup @ 0x646dac
// > ??> @ 0xb5278
//
// 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 GameObject::createColorGroupContainer(GameObject *a1, int a2)
{
unsigned __int64 v4; // x0
std::array *v5; // x0
unsigned int v6; // w2
int v7; // w1
std::array *v8; // x4
unsigned int v9; // w3
__int16 *v10; // x0
if ( !a1->m_colorGroups )
{
v4 = 2LL * a2;
if ( (unsigned __int64)a2 > 0x3F80000000000000LL )
v4 = -1;
v5 = (std::array *)operator new[](v4);
a1->m_colorGroups = v5;
if ( a2 > 0 )
{
v6 = ((unsigned int)(a2 - 8) >> 3) + 1;
v7 = 8 * v6;
if ( (unsigned int)(a2 - 1) <= 6 )
{
v7 = 0;
}
else
{
v8 = v5;
v9 = 0;
do
{
*(_OWORD *)v8->__elems_ = 0u;
v8 = (std::array *)((char *)v8 + 16);
++v9;
}
while ( v6 > v9 );
if ( a2 == v7 )
return;
}
v5->__elems_[v7] = 0;
if ( a2 > v7 + 1 )
{
v10 = &v5->__elems_[v7];
v10[1] = 0;
if ( a2 > v7 + 2 )
{
v10[2] = 0;
if ( a2 > v7 + 3 )
{
v10[3] = 0;
if ( a2 > v7 + 4 )
{
v10[4] = 0;
if ( a2 > v7 + 5 )
{
v10[5] = 0;
if ( a2 > v7 + 6 )
v10[6] = 0;
}
}
}
}
}
}
}
}