//
// sub_745228 from 0x745228 to 0x7452f6 (206 bytes)
//
// 0 xrefs:
//
// 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
//
size_t __fastcall sub_745228(size_t a1, int a2, int a3)
{
size_t v3; // r5
char *v5; // r4
int v7; // r8
int v8; // r7
char *v9; // r0
int v10; // r2
char *v11; // r3
char *v12; // lr
int v13; // r8
char *v14; // r12
int v15; // r2
int v16; // r3
char *v17; // r1
char *v18; // r3
int v19; // r0
int v20; // r1
bool v21; // zf
int v23; // r2
int v24; // r3
v3 = a1;
v5 = (char *)(a1 + 36);
if ( a2 <= 7 )
{
v8 = 8;
LABEL_18:
*(_DWORD *)(v3 + 104) = v5;
*(_DWORD *)(v3 + 100) = v8;
return (size_t)&v5[8 * a2];
}
if ( a2 != 0x7FFFFFFF )
{
v7 = a2 + 1;
if ( a2 + 1 <= 266338304 )
a1 = 8 * v7;
v8 = a2 + 1;
if ( a2 + 1 > 266338304 )
a1 = -1;
v9 = (char *)operator new[](a1);
v10 = 0;
v11 = v9 + 8;
v12 = v9;
do
{
++v10;
*((_DWORD *)v11 - 2) = 0;
*((_DWORD *)v11 - 1) = 0;
v11 += 8;
}
while ( v10 != v7 );
v13 = *(_DWORD *)(v3 + 100);
v14 = *(char **)(v3 + 104);
if ( v13 > 0 )
{
v15 = 0;
do
{
v16 = 8 * v15++;
v17 = &v14[v16];
v18 = &v12[v16];
v19 = *(_DWORD *)v17;
v20 = *((_DWORD *)v17 + 1);
*(_DWORD *)v18 = v19;
*((_DWORD *)v18 + 1) = v20;
}
while ( v15 != v13 );
}
v21 = v14 == nullptr;
if ( v14 )
v21 = v5 == v14;
v5 = v12;
if ( !v21 )
operator delete[](v14);
goto LABEL_18;
}
v23 = *(_DWORD *)(a1 + 16);
v24 = *(_DWORD *)(a1 + 20) | 1;
*(_DWORD *)(a1 + 20) = v24;
if ( (v24 & v23) != 0 )
sub_77356C("ios_base::_M_grow_words is not valid");
if ( a3 )
*(_DWORD *)(a1 + 32) = 0;
else
*(_DWORD *)(a1 + 28) = 0;
return a1 + 28;
}