// File: /workspace/github_c_makefile_star2_O0/PoulinV[P]AxiCLASS/build/../tools/arrays.c
// Function: array_interpolate_spline_transposed
int array_interpolate_spline_transposed(double * array,
                                        int x_size,
                                        int y_size,
                                        int index_x,
                                        int index_y,
                                        int index_ddy,
                                        double x,
                                        int * last_index,
                                        double * result,
                                        ErrorMsg errmsg) {

  int inf,sup,mid;
  double h,a,b;

  inf=0;
  sup=x_size-1;

  if (array[inf*y_size+index_x] < array[sup*y_size+index_x]){

    if (x < array[inf*y_size+index_x]) {
      class_sprintf(errmsg,"%s(L:%d) : x=%e < x_min=%e",__func__,__LINE__,x,array[inf*y_size+index_x]);
      return _FAILURE_;
    }

    if (x > array[sup*y_size+index_x]) {
      class_sprintf(errmsg,"%s(L:%d) : x=%e > x_max=%e",__func__,__LINE__,x,array[sup*y_size+index_x]);
      return _FAILURE_;
    }

    while (sup-inf > 1) {

      mid=(int)(0.5*(inf+sup));
      if (x < array[mid*y_size+index_x]) {sup=mid;}
      else {inf=mid;}

    }

  }

  else {

    if (x < array[sup*y_size+index_x]) {
      class_sprintf(errmsg,"%s(L:%d) : x=%e < x_min=%e",__func__,__LINE__,x,array[sup*y_size+index_x]);
      return _FAILURE_;
    }

    if (x > array[inf*y_size+index_x]) {
      class_sprintf(errmsg,"%s(L:%d) : x=%e > x_max=%e",__func__,__LINE__,x,array[inf*y_size+index_x]);
      return _FAILURE_;
    }

    while (sup-inf > 1) {

      mid=(int)(0.5*(inf+sup));
      if (x > array[mid*y_size+index_x]) {sup=mid;}
      else {inf=mid;}

    }

  }

  *last_index = inf;

  h = array[sup*y_size+index_x]-array[inf*y_size+index_x];
  b = (x - array[inf*y_size+index_x])/h;
  a = 1.0 - b;

  *result= (a*array[inf*y_size+index_y]+b*array[sup*y_size+index_y]
            + ((a*a*a-a)* array[inf*y_size+index_ddy] + (b*b*b-b)* array[sup*y_size+index_ddy])*h*h/6.);

  return _SUCCESS_;
}

// Assembly:
subq $0x68, %rsp
movq 0x80(%rsp), %rax
movq 0x78(%rsp), %rax
movq 0x70(%rsp), %rax
movq %rdi, 0x58(%rsp)
movl %esi, 0x54(%rsp)
movl %edx, 0x50(%rsp)
movl %ecx, 0x4c(%rsp)
movl %r8d, 0x48(%rsp)
movl %r9d, 0x44(%rsp)
movsd %xmm0, 0x38(%rsp)
movl $0x0, 0x34(%rsp)
movl 0x54(%rsp), %eax
subl $0x1, %eax
movl %eax, 0x30(%rsp)
movq 0x58(%rsp), %rax
movl 0x34(%rsp), %ecx
imull 0x50(%rsp), %ecx
addl 0x4c(%rsp), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm1
movq 0x58(%rsp), %rax
movl 0x30(%rsp), %ecx
imull 0x50(%rsp), %ecx
addl 0x4c(%rsp), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x23e7a
movsd 0x38(%rsp), %xmm1
movq 0x58(%rsp), %rax
movl 0x34(%rsp), %ecx
imull 0x50(%rsp), %ecx
addl 0x4c(%rsp), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x23d44
jmp 0x23ca4
movsd 0x38(%rsp), %xmm0
movq 0x58(%rsp), %rax
movl 0x34(%rsp), %ecx
imull 0x50(%rsp), %ecx
addl 0x4c(%rsp), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm1
xorl %eax, %eax
movl %eax, %esi
leaq 0x1b0437(%rip), %rdx    # 0x1d4106
leaq 0x1b0478(%rip), %rcx    # 0x1d414e
movl $0x6d1, %r8d            # imm = 0x6D1
movq %rsi, %rdi
movb $0x2, %al
callq 0x8540
movl %eax, 0xc(%rsp)
movq 0x80(%rsp), %rdi
movl 0xc(%rsp), %eax
addl $0x1, %eax
movslq %eax, %rsi
movsd 0x38(%rsp), %xmm0
movq 0x58(%rsp), %rax
movl 0x34(%rsp), %ecx
imull 0x50(%rsp), %ecx
addl 0x4c(%rsp), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm1
leaq 0x1b03e3(%rip), %rdx    # 0x1d4106
leaq 0x1b0424(%rip), %rcx    # 0x1d414e
movl $0x6d1, %r8d            # imm = 0x6D1
movb $0x2, %al
callq 0x8540
movl $0x1, 0x64(%rsp)
jmp 0x24217
movsd 0x38(%rsp), %xmm0
movq 0x58(%rsp), %rax
movl 0x30(%rsp), %ecx
imull 0x50(%rsp), %ecx
addl 0x4c(%rsp), %ecx
movslq %ecx, %rcx
ucomisd (%rax,%rcx,8), %xmm0
jbe 0x23e0c
jmp 0x23d6c
movsd 0x38(%rsp), %xmm0
movq 0x58(%rsp), %rax
movl 0x30(%rsp), %ecx
imull 0x50(%rsp), %ecx
addl 0x4c(%rsp), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm1
xorl %eax, %eax
movl %eax, %esi
leaq 0x1b039c(%rip), %rdx    # 0x1d4133
leaq 0x1b03b0(%rip), %rcx    # 0x1d414e
movl $0x6d6, %r8d            # imm = 0x6D6
movq %rsi, %rdi
movb $0x2, %al
callq 0x8540
movl %eax, 0x8(%rsp)
movq 0x80(%rsp), %rdi
movl 0x8(%rsp), %eax
addl $0x1, %eax
movslq %eax, %rsi
movsd 0x38(%rsp), %xmm0
movq 0x58(%rsp), %rax
movl 0x30(%rsp), %ecx
imull 0x50(%rsp), %ecx
addl 0x4c(%rsp), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm1
leaq 0x1b0348(%rip), %rdx    # 0x1d4133
leaq 0x1b035c(%rip), %rcx    # 0x1d414e
movl $0x6d6, %r8d            # imm = 0x6D6
movb $0x2, %al
callq 0x8540
movl $0x1, 0x64(%rsp)
jmp 0x24217
jmp 0x23e0e
movl 0x30(%rsp), %eax
subl 0x34(%rsp), %eax
cmpl $0x1, %eax
jle 0x23e75
movl 0x34(%rsp), %eax
addl 0x30(%rsp), %eax
cvtsi2sd %eax, %xmm1
movsd 0x1aee59(%rip), %xmm0   # 0x1d2c88
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0x2c(%rsp)
movsd 0x38(%rsp), %xmm1
movq 0x58(%rsp), %rax
movl 0x2c(%rsp), %ecx
imull 0x50(%rsp), %ecx
addl 0x4c(%rsp), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x23e6b
movl 0x2c(%rsp), %eax
movl %eax, 0x30(%rsp)
jmp 0x23e73
movl 0x2c(%rsp), %eax
movl %eax, 0x34(%rsp)
jmp 0x23e0e
jmp 0x24073
movsd 0x38(%rsp), %xmm1
movq 0x58(%rsp), %rax
movl 0x30(%rsp), %ecx
imull 0x50(%rsp), %ecx
addl 0x4c(%rsp), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x23f46
jmp 0x23ea6
movsd 0x38(%rsp), %xmm0
movq 0x58(%rsp), %rax
movl 0x30(%rsp), %ecx
imull 0x50(%rsp), %ecx
addl 0x4c(%rsp), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm1
xorl %eax, %eax
movl %eax, %esi
leaq 0x1b0235(%rip), %rdx    # 0x1d4106
leaq 0x1b0276(%rip), %rcx    # 0x1d414e
movl $0x6e7, %r8d            # imm = 0x6E7
movq %rsi, %rdi
movb $0x2, %al
callq 0x8540
movl %eax, 0x4(%rsp)
movq 0x80(%rsp), %rdi
movl 0x4(%rsp), %eax
addl $0x1, %eax
movslq %eax, %rsi
movsd 0x38(%rsp), %xmm0
movq 0x58(%rsp), %rax
movl 0x30(%rsp), %ecx
imull 0x50(%rsp), %ecx
addl 0x4c(%rsp), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm1
leaq 0x1b01e1(%rip), %rdx    # 0x1d4106
leaq 0x1b0222(%rip), %rcx    # 0x1d414e
movl $0x6e7, %r8d            # imm = 0x6E7
movb $0x2, %al
callq 0x8540
movl $0x1, 0x64(%rsp)
jmp 0x24217
movsd 0x38(%rsp), %xmm0
movq 0x58(%rsp), %rax
movl 0x34(%rsp), %ecx
imull 0x50(%rsp), %ecx
addl 0x4c(%rsp), %ecx
movslq %ecx, %rcx
ucomisd (%rax,%rcx,8), %xmm0
jbe 0x2400c
jmp 0x23f6e
movsd 0x38(%rsp), %xmm0
movq 0x58(%rsp), %rax
movl 0x34(%rsp), %ecx
imull 0x50(%rsp), %ecx
addl 0x4c(%rsp), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm1
xorl %eax, %eax
movl %eax, %esi
leaq 0x1b019a(%rip), %rdx    # 0x1d4133
leaq 0x1b01ae(%rip), %rcx    # 0x1d414e
movl $0x6ec, %r8d            # imm = 0x6EC
movq %rsi, %rdi
movb $0x2, %al
callq 0x8540
movl %eax, (%rsp)
movq 0x80(%rsp), %rdi
movl (%rsp), %eax
addl $0x1, %eax
movslq %eax, %rsi
movsd 0x38(%rsp), %xmm0
movq 0x58(%rsp), %rax
movl 0x34(%rsp), %ecx
imull 0x50(%rsp), %ecx
addl 0x4c(%rsp), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm1
leaq 0x1b0148(%rip), %rdx    # 0x1d4133
leaq 0x1b015c(%rip), %rcx    # 0x1d414e
movl $0x6ec, %r8d            # imm = 0x6EC
movb $0x2, %al
callq 0x8540
movl $0x1, 0x64(%rsp)
jmp 0x24217
jmp 0x2400e
movl 0x30(%rsp), %eax
subl 0x34(%rsp), %eax
cmpl $0x1, %eax
jle 0x24071
movl 0x34(%rsp), %eax
addl 0x30(%rsp), %eax
cvtsi2sd %eax, %xmm1
movsd 0x1aec59(%rip), %xmm0   # 0x1d2c88
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0x2c(%rsp)
movsd 0x38(%rsp), %xmm0
movq 0x58(%rsp), %rax
movl 0x2c(%rsp), %ecx
imull 0x50(%rsp), %ecx
addl 0x4c(%rsp), %ecx
movslq %ecx, %rcx
ucomisd (%rax,%rcx,8), %xmm0
jbe 0x24067
movl 0x2c(%rsp), %eax
movl %eax, 0x30(%rsp)
jmp 0x2406f
movl 0x2c(%rsp), %eax
movl %eax, 0x34(%rsp)
jmp 0x2400e
jmp 0x24073
movl 0x34(%rsp), %ecx
movq 0x70(%rsp), %rax
movl %ecx, (%rax)
movq 0x58(%rsp), %rax
movl 0x30(%rsp), %ecx
imull 0x50(%rsp), %ecx
addl 0x4c(%rsp), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x58(%rsp), %rax
movl 0x34(%rsp), %ecx
imull 0x50(%rsp), %ecx
addl 0x4c(%rsp), %ecx
movslq %ecx, %rcx
subsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x20(%rsp)
movsd 0x38(%rsp), %xmm0
movq 0x58(%rsp), %rax
movl 0x34(%rsp), %ecx
imull 0x50(%rsp), %ecx
addl 0x4c(%rsp), %ecx
movslq %ecx, %rcx
subsd (%rax,%rcx,8), %xmm0
divsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x1ae15c(%rip), %xmm0   # 0x1d2248
subsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x18(%rsp), %xmm0
movq 0x58(%rsp), %rax
movl 0x34(%rsp), %ecx
imull 0x50(%rsp), %ecx
addl 0x48(%rsp), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm2
movsd 0x10(%rsp), %xmm1
movq 0x58(%rsp), %rax
movl 0x30(%rsp), %ecx
imull 0x50(%rsp), %ecx
addl 0x48(%rsp), %ecx
movslq %ecx, %rcx
mulsd (%rax,%rcx,8), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd 0x18(%rsp), %xmm1
mulsd 0x18(%rsp), %xmm1
movsd 0x18(%rsp), %xmm3
movsd 0x18(%rsp), %xmm2
movq %xmm2, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm2
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
movq 0x58(%rsp), %rax
movl 0x34(%rsp), %ecx
imull 0x50(%rsp), %ecx
addl 0x44(%rsp), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm3
movsd 0x10(%rsp), %xmm2
mulsd 0x10(%rsp), %xmm2
movsd 0x10(%rsp), %xmm5
movsd 0x10(%rsp), %xmm4
movq %xmm4, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm4
mulsd %xmm5, %xmm2
addsd %xmm4, %xmm2
movq 0x58(%rsp), %rax
movl 0x30(%rsp), %ecx
imull 0x50(%rsp), %ecx
addl 0x44(%rsp), %ecx
movslq %ecx, %rcx
mulsd (%rax,%rcx,8), %xmm2
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
mulsd 0x20(%rsp), %xmm1
mulsd 0x20(%rsp), %xmm1
movsd 0x1af48a(%rip), %xmm2   # 0x1d3688
divsd %xmm2, %xmm1
addsd %xmm1, %xmm0
movq 0x78(%rsp), %rax
movsd %xmm0, (%rax)
movl $0x0, 0x64(%rsp)
movl 0x64(%rsp), %eax
addq $0x68, %rsp
retq