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

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

  for (i=1; 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+i*n_columns+index_ddy) = 2.*(dyp*dxm-dym*dxp)/(dxp*dxm*(dxp-dxm));

  }

  *(array+0*n_columns+index_dy) = *(array+1*n_columns+index_dy)
    - (x_array[1] - x_array[0]) * *(array+1*n_columns+index_ddy);
  *(array+0*n_columns+index_ddy) = *(array+1*n_columns+index_ddy);

  *(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]) * *(array+(n_lines-2)*n_columns+index_ddy);
  *(array+(n_lines-1)*n_columns+index_ddy) = *(array+(n_lines-2)*n_columns+index_ddy);

  return _SUCCESS_;

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movslq 0x40(%rsp), %rax
leal -0x1(%rsi), %edx
movslq %r8d, %r13
movslq %r9d, %r8
movslq %edx, %r9
movslq %ecx, %rcx
leaq (,%r13,8), %r10
leaq (,%rcx,8), %r11
leaq (,%rax,8), %rdx
leaq (%rdx,%rcx,8), %r14
leaq (,%r8,8), %rdx
leaq (%rdx,%rcx,8), %r15
leaq (%r10,%rcx,8), %r12
movq %rcx, %rdx
shlq $0x4, %rdx
leaq (%rdx,%r13,8), %r13
pushq $0x1
popq %rbp
xorpd %xmm0, %xmm0
movapd 0xd3ba8(%rip), %xmm1    # 0xe5230
movq %rbx, %rdx
cmpq %r9, %rbp
jge 0x11738
movsd 0x8(%rdi,%rbp,8), %xmm2
movsd -0x8(%rdi,%rbp,8), %xmm3
movsd (%rdi,%rbp,8), %xmm4
subsd %xmm4, %xmm2
subsd %xmm4, %xmm3
movapd %xmm2, %xmm4
mulsd %xmm3, %xmm4
movapd %xmm3, %xmm6
subsd %xmm2, %xmm6
mulsd %xmm4, %xmm6
ucomisd %xmm0, %xmm6
jne 0x116cd
jnp 0x117aa
movsd (%rdx,%r10), %xmm5
movsd (%rdx,%r12), %xmm7
subsd %xmm7, %xmm5
xorpd %xmm1, %xmm5
movsd (%rdx,%r13), %xmm8
subsd %xmm7, %xmm8
mulsd %xmm3, %xmm8
mulsd %xmm2, %xmm5
movapd %xmm2, %xmm7
mulsd %xmm5, %xmm7
addsd %xmm8, %xmm5
mulsd %xmm3, %xmm8
addsd %xmm7, %xmm8
divsd %xmm6, %xmm8
movsd %xmm8, (%rdx,%r15)
addsd %xmm5, %xmm5
subsd %xmm3, %xmm2
mulsd %xmm2, %xmm4
divsd %xmm4, %xmm5
movsd %xmm5, (%rdx,%r14)
addq %r11, %rdx
incq %rbp
jmp 0x1168b
leaq (%rbx,%rcx,8), %rdx
movsd (%rdx,%r8,8), %xmm0
movsd 0x8(%rdi), %xmm1
subsd (%rdi), %xmm1
mulsd (%rdx,%rax,8), %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, (%rbx,%r8,8)
movsd (%rdx,%rax,8), %xmm0
movsd %xmm0, (%rbx,%rax,8)
leal -0x2(%rsi), %edx
imull %ecx, %edx
movslq %edx, %rdx
leaq (%rbx,%rdx,8), %rdx
movsd (%rdi,%r9,8), %xmm0
movslq %esi, %rsi
subsd -0x10(%rdi,%rsi,8), %xmm0
mulsd (%rdx,%rax,8), %xmm0
addsd (%rdx,%r8,8), %xmm0
imull %ecx, %r9d
movslq %r9d, %rcx
leaq (%rbx,%rcx,8), %rcx
movsd %xmm0, (%rcx,%r8,8)
movsd (%rdx,%rax,8), %xmm0
movsd %xmm0, (%rcx,%rax,8)
xorl %eax, %eax
jmp 0x117ef
leaq 0xd5543(%rip), %r14     # 0xe6cf4
leaq 0xd5564(%rip), %r15     # 0xe6d1c
xorl %edi, %edi
xorl %esi, %esi
movq %r14, %rdx
movq %r15, %rcx
movl $0xe7, %r8d
xorl %eax, %eax
callq 0x8580
incl %eax
movslq %eax, %rsi
movq 0x48(%rsp), %rdi
movq %r14, %rdx
movq %r15, %rcx
movl $0xe7, %r8d
xorl %eax, %eax
callq 0x8580
pushq $0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq