// File: /workspace/github_c_makefile_star2_O2/PoulinV[P]AxiCLASS/build/../tools/evolver_ndf15.c
// Function: numjac
int numjac(
       int (*derivs)(double x, double * y,double * dy,
             void * parameters_and_workspace, ErrorMsg error_message),
       double t, double *y, double *fval,
       struct jacobian *jac, struct numjac_workspace *nj_ws,
       double thresh, int neq, int *nfe, void * parameters_and_workspace_for_derivs,
       ErrorMsg error_message){
  /*    Routine that computes the jacobian numerically. It is based on the numjac
    implementation in MATLAB, but a feature for recognising sparsity in the
    jacobian and taking advantage of that has been added.
  */
  double eps=1e-16, br=pow(eps,0.875),bl=pow(eps,0.75),bu=pow(eps,0.25);
  double facmin=pow(eps,0.78),facmax=0.1;
  int logjpos, pattern_broken;
  double tmpfac,difmax2=0.,del2,ffscale;
  int i,j,rowmax2;
  double maxval1,maxval2;
  int colmax,group,row,nz,nz2;
  double Fdiff_absrm,Fdiff_new;
  double **dFdy,*fac;
  int *Ap=NULL, *Ai=NULL;

  dFdy = jac->dfdy; /* Assign pointer to dfdy directly for easier notation. */
  fac = jac->jacvec;
  if (jac->use_sparse){
    Ap = jac->spJ->Ap;
    Ai = jac->spJ->Ai;
  }

  /* Set new_jacobian flag: */
  jac->new_jacobian = _TRUE_;

  for(j=1;j<=neq;j++){
    nj_ws->yscale[j] = MAX(fabs(y[j]),thresh);
    nj_ws->del[j] = (y[j] + fac[j] * nj_ws->yscale[j]) - y[j];
  }

  /*Select an increment del for a difference approximation to
    column j of dFdy.  The vector fac accounts for experience
    gained in previous calls to numjac.
  */
  for(j=1;j<=neq;j++){
    if (nj_ws->del[j]==0.0){
      for(;;){
    if (fac[j] < facmax){
      fac[j] = MIN(100*fac[j],facmax);
      nj_ws->del[j] = (y[j] + fac[j]*nj_ws->yscale[j]) - y[j];
      if(nj_ws->del[j]==0.0){
        break;
      }
    }
    else{
      nj_ws->del[j] = thresh;
      break;
    }
      }
    }
  }

  /* keep del pointing into region: */
  for(j=1;j<=neq;j++){
    if (fval[j]>=0.0){
      nj_ws->del[j] = fabs(nj_ws->del[j]);
    }
    else{
      nj_ws->del[j] = -fabs(nj_ws->del[j]);
    }
  }

  /* Sparse calculation?*/
  if ((jac->use_sparse)&&(jac->repeated_pattern >= jac->trust_sparse)){
    /* printf("\n Sparse calculation..neq=%d, has grouping=%d",neq,jac->has_grouping);*/
    /* Everything done sparse'ly. Do we have a grouping? */
    if (jac->has_grouping==0){
      jac->max_group = column_grouping(jac->spJ,jac->col_group,jac->col_wi);
      jac->has_grouping = 1;
    }
    colmax = jac->max_group+1;
    /*    printf("\n                ->groups=%d/%d.",colmax,neq);  */
    for(j=1;j<=colmax;j++){
      /*loop over groups */
      group = j-1;
      for(i=1;i<=neq;i++){
        /*Add y-vector.. */
        nj_ws->ydel_Fdel[i][j] = y[i];
        /*Add del of all groupmembers:*/
        if(jac->col_group[i-1]==group) nj_ws->ydel_Fdel[i][j] +=nj_ws->del[i];
      }
    }
  }
  else{
    /*printf("\n Normal calculation..."); */
    /*Normal calculation: */
    colmax = neq;
    for(j=1;j<=neq;j++){
      for(i=1;i<=neq;i++){
        nj_ws->ydel_Fdel[i][j] = y[i];
      }
      nj_ws->ydel_Fdel[j][j] += nj_ws->del[j];
    }
  }

  /* The next section should work regardless of sparse...*/
  /* Evaluate the function at y+delta vectors:*/
  for(j=1;j<=colmax;j++){
    for(i=1;i<=neq;i++){
      nj_ws->yydel[i] = nj_ws->ydel_Fdel[i][j];
    }
    class_call((*derivs)(t,nj_ws->yydel+1,nj_ws->ffdel+1,
               parameters_and_workspace_for_derivs,error_message),
               error_message,error_message);

    *nfe+=1;
    for(i=1;i<=neq;i++) nj_ws->ydel_Fdel[i][j] = nj_ws->ffdel[i];
  }


  /*Using the Fdel array, form the jacobian and construct max-value arrays.
    First we do it for the sparse case, then for the normal case:*/
  if ((jac->use_sparse)&&(jac->repeated_pattern >= jac->trust_sparse)){
    /* Sparse case:*/
    for(j=0;j<neq;j++){
      /*Loop over columns, and assign corresponding group:*/
      group = jac->col_group[j];
      Fdiff_new = 0.0;
      Fdiff_absrm = 0.0;
      for(i=Ap[j];i<Ap[j+1];i++){
        /* Loop over rows in the sparse matrix */
        row = Ai[i]+1;
        /* Do I want to construct the full jacobian? No, that is ugly..*/
        Fdiff_absrm = MAX(Fdiff_absrm,fabs(Fdiff_new));
        Fdiff_new = nj_ws->ydel_Fdel[row][group+1]-fval[row]; /*Remember to access the column of the corresponding group */
        if (fabs(Fdiff_new)>=Fdiff_absrm){
          nj_ws->Rowmax[j+1] = row;
          nj_ws->Difmax[j+1] = Fdiff_new;
        }
        /* Assign value to sparse rep of jacobian: */
        jac->xjac[i] = Fdiff_new/nj_ws->del[j+1];
      }
      /* The maximum numerical value of Fdel in true column j+1*/
      nj_ws->absFdelRm[j+1] = fabs(nj_ws->ydel_Fdel[nj_ws->Rowmax[j+1]][group+1]);
    }
  }
  else{
    /*Normal case:*/
    for(j=1;j<=neq;j++){
      Fdiff_new = 0.0;
      Fdiff_absrm = 0.0;
      for(i=1;i<=neq;i++){
        Fdiff_absrm = MAX(fabs(Fdiff_new),Fdiff_absrm);
        Fdiff_new = nj_ws->ydel_Fdel[i][j] - fval[i];
        dFdy[i][j] = Fdiff_new/nj_ws->del[j];
        /*Find row maximums:*/
        if(fabs(Fdiff_new)>=Fdiff_absrm){
          /* Found new max location in column */
          nj_ws->Rowmax[j] = i;
          nj_ws->Difmax[j] = fabs(Fdiff_new);
        }
      }
      nj_ws->absFdelRm[j] = fabs(nj_ws->ydel_Fdel[nj_ws->Rowmax[j]][j]);
    }
  }

  /* Adjust fac for next call to numjac. */
  for(i=1;i<=neq;i++){
    nj_ws->absFvalue[i] = fabs(fval[i]);
  }
  for(j=1;j<=neq;j++){
    nj_ws->absFvalueRm[j] = nj_ws->absFvalue[nj_ws->Rowmax[j]];
  }

  logjpos = 0;
  for(j=1;j<=neq;j++){
    if (((nj_ws->absFdelRm[j]<TINY)&&(nj_ws->absFvalueRm[j] < TINY))||(fabs(nj_ws->Difmax[j])<TINY)){
      nj_ws->logj[j] = 1;/*.true.*/
      logjpos = 1;
    }
    else{
      nj_ws->logj[j] = 0;
    }
  }

  if (logjpos ==1){
    for(i=1;i<=neq;i++){
      nj_ws->yydel[i] = y[i];
      nj_ws->Fscale[i] = MAX(nj_ws->absFdelRm[i],nj_ws->absFvalueRm[i]);
    }
    /* If the difference in f values is so small that the column might be just
       ! roundoff error, try a bigger increment. */
    for(j=1;j<=neq;j++){
      if ((nj_ws->logj[j]==1)&&(nj_ws->Difmax[j]<=(br*nj_ws->Fscale[j]))){
        tmpfac = MIN(sqrt(fac[j]),facmax);
        del2 = (y[j] + tmpfac*nj_ws->yscale[j]) - y[j];
        if ((tmpfac!=fac[j])&&(del2!=0.0)){
          if (fval[j] >= 0.0){
            /*! keep del pointing into region */
            del2 = fabs(del2);
          }
          else{
            del2 = -fabs(del2);
          }
          nj_ws->yydel[j] = y[j] + del2;
          class_call((*derivs)(t,nj_ws->yydel+1,nj_ws->ffdel+1,
                     parameters_and_workspace_for_derivs,error_message),
                     error_message,error_message);
          *nfe+=1;
          nj_ws->yydel[j] = y[j];
          rowmax2 = 1;
          Fdiff_new=0.0;
          Fdiff_absrm = 0.0;
          for(i=1;i<=neq;i++){
            Fdiff_absrm = MAX(Fdiff_absrm,fabs(Fdiff_new));
            Fdiff_new = nj_ws->ffdel[i]-fval[i];
            nj_ws->tmp[i] = Fdiff_new/del2;
            if(fabs(Fdiff_new)>=Fdiff_absrm){
              rowmax2 = i;
              difmax2 = fabs(Fdiff_new);
            }
          }
          maxval1 = difmax2*fabs(del2)*tmpfac;
          maxval2 = nj_ws->Difmax[j]*fabs(nj_ws->del[j]);
          if(maxval1>=maxval2){
            /* The new difference is more significant, so
               use the column computed with this increment.
               This depends on wether we are in sparse mode or not: */
            if ((jac->use_sparse)&&(jac->repeated_pattern >= jac->trust_sparse)){
              for(i=Ap[j-1];i<Ap[j];i++) jac->xjac[i]=nj_ws->tmp[Ai[i]+1];
            }
            else{
              for(i=1;i<=neq;i++) dFdy[i][j]=nj_ws->tmp[i];
            }
            /* Adjust fac for the next call to numjac. */
            ffscale = MAX(fabs(nj_ws->ffdel[rowmax2]),nj_ws->absFvalue[rowmax2]);
            if (difmax2 <= bl*ffscale){
              /* The difference is small, so increase the increment. */
              fac[j] = MIN(10*tmpfac, facmax);
            }
            else if(difmax2 > bu*ffscale){
              /* The difference is large, so reduce the increment. */
              fac[j] = MAX(0.1*tmpfac, facmin);
            }
            else{
              fac[j] = tmpfac;
            }
          }
        }
      }
    }
  }
  /* If use_sparse is true but I still don't trust the sparsity pattern, go through the full calculated jacobi-
     matrix, deduce the sparsity pattern, compare with the old pattern, and write the new sparse Jacobi matrix.
     If I do this cleverly, I only have to walk through the jacobian once, and I don't need any local storage.*/

  if ((jac->use_sparse)&&(jac->repeated_pattern < jac->trust_sparse)){
    nz=0; /*Number of non-zeros */
    Ap[0]=0; /*<-Always is.. */
    pattern_broken = _FALSE_;
    for(j=1;j<=neq;j++){
      for(i=1;i<=neq;i++){
        if ((i==j)||(fabs(dFdy[i][j])!=0.0)){
          /* Diagonal or non-zero index found. */
          if (nz>=jac->max_nonzero){
            /* Too many non-zero points to take advantage of sparsity.*/
            jac->use_sparse = 0;
            break;
          }
          /* Test pattern if it is still unbroken: */
          /* Two conditions must be met if the pattern is intact: Ap[j-1]<=nz<Ap[j],
             so that we are in the right column, and (i-1) must exist in column. Ai[nz]*/
          /* We should first test if nz is in the column, otherwise pattern is dead:*/
          if ((pattern_broken==_FALSE_)&&(jac->has_pattern==_TRUE_)){
            if ((nz<Ap[j-1])||(nz>=Ap[j])){
              /* If we are no longer in the right column, pattern is broken for sure. */
              pattern_broken = _TRUE_;
            }
          }
          if ((pattern_broken==_FALSE_)&&(jac->has_pattern==_TRUE_)){
            /* Up to this point, the new jacobian has managed to fit in the old
               sparsity pattern..*/
            if (Ai[nz]!=(i-1)){
              /* The current non-zero rownumber does not fit the current entry in the
             sparse matrix. Pattern MIGHT be broken. Scan ahead in the sparse matrix
             to search for the row entry: (Remember: the indices are sorted..)*/
              pattern_broken = _TRUE_;
              for(nz2=nz; (nz2<Ap[j])&&(Ai[nz2]<=(i-1)); nz2++){
            /* Go through the rest of the column with the added constraint that
               the row index in the sparse matrix should be smaller than the current
               row index i-1:*/
            if (Ai[nz2]==(i-1)){
              /* sparsity pattern recovered.. */
              pattern_broken = _FALSE_;
              nz = nz2;
              break;
            }
            /* Write a zero entry in the sparse matrix, in case we recover pattern. */
            jac->xjac[nz2] = 0.0;
              }
            }
          }
          /* The following works no matter the status of the pattern: */
          /* Write row_number: */
          Ai[nz] = i-1;
          /* Write value: */
          jac->xjac[nz] = dFdy[i][j];
          nz++;
        }
      }
      /* Break this loop too if I have hit max non-zero points: */
      if (jac->use_sparse==_FALSE_) break;
      Ap[j]=nz;
    }
    if (jac->use_sparse==_TRUE_){
      if ((jac->has_pattern==_TRUE_)&&(pattern_broken==_FALSE_)){
        /*New jacobian fitted into the current sparsity pattern:*/
        jac->repeated_pattern++;
        /* printf("\n Found repeated pattern. nz=%d/%d and
           rep.pat=%d.",nz,neq*neq,jac->repeated_pattern); */
      }
      else{
        /*Something has changed (or first run), better still do the full calculation..*/
        jac->repeated_pattern = 0;
      }
      jac->has_pattern = 1;
    }
  }
  return _SUCCESS_;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x888, %rsp            # imm = 0x888
movq %r8, %r12
movq %rcx, %rbx
movq %rdx, %r13
movq %rsi, %rbp
movsd %xmm0, 0x40(%rsp)
movq %rdi, 0x38(%rsp)
movl 0x28(%rcx), %eax
xorl %ecx, %ecx
testl %eax, %eax
je 0xec4e
movq 0x68(%rbx), %rdx
movq 0x10(%rdx), %r10
movq 0x18(%rdx), %r11
jmp 0xec54
xorl %r10d, %r10d
xorl %r11d, %r11d
movq (%rbx), %rdx
movq %rdx, 0x18(%rsp)
movq 0x8(%rbx), %r14
movl $0x1, 0x44(%rbx)
testl %r9d, %r9d
movl $0x0, %r15d
movq %r9, 0x28(%rsp)
cmovgl %r9d, %r15d
leal 0x1(%r15), %edx
movq %rdx, 0x20(%rsp)
movapd 0xd65b6(%rip), %xmm5    # 0xe5240
cmpq %rcx, %r15
je 0xecd0
movsd 0x8(%rbp,%rcx,8), %xmm0
andpd %xmm5, %xmm0
movapd %xmm1, %xmm2
maxsd %xmm0, %xmm2
movq (%r12), %rdx
movsd %xmm2, 0x8(%rdx,%rcx,8)
movsd 0x8(%rbp,%rcx,8), %xmm0
mulsd 0x8(%r14,%rcx,8), %xmm2
addsd %xmm0, %xmm2
subsd %xmm0, %xmm2
movq 0x8(%r12), %rdx
movsd %xmm2, 0x8(%rdx,%rcx,8)
incq %rcx
jmp 0xec8a
pushq $0x1
popq %rcx
xorpd %xmm0, %xmm0
movsd 0xd65b1(%rip), %xmm6    # 0xe5290
movsd 0xd7019(%rip), %xmm2    # 0xe5d00
movq 0x18(%rsp), %r9
cmpq 0x20(%rsp), %rcx
je 0xed4f
movq 0x8(%r12), %rdx
movsd (%rdx,%rcx,8), %xmm3
ucomisd %xmm0, %xmm3
jne 0xed4a
jp 0xed4a
movsd (%r14,%rcx,8), %xmm3
ucomisd %xmm3, %xmm6
jbe 0xed45
mulsd %xmm2, %xmm3
minsd %xmm6, %xmm3
movsd %xmm3, (%r14,%rcx,8)
movsd (%rbp,%rcx,8), %xmm4
movq (%r12), %rsi
mulsd (%rsi,%rcx,8), %xmm3
addsd %xmm4, %xmm3
subsd %xmm4, %xmm3
movsd %xmm3, (%rdx,%rcx,8)
ucomisd %xmm0, %xmm3
jne 0xed05
jp 0xed05
jmp 0xed4a
movsd %xmm1, (%rdx,%rcx,8)
incq %rcx
jmp 0xecec
xorl %ecx, %ecx
cmpq %rcx, %r15
je 0xed94
movq 0x8(%r12), %rdx
movsd 0x8(%rdx,%rcx,8), %xmm0
movapd %xmm0, %xmm1
andpd %xmm5, %xmm1
orpd 0xd64bf(%rip), %xmm0    # 0xe5230
xorpd %xmm2, %xmm2
cmpnlesd 0x8(%r13,%rcx,8), %xmm2
andpd %xmm2, %xmm0
andnpd %xmm1, %xmm2
orpd %xmm0, %xmm2
movlpd %xmm2, 0x8(%rdx,%rcx,8)
incq %rcx
jmp 0xed51
testl %eax, %eax
movq %r10, 0x8(%rsp)
movq %r11, (%rsp)
movq %rbx, 0x50(%rsp)
je 0xedb2
movl 0x34(%rbx), %eax
cmpl 0x38(%rbx), %eax
jge 0xeff3
movq 0x28(%rsp), %rax
incl %eax
pushq $0x1
popq %rcx
movq %rcx, %rdx
cmpq 0x20(%rsp), %rdx
je 0xee09
movq %rcx, %rsi
cmpq %rsi, %rax
je 0xede7
movsd (%rbp,%rsi,8), %xmm0
movq 0x50(%r12), %rdi
movq (%rdi,%rsi,8), %rdi
movsd %xmm0, (%rdi,%rdx,8)
incq %rsi
jmp 0xedc9
movq 0x8(%r12), %rsi
movq 0x50(%r12), %rdi
movsd (%rsi,%rdx,8), %xmm0
movq (%rdi,%rdx,8), %rsi
addsd (%rsi,%rdx,8), %xmm0
movsd %xmm0, (%rsi,%rdx,8)
incq %rdx
jmp 0xedbf
movq 0x20(%rsp), %rax
movq %rax, 0x10(%rsp)
pushq $0x1
popq %rbx
cmpq 0x10(%rsp), %rbx
je 0xeed2
xorl %eax, %eax
cmpq %rax, %r15
je 0xee47
movq 0x40(%r12), %rcx
movq 0x50(%r12), %rdx
movq 0x8(%rdx,%rax,8), %rdx
movsd (%rdx,%rbx,8), %xmm0
movsd %xmm0, 0x8(%rcx,%rax,8)
incq %rax
jmp 0xee23
movq 0x38(%r12), %rsi
movq 0x40(%r12), %rdi
addq $0x8, %rdi
addq $0x8, %rsi
movsd 0x40(%rsp), %xmm0
movq 0x8c8(%rsp), %rdx
movq 0x8d0(%rsp), %rcx
callq *0x38(%rsp)
cmpl $0x1, %eax
je 0xefa0
movq 0x8c0(%rsp), %rax
incl (%rax)
xorl %eax, %eax
movq 0x8(%rsp), %r10
movq (%rsp), %r11
movq 0x18(%rsp), %r9
movapd 0xd63a2(%rip), %xmm5    # 0xe5240
movsd 0xd63ea(%rip), %xmm6    # 0xe5290
cmpq %rax, %r15
je 0xeeca
movq 0x38(%r12), %rcx
movq 0x50(%r12), %rdx
movsd 0x8(%rcx,%rax,8), %xmm0
movq 0x8(%rdx,%rax,8), %rcx
movsd %xmm0, (%rcx,%rbx,8)
incq %rax
jmp 0xeea6
incq %rbx
jmp 0xee16
movq 0x50(%rsp), %rbx
cmpl $0x0, 0x28(%rbx)
je 0xeee9
movl 0x34(%rbx), %eax
cmpl 0x38(%rbx), %eax
jge 0xf005
movq 0x28(%rsp), %rax
incl %eax
pushq $0x1
popq %rcx
movapd 0xd6345(%rip), %xmm0    # 0xe5240
movq %rcx, %rdx
cmpq 0x20(%rsp), %rdx
je 0xf0cd
xorpd %xmm1, %xmm1
movq %rcx, %rsi
xorpd %xmm2, %xmm2
cmpq %rsi, %rax
je 0xef73
andpd %xmm0, %xmm2
maxsd %xmm2, %xmm1
movq 0x8(%r12), %rdi
movq 0x50(%r12), %r8
movq (%r8,%rsi,8), %r8
movsd (%r8,%rdx,8), %xmm2
subsd (%r13,%rsi,8), %xmm2
movapd %xmm2, %xmm3
divsd (%rdi,%rdx,8), %xmm3
movq (%r9,%rsi,8), %rdi
movsd %xmm3, (%rdi,%rdx,8)
movapd %xmm2, %xmm3
andpd %xmm0, %xmm3
ucomisd %xmm1, %xmm3
jb 0xef6e
movq 0x60(%r12), %rdi
movl %esi, (%rdi,%rdx,4)
movq 0x10(%r12), %rdi
movsd %xmm3, (%rdi,%rdx,8)
incq %rsi
jmp 0xef14
movq 0x18(%r12), %rsi
movq 0x50(%r12), %rdi
movq 0x60(%r12), %r8
movslq (%r8,%rdx,4), %r8
movq (%rdi,%r8,8), %rdi
movsd (%rdi,%rdx,8), %xmm1
andpd %xmm5, %xmm1
movlpd %xmm1, (%rsi,%rdx,8)
incq %rdx
jmp 0xeefe
leaq 0xd6449(%rip), %rsi     # 0xe53f0
leaq 0xd7378(%rip), %rdx     # 0xe6326
leaq 0x80(%rsp), %rbx
movq %rbx, %rdi
movq 0x8d0(%rsp), %r14
movq %r14, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0xd6062(%rip), %rsi     # 0xe5034
leaq 0xd73ab(%rip), %rdx     # 0xe6384
movq %r14, %rdi
movl $0x51a, %ecx            # imm = 0x51A
movq %rbx, %r8
xorl %eax, %eax
callq 0x2e014
pushq $0x1
popq %rax
jmp 0xf642
cmpl $0x0, 0x3c(%rbx)
je 0xf654
movl 0x60(%rbx), %eax
jmp 0xf68d
xorl %eax, %eax
movapd 0xd6231(%rip), %xmm0    # 0xe5240
cmpq %r15, %rax
je 0xf0cd
movq 0x50(%rbx), %rcx
movslq (%rcx,%rax,4), %rcx
movslq (%r10,%rax,4), %rdx
incq %rax
xorpd %xmm3, %xmm3
xorpd %xmm1, %xmm1
movslq (%r10,%rax,4), %rsi
cmpq %rsi, %rdx
jge 0xf0a2
movslq (%r11,%rdx,4), %rsi
andpd %xmm0, %xmm1
movapd %xmm1, %xmm2
maxsd %xmm3, %xmm2
movq 0x50(%r12), %rdi
movq 0x8(%rdi,%rsi,8), %rdi
movsd 0x8(%rdi,%rcx,8), %xmm1
subsd 0x8(%r13,%rsi,8), %xmm1
movapd %xmm1, %xmm3
andpd %xmm0, %xmm3
ucomisd %xmm2, %xmm3
jb 0xf082
incq %rsi
movq 0x60(%r12), %rdi
movl %esi, (%rdi,%rax,4)
movq 0x10(%r12), %rsi
movsd %xmm1, (%rsi,%rax,8)
movq 0x8(%r12), %rsi
movapd %xmm1, %xmm3
divsd (%rsi,%rax,8), %xmm3
movq 0x70(%rbx), %rsi
movsd %xmm3, (%rsi,%rdx,8)
incq %rdx
movapd %xmm2, %xmm3
jmp 0xf02f
movq 0x18(%r12), %rdx
movq 0x50(%r12), %rsi
movq 0x60(%r12), %rdi
movslq (%rdi,%rax,4), %rdi
movq (%rsi,%rdi,8), %rsi
movsd 0x8(%rsi,%rcx,8), %xmm1
andpd %xmm5, %xmm1
movlpd %xmm1, (%rdx,%rax,8)
jmp 0xf00f
xorl %eax, %eax
cmpq %rax, %r15
je 0xf0ef
movsd 0x8(%r13,%rax,8), %xmm0
andpd %xmm5, %xmm0
movq 0x20(%r12), %rcx
movlpd %xmm0, 0x8(%rcx,%rax,8)
incq %rax
jmp 0xf0cf
xorl %eax, %eax
cmpq %rax, %r15
je 0xf11a
movq 0x60(%r12), %rcx
movslq 0x4(%rcx,%rax,4), %rcx
movq 0x20(%r12), %rdx
movq 0x28(%r12), %rsi
movsd (%rdx,%rcx,8), %xmm0
movsd %xmm0, 0x8(%rsi,%rax,8)
incq %rax
jmp 0xf0f1
xorl %eax, %eax
movsd 0xd6be4(%rip), %xmm0    # 0xe5d08
pushq $0x1
popq %rcx
xorl %edx, %edx
cmpq %rax, %r15
je 0xf186
movq 0x18(%r12), %rsi
ucomisd 0x8(%rsi,%rax,8), %xmm0
jbe 0xf154
movq 0x28(%r12), %rsi
ucomisd 0x8(%rsi,%rax,8), %xmm0
movq 0x58(%r12), %rsi
movl %ecx, %edi
movl %ecx, %r8d
jbe 0xf159
jmp 0xf17a
movq 0x58(%r12), %rsi
movq 0x10(%r12), %rdi
movsd 0x8(%rdi,%rax,8), %xmm1
andpd %xmm5, %xmm1
ucomisd %xmm1, %xmm0
jbe 0xf175
movl %ecx, %edi
movl %ecx, %r8d
jmp 0xf17a
xorl %edi, %edi
movl %edx, %r8d
movl %edi, 0x4(%rsi,%rax,4)
incq %rax
movl %r8d, %edx
jmp 0xf129
cmpl $0x1, %edx
jne 0xf51e
xorl %eax, %eax
cmpq %rax, %r15
je 0xf1cd
movsd 0x8(%rbp,%rax,8), %xmm0
movq 0x40(%r12), %rcx
movsd %xmm0, 0x8(%rcx,%rax,8)
movq 0x18(%r12), %rcx
movq 0x28(%r12), %rdx
movsd 0x8(%rdx,%rax,8), %xmm0
maxsd 0x8(%rcx,%rax,8), %xmm0
movq 0x30(%r12), %rcx
movsd %xmm0, 0x8(%rcx,%rax,8)
incq %rax
jmp 0xf191
movq %r15, %rax
negq %rax
movq %rax, 0x48(%rsp)
pushq $0x1
popq %r9
xorpd %xmm4, %xmm4
cmpq 0x20(%rsp), %r9
je 0xf51e
movq 0x58(%r12), %rax
cmpl $0x1, (%rax,%r9,4)
jne 0xf217
movq 0x10(%r12), %rax
movq 0x30(%r12), %rcx
movsd (%rcx,%r9,8), %xmm0
mulsd 0xd6ab1(%rip), %xmm0    # 0xe5cc0
ucomisd (%rax,%r9,8), %xmm0
jae 0xf21c
incq %r9
jmp 0xf1e0
movsd (%r14,%r9,8), %xmm0
ucomisd 0xd602e(%rip), %xmm0    # 0xe5258
movq %r9, 0x10(%rsp)
movsd %xmm4, 0x30(%rsp)
jb 0xf23d
sqrtsd %xmm0, %xmm0
jmp 0xf266
callq 0x82d0
movsd 0x30(%rsp), %xmm4
movq 0x10(%rsp), %r9
movsd 0xd603b(%rip), %xmm6    # 0xe5290
movapd 0xd5fe3(%rip), %xmm5    # 0xe5240
movq (%rsp), %r11
movq 0x8(%rsp), %r10
ucomisd %xmm0, %xmm6
movapd %xmm6, %xmm0
jbe 0xf2af
movsd (%r14,%r9,8), %xmm0
ucomisd 0xd5fda(%rip), %xmm0    # 0xe5258
jb 0xf286
sqrtsd %xmm0, %xmm0
jmp 0xf2af
callq 0x82d0
movsd 0x30(%rsp), %xmm4
movq 0x10(%rsp), %r9
movsd 0xd5ff2(%rip), %xmm6    # 0xe5290
movapd 0xd5f9a(%rip), %xmm5    # 0xe5240
movq (%rsp), %r11
movq 0x8(%rsp), %r10
ucomisd (%r14,%r9,8), %xmm0
jne 0xf2bd
jnp 0xf217
movsd (%rbp,%r9,8), %xmm2
movq (%r12), %rax
movsd (%rax,%r9,8), %xmm1
mulsd %xmm0, %xmm1
addsd %xmm2, %xmm1
subsd %xmm2, %xmm1
ucomisd 0xd5f76(%rip), %xmm1    # 0xe5258
jne 0xf2ea
jnp 0xf217
movsd %xmm0, 0x58(%rsp)
movapd %xmm1, %xmm0
andpd %xmm5, %xmm0
orpd 0xd5f30(%rip), %xmm1    # 0xe5230
xorpd %xmm3, %xmm3
cmpnlesd (%r13,%r9,8), %xmm3
andpd %xmm3, %xmm1
movapd %xmm0, 0x70(%rsp)
andnpd %xmm0, %xmm3
orpd %xmm1, %xmm3
movapd %xmm3, 0x60(%rsp)
addsd %xmm3, %xmm2
movq 0x40(%r12), %rdi
movsd %xmm2, (%rdi,%r9,8)
addq $0x8, %rdi
movq 0x38(%r12), %rsi
addq $0x8, %rsi
movsd 0x40(%rsp), %xmm0
movq 0x8c8(%rsp), %rdx
movq 0x8d0(%rsp), %rcx
callq *0x38(%rsp)
cmpl $0x1, %eax
je 0xf6f1
movq 0x8c0(%rsp), %rax
incl (%rax)
movq 0x10(%rsp), %r9
movsd (%rbp,%r9,8), %xmm0
movq 0x40(%r12), %rax
movsd %xmm0, (%rax,%r9,8)
xorpd %xmm2, %xmm2
pushq $0x1
popq %rcx
pushq $0x1
popq %rax
xorpd %xmm0, %xmm0
movq 0x8(%rsp), %r10
movq (%rsp), %r11
movq 0x18(%rsp), %rdi
movapd 0xd5e98(%rip), %xmm5    # 0xe5240
movsd 0xd5ee0(%rip), %xmm6    # 0xe5290
movq 0x48(%rsp), %r8
movapd 0xd5e83(%rip), %xmm3    # 0xe5240
movsd 0x30(%rsp), %xmm4
movapd 0x60(%rsp), %xmm7
leaq (%r8,%rcx), %rdx
cmpq $0x1, %rdx
je 0xf420
andpd %xmm3, %xmm0
movapd %xmm0, %xmm1
maxsd %xmm2, %xmm1
movq 0x38(%r12), %rdx
movq 0x48(%r12), %rsi
movsd (%rdx,%rcx,8), %xmm0
subsd (%r13,%rcx,8), %xmm0
movapd %xmm0, %xmm2
divsd %xmm7, %xmm2
movsd %xmm2, (%rsi,%rcx,8)
movapd %xmm0, %xmm2
andpd %xmm3, %xmm2
ucomisd %xmm1, %xmm2
cmovael %ecx, %eax
jb 0xf417
movapd %xmm2, %xmm4
incq %rcx
movapd %xmm1, %xmm2
jmp 0xf3c9
movapd 0x70(%rsp), %xmm1
mulsd %xmm4, %xmm1
movsd 0x58(%rsp), %xmm2
mulsd %xmm2, %xmm1
movq 0x8(%r12), %rcx
movq 0x10(%r12), %rdx
movsd (%rcx,%r9,8), %xmm0
andpd %xmm5, %xmm0
mulsd (%rdx,%r9,8), %xmm0
ucomisd %xmm0, %xmm1
jb 0xf217
cmpl $0x0, 0x28(%rbx)
je 0xf466
movl 0x34(%rbx), %ecx
cmpl 0x38(%rbx), %ecx
jge 0xf488
xorl %ecx, %ecx
cmpq %rcx, %r15
je 0xf4b3
movq 0x48(%r12), %rdx
movsd 0x8(%rdx,%rcx,8), %xmm0
movq 0x8(%rdi,%rcx,8), %rdx
movsd %xmm0, (%rdx,%r9,8)
incq %rcx
jmp 0xf468
movslq -0x4(%r10,%r9,4), %rcx
movslq (%r10,%r9,4), %rdx
cmpq %rdx, %rcx
jge 0xf4b3
movq 0x48(%r12), %rsi
movslq (%r11,%rcx,4), %rdi
movsd 0x8(%rsi,%rdi,8), %xmm0
movq 0x70(%rbx), %rsi
movsd %xmm0, (%rsi,%rcx,8)
incq %rcx
jmp 0xf491
movq 0x20(%r12), %rcx
movq 0x38(%r12), %rdx
cltq
movsd (%rdx,%rax,8), %xmm1
andpd %xmm5, %xmm1
movsd (%rcx,%rax,8), %xmm0
maxsd %xmm1, %xmm0
movapd %xmm0, %xmm1
mulsd 0xd6833(%rip), %xmm1    # 0xe5d10
ucomisd %xmm4, %xmm1
jae 0xf507
mulsd 0xd682d(%rip), %xmm0    # 0xe5d18
ucomisd %xmm0, %xmm4
jbe 0xf513
mulsd %xmm6, %xmm2
movsd 0xd6823(%rip), %xmm0    # 0xe5d20
maxsd %xmm2, %xmm0
movapd %xmm0, %xmm2
jmp 0xf513
mulsd 0xd62e1(%rip), %xmm2    # 0xe57f0
minsd %xmm6, %xmm2
movsd %xmm2, (%r14,%r9,8)
jmp 0xf217
xorl %eax, %eax
cmpl $0x0, 0x28(%rbx)
je 0xf642
movl 0x34(%rbx), %ecx
cmpl 0x38(%rbx), %ecx
jge 0xf642
andl $0x0, (%r10)
movq 0x28(%rsp), %r15
incl %r15d
xorl %ebp, %ebp
pushq $0x1
popq %rcx
pushq $0x1
popq %rdx
xorpd %xmm0, %xmm0
movq %rcx, %rsi
xorl %edi, %edi
cmpq 0x20(%rsp), %rsi
je 0xf737
movq %rcx, %r8
cmpq %r15, %r8
je 0xf62a
cmpq %rsi, %r8
je 0xf586
movq 0x18(%rsp), %r9
movq (%r9,%r8,8), %r9
movsd (%r9,%rsi,8), %xmm1
ucomisd %xmm0, %xmm1
jne 0xf586
jnp 0xf5bb
cmpl 0x30(%rbx), %edi
jge 0xf63c
testl %ebp, %ebp
je 0xf5c0
movl %edx, %ebp
movslq %edi, %rdi
leal -0x1(%r8), %r9d
movl %r9d, (%r11,%rdi,4)
movq 0x18(%rsp), %r9
movq (%r9,%r8,8), %r9
movsd (%r9,%rsi,8), %xmm1
movq 0x70(%rbx), %r9
movsd %xmm1, (%r9,%rdi,8)
incl %edi
incq %r8
jmp 0xf561
xorl %ebp, %ebp
cmpl $0x1, 0x40(%rbx)
jne 0xf595
cmpl -0x4(%r10,%rsi,4), %edi
jl 0xf593
movslq (%r10,%rsi,4), %r9
cmpl %r9d, %edi
jge 0xf593
movq %rbx, %r14
movslq %edi, %r10
movl (%r11,%r10,4), %ebx
leaq -0x1(%r8), %r11
cmpq %rbx, %r11
je 0xf619
cmpq %r9, %r10
jge 0xf612
movq (%rsp), %rbx
movslq (%rbx,%r10,4), %rbx
cmpq %rbx, %r8
jle 0xf612
movl %ebx, %ebx
cmpq %rbx, %r11
je 0xf616
movq 0x70(%r14), %rbx
andq $0x0, (%rbx,%r10,8)
incq %r10
jmp 0xf5eb
movl %edx, %ebp
jmp 0xf619
movl %r10d, %edi
movq %r14, %rbx
movq 0x8(%rsp), %r10
movq (%rsp), %r11
jmp 0xf595
cmpl $0x0, 0x28(%rbx)
je 0xf640
movl %edi, (%r10,%rsi,4)
incq %rsi
jmp 0xf553
andl $0x0, 0x28(%rbx)
xorl %eax, %eax
addq $0x888, %rsp            # imm = 0x888
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x68(%rbx), %rdi
movq 0x50(%rbx), %rsi
movq 0x58(%rbx), %rdx
callq 0xaa2e
movsd 0xd5c23(%rip), %xmm6    # 0xe5290
movapd 0xd5bcb(%rip), %xmm5    # 0xe5240
movq 0x18(%rsp), %r9
movq (%rsp), %r11
movq 0x8(%rsp), %r10
movl %eax, 0x60(%rbx)
movl $0x1, 0x3c(%rbx)
testl %eax, %eax
pushq $-0x1
popq %rcx
cmovnsl %eax, %ecx
addl $0x2, %ecx
movq %rcx, 0x10(%rsp)
pushq $0x1
popq %rax
cmpq 0x10(%rsp), %rax
je 0xee13
leaq -0x1(%rax), %rcx
xorl %edx, %edx
cmpq %rdx, %r15
je 0xf6ec
movsd 0x8(%rbp,%rdx,8), %xmm0
movq 0x50(%r12), %rsi
movq 0x8(%rsi,%rdx,8), %rsi
movsd %xmm0, (%rsi,%rax,8)
movq 0x50(%rbx), %rdi
movl (%rdi,%rdx,4), %edi
cmpq %rdi, %rcx
jne 0xf6e7
movq 0x8(%r12), %rdi
addsd 0x8(%rdi,%rdx,8), %xmm0
movsd %xmm0, (%rsi,%rax,8)
incq %rdx
jmp 0xf6b1
incq %rax
jmp 0xf6a0
leaq 0xd5cf8(%rip), %rsi     # 0xe53f0
leaq 0xd6c27(%rip), %rdx     # 0xe6326
leaq 0x80(%rsp), %rbx
movq %rbx, %rdi
movq 0x8d0(%rsp), %r14
movq %r14, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0xd5911(%rip), %rsi     # 0xe5034
leaq 0xd6c5a(%rip), %rdx     # 0xe6384
movq %r14, %rdi
movl $0x578, %ecx            # imm = 0x578
jmp 0xefe1
cmpl $0x1, 0x28(%rbx)
jne 0xf640
movl 0x40(%rbx), %ecx
xorl $0x1, %ecx
xorl %eax, %eax
orl %ebp, %ecx
movl $0x0, %ecx
jne 0xf757
movl 0x34(%rbx), %ecx
incl %ecx
movl %ecx, 0x34(%rbx)
movl $0x1, 0x40(%rbx)
jmp 0xf642