//
// common_vsprintf<__crt_stdio_output::standard_base,char> from 0x18012b858 to 0x18012ba23 (459 bytes)
//
// 2 xrefs:
// > common_vsprintf<__crt_stdio_output::standard_base,char> @ 0x18012f308
// > ??> @ 0x180202b34
//
// 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 10:54:56 +0000
//
__int64 __fastcall common_vsprintf<__crt_stdio_output::standard_base,char>(
__int64 a1,
_BYTE *a2,
unsigned __int64 a3,
__int64 a4,
struct __crt_locale_pointers *a5,
__int64 a6)
{
int v11; // eax
unsigned __int64 v12; // rbx
__int64 v13; // rax
_QWORD v14[2]; // [rsp+20h] [rbp-E0h] BYREF
__int64 v15; // [rsp+30h] [rbp-D0h]
char v16; // [rsp+38h] [rbp-C8h]
int v17; // [rsp+39h] [rbp-C7h]
__int16 v18; // [rsp+3Dh] [rbp-C3h]
char v19; // [rsp+3Fh] [rbp-C1h]
__int64 v20; // [rsp+40h] [rbp-C0h] BYREF
_BYTE v21[24]; // [rsp+48h] [rbp-B8h] BYREF
_QWORD v22[7]; // [rsp+60h] [rbp-A0h] BYREF
int v23; // [rsp+98h] [rbp-68h]
__int16 v24; // [rsp+A0h] [rbp-60h]
int v25; // [rsp+B0h] [rbp-50h]
char v26; // [rsp+B4h] [rbp-4Ch]
__int64 v27; // [rsp+4B8h] [rbp+3B8h]
void *Block; // [rsp+4C0h] [rbp+3C0h]
_QWORD *v29; // [rsp+4C8h] [rbp+3C8h]
int v30; // [rsp+4D0h] [rbp+3D0h]
if ( !a4 || a3 && !a2 )
{
*errno() = 22;
invalid_parameter_noinfo();
return 0xFFFFFFFFLL;
}
_LocaleUpdate::_LocaleUpdate((_LocaleUpdate *)&v20, a5);
v17 = 0;
v18 = 0;
v19 = 0;
v14[0] = a2;
v14[1] = a3;
v15 = 0;
if ( (a1 & 2) != 0 || (v16 = 0, !a2) )
v16 = 1;
v22[2] = 0;
v29 = v14;
v22[5] = 0;
v22[1] = v21;
v22[4] = a6;
v22[6] = 0;
v23 = 0;
v24 = 0;
v25 = 0;
v26 = 0;
v27 = 0;
Block = nullptr;
v22[0] = a1;
v22[3] = a4;
v30 = 0;
v11 = __crt_stdio_output::output_processor,__crt_stdio_output::standard_base>>::process(v22);
v12 = v11;
if ( !a2 )
goto LABEL_22;
if ( (a1 & 1) == 0 )
{
if ( (a1 & 2) != 0 )
{
if ( !a3 )
goto LABEL_22;
if ( v11 < 0 )
{
*a2 = 0;
goto LABEL_22;
}
v13 = v15;
if ( v15 != a3 )
{
LABEL_21:
a2[v13] = 0;
goto LABEL_22;
}
}
else
{
if ( !a3 )
{
LABEL_26:
LODWORD(v12) = -1;
goto LABEL_22;
}
v13 = v15;
if ( v15 != a3 )
goto LABEL_21;
LODWORD(v12) = -2;
}
a2[a3 - 1] = 0;
goto LABEL_22;
}
if ( !a3 && v11 )
goto LABEL_26;
v13 = v15;
if ( v15 != a3 )
goto LABEL_21;
if ( (v12 & 0x80000000) == 0LL && v12 > a3 )
goto LABEL_26;
LABEL_22:
free_base(Block);
Block = nullptr;
if ( v21[16] )
*(_DWORD *)(v20 + 936) &= ~2u;
return (unsigned int)v12;
}