// File: /workspace/github_c_makefile_star2_O0/PoulinV[P]AxiCLASS/build/../tools/arrays.c
// Function: array_interpolate_two_arrays_one_column
int array_interpolate_two_arrays_one_column(
					    double * array_x, /* assumed to be a vector (i.e. one column array) */
					    double * array_y,
					    int n_columns_y,
					    int index_y, /* between 0 and (n_columns_y-1) */
					    int n_lines,  /** must be the same for array_x and array_y */
					    double x,
					    double * result,
					    ErrorMsg errmsg) {

  int inf,sup,mid;
  double weight;
  double epsilon=1e-9;

  inf=0;
  sup=n_lines-1;

  if (array_x[inf] < array_x[sup]){

    class_test(x < array_x[inf]-epsilon,
	       errmsg,
	       "x=%e < x_min=%e",x,array_x[inf]);

    class_test(x > array_x[sup]+epsilon,
	       errmsg,
	       "x=%e > x_max=%e",x,array_x[sup]);

    while (sup-inf > 1) {

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

    }

  }

  else {

    class_test(x < array_x[sup]-epsilon,
	       errmsg,
	       "x=%e < x_min=%e",x,array_x[sup]);

    class_test(x > array_x[inf]+epsilon,
	       errmsg,
	       "x=%e > x_max=%e",x,array_x[inf]);

    while (sup-inf > 1) {

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

    }

  }

  weight=(x-array_x[inf])/(array_x[sup]-array_x[inf]);

  *result = array_y[index_y*n_lines+inf] * (1.-weight)
    + weight * array_y[index_y*n_lines+sup];

  return _SUCCESS_;
}

// Assembly:
subq $0x4058, %rsp           # imm = 0x4058
movq 0x4060(%rsp), %rax
movq %rdi, 0x4048(%rsp)
movq %rsi, 0x4040(%rsp)
movl %edx, 0x403c(%rsp)
movl %ecx, 0x4038(%rsp)
movl %r8d, 0x4034(%rsp)
movsd %xmm0, 0x4028(%rsp)
movq %r9, 0x4020(%rsp)
movsd 0x1aa8ba(%rip), %xmm0   # 0x1d36a8
movsd %xmm0, 0x4000(%rsp)
movl $0x0, 0x401c(%rsp)
movl 0x4034(%rsp), %eax
subl $0x1, %eax
movl %eax, 0x4018(%rsp)
movq 0x4048(%rsp), %rax
movslq 0x401c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
movq 0x4048(%rsp), %rax
movslq 0x4018(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x29056
movsd 0x4028(%rsp), %xmm1
movq 0x4048(%rsp), %rax
movslq 0x401c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
subsd 0x4000(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x28f0b
leaq 0x3800(%rsp), %rdi
movsd 0x4028(%rsp), %xmm0
movq 0x4048(%rsp), %rax
movslq 0x401c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
leaq 0x1ab26c(%rip), %rsi    # 0x1d4111
movb $0x2, %al
callq 0x5b9c0
leaq 0x3000(%rsp), %rdi
leaq 0x3800(%rsp), %rcx
leaq 0x1a91bf(%rip), %rsi    # 0x1d2082
leaq 0x1ab507(%rip), %rdx    # 0x1d43d1
movb $0x0, %al
callq 0x5b9c0
movq 0x4060(%rsp), %rdi
leaq 0x3000(%rsp), %r8
leaq 0x1a914c(%rip), %rsi    # 0x1d2034
leaq 0x1ab4fb(%rip), %rdx    # 0x1d43ea
movl $0xb79, %ecx            # imm = 0xB79
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x4054(%rsp)
jmp 0x2932e
movsd 0x4028(%rsp), %xmm0
movq 0x4048(%rsp), %rax
movslq 0x4018(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
addsd 0x4000(%rsp), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x28fcf
leaq 0x2800(%rsp), %rdi
movsd 0x4028(%rsp), %xmm0
movq 0x4048(%rsp), %rax
movslq 0x4018(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
leaq 0x1ab1d5(%rip), %rsi    # 0x1d413e
movb $0x2, %al
callq 0x5b9c0
leaq 0x2000(%rsp), %rdi
leaq 0x2800(%rsp), %rcx
leaq 0x1a90fb(%rip), %rsi    # 0x1d2082
leaq 0x1ab484(%rip), %rdx    # 0x1d4412
movb $0x0, %al
callq 0x5b9c0
movq 0x4060(%rsp), %rdi
leaq 0x2000(%rsp), %r8
leaq 0x1a9088(%rip), %rsi    # 0x1d2034
leaq 0x1ab437(%rip), %rdx    # 0x1d43ea
movl $0xb7d, %ecx            # imm = 0xB7D
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x4054(%rsp)
jmp 0x2932e
jmp 0x28fd1
movl 0x4018(%rsp), %eax
subl 0x401c(%rsp), %eax
cmpl $0x1, %eax
jle 0x29051
movl 0x401c(%rsp), %eax
addl 0x4018(%rsp), %eax
cvtsi2sd %eax, %xmm1
movsd 0x1a9c8a(%rip), %xmm0   # 0x1d2c88
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0x4014(%rsp)
movsd 0x4028(%rsp), %xmm1
movq 0x4048(%rsp), %rax
movslq 0x4014(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x29041
movl 0x4014(%rsp), %eax
movl %eax, 0x4018(%rsp)
jmp 0x2904f
movl 0x4014(%rsp), %eax
movl %eax, 0x401c(%rsp)
jmp 0x28fd1
jmp 0x29254
movsd 0x4028(%rsp), %xmm1
movq 0x4048(%rsp), %rax
movslq 0x4018(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
subsd 0x4000(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x2911a
leaq 0x1800(%rsp), %rdi
movsd 0x4028(%rsp), %xmm0
movq 0x4048(%rsp), %rax
movslq 0x4018(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
leaq 0x1ab05d(%rip), %rsi    # 0x1d4111
movb $0x2, %al
callq 0x5b9c0
leaq 0x1000(%rsp), %rdi
leaq 0x1800(%rsp), %rcx
leaq 0x1a8fb0(%rip), %rsi    # 0x1d2082
leaq 0x1ab352(%rip), %rdx    # 0x1d442b
movb $0x0, %al
callq 0x5b9c0
movq 0x4060(%rsp), %rdi
leaq 0x1000(%rsp), %r8
leaq 0x1a8f3d(%rip), %rsi    # 0x1d2034
leaq 0x1ab2ec(%rip), %rdx    # 0x1d43ea
movl $0xb8d, %ecx            # imm = 0xB8D
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x4054(%rsp)
jmp 0x2932e
movsd 0x4028(%rsp), %xmm0
movq 0x4048(%rsp), %rax
movslq 0x401c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
addsd 0x4000(%rsp), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x291d4
leaq 0x800(%rsp), %rdi
movsd 0x4028(%rsp), %xmm0
movq 0x4048(%rsp), %rax
movslq 0x401c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
leaq 0x1aafc6(%rip), %rsi    # 0x1d413e
movb $0x2, %al
callq 0x5b9c0
movq %rsp, %rdi
leaq 0x800(%rsp), %rcx
leaq 0x1a8ef1(%rip), %rsi    # 0x1d2082
leaq 0x1ab2ac(%rip), %rdx    # 0x1d4444
movb $0x0, %al
callq 0x5b9c0
movq 0x4060(%rsp), %rdi
movq %rsp, %r8
leaq 0x1a8e83(%rip), %rsi    # 0x1d2034
leaq 0x1ab232(%rip), %rdx    # 0x1d43ea
movl $0xb91, %ecx            # imm = 0xB91
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x4054(%rsp)
jmp 0x2932e
jmp 0x291d6
movl 0x4018(%rsp), %eax
subl 0x401c(%rsp), %eax
cmpl $0x1, %eax
jle 0x29252
movl 0x401c(%rsp), %eax
addl 0x4018(%rsp), %eax
cvtsi2sd %eax, %xmm1
movsd 0x1a9a85(%rip), %xmm0   # 0x1d2c88
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0x4014(%rsp)
movsd 0x4028(%rsp), %xmm0
movq 0x4048(%rsp), %rax
movslq 0x4014(%rsp), %rcx
ucomisd (%rax,%rcx,8), %xmm0
jbe 0x29242
movl 0x4014(%rsp), %eax
movl %eax, 0x4018(%rsp)
jmp 0x29250
movl 0x4014(%rsp), %eax
movl %eax, 0x401c(%rsp)
jmp 0x291d6
jmp 0x29254
movsd 0x4028(%rsp), %xmm0
movq 0x4048(%rsp), %rax
movslq 0x401c(%rsp), %rcx
subsd (%rax,%rcx,8), %xmm0
movq 0x4048(%rsp), %rax
movslq 0x4018(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
movq 0x4048(%rsp), %rax
movslq 0x401c(%rsp), %rcx
subsd (%rax,%rcx,8), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x4008(%rsp)
movq 0x4040(%rsp), %rax
movl 0x4038(%rsp), %ecx
imull 0x4034(%rsp), %ecx
addl 0x401c(%rsp), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movsd 0x1a8f71(%rip), %xmm2   # 0x1d2248
subsd 0x4008(%rsp), %xmm2
movsd 0x4008(%rsp), %xmm1
movq 0x4040(%rsp), %rax
movl 0x4038(%rsp), %ecx
imull 0x4034(%rsp), %ecx
addl 0x4018(%rsp), %ecx
movslq %ecx, %rcx
mulsd (%rax,%rcx,8), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movq 0x4020(%rsp), %rax
movsd %xmm0, (%rax)
movl $0x0, 0x4054(%rsp)
movl 0x4054(%rsp), %eax
addq $0x4058, %rsp           # imm = 0x4058
retq
nopl (%rax)