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

  int inf,sup,mid,i;
  double weight;

  inf=0;
  sup=n_lines-1;

  if (*(array+inf*n_columns+index_x) < *(array+sup*n_columns+index_x)){

    if (x < *(array+inf*n_columns+index_x)) {
      class_sprintf(errmsg,"%s(L:%d) : x=%e < x_min=%e",__func__,__LINE__,x,*(array+inf*n_columns+index_x));
      return _FAILURE_;
    }

    if (x > *(array+sup*n_columns+index_x)) {
      class_sprintf(errmsg,"%s(L:%d) : x=%e > x_max=%e",__func__,__LINE__,x,*(array+sup*n_columns+index_x));
      return _FAILURE_;
    }

    while (sup-inf > 1) {

      mid=(int)(0.5*(inf+sup));
      if (x < *(array+mid*n_columns+index_x)) {sup=mid;}
      else {inf=mid;}

    }

  }

  else {

    if (x < *(array+sup*n_columns+index_x)) {
      class_sprintf(errmsg,"%s(L:%d) : x=%e < x_min=%e",__func__,__LINE__,x,*(array+sup*n_columns+index_x));
      return _FAILURE_;
    }

    if (x > *(array+inf*n_columns+index_x)) {
      class_sprintf(errmsg,"%s(L:%d) : x=%e > x_max=%e",__func__,__LINE__,x,*(array+inf*n_columns+index_x));
      return _FAILURE_;
    }

    while (sup-inf > 1) {

      mid=(int)(0.5*(inf+sup));
      if (x > *(array+mid*n_columns+index_x)) {sup=mid;}
      else {inf=mid;}

    }

  }

  *last_index = inf;

  weight=(x-*(array+inf*n_columns+index_x))/(*(array+sup*n_columns+index_x)-*(array+inf*n_columns+index_x));

  for (i=0; i<result_size; i++)
    *(result+i) = *(array+inf*n_columns+i) * (1.-weight)
      + weight * *(array+sup*n_columns+i);

  *(result+index_x) = x;

  return _SUCCESS_;
}

// Assembly:
subq $0x68, %rsp
movq 0x78(%rsp), %rax
movl 0x70(%rsp), %eax
movq %rdi, 0x58(%rsp)
movl %esi, 0x54(%rsp)
movl %edx, 0x50(%rsp)
movl %ecx, 0x4c(%rsp)
movsd %xmm0, 0x40(%rsp)
movq %r8, 0x38(%rsp)
movq %r9, 0x30(%rsp)
movl $0x0, 0x2c(%rsp)
movl 0x50(%rsp), %eax
subl $0x1, %eax
movl %eax, 0x28(%rsp)
movq 0x58(%rsp), %rax
movl 0x2c(%rsp), %ecx
imull 0x54(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x4c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
movq 0x58(%rsp), %rax
movl 0x28(%rsp), %ecx
imull 0x54(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x4c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x23883
movsd 0x40(%rsp), %xmm1
movq 0x58(%rsp), %rax
movl 0x2c(%rsp), %ecx
imull 0x54(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x4c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x23730
jmp 0x23683
movsd 0x40(%rsp), %xmm0
movq 0x58(%rsp), %rax
movl 0x2c(%rsp), %ecx
imull 0x54(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x4c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
xorl %eax, %eax
movl %eax, %esi
leaq 0x1b0a50(%rip), %rdx    # 0x1d4106
leaq 0x1b0a64(%rip), %rcx    # 0x1d4121
movl $0x681, %r8d            # imm = 0x681
movq %rsi, %rdi
movb $0x2, %al
callq 0x8540
movl %eax, 0x14(%rsp)
movq 0x78(%rsp), %rdi
movl 0x14(%rsp), %eax
addl $0x1, %eax
movslq %eax, %rsi
movsd 0x40(%rsp), %xmm0
movq 0x58(%rsp), %rax
movl 0x2c(%rsp), %ecx
imull 0x54(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x4c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
leaq 0x1b09f7(%rip), %rdx    # 0x1d4106
leaq 0x1b0a0b(%rip), %rcx    # 0x1d4121
movl $0x681, %r8d            # imm = 0x681
movb $0x2, %al
callq 0x8540
movl $0x1, 0x64(%rsp)
jmp 0x23bdf
movsd 0x40(%rsp), %xmm0
movq 0x58(%rsp), %rax
movl 0x28(%rsp), %ecx
imull 0x54(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x4c(%rsp), %rcx
ucomisd (%rax,%rcx,8), %xmm0
jbe 0x2380d
jmp 0x23760
movsd 0x40(%rsp), %xmm0
movq 0x58(%rsp), %rax
movl 0x28(%rsp), %ecx
imull 0x54(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x4c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
xorl %eax, %eax
movl %eax, %esi
leaq 0x1b09a0(%rip), %rdx    # 0x1d4133
leaq 0x1b0987(%rip), %rcx    # 0x1d4121
movl $0x686, %r8d            # imm = 0x686
movq %rsi, %rdi
movb $0x2, %al
callq 0x8540
movl %eax, 0x10(%rsp)
movq 0x78(%rsp), %rdi
movl 0x10(%rsp), %eax
addl $0x1, %eax
movslq %eax, %rsi
movsd 0x40(%rsp), %xmm0
movq 0x58(%rsp), %rax
movl 0x28(%rsp), %ecx
imull 0x54(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x4c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
leaq 0x1b0947(%rip), %rdx    # 0x1d4133
leaq 0x1b092e(%rip), %rcx    # 0x1d4121
movl $0x686, %r8d            # imm = 0x686
movb $0x2, %al
callq 0x8540
movl $0x1, 0x64(%rsp)
jmp 0x23bdf
jmp 0x2380f
movl 0x28(%rsp), %eax
subl 0x2c(%rsp), %eax
cmpl $0x1, %eax
jle 0x2387e
movl 0x2c(%rsp), %eax
addl 0x28(%rsp), %eax
cvtsi2sd %eax, %xmm1
movsd 0x1af458(%rip), %xmm0   # 0x1d2c88
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0x24(%rsp)
movsd 0x40(%rsp), %xmm1
movq 0x58(%rsp), %rax
movl 0x24(%rsp), %ecx
imull 0x54(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x4c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x23874
movl 0x24(%rsp), %eax
movl %eax, 0x28(%rsp)
jmp 0x2387c
movl 0x24(%rsp), %eax
movl %eax, 0x2c(%rsp)
jmp 0x2380f
jmp 0x23ab0
movsd 0x40(%rsp), %xmm1
movq 0x58(%rsp), %rax
movl 0x28(%rsp), %ecx
imull 0x54(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x4c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x23964
jmp 0x238b7
movsd 0x40(%rsp), %xmm0
movq 0x58(%rsp), %rax
movl 0x28(%rsp), %ecx
imull 0x54(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x4c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
xorl %eax, %eax
movl %eax, %esi
leaq 0x1b081c(%rip), %rdx    # 0x1d4106
leaq 0x1b0830(%rip), %rcx    # 0x1d4121
movl $0x697, %r8d            # imm = 0x697
movq %rsi, %rdi
movb $0x2, %al
callq 0x8540
movl %eax, 0xc(%rsp)
movq 0x78(%rsp), %rdi
movl 0xc(%rsp), %eax
addl $0x1, %eax
movslq %eax, %rsi
movsd 0x40(%rsp), %xmm0
movq 0x58(%rsp), %rax
movl 0x28(%rsp), %ecx
imull 0x54(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x4c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
leaq 0x1b07c3(%rip), %rdx    # 0x1d4106
leaq 0x1b07d7(%rip), %rcx    # 0x1d4121
movl $0x697, %r8d            # imm = 0x697
movb $0x2, %al
callq 0x8540
movl $0x1, 0x64(%rsp)
jmp 0x23bdf
movsd 0x40(%rsp), %xmm0
movq 0x58(%rsp), %rax
movl 0x2c(%rsp), %ecx
imull 0x54(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x4c(%rsp), %rcx
ucomisd (%rax,%rcx,8), %xmm0
jbe 0x23a41
jmp 0x23994
movsd 0x40(%rsp), %xmm0
movq 0x58(%rsp), %rax
movl 0x2c(%rsp), %ecx
imull 0x54(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x4c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
xorl %eax, %eax
movl %eax, %esi
leaq 0x1b076c(%rip), %rdx    # 0x1d4133
leaq 0x1b0753(%rip), %rcx    # 0x1d4121
movl $0x69c, %r8d            # imm = 0x69C
movq %rsi, %rdi
movb $0x2, %al
callq 0x8540
movl %eax, 0x8(%rsp)
movq 0x78(%rsp), %rdi
movl 0x8(%rsp), %eax
addl $0x1, %eax
movslq %eax, %rsi
movsd 0x40(%rsp), %xmm0
movq 0x58(%rsp), %rax
movl 0x2c(%rsp), %ecx
imull 0x54(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x4c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
leaq 0x1b0713(%rip), %rdx    # 0x1d4133
leaq 0x1b06fa(%rip), %rcx    # 0x1d4121
movl $0x69c, %r8d            # imm = 0x69C
movb $0x2, %al
callq 0x8540
movl $0x1, 0x64(%rsp)
jmp 0x23bdf
jmp 0x23a43
movl 0x28(%rsp), %eax
subl 0x2c(%rsp), %eax
cmpl $0x1, %eax
jle 0x23aae
movl 0x2c(%rsp), %eax
addl 0x28(%rsp), %eax
cvtsi2sd %eax, %xmm1
movsd 0x1af224(%rip), %xmm0   # 0x1d2c88
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0x24(%rsp)
movsd 0x40(%rsp), %xmm0
movq 0x58(%rsp), %rax
movl 0x24(%rsp), %ecx
imull 0x54(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x4c(%rsp), %rcx
ucomisd (%rax,%rcx,8), %xmm0
jbe 0x23aa4
movl 0x24(%rsp), %eax
movl %eax, 0x28(%rsp)
jmp 0x23aac
movl 0x24(%rsp), %eax
movl %eax, 0x2c(%rsp)
jmp 0x23a43
jmp 0x23ab0
movl 0x2c(%rsp), %ecx
movq 0x38(%rsp), %rax
movl %ecx, (%rax)
movsd 0x40(%rsp), %xmm0
movq 0x58(%rsp), %rax
movl 0x2c(%rsp), %ecx
imull 0x54(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x4c(%rsp), %rcx
subsd (%rax,%rcx,8), %xmm0
movq 0x58(%rsp), %rax
movl 0x28(%rsp), %ecx
imull 0x54(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x4c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
movq 0x58(%rsp), %rax
movl 0x2c(%rsp), %ecx
imull 0x54(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x4c(%rsp), %rcx
subsd (%rax,%rcx,8), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x18(%rsp)
movl $0x0, 0x20(%rsp)
movl 0x20(%rsp), %eax
cmpl 0x70(%rsp), %eax
jge 0x23bc2
movq 0x58(%rsp), %rax
movl 0x2c(%rsp), %ecx
imull 0x54(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x20(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd 0x1ae6db(%rip), %xmm2   # 0x1d2248
subsd 0x18(%rsp), %xmm2
movsd 0x18(%rsp), %xmm1
movq 0x58(%rsp), %rax
movl 0x28(%rsp), %ecx
imull 0x54(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x20(%rsp), %rcx
mulsd (%rax,%rcx,8), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movq 0x30(%rsp), %rax
movslq 0x20(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl 0x20(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x20(%rsp)
jmp 0x23b39
movsd 0x40(%rsp), %xmm0
movq 0x30(%rsp), %rax
movslq 0x4c(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl $0x0, 0x64(%rsp)
movl 0x64(%rsp), %eax
addq $0x68, %rsp
retq
nopl (%rax,%rax)