//
// fmt::internal::PrintfParser::Format from 0xb6f740 to 0xb70030 (2288 bytes)
//
// 1 xrefs:
// > ??> @ 0x99810
//
// 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
//
__int64 __fastcall fmt::internal::PrintfParser::Format(
__int64 a1,
__int64 *a2,
_DWORD *a3,
__int64 a4,
__int64 *a5)
{
__int64 v6; // x4
__int64 v7; // x5
__int64 v9; // x0
_DWORD *v10; // x26
int v12; // w0
unsigned int v14; // w27
_DWORD *v15; // x3
int v16; // w26
int v17; // w0
_DWORD *v18; // x0
int v19; // w2
char v20; // cf
bool v21; // zf
int v22; // w0
int v23; // w5
__int64 v24; // x3
__int64 v25; // x4
__int64 v26; // x5
__int64 v27; // x6
__int64 v28; // x7
int *v29; // x27
int v30; // w1
_DWORD *v31; // x26
int v32; // w0
unsigned int v33; // w0
__int64 v34; // x3
unsigned __int64 v35; // x4
unsigned int v36; // w28
int v37; // w5
__int64 v38; // x2
__int64 v39; // x6
int32x4_t *v40; // x1
unsigned int v41; // w4
unsigned int *v42; // x5
unsigned int v43; // w3
unsigned int v44; // w7
int32x4_t v45; // q0
int32x4_t *v46; // x0
unsigned int v47; // w2
unsigned __int64 v48; // x1
__int64 v49; // x3
_DWORD *v50; // x0
unsigned __int64 v51; // x0
int v52; // w1
__int64 v53; // x2
unsigned __int64 v54; // x28
__int64 v55; // x1
unsigned int v56; // w3
unsigned int v57; // w2
unsigned int v58; // w4
int32x4_t v59; // q0
int32x4_t *v60; // x5
unsigned int v61; // w0
unsigned int *v62; // x0
unsigned __int64 v63; // x0
unsigned __int64 v64; // x2
unsigned __int64 v65; // x4
__int64 v66; // x5
int32x4_t v67; // q0
int32x4_t *v68; // x8
unsigned __int64 v69; // x7
unsigned int *v70; // x4
unsigned __int64 v71; // x5
unsigned __int64 v72; // x0
unsigned int *v73; // x7
unsigned __int64 v74; // x4
__int64 v75; // x5
int32x4_t v76; // q0
unsigned __int64 v77; // x3
unsigned __int64 v78; // x2
int32x4_t *v79; // x6
char v80; // [xsp+0h] [xbp+0h]
__int64 v81; // [xsp+60h] [xbp+60h]
unsigned __int64 v82; // [xsp+68h] [xbp+68h]
__int64 v83; // [xsp+68h] [xbp+68h]
_DWORD *v84; // [xsp+70h] [xbp+70h] BYREF
const char *v85; // [xsp+78h] [xbp+78h] BYREF
_QWORD v86[2]; // [xsp+80h] [xbp+80h] BYREF
unsigned int v87; // [xsp+90h] [xbp+90h] BYREF
int v88; // [xsp+94h] [xbp+94h]
int v89; // [xsp+98h] [xbp+98h]
int v90; // [xsp+9Ch] [xbp+9Ch]
int v91; // [xsp+A0h] [xbp+A0h]
char v92; // [xsp+A4h] [xbp+A4h]
__int64 v93; // [xsp+A8h] [xbp+A8h]
v6 = *a5;
v7 = a5[1];
v9 = _stack_chk_guard;
v10 = a3;
*(_DWORD *)(a1 + 16) = 0;
v84 = a3;
v93 = v9;
*(_QWORD *)a1 = v6;
*(_QWORD *)(a1 + 8) = v7;
while ( 1 )
{
v12 = *a3;
if ( !*a3 )
break;
while ( 1 )
{
v84 = a3 + 1;
if ( v12 == 37 )
break;
++a3;
LABEL_5:
v12 = *a3;
if ( !*a3 )
goto LABEL_6;
}
if ( a3[1] == 37 )
{
fmt::internal::Array::append(a2, v10, (__int64)(a3 + 1));
v10 = v84 + 1;
v84 = v10;
a3 = v10;
goto LABEL_5;
}
v14 = -1;
fmt::internal::Array::append(a2, v10, (__int64)a3);
v87 = 0;
v15 = v84;
v90 = 0;
v88 = 32;
v91 = -1;
v92 = 0;
v89 = 2;
v16 = *v84;
v85 = nullptr;
if ( (unsigned int)(v16 - 48) > 9 )
{
v22 = v16;
goto LABEL_18;
}
v14 = sub_B671B8((__int64 *)&v84, &v85);
v15 = v84;
if ( *v84 == 36 )
{
v22 = v84[1];
++v84;
++v15;
goto LABEL_18;
}
if ( v16 != 48 )
{
if ( v14 )
goto LABEL_12;
LABEL_43:
v22 = *v84;
v14 = -1;
LABEL_18:
v23 = v89;
while ( 2 )
{
switch ( v22 )
{
case ' ':
v90 |= 1u;
goto LABEL_30;
case '#':
v90 |= 4u;
goto LABEL_30;
case '+':
v90 |= 3u;
goto LABEL_30;
case '-':
v23 = 1;
goto LABEL_30;
case '0':
v88 = 48;
LABEL_30:
v22 = v15[1];
++v15;
continue;
default:
v89 = v23;
v84 = v15;
if ( (unsigned int)(v22 - 48) <= 9 )
{
v87 = sub_B671B8((__int64 *)&v84, &v85);
v15 = v84;
v22 = *v84;
}
else if ( v22 == 42 )
{
v84 = v15 + 1;
v50 = fmt::internal::PrintfParser::HandleArgIndex(a1, 0xFFFFFFFF, &v85);
switch ( *v50 )
{
case 0:
v52 = v50[4];
v51 = v52;
if ( (v52 & 0x80000000) == 0 )
goto LABEL_92;
goto LABEL_97;
case 1:
v51 = (unsigned int)v50[4];
goto LABEL_92;
case 2:
v51 = *((_QWORD *)v50 + 2);
if ( (v51 & 0x8000000000000000LL) != 0 )
{
LABEL_97:
v51 = -(__int64)v51;
v89 = 1;
}
goto LABEL_92;
case 3:
v51 = *((_QWORD *)v50 + 2);
LABEL_92:
if ( v51 <= 0x7FFFFFFF )
goto LABEL_87;
v15 = v84;
if ( !v85 )
v85 = "number is too big in format";
v22 = *v84;
break;
default:
if ( !v85 )
v85 = "width is not integer";
LODWORD(v51) = 0;
LABEL_87:
v15 = v84;
v87 = v51;
v22 = *v84;
break;
}
}
if ( v22 == 46 )
goto LABEL_13;
goto LABEL_22;
}
}
}
v88 = 48;
if ( !v14 )
goto LABEL_43;
LABEL_12:
v87 = v14;
v14 = -1;
if ( *v84 == 46 )
{
LABEL_13:
v17 = v15[1];
v84 = v15 + 1;
if ( (unsigned int)(v17 - 48) <= 9 )
{
v91 = sub_B671B8((__int64 *)&v84, &v85);
}
else if ( v17 == 42 )
{
v84 = v15 + 2;
v18 = fmt::internal::PrintfParser::HandleArgIndex(a1, 0xFFFFFFFF, &v85);
v19 = -1;
if ( !v21 & v20 )
{
LABEL_102:
v91 = v19;
}
else
{
switch ( *v18 )
{
case 0:
case 1:
case 2:
case 3:
v19 = v18[4];
goto LABEL_102;
default:
if ( !v85 )
v85 = "precision is not integer";
break;
}
}
}
}
LABEL_22:
v29 = (int *)fmt::internal::PrintfParser::HandleArgIndex(a1, v14, &v85);
if ( (v90 & 4) != 0 )
{
v30 = *v29;
switch ( *v29 )
{
case 0:
v24 = v29[4];
goto LABEL_41;
case 1:
v24 = (unsigned int)v29[4];
goto LABEL_41;
case 2:
case 3:
v24 = *((_QWORD *)v29 + 2);
LABEL_41:
v30 = *v29;
if ( !v24 )
v90 &= ~4u;
break;
default:
break;
}
}
else
{
v30 = *v29;
}
if ( v88 == 48 )
{
if ( v30 > 5 )
v88 = 32;
else
v89 = 4;
}
v31 = v84;
v32 = *v84;
switch ( *v84 )
{
case 'L':
case 'h':
case 'j':
case 'l':
case 't':
case 'z':
v32 = v84[1];
v31 = v84 + 1;
break;
default:
break;
}
v10 = v31 + 1;
v84 = v10;
v92 = v32;
a3 = v10;
switch ( v30 )
{
case 0:
fmt::BasicWriter::FormatInt(
(unsigned __int64 *)a2,
v29[4],
(__int64)&v87,
v24,
v25,
v26,
v27,
v28,
v80);
a3 = v84;
continue;
case 1:
fmt::BasicWriter::FormatInt(
(unsigned __int64 *)a2,
v29[4],
(__int64)&v87,
v24,
v25,
v26,
v27,
v28,
v80);
a3 = v84;
continue;
case 2:
fmt::BasicWriter::FormatInt(
(unsigned __int64 *)a2,
*((_QWORD *)v29 + 2),
(__int64)&v87,
v24,
v25,
v26,
v27,
v28,
v80);
a3 = v84;
continue;
case 3:
fmt::BasicWriter::FormatInt(
(unsigned __int64 *)a2,
*((_QWORD *)v29 + 2),
(__int64)&v87,
v24,
v25,
v26,
v27,
v28,
v80);
a3 = v84;
continue;
case 4:
fmt::BasicWriter::FormatDouble(
(unsigned __int64 *)a2,
(__int64)&v87,
(const char *)v10,
*((double *)v29 + 2));
a3 = v84;
continue;
case 5:
fmt::BasicWriter::FormatDouble(
(unsigned __int64 *)a2,
(__int64)&v87,
*((long double *)v29 + 1));
a3 = v84;
continue;
case 6:
if ( (unsigned __int8)v32 != 99 && (_BYTE)v32 )
fmt::internal::ReportUnknownType((fmt::internal *)(unsigned __int8)v32, (char)"char", (const char *)v10);
v33 = v87;
if ( v87 > 1 )
{
v34 = *a2;
v35 = *a2 + v87;
v36 = v88;
if ( v35 > a2[1] )
{
v81 = *a2;
v82 = *a2 + v87;
fmt::internal::Array::grow(a2, v35);
v33 = v87;
v34 = v81;
v35 = v82;
}
v37 = v89;
v38 = 4 * v34;
v39 = a2[2];
*a2 = v35;
v40 = (int32x4_t *)(v39 + 4 * v34);
if ( v37 == 2 )
{
v56 = v33 - 1;
if ( v33 == 1 )
goto LABEL_69;
v57 = ((v33 - 5) >> 2) + 1;
v58 = 4 * v57;
if ( v33 - 2 <= 2 )
{
v62 = (unsigned int *)v40;
LABEL_111:
*v62 = v36;
if ( v56 != 1 )
{
v62[1] = v36;
if ( v56 != 2 )
v62[2] = v36;
}
}
else
{
v59 = vdupq_n_s32(v36);
v60 = v40;
v61 = 0;
do
{
*v60++ = v59;
++v61;
}
while ( v61 < v57 );
v21 = v56 == v58;
v56 -= v58;
v62 = (unsigned int *)&v40[v58 / 4];
if ( !v21 )
goto LABEL_111;
}
v40 = (int32x4_t *)((char *)v40 + 4 * v87 - 4);
goto LABEL_69;
}
if ( v37 != 3 )
{
v41 = v33 - 1;
v42 = &v40->n128_u32[1];
if ( v33 != 1 )
{
v43 = ((v33 - 5) >> 2) + 1;
v44 = 4 * v43;
if ( v33 - 2 <= 2 )
goto LABEL_66;
v45 = vdupq_n_s32(v36);
v46 = (int32x4_t *)(v39 + v38 + 4);
v47 = 0;
do
{
*v46++ = v45;
++v47;
}
while ( v47 < v43 );
v21 = v41 == v44;
v41 -= v44;
v42 += v44;
if ( !v21 )
{
LABEL_66:
*v42 = v36;
if ( v41 != 1 )
{
v42[1] = v36;
if ( v41 != 2 )
v42[2] = v36;
}
}
}
goto LABEL_69;
}
v63 = v33 - 1LL;
v64 = v63 >> 1;
if ( v63 >> 1 )
{
v65 = ((v64 - 4) >> 2) + 1;
v66 = 4 * v65;
if ( v64 - 1 <= 2 )
{
v71 = v63 >> 1;
v70 = (unsigned int *)(v39 + 4 * v34);
LABEL_120:
*v70 = v36;
if ( v71 != 1 )
{
v70[1] = v36;
if ( v71 != 2 )
v70[2] = v36;
}
}
else
{
v67 = vdupq_n_s32(v36);
v68 = (int32x4_t *)(v39 + 4 * v34);
v69 = 0;
do
{
*v68++ = v67;
++v69;
}
while ( v69 < v65 );
v21 = v64 == v66;
v70 = (unsigned int *)&v40[v65];
v71 = v64 - v66;
if ( !v21 )
goto LABEL_120;
}
}
v72 = v63 - v64;
v40 = (int32x4_t *)((char *)v40 + 4 * v64);
v73 = &v40->n128_u32[1];
if ( v72 )
{
v74 = ((v72 - 4) >> 2) + 1;
v75 = 4 * v74;
if ( v72 - 1 <= 2 )
goto LABEL_136;
v76 = vdupq_n_s32(v36);
v77 = v34 + 1 + v64;
v78 = 0;
v79 = (int32x4_t *)(v39 + 4 * v77);
do
{
*v79++ = v76;
++v78;
}
while ( v78 < v74 );
v21 = v72 == v75;
v73 += 4 * v74;
v72 -= v75;
if ( !v21 )
{
LABEL_136:
*v73 = v36;
if ( v72 != 1 )
{
v73[1] = v36;
if ( v72 != 2 )
v73[2] = v36;
}
}
}
goto LABEL_69;
}
v53 = *a2;
v54 = *a2 + 1;
if ( v54 > a2[1] )
{
v83 = *a2;
fmt::internal::Array::grow(a2, *a2 + 1);
v53 = v83;
}
v55 = a2[2];
*a2 = v54;
v40 = (int32x4_t *)(v55 + 4 * v53);
LABEL_69:
v40->n128_u32[0] = v29[4];
a3 = v84;
break;
case 7:
fmt::BasicWriter::write_str((unsigned __int64 *)a2, (__int64)(v29 + 4), (__int64)&v87);
a3 = v84;
continue;
case 8:
v49 = *((_QWORD *)v29 + 3);
v86[0] = *((_QWORD *)v29 + 2);
v86[1] = v49;
fmt::BasicWriter::write_str((unsigned __int64 *)a2, (__int64)v86, &v87);
a3 = v84;
continue;
case 9:
if ( (unsigned __int8)v32 != 112 && (_BYTE)v32 )
fmt::internal::ReportUnknownType((fmt::internal *)(unsigned __int8)v32, (char)"pointer", (const char *)v10);
v92 = 120;
v48 = *((_QWORD *)v29 + 2);
v90 = 4;
fmt::BasicWriter::FormatInt(
(unsigned __int64 *)a2,
v48,
(__int64)&v87,
4,
v25,
v26,
v27,
v28,
v80);
a3 = v84;
continue;
case 10:
if ( (_BYTE)v32 )
fmt::internal::ReportUnknownType((fmt::internal *)(unsigned __int8)v32, (char)"object", (const char *)v10);
(*((void (__fastcall **)(__int64 *, _QWORD, char *))v29 + 3))(a2, *((_QWORD *)v29 + 2), "s");
a3 = v84;
continue;
default:
continue;
}
}
LABEL_6:
fmt::internal::Array::append(a2, v10, (__int64)a3);
return _stack_chk_guard;
}