//
// std::vector>::emplace_back from 0x48070c to 0x48078a (126 bytes)
//
// 1 xrefs:
// > GJBaseGameLayer::sortGroups @ 0x489df4
//
// 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::emplace_back(int a1, _DWORD *a2)
{
_DWORD *v3; // r3
int v5; // r3
int v6; // r4
bool v7; // cf
unsigned int v8; // r4
char *v9; // r6
int v10; // r3
size_t v11; // r7
char *v12; // r7
v3 = *(_DWORD **)(a1 + 4);
if ( v3 != *(_DWORD **)(a1 + 8) )
{
if ( v3 )
*v3 = *a2;
*(_DWORD *)(a1 + 4) += 4;
return;
}
v5 = ((int)v3 - *(_DWORD *)a1) >> 2;
if ( v5 )
v6 = v5;
else
v6 = 1;
v7 = __CFADD__(v6, v5);
v8 = v6 + v5;
if ( v7 || v8 >= 0x40000000 )
{
v8 = 0x3FFFFFFF;
}
else if ( !v8 )
{
v9 = nullptr;
goto LABEL_12;
}
v9 = (char *)operator new(4 * v8);
LABEL_12:
v10 = *(_DWORD *)(a1 + 4) - *(_DWORD *)a1;
if ( &v9[v10] )
*(_DWORD *)&v9[v10] = *a2;
v11 = *(_DWORD *)(a1 + 4) - *(_DWORD *)a1;
if ( v11 >> 2 )
memmove(v9, *(const void **)a1, v11);
v12 = &v9[v11 + 4];
if ( *(_DWORD *)a1 )
operator delete(*(void **)a1);
*(_DWORD *)a1 = v9;
*(_DWORD *)(a1 + 4) = v12;
*(_DWORD *)(a1 + 8) = &v9[4 * v8];
}