// File: /workspace/github_c_makefile_star2_O1/PoulinV[P]AxiCLASS/build/../tools/arrays.c
// Function: array_interpolate_two_bis
int array_interpolate_two_bis(
		   double * array_x,
		   int n_columns_x,
		   int index_x,   /** from 0 to (n_columns_x-1) */
		   double * array_y,
		   int n_columns_y,
		   int n_lines,  /** must be the same for array_x and array_y */
		   double x,
		   double * result,
		   int result_size, /** from 1 to n_columns_y */
		   ErrorMsg errmsg) {

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

  inf=0;
  sup=n_lines-1;

  if (array_x[inf*n_columns_x+index_x] < array_x[sup*n_columns_x+index_x]){

    if (x < array_x[inf*n_columns_x+index_x]) {

      class_sprintf(errmsg,"%s(L:%d) : x=%e < x_min=%e",__func__,__LINE__,x,array_x[inf*n_columns_x+index_x]);
      return _FAILURE_;
    }

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

    while (sup-inf > 1) {

      mid=(int)(0.5*(inf+sup));
      if (x < array_x[mid*n_columns_x+index_x]) {sup=mid;}
      else {inf=mid;}

    }

  }

  else {

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

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

    while (sup-inf > 1) {

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

    }

  }

  weight=(x-*(array_x+inf*n_columns_x+index_x))/(*(array_x+sup*n_columns_x+index_x)-*(array_x+inf*n_columns_x+index_x));

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

  return _SUCCESS_;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x50(%rsp), %r14
leal -0x1(%r9), %eax
movslq %edx, %r13
movsd (%rdi,%r13,8), %xmm1
movl %eax, %edi
imull %esi, %edi
leal (%rdi,%r13), %r10d
movslq %r10d, %rbp
movsd (%rbx,%rbp,8), %xmm2
ucomisd %xmm1, %xmm2
jbe 0x1a2d9
ucomisd %xmm0, %xmm1
jbe 0x1a33d
leaq 0xd8e78(%rip), %r15     # 0xf310f
leaq 0xd9122(%rip), %r12     # 0xf33c0
xorl %edi, %edi
xorl %esi, %esi
movq %r15, %rdx
movq %r12, %rcx
movl $0xb2c, %r8d            # imm = 0xB2C
movb $0x2, %al
movsd %xmm0, (%rsp)
callq 0x8550
incl %eax
movslq %eax, %rsi
movsd (%rbx,%r13,8), %xmm1
movq %r14, %rdi
movq %r15, %rdx
movq %r12, %rcx
movl $0xb2c, %r8d            # imm = 0xB2C
jmp 0x1a3de
movslq %edi, %rdx
leaq (%rbx,%rdx,8), %r12
movsd (%r12,%r13,8), %xmm2
ucomisd %xmm0, %xmm2
jbe 0x1a390
leaq 0xd8e18(%rip), %rbx     # 0xf310f
leaq 0xd90c2(%rip), %r15     # 0xf33c0
xorl %edi, %edi
xorl %esi, %esi
movq %rbx, %rdx
movq %r15, %rcx
movl $0xb42, %r8d            # imm = 0xB42
movapd %xmm2, %xmm1
movb $0x2, %al
movsd %xmm0, (%rsp)
callq 0x8550
incl %eax
movslq %eax, %rsi
movsd (%r12,%r13,8), %xmm1
movq %r14, %rdi
movq %rbx, %rdx
movq %r15, %rcx
movl $0xb42, %r8d            # imm = 0xB42
jmp 0x1a3de
ucomisd %xmm2, %xmm0
jbe 0x1a3fe
leaq 0xd8dee(%rip), %r15     # 0xf313c
leaq 0xd906b(%rip), %r12     # 0xf33c0
xorl %edi, %edi
xorl %esi, %esi
movq %r15, %rdx
movq %r12, %rcx
movl $0xb31, %r8d            # imm = 0xB31
movapd %xmm2, %xmm1
movb $0x2, %al
movsd %xmm0, (%rsp)
callq 0x8550
incl %eax
movslq %eax, %rsi
movsd (%rbx,%rbp,8), %xmm1
movq %r14, %rdi
movq %r15, %rdx
movq %r12, %rcx
movl $0xb31, %r8d            # imm = 0xB31
jmp 0x1a3de
ucomisd %xmm1, %xmm0
jbe 0x1a455
leaq 0xd8d9b(%rip), %r15     # 0xf313c
leaq 0xd9018(%rip), %r12     # 0xf33c0
xorl %edi, %edi
xorl %esi, %esi
movq %r15, %rdx
movq %r12, %rcx
movl $0xb47, %r8d            # imm = 0xB47
movb $0x2, %al
movsd %xmm0, (%rsp)
callq 0x8550
incl %eax
movslq %eax, %rsi
movsd (%rbx,%r13,8), %xmm1
movq %r14, %rdi
movq %r15, %rdx
movq %r12, %rcx
movl $0xb47, %r8d            # imm = 0xB47
movsd (%rsp), %xmm0
movb $0x2, %al
callq 0x8550
movl $0x1, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x3, %r9d
jl 0x1a4a5
xorl %r9d, %r9d
movsd 0xd78bd(%rip), %xmm2    # 0xf1cd0
leal (%r9,%rax), %edi
xorps %xmm1, %xmm1
cvtsi2sd %edi, %xmm1
mulsd %xmm2, %xmm1
cvttsd2si %xmm1, %edi
movl %edi, %r10d
imull %esi, %r10d
addl %edx, %r10d
movslq %r10d, %r10
movsd (%rbx,%r10,8), %xmm1
ucomisd %xmm0, %xmm1
cmoval %edi, %eax
cmoval %r9d, %edi
movl %eax, %r10d
subl %edi, %r10d
movl %edi, %r9d
cmpl $0x1, %r10d
jg 0x1a413
jmp 0x1a4a7
cmpl $0x3, %r9d
jl 0x1a4a5
leaq (%rbx,%r13,8), %rdx
xorl %r9d, %r9d
movsd 0xd7866(%rip), %xmm2    # 0xf1cd0
leal (%r9,%rax), %edi
xorps %xmm1, %xmm1
cvtsi2sd %edi, %xmm1
mulsd %xmm2, %xmm1
cvttsd2si %xmm1, %edi
movl %edi, %r10d
imull %esi, %r10d
movslq %r10d, %r10
ucomisd (%rdx,%r10,8), %xmm0
cmoval %edi, %eax
cmoval %r9d, %edi
movl %eax, %r10d
subl %edi, %r10d
movl %edi, %r9d
cmpl $0x1, %r10d
jg 0x1a46a
jmp 0x1a4a7
xorl %edi, %edi
movl 0x48(%rsp), %r9d
testl %r9d, %r9d
jle 0x1a53e
movq 0x40(%rsp), %rdx
movl %edi, %r10d
imull %esi, %r10d
movslq %r10d, %r10
leaq (%rbx,%r10,8), %r10
movsd (%r10,%r13,8), %xmm2
subsd %xmm2, %xmm0
imull %eax, %esi
movslq %esi, %rsi
leaq (%rbx,%rsi,8), %rsi
movsd (%rsi,%r13,8), %xmm1
subsd %xmm2, %xmm1
divsd %xmm1, %xmm0
imull %r8d, %edi
movslq %edi, %rsi
leaq (%rcx,%rsi,8), %rsi
movsd 0xd6d63(%rip), %xmm3    # 0xf1260
subsd %xmm0, %xmm3
imull %r8d, %eax
cltq
leaq (%rcx,%rax,8), %rcx
movl %r9d, %edi
xorl %eax, %eax
xorl %r8d, %r8d
movsd (%rcx,%r8,8), %xmm1
mulsd %xmm0, %xmm1
movsd (%rsi,%r8,8), %xmm2
mulsd %xmm3, %xmm2
addsd %xmm1, %xmm2
movsd %xmm2, (%rdx,%r8,8)
incq %r8
cmpq %r8, %rdi
jne 0x1a513
jmp 0x1a3ef
xorl %eax, %eax
jmp 0x1a3ef