// File: /workspace/github_cpp_makefile_star2_O1/fanyazhi[P]Spline-Fitting/src/cubicSpline.cpp
// Function: cubicSpline(std::vector<double, std::allocator<double>>, std::vector<double, std::allocator<double>>, std::vector<double, std::allocator<double>>&, std::vector<double, std::allocator<double>>&)
void cubicSpline(vector<double> x, vector<double> y, vector<double> &qx, vector<double> &qy) {
    //initialize qx and qy for extraction
    qx[0] = x[0];
    qy[0] = y[0];

    //initialize variable t to breakdown a and y into monotonic functions
    vector<double> t(x.size());
    for (int i = 0; i < t.size(); i++) {
        t[i] = i;
    }
    vector<double> qt(qx.size());
    qt[0] = 0;
    for (int i = 1; i < qt.size(); i++) {
        qt[i] = qt[i - 1] + 1.0 * (t.size() - 1) / qx.size();
    }

    //obtain derivatives
    vector<double> ky(qt.size());
    vector<double> kx(qt.size());
    ky = splineDerivative(t.size(), t, y);
    kx = splineDerivative(t.size(), t, x);

    //if the first point and the last points are exactly the same, then the
    //curve is enclosed, and derivatives should match at the enclosure point
    double epislon = 1E-7;
    if ((abs(x[0] - x[x.size() - 1]) < epislon) && (abs(y[0] - y[y.size() - 1]) < epislon)) {
        ky[ky.size() - 1] = ky[0];
        kx[kx.size() - 1] = kx[0];
    }

    for (int j = 1; j < qt.size(); j++) {
        int i = 0;
        while (t[i] < qt[j] && i < t.size()) {
            i++;
        }
        qy[j] = cubicPoint(i, qt[j], t, y, ky);
        qx[j] = cubicPoint(i, qt[j], t, x, kx);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x188, %rsp            # imm = 0x188
movq %rdx, %r14
movq %rdi, %r12
movq (%rdi), %rax
movsd (%rax), %xmm0
movq (%rdx), %rdx
movsd %xmm0, (%rdx)
movq %rsi, 0x70(%rsp)
movq (%rsi), %rdx
movsd (%rdx), %xmm0
movq %rcx, 0x90(%rsp)
movq (%rcx), %rcx
movsd %xmm0, (%rcx)
movq 0x8(%rdi), %rsi
subq %rax, %rsi
sarq $0x3, %rsi
leaq 0x78(%rsp), %rbx
leaq 0x28(%rsp), %rdx
movq %rbx, %rdi
callq 0x3d60
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
subq %rax, %rcx
je 0x48fb
sarq $0x3, %rcx
cmpq $0x1, %rcx
adcq $0x0, %rcx
xorl %edx, %edx
xorps %xmm0, %xmm0
cvtsi2sd %edx, %xmm0
movsd %xmm0, (%rax,%rdx,8)
incq %rdx
cmpq %rdx, %rcx
jne 0x48e7
movq 0x8(%r14), %rsi
subq (%r14), %rsi
sarq $0x3, %rsi
leaq 0x28(%rsp), %rdi
leaq 0x58(%rsp), %rdx
callq 0x3d60
movq 0x28(%rsp), %rax
movq $0x0, (%rax)
movq 0x30(%rsp), %rsi
subq %rax, %rsi
sarq $0x3, %rsi
cmpq $0x2, %rsi
jb 0x49b2
movq 0x80(%rsp), %rcx
subq 0x78(%rsp), %rcx
sarq $0x3, %rcx
decq %rcx
movq %rcx, %xmm1
movq 0x179c(%rip), %xmm2     # 0x60f0
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movapd 0x17a0(%rip), %xmm3     # 0x6100
subpd %xmm3, %xmm1
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
movq 0x8(%r14), %rcx
subq (%r14), %rcx
sarq $0x3, %rcx
movq %rcx, %xmm1
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
subpd %xmm3, %xmm1
movapd %xmm1, %xmm2
unpckhpd %xmm1, %xmm2            # xmm2 = xmm2[1],xmm1[1]
addsd %xmm1, %xmm2
divsd %xmm2, %xmm0
movsd (%rax), %xmm1
movl $0x1, %ecx
addsd %xmm0, %xmm1
movsd %xmm1, (%rax,%rcx,8)
incq %rcx
cmpq %rcx, %rsi
jne 0x49a1
leaq 0x58(%rsp), %rdi
leaq 0x40(%rsp), %rdx
callq 0x3d60
movq 0x30(%rsp), %rsi
subq 0x28(%rsp), %rsi
sarq $0x3, %rsi
leaq 0x40(%rsp), %rdi
movq %rsp, %rdx
callq 0x3d60
leaq 0x78(%rsp), %rsi
movq 0x8(%rsi), %rbx
subq (%rsi), %rbx
leaq 0x140(%rsp), %rdi
callq 0x3dea
leaq 0x128(%rsp), %rdi
movq 0x70(%rsp), %rsi
callq 0x3dea
shrq $0x3, %rbx
movq %rsp, %rdi
leaq 0x140(%rsp), %rdx
leaq 0x128(%rsp), %rcx
movl %ebx, %esi
callq 0x439a
movq 0x58(%rsp), %rdi
movq 0x68(%rsp), %rsi
movq (%rsp), %rax
movq %rax, 0x58(%rsp)
movupd 0x8(%rsp), %xmm0
movupd %xmm0, 0x60(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
testq %rdi, %rdi
je 0x4a63
subq %rdi, %rsi
callq 0x2190
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x4a79
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x2190
movq 0x128(%rsp), %rdi
testq %rdi, %rdi
je 0x4a96
movq 0x138(%rsp), %rsi
subq %rdi, %rsi
callq 0x2190
movq 0x140(%rsp), %rdi
testq %rdi, %rdi
je 0x4ab3
movq 0x150(%rsp), %rsi
subq %rdi, %rsi
callq 0x2190
leaq 0x78(%rsp), %rsi
movq 0x8(%rsi), %rbx
subq (%rsi), %rbx
leaq 0x110(%rsp), %rdi
callq 0x3dea
leaq 0xf8(%rsp), %rdi
movq %r12, %rsi
callq 0x3dea
shrq $0x3, %rbx
movq %rsp, %rdi
leaq 0x110(%rsp), %rdx
leaq 0xf8(%rsp), %rcx
movl %ebx, %esi
callq 0x439a
movq 0x40(%rsp), %rdi
movq 0x50(%rsp), %rsi
movq (%rsp), %rax
movq %rax, 0x40(%rsp)
movups 0x8(%rsp), %xmm0
movups %xmm0, 0x48(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
testq %rdi, %rdi
je 0x4b34
subq %rdi, %rsi
callq 0x2190
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x4b4a
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x2190
movq 0xf8(%rsp), %rdi
testq %rdi, %rdi
je 0x4b67
movq 0x108(%rsp), %rsi
subq %rdi, %rsi
callq 0x2190
movq 0x110(%rsp), %rdi
testq %rdi, %rdi
je 0x4b84
movq 0x120(%rsp), %rsi
subq %rdi, %rsi
callq 0x2190
movq (%r12), %rax
movq 0x8(%r12), %rcx
movsd (%rax), %xmm1
subsd -0x8(%rcx), %xmm1
andpd 0x1572(%rip), %xmm1     # 0x6110
movsd 0x153a(%rip), %xmm0     # 0x60e0
ucomisd %xmm1, %xmm0
jbe 0x4bf5
movq 0x70(%rsp), %rcx
movq (%rcx), %rax
movq 0x8(%rcx), %rcx
movsd (%rax), %xmm1
subsd -0x8(%rcx), %xmm1
andpd 0x1547(%rip), %xmm1     # 0x6110
ucomisd %xmm1, %xmm0
jbe 0x4bf5
movq 0x58(%rsp), %rax
movq 0x60(%rsp), %rcx
movsd (%rax), %xmm0
movsd %xmm0, -0x8(%rcx)
movq 0x40(%rsp), %rax
movq 0x48(%rsp), %rcx
movsd (%rax), %xmm0
movsd %xmm0, -0x8(%rcx)
movq 0x28(%rsp), %rax
movq 0x30(%rsp), %rcx
subq %rax, %rcx
cmpq $0x9, %rcx
jb 0x4ee1
movl $0x1, %r13d
leaq 0x78(%rsp), %rbp
movq 0x78(%rsp), %rcx
movsd (%rax,%r13,8), %xmm0
movsd %xmm0, 0x20(%rsp)
ucomisd (%rcx), %xmm0
movl $0x0, %ebx
jbe 0x4c63
movq 0x80(%rsp), %rax
subq %rcx, %rax
sarq $0x3, %rax
xorl %edx, %edx
cmpq %rdx, %rax
je 0x4c60
leaq 0x1(%rdx), %rbx
movsd 0x20(%rsp), %xmm0
ucomisd 0x8(%rcx,%rdx,8), %xmm0
movq %rbx, %rdx
ja 0x4c44
jmp 0x4c63
movq %rax, %rbx
leaq 0xe0(%rsp), %rdi
movq %rbp, %rsi
callq 0x3dea
leaq 0xc8(%rsp), %rdi
movq 0x70(%rsp), %rsi
callq 0x3dea
leaq 0x170(%rsp), %rdi
leaq 0x58(%rsp), %rsi
callq 0x3dea
movslq %ebx, %rbx
movq 0xe0(%rsp), %rax
movsd -0x8(%rax,%rbx,8), %xmm0
movsd 0x20(%rsp), %xmm5
subsd %xmm0, %xmm5
movl %ebx, %r15d
movsd (%rax,%r15,8), %xmm1
subsd %xmm0, %xmm1
divsd %xmm1, %xmm5
movq 0x170(%rsp), %rdi
movq 0xc8(%rsp), %rax
movsd (%rax,%r15,8), %xmm0
movsd -0x8(%rax,%rbx,8), %xmm2
movapd %xmm5, %xmm3
mulsd %xmm0, %xmm3
subsd %xmm2, %xmm0
movsd -0x8(%rdi,%rbx,8), %xmm4
mulsd %xmm1, %xmm4
mulsd (%rdi,%r15,8), %xmm1
subsd %xmm0, %xmm4
subsd %xmm1, %xmm0
movsd 0x12fd(%rip), %xmm1     # 0x6008
subsd %xmm5, %xmm1
mulsd %xmm1, %xmm2
addsd %xmm3, %xmm2
movapd %xmm5, %xmm3
mulsd %xmm1, %xmm3
mulsd %xmm5, %xmm0
mulsd %xmm4, %xmm1
addsd %xmm0, %xmm1
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
movq 0x90(%rsp), %rax
movq (%rax), %rax
movsd %xmm1, (%rax,%r13,8)
testq %rdi, %rdi
je 0x4d59
movq 0x180(%rsp), %rsi
subq %rdi, %rsi
callq 0x2190
movq 0xc8(%rsp), %rdi
testq %rdi, %rdi
je 0x4d76
movq 0xd8(%rsp), %rsi
subq %rdi, %rsi
callq 0x2190
movq 0xe0(%rsp), %rdi
testq %rdi, %rdi
je 0x4d93
movq 0xf0(%rsp), %rsi
subq %rdi, %rsi
callq 0x2190
movq 0x28(%rsp), %rax
movsd (%rax,%r13,8), %xmm0
movsd %xmm0, 0x20(%rsp)
leaq 0xb0(%rsp), %rdi
movq %rbp, %rsi
callq 0x3dea
leaq 0x98(%rsp), %rdi
movq %r12, %rsi
callq 0x3dea
leaq 0x158(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x3dea
decq %rbx
movq 0xb0(%rsp), %rax
movsd (%rax,%rbx,8), %xmm0
movsd 0x20(%rsp), %xmm5
subsd %xmm0, %xmm5
movsd (%rax,%r15,8), %xmm1
subsd %xmm0, %xmm1
divsd %xmm1, %xmm5
movq 0x158(%rsp), %rdi
movq 0x98(%rsp), %rax
movsd (%rax,%r15,8), %xmm0
movsd (%rax,%rbx,8), %xmm2
movapd %xmm5, %xmm3
mulsd %xmm0, %xmm3
subsd %xmm2, %xmm0
movsd (%rdi,%rbx,8), %xmm4
mulsd %xmm1, %xmm4
mulsd (%rdi,%r15,8), %xmm1
subsd %xmm0, %xmm4
subsd %xmm1, %xmm0
movsd 0x11c4(%rip), %xmm1     # 0x6008
subsd %xmm5, %xmm1
mulsd %xmm1, %xmm2
addsd %xmm3, %xmm2
movapd %xmm5, %xmm3
mulsd %xmm1, %xmm3
mulsd %xmm5, %xmm0
mulsd %xmm4, %xmm1
addsd %xmm0, %xmm1
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
movq (%r14), %rax
movsd %xmm1, (%rax,%r13,8)
testq %rdi, %rdi
je 0x4e8a
movq 0x168(%rsp), %rsi
subq %rdi, %rsi
callq 0x2190
movq 0x98(%rsp), %rdi
testq %rdi, %rdi
je 0x4ea7
movq 0xa8(%rsp), %rsi
subq %rdi, %rsi
callq 0x2190
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0x4ec4
movq 0xc0(%rsp), %rsi
subq %rdi, %rsi
callq 0x2190
incq %r13
movq 0x28(%rsp), %rax
movq 0x30(%rsp), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %r13, %rcx
ja 0x4c17
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x4ef8
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x2190
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x4f0f
movq 0x68(%rsp), %rsi
subq %rdi, %rsi
callq 0x2190
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x4f26
movq 0x38(%rsp), %rsi
subq %rdi, %rsi
callq 0x2190
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x4f40
movq 0x88(%rsp), %rsi
subq %rdi, %rsi
callq 0x2190
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0xf8(%rsp), %rdi
testq %rdi, %rdi
je 0x4f77
movq 0x108(%rsp), %rsi
subq %rdi, %rsi
callq 0x2190
jmp 0x4f77
movq %rax, %rbx
movq 0x110(%rsp), %rdi
testq %rdi, %rdi
je 0x507d
movq 0x120(%rsp), %rsi
jmp 0x5070
jmp 0x507a
movq %rax, %rbx
movq 0x128(%rsp), %rdi
testq %rdi, %rdi
je 0x4fbf
movq 0x138(%rsp), %rsi
subq %rdi, %rsi
callq 0x2190
jmp 0x4fbf
movq %rax, %rbx
movq 0x140(%rsp), %rdi
testq %rdi, %rdi
je 0x507d
movq 0x150(%rsp), %rsi
jmp 0x5070
jmp 0x507a
movq %rax, %rbx
jmp 0x5094
movq %rax, %rbx
jmp 0x50ab
movq %rax, %rbx
jmp 0x50c2
movq %rax, %rbx
jmp 0x501f
movq %rax, %rbx
movq 0xc8(%rsp), %rdi
testq %rdi, %rdi
je 0x501f
movq 0xd8(%rsp), %rsi
subq %rdi, %rsi
callq 0x2190
movq 0xe0(%rsp), %rdi
testq %rdi, %rdi
je 0x507d
movq 0xf0(%rsp), %rsi
jmp 0x5070
movq %rax, %rbx
jmp 0x505b
movq %rax, %rbx
movq 0x98(%rsp), %rdi
testq %rdi, %rdi
je 0x505b
movq 0xa8(%rsp), %rsi
subq %rdi, %rsi
callq 0x2190
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0x507d
movq 0xc0(%rsp), %rsi
subq %rdi, %rsi
callq 0x2190
jmp 0x507d
movq %rax, %rbx
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x5094
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x2190
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x50ab
movq 0x68(%rsp), %rsi
subq %rdi, %rsi
callq 0x2190
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x50c2
movq 0x38(%rsp), %rsi
subq %rdi, %rsi
callq 0x2190
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x50dc
movq 0x88(%rsp), %rsi
subq %rdi, %rsi
callq 0x2190
movq %rbx, %rdi
callq 0x2270