// File: /workspace/github_c_makefile_star2_O3/PoulinV[P]AxiCLASS/build/../tools/arrays.c
// Function: array_interpolate_spline_one_column
int array_interpolate_spline_one_column(
					double * x_array,
					int x_size,
					double * y_array, /* array of size x_size*y_size with elements
							   y_array[index_y*x_size+index_x] */
					int y_size,
					int index_y,
					double * ddy_array, /* array of size x_size*y_size */
					double x,   /* input */
					double * y, /* output */
					ErrorMsg errmsg
					) {


  int inf,sup,mid;
  double h,a,b;

  inf=0;
  sup=x_size-1;

  if (x_array[inf] < x_array[sup]){

    if (x < x_array[inf]) {
      class_sprintf(errmsg,"%s(L:%d) : x=%e < x_min=%e",__func__,__LINE__,x,x_array[inf]);
      return _FAILURE_;
    }

    if (x > x_array[sup]) {
      class_sprintf(errmsg,"%s(L:%d) : x=%e > x_max=%e",__func__,__LINE__,x,x_array[sup]);
      return _FAILURE_;
    }

    while (sup-inf > 1) {

      mid=(int)(0.5*(inf+sup));
      if (x < x_array[mid]) {sup=mid;}
      else {inf=mid;}

    }

  }

  else {

    if (x < x_array[sup]) {
      class_sprintf(errmsg,"%s(L:%d) : x=%e < x_min=%e",__func__,__LINE__,x,x_array[sup]);
      return _FAILURE_;
    }

    if (x > x_array[inf]) {
      class_sprintf(errmsg,"%s(L:%d) : x=%e > x_max=%e",__func__,__LINE__,x,x_array[inf]);
      return _FAILURE_;
    }

    while (sup-inf > 1) {

      mid=(int)(0.5*(inf+sup));
      if (x > x_array[mid]) {sup=mid;}
      else {inf=mid;}

    }

  }

  h = x_array[sup] - x_array[inf];
  b = (x-x_array[inf])/h;
  a = 1-b;

  *y =
    a * y_array[index_y * x_size + inf] +
    b * y_array[index_y * x_size + sup] +
    ((a*a*a-a)* ddy_array[index_y * x_size + inf] +
     (b*b*b-b)* ddy_array[index_y * x_size + sup])*h*h/6.;

  return _SUCCESS_;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movq 0x48(%rsp), %r14
leal -0x1(%rsi), %eax
movslq %esi, %r13
movsd (%rdi), %xmm1
movsd -0x8(%rdi,%r13,8), %xmm2
decq %r13
ucomisd %xmm1, %xmm2
jbe 0x18c6f
ucomisd %xmm0, %xmm1
jbe 0x18cc7
leaq 0xd74f1(%rip), %r15     # 0xf011f
leaq 0xd75ee(%rip), %r12     # 0xf0223
xorl %edi, %edi
xorl %esi, %esi
movq %r15, %rdx
movq %r12, %rcx
movl $0x85b, %r8d            # imm = 0x85B
movb $0x2, %al
movsd %xmm0, 0x8(%rsp)
callq 0x8550
incl %eax
movslq %eax, %rsi
movsd (%rbx), %xmm1
movq %r14, %rdi
movq %r15, %rdx
movq %r12, %rcx
movl $0x85b, %r8d            # imm = 0x85B
jmp 0x18d69
ucomisd %xmm0, %xmm2
jbe 0x18d1c
leaq 0xd749f(%rip), %r15     # 0xf011f
leaq 0xd759c(%rip), %r12     # 0xf0223
xorl %edi, %edi
xorl %esi, %esi
movq %r15, %rdx
movq %r12, %rcx
movl $0x871, %r8d            # imm = 0x871
movapd %xmm2, %xmm1
movb $0x2, %al
movsd %xmm0, 0x8(%rsp)
callq 0x8550
incl %eax
movslq %eax, %rsi
movsd (%rbx,%r13,8), %xmm1
movq %r14, %rdi
movq %r15, %rdx
movq %r12, %rcx
movl $0x871, %r8d            # imm = 0x871
jmp 0x18d69
ucomisd %xmm2, %xmm0
jbe 0x18d80
leaq 0xd7474(%rip), %r15     # 0xf014c
leaq 0xd7544(%rip), %r12     # 0xf0223
xorl %edi, %edi
xorl %esi, %esi
movq %r15, %rdx
movq %r12, %rcx
movl $0x860, %r8d            # imm = 0x860
movapd %xmm2, %xmm1
movb $0x2, %al
movsd %xmm0, 0x8(%rsp)
callq 0x8550
incl %eax
movslq %eax, %rsi
movsd (%rbx,%r13,8), %xmm1
movq %r14, %rdi
movq %r15, %rdx
movq %r12, %rcx
movl $0x860, %r8d            # imm = 0x860
jmp 0x18d69
ucomisd %xmm1, %xmm0
jbe 0x18dc3
leaq 0xd741f(%rip), %r15     # 0xf014c
leaq 0xd74ef(%rip), %r12     # 0xf0223
xorl %edi, %edi
xorl %esi, %esi
movq %r15, %rdx
movq %r12, %rcx
movl $0x876, %r8d            # imm = 0x876
movb $0x2, %al
movsd %xmm0, 0x8(%rsp)
callq 0x8550
incl %eax
movslq %eax, %rsi
movsd (%rbx), %xmm1
movq %r14, %rdi
movq %r15, %rdx
movq %r12, %rcx
movl $0x876, %r8d            # imm = 0x876
movsd 0x8(%rsp), %xmm0
movb $0x2, %al
callq 0x8550
movl $0x1, %eax
jmp 0x18e9f
cmpl $0x3, %esi
jl 0x18e02
xorl %edi, %edi
movsd 0xd5f41(%rip), %xmm2    # 0xeecd0
leal (%rdi,%rax), %ecx
xorps %xmm1, %xmm1
cvtsi2sd %ecx, %xmm1
mulsd %xmm2, %xmm1
cvttsd2si %xmm1, %ecx
movslq %ecx, %rcx
movsd (%rbx,%rcx,8), %xmm1
ucomisd %xmm0, %xmm1
cmoval %ecx, %eax
cmoval %edi, %ecx
movl %eax, %r10d
subl %ecx, %r10d
movl %ecx, %edi
cmpl $0x1, %r10d
jg 0x18d8f
jmp 0x18e04
cmpl $0x3, %esi
jl 0x18e02
xorl %edi, %edi
movsd 0xd5efe(%rip), %xmm2    # 0xeecd0
leal (%rdi,%rax), %ecx
xorps %xmm1, %xmm1
cvtsi2sd %ecx, %xmm1
mulsd %xmm2, %xmm1
cvttsd2si %xmm1, %ecx
movslq %ecx, %rcx
ucomisd (%rbx,%rcx,8), %xmm0
cmoval %ecx, %eax
cmoval %edi, %ecx
movl %eax, %r10d
subl %ecx, %r10d
movl %ecx, %edi
cmpl $0x1, %r10d
jg 0x18dd2
jmp 0x18e04
xorl %ecx, %ecx
cltq
movsd (%rbx,%rax,8), %xmm5
movslq %ecx, %rcx
movsd (%rbx,%rcx,8), %xmm1
subsd %xmm1, %xmm5
subsd %xmm1, %xmm0
divsd %xmm5, %xmm0
movsd 0xd5439(%rip), %xmm2    # 0xee260
subsd %xmm0, %xmm2
imull %esi, %r8d
addl %r8d, %ecx
movslq %ecx, %rcx
addl %r8d, %eax
cltq
movsd (%rdx,%rax,8), %xmm1
mulsd %xmm0, %xmm1
movsd (%rdx,%rcx,8), %xmm3
mulsd %xmm2, %xmm3
movapd %xmm2, %xmm4
mulsd %xmm2, %xmm4
mulsd %xmm2, %xmm4
subsd %xmm2, %xmm4
movapd %xmm0, %xmm2
mulsd %xmm0, %xmm2
mulsd %xmm0, %xmm2
subsd %xmm0, %xmm2
mulsd (%r9,%rax,8), %xmm2
movq 0x40(%rsp), %rax
mulsd (%r9,%rcx,8), %xmm4
addsd %xmm2, %xmm4
mulsd %xmm5, %xmm4
mulsd %xmm5, %xmm4
divsd 0xd67df(%rip), %xmm4    # 0xef670
addsd %xmm1, %xmm3
addsd %xmm3, %xmm4
movsd %xmm4, (%rax)
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq