// File: /workspace/github_c_makefile_star2_O2/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, %r15
movq %rdx, %rbx
movapd %xmm2, %xmm4
movl %esi, %r12d
movq %rdi, %r14
movapd %xmm0, %xmm3
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
jbe 0x18909
leal -0x1(%r12), %eax
ucomisd %xmm4, %xmm3
cvtsi2sd %eax, %xmm2
mulsd %xmm1, %xmm2
addsd %xmm3, %xmm2
ja 0x18a1f
ucomisd %xmm2, %xmm4
ja 0x18a1f
ucomisd %xmm1, %xmm0
jbe 0x18934
leal -0x1(%r12), %eax
ucomisd %xmm3, %xmm4
cvtsi2sd %eax, %xmm2
mulsd %xmm1, %xmm2
addsd %xmm3, %xmm2
ja 0x18a78
ucomisd %xmm4, %xmm2
ja 0x18a78
subsd %xmm3, %xmm4
divsd %xmm1, %xmm4
movsd %xmm4, 0x8(%rsp)
movapd %xmm4, %xmm0
callq 0x8610
cvttsd2si %xmm0, %eax
cmpl $0x2, %eax
pushq $0x1
popq %rcx
cmovgel %eax, %ecx
addl $-0x3, %r12d
cmpl %r12d, %ecx
cmovll %ecx, %r12d
cvtsi2sd %r12d, %xmm0
movsd 0x8(%rsp), %xmm6
subsd %xmm0, %xmm6
movslq %r12d, %rax
movsd -0x8(%r14,%rax,8), %xmm2
mulsd %xmm6, %xmm2
movsd 0xcc8d8(%rip), %xmm0    # 0xe5260
movapd %xmm0, %xmm3
subsd %xmm6, %xmm3
mulsd %xmm3, %xmm2
movsd 0xcd344(%rip), %xmm4    # 0xe5ce0
subsd %xmm6, %xmm4
mulsd %xmm4, %xmm2
movsd 0xcdca4(%rip), %xmm1    # 0xe6650
divsd %xmm1, %xmm2
addsd %xmm6, %xmm0
movsd (%r14,%rax,8), %xmm5
mulsd %xmm0, %xmm5
mulsd %xmm3, %xmm5
mulsd %xmm4, %xmm5
movsd 0xcd2e2(%rip), %xmm3    # 0xe5cb0
mulsd %xmm3, %xmm5
subsd %xmm2, %xmm5
movsd 0x8(%r14,%rax,8), %xmm2
mulsd %xmm0, %xmm2
mulsd %xmm6, %xmm2
mulsd %xmm4, %xmm2
mulsd %xmm3, %xmm2
addsd %xmm5, %xmm2
mulsd 0x10(%r14,%rax,8), %xmm0
movapd %xmm6, %xmm3
mulsd %xmm6, %xmm0
addsd 0xccde0(%rip), %xmm3    # 0xe57e8
mulsd %xmm0, %xmm3
divsd %xmm1, %xmm3
addsd %xmm2, %xmm3
movsd %xmm3, (%rbx)
xorl %eax, %eax
jmp 0x18ae0
leaq 0xcea7c(%rip), %rsi     # 0xe74a2
leaq 0x810(%rsp), %rbx
movq %rbx, %rdi
movapd %xmm4, %xmm0
movapd %xmm3, %xmm1
movb $0x3, %al
callq 0x2e014
leaq 0xcc63b(%rip), %rsi     # 0xe5082
leaq 0xcea6e(%rip), %rdx     # 0xe74bc
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0xcc5cd(%rip), %rsi     # 0xe5034
leaq 0xcea73(%rip), %rdx     # 0xe74e1
movq %r15, %rdi
movl $0xbde, %ecx            # imm = 0xBDE
jmp 0x18ad3
leaq 0xcea23(%rip), %rsi     # 0xe74a2
leaq 0x810(%rsp), %rbx
movq %rbx, %rdi
movapd %xmm4, %xmm0
movapd %xmm2, %xmm1
movapd %xmm3, %xmm2
movb $0x3, %al
callq 0x2e014
leaq 0xcc5de(%rip), %rsi     # 0xe5082
leaq 0xcea54(%rip), %rdx     # 0xe74ff
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0xcc570(%rip), %rsi     # 0xe5034
leaq 0xcea16(%rip), %rdx     # 0xe74e1
movq %r15, %rdi
movl $0xbe2, %ecx            # imm = 0xBE2
movq %r14, %r8
xorl %eax, %eax
callq 0x2e014
pushq $0x1
popq %rax
addq $0x1018, %rsp           # imm = 0x1018
popq %rbx
popq %r12
popq %r14
popq %r15
retq