// File: fanyazhi[P]Spline-Fitting/src/cubicSpline.cpp
// Function: cubicPoint(int, double, std::vector<double, std::allocator<double>>, std::vector<double, std::allocator<double>>, std::vector<double, std::allocator<double>>)
double cubicPoint(int i, double xi, vector<double> x, vector<double> y, vector<double> k) {
    double t = (xi - x[i - 1]) / (x[i] - x[i - 1]);
    double a = k[i - 1] * (x[i] - x[i - 1]) - (y[i] - y[i - 1]);
    double b = -1.0 * k[i] * (x[i] - x[i - 1]) + (y[i] - y[i - 1]);
    return (1 - t) * y[i - 1] + t * y[i] + t * (1 - t) * (a * (1 - t) + b * t);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movq %rsi, -0xd0(%rbp)
movl %edi, %eax
movq -0xd0(%rbp), %rdi
movq %rdi, -0x88(%rbp)
movq %rdx, -0x60(%rbp)
movq %rcx, -0x90(%rbp)
movl %eax, -0x4(%rbp)
movsd %xmm0, -0x10(%rbp)
movq %rdi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movsd -0x10(%rbp), %xmm0
movsd %xmm0, -0xc8(%rbp)
movl -0x4(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x4950
movsd -0xc8(%rbp), %xmm0
movq -0x88(%rbp), %rdi
subsd (%rax), %xmm0
movsd %xmm0, -0xb8(%rbp)
movslq -0x4(%rbp), %rsi
callq 0x4950
movq -0x88(%rbp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, -0xc0(%rbp)
movl -0x4(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x4950
movsd -0xc0(%rbp), %xmm1
movsd -0xb8(%rbp), %xmm0
movq -0x90(%rbp), %rdi
subsd (%rax), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x30(%rbp)
movl -0x4(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x4950
movq -0x88(%rbp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, -0xa0(%rbp)
movslq -0x4(%rbp), %rsi
callq 0x4950
movq -0x88(%rbp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, -0xb0(%rbp)
movl -0x4(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x4950
movsd -0xb0(%rbp), %xmm0
movq -0x60(%rbp), %rdi
subsd (%rax), %xmm0
movsd %xmm0, -0x98(%rbp)
movslq -0x4(%rbp), %rsi
callq 0x4950
movq -0x60(%rbp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, -0xa8(%rbp)
movl -0x4(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x4950
movsd -0xa8(%rbp), %xmm1
movsd -0xa0(%rbp), %xmm0
movsd -0x98(%rbp), %xmm2
movq -0x90(%rbp), %rdi
subsd (%rax), %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x38(%rbp)
movslq -0x4(%rbp), %rsi
callq 0x4950
movq -0x88(%rbp), %rdi
movsd 0x369a(%rip), %xmm0     # 0xc018
mulsd (%rax), %xmm0
movsd %xmm0, -0x70(%rbp)
movslq -0x4(%rbp), %rsi
callq 0x4950
movq -0x88(%rbp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, -0x80(%rbp)
movl -0x4(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x4950
movsd -0x80(%rbp), %xmm0
movq -0x60(%rbp), %rdi
subsd (%rax), %xmm0
movsd %xmm0, -0x68(%rbp)
movslq -0x4(%rbp), %rsi
callq 0x4950
movq -0x60(%rbp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, -0x78(%rbp)
movl -0x4(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x4950
movsd -0x78(%rbp), %xmm1
movsd -0x70(%rbp), %xmm0
movsd -0x68(%rbp), %xmm2
movq -0x60(%rbp), %rdi
subsd (%rax), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x40(%rbp)
movsd 0x3610(%rip), %xmm0     # 0xc020
subsd -0x30(%rbp), %xmm0
movsd %xmm0, -0x50(%rbp)
movl -0x4(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x4950
movq -0x60(%rbp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, -0x48(%rbp)
movsd -0x30(%rbp), %xmm0
movsd %xmm0, -0x58(%rbp)
movslq -0x4(%rbp), %rsi
callq 0x4950
movsd -0x58(%rbp), %xmm0
movsd -0x50(%rbp), %xmm1
movsd -0x48(%rbp), %xmm2
mulsd (%rax), %xmm0
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movsd -0x30(%rbp), %xmm0
movsd 0x35b0(%rip), %xmm2     # 0xc020
subsd -0x30(%rbp), %xmm2
mulsd %xmm2, %xmm0
movsd -0x38(%rbp), %xmm2
movsd 0x359a(%rip), %xmm4     # 0xc020
subsd -0x30(%rbp), %xmm4
movsd -0x40(%rbp), %xmm3
mulsd -0x30(%rbp), %xmm3
mulsd %xmm4, %xmm2
addsd %xmm3, %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
addq $0xd0, %rsp
popq %rbp
retq
nop