//
// fmt::BasicWriter::PrepareBufferForInt from 0x60d9d0 to 0x60db5a (394 bytes)
//
// 4 xrefs:
// > fmt::BasicWriter::PrepareBufferForInt @ 0x60da1e
// > fmt::BasicWriter::PrepareBufferForInt @ 0x60da44
// > fmt::BasicWriter::PrepareBufferForInt @ 0x60dbb0
// > fmt::BasicWriter::PrepareBufferForInt @ 0x60dbd6
//
// 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
//
int __fastcall fmt::BasicWriter::PrepareBufferForInt(
unsigned int *a1,
int a2,
unsigned int *a3,
int a4,
int a5)
{
int v8; // r5
unsigned int v9; // r2
int v10; // r8
int v11; // r9
int *v12; // t0
int v14; // r6
int v15; // r5
int *v16; // r0
int *v17; // r6
int *v18; // r0
int *v19; // r3
int v20; // r6
_DWORD *v21; // r4
int *v22; // r0
int *v23; // r7
int *v24; // r4
int *i; // r2
_DWORD *v26; // r4
int j; // r1
int v28; // t1
int *v29; // r6
unsigned int v30; // [sp+Ch] [bp-18h]
int v31; // [sp+Ch] [bp-18h]
_DWORD v32[3]; // [sp+10h] [bp-14h] BYREF
v8 = a5;
v12 = (int *)a3;
v9 = *a3;
v10 = *++v12;
v11 = v12[1];
if ( a2 >= -1 )
{
v20 = a2 + a5;
if ( v9 > a2 + a5 )
{
v31 = v9;
v22 = (int *)fmt::BasicWriter::GrowBuffer(a1, v9);
v23 = v22;
v24 = &v22[v31];
if ( v11 == 1 )
{
std::copy(a4, a4 + a5, v22);
for ( i = &v23[v20]; i != v24; ++i )
*i = v10;
v24 = &v23[v20];
}
else if ( v11 == 3 )
{
v26 = (_DWORD *)fmt::BasicWriter::FillPadding((char *)v22, v31, a2 + a5, v10);
std::copy(a4, a4 + a5, v26);
v24 = &v26[v20];
}
else
{
if ( v11 == 4 )
{
if ( a5 )
{
for ( j = a4 - 1; a5 - 1 - j + a4 > 0; ++j )
{
v28 = *(unsigned __int8 *)(j + 1);
*v22++ = v28;
}
v20 = a2;
v23 += a5 & ~(a5 >> 31);
}
}
else
{
std::copy(a4, a4 + a5, &v24[-v20]);
}
v29 = &v24[-v20];
while ( v23 != v29 )
*v23++ = v10;
}
return (int)(v24 - 1);
}
else
{
v21 = (_DWORD *)fmt::BasicWriter::GrowBuffer(a1, a2 + a5);
std::copy(a4, a4 + a5, v21);
return (int)&v21[v20 - 1];
}
}
else
{
if ( a5 && *(_BYTE *)(a4 + a5 - 1) == 48 )
v8 = a5 - 1;
v32[1] = 48;
v32[0] = v8 - 1;
v32[2] = 4;
if ( v8 - 1 < v9 )
{
v30 = v9;
fmt::internal::Array::reserve((int)a1, v9);
v14 = v30 - (v8 - 1);
if ( v11 != 1 )
{
v18 = (int *)fmt::BasicWriter::GrowBuffer(a1, v30 - (v8 - 1));
v19 = &v18[v14];
while ( v18 != v19 )
*v18++ = v10;
}
v15 = fmt::BasicWriter::PrepareBufferForInt(a1, a2, v32, a4, v8);
if ( v11 == 1 )
{
v16 = (int *)fmt::BasicWriter::GrowBuffer(a1, v14);
v17 = &v16[v14];
while ( v16 != v17 )
*v16++ = v10;
}
return v15;
}
else
{
return fmt::BasicWriter::PrepareBufferForInt(a1, a2, v32, a4, v8);
}
}
}