//
// fmt::BasicWriter::FillPadding from 0x180041110 to 0x1800411ae (158 bytes)
//
// 15 xrefs:
// > sub_18003DA20 @ 0x18003ddb2
// > sub_18003E390 @ 0x18003e722
// > sub_18003FE60 @ 0x18004007e
// > sub_180040360 @ 0x18004057f
// > sub_180040870 @ 0x18004091f
// > fmt::internal::PrintfParser::Format @ 0x1800422e3
// > fmt::internal::PrintfParser::Format @ 0x18004242d
// > fmt::internal::PrintfParser::Format @ 0x180042557
// > fmt::BasicFormatter::format @ 0x180043d36
// > fmt::BasicFormatter::format @ 0x180043e4f
// > fmt::BasicFormatter::format @ 0x180043f6c
// > ??> @ 0x180136d18
// > ??> @ 0x180136d28
// > ??> @ 0x1801438a8
// > ??> @ 0x1801b1410
//
// 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
//
char *__fastcall fmt::BasicWriter::FillPadding(_WORD *a1, unsigned int a2, __int64 a3, __int16 a4)
{
unsigned __int64 v6; // rsi
unsigned __int64 v8; // r14
_WORD *v9; // rdi
unsigned __int64 i; // rcx
char *v11; // rbx
unsigned __int64 v12; // rsi
char *v13; // rdi
unsigned __int64 j; // rcx
v6 = a2 - a3;
v8 = v6 >> 1;
if ( v6 >> 1 )
{
if ( a4 )
{
v9 = a1;
for ( i = ((unsigned __int64)a2 - a3) >> 1; i; --i )
*v9++ = a4;
}
else
{
memset(a1, 0, 2 * v8);
}
}
v11 = (char *)&a1[v8];
v12 = v6 - v8;
if ( v12 )
{
v13 = &v11[2 * a3];
if ( a4 )
{
for ( j = v12; j; --j )
{
*(_WORD *)v13 = a4;
v13 += 2;
}
}
else
{
memset(&v11[2 * a3], 0, 2 * v12);
}
}
return v11;
}