// File: /workspace/github_c_makefile_star2_O0/PoulinV[P]AxiCLASS/build/../tools/arrays.c
// Function: array_interpolate_equal
int array_interpolate_equal(
			    double * array,
			    int n_columns,
			    int n_lines,
			    double x,
			    double x_min,
			    double x_max,
			    double * result,
			    ErrorMsg errmsg) {

  int index_minus,i;
  double x_step,x_minus,weight;

  if (x < x_min) {
    class_sprintf(errmsg,"%s(L:%d) : x out of bounds: x=%e,x_min=%e",__func__,__LINE__,x,x_min);
    return _FAILURE_;
  }

  if (x > x_max) {
    class_sprintf(errmsg,"%s(L:%d) : x out of bounds: x=%e,x_max=%e",__func__,__LINE__,x,x_max);
    return _FAILURE_;
  }

  x_step = (x_max-x_min)/(n_lines-1);
  index_minus = (int)((x-x_min)/x_step);
  x_minus = index_minus * x_step;
  weight = (x-x_minus) / x_step;

  for (i=0; i<n_columns; i++)
    result[i] = *(array+n_columns*index_minus+i)*(1.-weight)
      + *(array+n_columns*(index_minus+1)+i)*weight;

  return _SUCCESS_;

}

// Assembly:
subq $0x68, %rsp
movq %rdi, 0x58(%rsp)
movl %esi, 0x54(%rsp)
movl %edx, 0x50(%rsp)
movsd %xmm0, 0x48(%rsp)
movsd %xmm1, 0x40(%rsp)
movsd %xmm2, 0x38(%rsp)
movq %rcx, 0x30(%rsp)
movq %r8, 0x28(%rsp)
movsd 0x48(%rsp), %xmm1
movsd 0x40(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x293f6
jmp 0x29381
movsd 0x48(%rsp), %xmm0
movsd 0x40(%rsp), %xmm1
xorl %eax, %eax
movl %eax, %esi
leaq 0x1ab0c5(%rip), %rdx    # 0x1d445d
leaq 0x1ab0e8(%rip), %rcx    # 0x1d4487
movl $0xbb6, %r8d            # imm = 0xBB6
movq %rsi, %rdi
movb $0x2, %al
callq 0x8540
movl %eax, 0x4(%rsp)
movq 0x28(%rsp), %rdi
movl 0x4(%rsp), %eax
addl $0x1, %eax
movslq %eax, %rsi
movsd 0x48(%rsp), %xmm0
movsd 0x40(%rsp), %xmm1
leaq 0x1ab088(%rip), %rdx    # 0x1d445d
leaq 0x1ab0ab(%rip), %rcx    # 0x1d4487
movl $0xbb6, %r8d            # imm = 0xBB6
movb $0x2, %al
callq 0x8540
movl $0x1, 0x64(%rsp)
jmp 0x29580
movsd 0x48(%rsp), %xmm0
ucomisd 0x38(%rsp), %xmm0
jbe 0x29479
jmp 0x29406
movsd 0x48(%rsp), %xmm0
movsd 0x38(%rsp), %xmm1
xorl %eax, %eax
movl %eax, %esi
leaq 0x1ab082(%rip), %rdx    # 0x1d449f
leaq 0x1ab063(%rip), %rcx    # 0x1d4487
movl $0xbbb, %r8d            # imm = 0xBBB
movq %rsi, %rdi
movb $0x2, %al
callq 0x8540
movl %eax, (%rsp)
movq 0x28(%rsp), %rdi
movl (%rsp), %eax
addl $0x1, %eax
movslq %eax, %rsi
movsd 0x48(%rsp), %xmm0
movsd 0x38(%rsp), %xmm1
leaq 0x1ab047(%rip), %rdx    # 0x1d449f
leaq 0x1ab028(%rip), %rcx    # 0x1d4487
movl $0xbbb, %r8d            # imm = 0xBBB
movb $0x2, %al
callq 0x8540
movl $0x1, 0x64(%rsp)
jmp 0x29580
movsd 0x38(%rsp), %xmm0
subsd 0x40(%rsp), %xmm0
movl 0x50(%rsp), %eax
subl $0x1, %eax
cvtsi2sd %eax, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x48(%rsp), %xmm0
subsd 0x40(%rsp), %xmm0
divsd 0x18(%rsp), %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0x24(%rsp)
cvtsi2sdl 0x24(%rsp), %xmm0
mulsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x48(%rsp), %xmm0
subsd 0x10(%rsp), %xmm0
divsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movl $0x0, 0x20(%rsp)
movl 0x20(%rsp), %eax
cmpl 0x54(%rsp), %eax
jge 0x29578
movq 0x58(%rsp), %rax
movl 0x54(%rsp), %ecx
imull 0x24(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x20(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd 0x1a8d2a(%rip), %xmm2   # 0x1d2248
subsd 0x8(%rsp), %xmm2
movq 0x58(%rsp), %rax
movl 0x54(%rsp), %ecx
movl 0x24(%rsp), %edx
addl $0x1, %edx
imull %edx, %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x20(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
mulsd 0x8(%rsp), %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 0x294e6
movl $0x0, 0x64(%rsp)
movl 0x64(%rsp), %eax
addq $0x68, %rsp
retq
nopl (%rax)