// File: /workspace/github_cpp_makefile_star2_O2/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 $0x48, %rsp
movl %r9d, -0x3c(%rbp)
movl %r8d, %ebx
movq %rdx, %rdi
movq %rsi, %r13
movl 0x18(%rbp), %r14d
movq 0x10(%rbp), %r12
movq %rcx, -0x38(%rbp)
leal (%rbx,%rcx), %eax
addl $-0x2, %eax
movslq %eax, %rsi
movq %rdx, -0x58(%rbp)
callq 0x1c9de
movsd (%rax), %xmm0
movsd %xmm0, -0x30(%rbp)
leal -0x1(%rbx), %eax
movslq %eax, %r15
movq %r13, %rdi
movq %r15, %rsi
callq 0x1ca00
movq %rax, %rdi
xorl %esi, %esi
callq 0x1c9de
movsd -0x30(%rbp), %xmm0
divsd (%rax), %xmm0
movsd %xmm0, -0x30(%rbp)
movq %rbx, -0x48(%rbp)
leal (%rbx,%r14), %eax
addl $-0x2, %eax
movslq %eax, %rsi
movq %r12, %rdi
callq 0x1c982
movsd -0x30(%rbp), %xmm0
movsd %xmm0, (%rax)
testl %r15d, %r15d
je 0x1c091
movq -0x38(%rbp), %rax
addl $-0x2, %eax
movq %rax, -0x38(%rbp)
movl 0x18(%rbp), %ecx
movl %ecx, %eax
addl $-0x2, %ecx
movq %rcx, -0x50(%rbp)
movq -0x48(%rbp), %rcx
leal (%rax,%rcx), %r14d
addl $-0x2, %r14d
pushq $0x2
popq %r12
cmpl -0x48(%rbp), %r12d
jg 0x1c091
movq -0x38(%rbp), %rax
addl %r15d, %eax
movslq %eax, %rsi
movq -0x58(%rbp), %rdi
callq 0x1c9de
movsd (%rax), %xmm0
movsd %xmm0, -0x30(%rbp)
movl -0x3c(%rbp), %eax
cmpl %eax, %r12d
movl %r12d, -0x40(%rbp)
cmovll %r12d, %eax
movq %r15, -0x60(%rbp)
decq %r15
movslq %eax, %r12
pushq $0x1
popq %rbx
cmpq %r12, %rbx
jge 0x1c040
leal (%r14,%rbx), %eax
decl %eax
movslq %eax, %rsi
movq 0x10(%rbp), %rdi
callq 0x1c982
movsd (%rax), %xmm0
movsd %xmm0, -0x68(%rbp)
movq %r13, %rdi
movq %r15, %rsi
callq 0x1ca00
movq %rax, %rdi
movq %rbx, %rsi
callq 0x1c9de
movsd -0x68(%rbp), %xmm1
mulsd (%rax), %xmm1
movsd -0x30(%rbp), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, -0x30(%rbp)
incq %rbx
jmp 0x1bfee
movq %r13, %rdi
movq %r15, %rsi
callq 0x1ca00
movq %rax, %rdi
xorl %esi, %esi
callq 0x1c9de
movsd -0x30(%rbp), %xmm0
divsd (%rax), %xmm0
movsd %xmm0, -0x30(%rbp)
movq -0x50(%rbp), %rax
movq -0x60(%rbp), %rcx
addl %ecx, %eax
movslq %eax, %rsi
movq 0x10(%rbp), %rdi
callq 0x1c982
movsd -0x30(%rbp), %xmm0
movsd %xmm0, (%rax)
movl -0x40(%rbp), %r12d
incl %r12d
decq %r14
jmp 0x1bfad
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq