//
// fmt::BasicWriter::FillPadding from 0x180041940 to 0x180041a12 (210 bytes)
//
// 12 xrefs:
// > sub_18003E130 @ 0x18003e4b4
// > sub_18003EA80 @ 0x18003ee05
// > sub_180040500 @ 0x18004071e
// > sub_180040A00 @ 0x180040c1f
// > sub_180040EF0 @ 0x180040fc5
// > sub_180041060 @ 0x180041134
// > fmt::internal::PrintfParser::Format @ 0x180042b65
// > fmt::BasicFormatter::format @ 0x18004435d
// > ??> @ 0x18013fd14
// > ??> @ 0x18013fd24
// > ??> @ 0x18014cf68
// > ??> @ 0x1801bb524
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// 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:21:39 +0000
//
char *__fastcall fmt::BasicWriter::FillPadding(_WORD *a1, unsigned int a2, __int64 a3, __int16 a4)
{
int v4; // ebx
unsigned __int64 v6; // r14
unsigned __int64 v8; // r15
char v10; // r12
_WORD *v11; // rdi
unsigned __int64 i; // rcx
char *v13; // rsi
unsigned __int64 v14; // r14
char *v15; // rdi
unsigned __int64 j; // rcx
v4 = 0;
v6 = a2 - a3;
v8 = v6 >> 1;
v10 = HIBYTE(a4);
if ( v6 >> 1 )
{
if ( a4 )
{
v11 = a1;
for ( i = ((unsigned __int64)a2 - a3) >> 1; i; --i )
*v11++ = a4;
}
else
{
memset(a1, 0, 2 * v8);
}
}
v13 = (char *)&a1[v8];
v14 = v6 - v8;
if ( v14 )
{
v15 = &v13[2 * a3];
if ( (_BYTE)a4 || v10 )
v4 = 1;
if ( v4 )
{
for ( j = v14; j; --j )
{
*(_WORD *)v15 = a4;
v15 += 2;
}
}
else
{
memset(&v13[2 * a3], 0, 2 * v14);
}
}
return v13;
}