// File: /workspace/github_c_makefile_star2_O2/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 0x1138e
leaq 0xd5944(%rip), %r15     # 0xe6c8e
leaq 0xd597b(%rip), %r12     # 0xe6ccc
xorl %edi, %edi
xorl %esi, %esi
movq %r15, %rdx
movq %r12, %rcx
movl $0xa8, %r8d
movl %r14d, %r9d
xorl %eax, %eax
callq 0x8580
incl %eax
movslq %eax, %rsi
movq %rbx, %rdi
movq %r15, %rdx
movq %r12, %rcx
movl $0xa8, %r8d
movl %r14d, %r9d
xorl %eax, %eax
callq 0x8580
jmp 0x1160e
movsd 0x10(%rdi), %xmm0
movsd (%rdi), %xmm1
movsd 0x8(%rdi), %xmm2
subsd %xmm2, %xmm0
subsd %xmm2, %xmm1
movapd %xmm0, %xmm5
mulsd %xmm1, %xmm5
movapd %xmm1, %xmm6
subsd %xmm0, %xmm6
mulsd %xmm5, %xmm6
xorpd %xmm2, %xmm2
ucomisd %xmm2, %xmm6
jne 0x11402
jp 0x11402
leaq 0xd5929(%rip), %r14     # 0xe6cf4
leaq 0xd58fa(%rip), %r15     # 0xe6ccc
xorl %edi, %edi
xorl %esi, %esi
movq %r14, %rdx
movq %r15, %rcx
movl $0xb2, %r8d
xorl %eax, %eax
callq 0x8580
incl %eax
movslq %eax, %rsi
movq %rbx, %rdi
movq %r14, %rdx
movq %r15, %rcx
movl $0xb2, %r8d
jmp 0x11607
movslq %r8d, %r15
leaq (%rdx,%r15,8), %rax
movsd (%rax), %xmm4
movslq %ecx, %r11
leaq (%rdx,%r11,8), %rsi
movsd (%rsi,%r15,8), %xmm7
subsd %xmm7, %xmm4
leal (%r11,%r11), %r8d
movslq %r8d, %r8
movsd (%rax,%r8,8), %xmm3
subsd %xmm7, %xmm3
movapd %xmm1, %xmm7
mulsd %xmm3, %xmm7
movapd 0xd3df0(%rip), %xmm8    # 0xe5230
xorpd %xmm4, %xmm8
mulsd %xmm0, %xmm8
movapd %xmm0, %xmm9
mulsd %xmm8, %xmm9
movapd %xmm7, %xmm10
mulsd %xmm1, %xmm10
addsd %xmm9, %xmm10
divsd %xmm6, %xmm10
movslq %r9d, %rax
movsd %xmm10, (%rsi,%rax,8)
movsd 0x8(%rdi), %xmm6
subsd (%rdi), %xmm6
addsd %xmm7, %xmm8
addsd %xmm6, %xmm6
mulsd %xmm6, %xmm8
movapd %xmm0, %xmm6
subsd %xmm1, %xmm6
mulsd %xmm6, %xmm5
divsd %xmm5, %xmm8
subsd %xmm8, %xmm10
movsd %xmm10, (%rdx,%rax,8)
leal -0x1(%r14), %esi
leaq (,%r11,8), %r8
leaq (,%r15,8), %r9
leaq (%r9,%r11,8), %r9
imulq $0x18, %r11, %r12
shlq $0x4, %r11
leaq (%r11,%rax,8), %r10
leaq (%r11,%r15,8), %r11
leaq (%r12,%r15,8), %r15
pushq $0x3
popq %r12
movq %rdx, %r13
leaq -0x1(%r12), %rbp
cmpq %rsi, %rbp
jae 0x11570
movsd (%rdi,%r12,8), %xmm0
movsd -0x10(%rdi,%r12,8), %xmm1
movsd -0x8(%rdi,%r12,8), %xmm3
subsd %xmm3, %xmm0
subsd %xmm3, %xmm1
movapd %xmm0, %xmm3
mulsd %xmm1, %xmm3
movapd %xmm1, %xmm5
subsd %xmm0, %xmm5
mulsd %xmm3, %xmm5
ucomisd %xmm2, %xmm5
jne 0x11521
jnp 0x115ce
movsd (%r13,%r9), %xmm4
movsd (%r13,%r11), %xmm6
subsd %xmm6, %xmm4
movsd (%r13,%r15), %xmm3
subsd %xmm6, %xmm3
movapd %xmm1, %xmm6
mulsd %xmm3, %xmm6
movapd %xmm0, %xmm7
mulsd %xmm4, %xmm7
mulsd %xmm0, %xmm7
mulsd %xmm1, %xmm6
subsd %xmm7, %xmm6
divsd %xmm5, %xmm6
movsd %xmm6, (%r13,%r10)
incq %r12
addq %r8, %r13
jmp 0x114d7
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 %xmm0, %xmm4
mulsd %xmm1, %xmm3
subsd %xmm4, %xmm3
mulsd %xmm2, %xmm3
movapd %xmm1, %xmm2
mulsd %xmm0, %xmm2
subsd %xmm1, %xmm0
mulsd %xmm2, %xmm0
divsd %xmm0, %xmm3
addsd (%r8,%rax,8), %xmm3
imull %esi, %ecx
movslq %ecx, %rcx
leaq (%rdx,%rcx,8), %rcx
movsd %xmm3, (%rcx,%rax,8)
xorl %eax, %eax
jmp 0x11611
leaq 0xd571f(%rip), %r14     # 0xe6cf4
leaq 0xd56f0(%rip), %r15     # 0xe6ccc
xorl %edi, %edi
xorl %esi, %esi
movq %r14, %rdx
movq %r15, %rcx
movl $0xc3, %r8d
xorl %eax, %eax
callq 0x8580
incl %eax
movslq %eax, %rsi
movq %rbx, %rdi
movq %r14, %rdx
movq %r15, %rcx
movl $0xc3, %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