// File: /workspace/github_c_makefile_star2_O0/PoulinV[P]AxiCLASS/build/../tools/arrays.c
// Function: array_interpolate_extrapolate_logspline_loglinear_one_column
int array_interpolate_extrapolate_logspline_loglinear_one_column(
								 double * x_array,
								 int x_size,
								 int x_stop,
								 double * y_array, /* array of size x_size*y_size with elements
										      y_array[index_y*x_size+index_x] */
								 int y_size,
								 int index_y,
								 double * ddlogy_array, /* array of size x_size*y_size */
								 double x,   /* input */
								 double * y, /* output */
								 ErrorMsg errmsg
								 ) {


  int inf,sup,mid;
  double h,a,b;

  if (x > x_array[x_stop-1]) {

    /*interpolate/extrapolate linearly ln(y) as a function of ln(x)*/

    h = log(x_array[x_stop-1]) - log(x_array[x_stop-2]);
    b = (log(x)-log(x_array[x_stop-2]))/h;
    a = 1-b;

/*     *y = exp(a * log(y_array[index_y * x_size + (x_stop-2)]) + */
/* 	     b * log(y_array[index_y * x_size + (x_stop-1)])); */

    *y = exp(log(y_array[index_y * x_size + (x_stop-1)])
	     +(log(x)-log(x_array[x_stop-1]))
	     *((log(y_array[index_y * x_size + (x_stop-1)])-log(y_array[index_y * x_size + (x_stop-2)]))/h
	       +h/6.*(ddlogy_array[index_y * x_size + (x_stop-2)]+2.*ddlogy_array[index_y * x_size + (x_stop-1)])));


  }

  else {

    /*interpolate ln(y) as a function of ln(x) with a spline*/

    inf=0;
    sup=x_stop-1;

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

      if (x < x_array[inf]) {
	class_sprintf(errmsg,"%s(L:%d) : x=%e < x_min=%e",__func__,__LINE__,x,x_array[inf]);
	return _FAILURE_;
      }

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

      while (sup-inf > 1) {

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

      }

    }

    else {

      if (x < x_array[sup]) {
	class_sprintf(errmsg,"%s(L:%d) : x=%e < x_min=%e",__func__,__LINE__,x,x_array[sup]);
	return _FAILURE_;
      }

      if (x > x_array[inf]) {
	class_sprintf(errmsg,"%s(L:%d) : x=%e > x_max=%e",__func__,__LINE__,x,x_array[inf]);
	return _FAILURE_;
      }

      while (sup-inf > 1) {

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

      }

    }

    h = log(x_array[sup]) - log(x_array[inf]);
    b = (log(x)-log(x_array[inf]))/h;
    a = 1-b;

    *y = exp(a * log(y_array[index_y * x_size + inf]) +
	     b * log(y_array[index_y * x_size + sup]) +
	     ((a*a*a-a)* ddlogy_array[index_y * x_size + inf] +
	      (b*b*b-b)* ddlogy_array[index_y * x_size + sup])*h*h/6.);

  }

  return _SUCCESS_;
}

// Assembly:
subq $0xc8, %rsp
movq 0xe0(%rsp), %rax
movq 0xd8(%rsp), %rax
movq 0xd0(%rsp), %rax
movq %rdi, 0xb8(%rsp)
movl %esi, 0xb4(%rsp)
movl %edx, 0xb0(%rsp)
movq %rcx, 0xa8(%rsp)
movl %r8d, 0xa4(%rsp)
movl %r9d, 0xa0(%rsp)
movsd %xmm0, 0x98(%rsp)
movsd 0x98(%rsp), %xmm0
movq 0xb8(%rsp), %rax
movl 0xb0(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
ucomisd (%rax,%rcx,8), %xmm0
jbe 0x265a9
movq 0xb8(%rsp), %rax
movl 0xb0(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
callq 0x82f0
movsd %xmm0, 0x30(%rsp)
movq 0xb8(%rsp), %rax
movl 0xb0(%rsp), %ecx
subl $0x2, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
callq 0x82f0
movaps %xmm0, %xmm1
movsd 0x30(%rsp), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, 0x80(%rsp)
movsd 0x98(%rsp), %xmm0
callq 0x82f0
movsd %xmm0, 0x38(%rsp)
movq 0xb8(%rsp), %rax
movl 0xb0(%rsp), %ecx
subl $0x2, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
callq 0x82f0
movaps %xmm0, %xmm1
movsd 0x38(%rsp), %xmm0
subsd %xmm1, %xmm0
divsd 0x80(%rsp), %xmm0
movsd %xmm0, 0x70(%rsp)
movsd 0x1abe48(%rip), %xmm0   # 0x1d2248
subsd 0x70(%rsp), %xmm0
movsd %xmm0, 0x78(%rsp)
movq 0xa8(%rsp), %rax
movl 0xa0(%rsp), %ecx
imull 0xb4(%rsp), %ecx
movl 0xb0(%rsp), %edx
subl $0x1, %edx
addl %edx, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
callq 0x82f0
movsd %xmm0, 0x50(%rsp)
movsd 0x98(%rsp), %xmm0
callq 0x82f0
movsd %xmm0, 0x40(%rsp)
movq 0xb8(%rsp), %rax
movl 0xb0(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
callq 0x82f0
movaps %xmm0, %xmm1
movsd 0x40(%rsp), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, 0x58(%rsp)
movq 0xa8(%rsp), %rax
movl 0xa0(%rsp), %ecx
imull 0xb4(%rsp), %ecx
movl 0xb0(%rsp), %edx
subl $0x1, %edx
addl %edx, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
callq 0x82f0
movsd %xmm0, 0x48(%rsp)
movq 0xa8(%rsp), %rax
movl 0xa0(%rsp), %ecx
imull 0xb4(%rsp), %ecx
movl 0xb0(%rsp), %edx
subl $0x2, %edx
addl %edx, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
callq 0x82f0
movsd 0x48(%rsp), %xmm3
movsd 0x50(%rsp), %xmm1
movaps %xmm0, %xmm2
movsd 0x58(%rsp), %xmm0
subsd %xmm2, %xmm3
divsd 0x80(%rsp), %xmm3
movsd 0x80(%rsp), %xmm2
movsd 0x1ad167(%rip), %xmm4   # 0x1d3688
divsd %xmm4, %xmm2
movq 0xd0(%rsp), %rax
movl 0xa0(%rsp), %ecx
imull 0xb4(%rsp), %ecx
movl 0xb0(%rsp), %edx
subl $0x2, %edx
addl %edx, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm5
movq 0xd0(%rsp), %rax
movl 0xa0(%rsp), %ecx
imull 0xb4(%rsp), %ecx
movl 0xb0(%rsp), %edx
subl $0x1, %edx
addl %edx, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm4
addsd %xmm4, %xmm4
addsd %xmm5, %xmm4
mulsd %xmm4, %xmm2
addsd %xmm3, %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x8670
movq 0xd8(%rsp), %rax
movsd %xmm0, (%rax)
jmp 0x26c54
movl $0x0, 0x94(%rsp)
movl 0xb0(%rsp), %eax
subl $0x1, %eax
movl %eax, 0x90(%rsp)
movq 0xb8(%rsp), %rax
movslq 0x94(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
movq 0xb8(%rsp), %rax
movslq 0x90(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x2680e
movsd 0x98(%rsp), %xmm1
movq 0xb8(%rsp), %rax
movslq 0x94(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x266c2
jmp 0x26623
movsd 0x98(%rsp), %xmm0
movq 0xb8(%rsp), %rax
movslq 0x94(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
xorl %eax, %eax
movl %eax, %esi
leaq 0x1adaba(%rip), %rdx    # 0x1d4106
leaq 0x1adc0b(%rip), %rcx    # 0x1d425e
movl $0x92b, %r8d            # imm = 0x92B
movq %rsi, %rdi
movb $0x2, %al
callq 0x8540
movl %eax, 0x6c(%rsp)
movq 0xe0(%rsp), %rdi
movl 0x6c(%rsp), %eax
addl $0x1, %eax
movslq %eax, %rsi
movsd 0x98(%rsp), %xmm0
movq 0xb8(%rsp), %rax
movslq 0x94(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
leaq 0x1ada68(%rip), %rdx    # 0x1d4106
leaq 0x1adbb9(%rip), %rcx    # 0x1d425e
movl $0x92b, %r8d            # imm = 0x92B
movb $0x2, %al
callq 0x8540
movl $0x1, 0xc4(%rsp)
jmp 0x26c5f
movsd 0x98(%rsp), %xmm0
movq 0xb8(%rsp), %rax
movslq 0x90(%rsp), %rcx
ucomisd (%rax,%rcx,8), %xmm0
jbe 0x26787
jmp 0x266e8
movsd 0x98(%rsp), %xmm0
movq 0xb8(%rsp), %rax
movslq 0x90(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
xorl %eax, %eax
movl %eax, %esi
leaq 0x1ada22(%rip), %rdx    # 0x1d4133
leaq 0x1adb46(%rip), %rcx    # 0x1d425e
movl $0x930, %r8d            # imm = 0x930
movq %rsi, %rdi
movb $0x2, %al
callq 0x8540
movl %eax, 0x68(%rsp)
movq 0xe0(%rsp), %rdi
movl 0x68(%rsp), %eax
addl $0x1, %eax
movslq %eax, %rsi
movsd 0x98(%rsp), %xmm0
movq 0xb8(%rsp), %rax
movslq 0x90(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
leaq 0x1ad9d0(%rip), %rdx    # 0x1d4133
leaq 0x1adaf4(%rip), %rcx    # 0x1d425e
movl $0x930, %r8d            # imm = 0x930
movb $0x2, %al
callq 0x8540
movl $0x1, 0xc4(%rsp)
jmp 0x26c5f
jmp 0x26789
movl 0x90(%rsp), %eax
subl 0x94(%rsp), %eax
cmpl $0x1, %eax
jle 0x26809
movl 0x94(%rsp), %eax
addl 0x90(%rsp), %eax
cvtsi2sd %eax, %xmm1
movsd 0x1ac4d2(%rip), %xmm0   # 0x1d2c88
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0x8c(%rsp)
movsd 0x98(%rsp), %xmm1
movq 0xb8(%rsp), %rax
movslq 0x8c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x267f9
movl 0x8c(%rsp), %eax
movl %eax, 0x90(%rsp)
jmp 0x26807
movl 0x8c(%rsp), %eax
movl %eax, 0x94(%rsp)
jmp 0x26789
jmp 0x26a1c
movsd 0x98(%rsp), %xmm1
movq 0xb8(%rsp), %rax
movslq 0x90(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x268d7
jmp 0x26838
movsd 0x98(%rsp), %xmm0
movq 0xb8(%rsp), %rax
movslq 0x90(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
xorl %eax, %eax
movl %eax, %esi
leaq 0x1ad8a5(%rip), %rdx    # 0x1d4106
leaq 0x1ad9f6(%rip), %rcx    # 0x1d425e
movl $0x941, %r8d            # imm = 0x941
movq %rsi, %rdi
movb $0x2, %al
callq 0x8540
movl %eax, 0x64(%rsp)
movq 0xe0(%rsp), %rdi
movl 0x64(%rsp), %eax
addl $0x1, %eax
movslq %eax, %rsi
movsd 0x98(%rsp), %xmm0
movq 0xb8(%rsp), %rax
movslq 0x90(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
leaq 0x1ad853(%rip), %rdx    # 0x1d4106
leaq 0x1ad9a4(%rip), %rcx    # 0x1d425e
movl $0x941, %r8d            # imm = 0x941
movb $0x2, %al
callq 0x8540
movl $0x1, 0xc4(%rsp)
jmp 0x26c5f
movsd 0x98(%rsp), %xmm0
movq 0xb8(%rsp), %rax
movslq 0x94(%rsp), %rcx
ucomisd (%rax,%rcx,8), %xmm0
jbe 0x2699c
jmp 0x268fd
movsd 0x98(%rsp), %xmm0
movq 0xb8(%rsp), %rax
movslq 0x94(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
xorl %eax, %eax
movl %eax, %esi
leaq 0x1ad80d(%rip), %rdx    # 0x1d4133
leaq 0x1ad931(%rip), %rcx    # 0x1d425e
movl $0x946, %r8d            # imm = 0x946
movq %rsi, %rdi
movb $0x2, %al
callq 0x8540
movl %eax, 0x60(%rsp)
movq 0xe0(%rsp), %rdi
movl 0x60(%rsp), %eax
addl $0x1, %eax
movslq %eax, %rsi
movsd 0x98(%rsp), %xmm0
movq 0xb8(%rsp), %rax
movslq 0x94(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
leaq 0x1ad7bb(%rip), %rdx    # 0x1d4133
leaq 0x1ad8df(%rip), %rcx    # 0x1d425e
movl $0x946, %r8d            # imm = 0x946
movb $0x2, %al
callq 0x8540
movl $0x1, 0xc4(%rsp)
jmp 0x26c5f
jmp 0x2699e
movl 0x90(%rsp), %eax
subl 0x94(%rsp), %eax
cmpl $0x1, %eax
jle 0x26a1a
movl 0x94(%rsp), %eax
addl 0x90(%rsp), %eax
cvtsi2sd %eax, %xmm1
movsd 0x1ac2bd(%rip), %xmm0   # 0x1d2c88
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0x8c(%rsp)
movsd 0x98(%rsp), %xmm0
movq 0xb8(%rsp), %rax
movslq 0x8c(%rsp), %rcx
ucomisd (%rax,%rcx,8), %xmm0
jbe 0x26a0a
movl 0x8c(%rsp), %eax
movl %eax, 0x90(%rsp)
jmp 0x26a18
movl 0x8c(%rsp), %eax
movl %eax, 0x94(%rsp)
jmp 0x2699e
jmp 0x26a1c
movq 0xb8(%rsp), %rax
movslq 0x90(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
callq 0x82f0
movsd %xmm0, 0x8(%rsp)
movq 0xb8(%rsp), %rax
movslq 0x94(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
callq 0x82f0
movaps %xmm0, %xmm1
movsd 0x8(%rsp), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, 0x80(%rsp)
movsd 0x98(%rsp), %xmm0
callq 0x82f0
movsd %xmm0, 0x10(%rsp)
movq 0xb8(%rsp), %rax
movslq 0x94(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
callq 0x82f0
movaps %xmm0, %xmm1
movsd 0x10(%rsp), %xmm0
subsd %xmm1, %xmm0
divsd 0x80(%rsp), %xmm0
movsd %xmm0, 0x70(%rsp)
movsd 0x1ab78a(%rip), %xmm0   # 0x1d2248
subsd 0x70(%rsp), %xmm0
movsd %xmm0, 0x78(%rsp)
movsd 0x78(%rsp), %xmm0
movsd %xmm0, 0x28(%rsp)
movq 0xa8(%rsp), %rax
movl 0xa0(%rsp), %ecx
imull 0xb4(%rsp), %ecx
addl 0x94(%rsp), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
callq 0x82f0
movsd %xmm0, 0x20(%rsp)
movsd 0x70(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
movq 0xa8(%rsp), %rax
movl 0xa0(%rsp), %ecx
imull 0xb4(%rsp), %ecx
addl 0x90(%rsp), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
callq 0x82f0
movsd 0x18(%rsp), %xmm1
movsd 0x20(%rsp), %xmm2
movaps %xmm0, %xmm3
movsd 0x28(%rsp), %xmm0
mulsd %xmm3, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd 0x78(%rsp), %xmm1
mulsd 0x78(%rsp), %xmm1
movsd 0x78(%rsp), %xmm3
movsd 0x78(%rsp), %xmm2
movq %xmm2, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm2
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
movq 0xd0(%rsp), %rax
movl 0xa0(%rsp), %ecx
imull 0xb4(%rsp), %ecx
addl 0x94(%rsp), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm3
movsd 0x70(%rsp), %xmm2
mulsd 0x70(%rsp), %xmm2
movsd 0x70(%rsp), %xmm5
movsd 0x70(%rsp), %xmm4
movq %xmm4, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm4
mulsd %xmm5, %xmm2
addsd %xmm4, %xmm2
movq 0xd0(%rsp), %rax
movl 0xa0(%rsp), %ecx
imull 0xb4(%rsp), %ecx
addl 0x90(%rsp), %ecx
movslq %ecx, %rcx
mulsd (%rax,%rcx,8), %xmm2
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
mulsd 0x80(%rsp), %xmm1
mulsd 0x80(%rsp), %xmm1
movsd 0x1aca4d(%rip), %xmm2   # 0x1d3688
divsd %xmm2, %xmm1
addsd %xmm1, %xmm0
callq 0x8670
movq 0xd8(%rsp), %rax
movsd %xmm0, (%rax)
movl $0x0, 0xc4(%rsp)
movl 0xc4(%rsp), %eax
addq $0xc8, %rsp
retq
nop