//
// std::vector>::resize from 0x36d694 to 0x36d72e (154 bytes)
//
// 1 xrefs:
// > LevelEditorLayer::init @ 0x37667e
//
// 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::resize(int a1, unsigned int a2)
{
_BYTE *v3; // r2
_BYTE *v4; // r0
size_t v5; // r3
size_t v6; // r4
unsigned int v7; // r6
char *v8; // r8
int v9; // r0
size_t v10; // r7
char *v11; // r0
char *v12; // r7
v3 = *(_BYTE **)a1;
v4 = *(_BYTE **)(a1 + 4);
v5 = v4 - v3;
if ( a2 > v4 - v3 )
{
v6 = a2 - v5;
if ( a2 == v5 )
return;
if ( *(_DWORD *)(a1 + 8) - (int)v4 >= v6 )
{
memset(v4, 0, v6);
*(_DWORD *)(a1 + 4) += v6;
return;
}
if ( ~v5 < v6 )
sub_7731C4("vector::_M_default_append", a2, ~v5);
if ( v6 < v5 )
v7 = 2 * v5;
else
v7 = a2;
if ( v7 < v5 )
{
v7 = -1;
}
else if ( !v7 )
{
v8 = nullptr;
goto LABEL_16;
}
v8 = (char *)operator new(v7);
LABEL_16:
v9 = *(_DWORD *)(a1 + 4);
v10 = v9 - *(_DWORD *)a1;
if ( v9 != *(_DWORD *)a1 )
memmove(v8, *(const void **)a1, v10);
v11 = &v8[v10];
v12 = &v8[v10 + v6];
memset(v11, 0, v6);
if ( *(_DWORD *)a1 )
operator delete(*(void **)a1);
*(_DWORD *)a1 = v8;
*(_DWORD *)(a1 + 4) = v12;
*(_DWORD *)(a1 + 8) = &v8[v7];
return;
}
if ( a2 < v4 - v3 )
*(_DWORD *)(a1 + 4) = &v3[a2];
}