//
// std::vector>::reserve from 0x8ba248 to 0x8ba3f8 (432 bytes)
//
// 2 xrefs:
// > GJEffectManager::createKeyframeCommand @ 0x8ba874
// > ??> @ 0x81708
//
// 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
//
unsigned __int64 __fastcall std::vector::reserve(__int64 a1, unsigned __int64 a2, double a3)
{
__int64 *v5; // x19
unsigned __int64 result; // x0
__int64 *v7; // x1
signed __int64 v8; // x24
__int64 v9; // x23
__int64 *v10; // x19
__int64 *v11; // x21
void *v12; // x0
void *v13; // x0
void *v14; // x0
void *v15; // x0
void *v16; // x0
void *v17; // x0
void *v18; // x0
void *v19; // x0
void *v20; // x0
void *v21; // x0
__int64 *v22; // [xsp+48h] [xbp+48h]
if ( a2 > 0x92492492492492LL )
sub_D13AF4("vector::reserve");
v5 = *(__int64 **)a1;
result = 0x6DB6DB6DB6DB6DB7LL * ((__int64)(*(_QWORD *)(a1 + 16) - *(_QWORD *)a1) >> 6);
if ( a2 > result )
{
v7 = *(__int64 **)(a1 + 8);
v8 = (char *)v7 - (char *)v5;
if ( a2 )
{
v22 = *(__int64 **)(a1 + 8);
v9 = operator new(448 * a2);
v7 = v22;
}
else
{
v9 = 0;
}
std::__uninitialized_copy::__uninit_copy(v5, v7, v9, a3);
v10 = *(__int64 **)a1;
v11 = *(__int64 **)(a1 + 8);
if ( *(__int64 **)a1 != v11 )
{
do
{
v12 = (void *)v10[37];
if ( v12 )
operator delete(v12);
v13 = (void *)v10[34];
if ( v13 )
operator delete(v13);
v14 = (void *)v10[31];
if ( v14 )
operator delete(v14);
v15 = (void *)v10[28];
if ( v15 )
operator delete(v15);
v16 = (void *)v10[25];
if ( v16 )
operator delete(v16);
v17 = (void *)v10[16];
if ( v17 )
operator delete(v17);
v18 = (void *)v10[13];
if ( v18 )
operator delete(v18);
v19 = (void *)v10[10];
if ( v19 )
operator delete(v19);
v20 = (void *)v10[7];
if ( v20 )
operator delete(v20);
v21 = (void *)v10[4];
if ( v21 )
operator delete(v21);
v10 += 56;
}
while ( v11 != v10 );
v11 = *(__int64 **)a1;
}
if ( v11 )
operator delete(v11);
*(_QWORD *)a1 = v9;
result = v9 + 448 * a2;
*(_QWORD *)(a1 + 8) = v9 + v8;
*(_QWORD *)(a1 + 16) = result;
}
return result;
}