//
// tk::spline::find_closest from 0x5947ba to 0x594818 (94 bytes)
//
// 2 xrefs:
// > tk::spline::operator @ 0x594828
// > tk::spline::deriv @ 0x5948da
//
// 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
//
unsigned int __fastcall tk::spline::find_closest(double **this, double a2)
{
double *v4; // r3
int v5; // r2
double *v6; // r4
double v7; // r0
v4 = *this;
v5 = *(this + 1) - *this;
while ( v5 > 0 )
{
v6 = &v4[v5 >> 1];
if ( a2 < *v6 )
{
v5 >>= 1;
}
else
{
v4 = v6 + 1;
v5 = v5 - (v5 >> 1) - 1;
}
}
LODWORD(v7) = fmax();
return (unsigned int)v7;
}