//
// std::vector>::_M_default_append from 0x49bf98 to 0x49c090 (248 bytes)
//
// 1 xrefs:
// > GJEffectManager::saveToState @ 0x4a690c
//
// 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 __fastcall std::vector::_M_default_append(int a1, unsigned int a2)
{
int v4; // r4
int v5; // r4
unsigned int v6; // r9
int v7; // r3
int v8; // r4
unsigned int v9; // r3
unsigned int v10; // r2
char *v11; // r10
int v12; // r9
char *v13; // r9
char *v14; // r3
unsigned int v15; // r8
char *v16; // r6
char *v17; // [sp+4h] [bp-50h]
_BYTE v18[68]; // [sp+Ch] [bp-48h] BYREF
if ( a2 )
{
v4 = *(_DWORD *)(a1 + 4);
if ( -252645135 * ((*(_DWORD *)(a1 + 8) - v4) >> 2) < a2 )
{
v7 = v4 - *(_DWORD *)a1;
v8 = 63161283;
v9 = -252645135 * (v7 >> 2);
if ( 63161283 - v9 < a2 )
sub_7731C4("vector::_M_default_append", a2, 63161283 - v9);
if ( v9 < a2 )
v10 = v9 + a2;
else
v10 = 2 * v9;
if ( v10 < v9 || v10 > 0x3C3C3C3 || (v8 = v10) != 0 )
v11 = (char *)operator new(68 * v8);
else
v11 = nullptr;
v12 = *(_DWORD *)(a1 + 4) - *(_DWORD *)a1;
if ( -252645135 * (v12 >> 2) )
memmove(v11, *(const void **)a1, *(_DWORD *)(a1 + 4) - *(_DWORD *)a1);
v13 = &v11[v12];
memset(v18, 0, sizeof(v18));
v14 = v13 + 68;
v15 = a2;
do
{
v17 = v14;
memcpy(v14 - 68, v18, 0x44u);
--v15;
v14 = v17 + 68;
}
while ( v15 );
v16 = &v13[68 * a2];
if ( *(_DWORD *)a1 )
operator delete(*(void **)a1);
*(_DWORD *)a1 = v11;
*(_DWORD *)(a1 + 4) = v16;
*(_DWORD *)(a1 + 8) = &v11[68 * v8];
}
else
{
v5 = v4 + 68;
memset(v18, 0, sizeof(v18));
v6 = a2;
do
{
memcpy((void *)(v5 - 68), v18, 0x44u);
--v6;
v5 += 68;
}
while ( v6 );
*(_DWORD *)(a1 + 4) += 68 * a2;
}
}
}