// File: /workspace/github_c_makefile_star2_O0/PoulinV[P]AxiCLASS/build/../tools/arrays.c
// Function: array_derive_two
int array_derive_two(
		     double * array,
		     int n_columns,
		     int n_lines,
		     int index_x,   /** from 0 to (n_columns-1) */
		     int index_y,
		     int index_dydx,
		     int index_ddydxdx,
		     ErrorMsg errmsg) {

  int i;

  double dx1,dx2,dy1,dy2,weight1,weight2;

  if ((index_dydx == index_x) || (index_dydx == index_y)) {
    class_sprintf(errmsg,"%s(L:%d) : Output column %d must differ from input columns %d and %d",__func__,__LINE__,index_dydx,index_x,index_y);
    return _FAILURE_;
  }

  dx2=*(array+1*n_columns+index_x)-*(array+0*n_columns+index_x);
  dy2=*(array+1*n_columns+index_y)-*(array+0*n_columns+index_y);

  for (i=1; i<n_lines-1; i++) {

    dx1 = dx2;
    dy1 = dy2;
    dx2 = *(array+(i+1)*n_columns+index_x)-*(array+i*n_columns+index_x);
    dy2 = *(array+(i+1)*n_columns+index_y)-*(array+i*n_columns+index_y);
    weight1 = dx2*dx2;
    weight2 = dx1*dx1;

    if ((dx1 == 0.) && (dx2 == 0.)) {
      class_sprintf(errmsg,"%s(L:%d) stop to avoid division by zero",__func__,__LINE__);
      return _FAILURE_;
    }

    *(array+i*n_columns+index_dydx) = (weight1*dy1+weight2*dy2) / (weight1*dx1+weight2*dx2);
    *(array+i*n_columns+index_ddydxdx) = (dx2*dy1-dx1*dy2) / (weight1*dx1+weight2*dx2);

    if (i == 1) {
      *(array+(i-1)*n_columns+index_dydx) = 2.*dy1/dx1 - *(array+i*n_columns+index_dydx);
      *(array+(i-1)*n_columns+index_ddydxdx) = *(array+i*n_columns+index_ddydxdx);
    }

    if (i == n_lines-2) {
      *(array+(i+1)*n_columns+index_dydx) = 2.*dy2/dx2 - *(array+i*n_columns+index_dydx);
      *(array+(i+1)*n_columns+index_dydx) = *(array+i*n_columns+index_ddydxdx);
    }
  }

  return _SUCCESS_;
}

// Assembly:
subq $0x78, %rsp
movq 0x88(%rsp), %rax
movl 0x80(%rsp), %eax
movq %rdi, 0x68(%rsp)
movl %esi, 0x64(%rsp)
movl %edx, 0x60(%rsp)
movl %ecx, 0x5c(%rsp)
movl %r8d, 0x58(%rsp)
movl %r9d, 0x54(%rsp)
movl 0x54(%rsp), %eax
cmpl 0x5c(%rsp), %eax
je 0x1ae36
movl 0x54(%rsp), %eax
cmpl 0x58(%rsp), %eax
jne 0x1aec4
jmp 0x1ae38
movl 0x54(%rsp), %r9d
movl 0x5c(%rsp), %r10d
movl 0x58(%rsp), %eax
xorl %ecx, %ecx
movl %ecx, %esi
leaq 0x1b8f1a(%rip), %rdx    # 0x1d3d6b
leaq 0x1b8f58(%rip), %rcx    # 0x1d3db0
movl $0x12d, %r8d            # imm = 0x12D
movq %rsi, %rdi
movl %r10d, (%rsp)
movl %eax, 0x8(%rsp)
movb $0x0, %al
callq 0x8540
movl %eax, 0x1c(%rsp)
movq 0x88(%rsp), %rdi
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movslq %eax, %rsi
movl 0x54(%rsp), %r9d
movl 0x5c(%rsp), %r10d
movl 0x58(%rsp), %eax
leaq 0x1b8ed0(%rip), %rdx    # 0x1d3d6b
leaq 0x1b8f0e(%rip), %rcx    # 0x1d3db0
movl $0x12d, %r8d            # imm = 0x12D
movl %r10d, (%rsp)
movl %eax, 0x8(%rsp)
movb $0x0, %al
callq 0x8540
movl $0x1, 0x74(%rsp)
jmp 0x1b32c
movq 0x68(%rsp), %rax
movl 0x64(%rsp), %ecx
shll $0x0, %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x5c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x68(%rsp), %rax
imull $0x0, 0x64(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x5c(%rsp), %rcx
subsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x40(%rsp)
movq 0x68(%rsp), %rax
movl 0x64(%rsp), %ecx
shll $0x0, %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x58(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x68(%rsp), %rax
imull $0x0, 0x64(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x58(%rsp), %rcx
subsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x30(%rsp)
movl $0x1, 0x50(%rsp)
movl 0x50(%rsp), %eax
movl 0x60(%rsp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x1b324
movsd 0x40(%rsp), %xmm0
movsd %xmm0, 0x48(%rsp)
movsd 0x30(%rsp), %xmm0
movsd %xmm0, 0x38(%rsp)
movq 0x68(%rsp), %rax
movl 0x50(%rsp), %ecx
addl $0x1, %ecx
imull 0x64(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x5c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x68(%rsp), %rax
movl 0x50(%rsp), %ecx
imull 0x64(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x5c(%rsp), %rcx
subsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x40(%rsp)
movq 0x68(%rsp), %rax
movl 0x50(%rsp), %ecx
addl $0x1, %ecx
imull 0x64(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x58(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x68(%rsp), %rax
movl 0x50(%rsp), %ecx
imull 0x64(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x58(%rsp), %rcx
subsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x30(%rsp)
movsd 0x40(%rsp), %xmm0
mulsd 0x40(%rsp), %xmm0
movsd %xmm0, 0x28(%rsp)
movsd 0x48(%rsp), %xmm0
mulsd 0x48(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
movsd 0x48(%rsp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x1b0c1
jp 0x1b0c1
movsd 0x40(%rsp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x1b0c1
jp 0x1b0c1
jmp 0x1b061
xorl %eax, %eax
movl %eax, %esi
leaq 0x1b8caf(%rip), %rdx    # 0x1d3d1b
leaq 0x1b8d3d(%rip), %rcx    # 0x1d3db0
movl $0x13e, %r8d            # imm = 0x13E
movq %rsi, %rdi
movb $0x0, %al
callq 0x8540
movl %eax, 0x18(%rsp)
movq 0x88(%rsp), %rdi
movl 0x18(%rsp), %eax
addl $0x1, %eax
movslq %eax, %rsi
leaq 0x1b8c7b(%rip), %rdx    # 0x1d3d1b
leaq 0x1b8d09(%rip), %rcx    # 0x1d3db0
movl $0x13e, %r8d            # imm = 0x13E
movb $0x0, %al
callq 0x8540
movl $0x1, 0x74(%rsp)
jmp 0x1b32c
movsd 0x28(%rsp), %xmm0
movsd 0x38(%rsp), %xmm2
movsd 0x20(%rsp), %xmm1
mulsd 0x30(%rsp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd 0x28(%rsp), %xmm1
movsd 0x48(%rsp), %xmm3
movsd 0x20(%rsp), %xmm2
mulsd 0x40(%rsp), %xmm2
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movq 0x68(%rsp), %rax
movl 0x50(%rsp), %ecx
imull 0x64(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x54(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movsd 0x40(%rsp), %xmm0
movsd 0x38(%rsp), %xmm2
movsd 0x48(%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 0x28(%rsp), %xmm1
movsd 0x48(%rsp), %xmm3
movsd 0x20(%rsp), %xmm2
mulsd 0x40(%rsp), %xmm2
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movq 0x68(%rsp), %rax
movl 0x50(%rsp), %ecx
imull 0x64(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x80(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
cmpl $0x1, 0x50(%rsp)
jne 0x1b25a
movsd 0x1b7ac6(%rip), %xmm0   # 0x1d2c80
mulsd 0x38(%rsp), %xmm0
divsd 0x48(%rsp), %xmm0
movq 0x68(%rsp), %rax
movl 0x50(%rsp), %ecx
imull 0x64(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x54(%rsp), %rcx
subsd (%rax,%rcx,8), %xmm0
movq 0x68(%rsp), %rax
movl 0x50(%rsp), %ecx
subl $0x1, %ecx
imull 0x64(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x54(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movq 0x68(%rsp), %rax
movl 0x50(%rsp), %ecx
imull 0x64(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x80(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x68(%rsp), %rax
movl 0x50(%rsp), %ecx
subl $0x1, %ecx
imull 0x64(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x80(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl 0x50(%rsp), %eax
movl 0x60(%rsp), %ecx
subl $0x2, %ecx
cmpl %ecx, %eax
jne 0x1b312
movsd 0x1b7a0b(%rip), %xmm0   # 0x1d2c80
mulsd 0x30(%rsp), %xmm0
divsd 0x40(%rsp), %xmm0
movq 0x68(%rsp), %rax
movl 0x50(%rsp), %ecx
imull 0x64(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x54(%rsp), %rcx
subsd (%rax,%rcx,8), %xmm0
movq 0x68(%rsp), %rax
movl 0x50(%rsp), %ecx
addl $0x1, %ecx
imull 0x64(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x54(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movq 0x68(%rsp), %rax
movl 0x50(%rsp), %ecx
imull 0x64(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x80(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x68(%rsp), %rax
movl 0x50(%rsp), %ecx
addl $0x1, %ecx
imull 0x64(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x54(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
jmp 0x1b314
movl 0x50(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x50(%rsp)
jmp 0x1af54
movl $0x0, 0x74(%rsp)
movl 0x74(%rsp), %eax
addq $0x78, %rsp
retq
nopw %cs:(%rax,%rax)