// File: /workspace/github_c_makefile_star2_O0/PoulinV[P]AxiCLASS/build/../tools/arrays.c
// Function: array_interpolate_logspline(double*, int, double*, double*, int, double, int*, double*, int, char*)
int array_interpolate_logspline(
							 double * x_array,
							 int n_lines,
							 double * array,
							 double * array_logsplined,
							 int n_columns,
							 double x,
							 int * last_index,
							 double * result,
							 int result_size, /** from 1 to n_columns */
							 ErrorMsg errmsg) {

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

	inf=0;
	sup=n_lines-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;}

		}

	}

	*last_index = inf;

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

	for (i=0; i<result_size; i++)
		*(result+i) = exp(
		a * log(array[inf*n_columns+i]) +
		b * log(array[sup*n_columns+i]) +
		((a*a*a-a)* array_logsplined[inf*n_columns+i] +
		 (b*b*b-b)* array_logsplined[sup*n_columns+i])*h*h/6.);

	return _SUCCESS_;
}

// Assembly:
subq $0xa8, %rsp
movq 0xc0(%rsp), %rax
movl 0xb8(%rsp), %eax
movq 0xb0(%rsp), %rax
movq %rdi, 0x98(%rsp)
movl %esi, 0x94(%rsp)
movq %rdx, 0x88(%rsp)
movq %rcx, 0x80(%rsp)
movl %r8d, 0x7c(%rsp)
movsd %xmm0, 0x70(%rsp)
movq %r9, 0x68(%rsp)
movl $0x0, 0x64(%rsp)
movl 0x94(%rsp), %eax
subl $0x1, %eax
movl %eax, 0x60(%rsp)
movq 0x98(%rsp), %rax
movslq 0x64(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
movq 0x98(%rsp), %rax
movslq 0x60(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x252f1
movsd 0x70(%rsp), %xmm1
movq 0x98(%rsp), %rax
movslq 0x64(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x251d8
jmp 0x25145
movsd 0x70(%rsp), %xmm0
movq 0x98(%rsp), %rax
movslq 0x64(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
xorl %eax, %eax
movl %eax, %esi
leaq 0x1aef9e(%rip), %rdx    # 0x1d4106
leaq 0x1af07f(%rip), %rcx    # 0x1d41ee
movl $0x806, %r8d            # imm = 0x806
movq %rsi, %rdi
movb $0x2, %al
callq 0x8540
movl %eax, 0x3c(%rsp)
movq 0xc0(%rsp), %rdi
movl 0x3c(%rsp), %eax
addl $0x1, %eax
movslq %eax, %rsi
movsd 0x70(%rsp), %xmm0
movq 0x98(%rsp), %rax
movslq 0x64(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
leaq 0x1aef52(%rip), %rdx    # 0x1d4106
leaq 0x1af033(%rip), %rcx    # 0x1d41ee
movl $0x806, %r8d            # imm = 0x806
movb $0x2, %al
callq 0x8540
movl $0x1, 0xa4(%rsp)
jmp 0x256fb
movsd 0x70(%rsp), %xmm0
movq 0x98(%rsp), %rax
movslq 0x60(%rsp), %rcx
ucomisd (%rax,%rcx,8), %xmm0
jbe 0x2528b
jmp 0x251f8
movsd 0x70(%rsp), %xmm0
movq 0x98(%rsp), %rax
movslq 0x60(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
xorl %eax, %eax
movl %eax, %esi
leaq 0x1aef18(%rip), %rdx    # 0x1d4133
leaq 0x1aefcc(%rip), %rcx    # 0x1d41ee
movl $0x80b, %r8d            # imm = 0x80B
movq %rsi, %rdi
movb $0x2, %al
callq 0x8540
movl %eax, 0x38(%rsp)
movq 0xc0(%rsp), %rdi
movl 0x38(%rsp), %eax
addl $0x1, %eax
movslq %eax, %rsi
movsd 0x70(%rsp), %xmm0
movq 0x98(%rsp), %rax
movslq 0x60(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
leaq 0x1aeecc(%rip), %rdx    # 0x1d4133
leaq 0x1aef80(%rip), %rcx    # 0x1d41ee
movl $0x80b, %r8d            # imm = 0x80B
movb $0x2, %al
callq 0x8540
movl $0x1, 0xa4(%rsp)
jmp 0x256fb
jmp 0x2528d
movl 0x60(%rsp), %eax
subl 0x64(%rsp), %eax
cmpl $0x1, %eax
jle 0x252ec
movl 0x64(%rsp), %eax
addl 0x60(%rsp), %eax
cvtsi2sd %eax, %xmm1
movsd 0x1ad9da(%rip), %xmm0   # 0x1d2c88
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0x5c(%rsp)
movsd 0x70(%rsp), %xmm1
movq 0x98(%rsp), %rax
movslq 0x5c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x252e2
movl 0x5c(%rsp), %eax
movl %eax, 0x60(%rsp)
jmp 0x252ea
movl 0x5c(%rsp), %eax
movl %eax, 0x64(%rsp)
jmp 0x2528d
jmp 0x254ba
movsd 0x70(%rsp), %xmm1
movq 0x98(%rsp), %rax
movslq 0x60(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x253a8
jmp 0x25315
movsd 0x70(%rsp), %xmm0
movq 0x98(%rsp), %rax
movslq 0x60(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
xorl %eax, %eax
movl %eax, %esi
leaq 0x1aedce(%rip), %rdx    # 0x1d4106
leaq 0x1aeeaf(%rip), %rcx    # 0x1d41ee
movl $0x81c, %r8d            # imm = 0x81C
movq %rsi, %rdi
movb $0x2, %al
callq 0x8540
movl %eax, 0x34(%rsp)
movq 0xc0(%rsp), %rdi
movl 0x34(%rsp), %eax
addl $0x1, %eax
movslq %eax, %rsi
movsd 0x70(%rsp), %xmm0
movq 0x98(%rsp), %rax
movslq 0x60(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
leaq 0x1aed82(%rip), %rdx    # 0x1d4106
leaq 0x1aee63(%rip), %rcx    # 0x1d41ee
movl $0x81c, %r8d            # imm = 0x81C
movb $0x2, %al
callq 0x8540
movl $0x1, 0xa4(%rsp)
jmp 0x256fb
movsd 0x70(%rsp), %xmm0
movq 0x98(%rsp), %rax
movslq 0x64(%rsp), %rcx
ucomisd (%rax,%rcx,8), %xmm0
jbe 0x2545b
jmp 0x253c8
movsd 0x70(%rsp), %xmm0
movq 0x98(%rsp), %rax
movslq 0x64(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
xorl %eax, %eax
movl %eax, %esi
leaq 0x1aed48(%rip), %rdx    # 0x1d4133
leaq 0x1aedfc(%rip), %rcx    # 0x1d41ee
movl $0x821, %r8d            # imm = 0x821
movq %rsi, %rdi
movb $0x2, %al
callq 0x8540
movl %eax, 0x30(%rsp)
movq 0xc0(%rsp), %rdi
movl 0x30(%rsp), %eax
addl $0x1, %eax
movslq %eax, %rsi
movsd 0x70(%rsp), %xmm0
movq 0x98(%rsp), %rax
movslq 0x64(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
leaq 0x1aecfc(%rip), %rdx    # 0x1d4133
leaq 0x1aedb0(%rip), %rcx    # 0x1d41ee
movl $0x821, %r8d            # imm = 0x821
movb $0x2, %al
callq 0x8540
movl $0x1, 0xa4(%rsp)
jmp 0x256fb
jmp 0x2545d
movl 0x60(%rsp), %eax
subl 0x64(%rsp), %eax
cmpl $0x1, %eax
jle 0x254b8
movl 0x64(%rsp), %eax
addl 0x60(%rsp), %eax
cvtsi2sd %eax, %xmm1
movsd 0x1ad80a(%rip), %xmm0   # 0x1d2c88
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0x5c(%rsp)
movsd 0x70(%rsp), %xmm0
movq 0x98(%rsp), %rax
movslq 0x5c(%rsp), %rcx
ucomisd (%rax,%rcx,8), %xmm0
jbe 0x254ae
movl 0x5c(%rsp), %eax
movl %eax, 0x60(%rsp)
jmp 0x254b6
movl 0x5c(%rsp), %eax
movl %eax, 0x64(%rsp)
jmp 0x2545d
jmp 0x254ba
movl 0x64(%rsp), %ecx
movq 0x68(%rsp), %rax
movl %ecx, (%rax)
movq 0x98(%rsp), %rax
movslq 0x60(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
callq 0x82f0
movsd %xmm0, 0x20(%rsp)
movq 0x98(%rsp), %rax
movslq 0x64(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
callq 0x82f0
movaps %xmm0, %xmm1
movsd 0x20(%rsp), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, 0x50(%rsp)
movsd 0x70(%rsp), %xmm0
callq 0x82f0
movsd %xmm0, 0x28(%rsp)
movq 0x98(%rsp), %rax
movslq 0x64(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
callq 0x82f0
movaps %xmm0, %xmm1
movsd 0x28(%rsp), %xmm0
subsd %xmm1, %xmm0
divsd 0x50(%rsp), %xmm0
movsd %xmm0, 0x40(%rsp)
movsd 0x1accf3(%rip), %xmm0   # 0x1d2248
subsd 0x40(%rsp), %xmm0
movsd %xmm0, 0x48(%rsp)
movl $0x0, 0x58(%rsp)
movl 0x58(%rsp), %eax
cmpl 0xb8(%rsp), %eax
jge 0x256f0
movsd 0x48(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
movq 0x88(%rsp), %rax
movl 0x64(%rsp), %ecx
imull 0x7c(%rsp), %ecx
addl 0x58(%rsp), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
callq 0x82f0
movsd %xmm0, 0x10(%rsp)
movsd 0x40(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movq 0x88(%rsp), %rax
movl 0x60(%rsp), %ecx
imull 0x7c(%rsp), %ecx
addl 0x58(%rsp), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
callq 0x82f0
movsd 0x8(%rsp), %xmm1
movsd 0x10(%rsp), %xmm2
movaps %xmm0, %xmm3
movsd 0x18(%rsp), %xmm0
mulsd %xmm3, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd 0x48(%rsp), %xmm1
mulsd 0x48(%rsp), %xmm1
movsd 0x48(%rsp), %xmm3
movsd 0x48(%rsp), %xmm2
movq %xmm2, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm2
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
movq 0x80(%rsp), %rax
movl 0x64(%rsp), %ecx
imull 0x7c(%rsp), %ecx
addl 0x58(%rsp), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm3
movsd 0x40(%rsp), %xmm2
mulsd 0x40(%rsp), %xmm2
movsd 0x40(%rsp), %xmm5
movsd 0x40(%rsp), %xmm4
movq %xmm4, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm4
mulsd %xmm5, %xmm2
addsd %xmm4, %xmm2
movq 0x80(%rsp), %rax
movl 0x60(%rsp), %ecx
imull 0x7c(%rsp), %ecx
addl 0x58(%rsp), %ecx
movslq %ecx, %rcx
mulsd (%rax,%rcx,8), %xmm2
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
mulsd 0x50(%rsp), %xmm1
mulsd 0x50(%rsp), %xmm1
movsd 0x1adfc7(%rip), %xmm2   # 0x1d3688
divsd %xmm2, %xmm1
addsd %xmm1, %xmm0
callq 0x8670
movq 0xb0(%rsp), %rax
movslq 0x58(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl 0x58(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x58(%rsp)
jmp 0x25569
movl $0x0, 0xa4(%rsp)
movl 0xa4(%rsp), %eax
addq $0xa8, %rsp
retq
nopw (%rax,%rax)