//
// std::vector>::operator= from 0x679ae0 to 0x679c3c (348 bytes)
//
// 3 xrefs:
// > std::vector>::operator= @ 0x679cc4
// > std::vector>::operator= @ 0x679d84
// > ??> @ 0x9baf0
//
// 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
//
__int64 __fastcall std::vector::operator=(__int64 a1, __int64 **a2)
{
__int64 *v3; // x19
__int64 *v4; // x20
char *v5; // x0
signed __int64 v6; // x22
__int64 v7; // x3
char *v8; // x2
signed __int64 v9; // x1
__int64 v10; // x4
char *v11; // x1
__int64 v12; // x2
__int64 v13; // x3
char *v14; // x22
__int64 *v16; // x3
__int64 v17; // x4
__int64 v18; // x5
__int64 *v19; // x19
__int64 v20; // x5
__int64 v21; // x23
_QWORD *i; // x1
__int64 v23; // x3
__int64 v24; // x22
if ( a2 != (__int64 **)a1 )
{
v3 = *a2;
v4 = a2[1];
v5 = *(char **)a1;
v6 = (char *)v4 - (char *)*a2;
v7 = v6 >> 4;
if ( v6 >> 4 <= (unsigned __int64)((__int64)(*(_QWORD *)(a1 + 16) - (_QWORD)v5) >> 4) )
{
v8 = *(char **)(a1 + 8);
v9 = v8 - v5;
v10 = (v8 - v5) >> 4;
if ( v7 > (unsigned __int64)v10 )
{
v16 = v3;
if ( v10 > 0 )
{
do
{
v17 = *v16;
v18 = v16[1];
v16 += 2;
*(_QWORD *)v5 = v17;
*((_QWORD *)v5 + 1) = v18;
v5 += 16;
}
while ( v16 != (__int64 *)((char *)v3 + v9) );
v5 = *(char **)a1;
v9 = *(_QWORD *)(a1 + 8) - *(_QWORD *)a1;
}
v19 = (__int64 *)((char *)v3 + v9);
if ( v4 != v19 )
{
do
{
if ( v8 )
{
v20 = v19[1];
*(_QWORD *)v8 = *v19;
*((_QWORD *)v8 + 1) = v20;
}
v19 += 2;
v8 += 16;
}
while ( v4 != v19 );
v14 = &v5[v6];
goto LABEL_7;
}
}
else
{
v11 = v5;
if ( v7 > 0 )
{
do
{
v12 = *v3;
v13 = v3[1];
v3 += 2;
*(_QWORD *)v11 = v12;
*((_QWORD *)v11 + 1) = v13;
v11 += 16;
}
while ( v3 != v4 );
}
}
v14 = &v5[v6];
LABEL_7:
*(_QWORD *)(a1 + 8) = v14;
return a1;
}
v21 = 0;
if ( v7 )
{
if ( (unsigned __int64)v7 > 0xFFFFFFFFFFFFFFFLL )
sub_D1383C();
v21 = operator new(v6);
v5 = *(char **)a1;
}
for ( i = (_QWORD *)v21; v4 != v3; i += 2 )
{
if ( i )
{
v23 = v3[1];
*i = *v3;
i[1] = v23;
}
v3 += 2;
}
if ( v5 )
operator delete(v5);
v24 = v21 + v6;
*(_QWORD *)a1 = v21;
*(_QWORD *)(a1 + 16) = v24;
*(_QWORD *)(a1 + 8) = v24;
}
return a1;
}