//
// tk::spline::set_coeffs_from_b from 0x5951b8 to 0x595296 (222 bytes)
//
// 2 xrefs:
// > tk::spline::make_monotonic @ 0x595400
// > tk::spline::set_points @ 0x5960fe
//
// 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::set_coeffs_from_b(tk::spline *this)
{
unsigned int v2; // r5
unsigned int v3; // r5
unsigned int result; // r0
int v5; // r3
int v6; // r1
double *v7; // r7
double *v8; // r1
double v9; // d2
double v10; // d7
__int64 v11; // r2
v2 = (*((_DWORD *)this + 7) - *((_DWORD *)this + 6)) >> 3;
if ( v2 != (*((_DWORD *)this + 10) - *((_DWORD *)this + 9)) >> 3 )
std::vector::resize((const void **)this + 9, v2);
if ( v2 != (*((_DWORD *)this + 13) - *((_DWORD *)this + 12)) >> 3 )
std::vector::resize((const void **)this + 12, v2);
v3 = v2 - 1;
result = 0;
while ( result < v3 )
{
++result;
v5 = 8 * result - 8;
v6 = *((_DWORD *)this + 6);
v7 = (double *)(v6 + v5);
v8 = (double *)(v6 + 8 * result);
v9 = *(double *)(*(_DWORD *)this + 8 * result) - *(double *)(*(_DWORD *)this + v5);
v10 = ((*(double *)(8 * result + *((_DWORD *)this + 3)) - *(double *)(*((_DWORD *)this + 3) + v5)) * 3.0 / v9
- (*v7
+ *v7
+ *v8))
/ v9;
*(double *)(*((_DWORD *)this + 9) + v5) = v10;
*(double *)(v5 + *((_DWORD *)this + 12)) = ((*v8 - *v7) / (v9 * 3.0) - v10 * 0.666666667) / v9;
}
if ( *((_DWORD *)this + 19) == 1 )
v11 = 0;
else
v11 = *(_QWORD *)*((_DWORD *)this + 9);
*((_QWORD *)this + 8) = v11;
return result;
}