//
// sub_18012D5FC from 0x18012d5fc to 0x18012d8d9 (733 bytes)
//
// 3 xrefs:
// > __crt_stdio_output::output_processor,__crt_stdio_output::standard_base>>::process @ 0x18012c9f4
// > sub_18012D06C @ 0x18012d08e
// > ??> @ 0x180202c6c
//
// 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:57 +0000
//
char __fastcall sub_18012D5FC(__int64 a1, __int64 a2, __int64 a3)
{
unsigned __int16 v3; // ax
__int16 v4; // si
__int64 v5; // rbx
char v6; // al
__int64 v7; // r8
__int64 v8; // rdx
int v9; // ecx
int v11; // ecx
__int64 v12; // rdi
__int16 v13; // ax
__int16 v14; // dx
__int64 v15; // r9
int v16; // esi
int *v17; // rbp
int v18; // ecx
int v19; // [rsp+30h] [rbp-38h] BYREF
__int16 v20; // [rsp+34h] [rbp-34h]
v3 = *(_WORD *)(a1 + 66);
v4 = 120;
v5 = a1;
if ( v3 > 0x64u )
{
if ( v3 <= 0x67u )
goto LABEL_34;
if ( v3 != 105 )
{
switch ( v3 )
{
case 'n':
v6 = unknown_libname_51();
goto LABEL_35;
case 'o':
v9 = *(_DWORD *)(a1 + 48);
if ( (v9 & 0x20) != 0 )
*(_DWORD *)(v5 + 48) = v9 | 0x80;
v8 = 8;
a1 = v5;
goto LABEL_32;
case 'p':
*(_DWORD *)(a1 + 56) = 16;
*(_DWORD *)(a1 + 60) = 11;
LABEL_25:
LOBYTE(a3) = 1;
v8 = 16;
LABEL_33:
v6 = sub_18012E698(a1, v8, a3);
goto LABEL_35;
case 's':
LABEL_23:
v6 = unknown_libname_54();
goto LABEL_35;
}
if ( v3 != 117 )
{
if ( v3 != 120 )
return 0;
v8 = 16;
goto LABEL_32;
}
LABEL_31:
v8 = 10;
LABEL_32:
a3 = 0;
goto LABEL_33;
}
LABEL_30:
*(_DWORD *)(a1 + 48) |= 0x10u;
goto LABEL_31;
}
if ( v3 == 100 )
goto LABEL_30;
if ( v3 != 65 )
{
if ( v3 == 67 )
{
LABEL_12:
v6 = unknown_libname_48(a1, 0);
goto LABEL_35;
}
if ( v3 <= 0x44u )
return 0;
if ( v3 > 0x47u )
{
if ( v3 != 83 )
{
if ( v3 != 88 )
{
if ( v3 == 90 )
{
v6 = unknown_libname_42();
goto LABEL_35;
}
if ( v3 != 97 )
{
if ( v3 == 99 )
goto LABEL_12;
return 0;
}
goto LABEL_34;
}
goto LABEL_25;
}
goto LABEL_23;
}
}
LABEL_34:
v6 = unknown_libname_45();
LABEL_35:
if ( !v6 )
return 0;
if ( !*(_BYTE *)(v5 + 64) )
{
v11 = *(_DWORD *)(v5 + 48);
v19 = 0;
v12 = 0;
v20 = 0;
if ( (v11 & 0x10) == 0 )
goto LABEL_47;
if ( (v11 & 0x40) != 0 )
{
v13 = 45;
}
else
{
if ( (v11 & 1) == 0 )
{
if ( (v11 & 2) == 0 )
goto LABEL_47;
LOWORD(v19) = 32;
LABEL_46:
v12 = 1;
LABEL_47:
v14 = *(_WORD *)(v5 + 66);
LOBYTE(v7) = ((v14 - 88) & 0xFFDF) == 0 && (v11 & 0x20) != 0;
v15 = 48;
if ( (_BYTE)v7 || ((v14 - 65) & 0xFFDF) == 0 )
{
*((_WORD *)&v19 + v12) = 48;
if ( v14 == 88 || v14 == 65 )
v4 = 88;
*((_WORD *)&v19 + v12 + 1) = v4;
LODWORD(v12) = v12 + 2;
}
v16 = *(_DWORD *)(v5 + 52) - *(_DWORD *)(v5 + 80) - v12;
if ( (v11 & 0xC) == 0 )
__crt_stdio_output::write_multiple_characters<__crt_stdio_output::stream_output_adapter,char>(
(FILE **)(v5 + 1128),
32,
v16,
(_DWORD *)(v5 + 40));
v17 = (int *)(v5 + 40);
if ( (*(_DWORD *)(*(_QWORD *)(v5 + 1128) + 20LL) & 0x1000) == 0 || *(_QWORD *)(*(_QWORD *)(v5 + 1128) + 8LL) )
__crt_stdio_output::output_adapter_common>::write_string_impl(
v5 + 1128,
(unsigned int)&v19,
v12,
v5 + 40,
v5 + 16);
else
*v17 += v12;
v18 = *(_DWORD *)(v5 + 48);
if ( (v18 & 8) != 0 && (v18 & 4) == 0 )
__crt_stdio_output::write_multiple_characters<__crt_stdio_output::stream_output_adapter,char>(
(FILE **)(v5 + 1128),
48,
v16,
(_DWORD *)(v5 + 40));
unknown_libname_57(v5, 0, v7, v15);
if ( *v17 >= 0 && (*(_DWORD *)(v5 + 48) & 4) != 0 )
__crt_stdio_output::write_multiple_characters<__crt_stdio_output::stream_output_adapter,char>(
(FILE **)(v5 + 1128),
32,
v16,
(_DWORD *)(v5 + 40));
return 1;
}
v13 = 43;
}
LOWORD(v19) = v13;
goto LABEL_46;
}
return 1;
}