//
// sub_18003FDE0 from 0x18003fde0 to 0x18003fe52 (114 bytes)
//
// 3 xrefs:
// > fmt::internal::PrintfParser::ParseHeader @ 0x18004313a
// > fmt::internal::PrintfParser::ParseHeader @ 0x1800431df
// > ??> @ 0x1801b1344
//
// 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 sub_18003FDE0(_QWORD *a1, _QWORD *a2)
{
unsigned int v2; // r11d
int v3; // eax
_WORD *v4; // r9
unsigned int v5; // r10d
__int64 result; // rax
v2 = 0;
do
{
v3 = *(unsigned __int16 *)*a1;
v4 = (_WORD *)(*a1 + 2LL);
*a1 = v4;
v5 = v3 + 2 * (v2 + 4 * (v2 - 6));
LODWORD(result) = -1;
if ( v5 >= v2 )
LODWORD(result) = v5;
v2 = result;
}
while ( *v4 >= 0x30u && *v4 <= 0x39u );
if ( (unsigned int)result <= 0x7FFFFFFF )
return (unsigned int)result;
if ( !*a2 )
*a2 = "number is too big in format";
return 0;
}