// File: /workspace/github_c_makefile_star2_O1/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 0x18ae4
ucomisd %xmm0, %xmm1
jbe 0x18b3c
leaq 0xda66c(%rip), %r15     # 0xf310f
leaq 0xda769(%rip), %r12     # 0xf3213
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 0x18bde
ucomisd %xmm0, %xmm2
jbe 0x18b91
leaq 0xda61a(%rip), %r15     # 0xf310f
leaq 0xda717(%rip), %r12     # 0xf3213
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 0x18bde
ucomisd %xmm2, %xmm0
jbe 0x18bf5
leaq 0xda5ef(%rip), %r15     # 0xf313c
leaq 0xda6bf(%rip), %r12     # 0xf3213
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 0x18bde
ucomisd %xmm1, %xmm0
jbe 0x18c38
leaq 0xda59a(%rip), %r15     # 0xf313c
leaq 0xda66a(%rip), %r12     # 0xf3213
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 0x18d14
cmpl $0x3, %esi
jl 0x18c77
xorl %edi, %edi
movsd 0xd90cc(%rip), %xmm2    # 0xf1cd0
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 0x18c04
jmp 0x18c79
cmpl $0x3, %esi
jl 0x18c77
xorl %edi, %edi
movsd 0xd9089(%rip), %xmm2    # 0xf1cd0
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 0x18c47
jmp 0x18c79
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 0xd85c4(%rip), %xmm2    # 0xf1260
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 0xd996a(%rip), %xmm4    # 0xf2670
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