//
// tinyxml2::DynArray::EnsureCapacity from 0x180098f90 to 0x180099006 (118 bytes)
//
// 10 xrefs:
// > tinyxml2::MemPoolT<72>::Alloc @ 0x18009840c
// > tinyxml2::MemPoolT<88>::Alloc @ 0x1800985cc
// > tinyxml2::MemPoolT<96>::Alloc @ 0x18009878e
// > tinyxml2::MemPoolT<104>::Alloc @ 0x18009889c
// > tinyxml2::XMLPrinter::OpenElement @ 0x18009a1fa
// > tinyxml2::DynArray::Push @ 0x18009b485
// > ??> @ 0x18013ebc4
// > ??> @ 0x18013ebd4
// > ??> @ 0x1801438a8
// > ??> @ 0x1801b6d98
//
// 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
//
// Alternative name is '?EnsureCapacity@?$DynArray@PEAUBlock@?$MemPoolT@$0EI@@tinyxml2@@$09@tinyxml2@@AEAAXH@Z'
// Alternative name is '?EnsureCapacity@?$DynArray@PEAUBlock@?$MemPoolT@$0FI@@tinyxml2@@$09@tinyxml2@@AEAAXH@Z'
// Alternative name is '?EnsureCapacity@?$DynArray@PEAUBlock@?$MemPoolT@$0GA@@tinyxml2@@$09@tinyxml2@@AEAAXH@Z'
// Alternative name is '?EnsureCapacity@?$DynArray@PEAUBlock@?$MemPoolT@$0GI@@tinyxml2@@$09@tinyxml2@@AEAAXH@Z'
void __fastcall tinyxml2::DynArray::EnsureCapacity(__int64 a1, int a2)
{
int v3; // edi
void *v4; // rsi
if ( a2 > *(_DWORD *)(a1 + 88) )
{
v3 = 2 * a2;
v4 = operator new(saturated_mul(2 * a2, 8u));
memcpy(v4, *(const void **)a1, 8LL * *(int *)(a1 + 92));
if ( *(_QWORD *)a1 != a1 + 8 )
j_j_free_0(*(void **)a1);
*(_QWORD *)a1 = v4;
*(_DWORD *)(a1 + 88) = v3;
}
}