//
// fmt::BasicWriter::FormatDouble from 0x60e730 to 0x60e988 (600 bytes)
//
// 2 xrefs:
// > fmt::BasicFormatter::format @ 0x60ebbc
// > fmt::internal::PrintfParser::Format @ 0x60f008
//
// 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
//
char *__fastcall fmt::BasicWriter::FormatDouble(unsigned int *a1, double a2, int a3)
{
unsigned int v6; // r6
int v7; // r3
int v8; // r4
int v9; // r2
const char *v10; // r1
unsigned int v11; // r2
char *result; // r0
unsigned int v13; // r8
int v14; // r7
int v15; // r1
int v16; // r2
int *v17; // r3
int *v18; // r6
int v19; // r0
unsigned int v20; // r11
int v21; // r1
int v22; // r2
int v23; // r7
unsigned int v24; // r1
char *v25; // r4
int v26; // [sp+10h] [bp-44h]
int v27; // [sp+28h] [bp-2Ch] BYREF
char v28; // [sp+2Ch] [bp-28h] BYREF
v6 = *(unsigned __int8 *)(a3 + 20);
if ( v6 > 0x47 )
{
if ( v6 == 97 || v6 >= 0x61 && v6 - 101 <= 2 )
goto LABEL_13;
}
else
{
if ( v6 >= 0x45 )
goto LABEL_11;
if ( !*(_BYTE *)(a3 + 20) )
{
v7 = 0;
v6 = 103;
goto LABEL_14;
}
if ( v6 == 65 )
{
LABEL_11:
v7 = 1;
goto LABEL_14;
}
}
fmt::internal::ReportUnknownType((fmt::internal *)*(unsigned __int8 *)(a3 + 20), (char)"double", _stack_chk_guard);
LABEL_13:
v7 = 0;
LABEL_14:
if ( a2 >= 0.0 )
{
v9 = *(_DWORD *)(a3 + 12);
v8 = v9 & 1;
if ( (v9 & 1) != 0 )
{
if ( (v9 & 2) != 0 )
v8 = 43;
else
v8 = 32;
}
}
else
{
a2 = -a2;
v8 = 45;
}
if ( fabs(a2) <= 1.79769313e308 )
{
v13 = *a1;
v14 = *(_DWORD *)a3;
if ( v8 )
{
if ( v14 )
v15 = *(_DWORD *)a3;
else
v15 = 1;
fmt::internal::Array::reserve((int)a1, v15 + v13);
if ( v14 )
--v14;
++v13;
}
v16 = *(_DWORD *)(a3 + 8);
if ( (*(_DWORD *)(a3 + 12) & 4) != 0 )
{
v27 = 35;
v17 = (int *)&v28;
}
else
{
v17 = &v27;
}
if ( v16 != 3 )
{
if ( v16 == 1 )
*v17++ = 45;
if ( v14 )
*v17++ = 42;
}
if ( *(int *)(a3 + 16) >= 0 )
{
*v17 = 46;
v17[1] = 42;
v17 += 2;
}
*v17 = 76;
v17[1] = v6;
v17[2] = 0;
v26 = *(_DWORD *)(a3 + 4);
while ( 1 )
{
v18 = (int *)(a1[2] + 4 * v13);
v19 = swprintf();
v20 = v19;
if ( v19 >= 0 && v19 + v13 < a1[1] )
break;
if ( v19 < 0 )
v24 = a1[1] + 1;
else
v24 = v13 + 1 + v19;
fmt::internal::Array::reserve((int)a1, v24);
}
v21 = *(_DWORD *)(a3 + 8);
if ( v8 )
{
if ( (v21 & 0xFFFFFFFD) != 0 || *v18 != 32 )
{
v22 = v8;
v8 = 0;
}
else
{
v22 = v26;
}
v20 = v19 + 1;
*(v18 - 1) = v22;
}
if ( v21 == 3 && (v23 = *(_DWORD *)a3, *(_DWORD *)a3 > v20) )
{
v25 = (char *)fmt::BasicWriter::GrowBuffer(a1, *(_DWORD *)a3);
std::__copy_move::__copy_m(
v25,
(int)&v25[4 * v20],
&v25[4 * ((v23 - v20) >> 1)]);
return (char *)fmt::BasicWriter::FillPadding(v25, *(_DWORD *)a3, v20, v26);
}
else
{
if ( *(_DWORD *)(a3 + 4) != 32 || v8 )
{
while ( *v18 == 32 )
*v18++ = v26;
if ( v8 )
*(v18 - 1) = v8;
}
return (char *)fmt::BasicWriter::GrowBuffer(a1, v20);
}
}
else
{
if ( v7 )
v10 = " INF";
else
v10 = " inf";
if ( v8 )
{
v11 = 4;
}
else
{
++v10;
v11 = 3;
}
result = fmt::BasicWriter::write_str(a1, (int)v10, v11, (int *)a3);
if ( v8 )
*(_DWORD *)result = v8;
}
return result;
}