// File: /workspace/github_cpp_makefile_star2_O3/TBody[P]atomicpp/atomicpp/Spline/BivariateBSpline.cpp
// Function: atomicpp::BivariateBSpline::fpback(std::vector<std::vector<double, std::allocator<double>>, std::allocator<std::vector<double, std::allocator<double>>>> const&, std::vector<double, std::allocator<double>> const&, int, int, int, std::vector<double, std::allocator<double>>&, int, int)
void BivariateBSpline::fpback(const std::vector<std::vector<double>>& a, const std::vector<double>& z, const int z_start, const int n, const int k, std::vector<double>& C, const int c_start, const int nest){
  // Switch from Fortran to C++ indexing
  // Supply start as '1' to not apply a shift
  int z_shifted = z_start - 1;
  int c_shifted = c_start - 1;

  C.at(c_shifted + n-1) = z.at(z_shifted + n-1)/a.at(n-1).at(0);
  
  int i = n-1;
  double store;

  if(i!=0){
    for(int j=2; j <= n; ++j){
      store = z.at(z_shifted + i-1);
      int i1 = k-1;

      if(j <= k-1){
        i1 = j-1;
      }
      int m = i;
      for(int l=1; l <= i1; ++l){
        m = m+1;
        store = store - C.at(c_shifted + m-1)*a.at(i-1).at(l);
      }
      C.at(c_shifted + i-1) = store/a.at(i-1).at(0);
      i -= 1;
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movl %r9d, -0x44(%rbp)
movl %r8d, %r12d
movq %rdx, %rdi
movq %rsi, %r13
movl 0x18(%rbp), %r15d
movq 0x10(%rbp), %rbx
movq %rcx, -0x38(%rbp)
leal (%r12,%rcx), %eax
addl $-0x2, %eax
movslq %eax, %rsi
movq %rdx, -0x78(%rbp)
callq 0x1d15e
movsd (%rax), %xmm0
movsd %xmm0, -0x30(%rbp)
leal -0x1(%r12), %eax
movslq %eax, %rsi
movq %r13, %rdi
callq 0x1d180
movq %rax, %rdi
xorl %esi, %esi
callq 0x1d15e
movsd -0x30(%rbp), %xmm0
divsd (%rax), %xmm0
movsd %xmm0, -0x30(%rbp)
leal (%r12,%r15), %eax
addl $-0x2, %eax
movslq %eax, %rsi
movq %rbx, %rdi
movq %r13, %r15
callq 0x1d102
movsd -0x30(%rbp), %xmm0
movsd %xmm0, (%rax)
cmpl $0x2, %r12d
jl 0x1c7eb
movq -0x38(%rbp), %rax
addl $-0x2, %eax
movq %rax, -0x38(%rbp)
movl 0x18(%rbp), %eax
leal -0x2(%rax), %ebx
movl %r12d, %r14d
decq %r14
decl %eax
movq %rax, -0x60(%rbp)
movl $0x2, %eax
movq %rax, -0x40(%rbp)
movq %r12, -0x68(%rbp)
movq %rbx, -0x58(%rbp)
movq -0x38(%rbp), %rax
addl %r14d, %eax
movslq %eax, %rsi
movq -0x78(%rbp), %rdi
callq 0x1d15e
movsd (%rax), %xmm0
movl -0x44(%rbp), %eax
cmpl $0x1, %eax
jle 0x1c784
movq -0x40(%rbp), %rcx
cmpl %eax, %ecx
cmovll %ecx, %eax
leaq -0x1(%r14), %rcx
movq %rcx, -0x50(%rbp)
movslq %eax, %r12
movq %r14, -0x70(%rbp)
addl -0x60(%rbp), %r14d
movl $0x1, %ebx
movq 0x10(%rbp), %r13
movsd %xmm0, -0x30(%rbp)
movslq %r14d, %r14
movq %r13, %rdi
movq %r14, %rsi
callq 0x1d102
movsd (%rax), %xmm0
movsd %xmm0, -0x80(%rbp)
movq %r15, %rdi
movq -0x50(%rbp), %rsi
callq 0x1d180
movq %rax, %rdi
movq %rbx, %rsi
callq 0x1d15e
movsd -0x30(%rbp), %xmm0
movsd -0x80(%rbp), %xmm1
mulsd (%rax), %xmm1
subsd %xmm1, %xmm0
incq %rbx
incl %r14d
cmpq %r12, %rbx
jl 0x1c71a
movsd %xmm0, -0x30(%rbp)
movq -0x68(%rbp), %r13
movq %r15, %rdi
movq -0x58(%rbp), %rbx
movq -0x70(%rbp), %r14
movq -0x50(%rbp), %r12
jmp 0x1c795
movsd %xmm0, -0x30(%rbp)
movq %r12, %r13
movq %r14, %r12
decq %r12
movq %r15, %rdi
movq %rdi, %r15
movq %r12, %rsi
callq 0x1d180
movq %rax, %rdi
xorl %esi, %esi
callq 0x1d15e
movsd -0x30(%rbp), %xmm0
divsd (%rax), %xmm0
movsd %xmm0, -0x30(%rbp)
leal (%rbx,%r14), %eax
movslq %eax, %rsi
movq 0x10(%rbp), %rdi
callq 0x1d102
movsd -0x30(%rbp), %xmm0
movsd %xmm0, (%rax)
movq -0x40(%rbp), %rcx
leal 0x1(%rcx), %eax
movq %r12, %r14
cmpl %r13d, %ecx
movq %rax, -0x40(%rbp)
movq %r13, %r12
jne 0x1c6d2
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq