//
// sub_180040FD0 from 0x180040fd0 to 0x180041022 (82 bytes)
//
// 8 xrefs:
// > sub_18003E830 @ 0x18003e8cb
// > sub_18003EAD0 @ 0x18003eb63
// > sub_18003ED90 @ 0x18003ee1b
// > sub_18003F020 @ 0x18003f09f
// > sub_18003F2C0 @ 0x18003f35f
// > sub_18003F570 @ 0x18003f607
// > sub_18003F830 @ 0x18003f8bc
// > sub_18003FAC0 @ 0x18003fb40
//
// 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_180040FD0(unsigned __int64 a1)
{
unsigned int v2; // ecx
v2 = 1;
if ( a1 < 0xA )
return v2;
while ( a1 >= 0x64 )
{
if ( a1 < 0x3E8 )
return v2 + 2;
if ( a1 < 0x2710 )
return v2 + 3;
v2 += 4;
a1 /= 0x2710u;
if ( a1 < 0xA )
return v2;
}
return v2 + 1;
}