// File: /workspace/github_c_makefile_star2_O0/PoulinV[P]AxiCLASS/build/../tools/arrays.c
// Function: array_interpolate_spline
int array_interpolate_spline(
                             double * __restrict__ x_array,
                             int n_lines,
                             double * __restrict__ array,
                             double * __restrict__ array_splined,
                             int n_columns,
                             double x,
                             int * __restrict__ last_index,
                             double * __restrict__ result,
                             int result_size, /** from 1 to n_columns */
                             ErrorMsg errmsg) {

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

  inf=0;
  sup=n_lines-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;}

    }

  }

  *last_index = inf;

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

  for (i=0; i<result_size; i++)
    *(result+i) =
      a * *(array+inf*n_columns+i) +
      b * *(array+sup*n_columns+i) +
      ((a*a*a-a)* *(array_splined+inf*n_columns+i) +
       (b*b*b-b)* *(array_splined+sup*n_columns+i))*h*h/6.;

  return _SUCCESS_;
}

// Assembly:
subq $0x78, %rsp
movq 0x90(%rsp), %rax
movl 0x88(%rsp), %eax
movq 0x80(%rsp), %rax
movq %rdi, 0x68(%rsp)
movl %esi, 0x64(%rsp)
movq %rdx, 0x58(%rsp)
movq %rcx, 0x50(%rsp)
movl %r8d, 0x4c(%rsp)
movsd %xmm0, 0x40(%rsp)
movq %r9, 0x38(%rsp)
movl $0x0, 0x34(%rsp)
movl 0x64(%rsp), %eax
subl $0x1, %eax
movl %eax, 0x30(%rsp)
movq 0x68(%rsp), %rax
movslq 0x34(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
movq 0x68(%rsp), %rax
movslq 0x30(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x2444e
movsd 0x40(%rsp), %xmm1
movq 0x68(%rsp), %rax
movslq 0x34(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x24344
jmp 0x242ba
movsd 0x40(%rsp), %xmm0
movq 0x68(%rsp), %rax
movslq 0x34(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
xorl %eax, %eax
movl %eax, %esi
leaq 0x1afe2c(%rip), %rdx    # 0x1d4106
leaq 0x1afe91(%rip), %rcx    # 0x1d4172
movl $0x720, %r8d            # imm = 0x720
movq %rsi, %rdi
movb $0x2, %al
callq 0x8540
movl %eax, 0xc(%rsp)
movq 0x90(%rsp), %rdi
movl 0xc(%rsp), %eax
addl $0x1, %eax
movslq %eax, %rsi
movsd 0x40(%rsp), %xmm0
movq 0x68(%rsp), %rax
movslq 0x34(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
leaq 0x1afde3(%rip), %rdx    # 0x1d4106
leaq 0x1afe48(%rip), %rcx    # 0x1d4172
movl $0x720, %r8d            # imm = 0x720
movb $0x2, %al
callq 0x8540
movl $0x1, 0x74(%rsp)
jmp 0x247cf
movsd 0x40(%rsp), %xmm0
movq 0x68(%rsp), %rax
movslq 0x30(%rsp), %rcx
ucomisd (%rax,%rcx,8), %xmm0
jbe 0x243eb
jmp 0x24361
movsd 0x40(%rsp), %xmm0
movq 0x68(%rsp), %rax
movslq 0x30(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
xorl %eax, %eax
movl %eax, %esi
leaq 0x1afdb2(%rip), %rdx    # 0x1d4133
leaq 0x1afdea(%rip), %rcx    # 0x1d4172
movl $0x725, %r8d            # imm = 0x725
movq %rsi, %rdi
movb $0x2, %al
callq 0x8540
movl %eax, 0x8(%rsp)
movq 0x90(%rsp), %rdi
movl 0x8(%rsp), %eax
addl $0x1, %eax
movslq %eax, %rsi
movsd 0x40(%rsp), %xmm0
movq 0x68(%rsp), %rax
movslq 0x30(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
leaq 0x1afd69(%rip), %rdx    # 0x1d4133
leaq 0x1afda1(%rip), %rcx    # 0x1d4172
movl $0x725, %r8d            # imm = 0x725
movb $0x2, %al
callq 0x8540
movl $0x1, 0x74(%rsp)
jmp 0x247cf
jmp 0x243ed
movl 0x30(%rsp), %eax
subl 0x34(%rsp), %eax
cmpl $0x1, %eax
jle 0x24449
movl 0x34(%rsp), %eax
addl 0x30(%rsp), %eax
cvtsi2sd %eax, %xmm1
movsd 0x1ae87a(%rip), %xmm0   # 0x1d2c88
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0x2c(%rsp)
movsd 0x40(%rsp), %xmm1
movq 0x68(%rsp), %rax
movslq 0x2c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x2443f
movl 0x2c(%rsp), %eax
movl %eax, 0x30(%rsp)
jmp 0x24447
movl 0x2c(%rsp), %eax
movl %eax, 0x34(%rsp)
jmp 0x243ed
jmp 0x245fa
movsd 0x40(%rsp), %xmm1
movq 0x68(%rsp), %rax
movslq 0x30(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x244f9
jmp 0x2446f
movsd 0x40(%rsp), %xmm0
movq 0x68(%rsp), %rax
movslq 0x30(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
xorl %eax, %eax
movl %eax, %esi
leaq 0x1afc77(%rip), %rdx    # 0x1d4106
leaq 0x1afcdc(%rip), %rcx    # 0x1d4172
movl $0x736, %r8d            # imm = 0x736
movq %rsi, %rdi
movb $0x2, %al
callq 0x8540
movl %eax, 0x4(%rsp)
movq 0x90(%rsp), %rdi
movl 0x4(%rsp), %eax
addl $0x1, %eax
movslq %eax, %rsi
movsd 0x40(%rsp), %xmm0
movq 0x68(%rsp), %rax
movslq 0x30(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
leaq 0x1afc2e(%rip), %rdx    # 0x1d4106
leaq 0x1afc93(%rip), %rcx    # 0x1d4172
movl $0x736, %r8d            # imm = 0x736
movb $0x2, %al
callq 0x8540
movl $0x1, 0x74(%rsp)
jmp 0x247cf
movsd 0x40(%rsp), %xmm0
movq 0x68(%rsp), %rax
movslq 0x34(%rsp), %rcx
ucomisd (%rax,%rcx,8), %xmm0
jbe 0x2459e
jmp 0x24516
movsd 0x40(%rsp), %xmm0
movq 0x68(%rsp), %rax
movslq 0x34(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
xorl %eax, %eax
movl %eax, %esi
leaq 0x1afbfd(%rip), %rdx    # 0x1d4133
leaq 0x1afc35(%rip), %rcx    # 0x1d4172
movl $0x73b, %r8d            # imm = 0x73B
movq %rsi, %rdi
movb $0x2, %al
callq 0x8540
movl %eax, (%rsp)
movq 0x90(%rsp), %rdi
movl (%rsp), %eax
addl $0x1, %eax
movslq %eax, %rsi
movsd 0x40(%rsp), %xmm0
movq 0x68(%rsp), %rax
movslq 0x34(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
leaq 0x1afbb6(%rip), %rdx    # 0x1d4133
leaq 0x1afbee(%rip), %rcx    # 0x1d4172
movl $0x73b, %r8d            # imm = 0x73B
movb $0x2, %al
callq 0x8540
movl $0x1, 0x74(%rsp)
jmp 0x247cf
jmp 0x245a0
movl 0x30(%rsp), %eax
subl 0x34(%rsp), %eax
cmpl $0x1, %eax
jle 0x245f8
movl 0x34(%rsp), %eax
addl 0x30(%rsp), %eax
cvtsi2sd %eax, %xmm1
movsd 0x1ae6c7(%rip), %xmm0   # 0x1d2c88
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0x2c(%rsp)
movsd 0x40(%rsp), %xmm0
movq 0x68(%rsp), %rax
movslq 0x2c(%rsp), %rcx
ucomisd (%rax,%rcx,8), %xmm0
jbe 0x245ee
movl 0x2c(%rsp), %eax
movl %eax, 0x30(%rsp)
jmp 0x245f6
movl 0x2c(%rsp), %eax
movl %eax, 0x34(%rsp)
jmp 0x245a0
jmp 0x245fa
movl 0x34(%rsp), %ecx
movq 0x38(%rsp), %rax
movl %ecx, (%rax)
movq 0x68(%rsp), %rax
movslq 0x30(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x68(%rsp), %rax
movslq 0x34(%rsp), %rcx
subsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x20(%rsp)
movsd 0x40(%rsp), %xmm0
movq 0x68(%rsp), %rax
movslq 0x34(%rsp), %rcx
subsd (%rax,%rcx,8), %xmm0
divsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x1adbf6(%rip), %xmm0   # 0x1d2248
subsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
movl $0x0, 0x28(%rsp)
movl 0x28(%rsp), %eax
cmpl 0x88(%rsp), %eax
jge 0x247c7
movsd 0x18(%rsp), %xmm0
movq 0x58(%rsp), %rax
movl 0x34(%rsp), %ecx
imull 0x4c(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x28(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm2
movsd 0x10(%rsp), %xmm1
movq 0x58(%rsp), %rax
movl 0x30(%rsp), %ecx
imull 0x4c(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x28(%rsp), %rcx
mulsd (%rax,%rcx,8), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd 0x18(%rsp), %xmm1
mulsd 0x18(%rsp), %xmm1
movsd 0x18(%rsp), %xmm3
movsd 0x18(%rsp), %xmm2
movq %xmm2, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm2
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
movq 0x50(%rsp), %rax
movl 0x34(%rsp), %ecx
imull 0x4c(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x28(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm3
movsd 0x10(%rsp), %xmm2
mulsd 0x10(%rsp), %xmm2
movsd 0x10(%rsp), %xmm5
movsd 0x10(%rsp), %xmm4
movq %xmm4, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm4
mulsd %xmm5, %xmm2
addsd %xmm4, %xmm2
movq 0x50(%rsp), %rax
movl 0x30(%rsp), %ecx
imull 0x4c(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x28(%rsp), %rcx
mulsd (%rax,%rcx,8), %xmm2
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
mulsd 0x20(%rsp), %xmm1
mulsd 0x20(%rsp), %xmm1
movsd 0x1aeeeb(%rip), %xmm2   # 0x1d3688
divsd %xmm2, %xmm1
addsd %xmm1, %xmm0
movq 0x80(%rsp), %rax
movslq 0x28(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl 0x28(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x28(%rsp)
jmp 0x24666
movl $0x0, 0x74(%rsp)
movl 0x74(%rsp), %eax
addq $0x78, %rsp
retq
nopl (%rax,%rax)