//
// fmt::BasicWriter::PrepareBufferForInt from 0x81df78 to 0x81e12a (434 bytes)
//
// 4 xrefs:
// > fmt::BasicWriter::PrepareBufferForInt @ 0x81dfca
// > fmt::BasicWriter::PrepareBufferForInt @ 0x81dff4
// > fmt::BasicWriter::PrepareBufferForInt @ 0x81e182
// > fmt::BasicWriter::PrepareBufferForInt @ 0x81e1ac
//
// 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 12:01:48 +0000
//
int __fastcall fmt::BasicWriter::PrepareBufferForInt(
unsigned int *a1,
int a2,
int *a3,
unsigned __int8 *a4,
int a5)
{
unsigned __int8 *v5; // r4
int v8; // r5
unsigned int v9; // r12
int v10; // r9
int v11; // r8
int v13; // r6
int v14; // r5
int *v15; // r0
int m; // r6
int *v17; // r0
int k; // r3
int v19; // r6
unsigned __int8 *v20; // r5
unsigned int v21; // r0
_DWORD *v22; // r3
int v23; // t1
char *v24; // r0
int *v25; // r2
char *v26; // r3
unsigned __int8 *v27; // r5
int v28; // t1
char *v29; // r2
int v30; // r0
int *v31; // r3
int i; // r0
unsigned __int8 *v33; // r5
_DWORD *v34; // r0
_DWORD *v35; // r3
int v36; // t1
unsigned __int8 *v37; // r0
int *v38; // r1
int v39; // t1
char *v40; // r1
unsigned __int8 *v41; // r5
int v42; // t1
int j; // r6
unsigned int v44; // [sp+Ch] [bp-18h]
int v45; // [sp+Ch] [bp-18h]
_DWORD v46[3]; // [sp+10h] [bp-14h] BYREF
v5 = a4;
v8 = a5;
v9 = *a3;
v10 = a3[2];
v11 = a3[1];
if ( a2 >= -1 )
{
v19 = a2 + a5;
if ( v9 > a2 + a5 )
{
v45 = *a3;
v24 = (char *)fmt::BasicWriter::GrowBuffer(a1, *a3);
v25 = (int *)v24;
v26 = &v24[4 * v45];
if ( v10 == 1 )
{
v27 = &v5[a5];
while ( v5 != v27 )
{
v28 = *v5++;
*(_DWORD *)v24 = v28;
v24 += 4;
}
v29 = (char *)&v25[v19];
v30 = v26 - v29;
v31 = (int *)v29;
for ( i = v30 >> 2; i > 0; --i )
*v31++ = v11;
v26 = v29;
}
else if ( v10 == 3 )
{
v33 = &v5[a5];
v34 = (_DWORD *)fmt::BasicWriter::FillPadding(v24, v45, v19, v11);
v35 = v34;
while ( v5 != v33 )
{
v36 = *v5++;
*v35++ = v36;
}
v26 = (char *)&v34[v19];
}
else
{
if ( v10 == 4 )
{
if ( a5 )
{
v37 = &v5[a5];
v38 = v25;
while ( v5 != v37 )
{
v39 = *v5++;
*v38++ = v39;
}
v25 += a5;
v19 = a2;
}
}
else
{
v40 = &v26[-4 * v19];
v41 = &v5[a5];
while ( v5 != v41 )
{
v42 = *v5++;
*(_DWORD *)v40 = v42;
v40 += 4;
}
}
for ( j = (&v26[-4 * v19] - (char *)v25) >> 2; j > 0; --j )
*v25++ = v11;
}
return (int)(v26 - 4);
}
else
{
v20 = &a4[a5];
v21 = fmt::BasicWriter::GrowBuffer(a1, a2 + a5);
v22 = (_DWORD *)v21;
while ( v5 != v20 )
{
v23 = *v5++;
*v22++ = v23;
}
return v21 + 4 * (v19 + 0x3FFFFFFF);
}
}
else
{
if ( a5 && a4[a5 - 1] == 48 )
v8 = a5 - 1;
v46[1] = 48;
v46[0] = v8 - 1;
v46[2] = 4;
if ( v8 - 1 < v9 )
{
v44 = v9;
fmt::internal::Array::reserve((int)a1, v9);
v13 = v44 - (v8 - 1);
if ( v10 != 1 )
{
v17 = (int *)fmt::BasicWriter::GrowBuffer(a1, v44 - (v8 - 1));
for ( k = (4 * v13) >> 2; k > 0; --k )
*v17++ = v11;
}
v14 = fmt::BasicWriter::PrepareBufferForInt(a1, a2, v46, v5, v8);
if ( v10 == 1 )
{
v15 = (int *)fmt::BasicWriter::GrowBuffer(a1, v13);
for ( m = (4 * v13) >> 2; m > 0; --m )
*v15++ = v11;
}
return v14;
}
else
{
return fmt::BasicWriter::PrepareBufferForInt(a1, a2, v46, a4, v8);
}
}
}