//
// sub_180040410 from 0x180040410 to 0x180040474 (100 bytes)
//
// 2 xrefs:
// > fmt::internal::PrintfParser::ParseHeader @ 0x180043558
// > fmt::internal::PrintfParser::ParseHeader @ 0x1800435e3
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:21:38 +0000
//
__int64 __fastcall sub_180040410(char **a1, _QWORD *a2)
{
unsigned int v2; // r11d
int v3; // eax
char *v4; // r9
unsigned int v5; // r10d
__int64 result; // rax
v2 = 0;
do
{
v3 = **a1;
v4 = *a1 + 1;
*a1 = v4;
v5 = v3 + 2 * (v2 + 4 * (v2 - 6));
LODWORD(result) = -1;
if ( v5 >= v2 )
LODWORD(result) = v5;
v2 = result;
}
while ( *v4 >= 48 && *v4 <= 57 );
if ( (unsigned int)result <= 0x7FFFFFFF )
return (unsigned int)result;
if ( !*a2 )
*a2 = "number is too big in format";
return 0;
}