//
// std::__ndk1::vector>::__append from 0x5c5ea0 to 0x5c5f9a (250 bytes)
//
// 2 xrefs:
// > GJEffectManager::saveToState @ 0x5d23bc
// > ReadArchive::process @ 0x7194be
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:53:53 +0000
//
void __fastcall std::vector::__append(void **a1, unsigned int a2)
{
_BYTE *v3; // r6
unsigned int v4; // r7
_BYTE *v5; // r2
void *v6; // r0
int v7; // r8
unsigned int v8; // r2
unsigned int v9; // r6
unsigned int v10; // r6
int v11; // r0
char *v12; // r5
void *v13; // r6
char *v14; // r8
unsigned int v15; // r9
char *v16; // r9
char *v17; // r10
char *v18; // r12
char *v19; // r7
char *i; // r3
char *v21; // r8
void *v22; // r0
v3 = a1[2];
v4 = a2;
v5 = a1[1];
if ( -252645135 * ((v3 - v5) >> 2) >= a2 )
{
do
{
v6 = a1[1];
if ( v6 )
memset(v6, 0, 0x44u);
--v4;
a1[1] = (char *)a1[1] + 68;
}
while ( v4 );
return;
}
v7 = v5 - (_BYTE *)*a1;
v8 = a2 - 252645135 * (v7 >> 2);
if ( v8 > 0x3C3C3C3 )
sub_388B90();
v9 = -252645135 * ((v3 - (_BYTE *)*a1) >> 2);
if ( v9 > 0x1E1E1E0 )
{
v10 = 63161283;
LABEL_14:
v11 = operator new(68 * v10);
goto LABEL_16;
}
v10 = 2 * v9;
if ( v10 < v8 )
v10 = a2 - 252645135 * (v7 >> 2);
if ( v10 )
goto LABEL_14;
v11 = 0;
LABEL_16:
v12 = (char *)(v11 + v7);
v13 = (void *)(v11 + 68 * v10);
v14 = (char *)(v11 + v7);
v15 = v4;
do
{
if ( v14 )
memset(v14, 0, 0x44u);
--v15;
v14 += 68;
}
while ( v15 );
v16 = (char *)a1[1];
v17 = (char *)*a1;
v18 = v12;
v19 = &v12[68 * v4];
for ( i = v16; i != v17; i = v21 )
{
v18 -= 68;
v21 = i - 68;
if ( v18 )
v18 = (char *)memcpy(v18, i - 68, 0x44u);
}
v22 = *a1;
a1[2] = v13;
*a1 = &v12[-68 * ((821096689 * ((unsigned int)(v16 - i) >> 2)) & 0x3FFFFFFF)];
a1[1] = v19;
if ( v22 )
operator delete(v22);
}