//
// fmt::internal::PrintfParser::Format from 0x60ed54 to 0x60f0fc (936 bytes)
//
// 0 xrefs:
//
// 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 __fastcall fmt::internal::PrintfParser::Format(_DWORD *a1, unsigned int *a2, void *a3, int a4, _DWORD *a5)
{
void *v7; // r6
int v8; // r1
int v9; // r2
int v10; // r3
int v11; // r7
int v12; // r0
unsigned int v13; // r6
int *v14; // r2
int v15; // r0
int v16; // r3
int v17; // r3
_DWORD *v18; // r0
unsigned __int64 v19; // r2
bool v20; // cf
int v21; // r3
int v22; // r2
int v23; // r0
int *v24; // r0
int *v25; // r0
unsigned int v26; // r6
int *v27; // r7
int v28; // r3
const char *v29; // r2
int v30; // r3
bool v31; // zf
char *v32; // r3
fmt::internal *v33; // r0
_DWORD *v34; // r0
_DWORD *v35; // r2
_DWORD *v36; // r0
unsigned int v37; // r1
int *i; // r0
int v39; // r3
int v41; // [sp+14h] [bp-40h]
int v42; // [sp+24h] [bp-30h] BYREF
const char *v43; // [sp+28h] [bp-2Ch] BYREF
_DWORD v44[2]; // [sp+2Ch] [bp-28h] BYREF
unsigned int v45; // [sp+34h] [bp-20h] BYREF
int v46; // [sp+38h] [bp-1Ch]
int v47; // [sp+3Ch] [bp-18h]
unsigned int v48; // [sp+40h] [bp-14h]
int v49; // [sp+44h] [bp-10h]
char v50; // [sp+48h] [bp-Ch]
v7 = a3;
v8 = a5[1];
*a1 = *a5;
a1[1] = v8;
a1[2] = 0;
v42 = (int)a3;
while ( 1 )
{
v9 = v42;
v10 = *(_DWORD *)v42;
if ( !*(_DWORD *)v42 )
return fmt::internal::Array::append(a2, v7, v42);
v42 += 4;
if ( v10 != 37 )
continue;
if ( *(_DWORD *)(v9 + 4) == 37 )
{
fmt::internal::Array::append(a2, v7, v9 + 4);
v7 = (void *)(v42 + 4);
v42 += 4;
continue;
}
fmt::internal::Array::append(a2, v7, v9);
v45 = 0;
v48 = 0;
v50 = 0;
v43 = nullptr;
v46 = 32;
v49 = -1;
v11 = *(_DWORD *)v42;
v47 = 2;
if ( (unsigned int)(v11 - 48) > 9 )
goto LABEL_13;
v12 = sub_60B92C((int **)&v42, (int *)&v43);
v13 = v12;
if ( *(_DWORD *)v42 != 36 )
{
if ( v11 == 48 )
v46 = 48;
if ( v12 )
{
v45 = v12;
v13 = -1;
goto LABEL_44;
}
LABEL_13:
v13 = -1;
goto LABEL_14;
}
v42 += 4;
LABEL_14:
v14 = (int *)v42;
v15 = v47;
while ( 1 )
{
v16 = *v14;
if ( *v14 != 43 )
break;
v17 = v48 | 3;
LABEL_27:
v48 = v17;
LABEL_22:
++v14;
}
if ( (unsigned int)*v14 <= 0x2B )
{
if ( v16 == 32 )
{
v17 = v48 | 1;
}
else
{
if ( v16 != 35 )
goto LABEL_28;
v17 = v48 | 4;
}
goto LABEL_27;
}
if ( v16 == 45 )
{
v15 = 1;
goto LABEL_22;
}
if ( v16 == 48 )
{
v46 = 48;
goto LABEL_22;
}
LABEL_28:
v42 = (int)v14;
v47 = v15;
if ( (unsigned int)(v16 - 48) > 9 )
{
if ( v16 == 42 )
{
v42 = (int)(v14 + 1);
v18 = fmt::internal::PrintfParser::HandleArgIndex(a1, 0xFFFFFFFF, &v43);
switch ( *v18 )
{
case 0:
v19 = (int)v18[2];
if ( (int)v18[2] >= 0 )
goto LABEL_40;
goto LABEL_36;
case 1:
v19 = (unsigned int)v18[2];
goto LABEL_40;
case 2:
v19 = *((_QWORD *)v18 + 1);
if ( (int)v18[3] < 0 )
{
LABEL_36:
v20 = (_DWORD)v19 == 0;
LODWORD(v19) = -(int)v19;
HIDWORD(v19) -= 2 * HIDWORD(v19) + !v20;
v47 = 1;
}
goto LABEL_40;
case 3:
v19 = *((_QWORD *)v18 + 1);
LABEL_40:
if ( v19 < 0x80000000 )
goto LABEL_41;
if ( !v43 )
v43 = "number is too big in format";
break;
default:
if ( !v43 )
v43 = "width is not integer";
LODWORD(v19) = 0;
LABEL_41:
v45 = v19;
break;
}
}
}
else
{
v45 = sub_60B92C((int **)&v42, (int *)&v43);
}
LABEL_44:
v21 = v42;
if ( *(_DWORD *)v42 == 46 )
{
v42 += 4;
v22 = *(_DWORD *)(v21 + 4);
if ( (unsigned int)(v22 - 48) <= 9 )
{
v23 = sub_60B92C((int **)&v42, (int *)&v43);
goto LABEL_50;
}
if ( v22 == 42 )
{
v42 = v21 + 8;
v24 = (int *)fmt::internal::PrintfParser::HandleArgIndex(a1, 0xFFFFFFFF, &v43);
if ( *v24 > 3 )
{
if ( !v43 )
v43 = "precision is not integer";
}
else
{
v23 = sub_60B8BE(v24);
LABEL_50:
v49 = v23;
}
}
}
v25 = (int *)fmt::internal::PrintfParser::HandleArgIndex(a1, v13, &v43);
v26 = v48;
v27 = v25;
if ( (v48 & 4) != 0 && !sub_60B8BE(v25) )
v48 = v26 & 0xFFFFFFFB;
if ( v46 == 48 )
{
if ( *v27 > 5 )
v28 = 32;
else
v28 = 4;
if ( *v27 > 5 )
v46 = v28;
else
v47 = v28;
}
v29 = (const char *)v42;
v30 = *(_DWORD *)v42;
if ( *(_DWORD *)v42 == 106 )
goto LABEL_72;
if ( *(_DWORD *)v42 <= 0x6Au )
{
if ( v30 != 76 )
{
v31 = v30 == 104;
goto LABEL_70;
}
goto LABEL_72;
}
if ( v30 == 116 || v30 == 122 )
goto LABEL_72;
v31 = v30 == 108;
LABEL_70:
if ( v31 )
{
LABEL_72:
v29 = (const char *)(v42 + 4);
v42 += 4;
}
v32 = (char *)v42;
v7 = (void *)(v42 + 4);
v42 += 4;
v33 = (fmt::internal *)(unsigned __int8)*v32;
v50 = *v32;
switch ( *v27 )
{
case 0:
fmt::BasicWriter::FormatInt(a2, v27[2], (int)&v45);
continue;
case 1:
goto LABEL_99;
case 2:
fmt::BasicWriter::FormatInt(a2, *((_QWORD *)v27 + 1), (int)&v45);
continue;
case 3:
fmt::BasicWriter::FormatInt(a2, *((_QWORD *)v27 + 1), (int)&v45);
continue;
case 4:
fmt::BasicWriter::FormatDouble(a2, *((double *)v27 + 1), (int)&v45);
continue;
case 5:
fmt::BasicWriter::FormatDouble(a2, *((double *)v27 + 1), (int)&v45);
continue;
case 6:
if ( v33 && v33 != (fmt::internal *)((char *)&dword_60 + 3) )
fmt::internal::ReportUnknownType(v33, (char)"char", v29);
if ( v45 <= 1 )
{
v36 = (_DWORD *)fmt::BasicWriter::GrowBuffer(a2, 1);
goto LABEL_91;
}
v41 = v46;
v34 = (_DWORD *)fmt::BasicWriter::GrowBuffer(a2, v45);
v35 = v34;
if ( v47 == 2 )
{
memset32(v34, v41, v45 - 1);
v35 = &v34[v45 - 1];
goto LABEL_92;
}
if ( v47 == 3 )
{
v36 = (_DWORD *)fmt::BasicWriter::FillPadding((char *)v34, v45, 1, v41);
LABEL_91:
v35 = v36;
goto LABEL_92;
}
v37 = v45;
for ( i = v34 + 1; --v37; ++i )
*i = v41;
LABEL_92:
*v35 = v27[2];
break;
case 7:
fmt::BasicWriter::write_str(a2, (int)(v27 + 2), (int)&v45);
continue;
case 8:
v39 = v27[3];
v44[0] = v27[2];
v44[1] = v39;
fmt::BasicWriter::write_str(a2, (int)v44, (int)&v45);
continue;
case 9:
if ( v33 && v33 != (fmt::internal *)&dword_70 )
fmt::internal::ReportUnknownType(v33, (char)"pointer", v29);
v48 = 4;
v50 = 120;
LABEL_99:
fmt::BasicWriter::FormatInt(a2, (fmt::internal *)v27[2], (int *)&v45);
continue;
case 10:
if ( v33 )
fmt::internal::ReportUnknownType(v33, (char)"object", v29);
((void (__fastcall *)(unsigned int *, int, __int16 *))v27[3])(a2, v27[2], &aO1i2r3e45s7t89[9]);
continue;
default:
continue;
}
}
}