// File: /workspace/github_c_makefile_star2_O1/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), %r13
cmpl $0x1, %esi
jg 0x12ee6
leaq 0xdfe19(%rip), %r15     # 0xf2cbe
leaq 0xdfe50(%rip), %r12     # 0xf2cfc
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 %r13, %rdi
movq %r15, %rdx
movq %r12, %rcx
movl $0xa8, %r8d
movl %r14d, %r9d
xorl %eax, %eax
callq 0x8550
jmp 0x12f5c
movsd 0x10(%rdi), %xmm0
movsd (%rdi), %xmm1
movsd 0x8(%rdi), %xmm2
subsd %xmm2, %xmm0
subsd %xmm2, %xmm1
movapd %xmm0, %xmm4
mulsd %xmm1, %xmm4
movapd %xmm1, %xmm5
subsd %xmm0, %xmm5
mulsd %xmm4, %xmm5
xorpd %xmm2, %xmm2
ucomisd %xmm2, %xmm5
jne 0x12f70
jp 0x12f70
leaq 0xdfe01(%rip), %r14     # 0xf2d24
leaq 0xdfdd2(%rip), %r15     # 0xf2cfc
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 %r13, %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
movq %rdx, %rbx
movslq %r8d, %r10
leaq (%rdx,%r10,8), %rax
movsd (%rax), %xmm3
movslq %ecx, %r11
leaq (%rdx,%r11,8), %rdx
movsd (%rdx,%r10,8), %xmm6
subsd %xmm6, %xmm3
leal (%r11,%r11), %esi
movslq %esi, %rsi
movsd (%rax,%rsi,8), %xmm2
subsd %xmm6, %xmm2
movapd %xmm1, %xmm6
mulsd %xmm2, %xmm6
movapd 0xde281(%rip), %xmm7    # 0xf1230
xorpd %xmm3, %xmm7
mulsd %xmm0, %xmm7
movapd %xmm0, %xmm8
mulsd %xmm7, %xmm8
movapd %xmm6, %xmm9
mulsd %xmm1, %xmm9
addsd %xmm8, %xmm9
divsd %xmm5, %xmm9
movslq %r9d, %rax
movsd %xmm9, (%rdx,%rax,8)
movsd 0x8(%rdi), %xmm5
subsd (%rdi), %xmm5
addsd %xmm6, %xmm7
addsd %xmm5, %xmm5
mulsd %xmm5, %xmm7
movapd %xmm0, %xmm5
subsd %xmm1, %xmm5
mulsd %xmm5, %xmm4
divsd %xmm4, %xmm7
subsd %xmm7, %xmm9
movsd %xmm9, (%rbx,%rax,8)
leal -0x1(%r14), %esi
movl %esi, %r8d
cmpl $0x4, %r14d
jl 0x130e7
movq %r11, %rdx
shlq $0x4, %rdx
leaq (%rdx,%rax,8), %r9
leaq (,%r11,8), %r15
leaq (%rdx,%r10,8), %r12
shlq $0x3, %r10
leaq (%r10,%r11,8), %r13
leaq (,%r8,8), %rbp
leaq (%r11,%r11,2), %rdx
leaq (%r10,%rdx,8), %r10
movl $0x10, %r11d
xorpd %xmm4, %xmm4
movq %rbx, %rdx
movsd 0x8(%rdi,%r11), %xmm0
movsd -0x8(%rdi,%r11), %xmm1
movsd (%rdi,%r11), %xmm2
subsd %xmm2, %xmm0
subsd %xmm2, %xmm1
movapd %xmm0, %xmm2
mulsd %xmm1, %xmm2
movapd %xmm1, %xmm5
subsd %xmm0, %xmm5
mulsd %xmm2, %xmm5
ucomisd %xmm4, %xmm5
jne 0x13097
jnp 0x13147
movsd (%rdx,%r13), %xmm3
movsd (%rdx,%r12), %xmm6
subsd %xmm6, %xmm3
movsd (%rdx,%r10), %xmm2
subsd %xmm6, %xmm2
movapd %xmm1, %xmm6
mulsd %xmm2, %xmm6
movapd %xmm0, %xmm7
mulsd %xmm3, %xmm7
mulsd %xmm0, %xmm7
mulsd %xmm1, %xmm6
subsd %xmm7, %xmm6
divsd %xmm5, %xmm6
movsd %xmm6, (%rdx,%r9)
addq %r15, %rdx
addq $0x8, %r11
cmpq %r11, %rbp
jne 0x1305b
addl $-0x2, %r14d
movl %r14d, %edx
imull %ecx, %edx
movslq %edx, %rdx
leaq (%rbx,%rdx,8), %rdx
movsd (%rdi,%r8,8), %xmm4
subsd (%rdi,%r14,8), %xmm4
addsd %xmm4, %xmm4
mulsd %xmm0, %xmm3
mulsd %xmm1, %xmm2
subsd %xmm3, %xmm2
mulsd %xmm4, %xmm2
movapd %xmm1, %xmm3
mulsd %xmm0, %xmm3
subsd %xmm1, %xmm0
mulsd %xmm3, %xmm0
divsd %xmm0, %xmm2
addsd (%rdx,%rax,8), %xmm2
imull %ecx, %esi
movslq %esi, %rcx
leaq (%rbx,%rcx,8), %rcx
movsd %xmm2, (%rcx,%rax,8)
xorl %eax, %eax
jmp 0x12f61
leaq 0xdfbd6(%rip), %r14     # 0xf2d24
leaq 0xdfba7(%rip), %r15     # 0xf2cfc
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 0x40(%rsp), %rdi
movq %r14, %rdx
movq %r15, %rcx
movl $0xc3, %r8d
jmp 0x12f55