// File: /workspace/github_c_makefile_star2_O0/PoulinV[P]AxiCLASS/build/../tools/arrays.c
// Function: array_interpolate_linear
int array_interpolate_linear(
			     double * x_array,
			     int n_lines,
			     double * array,
			     int n_columns,
			     double x,
			     int * last_index,
			     double * 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);

  return _SUCCESS_;
}

// Assembly:
subq $0x78, %rsp
movq 0x88(%rsp), %rax
movl 0x80(%rsp), %eax
movq %rdi, 0x68(%rsp)
movl %esi, 0x64(%rsp)
movq %rdx, 0x58(%rsp)
movl %ecx, 0x54(%rsp)
movsd %xmm0, 0x48(%rsp)
movq %r8, 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 0x24dd5
movsd 0x48(%rsp), %xmm1
movq 0x68(%rsp), %rax
movslq 0x34(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x24ccb
jmp 0x24c41
movsd 0x48(%rsp), %xmm0
movq 0x68(%rsp), %rax
movslq 0x34(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
xorl %eax, %eax
movl %eax, %esi
leaq 0x1af4a5(%rip), %rdx    # 0x1d4106
leaq 0x1af56d(%rip), %rcx    # 0x1d41d5
movl $0x7b4, %r8d            # imm = 0x7B4
movq %rsi, %rdi
movb $0x2, %al
callq 0x8540
movl %eax, 0xc(%rsp)
movq 0x88(%rsp), %rdi
movl 0xc(%rsp), %eax
addl $0x1, %eax
movslq %eax, %rsi
movsd 0x48(%rsp), %xmm0
movq 0x68(%rsp), %rax
movslq 0x34(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
leaq 0x1af45c(%rip), %rdx    # 0x1d4106
leaq 0x1af524(%rip), %rcx    # 0x1d41d5
movl $0x7b4, %r8d            # imm = 0x7B4
movb $0x2, %al
callq 0x8540
movl $0x1, 0x74(%rsp)
jmp 0x25079
movsd 0x48(%rsp), %xmm0
movq 0x68(%rsp), %rax
movslq 0x30(%rsp), %rcx
ucomisd (%rax,%rcx,8), %xmm0
jbe 0x24d72
jmp 0x24ce8
movsd 0x48(%rsp), %xmm0
movq 0x68(%rsp), %rax
movslq 0x30(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
xorl %eax, %eax
movl %eax, %esi
leaq 0x1af42b(%rip), %rdx    # 0x1d4133
leaq 0x1af4c6(%rip), %rcx    # 0x1d41d5
movl $0x7b9, %r8d            # imm = 0x7B9
movq %rsi, %rdi
movb $0x2, %al
callq 0x8540
movl %eax, 0x8(%rsp)
movq 0x88(%rsp), %rdi
movl 0x8(%rsp), %eax
addl $0x1, %eax
movslq %eax, %rsi
movsd 0x48(%rsp), %xmm0
movq 0x68(%rsp), %rax
movslq 0x30(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
leaq 0x1af3e2(%rip), %rdx    # 0x1d4133
leaq 0x1af47d(%rip), %rcx    # 0x1d41d5
movl $0x7b9, %r8d            # imm = 0x7B9
movb $0x2, %al
callq 0x8540
movl $0x1, 0x74(%rsp)
jmp 0x25079
jmp 0x24d74
movl 0x30(%rsp), %eax
subl 0x34(%rsp), %eax
cmpl $0x1, %eax
jle 0x24dd0
movl 0x34(%rsp), %eax
addl 0x30(%rsp), %eax
cvtsi2sd %eax, %xmm1
movsd 0x1adef3(%rip), %xmm0   # 0x1d2c88
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0x2c(%rsp)
movsd 0x48(%rsp), %xmm1
movq 0x68(%rsp), %rax
movslq 0x2c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x24dc6
movl 0x2c(%rsp), %eax
movl %eax, 0x30(%rsp)
jmp 0x24dce
movl 0x2c(%rsp), %eax
movl %eax, 0x34(%rsp)
jmp 0x24d74
jmp 0x24f81
movsd 0x48(%rsp), %xmm1
movq 0x68(%rsp), %rax
movslq 0x30(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x24e80
jmp 0x24df6
movsd 0x48(%rsp), %xmm0
movq 0x68(%rsp), %rax
movslq 0x30(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
xorl %eax, %eax
movl %eax, %esi
leaq 0x1af2f0(%rip), %rdx    # 0x1d4106
leaq 0x1af3b8(%rip), %rcx    # 0x1d41d5
movl $0x7ca, %r8d            # imm = 0x7CA
movq %rsi, %rdi
movb $0x2, %al
callq 0x8540
movl %eax, 0x4(%rsp)
movq 0x88(%rsp), %rdi
movl 0x4(%rsp), %eax
addl $0x1, %eax
movslq %eax, %rsi
movsd 0x48(%rsp), %xmm0
movq 0x68(%rsp), %rax
movslq 0x30(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
leaq 0x1af2a7(%rip), %rdx    # 0x1d4106
leaq 0x1af36f(%rip), %rcx    # 0x1d41d5
movl $0x7ca, %r8d            # imm = 0x7CA
movb $0x2, %al
callq 0x8540
movl $0x1, 0x74(%rsp)
jmp 0x25079
movsd 0x48(%rsp), %xmm0
movq 0x68(%rsp), %rax
movslq 0x34(%rsp), %rcx
ucomisd (%rax,%rcx,8), %xmm0
jbe 0x24f25
jmp 0x24e9d
movsd 0x48(%rsp), %xmm0
movq 0x68(%rsp), %rax
movslq 0x34(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
xorl %eax, %eax
movl %eax, %esi
leaq 0x1af276(%rip), %rdx    # 0x1d4133
leaq 0x1af311(%rip), %rcx    # 0x1d41d5
movl $0x7cf, %r8d            # imm = 0x7CF
movq %rsi, %rdi
movb $0x2, %al
callq 0x8540
movl %eax, (%rsp)
movq 0x88(%rsp), %rdi
movl (%rsp), %eax
addl $0x1, %eax
movslq %eax, %rsi
movsd 0x48(%rsp), %xmm0
movq 0x68(%rsp), %rax
movslq 0x34(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
leaq 0x1af22f(%rip), %rdx    # 0x1d4133
leaq 0x1af2ca(%rip), %rcx    # 0x1d41d5
movl $0x7cf, %r8d            # imm = 0x7CF
movb $0x2, %al
callq 0x8540
movl $0x1, 0x74(%rsp)
jmp 0x25079
jmp 0x24f27
movl 0x30(%rsp), %eax
subl 0x34(%rsp), %eax
cmpl $0x1, %eax
jle 0x24f7f
movl 0x34(%rsp), %eax
addl 0x30(%rsp), %eax
cvtsi2sd %eax, %xmm1
movsd 0x1add40(%rip), %xmm0   # 0x1d2c88
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0x2c(%rsp)
movsd 0x48(%rsp), %xmm0
movq 0x68(%rsp), %rax
movslq 0x2c(%rsp), %rcx
ucomisd (%rax,%rcx,8), %xmm0
jbe 0x24f75
movl 0x2c(%rsp), %eax
movl %eax, 0x30(%rsp)
jmp 0x24f7d
movl 0x2c(%rsp), %eax
movl %eax, 0x34(%rsp)
jmp 0x24f27
jmp 0x24f81
movl 0x34(%rsp), %ecx
movq 0x40(%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 0x48(%rsp), %xmm0
movq 0x68(%rsp), %rax
movslq 0x34(%rsp), %rcx
subsd (%rax,%rcx,8), %xmm0
divsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x1ad26f(%rip), %xmm0   # 0x1d2248
subsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
movl $0x0, 0x28(%rsp)
movl 0x28(%rsp), %eax
cmpl 0x80(%rsp), %eax
jge 0x25071
movsd 0x18(%rsp), %xmm0
movq 0x58(%rsp), %rax
movl 0x34(%rsp), %ecx
imull 0x54(%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 0x54(%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
movq 0x38(%rsp), %rax
movslq 0x28(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl 0x28(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x28(%rsp)
jmp 0x24fed
movl $0x0, 0x74(%rsp)
movl 0x74(%rsp), %eax
addq $0x78, %rsp
retq
nopw %cs:(%rax,%rax)