// File: /workspace/github_cpp_makefile_star2_O3/TBody[P]atomicpp/atomicpp/Spline/BivariateBSpline.cpp
// Function: atomicpp::BivariateBSpline::fpbisp(std::vector<double, std::allocator<double>> const&, int const&, std::vector<double, std::allocator<double>> const&, int const&, std::vector<double, std::allocator<double>> const&, int const&, int const&, double const&, double const&)
double BivariateBSpline::fpbisp(const std::vector<double>& tx, const int& nx, const std::vector<double>& ty, const int& ny, const std::vector<double>& c, const int& kx, const int& ky, const double& x, const double& y){

  std::vector<double> h(6, 0.0);
  int lx = 0;
  int ly = 0;
  std::vector<double> wx(kx+1, 0.0);
  std::vector<double> wy(ky+1, 0.0);

  // int (kx+1) = kx+1;
  int nkx1 = nx-(kx+1);
  double tb = tx.at(kx);
  double te = tx.at(nkx1);
  int l = (kx+1);
  int l1 = l+1;

  double arg = x;
  if(arg < tb){
    arg = tb;
  }
  if(arg > te){
    arg = te;
  }

  while(not(arg < tx.at(l1-1) or l==nkx1)){
    l = l1;
    l1 = l+1;
  }
  fpbspl(tx,nx,kx,arg,l,h);
  lx = l-(kx+1);

  for(int j=1; j <= (kx+1); ++j){
    wx.at(j-1) = h.at(j-1);
  }

  tb = ty.at(ky);
  te = ty.at((ny-(ky+1)));
  l = (ky+1);
  l1 = l+1;

  arg = y;
  if(arg < tb){
    arg = tb;
  }
  if(arg > te){
    arg = te;
  }
  while(not(arg<ty.at(l1-1) or l==(ny-(ky+1)))){
    l = l1;
    l1 = l+1;
  }
  fpbspl(ty,ny,ky,arg,l,h);
  ly = l-(ky+1);

  for(int j=1; j<=(ky+1); ++j){
    wy.at(j-1) = h.at(j-1);
  }

  int m = 0;

  l = lx*(ny-(ky+1));
  for(int i1=1; i1<= (kx+1); ++i1){
    h.at(i1-1) = wx.at(i1-1);
  }
  l1 = l+ly;
  double sp = 0.;
  for(int i1=1; i1<= (kx+1); ++i1){
    int l2 = l1;
    for(int j1=1; j1<= (ky+1); ++j1){
      l2 = l2+1;
      sp = sp+c.at(l2-1)*h.at(i1-1)*wy.at(j1-1);
    }
    l1 = l1+(ny-(ky+1));
  }
  m = m+1;
  double z = sp;
  return z;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %r9, -0x98(%rbp)
movq %r8, -0x48(%rbp)
movq %rcx, -0x40(%rbp)
movq %rdx, %r15
movq %rsi, %r12
leaq -0xb0(%rbp), %r14
movq $0x0, (%r14)
leaq -0x78(%rbp), %r13
movq %r13, %rdi
callq 0x533c
leaq -0x90(%rbp), %rdi
movl $0x6, %esi
movq %r14, %rdx
movq %r13, %rcx
callq 0x1802a
movq 0x10(%rbp), %rbx
leaq -0x78(%rbp), %r14
movq %r14, %rdi
callq 0x5a80
movslq (%rbx), %r13
incq %r13
movq $0x0, (%r14)
leaq -0x60(%rbp), %r14
movq %r14, %rdi
callq 0x533c
leaq -0xb0(%rbp), %rdi
leaq -0x78(%rbp), %rdx
movq %r13, %rsi
movq %r14, %rcx
callq 0x1802a
movq 0x18(%rbp), %rbx
movq %r14, %rdi
callq 0x5a80
movslq (%rbx), %r13
incq %r13
movq $0x0, (%r14)
leaq -0x29(%rbp), %r14
movq %r14, %rdi
callq 0x533c
leaq -0x78(%rbp), %rdi
leaq -0x60(%rbp), %rdx
movq %r13, %rsi
movq %r14, %rcx
callq 0x1802a
leaq -0x29(%rbp), %rdi
callq 0x5a80
movl (%r15), %r15d
movq 0x10(%rbp), %rax
movl (%rax), %r13d
movslq %r13d, %rsi
movq %r12, %rdi
callq 0x1d15e
movl %r13d, %ecx
notl %ecx
addl %r15d, %ecx
movsd (%rax), %xmm0
movsd %xmm0, -0x38(%rbp)
movslq %ecx, %rsi
movq %r12, %rdi
callq 0x1d15e
movq 0x20(%rbp), %rcx
movsd (%rax), %xmm0
movq 0x10(%rbp), %rax
movl (%rax), %ebx
leal 0x2(%rbx), %eax
movsd -0x38(%rbp), %xmm1
maxsd (%rcx), %xmm1
minsd %xmm1, %xmm0
movsd %xmm0, -0x38(%rbp)
movslq %eax, %r14
negl %ebx
decq %r14
subl %r15d, %r13d
addl $0x2, %r13d
movq %r12, %rdi
movq %r14, %rsi
callq 0x1d15e
movsd (%rax), %xmm0
leal -0x1(%rbx), %r15d
ucomisd -0x38(%rbp), %xmm0
ja 0x1cd9a
incq %r14
cmpl %ebx, %r13d
movl %r15d, %ebx
jne 0x1cd75
movq 0x10(%rbp), %rax
movl (%rax), %ecx
movl %r15d, %r8d
negl %r8d
leaq -0x90(%rbp), %r9
movq %r12, %rsi
movsd -0x38(%rbp), %xmm0
callq 0x1c988
movq 0x10(%rbp), %rax
movl (%rax), %ebx
testl %ebx, %ebx
js 0x1ce0c
xorl %r14d, %r14d
leaq -0x90(%rbp), %r12
leaq -0xb0(%rbp), %r13
movq %r12, %rdi
movq %r14, %rsi
callq 0x1d102
movsd (%rax), %xmm0
movsd %xmm0, -0x38(%rbp)
movq %r13, %rdi
movq %r14, %rsi
callq 0x1d102
movsd -0x38(%rbp), %xmm0
movsd %xmm0, (%rax)
movq 0x10(%rbp), %rax
movslq (%rax), %rax
incq %r14
cmpq %rax, %r14
jle 0x1cdd5
movq 0x18(%rbp), %rax
movslq (%rax), %rsi
movq -0x40(%rbp), %rdi
callq 0x1d15e
movsd (%rax), %xmm0
movsd %xmm0, -0x38(%rbp)
movq 0x18(%rbp), %rax
movl (%rax), %eax
notl %eax
movq -0x48(%rbp), %rcx
addl (%rcx), %eax
movslq %eax, %rsi
movq -0x40(%rbp), %rdi
callq 0x1d15e
movsd (%rax), %xmm0
movq 0x18(%rbp), %rax
movl (%rax), %eax
movq 0x28(%rbp), %rcx
movsd -0x38(%rbp), %xmm1
maxsd (%rcx), %xmm1
leal 0x2(%rax), %ecx
minsd %xmm1, %xmm0
movsd %xmm0, -0x38(%rbp)
movslq %ecx, %r14
decq %r14
movl %eax, %r13d
movq -0x40(%rbp), %rdi
movq %r14, %rsi
callq 0x1d15e
movsd (%rax), %xmm0
ucomisd -0x38(%rbp), %xmm0
movq 0x18(%rbp), %rax
movl (%rax), %ecx
ja 0x1ce9d
movl %ecx, %edx
notl %edx
movq -0x48(%rbp), %rax
addl (%rax), %edx
incq %r14
leal 0x1(%r13), %eax
cmpl %edx, %eax
jne 0x1ce68
leal 0x1(%r13), %r8d
leaq -0x90(%rbp), %r9
movq -0x40(%rbp), %rsi
movsd -0x38(%rbp), %xmm0
callq 0x1c988
movl %ebx, -0x58(%rbp)
movq 0x18(%rbp), %rax
movl (%rax), %eax
testl %eax, %eax
movl %eax, -0x50(%rbp)
js 0x1cf0a
xorl %r14d, %r14d
leaq -0x78(%rbp), %r12
leaq -0x90(%rbp), %rdi
movq %r14, %rsi
callq 0x1d102
movsd (%rax), %xmm0
movsd %xmm0, -0x38(%rbp)
movq %r12, %rdi
movq %r14, %rsi
callq 0x1d102
movsd -0x38(%rbp), %xmm0
movsd %xmm0, (%rax)
movq 0x18(%rbp), %rax
movslq (%rax), %rbx
incq %r14
cmpq %rbx, %r14
jle 0x1cecd
jmp 0x1cf0c
movl %eax, %ebx
notl %ebx
xorpd %xmm0, %xmm0
movsd %xmm0, -0x38(%rbp)
movq 0x10(%rbp), %rax
cmpl $0x0, (%rax)
js 0x1d042
movq -0x48(%rbp), %rax
addl (%rax), %ebx
xorl %r14d, %r14d
leaq -0x90(%rbp), %r12
leaq -0xb0(%rbp), %rdi
movq %r14, %rsi
callq 0x1d102
movsd (%rax), %xmm0
movsd %xmm0, -0x40(%rbp)
movq %r12, %rdi
movq %r14, %rsi
callq 0x1d102
movsd -0x40(%rbp), %xmm0
movsd %xmm0, (%rax)
movq 0x10(%rbp), %rax
movslq (%rax), %rax
incq %r14
cmpq %rax, %r14
jle 0x1cf34
testl %eax, %eax
js 0x1d042
notl %r15d
subl -0x58(%rbp), %r15d
imull %r15d, %ebx
subl -0x50(%rbp), %ebx
addl %r13d, %ebx
movq 0x18(%rbp), %rcx
movl (%rcx), %ecx
xorpd %xmm0, %xmm0
movsd %xmm0, -0x38(%rbp)
movl $0x1, %edi
leaq -0x78(%rbp), %r12
testl %ecx, %ecx
js 0x1d023
movq %rdi, -0x50(%rbp)
leaq -0x1(%rdi), %r13
movslq %ebx, %r15
xorl %r14d, %r14d
leaq (%r15,%r14), %rsi
movq -0x98(%rbp), %rdi
callq 0x1d15e
movsd (%rax), %xmm0
movsd %xmm0, -0x40(%rbp)
leaq -0x90(%rbp), %rdi
movq %r13, %rsi
callq 0x1d102
movsd (%rax), %xmm0
movsd %xmm0, -0x58(%rbp)
movq %r12, %rdi
movq %r14, %rsi
callq 0x1d102
movsd -0x40(%rbp), %xmm1
mulsd -0x58(%rbp), %xmm1
mulsd (%rax), %xmm1
movsd -0x38(%rbp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x38(%rbp)
movq 0x18(%rbp), %rax
movslq (%rax), %rcx
incq %r14
cmpq %rcx, %r14
jle 0x1cfb2
movq 0x10(%rbp), %rax
movl (%rax), %eax
movq -0x50(%rbp), %rdi
movl %ecx, %edx
notl %edx
addl %edx, %ebx
movq -0x48(%rbp), %rdx
addl (%rdx), %ebx
leaq 0x1(%rdi), %rdx
movslq %eax, %rsi
cmpq %rsi, %rdi
movq %rdx, %rdi
jle 0x1cfa0
leaq -0x78(%rbp), %rdi
callq 0x53c6
leaq -0xb0(%rbp), %rdi
callq 0x53c6
leaq -0x90(%rbp), %rdi
callq 0x53c6
movsd -0x38(%rbp), %xmm0
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1d0b4
jmp 0x1d0b4
movq %rax, %rbx
leaq -0x29(%rbp), %rdi
callq 0x5a80
jmp 0x1d0c0
movq %rax, %rbx
leaq -0x60(%rbp), %rdi
callq 0x5a80
jmp 0x1d0cc
movq %rax, %rbx
leaq -0x78(%rbp), %rdi
callq 0x5a80
jmp 0x1d0d8
jmp 0x1d0b4
jmp 0x1d0b4
jmp 0x1d0b4
jmp 0x1d0b4
jmp 0x1d0b4
jmp 0x1d0b4
movq %rax, %rbx
leaq -0x78(%rbp), %rdi
callq 0x53c6
leaq -0xb0(%rbp), %rdi
callq 0x53c6
leaq -0x90(%rbp), %rdi
callq 0x53c6
movq %rbx, %rdi
callq 0x45a0