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

  int i=1;
  double dxp,dxm,dyp,dym;

  if (n_lines < 2) {
    class_sprintf(errmsg,"%s(L:%d) routine called with n_lines=%d, should be at least 2",__func__,__LINE__,n_lines);
    return _FAILURE_;
  }

  dxp = x_array[2] - x_array[1];
  dxm = x_array[0] - x_array[1];
  dyp = *(array+2*n_columns+index_y) - *(array+1*n_columns+index_y);
  dym = *(array+0*n_columns+index_y) - *(array+1*n_columns+index_y);

  if ((dxp*dxm*(dxm-dxp)) == 0.) {
    class_sprintf(errmsg,"%s(L:%d) stop to avoid division by zero",__func__,__LINE__);
    return _FAILURE_;
  }

  *(array+1*n_columns+index_dy) = (dyp*dxm*dxm-dym*dxp*dxp)/(dxp*dxm*(dxm-dxp));

  *(array+0*n_columns+index_dy) = *(array+1*n_columns+index_dy)
    - (x_array[1] - x_array[0]) * 2.*(dyp*dxm-dym*dxp)/(dxp*dxm*(dxp-dxm));

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

    dxp = x_array[i+1] - x_array[i];
    dxm = x_array[i-1] - x_array[i];
    dyp = *(array+(i+1)*n_columns+index_y) - *(array+i*n_columns+index_y);
    dym = *(array+(i-1)*n_columns+index_y) - *(array+i*n_columns+index_y);

    if ((dxp*dxm*(dxm-dxp)) == 0.) {
      class_sprintf(errmsg,"%s(L:%d) stop to avoid division by zero",__func__,__LINE__);
      return _FAILURE_;
    }

    *(array+i*n_columns+index_dy) = (dyp*dxm*dxm-dym*dxp*dxp)/(dxp*dxm*(dxm-dxp));

  }

  *(array+(n_lines-1)*n_columns+index_dy) = *(array+(n_lines-2)*n_columns+index_dy)
    + (x_array[n_lines-1] - x_array[n_lines-2]) * 2.*(dyp*dxm-dym*dxp)/(dxp*dxm*(dxp-dxm));

  return _SUCCESS_;

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %r14d
movq 0x40(%rsp), %rbx
cmpl $0x1, %esi
jg 0x13050
leaq 0xdccbf(%rip), %r15     # 0xefcce
leaq 0xdccf6(%rip), %r12     # 0xefd0c
xorl %edi, %edi
xorl %esi, %esi
movq %r15, %rdx
movq %r12, %rcx
movl $0xa8, %r8d
movl %r14d, %r9d
xorl %eax, %eax
callq 0x8550
incl %eax
movslq %eax, %rsi
movq %rbx, %rdi
movq %r15, %rdx
movq %r12, %rcx
movl $0xa8, %r8d
movl %r14d, %r9d
xorl %eax, %eax
callq 0x8550
jmp 0x130c6
movsd 0x10(%rdi), %xmm2
movsd (%rdi), %xmm3
movsd 0x8(%rdi), %xmm0
subsd %xmm0, %xmm2
subsd %xmm0, %xmm3
movapd %xmm2, %xmm0
mulsd %xmm3, %xmm0
movapd %xmm3, %xmm4
subsd %xmm2, %xmm4
mulsd %xmm0, %xmm4
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm4
jne 0x130da
jp 0x130da
leaq 0xdcca7(%rip), %r14     # 0xefd34
leaq 0xdcc78(%rip), %r15     # 0xefd0c
xorl %edi, %edi
xorl %esi, %esi
movq %r14, %rdx
movq %r15, %rcx
movl $0xb2, %r8d
xorl %eax, %eax
callq 0x8550
incl %eax
movslq %eax, %rsi
movq %rbx, %rdi
movq %r14, %rdx
movq %r15, %rcx
movl $0xb2, %r8d
xorl %eax, %eax
callq 0x8550
movl $0x1, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movslq %r8d, %r8
leaq (%rdx,%r8,8), %rax
movsd (%rax), %xmm1
movslq %ecx, %r10
leaq (%rdx,%r10,8), %rsi
movsd (%rsi,%r8,8), %xmm5
subsd %xmm5, %xmm1
leal (%r10,%r10), %r11d
movslq %r11d, %r11
movsd (%rax,%r11,8), %xmm6
subsd %xmm5, %xmm6
mulsd %xmm3, %xmm6
xorpd 0xdb11d(%rip), %xmm1    # 0xee230
mulsd %xmm2, %xmm1
movapd %xmm2, %xmm5
mulsd %xmm1, %xmm5
addsd %xmm6, %xmm1
mulsd %xmm3, %xmm6
addsd %xmm5, %xmm6
divsd %xmm4, %xmm6
movslq %r9d, %rax
movsd %xmm6, (%rsi,%rax,8)
movsd 0x8(%rdi), %xmm4
subsd (%rdi), %xmm4
addsd %xmm4, %xmm4
mulsd %xmm1, %xmm4
subsd %xmm3, %xmm2
mulsd %xmm2, %xmm0
divsd %xmm0, %xmm4
subsd %xmm4, %xmm6
movsd %xmm6, (%rdx,%rax,8)
leal -0x1(%r14), %esi
cmpl $0x4, %r14d
jb 0x13257
movq %r10, %r15
shlq $0x4, %r15
leaq (%r15,%rax,8), %r9
leaq (,%r10,8), %r11
leaq (%r15,%r8,8), %r15
shlq $0x3, %r8
leaq (%r8,%r10,8), %r12
leaq (,%rsi,8), %r13
leaq (%r10,%r10,2), %r10
leaq (%r8,%r10,8), %r8
movl $0x10, %r10d
xorpd %xmm2, %xmm2
movapd 0xdb084(%rip), %xmm4    # 0xee230
movq %rdx, %rbp
movsd 0x8(%rdi,%r10), %xmm3
movsd -0x8(%rdi,%r10), %xmm5
movsd (%rdi,%r10), %xmm0
subsd %xmm0, %xmm3
subsd %xmm0, %xmm5
movapd %xmm3, %xmm0
mulsd %xmm5, %xmm0
movapd %xmm5, %xmm7
subsd %xmm3, %xmm7
mulsd %xmm0, %xmm7
ucomisd %xmm2, %xmm7
jne 0x131eb
jnp 0x1329c
movsd (%rbp,%r12), %xmm6
movsd (%rbp,%r15), %xmm8
subsd %xmm8, %xmm6
xorpd %xmm4, %xmm6
movsd (%rbp,%r8), %xmm1
subsd %xmm8, %xmm1
mulsd %xmm5, %xmm1
mulsd %xmm3, %xmm6
movapd %xmm3, %xmm8
mulsd %xmm6, %xmm8
movapd %xmm1, %xmm9
mulsd %xmm5, %xmm9
addsd %xmm8, %xmm9
divsd %xmm7, %xmm9
movsd %xmm9, (%rbp,%r9)
addq %r11, %rbp
addq $0x8, %r10
cmpq %r10, %r13
jne 0x131af
addsd %xmm6, %xmm1
subsd %xmm5, %xmm3
mulsd %xmm3, %xmm0
addl $-0x2, %r14d
movl %r14d, %r8d
imull %ecx, %r8d
movslq %r8d, %r8
leaq (%rdx,%r8,8), %r8
movsd (%rdi,%rsi,8), %xmm2
subsd (%rdi,%r14,8), %xmm2
addsd %xmm2, %xmm2
mulsd %xmm1, %xmm2
divsd %xmm0, %xmm2
addsd (%r8,%rax,8), %xmm2
imull %esi, %ecx
movslq %ecx, %rcx
leaq (%rdx,%rcx,8), %rcx
movsd %xmm2, (%rcx,%rax,8)
xorl %eax, %eax
jmp 0x130cb
leaq 0xdca91(%rip), %r14     # 0xefd34
leaq 0xdca62(%rip), %r15     # 0xefd0c
xorl %edi, %edi
xorl %esi, %esi
movq %r14, %rdx
movq %r15, %rcx
movl $0xc3, %r8d
xorl %eax, %eax
callq 0x8550
incl %eax
movslq %eax, %rsi
movq %rbx, %rdi
movq %r14, %rdx
movq %r15, %rcx
movl $0xc3, %r8d
jmp 0x130bf