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

  int inf,sup;
  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));

  *result = *(array+inf*n_columns+index_y) * (1.-weight) + *(array+sup*n_columns+index_y) * weight;

  return _SUCCESS_;
}

// Assembly:
subq $0x58, %rsp
movq 0x68(%rsp), %rax
movq 0x60(%rsp), %rax
movq %rdi, 0x48(%rsp)
movl %esi, 0x44(%rsp)
movl %edx, 0x40(%rsp)
movl %ecx, 0x3c(%rsp)
movsd %xmm0, 0x30(%rsp)
movq %r8, 0x28(%rsp)
movl %r9d, 0x24(%rsp)
movq 0x28(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x20(%rsp)
movq 0x28(%rsp), %rax
movl (%rax), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
movsd 0x30(%rsp), %xmm1
movq 0x48(%rsp), %rax
movl 0x20(%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 0x270ee
movl 0x20(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x20(%rsp)
cmpl $0x0, 0x20(%rsp)
jge 0x270e9
jmp 0x27062
movsd 0x30(%rsp), %xmm0
movq 0x48(%rsp), %rax
movslq 0x3c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
xorl %eax, %eax
movl %eax, %esi
leaq 0x1ad084(%rip), %rdx    # 0x1d4106
leaq 0x1ad234(%rip), %rcx    # 0x1d42bd
movl $0x9b1, %r8d            # imm = 0x9B1
movq %rsi, %rdi
movb $0x2, %al
callq 0x8540
movl %eax, 0xc(%rsp)
movq 0x68(%rsp), %rdi
movl 0xc(%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 0x1ad03e(%rip), %rdx    # 0x1d4106
leaq 0x1ad1ee(%rip), %rcx    # 0x1d42bd
movl $0x9b1, %r8d            # imm = 0x9B1
movb $0x2, %al
callq 0x8540
movl $0x1, 0x54(%rsp)
jmp 0x272ec
jmp 0x27018
movl 0x20(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
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
ucomisd (%rax,%rcx,8), %xmm0
jbe 0x271ef
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
movl 0x1c(%rsp), %eax
movl 0x40(%rsp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jle 0x271ea
jmp 0x27147
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 0x1acfbe(%rip), %rdx    # 0x1d4133
leaq 0x1ad141(%rip), %rcx    # 0x1d42bd
movl $0x9ba, %r8d            # imm = 0x9BA
movq %rsi, %rdi
movb $0x2, %al
callq 0x8540
movl %eax, 0x8(%rsp)
movq 0x68(%rsp), %rdi
movl 0x8(%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 0x1acf6a(%rip), %rdx    # 0x1d4133
leaq 0x1ad0ed(%rip), %rcx    # 0x1d42bd
movl $0x9ba, %r8d            # imm = 0x9BA
movb $0x2, %al
callq 0x8540
movl $0x1, 0x54(%rsp)
jmp 0x272ec
jmp 0x270f9
movl 0x1c(%rsp), %eax
subl $0x1, %eax
movl %eax, 0x20(%rsp)
movl 0x20(%rsp), %ecx
movq 0x28(%rsp), %rax
movl %ecx, (%rax)
movsd 0x30(%rsp), %xmm0
movq 0x48(%rsp), %rax
movl 0x20(%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 0x1c(%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 0x20(%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, 0x10(%rsp)
movq 0x48(%rsp), %rax
movl 0x20(%rsp), %ecx
imull 0x44(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x24(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd 0x1aafa3(%rip), %xmm2   # 0x1d2248
subsd 0x10(%rsp), %xmm2
movq 0x48(%rsp), %rax
movl 0x1c(%rsp), %ecx
imull 0x44(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x24(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
mulsd 0x10(%rsp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movq 0x60(%rsp), %rax
movsd %xmm0, (%rax)
movl $0x0, 0x54(%rsp)
movl 0x54(%rsp), %eax
addq $0x58, %rsp
retq
nopw %cs:(%rax,%rax)