//
// std::vector>::operator= from 0x3152e0 to 0x3153b6 (214 bytes)
//
// 1 xrefs:
// > GJGameState::operator= @ 0x31ed86
//
// 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, char **a2)
{
char *v3; // r7
char *v4; // r10
_BYTE *v5; // r11
int v6; // r9
unsigned int v7; // r4
char *v8; // r3
char *v9; // r3
int v10; // r6
int v11; // r6
char *v12; // r8
int v13; // r4
char *v15; // [sp+4h] [bp-8h]
if ( a2 != (char **)a1 )
{
v3 = *a2;
v4 = a2[1];
v5 = *(_BYTE **)a1;
v6 = v4 - *a2;
v7 = -858993459 * (v6 >> 5);
if ( v7 <= -858993459 * ((*(_DWORD *)(a1 + 8) - *(_DWORD *)a1) >> 5) )
{
v9 = *(char **)(a1 + 4);
v10 = -858993459 * ((v9 - v5) >> 5);
if ( v10 < v7 )
{
v12 = &v3[v9 - v5];
v13 = 0;
while ( v10 > 0 )
{
v15 = v9;
--v10;
memcpy(&v5[v13], &v3[v13], 0xA0u);
v13 += 160;
v9 = v15;
}
while ( v12 != v4 )
{
if ( v9 )
v9 = (char *)memcpy(v9, v12, 0xA0u);
v12 += 160;
v9 += 160;
}
}
else
{
v11 = 0;
while ( (int)v7 > 0 )
{
--v7;
memcpy(&v5[v11], &v3[v11], 0xA0u);
v11 += 160;
}
}
}
else
{
if ( v7 )
{
if ( v7 > 0x1999999 )
sub_772FB4(a1);
v7 = operator new(v4 - *a2);
}
v8 = (char *)v7;
while ( v3 != v4 )
{
if ( v8 )
v8 = (char *)memcpy(v8, v3, 0xA0u);
v3 += 160;
v8 += 160;
}
if ( *(_DWORD *)a1 )
operator delete(*(void **)a1);
*(_DWORD *)a1 = v7;
*(_DWORD *)(a1 + 8) = v7 + v6;
}
*(_DWORD *)(a1 + 4) = *(_DWORD *)a1 + v6;
}
return a1;
}