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

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

  /*
  if (*last_index < 0) {
    class_sprintf(errmsg,"%s(L:%d) problem with last_index =%d < 0",__func__,__LINE__,*last_index);
    return _FAILURE_;
  }
  if (*last_index > (n_lines-1)) {
    class_sprintf(errmsg,"%s(L:%d) problem with last_index =%d > %d",__func__,__LINE__,*last_index,n_lines-1);
    return _FAILURE_;
  }
  */

  inf = *last_index;
  class_test(inf<0 || inf>(n_lines-1),
	     errmsg,
	     "*lastindex=%d out of range [0:%d]\n",inf,n_lines-1);
  while (x < x_array[inf]) {
    inf--;
    if (inf < 0) {
      class_sprintf(errmsg,"%s(L:%d) : x=%e < x_min=%e",__func__,__LINE__,
	      x,x_array[0]);
      return _FAILURE_;
    }
  }
  sup = inf+1;
  while (x > x_array[sup]) {
    sup++;
    if (sup > (n_lines-1)) {
      class_sprintf(errmsg,"%s(L:%d) : x=%e > x_max=%e",__func__,__LINE__,
	      x,x_array[n_lines-1]);
      return _FAILURE_;
    }
  }
  inf = sup-1;

  *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 $0x1078, %rsp           # imm = 0x1078
movq 0x1090(%rsp), %rax
movl 0x1088(%rsp), %eax
movq 0x1080(%rsp), %rax
movq %rdi, 0x1068(%rsp)
movl %esi, 0x1064(%rsp)
movq %rdx, 0x1058(%rsp)
movq %rcx, 0x1050(%rsp)
movl %r8d, 0x104c(%rsp)
movsd %xmm0, 0x1040(%rsp)
movq %r9, 0x1038(%rsp)
movq 0x1038(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x1034(%rsp)
cmpl $0x0, 0x1034(%rsp)
jl 0x2738a
movl 0x1034(%rsp), %eax
movl 0x1064(%rsp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jle 0x2740a
leaq 0x810(%rsp), %rdi
movl 0x1034(%rsp), %edx
movl 0x1064(%rsp), %ecx
subl $0x1, %ecx
leaq 0x1acf39(%rip), %rsi    # 0x1d42e3
movb $0x0, %al
callq 0x5b9c0
leaq 0x10(%rsp), %rdi
leaq 0x810(%rsp), %rcx
leaq 0x1aacbd(%rip), %rsi    # 0x1d2082
leaq 0x1acf3a(%rip), %rdx    # 0x1d4306
movb $0x0, %al
callq 0x5b9c0
movq 0x1090(%rsp), %rdi
leaq 0x10(%rsp), %r8
leaq 0x1aac4d(%rip), %rsi    # 0x1d2034
leaq 0x1acf31(%rip), %rdx    # 0x1d431f
movl $0x9ec, %ecx            # imm = 0x9EC
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x1074(%rsp)
jmp 0x2786c
jmp 0x2740c
movsd 0x1040(%rsp), %xmm1
movq 0x1068(%rsp), %rax
movslq 0x1034(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x274e7
movl 0x1034(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x1034(%rsp)
cmpl $0x0, 0x1034(%rsp)
jge 0x274e2
jmp 0x27455
movsd 0x1040(%rsp), %xmm0
movq 0x1068(%rsp), %rax
movsd (%rax), %xmm1
xorl %eax, %eax
movl %eax, %esi
leaq 0x1acc91(%rip), %rdx    # 0x1d4106
leaq 0x1acea3(%rip), %rcx    # 0x1d431f
movl $0x9f0, %r8d            # imm = 0x9F0
movq %rsi, %rdi
movb $0x2, %al
callq 0x8540
movl %eax, 0xc(%rsp)
movq 0x1090(%rsp), %rdi
movl 0xc(%rsp), %eax
addl $0x1, %eax
movslq %eax, %rsi
movsd 0x1040(%rsp), %xmm0
movq 0x1068(%rsp), %rax
movsd (%rax), %xmm1
leaq 0x1acc48(%rip), %rdx    # 0x1d4106
leaq 0x1ace5a(%rip), %rcx    # 0x1d431f
movl $0x9f0, %r8d            # imm = 0x9F0
movb $0x2, %al
callq 0x8540
movl $0x1, 0x1074(%rsp)
jmp 0x2786c
jmp 0x2740c
movl 0x1034(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1030(%rsp)
movsd 0x1040(%rsp), %xmm0
movq 0x1068(%rsp), %rax
movslq 0x1030(%rsp), %rcx
ucomisd (%rax,%rcx,8), %xmm0
jbe 0x275f6
movl 0x1030(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1030(%rsp)
movl 0x1030(%rsp), %eax
movl 0x1064(%rsp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jle 0x275f1
jmp 0x27548
movsd 0x1040(%rsp), %xmm0
movq 0x1068(%rsp), %rax
movl 0x1064(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm1
xorl %eax, %eax
movl %eax, %esi
leaq 0x1acbbd(%rip), %rdx    # 0x1d4133
leaq 0x1acda2(%rip), %rcx    # 0x1d431f
movl $0x9f9, %r8d            # imm = 0x9F9
movq %rsi, %rdi
movb $0x2, %al
callq 0x8540
movl %eax, 0x8(%rsp)
movq 0x1090(%rsp), %rdi
movl 0x8(%rsp), %eax
addl $0x1, %eax
movslq %eax, %rsi
movsd 0x1040(%rsp), %xmm0
movq 0x1068(%rsp), %rax
movl 0x1064(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm1
leaq 0x1acb66(%rip), %rdx    # 0x1d4133
leaq 0x1acd4b(%rip), %rcx    # 0x1d431f
movl $0x9f9, %r8d            # imm = 0x9F9
movb $0x2, %al
callq 0x8540
movl $0x1, 0x1074(%rsp)
jmp 0x2786c
jmp 0x274f8
movl 0x1030(%rsp), %eax
subl $0x1, %eax
movl %eax, 0x1034(%rsp)
movl 0x1034(%rsp), %ecx
movq 0x1038(%rsp), %rax
movl %ecx, (%rax)
movq 0x1068(%rsp), %rax
movslq 0x1030(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x1068(%rsp), %rax
movslq 0x1034(%rsp), %rcx
subsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x1020(%rsp)
movsd 0x1040(%rsp), %xmm0
movq 0x1068(%rsp), %rax
movslq 0x1034(%rsp), %rcx
subsd (%rax,%rcx,8), %xmm0
divsd 0x1020(%rsp), %xmm0
movsd %xmm0, 0x1010(%rsp)
movsd 0x1aabc5(%rip), %xmm0   # 0x1d2248
subsd 0x1010(%rsp), %xmm0
movsd %xmm0, 0x1018(%rsp)
movl $0x0, 0x102c(%rsp)
movl 0x102c(%rsp), %eax
cmpl 0x1088(%rsp), %eax
jge 0x27861
movsd 0x1018(%rsp), %xmm0
movq 0x1058(%rsp), %rax
movl 0x1034(%rsp), %ecx
imull 0x104c(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x102c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm2
movsd 0x1010(%rsp), %xmm1
movq 0x1058(%rsp), %rax
movl 0x1030(%rsp), %ecx
imull 0x104c(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x102c(%rsp), %rcx
mulsd (%rax,%rcx,8), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd 0x1018(%rsp), %xmm1
mulsd 0x1018(%rsp), %xmm1
movsd 0x1018(%rsp), %xmm3
movsd 0x1018(%rsp), %xmm2
movq %xmm2, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm2
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
movq 0x1050(%rsp), %rax
movl 0x1034(%rsp), %ecx
imull 0x104c(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x102c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm3
movsd 0x1010(%rsp), %xmm2
mulsd 0x1010(%rsp), %xmm2
movsd 0x1010(%rsp), %xmm5
movsd 0x1010(%rsp), %xmm4
movq %xmm4, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm4
mulsd %xmm5, %xmm2
addsd %xmm4, %xmm2
movq 0x1050(%rsp), %rax
movl 0x1030(%rsp), %ecx
imull 0x104c(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x102c(%rsp), %rcx
mulsd (%rax,%rcx,8), %xmm2
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
mulsd 0x1020(%rsp), %xmm1
mulsd 0x1020(%rsp), %xmm1
movsd 0x1abe5a(%rip), %xmm2   # 0x1d3688
divsd %xmm2, %xmm1
addsd %xmm1, %xmm0
movq 0x1080(%rsp), %rax
movslq 0x102c(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl 0x102c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x102c(%rsp)
jmp 0x276a0
movl $0x0, 0x1074(%rsp)
movl 0x1074(%rsp), %eax
addq $0x1078, %rsp           # imm = 0x1078
retq
nopl (%rax,%rax)