//
// std::vector>::_M_default_append from 0x324a90 to 0x324b40 (176 bytes)
//
// 1 xrefs:
// > GameManager::calculateBaseKeyForIcons @ 0x324f54
//
// 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; // r3
unsigned int v5; // r2
_DWORD *v6; // r1
unsigned int v7; // r3
unsigned int v8; // r4
char *v9; // r8
size_t v10; // r6
char *v11; // r6
unsigned int v12; // r3
char *v13; // r2
char *v14; // r6
if ( !a2 )
return;
v4 = *(_DWORD *)(a1 + 4);
if ( a2 <= (*(_DWORD *)(a1 + 8) - v4) >> 2 )
{
v5 = a2;
v6 = *(_DWORD **)(a1 + 4);
do
{
--v5;
*v6++ = 0;
}
while ( v5 );
*(_DWORD *)(a1 + 4) = v4 + 4 * a2;
return;
}
v7 = (v4 - *(_DWORD *)a1) >> 2;
if ( 0x3FFFFFFF - v7 < a2 )
sub_7731C4("vector::_M_default_append", a2, 0x3FFFFFFF - v7);
if ( v7 < a2 )
v8 = v7 + a2;
else
v8 = 2 * v7;
if ( v8 >= v7 && v8 < 0x40000000 )
{
if ( !v8 )
{
v9 = nullptr;
goto LABEL_15;
}
}
else
{
v8 = 0x3FFFFFFF;
}
v9 = (char *)operator new(4 * v8);
LABEL_15:
v10 = *(_DWORD *)(a1 + 4) - *(_DWORD *)a1;
if ( v10 >> 2 )
memmove(v9, *(const void **)a1, v10);
v11 = &v9[v10];
v12 = a2;
v13 = v11;
do
{
--v12;
*(_DWORD *)v13 = 0;
v13 += 4;
}
while ( v12 );
v14 = &v11[4 * a2];
if ( *(_DWORD *)a1 )
operator delete(*(void **)a1);
*(_DWORD *)a1 = v9;
*(_DWORD *)(a1 + 4) = v14;
*(_DWORD *)(a1 + 8) = &v9[4 * v8];
}