// File: /workspace/github_cpp_makefile_star2_O2/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 $0x98, %rsp
movq %r9, -0xa0(%rbp)
movq %r8, -0x50(%rbp)
movq %rcx, %r15
movq %rdx, -0x38(%rbp)
movq %rsi, %r12
leaq -0xb8(%rbp), %r14
andq $0x0, (%r14)
leaq -0x78(%rbp), %r13
movq %r13, %rdi
callq 0x531c
leaq -0x90(%rbp), %rdi
pushq $0x6
popq %rsi
movq %r14, %rdx
movq %r13, %rcx
callq 0x17a40
movq 0x10(%rbp), %rbx
leaq -0x78(%rbp), %r14
movq %r14, %rdi
callq 0x5a64
movslq (%rbx), %r13
incq %r13
andq $0x0, (%r14)
leaq -0x60(%rbp), %r14
movq %r14, %rdi
callq 0x531c
leaq -0xb8(%rbp), %rdi
leaq -0x78(%rbp), %rdx
movq %r13, %rsi
movq %r14, %rcx
callq 0x17a40
movq 0x18(%rbp), %rbx
movq %r14, %rdi
callq 0x5a64
movslq (%rbx), %r13
incq %r13
andq $0x0, (%r14)
leaq -0x29(%rbp), %r14
movq %r14, %rdi
callq 0x531c
leaq -0x78(%rbp), %rdi
leaq -0x60(%rbp), %rdx
movq %r13, %rsi
movq %r14, %rcx
callq 0x17a40
leaq -0x29(%rbp), %rdi
callq 0x5a64
movq -0x38(%rbp), %rax
movl (%rax), %ebx
movq 0x10(%rbp), %rax
movl (%rax), %r13d
movslq %r13d, %rsi
movq %r12, %rdi
callq 0x1c9de
movl %r13d, %ecx
notl %ecx
movl %ebx, -0x48(%rbp)
addl %ebx, %ecx
movsd (%rax), %xmm0
movsd %xmm0, -0x38(%rbp)
movslq %ecx, %rsi
movq %r12, %rdi
callq 0x1c9de
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 -0x48(%rbp), %r13d
addl $0x2, %r13d
movq %r12, %rdi
movq %r14, %rsi
callq 0x1c9de
movsd (%rax), %xmm0
leal -0x1(%rbx), %r8d
ucomisd -0x38(%rbp), %xmm0
ja 0x1c60d
incq %r14
cmpl %ebx, %r13d
movl %r8d, %ebx
jne 0x1c5e8
movq 0x10(%rbp), %rax
movl (%rax), %ecx
movl %r8d, -0x3c(%rbp)
negl %r8d
leaq -0x90(%rbp), %r9
movq %r12, %rsi
movsd -0x38(%rbp), %xmm0
callq 0x1c206
movq 0x10(%rbp), %rax
movl (%rax), %ebx
pushq $0x1
popq %r14
leaq -0x90(%rbp), %r12
leaq -0xb8(%rbp), %r13
movl %ebx, %eax
incl %eax
cltq
cmpq %rax, %r14
jg 0x1c688
decq %r14
movq %r12, %rdi
movq %r14, %rsi
callq 0x1c982
movsd (%rax), %xmm0
movsd %xmm0, -0x38(%rbp)
movq %r13, %rdi
movq %r14, %rsi
callq 0x1c982
movsd -0x38(%rbp), %xmm0
movsd %xmm0, (%rax)
movq 0x10(%rbp), %rax
movl (%rax), %eax
addq $0x2, %r14
jmp 0x1c648
movq 0x18(%rbp), %rax
movslq (%rax), %rsi
movq %r15, %rdi
callq 0x1c9de
movsd (%rax), %xmm0
movsd %xmm0, -0x38(%rbp)
movq 0x18(%rbp), %rax
movl (%rax), %eax
notl %eax
movq -0x50(%rbp), %rcx
addl (%rcx), %eax
movslq %eax, %rsi
movq %r15, %rdi
callq 0x1c9de
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 %r15, %rdi
movq %r14, %rsi
callq 0x1c9de
movsd (%rax), %xmm0
ucomisd -0x38(%rbp), %xmm0
movq 0x18(%rbp), %rax
movl (%rax), %ecx
ja 0x1c716
movl %ecx, %edx
notl %edx
movq -0x50(%rbp), %rax
addl (%rax), %edx
incq %r14
leal 0x1(%r13), %eax
cmpl %edx, %eax
jne 0x1c6e2
leal 0x1(%r13), %r8d
leaq -0x90(%rbp), %r9
movq %r15, %rsi
movsd -0x38(%rbp), %xmm0
callq 0x1c206
movq 0x18(%rbp), %rax
movl (%rax), %eax
pushq $0x1
popq %r14
leaq -0x90(%rbp), %r15
leaq -0x78(%rbp), %r12
movl %eax, -0x48(%rbp)
incl %eax
movslq %eax, %rcx
cmpq %rcx, %r14
jg 0x1c787
decq %r14
movq %r15, %rdi
movq %r14, %rsi
callq 0x1c982
movsd (%rax), %xmm0
movsd %xmm0, -0x38(%rbp)
movq %r12, %rdi
movq %r14, %rsi
callq 0x1c982
movsd -0x38(%rbp), %xmm0
movsd %xmm0, (%rax)
movq 0x18(%rbp), %rax
movl (%rax), %eax
addq $0x2, %r14
jmp 0x1c746
movl %ebx, -0x58(%rbp)
movq -0x50(%rbp), %rcx
movl (%rcx), %ebx
subl %eax, %ebx
pushq $0x1
popq %r14
leaq -0xb8(%rbp), %r15
leaq -0x90(%rbp), %r12
movq 0x10(%rbp), %rax
movslq (%rax), %rax
leaq 0x1(%rax), %rcx
cmpq %rcx, %r14
jg 0x1c7e5
decq %r14
movq %r15, %rdi
movq %r14, %rsi
callq 0x1c982
movsd (%rax), %xmm0
movsd %xmm0, -0x38(%rbp)
movq %r12, %rdi
movq %r14, %rsi
callq 0x1c982
movsd -0x38(%rbp), %xmm0
movsd %xmm0, (%rax)
addq $0x2, %r14
jmp 0x1c7a4
movl -0x3c(%rbp), %ecx
notl %ecx
subl -0x58(%rbp), %ecx
imull %ebx, %ecx
subl -0x48(%rbp), %ecx
addl %r13d, %ecx
xorpd %xmm0, %xmm0
pushq $0x1
popq %rdx
leaq -0x90(%rbp), %r15
leaq -0x78(%rbp), %r12
incl %eax
cltq
cmpq %rax, %rdx
jg 0x1c8bc
movq %rdx, -0x98(%rbp)
leaq -0x1(%rdx), %r13
movl %ecx, -0x3c(%rbp)
movslq %ecx, %rbx
pushq $0x1
popq %r14
movq 0x18(%rbp), %rax
movslq (%rax), %rax
leaq 0x1(%rax), %rcx
cmpq %rcx, %r14
jg 0x1c89a
movsd %xmm0, -0x38(%rbp)
leaq (%rbx,%r14), %rsi
decq %rsi
movq -0xa0(%rbp), %rdi
callq 0x1c9de
movsd (%rax), %xmm0
movsd %xmm0, -0x48(%rbp)
movq %r15, %rdi
movq %r13, %rsi
callq 0x1c982
movsd (%rax), %xmm0
movsd %xmm0, -0x58(%rbp)
decq %r14
movq %r12, %rdi
movq %r14, %rsi
callq 0x1c982
movsd -0x48(%rbp), %xmm1
mulsd -0x58(%rbp), %xmm1
mulsd (%rax), %xmm1
movsd -0x38(%rbp), %xmm0
addsd %xmm1, %xmm0
addq $0x2, %r14
jmp 0x1c82a
notl %eax
movl -0x3c(%rbp), %ecx
addl %eax, %ecx
movq -0x50(%rbp), %rax
addl (%rax), %ecx
movq -0x98(%rbp), %rdx
incq %rdx
movq 0x10(%rbp), %rax
movl (%rax), %eax
jmp 0x1c808
leaq -0x78(%rbp), %rdi
movsd %xmm0, -0x38(%rbp)
callq 0x53a6
leaq -0xb8(%rbp), %rdi
callq 0x53a6
leaq -0x90(%rbp), %rdi
callq 0x53a6
movsd -0x38(%rbp), %xmm0
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1c933
jmp 0x1c933
movq %rax, %rbx
leaq -0x29(%rbp), %rdi
callq 0x5a64
jmp 0x1c93f
movq %rax, %rbx
leaq -0x60(%rbp), %rdi
callq 0x5a64
jmp 0x1c94b
movq %rax, %rbx
leaq -0x78(%rbp), %rdi
callq 0x5a64
jmp 0x1c957
jmp 0x1c933
jmp 0x1c933
jmp 0x1c933
jmp 0x1c933
jmp 0x1c933
jmp 0x1c933
movq %rax, %rbx
leaq -0x78(%rbp), %rdi
callq 0x53a6
leaq -0xb8(%rbp), %rdi
callq 0x53a6
leaq -0x90(%rbp), %rdi
callq 0x53a6
movq %rbx, %rdi
callq 0x45a0
nop