//
// sub_74B564 from 0x74b564 to 0x74b5e2 (126 bytes)
//
// 6 xrefs:
// > sub_74E8E0 @ 0x74e94a
// > sub_74EC08 @ 0x74ec9c
// > sub_74EEBC @ 0x74ef50
// > sub_7665E4 @ 0x766648
// > sub_766888 @ 0x766918
// > sub_766AF4 @ 0x766b84
//
// 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 sub_74B564(int a1, char *a2, int a3, const char *a4, ...)
{
char *v5; // r0
const char *v6; // r4
int v7; // r4
size_t v9; // r8
void *v10; // r7
va_list va; // [sp+28h] [bp+1Ch] BYREF
va_start(va, a4);
v5 = setlocale(1, nullptr);
if ( !v5 )
return vsprintf(a2, a4, va);
v6 = v5;
if ( !strcmp(v5, "C") )
return vsprintf(a2, a4, va);
v9 = strlen(v6) + 1;
v10 = operator new[](v9);
memcpy(v10, v6, v9);
setlocale(1, "C");
v7 = vsprintf(a2, a4, va);
setlocale(1, (const char *)v10);
operator delete[](v10);
return v7;
}