// File: /workspace/github_c_makefile_star2_O2/PoulinV[P]AxiCLASS/build/../tools/evolver_ndf15.c
// Function: interp_from_difold
int interp_from_difold(double tinterp,double tnew,double *ynew,double h,double **dif,int k, double *yinterp,
            double *ypinterp, double *yppinterp, int* index, int neq, int output){
  /* Output=1: only y_vector. Output=2: y and y prime. Output=3: y, yp and ypp*/
  int i,j,m,l,p,factor;
  double sumj,suml,sump,prodm,s;
  s = (tinterp - tnew)/h;
  if (k==1){
    for(i=1;i<=neq;i++){
      if(index[i]==_TRUE_){
        yinterp[i] = ynew[i] + dif[i][1] * s;
        if (output>1) ypinterp[i] = dif[i][1]/h;
        if (output>2) yppinterp[i] = 0; /* No good estimate can be made of the second derivative */
      }
    }
  }
  else{
    /*This gets tricky */
    for(i=1;i<=neq;i++){
      if(index[i]==_TRUE_){
        /*First the value of the function:    */
        sumj=0.0;
        factor=1;
        for(j=1;j<=k;j++){
          prodm=1.0;
          factor*=j;
          for(m=0;m<j;m++) prodm*=(m+s);
          sumj+=dif[i][j]/factor*prodm;
        }
        yinterp[i] = ynew[i]+sumj;
        /* Now the first derivative: */
        if (output>1){
          factor = 1;
          sumj=0.0;
          for(j=1;j<=k;j++){
            suml = 0.0;
            factor *=j;
            for(l=0;l<j;l++){
              prodm=1.0;
              for(m=0;m<j;m++){
            if(m!=l) prodm*=(m+s);
              }
              suml+=prodm;
            }
            sumj+=dif[i][j]/factor*suml;
          }
          ypinterp[i] = sumj/h;
        }
        /* The second derivative: */
        if (output>2){
          factor=1;
          sumj=0.0;
          for(j=1;j<=k;j++){
            suml=0.0;
            factor*=j;
            for(l=0;l<j;l++){
              sump=0.0;
              for(p=0;p<j;p++){
                if(p!=l){
                  prodm=1.0;
                  for(m=0;m<j;m++){
                    if((m!=l)&&(m!=p)){
                      prodm*=(m+s);
                    }
                  }
                  sump+=prodm;
                }
              }
              suml+=sump;
            }
            sumj+=dif[i][j]/factor*suml;
          }
          yppinterp[i] = sumj/(h*h);
        }
      }
    }
  }
  return _SUCCESS_;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %r9, -0x10(%rsp)
movq %r8, -0x8(%rsp)
movl 0x48(%rsp), %eax
movl 0x40(%rsp), %r10d
movq 0x38(%rsp), %r11
subsd %xmm1, %xmm0
divsd %xmm2, %xmm0
cmpl $0x1, %edx
jne 0x10098
xorl %edx, %edx
testl %r10d, %r10d
cmovlel %edx, %r10d
shlq $0x2, %r10
movq -0x8(%rsp), %r8
cmpq %rdx, %r10
je 0x102a4
cmpl $0x1, 0x4(%r11,%rdx)
jne 0x10092
movq 0x8(%rsi,%rdx,2), %r9
movsd 0x8(%r9), %xmm1
mulsd %xmm0, %xmm1
addsd 0x8(%rdi,%rdx,2), %xmm1
movsd %xmm1, 0x8(%rcx,%rdx,2)
cmpl $0x2, %eax
jl 0x10092
movsd 0x8(%r9), %xmm1
divsd %xmm2, %xmm1
movsd %xmm1, 0x8(%r8,%rdx,2)
je 0x10092
movq -0x10(%rsp), %r9
andq $0x0, 0x8(%r9,%rdx,2)
addq $0x4, %rdx
jmp 0x10043
movapd %xmm2, %xmm1
mulsd %xmm2, %xmm1
xorl %r9d, %r9d
testl %edx, %edx
cmovlel %r9d, %edx
incl %edx
testl %r10d, %r10d
cmovlel %r9d, %r10d
incl %r10d
movabsq $0x1, %r8
movl $0x1, %r12d
movsd 0xd5193(%rip), %xmm3    # 0xe5260
movq %r8, %r14
cmpq %r10, %r14
je 0x102a4
cmpl $0x1, (%r11,%r14,4)
jne 0x1029c
xorpd %xmm4, %xmm4
movq %r8, %r15
movl %r12d, %ebp
cmpq %rdx, %r15
je 0x10139
xorpd %xmm6, %xmm6
movq %r15, %r9
movapd %xmm3, %xmm5
subq $0x1, %r9
jb 0x10116
movapd %xmm0, %xmm7
addsd %xmm6, %xmm7
mulsd %xmm7, %xmm5
addsd %xmm3, %xmm6
jmp 0x100fe
imull %r15d, %ebp
movq (%rsi,%r14,8), %r9
movsd (%r9,%r15,8), %xmm6
cvtsi2sd %ebp, %xmm7
divsd %xmm7, %xmm6
mulsd %xmm5, %xmm6
addsd %xmm6, %xmm4
incq %r15
jmp 0x100ee
addsd (%rdi,%r14,8), %xmm4
movsd %xmm4, (%rcx,%r14,8)
cmpl $0x2, %eax
jl 0x1029c
xorpd %xmm4, %xmm4
movq %r8, %r15
movl %r12d, %ebx
cmpq %rdx, %r15
je 0x101c6
xorpd %xmm5, %xmm5
xorl %r13d, %r13d
movl %r13d, %r9d
cmpq %r9, %r15
je 0x101a2
xorpd %xmm6, %xmm6
xorl %r9d, %r9d
movapd %xmm3, %xmm7
cmpq %r9, %r15
je 0x10199
cmpl %r9d, %r13d
je 0x10190
movapd %xmm0, %xmm8
addsd %xmm6, %xmm8
mulsd %xmm8, %xmm7
addsd %xmm3, %xmm6
incq %r9
jmp 0x10177
addsd %xmm7, %xmm5
incq %r13
jmp 0x10164
imull %r15d, %r12d
movq (%rsi,%r14,8), %r9
movsd (%r9,%r15,8), %xmm6
cvtsi2sd %r12d, %xmm7
divsd %xmm7, %xmm6
mulsd %xmm5, %xmm6
addsd %xmm6, %xmm4
incq %r15
jmp 0x10158
divsd %xmm2, %xmm4
movq -0x8(%rsp), %r9
movsd %xmm4, (%r9,%r14,8)
cmpl $0x2, %eax
movl %ebx, %r12d
je 0x1029c
xorpd %xmm4, %xmm4
movq %r8, %r15
cmpq %rdx, %r15
je 0x1028a
xorpd %xmm5, %xmm5
xorl %r13d, %r13d
movl %r13d, %r9d
cmpq %r9, %r15
je 0x10263
xorpd %xmm6, %xmm6
xorl %ebp, %ebp
movl %ebp, %r9d
cmpq %r9, %r15
je 0x1025a
cmpl %r13d, %ebp
je 0x10255
xorpd %xmm7, %xmm7
xorl %r9d, %r9d
movapd %xmm3, %xmm8
cmpq %r9, %r15
je 0x10250
movapd %xmm8, %xmm9
cmpl %r9d, %ebp
je 0x1023d
movapd %xmm0, %xmm9
addsd %xmm7, %xmm9
mulsd %xmm8, %xmm9
cmpl %r9d, %r13d
je 0x10247
movapd %xmm9, %xmm8
addsd %xmm3, %xmm7
incq %r9
jmp 0x1021f
addsd %xmm8, %xmm6
incq %rbp
jmp 0x10206
addsd %xmm6, %xmm5
incq %r13
jmp 0x101f8
imull %r15d, %r12d
movq (%rsi,%r14,8), %r9
movsd (%r9,%r15,8), %xmm6
cvtsi2sd %r12d, %xmm7
divsd %xmm7, %xmm6
mulsd %xmm5, %xmm6
addsd %xmm6, %xmm4
incq %r15
jmp 0x101e8
divsd %xmm1, %xmm4
movq -0x10(%rsp), %r9
movsd %xmm4, (%r9,%r14,8)
movl %ebx, %r12d
incq %r14
jmp 0x100d0
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq