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

  int i;

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

  class_test((index_dydx == index_x) || (index_dydx == index_y),
	     errmsg,
	     "output column %d must differ from input columns %d and %d",index_dydx,index_x,index_y);

  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];
    class_test((dx1 == 0) || (dx2 == 0),
	       errmsg,
	       "stop to avoid division by zero");
    weight1 = dx2*dx2;
    weight2 = dx1*dx1;
    array[i*n_columns+index_dydx] = (weight1*dy1+weight2*dy2) / (weight1*dx1+weight2*dx2);

    if (i == 1)
      array[(i-1)*n_columns+index_dydx] = 2.*dy1/dx1 - array[i*n_columns+index_dydx];

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

  return _SUCCESS_;
}

// Assembly:
subq $0x2058, %rsp           # imm = 0x2058
movq 0x2060(%rsp), %rax
movq %rdi, 0x2048(%rsp)
movl %esi, 0x2044(%rsp)
movl %edx, 0x2040(%rsp)
movl %ecx, 0x203c(%rsp)
movl %r8d, 0x2038(%rsp)
movl %r9d, 0x2034(%rsp)
movl 0x2034(%rsp), %eax
cmpl 0x203c(%rsp), %eax
je 0x19320
movl 0x2034(%rsp), %eax
cmpl 0x2038(%rsp), %eax
jne 0x193ab
leaq 0x1800(%rsp), %rdi
movl 0x2034(%rsp), %edx
movl 0x203c(%rsp), %ecx
movl 0x2038(%rsp), %r8d
leaq 0x1ba7c7(%rip), %rsi    # 0x1d3b0c
movb $0x0, %al
callq 0x5b9c0
leaq 0x1000(%rsp), %rdi
leaq 0x1800(%rsp), %rcx
leaq 0x1b8d1f(%rip), %rsi    # 0x1d2082
leaq 0x1ba7dc(%rip), %rdx    # 0x1d3b46
movb $0x0, %al
callq 0x5b9c0
movq 0x2060(%rsp), %rdi
leaq 0x1000(%rsp), %r8
leaq 0x1b8cac(%rip), %rsi    # 0x1d2034
leaq 0x1ba7ea(%rip), %rdx    # 0x1d3b79
movl $0x1b, %ecx
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x2054(%rsp)
jmp 0x19796
movq 0x2048(%rsp), %rax
movl 0x2044(%rsp), %ecx
shll $0x0, %ecx
addl 0x203c(%rsp), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x2048(%rsp), %rax
imull $0x0, 0x2044(%rsp), %ecx
addl 0x203c(%rsp), %ecx
movslq %ecx, %rcx
subsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x2020(%rsp)
movq 0x2048(%rsp), %rax
movl 0x2044(%rsp), %ecx
shll $0x0, %ecx
addl 0x2038(%rsp), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x2048(%rsp), %rax
imull $0x0, 0x2044(%rsp), %ecx
addl 0x2038(%rsp), %ecx
movslq %ecx, %rcx
subsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x2010(%rsp)
movl $0x1, 0x2030(%rsp)
movl 0x2030(%rsp), %eax
movl 0x2040(%rsp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x1978b
movsd 0x2020(%rsp), %xmm0
movsd %xmm0, 0x2028(%rsp)
movsd 0x2010(%rsp), %xmm0
movsd %xmm0, 0x2018(%rsp)
movq 0x2048(%rsp), %rax
movl 0x2030(%rsp), %ecx
addl $0x1, %ecx
imull 0x2044(%rsp), %ecx
addl 0x203c(%rsp), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x2048(%rsp), %rax
movl 0x2030(%rsp), %ecx
imull 0x2044(%rsp), %ecx
addl 0x203c(%rsp), %ecx
movslq %ecx, %rcx
subsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x2020(%rsp)
movq 0x2048(%rsp), %rax
movl 0x2030(%rsp), %ecx
addl $0x1, %ecx
imull 0x2044(%rsp), %ecx
addl 0x2038(%rsp), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x2048(%rsp), %rax
movl 0x2030(%rsp), %ecx
imull 0x2044(%rsp), %ecx
addl 0x2038(%rsp), %ecx
movslq %ecx, %rcx
subsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x2010(%rsp)
movsd 0x2028(%rsp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x1954b
jp 0x1954b
jmp 0x1955f
movsd 0x2020(%rsp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x195ca
jp 0x195ca
leaq 0x800(%rsp), %rdi
leaq 0x1ba7b6(%rip), %rsi    # 0x1d3d24
movb $0x0, %al
callq 0x5b9c0
movq %rsp, %rdi
leaq 0x800(%rsp), %rcx
leaq 0x1b8afb(%rip), %rsi    # 0x1d2082
leaq 0x1ba5f8(%rip), %rdx    # 0x1d3b86
movb $0x0, %al
callq 0x5b9c0
movq 0x2060(%rsp), %rdi
movq %rsp, %r8
leaq 0x1b8a8d(%rip), %rsi    # 0x1d2034
leaq 0x1ba5cb(%rip), %rdx    # 0x1d3b79
movl $0x28, %ecx
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x2054(%rsp)
jmp 0x19796
movsd 0x2020(%rsp), %xmm0
mulsd 0x2020(%rsp), %xmm0
movsd %xmm0, 0x2008(%rsp)
movsd 0x2028(%rsp), %xmm0
mulsd 0x2028(%rsp), %xmm0
movsd %xmm0, 0x2000(%rsp)
movsd 0x2008(%rsp), %xmm0
movsd 0x2018(%rsp), %xmm2
movsd 0x2000(%rsp), %xmm1
mulsd 0x2010(%rsp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd 0x2008(%rsp), %xmm1
movsd 0x2028(%rsp), %xmm3
movsd 0x2000(%rsp), %xmm2
mulsd 0x2020(%rsp), %xmm2
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movq 0x2048(%rsp), %rax
movl 0x2030(%rsp), %ecx
imull 0x2044(%rsp), %ecx
addl 0x2034(%rsp), %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
cmpl $0x1, 0x2030(%rsp)
jne 0x196f5
movsd 0x1b95ec(%rip), %xmm0   # 0x1d2c80
mulsd 0x2018(%rsp), %xmm0
divsd 0x2028(%rsp), %xmm0
movq 0x2048(%rsp), %rax
movl 0x2030(%rsp), %ecx
imull 0x2044(%rsp), %ecx
addl 0x2034(%rsp), %ecx
movslq %ecx, %rcx
subsd (%rax,%rcx,8), %xmm0
movq 0x2048(%rsp), %rax
movl 0x2030(%rsp), %ecx
subl $0x1, %ecx
imull 0x2044(%rsp), %ecx
addl 0x2034(%rsp), %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movl 0x2030(%rsp), %eax
movl 0x2040(%rsp), %ecx
subl $0x2, %ecx
cmpl %ecx, %eax
jne 0x19773
movsd 0x1b956e(%rip), %xmm0   # 0x1d2c80
mulsd 0x2010(%rsp), %xmm0
divsd 0x2020(%rsp), %xmm0
movq 0x2048(%rsp), %rax
movl 0x2030(%rsp), %ecx
imull 0x2044(%rsp), %ecx
addl 0x2034(%rsp), %ecx
movslq %ecx, %rcx
subsd (%rax,%rcx,8), %xmm0
movq 0x2048(%rsp), %rax
movl 0x2030(%rsp), %ecx
addl $0x1, %ecx
imull 0x2044(%rsp), %ecx
addl 0x2034(%rsp), %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
jmp 0x19775
movl 0x2030(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2030(%rsp)
jmp 0x19448
movl $0x0, 0x2054(%rsp)
movl 0x2054(%rsp), %eax
addq $0x2058, %rsp           # imm = 0x2058
retq
nopw %cs:(%rax,%rax)