// File: /workspace/github_c_makefile_star2_O0/ukontainer[P]sqlite-bench/sqlite3.c
// Function: wherePathSolver
static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){
  int mxChoice;             /* Maximum number of simultaneous paths tracked */
  int nLoop;                /* Number of terms in the join */
  Parse *pParse;            /* Parsing context */
  sqlite3 *db;              /* The database connection */
  int iLoop;                /* Loop counter over the terms of the join */
  int ii, jj;               /* Loop counters */
  int mxI = 0;              /* Index of next entry to replace */
  int nOrderBy;             /* Number of ORDER BY clause terms */
  LogEst mxCost = 0;        /* Maximum cost of a set of paths */
  LogEst mxUnsorted = 0;    /* Maximum unsorted cost of a set of path */
  int nTo, nFrom;           /* Number of valid entries in aTo[] and aFrom[] */
  WherePath *aFrom;         /* All nFrom paths at the previous level */
  WherePath *aTo;           /* The nTo best paths at the current level */
  WherePath *pFrom;         /* An element of aFrom[] that we are working on */
  WherePath *pTo;           /* An element of aTo[] that we are working on */
  WhereLoop *pWLoop;        /* One of the WhereLoop objects */
  WhereLoop **pX;           /* Used to divy up the pSpace memory */
  LogEst *aSortCost = 0;    /* Sorting and partial sorting costs */
  char *pSpace;             /* Temporary memory used by this routine */
  int nSpace;               /* Bytes of space allocated at pSpace */

  pParse = pWInfo->pParse;
  db = pParse->db;
  nLoop = pWInfo->nLevel;
  /* TUNING: For simple queries, only the best path is tracked.
  ** For 2-way joins, the 5 best paths are followed.
  ** For joins of 3 or more tables, track the 10 best paths */
  mxChoice = (nLoop<=1) ? 1 : (nLoop==2 ? 5 : 10);
  assert( nLoop<=pWInfo->pTabList->nSrc );
  WHERETRACE(0x002, ("---- begin solver.  (nRowEst=%d)\n", nRowEst));

  /* If nRowEst is zero and there is an ORDER BY clause, ignore it. In this
  ** case the purpose of this call is to estimate the number of rows returned
  ** by the overall query. Once this estimate has been obtained, the caller
  ** will invoke this function a second time, passing the estimate as the
  ** nRowEst parameter.  */
  if( pWInfo->pOrderBy==0 || nRowEst==0 ){
    nOrderBy = 0;
  }else{
    nOrderBy = pWInfo->pOrderBy->nExpr;
  }

  /* Allocate and initialize space for aTo, aFrom and aSortCost[] */
  nSpace = (sizeof(WherePath)+sizeof(WhereLoop*)*nLoop)*mxChoice*2;
  nSpace += sizeof(LogEst) * nOrderBy;
  pSpace = sqlite3DbMallocRawNN(db, nSpace);
  if( pSpace==0 ) return SQLITE_NOMEM_BKPT;
  aTo = (WherePath*)pSpace;
  aFrom = aTo+mxChoice;
  memset(aFrom, 0, sizeof(aFrom[0]));
  pX = (WhereLoop**)(aFrom+mxChoice);
  for(ii=mxChoice*2, pFrom=aTo; ii>0; ii--, pFrom++, pX += nLoop){
    pFrom->aLoop = pX;
  }
  if( nOrderBy ){
    /* If there is an ORDER BY clause and it is not being ignored, set up
    ** space for the aSortCost[] array. Each element of the aSortCost array
    ** is either zero - meaning it has not yet been initialized - or the
    ** cost of sorting nRowEst rows of data where the first X terms of
    ** the ORDER BY clause are already in order, where X is the array 
    ** index.  */
    aSortCost = (LogEst*)pX;
    memset(aSortCost, 0, sizeof(LogEst) * nOrderBy);
  }
  assert( aSortCost==0 || &pSpace[nSpace]==(char*)&aSortCost[nOrderBy] );
  assert( aSortCost!=0 || &pSpace[nSpace]==(char*)pX );

  /* Seed the search with a single WherePath containing zero WhereLoops.
  **
  ** TUNING: Do not let the number of iterations go above 28.  If the cost
  ** of computing an automatic index is not paid back within the first 28
  ** rows, then do not use the automatic index. */
  aFrom[0].nRow = MIN(pParse->nQueryLoop, 48);  assert( 48==sqlite3LogEst(28) );
  nFrom = 1;
  assert( aFrom[0].isOrdered==0 );
  if( nOrderBy ){
    /* If nLoop is zero, then there are no FROM terms in the query. Since
    ** in this case the query may return a maximum of one row, the results
    ** are already in the requested order. Set isOrdered to nOrderBy to
    ** indicate this. Or, if nLoop is greater than zero, set isOrdered to
    ** -1, indicating that the result set may or may not be ordered, 
    ** depending on the loops added to the current plan.  */
    aFrom[0].isOrdered = nLoop>0 ? -1 : nOrderBy;
  }

  /* Compute successively longer WherePaths using the previous generation
  ** of WherePaths as the basis for the next.  Keep track of the mxChoice
  ** best paths at each generation */
  for(iLoop=0; iLoop<nLoop; iLoop++){
    nTo = 0;
    for(ii=0, pFrom=aFrom; ii<nFrom; ii++, pFrom++){
      for(pWLoop=pWInfo->pLoops; pWLoop; pWLoop=pWLoop->pNextLoop){
        LogEst nOut;                      /* Rows visited by (pFrom+pWLoop) */
        LogEst rCost;                     /* Cost of path (pFrom+pWLoop) */
        LogEst rUnsorted;                 /* Unsorted cost of (pFrom+pWLoop) */
        i8 isOrdered = pFrom->isOrdered;  /* isOrdered for (pFrom+pWLoop) */
        Bitmask maskNew;                  /* Mask of src visited by (..) */
        Bitmask revMask = 0;              /* Mask of rev-order loops for (..) */

        if( (pWLoop->prereq & ~pFrom->maskLoop)!=0 ) continue;
        if( (pWLoop->maskSelf & pFrom->maskLoop)!=0 ) continue;
        if( (pWLoop->wsFlags & WHERE_AUTO_INDEX)!=0 && pFrom->nRow<3 ){
          /* Do not use an automatic index if the this loop is expected
          ** to run less than 1.25 times.  It is tempting to also exclude
          ** automatic index usage on an outer loop, but sometimes an automatic
          ** index is useful in the outer loop of a correlated subquery. */
          assert( 10==sqlite3LogEst(2) );
          continue;
        }

        /* At this point, pWLoop is a candidate to be the next loop. 
        ** Compute its cost */
        rUnsorted = sqlite3LogEstAdd(pWLoop->rSetup,pWLoop->rRun + pFrom->nRow);
        rUnsorted = sqlite3LogEstAdd(rUnsorted, pFrom->rUnsorted);
        nOut = pFrom->nRow + pWLoop->nOut;
        maskNew = pFrom->maskLoop | pWLoop->maskSelf;
        if( isOrdered<0 ){
          isOrdered = wherePathSatisfiesOrderBy(pWInfo,
                       pWInfo->pOrderBy, pFrom, pWInfo->wctrlFlags,
                       iLoop, pWLoop, &revMask);
        }else{
          revMask = pFrom->revLoop;
        }
        if( isOrdered>=0 && isOrdered<nOrderBy ){
          if( aSortCost[isOrdered]==0 ){
            aSortCost[isOrdered] = whereSortingCost(
                pWInfo, nRowEst, nOrderBy, isOrdered
            );
          }
          /* TUNING:  Add a small extra penalty (5) to sorting as an
          ** extra encouragment to the query planner to select a plan
          ** where the rows emerge in the correct order without any sorting
          ** required. */
          rCost = sqlite3LogEstAdd(rUnsorted, aSortCost[isOrdered]) + 5;

          WHERETRACE(0x002,
              ("---- sort cost=%-3d (%d/%d) increases cost %3d to %-3d\n",
               aSortCost[isOrdered], (nOrderBy-isOrdered), nOrderBy, 
               rUnsorted, rCost));
        }else{
          rCost = rUnsorted;
          rUnsorted -= 2;  /* TUNING:  Slight bias in favor of no-sort plans */
        }

        /* Check to see if pWLoop should be added to the set of
        ** mxChoice best-so-far paths.
        **
        ** First look for an existing path among best-so-far paths
        ** that covers the same set of loops and has the same isOrdered
        ** setting as the current path candidate.
        **
        ** The term "((pTo->isOrdered^isOrdered)&0x80)==0" is equivalent
        ** to (pTo->isOrdered==(-1))==(isOrdered==(-1))" for the range
        ** of legal values for isOrdered, -1..64.
        */
        for(jj=0, pTo=aTo; jj<nTo; jj++, pTo++){
          if( pTo->maskLoop==maskNew
           && ((pTo->isOrdered^isOrdered)&0x80)==0
          ){
            testcase( jj==nTo-1 );
            break;
          }
        }
        if( jj>=nTo ){
          /* None of the existing best-so-far paths match the candidate. */
          if( nTo>=mxChoice
           && (rCost>mxCost || (rCost==mxCost && rUnsorted>=mxUnsorted))
          ){
            /* The current candidate is no better than any of the mxChoice
            ** paths currently in the best-so-far buffer.  So discard
            ** this candidate as not viable. */
#ifdef WHERETRACE_ENABLED /* 0x4 */
            if( sqlite3WhereTrace&0x4 ){
              sqlite3DebugPrintf("Skip   %s cost=%-3d,%3d,%3d order=%c\n",
                  wherePathName(pFrom, iLoop, pWLoop), rCost, nOut, rUnsorted,
                  isOrdered>=0 ? isOrdered+'0' : '?');
            }
#endif
            continue;
          }
          /* If we reach this points it means that the new candidate path
          ** needs to be added to the set of best-so-far paths. */
          if( nTo<mxChoice ){
            /* Increase the size of the aTo set by one */
            jj = nTo++;
          }else{
            /* New path replaces the prior worst to keep count below mxChoice */
            jj = mxI;
          }
          pTo = &aTo[jj];
#ifdef WHERETRACE_ENABLED /* 0x4 */
          if( sqlite3WhereTrace&0x4 ){
            sqlite3DebugPrintf("New    %s cost=%-3d,%3d,%3d order=%c\n",
                wherePathName(pFrom, iLoop, pWLoop), rCost, nOut, rUnsorted,
                isOrdered>=0 ? isOrdered+'0' : '?');
          }
#endif
        }else{
          /* Control reaches here if best-so-far path pTo=aTo[jj] covers the
          ** same set of loops and has the same isOrdered setting as the
          ** candidate path.  Check to see if the candidate should replace
          ** pTo or if the candidate should be skipped.
          ** 
          ** The conditional is an expanded vector comparison equivalent to:
          **   (pTo->rCost,pTo->nRow,pTo->rUnsorted) <= (rCost,nOut,rUnsorted)
          */
          if( pTo->rCost<rCost 
           || (pTo->rCost==rCost
               && (pTo->nRow<nOut
                   || (pTo->nRow==nOut && pTo->rUnsorted<=rUnsorted)
                  )
              )
          ){
#ifdef WHERETRACE_ENABLED /* 0x4 */
            if( sqlite3WhereTrace&0x4 ){
              sqlite3DebugPrintf(
                  "Skip   %s cost=%-3d,%3d,%3d order=%c",
                  wherePathName(pFrom, iLoop, pWLoop), rCost, nOut, rUnsorted,
                  isOrdered>=0 ? isOrdered+'0' : '?');
              sqlite3DebugPrintf("   vs %s cost=%-3d,%3d,%3d order=%c\n",
                  wherePathName(pTo, iLoop+1, 0), pTo->rCost, pTo->nRow,
                  pTo->rUnsorted, pTo->isOrdered>=0 ? pTo->isOrdered+'0' : '?');
            }
#endif
            /* Discard the candidate path from further consideration */
            testcase( pTo->rCost==rCost );
            continue;
          }
          testcase( pTo->rCost==rCost+1 );
          /* Control reaches here if the candidate path is better than the
          ** pTo path.  Replace pTo with the candidate. */
#ifdef WHERETRACE_ENABLED /* 0x4 */
          if( sqlite3WhereTrace&0x4 ){
            sqlite3DebugPrintf(
                "Update %s cost=%-3d,%3d,%3d order=%c",
                wherePathName(pFrom, iLoop, pWLoop), rCost, nOut, rUnsorted,
                isOrdered>=0 ? isOrdered+'0' : '?');
            sqlite3DebugPrintf("  was %s cost=%-3d,%3d,%3d order=%c\n",
                wherePathName(pTo, iLoop+1, 0), pTo->rCost, pTo->nRow,
                pTo->rUnsorted, pTo->isOrdered>=0 ? pTo->isOrdered+'0' : '?');
          }
#endif
        }
        /* pWLoop is a winner.  Add it to the set of best so far */
        pTo->maskLoop = pFrom->maskLoop | pWLoop->maskSelf;
        pTo->revLoop = revMask;
        pTo->nRow = nOut;
        pTo->rCost = rCost;
        pTo->rUnsorted = rUnsorted;
        pTo->isOrdered = isOrdered;
        memcpy(pTo->aLoop, pFrom->aLoop, sizeof(WhereLoop*)*iLoop);
        pTo->aLoop[iLoop] = pWLoop;
        if( nTo>=mxChoice ){
          mxI = 0;
          mxCost = aTo[0].rCost;
          mxUnsorted = aTo[0].nRow;
          for(jj=1, pTo=&aTo[1]; jj<mxChoice; jj++, pTo++){
            if( pTo->rCost>mxCost 
             || (pTo->rCost==mxCost && pTo->rUnsorted>mxUnsorted) 
            ){
              mxCost = pTo->rCost;
              mxUnsorted = pTo->rUnsorted;
              mxI = jj;
            }
          }
        }
      }
    }

#ifdef WHERETRACE_ENABLED  /* >=2 */
    if( sqlite3WhereTrace & 0x02 ){
      sqlite3DebugPrintf("---- after round %d ----\n", iLoop);
      for(ii=0, pTo=aTo; ii<nTo; ii++, pTo++){
        sqlite3DebugPrintf(" %s cost=%-3d nrow=%-3d order=%c",
           wherePathName(pTo, iLoop+1, 0), pTo->rCost, pTo->nRow,
           pTo->isOrdered>=0 ? (pTo->isOrdered+'0') : '?');
        if( pTo->isOrdered>0 ){
          sqlite3DebugPrintf(" rev=0x%llx\n", pTo->revLoop);
        }else{
          sqlite3DebugPrintf("\n");
        }
      }
    }
#endif

    /* Swap the roles of aFrom and aTo for the next generation */
    pFrom = aTo;
    aTo = aFrom;
    aFrom = pFrom;
    nFrom = nTo;
  }

  if( nFrom==0 ){
    sqlite3ErrorMsg(pParse, "no query solution");
    sqlite3DbFreeNN(db, pSpace);
    return SQLITE_ERROR;
  }
  
  /* Find the lowest cost path.  pFrom will be left pointing to that path */
  pFrom = aFrom;
  for(ii=1; ii<nFrom; ii++){
    if( pFrom->rCost>aFrom[ii].rCost ) pFrom = &aFrom[ii];
  }
  assert( pWInfo->nLevel==nLoop );
  /* Load the lowest cost path into pWInfo */
  for(iLoop=0; iLoop<nLoop; iLoop++){
    WhereLevel *pLevel = pWInfo->a + iLoop;
    pLevel->pWLoop = pWLoop = pFrom->aLoop[iLoop];
    pLevel->iFrom = pWLoop->iTab;
    pLevel->iTabCur = pWInfo->pTabList->a[pLevel->iFrom].iCursor;
  }
  if( (pWInfo->wctrlFlags & WHERE_WANT_DISTINCT)!=0
   && (pWInfo->wctrlFlags & WHERE_DISTINCTBY)==0
   && pWInfo->eDistinct==WHERE_DISTINCT_NOOP
   && nRowEst
  ){
    Bitmask notUsed;
    int rc = wherePathSatisfiesOrderBy(pWInfo, pWInfo->pResultSet, pFrom,
                 WHERE_DISTINCTBY, nLoop-1, pFrom->aLoop[nLoop-1], &notUsed);
    if( rc==pWInfo->pResultSet->nExpr ){
      pWInfo->eDistinct = WHERE_DISTINCT_ORDERED;
    }
  }
  pWInfo->bOrderedInnerLoop = 0;
  if( pWInfo->pOrderBy ){
    if( pWInfo->wctrlFlags & WHERE_DISTINCTBY ){
      if( pFrom->isOrdered==pWInfo->pOrderBy->nExpr ){
        pWInfo->eDistinct = WHERE_DISTINCT_ORDERED;
      }
    }else{
      pWInfo->nOBSat = pFrom->isOrdered;
      pWInfo->revMask = pFrom->revLoop;
      if( pWInfo->nOBSat<=0 ){
        pWInfo->nOBSat = 0;
        if( nLoop>0 ){
          u32 wsFlags = pFrom->aLoop[nLoop-1]->wsFlags;
          if( (wsFlags & WHERE_ONEROW)==0 
           && (wsFlags&(WHERE_IPK|WHERE_COLUMN_IN))!=(WHERE_IPK|WHERE_COLUMN_IN)
          ){
            Bitmask m = 0;
            int rc = wherePathSatisfiesOrderBy(pWInfo, pWInfo->pOrderBy, pFrom,
                      WHERE_ORDERBY_LIMIT, nLoop-1, pFrom->aLoop[nLoop-1], &m);
            testcase( wsFlags & WHERE_IPK );
            testcase( wsFlags & WHERE_COLUMN_IN );
            if( rc==pWInfo->pOrderBy->nExpr ){
              pWInfo->bOrderedInnerLoop = 1;
              pWInfo->revMask = m;
            }
          }
        }
      }
    }
    if( (pWInfo->wctrlFlags & WHERE_SORTBYGROUP)
        && pWInfo->nOBSat==pWInfo->pOrderBy->nExpr && nLoop>0
    ){
      Bitmask revMask = 0;
      int nOrder = wherePathSatisfiesOrderBy(pWInfo, pWInfo->pOrderBy, 
          pFrom, 0, nLoop-1, pFrom->aLoop[nLoop-1], &revMask
      );
      assert( pWInfo->sorted==0 );
      if( nOrder==pWInfo->pOrderBy->nExpr ){
        pWInfo->sorted = 1;
        pWInfo->revMask = revMask;
      }
    }
  }


  pWInfo->nRowOut = pFrom->nRow;

  /* Free temporary memory and return success */
  sqlite3DbFreeNN(db, pSpace);
  return SQLITE_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movw %si, %ax
movq %rdi, -0x10(%rbp)
movw %ax, -0x12(%rbp)
movl $0x0, -0x40(%rbp)
movw $0x0, -0x46(%rbp)
movw $0x0, -0x48(%rbp)
movq $0x0, -0x88(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movzbl 0x42(%rax), %eax
movl %eax, -0x1c(%rbp)
cmpl $0x1, -0x1c(%rbp)
jg 0x4867b8
movl $0x1, %eax
movl %eax, -0xe8(%rbp)
jmp 0x4867d1
movl -0x1c(%rbp), %edx
movl $0xa, %eax
movl $0x5, %ecx
cmpl $0x2, %edx
cmovel %ecx, %eax
movl %eax, -0xe8(%rbp)
movl -0xe8(%rbp), %eax
movl %eax, -0x18(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x4867ee
movswl -0x12(%rbp), %eax
cmpl $0x0, %eax
jne 0x4867f7
movl $0x0, -0x44(%rbp)
jmp 0x486804
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl (%rax), %eax
movl %eax, -0x44(%rbp)
movslq -0x1c(%rbp), %rax
shlq $0x3, %rax
addq $0x20, %rax
movslq -0x18(%rbp), %rcx
imulq %rcx, %rax
shlq %rax
movl %eax, -0x94(%rbp)
movslq -0x44(%rbp), %rcx
shlq %rcx
movslq -0x94(%rbp), %rax
addq %rcx, %rax
movl %eax, -0x94(%rbp)
movq -0x30(%rbp), %rdi
movslq -0x94(%rbp), %rsi
callq 0x41b3d0
movq %rax, -0x90(%rbp)
cmpq $0x0, -0x90(%rbp)
jne 0x486865
movl $0x7, -0x4(%rbp)
jmp 0x4872c0
movq -0x90(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
movslq -0x18(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rdi
xorl %esi, %esi
movl $0x20, %edx
callq 0x4010b0
movq -0x58(%rbp), %rax
movslq -0x18(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, -0x80(%rbp)
movl -0x18(%rbp), %eax
shll %eax
movl %eax, -0x38(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x68(%rbp)
cmpl $0x0, -0x38(%rbp)
jle 0x4868f4
movq -0x80(%rbp), %rcx
movq -0x68(%rbp), %rax
movq %rcx, 0x18(%rax)
movl -0x38(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x38(%rbp)
movq -0x68(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x68(%rbp)
movl -0x1c(%rbp), %ecx
movq -0x80(%rbp), %rax
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x80(%rbp)
jmp 0x4868b6
cmpl $0x0, -0x44(%rbp)
je 0x48691a
movq -0x80(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rdi
movslq -0x44(%rbp), %rdx
shlq %rdx
xorl %esi, %esi
callq 0x4010b0
movq -0x28(%rbp), %rax
cmpl $0x30, 0xb4(%rax)
jae 0x486939
movq -0x28(%rbp), %rax
movl 0xb4(%rax), %eax
movl %eax, -0xec(%rbp)
jmp 0x486946
movl $0x30, %eax
movl %eax, -0xec(%rbp)
jmp 0x486946
movl -0xec(%rbp), %eax
movw %ax, %cx
movq -0x58(%rbp), %rax
movw %cx, 0x10(%rax)
movl $0x1, -0x50(%rbp)
cmpl $0x0, -0x44(%rbp)
je 0x48698f
cmpl $0x0, -0x1c(%rbp)
jle 0x486977
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, -0xf0(%rbp)
jmp 0x486980
movl -0x44(%rbp), %eax
movl %eax, -0xf0(%rbp)
movl -0xf0(%rbp), %eax
movb %al, %cl
movq -0x58(%rbp), %rax
movb %cl, 0x16(%rax)
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x486eaa
movl $0x0, -0x4c(%rbp)
movl $0x0, -0x38(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0x68(%rbp)
movl -0x38(%rbp), %eax
cmpl -0x50(%rbp), %eax
jge 0x486e7e
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
movq %rax, -0x78(%rbp)
cmpq $0x0, -0x78(%rbp)
je 0x486e62
movq -0x68(%rbp), %rax
movb 0x16(%rax), %al
movb %al, -0x9b(%rbp)
movq $0x0, -0xb0(%rbp)
movq -0x78(%rbp), %rax
movq (%rax), %rax
movq -0x68(%rbp), %rcx
movq (%rcx), %rcx
xorq $-0x1, %rcx
andq %rcx, %rax
cmpq $0x0, %rax
je 0x486a13
jmp 0x486e51
movq -0x78(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x68(%rbp), %rcx
andq (%rcx), %rax
cmpq $0x0, %rax
je 0x486a2d
jmp 0x486e51
movq -0x78(%rbp), %rax
movl 0x28(%rax), %eax
andl $0x4000, %eax           # imm = 0x4000
cmpl $0x0, %eax
je 0x486a50
movq -0x68(%rbp), %rax
movswl 0x10(%rax), %eax
cmpl $0x3, %eax
jge 0x486a50
jmp 0x486e51
movq -0x78(%rbp), %rax
movw 0x12(%rax), %cx
movq -0x78(%rbp), %rax
movswl 0x14(%rax), %eax
movq -0x68(%rbp), %rdx
movswl 0x10(%rdx), %edx
addl %edx, %eax
movswl %cx, %edi
movswl %ax, %esi
callq 0x484f50
movw %ax, -0x9a(%rbp)
movw -0x9a(%rbp), %cx
movq -0x68(%rbp), %rax
movswl %cx, %edi
movswl 0x14(%rax), %esi
callq 0x484f50
movw %ax, -0x9a(%rbp)
movq -0x68(%rbp), %rax
movswl 0x10(%rax), %eax
movq -0x78(%rbp), %rcx
movswl 0x16(%rcx), %ecx
addl %ecx, %eax
movw %ax, -0x96(%rbp)
movq -0x68(%rbp), %rax
movq (%rax), %rax
movq -0x78(%rbp), %rcx
orq 0x8(%rcx), %rax
movq %rax, -0xa8(%rbp)
movsbl -0x9b(%rbp), %eax
cmpl $0x0, %eax
jge 0x486b17
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
movq -0x68(%rbp), %rdx
movq -0x10(%rbp), %rax
movw 0x40(%rax), %cx
movl -0x34(%rbp), %eax
movw %ax, %r8w
movq -0x78(%rbp), %r9
leaq -0xb0(%rbp), %rax
movzwl %cx, %ecx
movzwl %r8w, %r8d
movq %rax, (%rsp)
callq 0x491e60
movb %al, -0x9b(%rbp)
jmp 0x486b26
movq -0x68(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0xb0(%rbp)
movsbl -0x9b(%rbp), %eax
cmpl $0x0, %eax
jl 0x486bb9
movsbl -0x9b(%rbp), %eax
cmpl -0x44(%rbp), %eax
jge 0x486bb9
movq -0x88(%rbp), %rax
movsbq -0x9b(%rbp), %rcx
movswl (%rax,%rcx,2), %eax
cmpl $0x0, %eax
jne 0x486b8a
movq -0x10(%rbp), %rdi
movw -0x12(%rbp), %ax
movl -0x44(%rbp), %edx
movsbl -0x9b(%rbp), %ecx
movswl %ax, %esi
callq 0x492830
movw %ax, %dx
movq -0x88(%rbp), %rax
movsbq -0x9b(%rbp), %rcx
movw %dx, (%rax,%rcx,2)
movw -0x9a(%rbp), %dx
movq -0x88(%rbp), %rax
movsbq -0x9b(%rbp), %rcx
movswl %dx, %edi
movswl (%rax,%rcx,2), %esi
callq 0x484f50
cwtl
addl $0x5, %eax
movw %ax, -0x98(%rbp)
jmp 0x486bd8
movw -0x9a(%rbp), %ax
movw %ax, -0x98(%rbp)
movswl -0x9a(%rbp), %eax
subl $0x2, %eax
movw %ax, -0x9a(%rbp)
movl $0x0, -0x3c(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x70(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0x4c(%rbp), %eax
jge 0x486c35
movq -0x70(%rbp), %rax
movq (%rax), %rax
cmpq -0xa8(%rbp), %rax
jne 0x486c1c
movq -0x70(%rbp), %rax
movsbl 0x16(%rax), %eax
movsbl -0x9b(%rbp), %ecx
xorl %ecx, %eax
andl $0x80, %eax
cmpl $0x0, %eax
jne 0x486c1c
jmp 0x486c35
jmp 0x486c1e
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
movq -0x70(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x70(%rbp)
jmp 0x486be7
movl -0x3c(%rbp), %eax
cmpl -0x4c(%rbp), %eax
jl 0x486caa
movl -0x4c(%rbp), %eax
cmpl -0x18(%rbp), %eax
jl 0x486c77
movswl -0x98(%rbp), %eax
movswl -0x46(%rbp), %ecx
cmpl %ecx, %eax
jg 0x486c72
movswl -0x98(%rbp), %eax
movswl -0x46(%rbp), %ecx
cmpl %ecx, %eax
jne 0x486c77
movswl -0x9a(%rbp), %eax
movswl -0x48(%rbp), %ecx
cmpl %ecx, %eax
jl 0x486c77
jmp 0x486e51
movl -0x4c(%rbp), %eax
cmpl -0x18(%rbp), %eax
jge 0x486c8f
movl -0x4c(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x4c(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x486c95
movl -0x40(%rbp), %eax
movl %eax, -0x3c(%rbp)
movq -0x60(%rbp), %rax
movslq -0x3c(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, -0x70(%rbp)
jmp 0x486d10
movq -0x70(%rbp), %rax
movswl 0x12(%rax), %eax
movswl -0x98(%rbp), %ecx
cmpl %ecx, %eax
jl 0x486d09
movq -0x70(%rbp), %rax
movswl 0x12(%rax), %eax
movswl -0x98(%rbp), %ecx
cmpl %ecx, %eax
jne 0x486d0e
movq -0x70(%rbp), %rax
movswl 0x10(%rax), %eax
movswl -0x96(%rbp), %ecx
cmpl %ecx, %eax
jl 0x486d09
movq -0x70(%rbp), %rax
movswl 0x10(%rax), %eax
movswl -0x96(%rbp), %ecx
cmpl %ecx, %eax
jne 0x486d0e
movq -0x70(%rbp), %rax
movswl 0x14(%rax), %eax
movswl -0x9a(%rbp), %ecx
cmpl %ecx, %eax
jg 0x486d0e
jmp 0x486e51
jmp 0x486d10
movq -0x68(%rbp), %rax
movq (%rax), %rcx
movq -0x78(%rbp), %rax
orq 0x8(%rax), %rcx
movq -0x70(%rbp), %rax
movq %rcx, (%rax)
movq -0xb0(%rbp), %rcx
movq -0x70(%rbp), %rax
movq %rcx, 0x8(%rax)
movw -0x96(%rbp), %cx
movq -0x70(%rbp), %rax
movw %cx, 0x10(%rax)
movw -0x98(%rbp), %cx
movq -0x70(%rbp), %rax
movw %cx, 0x12(%rax)
movw -0x9a(%rbp), %cx
movq -0x70(%rbp), %rax
movw %cx, 0x14(%rax)
movb -0x9b(%rbp), %cl
movq -0x70(%rbp), %rax
movb %cl, 0x16(%rax)
movq -0x70(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x68(%rbp), %rax
movq 0x18(%rax), %rsi
movslq -0x34(%rbp), %rdx
shlq $0x3, %rdx
callq 0x401040
movq -0x78(%rbp), %rdx
movq -0x70(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x34(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x4c(%rbp), %eax
cmpl -0x18(%rbp), %eax
jl 0x486e4f
movl $0x0, -0x40(%rbp)
movq -0x60(%rbp), %rax
movw 0x12(%rax), %ax
movw %ax, -0x46(%rbp)
movq -0x60(%rbp), %rax
movw 0x10(%rax), %ax
movw %ax, -0x48(%rbp)
movl $0x1, -0x3c(%rbp)
movq -0x60(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x70(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0x18(%rbp), %eax
jge 0x486e4d
movq -0x70(%rbp), %rax
movswl 0x12(%rax), %eax
movswl -0x46(%rbp), %ecx
cmpl %ecx, %eax
jg 0x486e16
movq -0x70(%rbp), %rax
movswl 0x12(%rax), %eax
movswl -0x46(%rbp), %ecx
cmpl %ecx, %eax
jne 0x486e34
movq -0x70(%rbp), %rax
movswl 0x14(%rax), %eax
movswl -0x48(%rbp), %ecx
cmpl %ecx, %eax
jle 0x486e34
movq -0x70(%rbp), %rax
movw 0x12(%rax), %ax
movw %ax, -0x46(%rbp)
movq -0x70(%rbp), %rax
movw 0x14(%rax), %ax
movw %ax, -0x48(%rbp)
movl -0x3c(%rbp), %eax
movl %eax, -0x40(%rbp)
jmp 0x486e36
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
movq -0x70(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x70(%rbp)
jmp 0x486dde
jmp 0x486e4f
jmp 0x486e51
movq -0x78(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x78(%rbp)
jmp 0x4869d0
jmp 0x486e64
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
movq -0x68(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x68(%rbp)
jmp 0x4869b8
movq -0x60(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x68(%rbp), %rax
movq %rax, -0x58(%rbp)
movl -0x4c(%rbp), %eax
movl %eax, -0x50(%rbp)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x486996
cmpl $0x0, -0x50(%rbp)
jne 0x486ede
movq -0x28(%rbp), %rdi
leaq 0xfa17b(%rip), %rsi     # 0x581036
movb $0x0, %al
callq 0x4110b0
movq -0x30(%rbp), %rdi
movq -0x90(%rbp), %rsi
callq 0x41b230
movl $0x1, -0x4(%rbp)
jmp 0x4872c0
movq -0x58(%rbp), %rax
movq %rax, -0x68(%rbp)
movl $0x1, -0x38(%rbp)
movl -0x38(%rbp), %eax
cmpl -0x50(%rbp), %eax
jge 0x486f34
movq -0x68(%rbp), %rax
movswl 0x12(%rax), %eax
movq -0x58(%rbp), %rcx
movslq -0x38(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rcx
movswl 0x12(%rcx), %ecx
cmpl %ecx, %eax
jle 0x486f27
movq -0x58(%rbp), %rax
movslq -0x38(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, -0x68(%rbp)
jmp 0x486f29
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x486eed
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x486fcc
movq -0x10(%rbp), %rax
addq $0x398, %rax            # imm = 0x398
movslq -0x34(%rbp), %rcx
imulq $0x58, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xb8(%rbp)
movq -0x68(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rcx
movq %rcx, -0x78(%rbp)
movq -0xb8(%rbp), %rax
movq %rcx, 0x48(%rax)
movq -0x78(%rbp), %rax
movb 0x10(%rax), %cl
movq -0xb8(%rbp), %rax
movb %cl, 0x2c(%rax)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
addq $0x8, %rax
movq -0xb8(%rbp), %rcx
movzbl 0x2c(%rcx), %ecx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movl 0x40(%rax), %ecx
movq -0xb8(%rbp), %rax
movl %ecx, 0x4(%rax)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x486f3b
movq -0x10(%rbp), %rax
movzwl 0x40(%rax), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
je 0x48707b
movq -0x10(%rbp), %rax
movzwl 0x40(%rax), %eax
andl $0x80, %eax
cmpl $0x0, %eax
jne 0x48707b
movq -0x10(%rbp), %rax
movzbl 0x47(%rax), %eax
cmpl $0x0, %eax
jne 0x48707b
movswl -0x12(%rbp), %eax
cmpl $0x0, %eax
je 0x48707b
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rsi
movq -0x68(%rbp), %rdx
movl -0x1c(%rbp), %eax
subl $0x1, %eax
movw %ax, %r8w
movq -0x68(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x1c(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %r9
movl $0x80, %ecx
leaq -0xc0(%rbp), %rax
movzwl %r8w, %r8d
movq %rax, (%rsp)
callq 0x491e60
movsbl %al, %eax
movl %eax, -0xc4(%rbp)
movl -0xc4(%rbp), %eax
movq -0x10(%rbp), %rcx
movq 0x18(%rcx), %rcx
cmpl (%rcx), %eax
jne 0x487079
movq -0x10(%rbp), %rax
movb $0x2, 0x47(%rax)
jmp 0x48707b
movq -0x10(%rbp), %rax
movb $0x0, 0x48(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x487299
movq -0x10(%rbp), %rax
movzwl 0x40(%rax), %eax
andl $0x80, %eax
cmpl $0x0, %eax
je 0x4870c5
movq -0x68(%rbp), %rax
movsbl 0x16(%rax), %eax
movq -0x10(%rbp), %rcx
movq 0x10(%rcx), %rcx
cmpl (%rcx), %eax
jne 0x4870c0
movq -0x10(%rbp), %rax
movb $0x2, 0x47(%rax)
jmp 0x4871db
movq -0x68(%rbp), %rax
movb 0x16(%rax), %cl
movq -0x10(%rbp), %rax
movb %cl, 0x43(%rax)
movq -0x68(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x58(%rax)
movq -0x10(%rbp), %rax
movsbl 0x43(%rax), %eax
cmpl $0x0, %eax
jg 0x4871d9
movq -0x10(%rbp), %rax
movb $0x0, 0x43(%rax)
cmpl $0x0, -0x1c(%rbp)
jle 0x4871d7
movq -0x68(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x1c(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movl 0x28(%rax), %eax
movl %eax, -0xc8(%rbp)
movl -0xc8(%rbp), %eax
andl $0x1000, %eax           # imm = 0x1000
cmpl $0x0, %eax
jne 0x4871d5
movl -0xc8(%rbp), %eax
andl $0x104, %eax            # imm = 0x104
cmpl $0x104, %eax            # imm = 0x104
je 0x4871d5
movq $0x0, -0xd0(%rbp)
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
movq -0x68(%rbp), %rdx
movl -0x1c(%rbp), %eax
subl $0x1, %eax
movw %ax, %r8w
movq -0x68(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x1c(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %r9
movl $0x800, %ecx            # imm = 0x800
leaq -0xd0(%rbp), %rax
movzwl %r8w, %r8d
movq %rax, (%rsp)
callq 0x491e60
movsbl %al, %eax
movl %eax, -0xd4(%rbp)
movl -0xd4(%rbp), %eax
movq -0x10(%rbp), %rcx
movq 0x10(%rcx), %rcx
cmpl (%rcx), %eax
jne 0x4871d3
movq -0x10(%rbp), %rax
movb $0x1, 0x48(%rax)
movq -0xd0(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x58(%rax)
jmp 0x4871d5
jmp 0x4871d7
jmp 0x4871d9
jmp 0x4871db
movq -0x10(%rbp), %rax
movzwl 0x40(%rax), %eax
andl $0x200, %eax            # imm = 0x200
cmpl $0x0, %eax
je 0x487297
movq -0x10(%rbp), %rax
movsbl 0x43(%rax), %eax
movq -0x10(%rbp), %rcx
movq 0x10(%rcx), %rcx
cmpl (%rcx), %eax
jne 0x487297
cmpl $0x0, -0x1c(%rbp)
jle 0x487297
movq $0x0, -0xe0(%rbp)
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
movq -0x68(%rbp), %rdx
movl -0x1c(%rbp), %eax
subl $0x1, %eax
movw %ax, %r8w
movq -0x68(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x1c(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %r9
xorl %ecx, %ecx
leaq -0xe0(%rbp), %rax
movzwl %r8w, %r8d
movq %rax, (%rsp)
callq 0x491e60
movsbl %al, %eax
movl %eax, -0xe4(%rbp)
movl -0xe4(%rbp), %eax
movq -0x10(%rbp), %rcx
movq 0x10(%rcx), %rcx
cmpl (%rcx), %eax
jne 0x487295
movq -0x10(%rbp), %rax
movb $0x1, 0x44(%rax)
movq -0xe0(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x58(%rax)
jmp 0x487297
jmp 0x487299
movq -0x68(%rbp), %rax
movw 0x10(%rax), %cx
movq -0x10(%rbp), %rax
movw %cx, 0x60(%rax)
movq -0x30(%rbp), %rdi
movq -0x90(%rbp), %rsi
callq 0x41b230
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
nopl (%rax)