//
// fmt::BasicWriter::write_str from 0xb683b8 to 0xb6871c (868 bytes)
//
// 3 xrefs:
// > fmt::BasicFormatter::format @ 0xb6ef98
// > fmt::internal::PrintfParser::Format @ 0xb6fd2c
// > ??> @ 0x81a98
//
// 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
//
int32x4_t *__fastcall fmt::BasicWriter::write_str(unsigned __int64 *a1, __int64 a2, unsigned int *a3)
{
fmt::internal *v5; // x0
size_t v6; // x19
const wchar_t *v7; // x22
__int64 v8; // x23
size_t v9; // x21
size_t v10; // x1
unsigned __int64 v11; // x24
unsigned __int64 v12; // x0
unsigned __int64 v13; // x25
unsigned int v14; // w6
__int64 v15; // x4
unsigned __int64 v16; // x3
int32x4_t *result; // x0
unsigned int v18; // w5
size_t v19; // x1
unsigned int *v20; // x6
unsigned __int64 v21; // x2
__int64 v22; // x7
int32x4_t v23; // q0
int32x4_t *v24; // x3
unsigned __int64 v25; // x4
bool v26; // zf
unsigned __int64 v27; // x19
unsigned __int64 v28; // x0
size_t v29; // x0
size_t v30; // x1
unsigned __int64 v31; // x3
__int64 v32; // x4
int32x4_t v33; // q0
int32x4_t *v34; // x7
unsigned __int64 v35; // x6
unsigned int *v36; // x3
size_t v37; // x1
size_t v38; // x2
unsigned __int64 v39; // x4
__int64 v40; // x6
int32x4_t v41; // q0
int32x4_t *v42; // x8
unsigned __int64 v43; // x7
unsigned int *v44; // x4
size_t v45; // x6
unsigned __int64 v46; // x4
size_t v47; // x24
int32x4_t v48; // q0
unsigned __int64 v49; // x2
int32x4_t *v50; // x3
unsigned int *v51; // [xsp+58h] [xbp+58h]
unsigned int *v52; // [xsp+58h] [xbp+58h]
unsigned int *v53; // [xsp+58h] [xbp+58h]
v5 = (fmt::internal *)*((unsigned __int8 *)a3 + 20);
if ( (_DWORD)v5 == 115 || !*((_BYTE *)a3 + 20) )
{
v6 = *(_QWORD *)(a2 + 8);
v7 = *(const wchar_t **)a2;
if ( !v6 )
goto LABEL_4;
LABEL_21:
v10 = *a3;
v9 = 4 * v6;
v8 = (__int64)(4 * v6) >> 2;
v11 = *a1;
v12 = a1[1];
if ( v6 < v10 )
goto LABEL_7;
goto LABEL_22;
}
v51 = a3;
fmt::internal::ReportUnknownType(v5, (char)"string", (const char *)a3);
v6 = *(_QWORD *)(a2 + 8);
a3 = v51;
v7 = *(const wchar_t **)a2;
if ( v6 )
goto LABEL_21;
LABEL_4:
if ( *v7 )
{
v52 = a3;
v29 = wcslen(v7);
v9 = 4 * v29;
v6 = v29;
v8 = (__int64)(4 * v29) >> 2;
a3 = v52;
}
else
{
v8 = 0;
v9 = 0;
}
v10 = *a3;
v11 = *a1;
v12 = a1[1];
if ( v6 < v10 )
{
LABEL_7:
v13 = v10 + v11;
if ( v10 + v11 > v12 )
{
v53 = a3;
fmt::internal::Array::grow(a1, v10 + v11);
a3 = v53;
v15 = 4 * v11;
v16 = a1[2];
v14 = v53[2];
result = (int32x4_t *)(v16 + 4 * v11);
v10 = *v53;
*a1 = v13;
v18 = v53[1];
if ( v14 != 2 )
{
LABEL_9:
if ( v14 != 3 )
{
v19 = v10 - v6;
v20 = (unsigned int *)((char *)result + v9);
if ( !v19 )
goto LABEL_18;
v21 = ((v19 - 4) >> 2) + 1;
v22 = 4 * v21;
if ( v19 - 1 <= 2 )
{
LABEL_15:
*v20 = v18;
if ( v19 != 1 )
{
v20[1] = v18;
if ( v19 != 2 )
v20[2] = v18;
}
LABEL_18:
if ( !v8 )
return result;
return (int32x4_t *)memmove(result, v7, v9);
}
v23 = vdupq_n_s32(v18);
v24 = (int32x4_t *)(v16 + v15 + v9);
v25 = 0;
do
{
*v24++ = v23;
++v25;
}
while ( v25 < v21 );
LABEL_14:
v26 = v19 == v22;
v20 += v22;
v19 -= v22;
if ( v26 )
goto LABEL_18;
goto LABEL_15;
}
v37 = v10 - v6;
v38 = v37 >> 1;
if ( v37 >> 1 )
{
v39 = ((v38 - 4) >> 2) + 1;
v40 = 4 * v39;
if ( v38 - 1 <= 2 )
{
v45 = v37 >> 1;
v44 = (unsigned int *)result;
goto LABEL_42;
}
v41 = vdupq_n_s32(v18);
v42 = result;
v43 = 0;
do
{
*v42++ = v41;
++v43;
}
while ( v43 < v39 );
v26 = v38 == v40;
v44 = (unsigned int *)&result[v39];
v45 = v38 - v40;
if ( !v26 )
{
LABEL_42:
*v44 = v18;
if ( v45 != 1 )
{
v44[1] = v18;
if ( v45 != 2 )
v44[2] = v18;
}
}
}
v19 = v37 - v38;
result = (int32x4_t *)((char *)result + 4 * v38);
v20 = (unsigned int *)((char *)result + v9);
if ( !v19 )
goto LABEL_18;
v46 = ((v19 - 4) >> 2) + 1;
v22 = 4 * v46;
if ( v19 - 1 <= 2 )
goto LABEL_15;
v47 = v38 + v11;
v48 = vdupq_n_s32(v18);
v49 = 0;
v50 = (int32x4_t *)(v16 + v9 + 4 * v47);
do
{
*v50++ = v48;
++v49;
}
while ( v46 > v49 );
goto LABEL_14;
}
}
else
{
v14 = a3[2];
v15 = 4 * v11;
v16 = a1[2];
*a1 = v13;
result = (int32x4_t *)(v16 + 4 * v11);
v18 = a3[1];
if ( v14 != 2 )
goto LABEL_9;
}
v30 = v10 - v6;
if ( !v30 )
goto LABEL_18;
v31 = ((v30 - 4) >> 2) + 1;
v32 = 4 * v31;
if ( v30 - 1 <= 2 )
{
v36 = (unsigned int *)result;
}
else
{
v33 = vdupq_n_s32(v18);
v34 = result;
v35 = 0;
do
{
*v34++ = v33;
++v35;
}
while ( v35 < v31 );
v26 = v30 == v32;
v36 = (unsigned int *)&result[v31];
v30 -= v32;
if ( v26 )
{
LABEL_36:
result = (int32x4_t *)((char *)result + 4 * (*a3 - v6));
goto LABEL_18;
}
}
*v36 = v18;
if ( v30 != 1 )
{
v36[1] = v18;
if ( v30 != 2 )
v36[2] = v18;
}
goto LABEL_36;
}
LABEL_22:
v27 = v6 + v11;
if ( v27 > v12 )
fmt::internal::Array::grow(a1, v27);
v28 = a1[2];
*a1 = v27;
result = (int32x4_t *)(v28 + 4 * v11);
if ( v8 )
return (int32x4_t *)memmove(result, v7, v9);
return result;
}