// File: /workspace/github_c_makefile_star2_O0/PoulinV[P]AxiCLASS/build/../tools/arrays.c
// Function: array_interpolate_growing_closeby
int array_interpolate_growing_closeby(
		   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,i;
  double weight;

  inf = *last_index;
  sup = *last_index+1;

  while (x < *(array+inf*n_columns+index_x)) {
    inf--;
    if (inf < 0) {
      class_sprintf(errmsg,"%s(L:%d) : x=%e < x_min=%e",__func__,__LINE__,
	      x,array[index_x]);
      return _FAILURE_;
    }
  }
  sup = inf+1;
  while (x > *(array+sup*n_columns+index_x)) {
    sup++;
    if (sup > (n_lines-1)) {
      class_sprintf(errmsg,"%s(L:%d) : x=%e > x_max=%e",__func__,__LINE__,
	      x,array[(n_lines-1)*n_columns+index_x]);
      return _FAILURE_;
    }
  }
  inf = sup-1;

  *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 $0x58, %rsp
movq 0x68(%rsp), %rax
movl 0x60(%rsp), %eax
movq %rdi, 0x48(%rsp)
movl %esi, 0x44(%rsp)
movl %edx, 0x40(%rsp)
movl %ecx, 0x3c(%rsp)
movsd %xmm0, 0x30(%rsp)
movq %r8, 0x28(%rsp)
movq %r9, 0x20(%rsp)
movq 0x28(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x1c(%rsp)
movq 0x28(%rsp), %rax
movl (%rax), %eax
addl $0x1, %eax
movl %eax, 0x18(%rsp)
movsd 0x30(%rsp), %xmm1
movq 0x48(%rsp), %rax
movl 0x1c(%rsp), %ecx
imull 0x44(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x3c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x26d8d
movl 0x1c(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x1c(%rsp)
cmpl $0x0, 0x1c(%rsp)
jge 0x26d88
jmp 0x26d01
movsd 0x30(%rsp), %xmm0
movq 0x48(%rsp), %rax
movslq 0x3c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
xorl %eax, %eax
movl %eax, %esi
leaq 0x1ad3e5(%rip), %rdx    # 0x1d4106
leaq 0x1ad573(%rip), %rcx    # 0x1d429b
movl $0x97b, %r8d            # imm = 0x97B
movq %rsi, %rdi
movb $0x2, %al
callq 0x8540
movl %eax, 0x4(%rsp)
movq 0x68(%rsp), %rdi
movl 0x4(%rsp), %eax
addl $0x1, %eax
movslq %eax, %rsi
movsd 0x30(%rsp), %xmm0
movq 0x48(%rsp), %rax
movslq 0x3c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
leaq 0x1ad39f(%rip), %rdx    # 0x1d4106
leaq 0x1ad52d(%rip), %rcx    # 0x1d429b
movl $0x97b, %r8d            # imm = 0x97B
movb $0x2, %al
callq 0x8540
movl $0x1, 0x54(%rsp)
jmp 0x26fc6
jmp 0x26cb7
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x18(%rsp)
movsd 0x30(%rsp), %xmm0
movq 0x48(%rsp), %rax
movl 0x18(%rsp), %ecx
imull 0x44(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x3c(%rsp), %rcx
ucomisd (%rax,%rcx,8), %xmm0
jbe 0x26e8c
movl 0x18(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x18(%rsp)
movl 0x18(%rsp), %eax
movl 0x40(%rsp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jle 0x26e87
jmp 0x26de6
movsd 0x30(%rsp), %xmm0
movq 0x48(%rsp), %rax
movl 0x40(%rsp), %ecx
subl $0x1, %ecx
imull 0x44(%rsp), %ecx
addl 0x3c(%rsp), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm1
xorl %eax, %eax
movl %eax, %esi
leaq 0x1ad31f(%rip), %rdx    # 0x1d4133
leaq 0x1ad480(%rip), %rcx    # 0x1d429b
movl $0x984, %r8d            # imm = 0x984
movq %rsi, %rdi
movb $0x2, %al
callq 0x8540
movl %eax, (%rsp)
movq 0x68(%rsp), %rdi
movl (%rsp), %eax
addl $0x1, %eax
movslq %eax, %rsi
movsd 0x30(%rsp), %xmm0
movq 0x48(%rsp), %rax
movl 0x40(%rsp), %ecx
subl $0x1, %ecx
imull 0x44(%rsp), %ecx
addl 0x3c(%rsp), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm1
leaq 0x1ad2cd(%rip), %rdx    # 0x1d4133
leaq 0x1ad42e(%rip), %rcx    # 0x1d429b
movl $0x984, %r8d            # imm = 0x984
movb $0x2, %al
callq 0x8540
movl $0x1, 0x54(%rsp)
jmp 0x26fc6
jmp 0x26d98
movl 0x18(%rsp), %eax
subl $0x1, %eax
movl %eax, 0x1c(%rsp)
movl 0x1c(%rsp), %ecx
movq 0x28(%rsp), %rax
movl %ecx, (%rax)
movsd 0x30(%rsp), %xmm0
movq 0x48(%rsp), %rax
movl 0x1c(%rsp), %ecx
imull 0x44(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x3c(%rsp), %rcx
subsd (%rax,%rcx,8), %xmm0
movq 0x48(%rsp), %rax
movl 0x18(%rsp), %ecx
imull 0x44(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x3c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
movq 0x48(%rsp), %rax
movl 0x1c(%rsp), %ecx
imull 0x44(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x3c(%rsp), %rcx
subsd (%rax,%rcx,8), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x8(%rsp)
movl $0x0, 0x14(%rsp)
movl 0x14(%rsp), %eax
cmpl 0x60(%rsp), %eax
jge 0x26fa9
movq 0x48(%rsp), %rax
movl 0x1c(%rsp), %ecx
imull 0x44(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x14(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd 0x1ab2f4(%rip), %xmm2   # 0x1d2248
subsd 0x8(%rsp), %xmm2
movsd 0x8(%rsp), %xmm1
movq 0x48(%rsp), %rax
movl 0x18(%rsp), %ecx
imull 0x44(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x14(%rsp), %rcx
mulsd (%rax,%rcx,8), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movq 0x20(%rsp), %rax
movslq 0x14(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl 0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14(%rsp)
jmp 0x26f20
movsd 0x30(%rsp), %xmm0
movq 0x20(%rsp), %rax
movslq 0x3c(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl $0x0, 0x54(%rsp)
movl 0x54(%rsp), %eax
addq $0x58, %rsp
retq
nop