// File: /workspace/github_c_makefile_star2_O0/PoulinV[P]AxiCLASS/build/../tools/arrays.c
// Function: array_derive_spline
int array_derive_spline(
		 double * x_array,
		 int n_lines,
		 double * array,
		 double * array_splined,
		 int n_columns,
		 int index_y,
		 int index_dydx,
		 ErrorMsg errmsg) {

  int i;

  double h;

  class_test(index_dydx == index_y,
	     errmsg,
	     "Output column %d must differ from input columns %d",
	     index_dydx,
	     index_y);

  class_test(n_lines<2,
	     errmsg,
	     "no possible derivation with less than two lines");

  for (i=0; i<n_lines-1; i++) {

    h = x_array[i+1] - x_array[i];
    if (h == 0) {
      class_sprintf(errmsg,"%s(L:%d) h=0, stop to avoid division by zero",__func__,__LINE__);
      return _FAILURE_;
    }

    array[i*n_columns+index_dydx] =
      (array[(i+1)*n_columns+index_y] - array[i*n_columns+index_y])/h
      - h / 6. * (array_splined[(i+1)*n_columns+index_y] + 2. * array_splined[i*n_columns+index_y]);

  }

  h = x_array[n_lines-1] - x_array[n_lines-2];

  array[(n_lines-1)*n_columns+index_dydx] =
    (array[(n_lines-1)*n_columns+index_y] - array[(n_lines-2)*n_columns+index_y])/h
    + h / 6. * (2. * array_splined[(n_lines-1)*n_columns+index_y] + array_splined[(n_lines-2)*n_columns+index_y]);

  return _SUCCESS_;
}

// Assembly:
subq $0x2058, %rsp           # imm = 0x2058
movq 0x2068(%rsp), %rax
movl 0x2060(%rsp), %eax
movq %rdi, 0x2048(%rsp)
movl %esi, 0x2044(%rsp)
movq %rdx, 0x2038(%rsp)
movq %rcx, 0x2030(%rsp)
movl %r8d, 0x202c(%rsp)
movl %r9d, 0x2028(%rsp)
movl 0x2060(%rsp), %eax
cmpl 0x2028(%rsp), %eax
jne 0x1988c
leaq 0x1810(%rsp), %rdi
movl 0x2060(%rsp), %edx
movl 0x2028(%rsp), %ecx
leaq 0x1ba379(%rip), %rsi    # 0x1d3b9f
movb $0x0, %al
callq 0x5b9c0
leaq 0x1010(%rsp), %rdi
leaq 0x1810(%rsp), %rcx
leaq 0x1b883e(%rip), %rsi    # 0x1d2082
leaq 0x1ba387(%rip), %rdx    # 0x1d3bd2
movb $0x0, %al
callq 0x5b9c0
movq 0x2068(%rsp), %rdi
leaq 0x1010(%rsp), %r8
leaq 0x1b87cb(%rip), %rsi    # 0x1d2034
leaq 0x1ba378(%rip), %rdx    # 0x1d3be8
movl $0x49, %ecx
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x2054(%rsp)
jmp 0x19c3c
cmpl $0x2, 0x2044(%rsp)
jge 0x19905
leaq 0x810(%rsp), %rdi
leaq 0x1ba357(%rip), %rsi    # 0x1d3bfc
movb $0x0, %al
callq 0x5b9c0
leaq 0x10(%rsp), %rdi
leaq 0x810(%rsp), %rcx
leaq 0x1b87c2(%rip), %rsi    # 0x1d2082
leaq 0x1ba365(%rip), %rdx    # 0x1d3c2c
movb $0x0, %al
callq 0x5b9c0
movq 0x2068(%rsp), %rdi
leaq 0x10(%rsp), %r8
leaq 0x1b8752(%rip), %rsi    # 0x1d2034
leaq 0x1ba2ff(%rip), %rdx    # 0x1d3be8
movl $0x4d, %ecx
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x2054(%rsp)
jmp 0x19c3c
movl $0x0, 0x2024(%rsp)
movl 0x2024(%rsp), %eax
movl 0x2044(%rsp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x19af9
movq 0x2048(%rsp), %rax
movl 0x2024(%rsp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x2048(%rsp), %rax
movslq 0x2024(%rsp), %rcx
subsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x2018(%rsp)
movsd 0x2018(%rsp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x199da
jp 0x199da
jmp 0x19977
xorl %eax, %eax
movl %eax, %esi
leaq 0x1ba2b4(%rip), %rdx    # 0x1d3c36
leaq 0x1ba25f(%rip), %rcx    # 0x1d3be8
movl $0x53, %r8d
movq %rsi, %rdi
movb $0x0, %al
callq 0x8540
movl %eax, 0xc(%rsp)
movq 0x2068(%rsp), %rdi
movl 0xc(%rsp), %eax
addl $0x1, %eax
movslq %eax, %rsi
leaq 0x1ba280(%rip), %rdx    # 0x1d3c36
leaq 0x1ba22b(%rip), %rcx    # 0x1d3be8
movl $0x53, %r8d
movb $0x0, %al
callq 0x8540
movl $0x1, 0x2054(%rsp)
jmp 0x19c3c
movq 0x2038(%rsp), %rax
movl 0x2024(%rsp), %ecx
addl $0x1, %ecx
imull 0x202c(%rsp), %ecx
addl 0x2028(%rsp), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm1
movq 0x2038(%rsp), %rax
movl 0x2024(%rsp), %ecx
imull 0x202c(%rsp), %ecx
addl 0x2028(%rsp), %ecx
movslq %ecx, %rcx
subsd (%rax,%rcx,8), %xmm1
divsd 0x2018(%rsp), %xmm1
movsd 0x2018(%rsp), %xmm0
movsd 0x1b9c45(%rip), %xmm2   # 0x1d3688
divsd %xmm2, %xmm0
movq 0x2030(%rsp), %rax
movl 0x2024(%rsp), %ecx
addl $0x1, %ecx
imull 0x202c(%rsp), %ecx
addl 0x2028(%rsp), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm3
movq 0x2030(%rsp), %rax
movl 0x2024(%rsp), %ecx
imull 0x202c(%rsp), %ecx
addl 0x2028(%rsp), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm2
addsd %xmm2, %xmm2
addsd %xmm3, %xmm2
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movq 0x2038(%rsp), %rax
movl 0x2024(%rsp), %ecx
imull 0x202c(%rsp), %ecx
addl 0x2060(%rsp), %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movl 0x2024(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2024(%rsp)
jmp 0x19910
movq 0x2048(%rsp), %rax
movl 0x2044(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x2048(%rsp), %rax
movl 0x2044(%rsp), %ecx
subl $0x2, %ecx
movslq %ecx, %rcx
subsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x2018(%rsp)
movq 0x2038(%rsp), %rax
movl 0x2044(%rsp), %ecx
subl $0x1, %ecx
imull 0x202c(%rsp), %ecx
addl 0x2028(%rsp), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm1
movq 0x2038(%rsp), %rax
movl 0x2044(%rsp), %ecx
subl $0x2, %ecx
imull 0x202c(%rsp), %ecx
addl 0x2028(%rsp), %ecx
movslq %ecx, %rcx
subsd (%rax,%rcx,8), %xmm1
divsd 0x2018(%rsp), %xmm1
movsd 0x2018(%rsp), %xmm0
movsd 0x1b9ae6(%rip), %xmm2   # 0x1d3688
divsd %xmm2, %xmm0
movq 0x2030(%rsp), %rax
movl 0x2044(%rsp), %ecx
subl $0x1, %ecx
imull 0x202c(%rsp), %ecx
addl 0x2028(%rsp), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm2
movq 0x2030(%rsp), %rax
movl 0x2044(%rsp), %ecx
subl $0x2, %ecx
imull 0x202c(%rsp), %ecx
addl 0x2028(%rsp), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm3
addsd %xmm2, %xmm2
addsd %xmm3, %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movq 0x2038(%rsp), %rax
movl 0x2044(%rsp), %ecx
subl $0x1, %ecx
imull 0x202c(%rsp), %ecx
addl 0x2060(%rsp), %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movl $0x0, 0x2054(%rsp)
movl 0x2054(%rsp), %eax
addq $0x2058, %rsp           # imm = 0x2058
retq
nopl (%rax,%rax)