// File: /workspace/github_c_makefile_star2_O1/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 $0x878, %rsp            # imm = 0x878
movq %r8, %r15
movq %rcx, %r14
movq %rdx, %r12
movq %rsi, %r13
movsd %xmm0, 0x58(%rsp)
movq %rdi, 0x50(%rsp)
movl 0x28(%rcx), %eax
testl %eax, %eax
je 0x105ef
movq 0x68(%r14), %rcx
movq 0x10(%rcx), %rdx
movq %rdx, 0x28(%rsp)
movq 0x18(%rcx), %rcx
movq %rcx, 0x20(%rsp)
jmp 0x10601
movq $0x0, 0x28(%rsp)
movq $0x0, 0x20(%rsp)
movq (%r14), %r11
movq 0x8(%r14), %rbx
movl $0x1, 0x44(%r14)
testl %r9d, %r9d
jle 0x10666
movq (%r15), %rcx
movq 0x8(%r15), %rdx
leal 0x1(%r9), %esi
movl $0x1, %edi
movapd 0xe0c13(%rip), %xmm0    # 0xf1240
movsd (%r13,%rdi,8), %xmm2
andpd %xmm0, %xmm2
movapd %xmm1, %xmm3
maxsd %xmm2, %xmm3
movsd %xmm3, (%rcx,%rdi,8)
movsd (%r13,%rdi,8), %xmm2
mulsd (%rbx,%rdi,8), %xmm3
addsd %xmm2, %xmm3
subsd %xmm2, %xmm3
movsd %xmm3, (%rdx,%rdi,8)
incq %rdi
cmpq %rdi, %rsi
jne 0x1062d
testl %r9d, %r9d
jle 0x106e4
movq 0x8(%r15), %rcx
leal 0x1(%r9), %edx
movl $0x1, %esi
xorpd %xmm0, %xmm0
movsd 0xe0c0c(%rip), %xmm2    # 0xf1290
movsd 0xe1694(%rip), %xmm3    # 0xf1d20
movsd (%rcx,%rsi,8), %xmm4
ucomisd %xmm0, %xmm4
jne 0x106dc
jp 0x106dc
movsd (%rbx,%rsi,8), %xmm4
ucomisd %xmm4, %xmm2
jbe 0x106d7
mulsd %xmm3, %xmm4
minsd %xmm2, %xmm4
movsd %xmm4, (%rbx,%rsi,8)
movsd (%r13,%rsi,8), %xmm5
movq (%r15), %rdi
mulsd (%rdi,%rsi,8), %xmm4
addsd %xmm5, %xmm4
subsd %xmm5, %xmm4
movsd %xmm4, (%rcx,%rsi,8)
ucomisd %xmm0, %xmm4
jne 0x10699
jp 0x10699
jmp 0x106dc
movsd %xmm1, (%rcx,%rsi,8)
incq %rsi
cmpq %rdx, %rsi
jne 0x1068c
testl %r9d, %r9d
jle 0x1073b
leal 0x1(%r9), %ecx
movl $0x1, %edx
xorpd %xmm0, %xmm0
movapd 0xe0b32(%rip), %xmm1    # 0xf1230
movapd 0xe0b3a(%rip), %xmm2    # 0xf1240
movsd (%r12,%rdx,8), %xmm3
ucomisd %xmm0, %xmm3
jae 0x10721
movq 0x8(%r15), %rsi
movsd (%rsi,%rdx,8), %xmm3
orpd %xmm1, %xmm3
jmp 0x1072e
movq 0x8(%r15), %rsi
movsd (%rsi,%rdx,8), %xmm3
andpd %xmm2, %xmm3
movlpd %xmm3, (%rsi,%rdx,8)
incq %rdx
cmpq %rdx, %rcx
jne 0x10706
testl %eax, %eax
movq %r14, 0x18(%rsp)
movq %r9, 0x10(%rsp)
movq %r11, 0x8(%rsp)
je 0x10758
movl 0x34(%r14), %eax
cmpl 0x38(%r14), %eax
jge 0x107b6
movl %r9d, %ecx
testl %r9d, %r9d
jle 0x1085f
movq 0x8(%r15), %rax
movq 0x50(%r15), %rcx
leal 0x1(%r9), %edx
movl $0x1, %esi
movl $0x1, %edi
movsd (%r13,%rdi,8), %xmm0
movq (%rcx,%rdi,8), %r8
movsd %xmm0, (%r8,%rsi,8)
incq %rdi
cmpq %rdi, %rdx
jne 0x1077a
movsd (%rax,%rsi,8), %xmm0
movq (%rcx,%rsi,8), %rdi
addsd (%rdi,%rsi,8), %xmm0
movsd %xmm0, (%rdi,%rsi,8)
incq %rsi
cmpq %rdx, %rsi
jne 0x10775
movl %r9d, %ecx
jmp 0x1085f
cmpl $0x0, 0x3c(%r14)
jne 0x107e4
movq 0x68(%r14), %rdi
movq 0x50(%r14), %rsi
movq 0x58(%r14), %rdx
callq 0xc130
movq 0x8(%rsp), %r11
movq 0x10(%rsp), %r9
movl %eax, 0x60(%r14)
movl $0x1, 0x3c(%r14)
movl 0x60(%r14), %eax
leal 0x1(%rax), %ecx
testl %eax, %eax
js 0x1085f
movq %rcx, %rbp
leal 0x1(%r9), %ecx
addq $0x2, %rax
decq %rcx
movl $0x1, %edx
testl %r9d, %r9d
jle 0x1084a
leaq -0x1(%rdx), %rsi
movq 0x50(%r15), %rdi
movq 0x50(%r14), %r8
xorl %r9d, %r9d
movsd 0x8(%r13,%r9,8), %xmm0
movq 0x8(%rdi,%r9,8), %r10
movsd %xmm0, (%r10,%rdx,8)
movl (%r8,%r9,4), %r11d
cmpq %r11, %rsi
jne 0x10842
movq 0x8(%r15), %r11
addsd 0x8(%r11,%r9,8), %xmm0
movsd %xmm0, (%r10,%rdx,8)
incq %r9
cmpq %r9, %rcx
jne 0x10816
incq %rdx
cmpq %rax, %rdx
movq 0x10(%rsp), %r9
jne 0x10802
movq 0x8(%rsp), %r11
movq %rbp, %rcx
testl %ecx, %ecx
jle 0x1091f
leal 0x1(%r9), %r14d
incl %ecx
movl $0x1, %ebp
movq %rcx, 0x30(%rsp)
testl %r9d, %r9d
jle 0x1089f
movq 0x40(%r15), %rax
movq 0x50(%r15), %rcx
movl $0x1, %edx
movq (%rcx,%rdx,8), %rsi
movsd (%rsi,%rbp,8), %xmm0
movsd %xmm0, (%rax,%rdx,8)
incq %rdx
cmpq %rdx, %r14
jne 0x10889
movq 0x38(%r15), %rsi
movq 0x40(%r15), %rdi
addq $0x8, %rdi
addq $0x8, %rsi
movsd 0x58(%rsp), %xmm0
movq 0x8b8(%rsp), %rdx
movq 0x8c0(%rsp), %rcx
callq *0x50(%rsp)
cmpl $0x1, %eax
je 0x109f7
movq 0x8b0(%rsp), %rax
incl (%rax)
movq 0x10(%rsp), %r9
testl %r9d, %r9d
movq 0x8(%rsp), %r11
jle 0x1090e
movq 0x38(%r15), %rax
movq 0x50(%r15), %rcx
movl $0x1, %edx
movsd (%rax,%rdx,8), %xmm0
movq (%rcx,%rdx,8), %rsi
movsd %xmm0, (%rsi,%rbp,8)
incq %rdx
cmpq %rdx, %r14
jne 0x108f8
incq %rbp
movq 0x30(%rsp), %rcx
cmpq %rcx, %rbp
jne 0x10877
movq 0x18(%rsp), %rbp
cmpl $0x0, 0x28(%rbp)
je 0x10936
movl 0x34(%rbp), %eax
cmpl 0x38(%rbp), %eax
jge 0x10a49
testl %r9d, %r9d
jle 0x10b61
movq 0x50(%r15), %rax
movq 0x60(%r15), %rcx
movq 0x8(%r15), %rdx
movq 0x18(%r15), %rsi
movq 0x10(%rsp), %rdi
incl %edi
movl $0x1, %r8d
movapd 0xe08dc(%rip), %xmm0    # 0xf1240
movapd 0xe08d4(%rip), %xmm1    # 0xf1240
xorpd %xmm2, %xmm2
movl $0x1, %r9d
xorpd %xmm3, %xmm3
andpd %xmm0, %xmm2
maxsd %xmm2, %xmm3
movq (%rax,%r9,8), %r10
movsd (%r10,%r8,8), %xmm2
subsd (%r12,%r9,8), %xmm2
movapd %xmm2, %xmm4
divsd (%rdx,%r8,8), %xmm4
movq (%r11,%r9,8), %r10
movsd %xmm4, (%r10,%r8,8)
movapd %xmm2, %xmm4
andpd %xmm0, %xmm4
ucomisd %xmm3, %xmm4
jb 0x109c6
movq 0x60(%r15), %r10
movl %r9d, (%r10,%r8,4)
movq 0x10(%r15), %r10
movsd %xmm4, (%r10,%r8,8)
incq %r9
cmpq %r9, %rdi
jne 0x1097a
movslq (%rcx,%r8,4), %r9
movq (%rax,%r9,8), %r9
movsd (%r9,%r8,8), %xmm2
andpd %xmm1, %xmm2
movlpd %xmm2, (%rsi,%r8,8)
incq %r8
cmpq %rdi, %r8
jne 0x1096c
jmp 0x10b61
leaq 0xe09f2(%rip), %rsi     # 0xf13f0
leaq 0xe1941(%rip), %rdx     # 0xf2346
leaq 0x70(%rsp), %rbx
movq %rbx, %rdi
movq 0x8c0(%rsp), %r14
movq %r14, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0xe060e(%rip), %rsi     # 0xf1034
leaq 0xe1977(%rip), %rdx     # 0xf23a4
movq %r14, %rdi
movl $0x51a, %ecx            # imm = 0x51A
movq %rbx, %r8
xorl %eax, %eax
callq 0x30c2c
movl $0x1, %eax
jmp 0x11152
testl %r9d, %r9d
jle 0x10b61
movq 0x50(%rbp), %rax
movq %rax, 0x30(%rsp)
movq 0x18(%r15), %rax
movq %rax, 0x48(%rsp)
movq 0x50(%r15), %rdx
movq 0x60(%r15), %rsi
movl 0x10(%rsp), %edi
xorl %r8d, %r8d
movapd 0xe07c5(%rip), %xmm0    # 0xf1240
movapd 0xe07bd(%rip), %xmm1    # 0xf1240
movq %r8, %rax
movq 0x30(%rsp), %rcx
movslq (%rcx,%r8,4), %r9
movq 0x28(%rsp), %rcx
movslq (%rcx,%r8,4), %r10
incq %r8
cmpl 0x4(%rcx,%rax,4), %r10d
jge 0x10b30
movq 0x8(%r15), %r11
movq 0x50(%r15), %r14
movq 0x18(%rsp), %rax
movq 0x70(%rax), %rbp
xorpd %xmm2, %xmm2
xorpd %xmm3, %xmm3
movapd %xmm3, %xmm4
movq 0x20(%rsp), %rax
movslq (%rax,%r10,4), %rax
andpd %xmm0, %xmm2
movapd %xmm2, %xmm3
maxsd %xmm4, %xmm3
movq 0x8(%r14,%rax,8), %rcx
movsd 0x8(%rcx,%r9,8), %xmm2
subsd 0x8(%r12,%rax,8), %xmm2
movapd %xmm2, %xmm4
andpd %xmm0, %xmm4
ucomisd %xmm3, %xmm4
jb 0x10b0e
incq %rax
movq 0x60(%r15), %rcx
movl %eax, (%rcx,%r8,4)
movq 0x10(%r15), %rax
movsd %xmm2, (%rax,%r8,8)
movapd %xmm2, %xmm4
divsd (%r11,%r8,8), %xmm4
movsd %xmm4, (%rbp,%r10,8)
incq %r10
movq 0x28(%rsp), %rax
movslq (%rax,%r8,4), %rax
cmpq %rax, %r10
jl 0x10abf
movslq (%rsi,%r8,4), %rax
movq (%rdx,%rax,8), %rax
movsd 0x8(%rax,%r9,8), %xmm2
andpd %xmm1, %xmm2
movq 0x48(%rsp), %rax
movlpd %xmm2, (%rax,%r8,8)
cmpq %rdi, %r8
movq 0x18(%rsp), %rbp
movq 0x8(%rsp), %r11
jne 0x10a83
movq 0x10(%rsp), %r10
testl %r10d, %r10d
jle 0x10b97
movq 0x20(%r15), %rax
leal 0x1(%r10), %ecx
movl $0x1, %edx
movapd 0xe06c0(%rip), %xmm0    # 0xf1240
movsd (%r12,%rdx,8), %xmm1
andpd %xmm0, %xmm1
movlpd %xmm1, (%rax,%rdx,8)
incq %rdx
cmpq %rdx, %rcx
jne 0x10b80
testl %r10d, %r10d
jle 0x10bc8
movq 0x20(%r15), %rax
movq 0x28(%r15), %rcx
movq 0x60(%r15), %rdx
leal 0x1(%r10), %esi
movl $0x1, %edi
movslq (%rdx,%rdi,4), %r8
movsd (%rax,%r8,8), %xmm0
movsd %xmm0, (%rcx,%rdi,8)
incq %rdi
cmpq %rdi, %rsi
jne 0x10bb1
testl %r10d, %r10d
jle 0x10fc2
movq 0x18(%r15), %rax
movq 0x58(%r15), %rcx
leal 0x1(%r10), %r9d
xorl %edi, %edi
movl $0x1, %edx
movsd 0xe113c(%rip), %xmm0    # 0xf1d28
movapd 0xe064c(%rip), %xmm3    # 0xf1240
movl %edi, %esi
ucomisd (%rax,%rdx,8), %xmm0
jbe 0x10c13
movq 0x28(%r15), %rdi
movl $0x1, %r8d
ucomisd (%rdi,%rdx,8), %xmm0
movl $0x1, %edi
ja 0x10c36
movq 0x10(%r15), %rdi
movsd (%rdi,%rdx,8), %xmm1
andpd %xmm3, %xmm1
movl $0x1, %r8d
ucomisd %xmm1, %xmm0
movl $0x1, %edi
ja 0x10c36
xorl %r8d, %r8d
movl %esi, %edi
movl %r8d, (%rcx,%rdx,4)
incq %rdx
cmpq %rdx, %r9
jne 0x10bf4
cmpl $0x1, %edi
jne 0x10fc2
movq 0x40(%r15), %rax
movq 0x18(%r15), %rcx
movq 0x28(%r15), %rdx
movq 0x30(%r15), %rsi
movl $0x1, %edi
movsd (%r13,%rdi,8), %xmm0
movsd %xmm0, (%rax,%rdi,8)
movsd (%rdx,%rdi,8), %xmm0
maxsd (%rcx,%rdi,8), %xmm0
movsd %xmm0, (%rsi,%rdi,8)
incq %rdi
cmpq %rdi, %r9
jne 0x10c60
movl $0x1, %r14d
xorpd %xmm5, %xmm5
movq %r9, 0x18(%rsp)
movq 0x58(%r15), %rax
cmpl $0x1, (%rax,%r14,4)
jne 0x10cbb
movq 0x10(%r15), %rax
movq 0x30(%r15), %rcx
movsd (%rcx,%r14,8), %xmm0
mulsd 0xe102d(%rip), %xmm0    # 0xf1ce0
ucomisd (%rax,%r14,8), %xmm0
jae 0x10cc8
incq %r14
cmpq %r9, %r14
jne 0x10c92
jmp 0x10fc2
movsd (%rbx,%r14,8), %xmm0
ucomisd 0xe0582(%rip), %xmm0    # 0xf1258
movapd %xmm5, 0x30(%rsp)
jb 0x10ce4
sqrtsd %xmm0, %xmm0
jmp 0x10d06
callq 0x82b0
movapd 0x30(%rsp), %xmm5
movapd 0xe0549(%rip), %xmm3    # 0xf1240
movq 0x18(%rsp), %r9
movq 0x8(%rsp), %r11
movq 0x10(%rsp), %r10
movsd 0xe0582(%rip), %xmm1    # 0xf1290
ucomisd %xmm0, %xmm1
movapd %xmm1, %xmm0
jbe 0x10d50
movsd (%rbx,%r14,8), %xmm0
ucomisd 0xe0532(%rip), %xmm0    # 0xf1258
jb 0x10d2e
sqrtsd %xmm0, %xmm0
jmp 0x10d50
callq 0x82b0
movapd 0x30(%rsp), %xmm5
movapd 0xe04ff(%rip), %xmm3    # 0xf1240
movq 0x18(%rsp), %r9
movq 0x8(%rsp), %r11
movq 0x10(%rsp), %r10
ucomisd (%rbx,%r14,8), %xmm0
jne 0x10d5e
jnp 0x10cbb
movsd (%r13,%r14,8), %xmm4
movq (%r15), %rax
movsd (%rax,%r14,8), %xmm1
mulsd %xmm0, %xmm1
addsd %xmm4, %xmm1
subsd %xmm4, %xmm1
ucomisd 0xe04d6(%rip), %xmm1    # 0xf1258
jne 0x10d8a
jnp 0x10cbb
movsd %xmm0, 0x48(%rsp)
movapd %xmm1, %xmm2
andpd %xmm3, %xmm2
orpd 0xe0490(%rip), %xmm1    # 0xf1230
xorpd %xmm0, %xmm0
cmpnlesd (%r12,%r14,8), %xmm0
andpd %xmm0, %xmm1
andnpd %xmm2, %xmm0
orpd %xmm1, %xmm0
movapd %xmm0, 0x60(%rsp)
addsd %xmm0, %xmm4
movq 0x40(%r15), %rdi
movsd %xmm4, (%rdi,%r14,8)
addq $0x8, %rdi
movq 0x38(%r15), %rsi
addq $0x8, %rsi
movsd 0x58(%rsp), %xmm0
movq 0x8b8(%rsp), %rdx
movq 0x8c0(%rsp), %rcx
callq *0x50(%rsp)
cmpl $0x1, %eax
je 0x11164
movq 0x8b0(%rsp), %rax
incl (%rax)
movsd (%r13,%r14,8), %xmm0
movq 0x40(%r15), %rax
movsd %xmm0, (%rax,%r14,8)
movq 0x38(%r15), %rcx
movq 0x48(%r15), %rdx
movl $0x1, %eax
xorpd %xmm0, %xmm0
movl $0x1, %esi
xorpd %xmm1, %xmm1
movq 0x10(%rsp), %r10
movq 0x8(%rsp), %r11
movq 0x18(%rsp), %r9
movapd 0xe03fa(%rip), %xmm3    # 0xf1240
movapd 0xe03f2(%rip), %xmm4    # 0xf1240
movapd 0x30(%rsp), %xmm5
movapd 0x60(%rsp), %xmm6
movapd %xmm1, %xmm2
andpd %xmm4, %xmm0
movapd %xmm0, %xmm1
movsd (%rcx,%rsi,8), %xmm0
subsd (%r12,%rsi,8), %xmm0
maxsd %xmm2, %xmm1
movapd %xmm0, %xmm2
divsd %xmm6, %xmm2
movsd %xmm2, (%rdx,%rsi,8)
movapd %xmm0, %xmm2
andpd %xmm4, %xmm2
ucomisd %xmm1, %xmm2
movl %eax, %edi
movl %esi, %eax
cmovbl %edi, %eax
jb 0x10e9b
movapd %xmm2, %xmm5
incq %rsi
cmpq %rsi, %r9
jne 0x10e5a
movq 0x8(%r15), %rcx
movq 0x10(%r15), %rdx
movhpd (%rcx,%r14,8), %xmm6    # xmm6 = xmm6[0],mem[0]
andpd %xmm3, %xmm6
movapd %xmm5, %xmm0
movhpd (%rdx,%r14,8), %xmm0    # xmm0 = xmm0[0],mem[0]
mulpd %xmm6, %xmm0
movsd 0x48(%rsp), %xmm2
movapd %xmm2, %xmm1
mulsd %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
ucomisd %xmm0, %xmm1
jb 0x10cbb
cmpl $0x0, 0x28(%rbp)
je 0x10ef1
movl 0x34(%rbp), %ecx
cmpl 0x38(%rbp), %ecx
jge 0x10f82
movq 0x48(%r15), %rcx
movl $0x1, %edx
movsd (%rcx,%rdx,8), %xmm0
movq (%r11,%rdx,8), %rsi
movsd %xmm0, (%rsi,%r14,8)
incq %rdx
cmpq %rdx, %r9
jne 0x10efa
movq 0x20(%r15), %rcx
movq 0x38(%r15), %rdx
cltq
movsd (%rdx,%rax,8), %xmm1
andpd %xmm3, %xmm1
movsd (%rcx,%rax,8), %xmm0
maxsd %xmm1, %xmm0
movapd %xmm0, %xmm1
mulsd 0xe0df7(%rip), %xmm1    # 0xf1d30
ucomisd %xmm5, %xmm1
jae 0x10f67
mulsd 0xe0df1(%rip), %xmm0    # 0xf1d38
ucomisd %xmm0, %xmm5
jbe 0x10f77
mulsd 0xe033b(%rip), %xmm2    # 0xf1290
movsd 0xe0de3(%rip), %xmm0    # 0xf1d40
maxsd %xmm2, %xmm0
movapd %xmm0, %xmm2
jmp 0x10f77
mulsd 0xe0881(%rip), %xmm2    # 0xf17f0
minsd 0xe0319(%rip), %xmm2    # 0xf1290
movsd %xmm2, (%rbx,%r14,8)
jmp 0x10cbb
movq 0x28(%rsp), %rdx
movslq -0x4(%rdx,%r14,4), %rcx
movslq (%rdx,%r14,4), %rdx
cmpl %edx, %ecx
jge 0x10f11
movq 0x48(%r15), %rsi
movq 0x70(%rbp), %rdi
movq 0x20(%rsp), %r8
movslq (%r8,%rcx,4), %r8
movsd 0x8(%rsi,%r8,8), %xmm0
movsd %xmm0, (%rdi,%rcx,8)
incq %rcx
cmpq %rcx, %rdx
jne 0x10fa0
jmp 0x10f11
xorl %eax, %eax
cmpl $0x0, 0x28(%rbp)
je 0x11152
movl 0x34(%rbp), %ecx
cmpl 0x38(%rbp), %ecx
jge 0x11152
movq 0x28(%rsp), %r14
movl $0x0, (%r14)
testl %r10d, %r10d
jle 0x11126
incl %r10d
xorl %edx, %edx
movl $0x1, %ecx
xorpd %xmm0, %xmm0
xorl %esi, %esi
movl $0x1, %edi
cmpq %rcx, %rdi
je 0x1101f
movq (%r11,%rdi,8), %r8
movsd (%r8,%rcx,8), %xmm1
ucomisd %xmm0, %xmm1
jne 0x1101f
jnp 0x110e0
cmpl 0x30(%rbp), %edx
jge 0x11102
testl %esi, %esi
je 0x11036
movl $0x1, %esi
jmp 0x110ba
movl 0x40(%rbp), %r9d
xorl %esi, %esi
cmpl $0x1, %r9d
jne 0x110ba
cmpl -0x4(%r14,%rcx,4), %edx
jl 0x1102c
movq %r10, %rbx
movl (%r14,%rcx,4), %r10d
xorl %r8d, %r8d
cmpl %r10d, %edx
setge %r8b
cmpl $0x1, %r9d
jne 0x110b4
cmpl %r10d, %edx
jge 0x110b4
movslq %edx, %r8
movq 0x20(%rsp), %r9
movl (%r9,%r8,4), %r10d
leaq -0x1(%rdi), %r9
cmpq %r10, %r9
je 0x110b7
movl (%r14,%rcx,4), %r10d
cmpl %r10d, %edx
jge 0x110ee
movq 0x20(%rsp), %r11
movslq (%r11,%r8,4), %r11
cmpq %r11, %rdi
jle 0x110ad
movl %r11d, %r11d
cmpq %r11, %r9
je 0x110f5
movq 0x70(%rbp), %r11
movq $0x0, (%r11,%r8,8)
incq %r8
cmpl %r8d, %r10d
jne 0x11083
movl $0x1, %esi
jmp 0x110f8
movl %r8d, %esi
movq %rbx, %r10
movslq %edx, %rdx
leal -0x1(%rdi), %r8d
movq 0x20(%rsp), %r9
movl %r8d, (%r9,%rdx,4)
movq (%r11,%rdi,8), %r8
movsd (%r8,%rcx,8), %xmm1
movq 0x70(%rbp), %r8
movsd %xmm1, (%r8,%rdx,8)
incl %edx
incq %rdi
cmpq %r10, %rdi
jne 0x11004
jmp 0x11109
movl $0x1, %esi
jmp 0x110b7
movl %r8d, %edx
movq %rbx, %r10
movq 0x8(%rsp), %r11
jmp 0x110ba
movl $0x0, 0x28(%rbp)
cmpl $0x0, 0x28(%rbp)
je 0x1111f
movl %edx, (%r14,%rcx,4)
incq %rcx
cmpq %r10, %rcx
jne 0x10fff
testl %esi, %esi
sete %cl
jmp 0x11128
movb $0x1, %cl
cmpl $0x1, 0x28(%rbp)
jne 0x11152
cmpl $0x1, 0x40(%rbp)
sete %dl
andb %cl, %dl
xorl %eax, %eax
movl $0x0, %ecx
cmpb $0x1, %dl
jne 0x11148
movl 0x34(%rbp), %ecx
incl %ecx
movl %ecx, 0x34(%rbp)
movl $0x1, 0x40(%rbp)
addq $0x878, %rsp            # imm = 0x878
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xe0285(%rip), %rsi     # 0xf13f0
leaq 0xe11d4(%rip), %rdx     # 0xf2346
leaq 0x70(%rsp), %rbx
movq %rbx, %rdi
movq 0x8c0(%rsp), %r14
movq %r14, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0xdfea1(%rip), %rsi     # 0xf1034
leaq 0xe120a(%rip), %rdx     # 0xf23a4
movq %r14, %rdi
movl $0x578, %ecx            # imm = 0x578
jmp 0x10a35