//
// sub_1004DBEC0 from 0x1004dbec0 to 0x1004dbf3f (127 bytes)
//
// 0 xrefs:
//
// 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 12:31:16 +0000
//
__int64 __fastcall sub_1004DBEC0(__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);
}