//
// tk::spline::deriv from 0xa7d768 to 0xa7d8f0 (392 bytes)
//
// 1 xrefs:
// > ??> @ 0xc4248
//
// 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
//
double __fastcall tk::spline::deriv(tk::spline *this, int a2, double a3)
{
__int64 v4; // x21
__int64 v6; // x20
unsigned __int64 closest; // x0
double v8; // d0
__int64 v10; // x20
v4 = *(_QWORD *)this;
v6 = *((_QWORD *)this + 1);
closest = tk::spline::find_closest((double **)this, a3);
v8 = a3 - *(double *)(*(_QWORD *)this + 8 * closest);
if ( a3 >= **(double **)this )
{
v10 = ((v6 - v4) >> 3) - 1;
if ( a3 <= *(double *)(*(_QWORD *)this + 8 * v10) )
{
switch ( a2 )
{
case 2:
return *(double *)(*((_QWORD *)this + 9) + 8 * closest)
+ *(double *)(*((_QWORD *)this + 9) + 8 * closest)
+ *(double *)(*((_QWORD *)this + 12) + 8 * closest) * 6.0 * v8;
case 3:
return *(double *)(*((_QWORD *)this + 12) + 8 * closest) * 6.0;
case 1:
return *(double *)(*((_QWORD *)this + 6) + 8 * closest)
+ (*(double *)(*((_QWORD *)this + 9) + 8 * closest)
+ *(double *)(*((_QWORD *)this + 9) + 8 * closest)
+ *(double *)(*((_QWORD *)this + 12) + 8 * closest) * 3.0 * v8)
* v8;
default:
return 0.0;
}
}
else if ( a2 == 1 )
{
return *(double *)(*((_QWORD *)this + 6) + 8 * v10)
+ (*(double *)(*((_QWORD *)this + 9) + 8 * v10) + *(double *)(*((_QWORD *)this + 9) + 8 * v10)) * v8;
}
else
{
if ( a2 != 2 )
return 0.0;
return *(double *)(*((_QWORD *)this + 9) + 8 * v10) + *(double *)(*((_QWORD *)this + 9) + 8 * v10);
}
}
else if ( a2 == 1 )
{
return **((double **)this + 6) + (*((double *)this + 15) + *((double *)this + 15)) * v8;
}
else
{
if ( a2 != 2 )
return 0.0;
return *((double *)this + 15) + *((double *)this + 15);
}
}