// File: /workspace/github_c_makefile_star2_O3/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
subq $0x18, %rsp
movl 0x50(%rsp), %eax
leal -0x1(%rsi), %r11d
cmpl $0x2, %esi
jle 0x1341c
movslq %r8d, %rbx
movslq %r9d, %r9
movslq %eax, %r8
movl %ecx, 0xc(%rsp)
movslq %ecx, %r10
movl %r11d, 0x8(%rsp)
movl %r11d, %r11d
leaq (,%r10,8), %r14
leaq (,%r8,8), %rax
leaq (%rax,%r10,8), %r15
leaq (,%r9,8), %rax
leaq (%rax,%r10,8), %r12
leaq (,%rbx,8), %r13
leaq (,%r10,8), %rbp
addq %r13, %rbp
movq %r10, %rax
shlq $0x4, %rax
leaq (%rax,%rbx,8), %rbx
movl $0x1, %eax
xorpd %xmm0, %xmm0
movapd 0xdaed0(%rip), %xmm1    # 0xee230
movq %rdx, 0x10(%rsp)
movsd 0x8(%rdi,%rax,8), %xmm2
movsd -0x8(%rdi,%rax,8), %xmm3
movsd (%rdi,%rax,8), %xmm4
subsd %xmm4, %xmm2
subsd %xmm4, %xmm3
movapd %xmm2, %xmm4
mulsd %xmm3, %xmm4
movapd %xmm3, %xmm5
subsd %xmm2, %xmm5
mulsd %xmm4, %xmm5
ucomisd %xmm0, %xmm5
jne 0x1339e
jnp 0x1349f
incq %rax
movsd (%rdx,%r13), %xmm6
movsd (%rdx,%rbp), %xmm7
subsd %xmm7, %xmm6
xorpd %xmm1, %xmm6
movsd (%rdx,%rbx), %xmm8
subsd %xmm7, %xmm8
mulsd %xmm3, %xmm8
mulsd %xmm2, %xmm6
movapd %xmm2, %xmm7
mulsd %xmm6, %xmm7
addsd %xmm8, %xmm6
mulsd %xmm3, %xmm8
addsd %xmm7, %xmm8
divsd %xmm5, %xmm8
movsd %xmm8, (%rdx,%r12)
addsd %xmm6, %xmm6
subsd %xmm3, %xmm2
mulsd %xmm2, %xmm4
divsd %xmm4, %xmm6
movsd %xmm6, (%rdx,%r15)
addq %r14, %rdx
cmpq %rax, %r11
jne 0x13365
movl 0xc(%rsp), %ecx
movq 0x10(%rsp), %rdx
movl 0x8(%rsp), %r11d
jmp 0x13425
movslq %ecx, %r10
movslq %r9d, %r9
movslq %eax, %r8
leaq (%rdx,%r10,8), %rax
movsd 0x8(%rdi), %xmm0
subsd (%rdi), %xmm0
movsd (%rax,%r9,8), %xmm1
mulsd (%rax,%r8,8), %xmm0
subsd %xmm0, %xmm1
movsd %xmm1, (%rdx,%r9,8)
movsd (%rax,%r8,8), %xmm0
movsd %xmm0, (%rdx,%r8,8)
leal -0x2(%rsi), %eax
imull %ecx, %eax
cltq
leaq (%rdx,%rax,8), %rax
movslq %r11d, %r10
movsd (%rdi,%r10,8), %xmm0
movslq %esi, %rsi
subsd -0x10(%rdi,%rsi,8), %xmm0
mulsd (%rax,%r8,8), %xmm0
addsd (%rax,%r9,8), %xmm0
imull %ecx, %r11d
movslq %r11d, %rcx
leaq (%rdx,%rcx,8), %rcx
movsd %xmm0, (%rcx,%r9,8)
movsd (%rax,%r8,8), %xmm0
movsd %xmm0, (%rcx,%r8,8)
xorl %eax, %eax
jmp 0x134e6
leaq 0xdc88e(%rip), %r14     # 0xefd34
leaq 0xdc8af(%rip), %r15     # 0xefd5c
xorl %edi, %edi
xorl %esi, %esi
movq %r14, %rdx
movq %r15, %rcx
movl $0xe7, %r8d
xorl %eax, %eax
callq 0x8550
incl %eax
movslq %eax, %rsi
movq 0x58(%rsp), %rdi
movq %r14, %rdx
movq %r15, %rcx
movl $0xe7, %r8d
xorl %eax, %eax
callq 0x8550
movl $0x1, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq