//
// sub_1004E0ED0 from 0x1004e0ed0 to 0x1004e0f4f (127 bytes)
//
// 0 xrefs:
//
// 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_1004E0ED0(__int64 *a1, double a2)
{
__int64 v2; // rcx
__int64 v3; // rdx
__int64 v4; // rdx
unsigned __int64 v5; // rsi
v2 = *a1;
v3 = a1[1] - *a1;
if ( v3 )
{
v4 = v3 >> 3;
v2 = *a1;
v5 = v4;
do
{
v5 >>= 1;
if ( *(double *)(v2 + 8 * v5) <= a2 )
{
v2 += 8 * v5 + 8;
v5 = v4 + ~v5;
}
v4 = v5;
}
while ( v5 );
}
return (unsigned int)(int)fmax((double)(int)(((unsigned __int64)(v2 - *a1) >> 3) - 1), 0.0);
}