// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x68, %rsp
movq 0x70(%rsp), %rax
movq %rdi, 0x58(%rsp)
movl %esi, 0x54(%rsp)
movq %rdx, 0x48(%rsp)
movl %ecx, 0x44(%rsp)
movl %r8d, 0x40(%rsp)
movl %r9d, 0x3c(%rsp)
movl $0x1, 0x38(%rsp)
cmpl $0x2, 0x54(%rsp)
jge 0x1a22d
jmp 0x1a1c6
movl 0x54(%rsp), %r9d
xorl %eax, %eax
movl %eax, %esi
leaq 0x1b9adf(%rip), %rdx    # 0x1d3cb5
leaq 0x1b9b16(%rip), %rcx    # 0x1d3cf3
movl $0xa8, %r8d
movq %rsi, %rdi
movb $0x0, %al
callq 0x8540
movl %eax, 0x14(%rsp)
movq 0x70(%rsp), %rdi
movl 0x14(%rsp), %eax
addl $0x1, %eax
movslq %eax, %rsi
movl 0x54(%rsp), %r9d
leaq 0x1b9aa9(%rip), %rdx    # 0x1d3cb5
leaq 0x1b9ae0(%rip), %rcx    # 0x1d3cf3
movl $0xa8, %r8d
movb $0x0, %al
callq 0x8540
movl $0x1, 0x64(%rsp)
jmp 0x1a7b5
movq 0x58(%rsp), %rax
movsd 0x10(%rax), %xmm0
movq 0x58(%rsp), %rax
subsd 0x8(%rax), %xmm0
movsd %xmm0, 0x30(%rsp)
movq 0x58(%rsp), %rax
movsd (%rax), %xmm0
movq 0x58(%rsp), %rax
subsd 0x8(%rax), %xmm0
movsd %xmm0, 0x28(%rsp)
movq 0x48(%rsp), %rax
movl 0x44(%rsp), %ecx
shll %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x40(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x48(%rsp), %rax
movl 0x44(%rsp), %ecx
shll $0x0, %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x40(%rsp), %rcx
subsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x20(%rsp)
movq 0x48(%rsp), %rax
imull $0x0, 0x44(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x40(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x48(%rsp), %rax
movl 0x44(%rsp), %ecx
shll $0x0, %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x40(%rsp), %rcx
subsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x30(%rsp), %xmm0
mulsd 0x28(%rsp), %xmm0
movsd 0x28(%rsp), %xmm1
subsd 0x30(%rsp), %xmm1
mulsd %xmm1, %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x1a36f
jp 0x1a36f
jmp 0x1a312
xorl %eax, %eax
movl %eax, %esi
leaq 0x1b99fe(%rip), %rdx    # 0x1d3d1b
leaq 0x1b99cf(%rip), %rcx    # 0x1d3cf3
movl $0xb2, %r8d
movq %rsi, %rdi
movb $0x0, %al
callq 0x8540
movl %eax, 0x10(%rsp)
movq 0x70(%rsp), %rdi
movl 0x10(%rsp), %eax
addl $0x1, %eax
movslq %eax, %rsi
leaq 0x1b99cd(%rip), %rdx    # 0x1d3d1b
leaq 0x1b999e(%rip), %rcx    # 0x1d3cf3
movl $0xb2, %r8d
movb $0x0, %al
callq 0x8540
movl $0x1, 0x64(%rsp)
jmp 0x1a7b5
movsd 0x20(%rsp), %xmm0
mulsd 0x28(%rsp), %xmm0
movsd 0x28(%rsp), %xmm2
movsd 0x18(%rsp), %xmm1
mulsd 0x30(%rsp), %xmm1
mulsd 0x30(%rsp), %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd 0x30(%rsp), %xmm1
mulsd 0x28(%rsp), %xmm1
movsd 0x28(%rsp), %xmm2
subsd 0x30(%rsp), %xmm2
mulsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movq 0x48(%rsp), %rax
movl 0x44(%rsp), %ecx
shll $0x0, %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x3c(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movq 0x48(%rsp), %rax
movl 0x44(%rsp), %ecx
shll $0x0, %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x3c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x58(%rsp), %rax
movsd 0x8(%rax), %xmm1
movq 0x58(%rsp), %rax
subsd (%rax), %xmm1
movsd 0x1b8853(%rip), %xmm2   # 0x1d2c80
mulsd %xmm2, %xmm1
movsd 0x20(%rsp), %xmm2
movsd 0x28(%rsp), %xmm4
movsd 0x18(%rsp), %xmm3
mulsd 0x30(%rsp), %xmm3
movq %xmm3, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm3
mulsd %xmm4, %xmm2
addsd %xmm3, %xmm2
mulsd %xmm2, %xmm1
movsd 0x30(%rsp), %xmm2
mulsd 0x28(%rsp), %xmm2
movsd 0x30(%rsp), %xmm3
subsd 0x28(%rsp), %xmm3
mulsd %xmm3, %xmm2
divsd %xmm2, %xmm1
subsd %xmm1, %xmm0
movq 0x48(%rsp), %rax
imull $0x0, 0x44(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x3c(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl $0x2, 0x38(%rsp)
movl 0x38(%rsp), %eax
movl 0x54(%rsp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x1a6d0
movq 0x58(%rsp), %rax
movl 0x38(%rsp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x58(%rsp), %rax
movslq 0x38(%rsp), %rcx
subsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x30(%rsp)
movq 0x58(%rsp), %rax
movl 0x38(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x58(%rsp), %rax
movslq 0x38(%rsp), %rcx
subsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x28(%rsp)
movq 0x48(%rsp), %rax
movl 0x38(%rsp), %ecx
addl $0x1, %ecx
imull 0x44(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x40(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x48(%rsp), %rax
movl 0x38(%rsp), %ecx
imull 0x44(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x40(%rsp), %rcx
subsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x20(%rsp)
movq 0x48(%rsp), %rax
movl 0x38(%rsp), %ecx
subl $0x1, %ecx
imull 0x44(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x40(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x48(%rsp), %rax
movl 0x38(%rsp), %ecx
imull 0x44(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x40(%rsp), %rcx
subsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x30(%rsp), %xmm0
mulsd 0x28(%rsp), %xmm0
movsd 0x28(%rsp), %xmm1
subsd 0x30(%rsp), %xmm1
mulsd %xmm1, %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x1a63b
jp 0x1a63b
jmp 0x1a5de
xorl %eax, %eax
movl %eax, %esi
leaq 0x1b9732(%rip), %rdx    # 0x1d3d1b
leaq 0x1b9703(%rip), %rcx    # 0x1d3cf3
movl $0xc3, %r8d
movq %rsi, %rdi
movb $0x0, %al
callq 0x8540
movl %eax, 0xc(%rsp)
movq 0x70(%rsp), %rdi
movl 0xc(%rsp), %eax
addl $0x1, %eax
movslq %eax, %rsi
leaq 0x1b9701(%rip), %rdx    # 0x1d3d1b
leaq 0x1b96d2(%rip), %rcx    # 0x1d3cf3
movl $0xc3, %r8d
movb $0x0, %al
callq 0x8540
movl $0x1, 0x64(%rsp)
jmp 0x1a7b5
movsd 0x20(%rsp), %xmm0
mulsd 0x28(%rsp), %xmm0
movsd 0x28(%rsp), %xmm2
movsd 0x18(%rsp), %xmm1
mulsd 0x30(%rsp), %xmm1
mulsd 0x30(%rsp), %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd 0x30(%rsp), %xmm1
mulsd 0x28(%rsp), %xmm1
movsd 0x28(%rsp), %xmm2
subsd 0x30(%rsp), %xmm2
mulsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movq 0x48(%rsp), %rax
movl 0x38(%rsp), %ecx
imull 0x44(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x3c(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl 0x38(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x38(%rsp)
jmp 0x1a4b6
movq 0x48(%rsp), %rax
movl 0x54(%rsp), %ecx
subl $0x2, %ecx
imull 0x44(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x3c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x58(%rsp), %rax
movl 0x54(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm1
movq 0x58(%rsp), %rax
movl 0x54(%rsp), %ecx
subl $0x2, %ecx
movslq %ecx, %rcx
subsd (%rax,%rcx,8), %xmm1
movsd 0x1b855b(%rip), %xmm2   # 0x1d2c80
mulsd %xmm2, %xmm1
movsd 0x20(%rsp), %xmm2
movsd 0x28(%rsp), %xmm4
movsd 0x18(%rsp), %xmm3
mulsd 0x30(%rsp), %xmm3
movq %xmm3, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm3
mulsd %xmm4, %xmm2
addsd %xmm3, %xmm2
mulsd %xmm2, %xmm1
movsd 0x30(%rsp), %xmm2
mulsd 0x28(%rsp), %xmm2
movsd 0x30(%rsp), %xmm3
subsd 0x28(%rsp), %xmm3
mulsd %xmm3, %xmm2
divsd %xmm2, %xmm1
addsd %xmm1, %xmm0
movq 0x48(%rsp), %rax
movl 0x54(%rsp), %ecx
subl $0x1, %ecx
imull 0x44(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x3c(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl $0x0, 0x64(%rsp)
movl 0x64(%rsp), %eax
addq $0x68, %rsp
retq
nop