// File: /workspace/github_cpp_makefile_star2_O1/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 -0x70(%rbp), %r13
movq %r13, %rdi
callq 0x533c
leaq -0x88(%rbp), %rdi
movl $0x6, %esi
movq %r14, %rdx
movq %r13, %rcx
callq 0x18048
movq 0x10(%rbp), %rbx
leaq -0x70(%rbp), %r14
movq %r14, %rdi
callq 0x5a80
movslq (%rbx), %r13
incq %r13
movq $0x0, (%r14)
leaq -0x58(%rbp), %r14
movq %r14, %rdi
callq 0x533c
leaq -0xb0(%rbp), %rdi
leaq -0x70(%rbp), %rdx
movq %r13, %rsi
movq %r14, %rcx
callq 0x18048
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 -0x70(%rbp), %rdi
leaq -0x58(%rbp), %rdx
movq %r13, %rsi
movq %r14, %rcx
callq 0x18048
leaq -0x29(%rbp), %rdi
callq 0x5a80
movl (%r15), %r15d
movq 0x10(%rbp), %rax
movl (%rax), %r13d
movslq %r13d, %rsi
movq %r12, %rdi
callq 0x1d21a
movl %r13d, %ecx
notl %ecx
addl %r15d, %ecx
movsd (%rax), %xmm0
movsd %xmm0, -0x38(%rbp)
movslq %ecx, %rsi
movq %r12, %rdi
callq 0x1d21a
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 0x1d21a
movsd (%rax), %xmm0
leal -0x1(%rbx), %r15d
ucomisd -0x38(%rbp), %xmm0
ja 0x1ce56
incq %r14
cmpl %ebx, %r13d
movl %r15d, %ebx
jne 0x1ce31
movq 0x10(%rbp), %rax
movl (%rax), %ecx
movl %r15d, %r8d
negl %r8d
leaq -0x88(%rbp), %r9
movq %r12, %rsi
movsd -0x38(%rbp), %xmm0
callq 0x1ca44
movq 0x10(%rbp), %rax
movl (%rax), %ebx
testl %ebx, %ebx
js 0x1cec8
xorl %r14d, %r14d
leaq -0x88(%rbp), %r12
leaq -0xb0(%rbp), %r13
movq %r12, %rdi
movq %r14, %rsi
callq 0x1d1be
movsd (%rax), %xmm0
movsd %xmm0, -0x38(%rbp)
movq %r13, %rdi
movq %r14, %rsi
callq 0x1d1be
movsd -0x38(%rbp), %xmm0
movsd %xmm0, (%rax)
movq 0x10(%rbp), %rax
movslq (%rax), %rax
incq %r14
cmpq %rax, %r14
jle 0x1ce91
movl %ebx, -0x50(%rbp)
movq 0x18(%rbp), %rbx
movslq (%rbx), %rsi
movq -0x40(%rbp), %rdi
callq 0x1d21a
movsd (%rax), %xmm0
movsd %xmm0, -0x38(%rbp)
movl (%rbx), %eax
notl %eax
movq -0x48(%rbp), %rcx
addl (%rcx), %eax
movslq %eax, %rsi
movq -0x40(%rbp), %rdi
callq 0x1d21a
movsd (%rax), %xmm0
movl (%rbx), %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
movq -0x40(%rbp), %rbx
movl %eax, %r13d
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1d21a
movsd (%rax), %xmm0
ucomisd -0x38(%rbp), %xmm0
ja 0x1cf55
movq 0x18(%rbp), %rax
movl (%rax), %ecx
notl %ecx
movq -0x48(%rbp), %rax
addl (%rax), %ecx
incq %r14
leal 0x1(%r13), %eax
cmpl %ecx, %eax
jne 0x1cf23
movq %rbx, %rsi
movq 0x18(%rbp), %rbx
movl (%rbx), %ecx
leal 0x1(%r13), %r8d
leaq -0x88(%rbp), %r9
movsd -0x38(%rbp), %xmm0
callq 0x1ca44
movl (%rbx), %eax
movl %eax, %ebx
movl %eax, -0x40(%rbp)
testl %eax, %eax
js 0x1cfc0
xorl %r14d, %r14d
leaq -0x70(%rbp), %r12
leaq -0x88(%rbp), %rdi
movq %r14, %rsi
callq 0x1d1be
movsd (%rax), %xmm0
movsd %xmm0, -0x38(%rbp)
movq %r12, %rdi
movq %r14, %rsi
callq 0x1d1be
movsd -0x38(%rbp), %xmm0
movsd %xmm0, (%rax)
movq 0x18(%rbp), %rax
movslq (%rax), %rbx
incq %r14
cmpq %rbx, %r14
jle 0x1cf85
notl %ebx
movq -0x48(%rbp), %rax
addl (%rax), %ebx
movq 0x10(%rbp), %rax
cmpl $0x0, (%rax)
js 0x1d016
xorl %r14d, %r14d
leaq -0x88(%rbp), %r12
leaq -0xb0(%rbp), %rdi
movq %r14, %rsi
callq 0x1d1be
movsd (%rax), %xmm0
movsd %xmm0, -0x38(%rbp)
movq %r12, %rdi
movq %r14, %rsi
callq 0x1d1be
movsd -0x38(%rbp), %xmm0
movsd %xmm0, (%rax)
movq 0x10(%rbp), %rax
movslq (%rax), %rax
incq %r14
cmpq %rax, %r14
jle 0x1cfdb
movq 0x10(%rbp), %rax
cmpl $0x0, (%rax)
js 0x1d0f5
notl %r15d
subl -0x50(%rbp), %r15d
imull %r15d, %ebx
subl -0x40(%rbp), %ebx
addl %r13d, %ebx
xorpd %xmm0, %xmm0
movl $0x1, %esi
leaq -0x70(%rbp), %r12
movq 0x18(%rbp), %rdx
movl (%rdx), %eax
testl %eax, %eax
js 0x1d0d2
movq %rsi, -0x90(%rbp)
leaq -0x1(%rsi), %r13
movslq %ebx, %r15
xorl %r14d, %r14d
movsd %xmm0, -0x38(%rbp)
leaq (%r15,%r14), %rsi
movq -0x98(%rbp), %rdi
callq 0x1d21a
movsd (%rax), %xmm0
movsd %xmm0, -0x40(%rbp)
leaq -0x88(%rbp), %rdi
movq %r13, %rsi
callq 0x1d1be
movsd (%rax), %xmm0
movsd %xmm0, -0x50(%rbp)
movq %r12, %rdi
movq %r14, %rsi
callq 0x1d1be
movsd -0x40(%rbp), %xmm1
mulsd -0x50(%rbp), %xmm1
mulsd (%rax), %xmm1
movsd -0x38(%rbp), %xmm0
addsd %xmm1, %xmm0
movq 0x18(%rbp), %rax
movslq (%rax), %rax
incq %r14
cmpq %rax, %r14
jle 0x1d060
movq 0x18(%rbp), %rdx
movq -0x90(%rbp), %rsi
notl %eax
addl %eax, %ebx
movq -0x48(%rbp), %rax
addl (%rax), %ebx
leaq 0x1(%rsi), %rax
movq 0x10(%rbp), %rcx
movslq (%rcx), %rcx
cmpq %rcx, %rsi
movq %rax, %rsi
jle 0x1d045
jmp 0x1d0f9
xorpd %xmm0, %xmm0
movsd %xmm0, -0x38(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x53c6
leaq -0xb0(%rbp), %rdi
callq 0x53c6
leaq -0x88(%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 0x1d170
jmp 0x1d170
movq %rax, %rbx
leaq -0x29(%rbp), %rdi
callq 0x5a80
jmp 0x1d17c
movq %rax, %rbx
leaq -0x58(%rbp), %rdi
callq 0x5a80
jmp 0x1d188
movq %rax, %rbx
leaq -0x70(%rbp), %rdi
callq 0x5a80
jmp 0x1d194
jmp 0x1d170
jmp 0x1d170
jmp 0x1d170
jmp 0x1d170
jmp 0x1d170
jmp 0x1d170
movq %rax, %rbx
leaq -0x70(%rbp), %rdi
callq 0x53c6
leaq -0xb0(%rbp), %rdi
callq 0x53c6
leaq -0x88(%rbp), %rdi
callq 0x53c6
movq %rbx, %rdi
callq 0x45a0