// File: /workspace/github_c_makefile_star2_O1/PoulinV[P]AxiCLASS/build/../tools/arrays.c
// Function: array_interpolate_cubic_equal
int array_interpolate_cubic_equal(
				  double x0,
				  double dx,
				  double *yarray,
				  int Nx,
				  double x,
				  double * result,
				  ErrorMsg errmsg) {

  int i;
  double frac;

  class_test((dx > 0 && (x<x0 || x>x0+dx*(Nx-1))),
	     errmsg,
	     "x=%e out of range [%e %e]",x,x0,x0+dx*(Nx-1));

  class_test((dx < 0 && (x>x0 || x<x0+dx*(Nx-1))),
	     errmsg,
	     "x=%e out of range [%e %e]",x,x0+dx*(Nx-1),x0);

  i = (int)floor((x-x0)/dx);
  if (i<1) i=1;
  if (i>Nx-3) i=Nx-3;
  frac = (x-x0)/dx-i;
  yarray += i-1;

  *result=-yarray[0]*frac*(1.-frac)*(2.-frac)/6.
    +yarray[1]*(1.+frac)*(1.-frac)*(2.-frac)/2.
    +yarray[2]*(1.+frac)*frac*(2.-frac)/2.
    +yarray[3]*(1.+frac)*frac*(frac-1.)/6.;

  return _SUCCESS_;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x1018, %rsp           # imm = 0x1018
movq %rcx, %r14
movq %rdx, %rbx
movapd %xmm2, %xmm4
movl %esi, %r12d
movq %rdi, %r15
movapd %xmm1, %xmm2
movapd %xmm0, %xmm3
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
jbe 0x1aa26
ucomisd %xmm4, %xmm3
ja 0x1a9b7
leal -0x1(%r12), %eax
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
mulsd %xmm2, %xmm1
addsd %xmm3, %xmm1
ucomisd %xmm1, %xmm4
jbe 0x1aa26
decl %r12d
xorps %xmm0, %xmm0
cvtsi2sd %r12d, %xmm0
mulsd %xmm0, %xmm2
addsd %xmm3, %xmm2
leaq 0xd8b01(%rip), %rsi     # 0xf34d2
leaq 0x810(%rsp), %rbx
movq %rbx, %rdi
movapd %xmm4, %xmm0
movapd %xmm3, %xmm1
movb $0x3, %al
callq 0x30c2c
leaq 0xd6690(%rip), %rsi     # 0xf1082
leaq 0xd8af3(%rip), %rdx     # 0xf34ec
leaq 0x10(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0xd6622(%rip), %rsi     # 0xf1034
leaq 0xd8af8(%rip), %rdx     # 0xf3511
movq %r14, %rdi
movl $0xbde, %ecx            # imm = 0xBDE
jmp 0x1aac2
ucomisd %xmm2, %xmm0
jbe 0x1aad6
ucomisd %xmm3, %xmm4
ja 0x1aa54
leal -0x1(%r12), %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm3, %xmm0
ucomisd %xmm4, %xmm0
jbe 0x1aad6
decl %r12d
xorps %xmm0, %xmm0
cvtsi2sd %r12d, %xmm0
mulsd %xmm0, %xmm2
addsd %xmm3, %xmm2
leaq 0xd8a64(%rip), %rsi     # 0xf34d2
leaq 0x810(%rsp), %rbx
movq %rbx, %rdi
movapd %xmm4, %xmm0
movapd %xmm2, %xmm1
movapd %xmm3, %xmm2
movb $0x3, %al
callq 0x30c2c
leaq 0xd65ef(%rip), %rsi     # 0xf1082
leaq 0xd8a95(%rip), %rdx     # 0xf352f
leaq 0x10(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0xd6581(%rip), %rsi     # 0xf1034
leaq 0xd8a57(%rip), %rdx     # 0xf3511
movq %r14, %rdi
movl $0xbe2, %ecx            # imm = 0xBE2
movq %r15, %r8
xorl %eax, %eax
callq 0x30c2c
movl $0x1, %eax
jmp 0x1abc1
subsd %xmm3, %xmm4
divsd %xmm2, %xmm4
movsd %xmm4, 0x8(%rsp)
movapd %xmm4, %xmm0
callq 0x85e0
cvttsd2si %xmm0, %eax
cmpl $0x2, %eax
movl $0x1, %ecx
cmovgel %eax, %ecx
addl $-0x3, %r12d
cmpl %r12d, %ecx
cmovll %ecx, %r12d
xorps %xmm0, %xmm0
cvtsi2sd %r12d, %xmm0
movsd 0x8(%rsp), %xmm6
subsd %xmm0, %xmm6
movslq %r12d, %rax
movsd -0x8(%r15,%rax,8), %xmm2
mulsd %xmm6, %xmm2
movsd 0xd6731(%rip), %xmm0    # 0xf1260
movapd %xmm0, %xmm3
subsd %xmm6, %xmm3
mulsd %xmm3, %xmm2
movsd 0xd71bd(%rip), %xmm4    # 0xf1d00
subsd %xmm6, %xmm4
mulsd %xmm4, %xmm2
movsd 0xd7b1d(%rip), %xmm1    # 0xf2670
divsd %xmm1, %xmm2
addsd %xmm6, %xmm0
movsd (%r15,%rax,8), %xmm5
mulsd %xmm0, %xmm5
mulsd %xmm3, %xmm5
mulsd %xmm4, %xmm5
movsd 0xd715b(%rip), %xmm3    # 0xf1cd0
mulsd %xmm3, %xmm5
subsd %xmm2, %xmm5
movsd 0x8(%r15,%rax,8), %xmm2
mulsd %xmm0, %xmm2
mulsd %xmm6, %xmm2
mulsd %xmm4, %xmm2
mulsd %xmm3, %xmm2
addsd %xmm5, %xmm2
mulsd 0x10(%r15,%rax,8), %xmm0
movapd %xmm6, %xmm3
mulsd %xmm6, %xmm0
addsd 0xd6c39(%rip), %xmm3    # 0xf17e8
mulsd %xmm0, %xmm3
divsd %xmm1, %xmm3
addsd %xmm2, %xmm3
movsd %xmm3, (%rbx)
xorl %eax, %eax
addq $0x1018, %rsp           # imm = 0x1018
popq %rbx
popq %r12
popq %r14
popq %r15
retq