// File: /workspace/github_c_makefile_star2_O1/PoulinV[P]AxiCLASS/build/../tools/arrays.c
// Function: array_spline_table_columns2
int array_spline_table_columns2(
		       double * x, /* vector of size x_size */
		       int x_size,
		       double * y_array, /* array of size x_size*y_size with elements
					  y_array[index_y*x_size+index_x] */
		       int y_size,
		       double * ddy_array, /* array of size x_size*y_size */
		       short spline_mode,
		       ErrorMsg errmsg
		       ) {

  double * p;
  double * qn;
  double * un;
  double * u;

  int index_y;

  u = (double*)malloc((x_size-1) * y_size * sizeof(double));
  p = (double*)malloc(y_size * sizeof(double));
  qn = (double*)malloc(y_size * sizeof(double));
  un = (double*)malloc(y_size * sizeof(double));
  if (u == NULL) {
    class_sprintf(errmsg,"%s(L:%d) Cannot allocate u",__func__,__LINE__);
    return _FAILURE_;
  }
  if (p == NULL) {
    class_sprintf(errmsg,"%s(L:%d) Cannot allocate p",__func__,__LINE__);
    return _FAILURE_;
  }
  if (qn == NULL) {
    class_sprintf(errmsg,"%s(L:%d) Cannot allocate qn",__func__,__LINE__);
    return _FAILURE_;
  }
  if (un == NULL) {
    class_sprintf(errmsg,"%s(L:%d) Cannot allocate un",__func__,__LINE__);
    return _FAILURE_;
  }

  if (x_size==2) spline_mode = _SPLINE_NATURAL_; // in the case of only 2 x-values, only the natural spline method is appropriate, for _SPLINE_EST_DERIV_ 3 x-values are needed.

  class_setup_parallel();

  for (index_y=0; index_y < y_size; index_y++) {

    class_run_parallel(=,

      double dy_first;
      double dy_last;
      int index_x;
      double sig;
      if (spline_mode == _SPLINE_NATURAL_) {
        ddy_array[index_y*x_size+0] = 0.0;
        u[0*y_size+index_y] = 0.0;
      }
      else {
        dy_first =
          ((x[2]-x[0])*(x[2]-x[0])*
           (y_array[index_y*x_size+1]-y_array[index_y*x_size+0])-
           (x[1]-x[0])*(x[1]-x[0])*
           (y_array[index_y*x_size+2]-y_array[index_y*x_size+0]))/
          ((x[2]-x[0])*(x[1]-x[0])*(x[2]-x[1]));

        ddy_array[index_y*x_size+0] = -0.5;

        u[0*y_size+index_y] =
          (3./(x[1] -  x[0]))*
          ((y_array[index_y*x_size+1]-y_array[index_y*x_size+0])/
           (x[1] - x[0])-dy_first);

      }

      for (index_x=1; index_x < x_size-1; index_x++) {

        sig = (x[index_x] - x[index_x-1])/(x[index_x+1] - x[index_x-1]);

        p[index_y] = sig * ddy_array[index_y*x_size+(index_x-1)] + 2.0;

        ddy_array[index_y*x_size+index_x] = (sig-1.0)/p[index_y];

        u[index_x*y_size+index_y] =
          (y_array[index_y*x_size+(index_x+1)] - y_array[index_y*x_size+index_x])
          / (x[index_x+1] - x[index_x])
          - (y_array[index_y*x_size+index_x] - y_array[index_y*x_size+(index_x-1)])
          / (x[index_x] - x[index_x-1]);

        u[index_x*y_size+index_y] = (6.0 * u[index_x*y_size+index_y] /
                                     (x[index_x+1] - x[index_x-1])
                                     - sig * u[(index_x-1)*y_size+index_y]) / p[index_y];

      }

      if (spline_mode == _SPLINE_NATURAL_) {

        qn[index_y]=un[index_y]=0.0;

      }
      else {

        dy_last =
          ((x[x_size-3]-x[x_size-1])*(x[x_size-3]-x[x_size-1])*
           (y_array[index_y*x_size+(x_size-2)]-y_array[index_y*x_size+(x_size-1)])-
           (x[x_size-2]-x[x_size-1])*(x[x_size-2]-x[x_size-1])*
           (y_array[index_y*x_size+(x_size-3)]-y_array[index_y*x_size+(x_size-1)]))/
          ((x[x_size-3]-x[x_size-1])*(x[x_size-2]-x[x_size-1])*(x[x_size-3]-x[x_size-2]));

        qn[index_y]=0.5;

        un[index_y]=
          (3./(x[x_size-1] - x[x_size-2]))*
          (dy_last-(y_array[index_y*x_size+(x_size-1)] - y_array[index_y*x_size+(x_size-2)])/
           (x[x_size-1] - x[x_size-2]));

      }

      index_x=x_size-1;

      ddy_array[index_y*x_size+index_x] =
        (un[index_y] - qn[index_y] * u[(index_x-1)*y_size+index_y]) /
        (qn[index_y] * ddy_array[index_y*x_size+(index_x-1)] + 1.0);

      for (index_x=x_size-2; index_x >= 0; index_x--) {

        ddy_array[index_y*x_size+index_x] = ddy_array[index_y*x_size+index_x] *
          ddy_array[index_y*x_size+(index_x+1)] + u[index_x*y_size+index_y];

      }
      return _SUCCESS_;
    );
  }

  class_finish_parallel();

  free(qn);
  free(p);
  free(u);
  free(un);

  return _SUCCESS_;
 }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movl %r9d, (%rsp)
movq %r8, 0xa0(%rsp)
movl %ecx, %ebp
movq %rdx, 0x98(%rsp)
movq %rdi, 0x90(%rsp)
movq 0x120(%rsp), %r14
movq %rsi, 0x70(%rsp)
leal -0x1(%rsi), %eax
imull %ecx, %eax
movslq %eax, %rdi
shlq $0x3, %rdi
callq 0x8460
movq %rax, %r15
movslq %ebp, %rbx
shlq $0x3, %rbx
movq %rbx, %rdi
callq 0x8460
movq %rax, %r13
movq %rbx, %rdi
callq 0x8460
movq %rax, 0x28(%rsp)
movq %rbx, %rdi
callq 0x8460
movq %rax, 0x20(%rsp)
movq %r15, 0x68(%rsp)
testq %r15, %r15
je 0x16314
testq %r13, %r13
je 0x16352
cmpq $0x0, 0x28(%rsp)
je 0x16390
cmpq $0x0, 0x20(%rsp)
je 0x16426
xorl %ecx, %ecx
cmpl $0x2, 0x70(%rsp)
movl (%rsp), %eax
movl $0x0, 0x4(%rsp)
cmovel %ecx, %eax
movl %eax, (%rsp)
callq 0x1c5f0
leaq 0xa8(%rsp), %rdi
movl %eax, %esi
callq 0x1c6a0
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rsp)
movq $0x0, 0x50(%rsp)
testl %ebp, %ebp
jle 0x162eb
movabsq $0x100000001, %rbx      # imm = 0x100000001
leaq 0x134165(%rip), %rax    # 0x14a1f0
addq $0x10, %rax
movq %rax, 0x88(%rsp)
movq %r13, 0x60(%rsp)
movl %ebp, 0x1c(%rsp)
movl $0x20, %edi
callq 0x83b0
movq %rax, %r12
movq %rbx, 0x8(%rax)
movq 0x88(%rsp), %rax
movq %rax, (%r12)
movl $0x88, %edi
callq 0x83b0
movq %rbx, %rcx
movq %rax, %rbx
movq %rcx, 0x8(%rax)
leaq 0x1341d8(%rip), %rax    # 0x14a2b0
movq %rax, (%rbx)
movq %rbx, %r14
addq $0x10, %r14
movq %r14, %rdi
leaq 0x8(%rsp), %rsi
callq 0x1d42e
movq %r14, 0x10(%r12)
leaq 0x134205(%rip), %rax    # 0x14a300
movq %rax, 0x10(%rbx)
movl (%rsp), %eax
movw %ax, 0x38(%rbx)
movq 0xa0(%rsp), %rax
movq %rax, 0x40(%rbx)
movl 0x4(%rsp), %eax
movl %eax, 0x48(%rbx)
movq 0x70(%rsp), %rax
movl %eax, 0x4c(%rbx)
movq 0x68(%rsp), %rax
movq %rax, 0x50(%rbx)
movl %ebp, 0x58(%rbx)
movq 0x90(%rsp), %rax
movq %rax, 0x60(%rbx)
movq 0x98(%rsp), %rax
movq %rax, 0x68(%rbx)
movq %r13, 0x70(%rbx)
movq 0x28(%rsp), %rax
movq %rax, 0x78(%rbx)
movq 0x20(%rsp), %rax
movq %rax, 0x80(%rbx)
movq %rbx, 0x18(%r12)
movq %r12, %rbx
addq $0x10, %rbx
leaq 0x78(%rsp), %rdi
movq %rbx, %rsi
callq 0x1d35e
movq %rbx, 0x30(%rsp)
movq %r12, 0x38(%rsp)
movq 0x135e28(%rip), %rax    # 0x14bfb0
cmpb $0x0, (%rax)
je 0x16194
incl 0x8(%r12)
jmp 0x1619a
lock
incl 0x8(%r12)
movl $0x1, %ebx
lock
xaddl %ebx, 0xc8(%rsp)
movl 0xa8(%rsp), %ecx
testl %ecx, %ecx
je 0x1622d
xorl %ebp, %ebp
leal (%rbx,%rbp), %eax
xorl %edx, %edx
divl %ecx
movq 0xd0(%rsp), %r14
imulq $0xb0, %rdx, %r15
leaq (%r14,%r15), %rdi
addq $0x58, %rdi
movq %rdi, 0x8(%rsp)
callq 0x8080
movl %eax, %r13d
testl %eax, %eax
sete 0x10(%rsp)
je 0x161f5
leaq 0x8(%rsp), %rdi
callq 0x1d17a
jmp 0x1621b
addq %r15, %r14
movq %r14, %rdi
leaq 0x30(%rsp), %rsi
callq 0x1c3b8
leaq 0x8(%rsp), %rdi
callq 0x1d17a
subq $-0x80, %r14
movq %r14, %rdi
callq 0x81c0
testl %r13d, %r13d
je 0x1628e
incl %ebp
movl 0xa8(%rsp), %ecx
cmpl %ecx, %ebp
jb 0x161b5
movl %ebx, %eax
xorl %edx, %edx
divl 0xa8(%rsp)
movq 0xd0(%rsp), %rbx
imulq $0xb0, %rdx, %r14
leaq (%rbx,%r14), %rax
addq $0x58, %rax
movq %rax, 0x8(%rsp)
movb $0x0, 0x10(%rsp)
leaq 0x8(%rsp), %rdi
callq 0x1d20a
addq %r14, %rbx
movb $0x1, 0x10(%rsp)
movq %rbx, %rdi
leaq 0x30(%rsp), %rsi
callq 0x1c3b8
leaq 0x8(%rsp), %rdi
callq 0x1d17a
subq $-0x80, %rbx
movq %rbx, %rdi
callq 0x81c0
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
movl 0x1c(%rsp), %ebp
je 0x162a1
callq 0x1d2a6
movq 0x60(%rsp), %r13
movabsq $0x100000001, %rbx      # imm = 0x100000001
movq %r12, %rdi
callq 0x1d2a6
leaq 0x40(%rsp), %rdi
leaq 0x78(%rsp), %rsi
callq 0x1dcb8
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x162d9
callq 0x1d2a6
movl 0x4(%rsp), %eax
incl %eax
movl %eax, 0x4(%rsp)
cmpl %ebp, %eax
jne 0x160a0
movq 0x40(%rsp), %rbx
movq 0x48(%rsp), %r14
cmpq %r14, %rbx
je 0x163ce
movq %rbx, %rdi
callq 0x1c724
testl %eax, %eax
jne 0x1647f
addq $0x10, %rbx
jmp 0x162f5
leaq 0xdcaf2(%rip), %rbx     # 0xf2e0d
leaq 0xdccd1(%rip), %r15     # 0xf2ff3
xorl %edi, %edi
xorl %esi, %esi
movq %rbx, %rdx
movq %r15, %rcx
movl $0x431, %r8d            # imm = 0x431
xorl %eax, %eax
callq 0x8550
incl %eax
movslq %eax, %rsi
movq %r14, %rdi
movq %rbx, %rdx
movq %r15, %rcx
movl $0x431, %r8d            # imm = 0x431
jmp 0x1645f
leaq 0xdcb68(%rip), %rbx     # 0xf2ec1
leaq 0xdcc93(%rip), %r15     # 0xf2ff3
xorl %edi, %edi
xorl %esi, %esi
movq %rbx, %rdx
movq %r15, %rcx
movl $0x435, %r8d            # imm = 0x435
xorl %eax, %eax
callq 0x8550
incl %eax
movslq %eax, %rsi
movq %r14, %rdi
movq %rbx, %rdx
movq %r15, %rcx
movl $0x435, %r8d            # imm = 0x435
jmp 0x1645f
leaq 0xdcb45(%rip), %rbx     # 0xf2edc
leaq 0xdcc55(%rip), %r15     # 0xf2ff3
xorl %edi, %edi
xorl %esi, %esi
movq %rbx, %rdx
movq %r15, %rcx
movl $0x439, %r8d            # imm = 0x439
xorl %eax, %eax
callq 0x8550
incl %eax
movslq %eax, %rsi
movq %r14, %rdi
movq %rbx, %rdx
movq %r15, %rcx
movl $0x439, %r8d            # imm = 0x439
jmp 0x1645f
movq 0x40(%rsp), %rbx
movq 0x48(%rsp), %r14
cmpq %rbx, %r14
je 0x163fc
movq %rbx, %r15
movq 0x8(%r15), %rdi
testq %rdi, %rdi
je 0x163ee
callq 0x1d2a6
addq $0x10, %r15
cmpq %r14, %r15
jne 0x163e0
movq %rbx, 0x48(%rsp)
movq 0x28(%rsp), %rdi
callq 0x8410
movq %r13, %rdi
callq 0x8410
movq 0x68(%rsp), %rdi
callq 0x8410
movq 0x20(%rsp), %rdi
callq 0x8410
xorl %ebx, %ebx
jmp 0x16484
leaq 0xdcacb(%rip), %rbx     # 0xf2ef8
leaq 0xdcbbf(%rip), %r15     # 0xf2ff3
xorl %edi, %edi
xorl %esi, %esi
movq %rbx, %rdx
movq %r15, %rcx
movl $0x43d, %r8d            # imm = 0x43D
xorl %eax, %eax
callq 0x8550
incl %eax
movslq %eax, %rsi
movq %r14, %rdi
movq %rbx, %rdx
movq %r15, %rcx
movl $0x43d, %r8d            # imm = 0x43D
xorl %eax, %eax
callq 0x8550
movl $0x1, %ebx
movl %ebx, %eax
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x1, %ebx
leaq 0x40(%rsp), %rdi
callq 0x1c770
leaq 0xa8(%rsp), %rdi
callq 0x1c7b0
jmp 0x1646b
jmp 0x164a6
movq %rax, %r14
jmp 0x164e9
jmp 0x164dc
movq %rax, %r14
jmp 0x16512
movq %rax, %r14
jmp 0x164bb
movq %rax, %r14
movq %rbx, %rdi
callq 0x8380
movq %r12, %rdi
callq 0x8380
jmp 0x16512
movq %rax, %r14
jmp 0x1650a
movq %rax, %r14
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
jne 0x1650d
jmp 0x16512
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0x1d17a
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x164f8
callq 0x1d2a6
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x1650a
callq 0x1d2a6
movq %r12, %rdi
callq 0x1d2a6
leaq 0x40(%rsp), %rdi
callq 0x1c770
leaq 0xa8(%rsp), %rdi
callq 0x1c7b0
movq %r14, %rdi
callq 0x8650