//
// std::vector>::operator= from 0x4a679c to 0x4a68d4 (312 bytes)
//
// 2 xrefs:
// > GJEffectManager::saveToState @ 0x4a6974
// > GJEffectManager::loadFromState @ 0x4a6b30
//
// 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
//
int __fastcall std::vector::operator=(int a1, GroupCommandObject2 **a2)
{
GroupCommandObject2 *v4; // r6
GroupCommandObject2 *v5; // r8
GroupCommandObject2 *v6; // r9
int v7; // r7
unsigned int v8; // r4
GroupCommandObject2 *v9; // r9
int v10; // r2
int v11; // r8
int v12; // r8
int v13; // r10
GroupCommandObject2 *v14; // r6
GroupCommandObject2 *i; // r4
GroupCommandObject2 *v16; // r0
if ( a2 != (GroupCommandObject2 **)a1 )
{
v4 = *a2;
v5 = a2[1];
v6 = *(GroupCommandObject2 **)a1;
v7 = (char *)v5 - (char *)*a2;
v8 = -1056139499 * (v7 >> 3);
if ( v8 <= -1056139499 * ((*(_DWORD *)(a1 + 8) - *(_DWORD *)a1) >> 3) )
{
v10 = *(_DWORD *)(a1 + 4);
v11 = -1056139499 * ((v10 - (int)v6) >> 3);
if ( v11 < v8 )
{
while ( v11 > 0 )
{
GroupCommandObject2::operator=((int)v6, &v4->m_groupCommandUniqueID, v10);
++v4;
++v6;
--v11;
}
std::__uninitialized_copy::__uninit_copy(
(GroupCommandObject2 *)((char *)*a2 + *(_DWORD *)(a1 + 4) - *(_DWORD *)a1),
a2[1],
*(GroupCommandObject2 **)(a1 + 4));
}
else
{
v12 = -1056139499 * (v7 >> 3);
v13 = *(_DWORD *)a1;
while ( v12 > 0 )
{
GroupCommandObject2::operator=(v13, &v4->m_groupCommandUniqueID, v10);
++v4;
v13 += 488;
--v12;
}
v14 = *(GroupCommandObject2 **)(a1 + 4);
for ( i = &v6[v8 & ~((int)v8 >> 31)]; i != v14; ++i )
{
v16 = i;
GroupCommandObject2::~GroupCommandObject2(v16);
}
}
}
else
{
if ( v8 )
{
if ( v8 > 0x864B8A )
sub_772FB4(a1);
v8 = operator new((char *)v5 - (char *)*a2);
}
v9 = (GroupCommandObject2 *)v8;
while ( v4 != v5 )
{
if ( v9 )
GroupCommandObject2::GroupCommandObject2(v9, v4);
++v4;
++v9;
}
std::_Destroy_aux::__destroy(
*(GroupCommandObject2 **)a1,
*(GroupCommandObject2 **)(a1 + 4));
if ( *(_DWORD *)a1 )
operator delete(*(void **)a1);
*(_DWORD *)a1 = v8;
*(_DWORD *)(a1 + 8) = v8 + v7;
}
*(_DWORD *)(a1 + 4) = v7 + *(_DWORD *)a1;
}
return a1;
}