// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x168, %rsp            # imm = 0x168
movw %r9w, %ax
movq 0x170(%rsp), %r9
movq %rdi, 0x158(%rsp)
movl %esi, 0x154(%rsp)
movq %rdx, 0x148(%rsp)
movl %ecx, 0x144(%rsp)
movq %r8, 0x138(%rsp)
movw %ax, 0x136(%rsp)
movl 0x154(%rsp), %eax
subl $0x1, %eax
imull 0x144(%rsp), %eax
movslq %eax, %rdi
shlq $0x3, %rdi
callq 0x8460
movq %rax, 0x110(%rsp)
movslq 0x144(%rsp), %rdi
shlq $0x3, %rdi
callq 0x8460
movq %rax, 0x128(%rsp)
movslq 0x144(%rsp), %rdi
shlq $0x3, %rdi
callq 0x8460
movq %rax, 0x120(%rsp)
movslq 0x144(%rsp), %rdi
shlq $0x3, %rdi
callq 0x8460
movq %rax, 0x118(%rsp)
cmpq $0x0, 0x110(%rsp)
jne 0x20948
jmp 0x208df
xorl %eax, %eax
movl %eax, %esi
leaq 0x1b351a(%rip), %rdx    # 0x1d3e04
leaq 0x1b36f9(%rip), %rcx    # 0x1d3fea
movl $0x431, %r8d            # imm = 0x431
movq %rsi, %rdi
movb $0x0, %al
callq 0x8540
movl %eax, 0x108(%rsp)
movq 0x170(%rsp), %rdi
movl 0x108(%rsp), %eax
addl $0x1, %eax
movslq %eax, %rsi
leaq 0x1b34e0(%rip), %rdx    # 0x1d3e04
leaq 0x1b36bf(%rip), %rcx    # 0x1d3fea
movl $0x431, %r8d            # imm = 0x431
movb $0x0, %al
callq 0x8540
movl $0x1, 0x164(%rsp)
jmp 0x20d2d
cmpq $0x0, 0x128(%rsp)
jne 0x209be
jmp 0x20955
xorl %eax, %eax
movl %eax, %esi
leaq 0x1b3558(%rip), %rdx    # 0x1d3eb8
leaq 0x1b3683(%rip), %rcx    # 0x1d3fea
movl $0x435, %r8d            # imm = 0x435
movq %rsi, %rdi
movb $0x0, %al
callq 0x8540
movl %eax, 0x104(%rsp)
movq 0x170(%rsp), %rdi
movl 0x104(%rsp), %eax
addl $0x1, %eax
movslq %eax, %rsi
leaq 0x1b351e(%rip), %rdx    # 0x1d3eb8
leaq 0x1b3649(%rip), %rcx    # 0x1d3fea
movl $0x435, %r8d            # imm = 0x435
movb $0x0, %al
callq 0x8540
movl $0x1, 0x164(%rsp)
jmp 0x20d2d
cmpq $0x0, 0x120(%rsp)
jne 0x20a34
jmp 0x209cb
xorl %eax, %eax
movl %eax, %esi
leaq 0x1b34fd(%rip), %rdx    # 0x1d3ed3
leaq 0x1b360d(%rip), %rcx    # 0x1d3fea
movl $0x439, %r8d            # imm = 0x439
movq %rsi, %rdi
movb $0x0, %al
callq 0x8540
movl %eax, 0x100(%rsp)
movq 0x170(%rsp), %rdi
movl 0x100(%rsp), %eax
addl $0x1, %eax
movslq %eax, %rsi
leaq 0x1b34c3(%rip), %rdx    # 0x1d3ed3
leaq 0x1b35d3(%rip), %rcx    # 0x1d3fea
movl $0x439, %r8d            # imm = 0x439
movb $0x0, %al
callq 0x8540
movl $0x1, 0x164(%rsp)
jmp 0x20d2d
cmpq $0x0, 0x118(%rsp)
jne 0x20aaa
jmp 0x20a41
xorl %eax, %eax
movl %eax, %esi
leaq 0x1b34a3(%rip), %rdx    # 0x1d3eef
leaq 0x1b3597(%rip), %rcx    # 0x1d3fea
movl $0x43d, %r8d            # imm = 0x43D
movq %rsi, %rdi
movb $0x0, %al
callq 0x8540
movl %eax, 0xfc(%rsp)
movq 0x170(%rsp), %rdi
movl 0xfc(%rsp), %eax
addl $0x1, %eax
movslq %eax, %rsi
leaq 0x1b3469(%rip), %rdx    # 0x1d3eef
leaq 0x1b355d(%rip), %rcx    # 0x1d3fea
movl $0x43d, %r8d            # imm = 0x43D
movb $0x0, %al
callq 0x8540
movl $0x1, 0x164(%rsp)
jmp 0x20d2d
cmpl $0x2, 0x154(%rsp)
jne 0x20abe
movw $0x0, 0x136(%rsp)
callq 0x2edc0
movl %eax, %esi
leaq 0xb8(%rsp), %rdi
callq 0x2ef50
leaq 0xa0(%rsp), %rdi
callq 0x2f070
movl $0x0, 0x10c(%rsp)
movl 0x10c(%rsp), %eax
cmpl 0x144(%rsp), %eax
jge 0x20c16
movw 0x136(%rsp), %ax
movw %ax, 0x40(%rsp)
movq 0x138(%rsp), %rax
movq %rax, 0x48(%rsp)
movl 0x10c(%rsp), %eax
movl %eax, 0x50(%rsp)
movl 0x154(%rsp), %eax
movl %eax, 0x54(%rsp)
movq 0x110(%rsp), %rax
movq %rax, 0x58(%rsp)
movl 0x144(%rsp), %eax
movl %eax, 0x60(%rsp)
movq 0x158(%rsp), %rax
movq %rax, 0x68(%rsp)
movq 0x148(%rsp), %rax
movq %rax, 0x70(%rsp)
movq 0x128(%rsp), %rax
movq %rax, 0x78(%rsp)
movq 0x120(%rsp), %rax
movq %rax, 0x80(%rsp)
movq 0x118(%rsp), %rax
movq %rax, 0x88(%rsp)
leaq 0x90(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
leaq 0x40(%rsp), %rdx
callq 0x20d50
jmp 0x20ba9
leaq 0xa0(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x2f080
jmp 0x20bc0
leaq 0x90(%rsp), %rdi
callq 0x2f0b0
movl 0x10c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x10c(%rsp)
jmp 0x20aea
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x38(%rsp)
movl %eax, 0x34(%rsp)
jmp 0x20d11
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x38(%rsp)
movl %eax, 0x34(%rsp)
leaq 0x90(%rsp), %rdi
callq 0x2f0b0
jmp 0x20d11
leaq 0xa0(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x28(%rsp), %rdi
callq 0x2f0c0
movq %rax, 0x20(%rsp)
movq 0x28(%rsp), %rdi
callq 0x2f0f0
movq %rax, 0x18(%rsp)
leaq 0x20(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x2f120
testb $0x1, %al
jne 0x20c56
jmp 0x20ca1
leaq 0x20(%rsp), %rdi
callq 0x2f160
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rdi
callq 0x2f170
movl %eax, 0x8(%rsp)
jmp 0x20c75
movl 0x8(%rsp), %eax
cmpl $0x0, %eax
je 0x20c93
movl $0x1, 0x164(%rsp)
movl $0x1, 0xc(%rsp)
jmp 0x20cf5
jmp 0x20c95
leaq 0x20(%rsp), %rdi
callq 0x2f1f0
jmp 0x20c41
leaq 0xa0(%rsp), %rdi
callq 0x2f210
movq 0x120(%rsp), %rdi
callq 0x8420
movq 0x128(%rsp), %rdi
callq 0x8420
movq 0x110(%rsp), %rdi
callq 0x8420
movq 0x118(%rsp), %rdi
callq 0x8420
movl $0x0, 0x164(%rsp)
movl $0x1, 0xc(%rsp)
leaq 0xa0(%rsp), %rdi
callq 0x2f230
leaq 0xb8(%rsp), %rdi
callq 0x2f290
jmp 0x20d2d
leaq 0xa0(%rsp), %rdi
callq 0x2f230
leaq 0xb8(%rsp), %rdi
callq 0x2f290
jmp 0x20d3c
movl 0x164(%rsp), %eax
addq $0x168, %rsp            # imm = 0x168
retq
movq 0x38(%rsp), %rdi
callq 0x8640
nopw %cs:(%rax,%rax)