// File: /workspace/github_cpp_makefile_star2_O1/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, %ebx
movl %r8d, %r14d
movq %rdx, %rdi
movq %rsi, %r12
movl 0x18(%rbp), %r15d
movq 0x10(%rbp), %r13
movq %rcx, -0x40(%rbp)
leal (%r14,%rcx), %eax
addl $-0x2, %eax
movslq %eax, %rsi
movq %rdx, -0x60(%rbp)
callq 0x1d21a
movsd (%rax), %xmm0
movsd %xmm0, -0x30(%rbp)
leal -0x1(%r14), %eax
movslq %eax, %rsi
movq %r12, %rdi
callq 0x1d23c
movq %rax, %rdi
xorl %esi, %esi
callq 0x1d21a
movsd -0x30(%rbp), %xmm0
divsd (%rax), %xmm0
movsd %xmm0, -0x30(%rbp)
leal (%r14,%r15), %eax
addl $-0x2, %eax
movslq %eax, %rsi
movq %r13, %rdi
callq 0x1d1be
movsd -0x30(%rbp), %xmm0
movsd %xmm0, (%rax)
movq %r14, -0x50(%rbp)
cmpl $0x2, %r14d
jl 0x1c8a7
movq -0x40(%rbp), %rax
addl $-0x2, %eax
movq %rax, -0x40(%rbp)
movq -0x50(%rbp), %rcx
movl %ecx, %r15d
decq %r15
movl 0x18(%rbp), %edx
movl %edx, %eax
addl $-0x2, %edx
movq %rdx, -0x58(%rbp)
addl %ecx, %eax
addl $-0x2, %eax
movl %eax, -0x34(%rbp)
movl $0x2, %r14d
movl %ebx, -0x44(%rbp)
movq -0x40(%rbp), %rax
addl %r15d, %eax
movslq %eax, %rsi
movq -0x60(%rbp), %rdi
callq 0x1d21a
movsd (%rax), %xmm0
cmpl $0x2, %ebx
movq %r14, -0x70(%rbp)
movq %r15, -0x68(%rbp)
movsd %xmm0, -0x30(%rbp)
jl 0x1c847
cmpl %ebx, %r14d
cmovll %r14d, %ebx
decq %r15
movslq %ebx, %r13
movl $0x1, %r14d
movl -0x34(%rbp), %eax
movl %eax, %ebx
movslq %ebx, %rbx
movq 0x10(%rbp), %rdi
movq %rbx, %rsi
callq 0x1d1be
movsd (%rax), %xmm0
movsd %xmm0, -0x78(%rbp)
movq %r12, %rdi
movq %r15, %rsi
callq 0x1d23c
movq %rax, %rdi
movq %r14, %rsi
callq 0x1d21a
movsd -0x78(%rbp), %xmm1
mulsd (%rax), %xmm1
movsd -0x30(%rbp), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, -0x30(%rbp)
incq %r14
incl %ebx
cmpq %r13, %r14
jl 0x1c7f8
movq -0x68(%rbp), %r14
leaq -0x1(%r14), %rbx
movq %r12, %rdi
movq %rbx, %rsi
callq 0x1d23c
movq %rax, %rdi
xorl %esi, %esi
callq 0x1d21a
movsd -0x30(%rbp), %xmm0
divsd (%rax), %xmm0
movsd %xmm0, -0x30(%rbp)
addl -0x58(%rbp), %r14d
movslq %r14d, %rsi
movq 0x10(%rbp), %rdi
callq 0x1d1be
movsd -0x30(%rbp), %xmm0
movsd %xmm0, (%rax)
movq -0x70(%rbp), %rcx
leal 0x1(%rcx), %eax
decl -0x34(%rbp)
movq %rbx, %r15
cmpl -0x50(%rbp), %ecx
movl %eax, %r14d
movl -0x44(%rbp), %ebx
jne 0x1c7b7
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq