// File: /workspace/github_c_makefile_star2_O0/ukontainer[P]sqlite-bench/sqlite3.c
// Function: whereLoopAddBtreeIndex
static int whereLoopAddBtreeIndex(
  WhereLoopBuilder *pBuilder,     /* The WhereLoop factory */
  struct SrcList_item *pSrc,      /* FROM clause term being analyzed */
  Index *pProbe,                  /* An index on pSrc */
  LogEst nInMul                   /* log(Number of iterations due to IN) */
){
  WhereInfo *pWInfo = pBuilder->pWInfo;  /* WHERE analyse context */
  Parse *pParse = pWInfo->pParse;        /* Parsing context */
  sqlite3 *db = pParse->db;       /* Database connection malloc context */
  WhereLoop *pNew;                /* Template WhereLoop under construction */
  WhereTerm *pTerm;               /* A WhereTerm under consideration */
  int opMask;                     /* Valid operators for constraints */
  WhereScan scan;                 /* Iterator for WHERE terms */
  Bitmask saved_prereq;           /* Original value of pNew->prereq */
  u16 saved_nLTerm;               /* Original value of pNew->nLTerm */
  u16 saved_nEq;                  /* Original value of pNew->u.btree.nEq */
  u16 saved_nBtm;                 /* Original value of pNew->u.btree.nBtm */
  u16 saved_nTop;                 /* Original value of pNew->u.btree.nTop */
  u16 saved_nSkip;                /* Original value of pNew->nSkip */
  u32 saved_wsFlags;              /* Original value of pNew->wsFlags */
  LogEst saved_nOut;              /* Original value of pNew->nOut */
  int rc = SQLITE_OK;             /* Return code */
  LogEst rSize;                   /* Number of rows in the table */
  LogEst rLogSize;                /* Logarithm of table size */
  WhereTerm *pTop = 0, *pBtm = 0; /* Top and bottom range constraints */

  pNew = pBuilder->pNew;
  if( db->mallocFailed ) return SQLITE_NOMEM_BKPT;
  WHERETRACE(0x800, ("BEGIN %s.addBtreeIdx(%s), nEq=%d\n",
                     pProbe->pTable->zName,pProbe->zName, pNew->u.btree.nEq));

  assert( (pNew->wsFlags & WHERE_VIRTUALTABLE)==0 );
  assert( (pNew->wsFlags & WHERE_TOP_LIMIT)==0 );
  if( pNew->wsFlags & WHERE_BTM_LIMIT ){
    opMask = WO_LT|WO_LE;
  }else{
    assert( pNew->u.btree.nBtm==0 );
    opMask = WO_EQ|WO_IN|WO_GT|WO_GE|WO_LT|WO_LE|WO_ISNULL|WO_IS;
  }
  if( pProbe->bUnordered ) opMask &= ~(WO_GT|WO_GE|WO_LT|WO_LE);

  assert( pNew->u.btree.nEq<pProbe->nColumn );

  saved_nEq = pNew->u.btree.nEq;
  saved_nBtm = pNew->u.btree.nBtm;
  saved_nTop = pNew->u.btree.nTop;
  saved_nSkip = pNew->nSkip;
  saved_nLTerm = pNew->nLTerm;
  saved_wsFlags = pNew->wsFlags;
  saved_prereq = pNew->prereq;
  saved_nOut = pNew->nOut;
  pTerm = whereScanInit(&scan, pBuilder->pWC, pSrc->iCursor, saved_nEq,
                        opMask, pProbe);
  pNew->rSetup = 0;
  rSize = pProbe->aiRowLogEst[0];
  rLogSize = estLog(rSize);
  for(; rc==SQLITE_OK && pTerm!=0; pTerm = whereScanNext(&scan)){
    u16 eOp = pTerm->eOperator;   /* Shorthand for pTerm->eOperator */
    LogEst rCostIdx;
    LogEst nOutUnadjusted;        /* nOut before IN() and WHERE adjustments */
    int nIn = 0;
#ifdef SQLITE_ENABLE_STAT3_OR_STAT4
    int nRecValid = pBuilder->nRecValid;
#endif
    if( (eOp==WO_ISNULL || (pTerm->wtFlags&TERM_VNULL)!=0)
     && indexColumnNotNull(pProbe, saved_nEq)
    ){
      continue; /* ignore IS [NOT] NULL constraints on NOT NULL columns */
    }
    if( pTerm->prereqRight & pNew->maskSelf ) continue;

    /* Do not allow the upper bound of a LIKE optimization range constraint
    ** to mix with a lower range bound from some other source */
    if( pTerm->wtFlags & TERM_LIKEOPT && pTerm->eOperator==WO_LT ) continue;

    /* Do not allow constraints from the WHERE clause to be used by the
    ** right table of a LEFT JOIN.  Only constraints in the ON clause are
    ** allowed */
    if( (pSrc->fg.jointype & JT_LEFT)!=0
     && !ExprHasProperty(pTerm->pExpr, EP_FromJoin)
    ){
      continue;
    }

    if( IsUniqueIndex(pProbe) && saved_nEq==pProbe->nKeyCol-1 ){
      pBuilder->bldFlags |= SQLITE_BLDF_UNIQUE;
    }else{
      pBuilder->bldFlags |= SQLITE_BLDF_INDEXED;
    }
    pNew->wsFlags = saved_wsFlags;
    pNew->u.btree.nEq = saved_nEq;
    pNew->u.btree.nBtm = saved_nBtm;
    pNew->u.btree.nTop = saved_nTop;
    pNew->nLTerm = saved_nLTerm;
    if( whereLoopResize(db, pNew, pNew->nLTerm+1) ) break; /* OOM */
    pNew->aLTerm[pNew->nLTerm++] = pTerm;
    pNew->prereq = (saved_prereq | pTerm->prereqRight) & ~pNew->maskSelf;

    assert( nInMul==0
        || (pNew->wsFlags & WHERE_COLUMN_NULL)!=0 
        || (pNew->wsFlags & WHERE_COLUMN_IN)!=0 
        || (pNew->wsFlags & WHERE_SKIPSCAN)!=0 
    );

    if( eOp & WO_IN ){
      Expr *pExpr = pTerm->pExpr;
      if( ExprHasProperty(pExpr, EP_xIsSelect) ){
        /* "x IN (SELECT ...)":  TUNING: the SELECT returns 25 rows */
        int i;
        nIn = 46;  assert( 46==sqlite3LogEst(25) );

        /* The expression may actually be of the form (x, y) IN (SELECT...).
        ** In this case there is a separate term for each of (x) and (y).
        ** However, the nIn multiplier should only be applied once, not once
        ** for each such term. The following loop checks that pTerm is the
        ** first such term in use, and sets nIn back to 0 if it is not. */
        for(i=0; i<pNew->nLTerm-1; i++){
          if( pNew->aLTerm[i] && pNew->aLTerm[i]->pExpr==pExpr ) nIn = 0;
        }
      }else if( ALWAYS(pExpr->x.pList && pExpr->x.pList->nExpr) ){
        /* "x IN (value, value, ...)" */
        nIn = sqlite3LogEst(pExpr->x.pList->nExpr);
        assert( nIn>0 );  /* RHS always has 2 or more terms...  The parser
                          ** changes "x IN (?)" into "x=?". */
      }
      if( pProbe->hasStat1 ){
        LogEst M, logK, safetyMargin;
        /* Let:
        **   N = the total number of rows in the table
        **   K = the number of entries on the RHS of the IN operator
        **   M = the number of rows in the table that match terms to the 
        **       to the left in the same index.  If the IN operator is on
        **       the left-most index column, M==N.
        **
        ** Given the definitions above, it is better to omit the IN operator
        ** from the index lookup and instead do a scan of the M elements,
        ** testing each scanned row against the IN operator separately, if:
        **
        **        M*log(K) < K*log(N)
        **
        ** Our estimates for M, K, and N might be inaccurate, so we build in
        ** a safety margin of 2 (LogEst: 10) that favors using the IN operator
        ** with the index, as using an index has better worst-case behavior.
        ** If we do not have real sqlite_stat1 data, always prefer to use
        ** the index.
        */
        M = pProbe->aiRowLogEst[saved_nEq];
        logK = estLog(nIn);
        safetyMargin = 10;  /* TUNING: extra weight for indexed IN */
        if( M + logK + safetyMargin < nIn + rLogSize ){
          WHERETRACE(0x40,
            ("Scan preferred over IN operator on column %d of \"%s\" (%d<%d)\n",
             saved_nEq, pProbe->zName, M+logK+10, nIn+rLogSize));
          continue;
        }else{
          WHERETRACE(0x40,
            ("IN operator preferred on column %d of \"%s\" (%d>=%d)\n",
             saved_nEq, pProbe->zName, M+logK+10, nIn+rLogSize));
        }
      }
      pNew->wsFlags |= WHERE_COLUMN_IN;
    }else if( eOp & (WO_EQ|WO_IS) ){
      int iCol = pProbe->aiColumn[saved_nEq];
      pNew->wsFlags |= WHERE_COLUMN_EQ;
      assert( saved_nEq==pNew->u.btree.nEq );
      if( iCol==XN_ROWID 
       || (iCol>=0 && nInMul==0 && saved_nEq==pProbe->nKeyCol-1)
      ){
        if( iCol==XN_ROWID || pProbe->uniqNotNull 
         || (pProbe->nKeyCol==1 && pProbe->onError && eOp==WO_EQ) 
        ){
          pNew->wsFlags |= WHERE_ONEROW;
        }else{
          pNew->wsFlags |= WHERE_UNQ_WANTED;
        }
      }
    }else if( eOp & WO_ISNULL ){
      pNew->wsFlags |= WHERE_COLUMN_NULL;
    }else if( eOp & (WO_GT|WO_GE) ){
      testcase( eOp & WO_GT );
      testcase( eOp & WO_GE );
      pNew->wsFlags |= WHERE_COLUMN_RANGE|WHERE_BTM_LIMIT;
      pNew->u.btree.nBtm = whereRangeVectorLen(
          pParse, pSrc->iCursor, pProbe, saved_nEq, pTerm
      );
      pBtm = pTerm;
      pTop = 0;
      if( pTerm->wtFlags & TERM_LIKEOPT ){
        /* Range contraints that come from the LIKE optimization are
        ** always used in pairs. */
        pTop = &pTerm[1];
        assert( (pTop-(pTerm->pWC->a))<pTerm->pWC->nTerm );
        assert( pTop->wtFlags & TERM_LIKEOPT );
        assert( pTop->eOperator==WO_LT );
        if( whereLoopResize(db, pNew, pNew->nLTerm+1) ) break; /* OOM */
        pNew->aLTerm[pNew->nLTerm++] = pTop;
        pNew->wsFlags |= WHERE_TOP_LIMIT;
        pNew->u.btree.nTop = 1;
      }
    }else{
      assert( eOp & (WO_LT|WO_LE) );
      testcase( eOp & WO_LT );
      testcase( eOp & WO_LE );
      pNew->wsFlags |= WHERE_COLUMN_RANGE|WHERE_TOP_LIMIT;
      pNew->u.btree.nTop = whereRangeVectorLen(
          pParse, pSrc->iCursor, pProbe, saved_nEq, pTerm
      );
      pTop = pTerm;
      pBtm = (pNew->wsFlags & WHERE_BTM_LIMIT)!=0 ?
                     pNew->aLTerm[pNew->nLTerm-2] : 0;
    }

    /* At this point pNew->nOut is set to the number of rows expected to
    ** be visited by the index scan before considering term pTerm, or the
    ** values of nIn and nInMul. In other words, assuming that all 
    ** "x IN(...)" terms are replaced with "x = ?". This block updates
    ** the value of pNew->nOut to account for pTerm (but not nIn/nInMul).  */
    assert( pNew->nOut==saved_nOut );
    if( pNew->wsFlags & WHERE_COLUMN_RANGE ){
      /* Adjust nOut using stat3/stat4 data. Or, if there is no stat3/stat4
      ** data, using some other estimate.  */
      whereRangeScanEst(pParse, pBuilder, pBtm, pTop, pNew);
    }else{
      int nEq = ++pNew->u.btree.nEq;
      assert( eOp & (WO_ISNULL|WO_EQ|WO_IN|WO_IS) );

      assert( pNew->nOut==saved_nOut );
      if( pTerm->truthProb<=0 && pProbe->aiColumn[saved_nEq]>=0 ){
        assert( (eOp & WO_IN) || nIn==0 );
        testcase( eOp & WO_IN );
        pNew->nOut += pTerm->truthProb;
        pNew->nOut -= nIn;
      }else{
#ifdef SQLITE_ENABLE_STAT3_OR_STAT4
        tRowcnt nOut = 0;
        if( nInMul==0 
         && pProbe->nSample 
         && pNew->u.btree.nEq<=pProbe->nSampleCol
         && ((eOp & WO_IN)==0 || !ExprHasProperty(pTerm->pExpr, EP_xIsSelect))
         && OptimizationEnabled(db, SQLITE_Stat34)
        ){
          Expr *pExpr = pTerm->pExpr;
          if( (eOp & (WO_EQ|WO_ISNULL|WO_IS))!=0 ){
            testcase( eOp & WO_EQ );
            testcase( eOp & WO_IS );
            testcase( eOp & WO_ISNULL );
            rc = whereEqualScanEst(pParse, pBuilder, pExpr->pRight, &nOut);
          }else{
            rc = whereInScanEst(pParse, pBuilder, pExpr->x.pList, &nOut);
          }
          if( rc==SQLITE_NOTFOUND ) rc = SQLITE_OK;
          if( rc!=SQLITE_OK ) break;          /* Jump out of the pTerm loop */
          if( nOut ){
            pNew->nOut = sqlite3LogEst(nOut);
            if( pNew->nOut>saved_nOut ) pNew->nOut = saved_nOut;
            pNew->nOut -= nIn;
          }
        }
        if( nOut==0 )
#endif
        {
          pNew->nOut += (pProbe->aiRowLogEst[nEq] - pProbe->aiRowLogEst[nEq-1]);
          if( eOp & WO_ISNULL ){
            /* TUNING: If there is no likelihood() value, assume that a 
            ** "col IS NULL" expression matches twice as many rows 
            ** as (col=?). */
            pNew->nOut += 10;
          }
        }
      }
    }

    /* Set rCostIdx to the cost of visiting selected rows in index. Add
    ** it to pNew->rRun, which is currently set to the cost of the index
    ** seek only. Then, if this is a non-covering index, add the cost of
    ** visiting the rows in the main table.  */
    rCostIdx = pNew->nOut + 1 + (15*pProbe->szIdxRow)/pSrc->pTab->szTabRow;
    pNew->rRun = sqlite3LogEstAdd(rLogSize, rCostIdx);
    if( (pNew->wsFlags & (WHERE_IDX_ONLY|WHERE_IPK))==0 ){
      pNew->rRun = sqlite3LogEstAdd(pNew->rRun, pNew->nOut + 16);
    }
    ApplyCostMultiplier(pNew->rRun, pProbe->pTable->costMult);

    nOutUnadjusted = pNew->nOut;
    pNew->rRun += nInMul + nIn;
    pNew->nOut += nInMul + nIn;
    whereLoopOutputAdjust(pBuilder->pWC, pNew, rSize);
    rc = whereLoopInsert(pBuilder, pNew);

    if( pNew->wsFlags & WHERE_COLUMN_RANGE ){
      pNew->nOut = saved_nOut;
    }else{
      pNew->nOut = nOutUnadjusted;
    }

    if( (pNew->wsFlags & WHERE_TOP_LIMIT)==0
     && pNew->u.btree.nEq<pProbe->nColumn
    ){
      whereLoopAddBtreeIndex(pBuilder, pSrc, pProbe, nInMul+nIn);
    }
    pNew->nOut = saved_nOut;
#ifdef SQLITE_ENABLE_STAT3_OR_STAT4
    pBuilder->nRecValid = nRecValid;
#endif
  }
  pNew->prereq = saved_prereq;
  pNew->u.btree.nEq = saved_nEq;
  pNew->u.btree.nBtm = saved_nBtm;
  pNew->u.btree.nTop = saved_nTop;
  pNew->nSkip = saved_nSkip;
  pNew->wsFlags = saved_wsFlags;
  pNew->nOut = saved_nOut;
  pNew->nLTerm = saved_nLTerm;

  /* Consider using a skip-scan if there are no WHERE clause constraints
  ** available for the left-most terms of the index, and if the average
  ** number of repeats in the left-most terms is at least 18. 
  **
  ** The magic number 18 is selected on the basis that scanning 17 rows
  ** is almost always quicker than an index seek (even though if the index
  ** contains fewer than 2^17 rows we assume otherwise in other parts of
  ** the code). And, even if it is not, it should not be too much slower. 
  ** On the other hand, the extra seeks could end up being significantly
  ** more expensive.  */
  assert( 42==sqlite3LogEst(18) );
  if( saved_nEq==saved_nSkip
   && saved_nEq+1<pProbe->nKeyCol
   && pProbe->noSkipScan==0
   && OptimizationEnabled(db, SQLITE_SkipScan)
   && pProbe->aiRowLogEst[saved_nEq+1]>=42  /* TUNING: Minimum for skip-scan */
   && (rc = whereLoopResize(db, pNew, pNew->nLTerm+1))==SQLITE_OK
  ){
    LogEst nIter;
    pNew->u.btree.nEq++;
    pNew->nSkip++;
    pNew->aLTerm[pNew->nLTerm++] = 0;
    pNew->wsFlags |= WHERE_SKIPSCAN;
    nIter = pProbe->aiRowLogEst[saved_nEq] - pProbe->aiRowLogEst[saved_nEq+1];
    pNew->nOut -= nIter;
    /* TUNING:  Because uncertainties in the estimates for skip-scan queries,
    ** add a 1.375 fudge factor to make skip-scan slightly less likely. */
    nIter += 5;
    whereLoopAddBtreeIndex(pBuilder, pSrc, pProbe, nIter + nInMul);
    pNew->nOut = saved_nOut;
    pNew->u.btree.nEq = saved_nEq;
    pNew->nSkip = saved_nSkip;
    pNew->wsFlags = saved_wsFlags;
  }

  WHERETRACE(0x800, ("END %s.addBtreeIdx(%s), nEq=%d, rc=%d\n",
                      pProbe->pTable->zName, pProbe->zName, saved_nEq, rc));
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movw %cx, %ax
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movw %ax, -0x22(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x40(%rbp)
movl $0x0, -0xe8(%rbp)
movq $0x0, -0xf8(%rbp)
movq $0x0, -0x100(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rax
cmpb $0x0, 0x61(%rax)
je 0x490d61
movl $0x7, -0x4(%rbp)
jmp 0x491918
movq -0x48(%rbp), %rax
movl 0x28(%rax), %eax
andl $0x20, %eax
cmpl $0x0, %eax
je 0x490d79
movl $0x18, -0x54(%rbp)
jmp 0x490d80
movl $0x1bf, -0x54(%rbp)     # imm = 0x1BF
movq -0x20(%rbp), %rax
movw 0x63(%rax), %ax
shrw $0x2, %ax
andw $0x1, %ax
movzwl %ax, %eax
cmpl $0x0, %eax
je 0x490da1
movl -0x54(%rbp), %eax
andl $-0x3d, %eax
movl %eax, -0x54(%rbp)
movq -0x48(%rbp), %rax
movw 0x18(%rax), %ax
movw %ax, -0xd4(%rbp)
movq -0x48(%rbp), %rax
movw 0x1a(%rax), %ax
movw %ax, -0xd6(%rbp)
movq -0x48(%rbp), %rax
movw 0x1c(%rax), %ax
movw %ax, -0xd8(%rbp)
movq -0x48(%rbp), %rax
movw 0x2e(%rax), %ax
movw %ax, -0xda(%rbp)
movq -0x48(%rbp), %rax
movw 0x2c(%rax), %ax
movw %ax, -0xd2(%rbp)
movq -0x48(%rbp), %rax
movl 0x28(%rax), %eax
movl %eax, -0xe0(%rbp)
movq -0x48(%rbp), %rax
movq (%rax), %rax
movq %rax, -0xd0(%rbp)
movq -0x48(%rbp), %rax
movw 0x16(%rax), %ax
movw %ax, -0xe2(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x18(%rbp), %rax
movl 0x40(%rax), %edx
movzwl -0xd4(%rbp), %ecx
movl -0x54(%rbp), %r8d
movq -0x20(%rbp), %r9
leaq -0xc8(%rbp), %rdi
callq 0x48d610
movq %rax, -0x50(%rbp)
movq -0x48(%rbp), %rax
movw $0x0, 0x12(%rax)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movw (%rax), %ax
movw %ax, -0xea(%rbp)
movswl -0xea(%rbp), %edi
callq 0x490660
movw %ax, -0xec(%rbp)
xorl %eax, %eax
cmpl $0x0, -0xe8(%rbp)
movb %al, -0x12f(%rbp)
jne 0x490e92
cmpq $0x0, -0x50(%rbp)
setne %al
movb %al, -0x12f(%rbp)
movb -0x12f(%rbp), %al
testb $0x1, %al
jne 0x490ea1
jmp 0x4916e3
movq -0x50(%rbp), %rax
movw 0x14(%rax), %ax
movw %ax, -0x102(%rbp)
movl $0x0, -0x10c(%rbp)
movzwl -0x102(%rbp), %eax
cmpl $0x100, %eax            # imm = 0x100
je 0x490ed8
movq -0x50(%rbp), %rax
movzwl 0x12(%rax), %eax
andl $0x0, %eax
cmpl $0x0, %eax
je 0x490ef2
movq -0x20(%rbp), %rdi
movzwl -0xd4(%rbp), %esi
callq 0x48d5b0
cmpl $0x0, %eax
je 0x490ef2
jmp 0x4916ce
movq -0x50(%rbp), %rax
movq 0x30(%rax), %rax
movq -0x48(%rbp), %rcx
andq 0x8(%rcx), %rax
cmpq $0x0, %rax
je 0x490f0d
jmp 0x4916ce
movq -0x50(%rbp), %rax
movzwl 0x12(%rax), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
je 0x490f31
movq -0x50(%rbp), %rax
movzwl 0x14(%rax), %eax
cmpl $0x10, %eax
jne 0x490f31
jmp 0x4916ce
movq -0x18(%rbp), %rax
movzbl 0x3c(%rax), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x490f58
movq -0x50(%rbp), %rax
movq (%rax), %rax
movl 0x4(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x490f58
jmp 0x4916ce
movq -0x20(%rbp), %rax
movzbl 0x62(%rax), %eax
cmpl $0x0, %eax
je 0x490f8a
movzwl -0xd4(%rbp), %eax
movq -0x20(%rbp), %rcx
movzwl 0x5e(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jne 0x490f8a
movq -0x10(%rbp), %rax
movl 0x28(%rax), %ecx
orl $0x2, %ecx
movl %ecx, 0x28(%rax)
jmp 0x490f97
movq -0x10(%rbp), %rax
movl 0x28(%rax), %ecx
orl $0x1, %ecx
movl %ecx, 0x28(%rax)
movl -0xe0(%rbp), %ecx
movq -0x48(%rbp), %rax
movl %ecx, 0x28(%rax)
movw -0xd4(%rbp), %cx
movq -0x48(%rbp), %rax
movw %cx, 0x18(%rax)
movw -0xd6(%rbp), %cx
movq -0x48(%rbp), %rax
movw %cx, 0x1a(%rax)
movw -0xd8(%rbp), %cx
movq -0x48(%rbp), %rax
movw %cx, 0x1c(%rax)
movw -0xd2(%rbp), %cx
movq -0x48(%rbp), %rax
movw %cx, 0x2c(%rax)
movq -0x40(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq -0x48(%rbp), %rax
movzwl 0x2c(%rax), %edx
addl $0x1, %edx
callq 0x48f570
cmpl $0x0, %eax
je 0x491002
jmp 0x4916e3
movq -0x50(%rbp), %rdx
movq -0x48(%rbp), %rax
movq 0x38(%rax), %rax
movq -0x48(%rbp), %rsi
movw 0x2c(%rsi), %cx
movw %cx, %di
addw $0x1, %di
movw %di, 0x2c(%rsi)
movzwl %cx, %ecx
movq %rdx, (%rax,%rcx,8)
movq -0xd0(%rbp), %rcx
movq -0x50(%rbp), %rax
orq 0x30(%rax), %rcx
movq -0x48(%rbp), %rax
movq 0x8(%rax), %rax
xorq $-0x1, %rax
andq %rax, %rcx
movq -0x48(%rbp), %rax
movq %rcx, (%rax)
movzwl -0x102(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x4911d0
movq -0x50(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x118(%rbp)
movq -0x118(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
je 0x4910ff
movl $0x2e, -0x10c(%rbp)
movl $0x0, -0x11c(%rbp)
movl -0x11c(%rbp), %eax
movq -0x48(%rbp), %rcx
movzwl 0x2c(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x4910fd
movq -0x48(%rbp), %rax
movq 0x38(%rax), %rax
movslq -0x11c(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
je 0x4910ea
movq -0x48(%rbp), %rax
movq 0x38(%rax), %rax
movslq -0x11c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax), %rax
cmpq -0x118(%rbp), %rax
jne 0x4910ea
movl $0x0, -0x10c(%rbp)
jmp 0x4910ec
movl -0x11c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x11c(%rbp)
jmp 0x491096
jmp 0x491139
movq -0x118(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0x491137
movq -0x118(%rbp), %rax
movq 0x20(%rax), %rax
cmpl $0x0, (%rax)
je 0x491137
movq -0x118(%rbp), %rax
movq 0x20(%rax), %rax
movslq (%rax), %rdi
callq 0x4413f0
cwtl
movl %eax, -0x10c(%rbp)
jmp 0x491139
movq -0x20(%rbp), %rax
movw 0x63(%rax), %ax
shrw $0x7, %ax
andw $0x1, %ax
movzwl %ax, %eax
cmpl $0x0, %eax
je 0x4911be
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movzwl -0xd4(%rbp), %ecx
movw (%rax,%rcx,2), %ax
movw %ax, -0x11e(%rbp)
movl -0x10c(%rbp), %eax
movswl %ax, %edi
callq 0x490660
movw %ax, -0x120(%rbp)
movw $0xa, -0x122(%rbp)
movswl -0x11e(%rbp), %eax
movswl -0x120(%rbp), %ecx
addl %ecx, %eax
movswl -0x122(%rbp), %ecx
addl %ecx, %eax
movl -0x10c(%rbp), %ecx
movswl -0xec(%rbp), %edx
addl %edx, %ecx
cmpl %ecx, %eax
jge 0x4911ba
jmp 0x4916ce
jmp 0x4911bc
jmp 0x4911be
movq -0x48(%rbp), %rax
movl 0x28(%rax), %ecx
orl $0x4, %ecx
movl %ecx, 0x28(%rax)
jmp 0x491452
movzwl -0x102(%rbp), %eax
andl $0x82, %eax
cmpl $0x0, %eax
je 0x4912b4
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movzwl -0xd4(%rbp), %ecx
movswl (%rax,%rcx,2), %eax
movl %eax, -0x128(%rbp)
movq -0x48(%rbp), %rax
movl 0x28(%rax), %ecx
orl $0x1, %ecx
movl %ecx, 0x28(%rax)
cmpl $-0x1, -0x128(%rbp)
je 0x491244
cmpl $0x0, -0x128(%rbp)
jl 0x4912af
movswl -0x22(%rbp), %eax
cmpl $0x0, %eax
jne 0x4912af
movzwl -0xd4(%rbp), %eax
movq -0x20(%rbp), %rcx
movzwl 0x5e(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jne 0x4912af
cmpl $-0x1, -0x128(%rbp)
je 0x49128b
movq -0x20(%rbp), %rax
movw 0x63(%rax), %ax
shrw $0x3, %ax
andw $0x1, %ax
movzwl %ax, %eax
cmpl $0x0, %eax
jne 0x49128b
movq -0x20(%rbp), %rax
movzwl 0x5e(%rax), %eax
cmpl $0x1, %eax
jne 0x49129d
movq -0x20(%rbp), %rax
movzbl 0x62(%rax), %eax
cmpl $0x0, %eax
je 0x49129d
movzwl -0x102(%rbp), %eax
cmpl $0x2, %eax
jne 0x49129d
movq -0x48(%rbp), %rax
movl 0x28(%rax), %ecx
orl $0x1000, %ecx           # imm = 0x1000
movl %ecx, 0x28(%rax)
jmp 0x4912ad
movq -0x48(%rbp), %rax
movl 0x28(%rax), %ecx
orl $0x10000, %ecx          # imm = 0x10000
movl %ecx, 0x28(%rax)
jmp 0x4912af
jmp 0x491450
movzwl -0x102(%rbp), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
je 0x4912d7
movq -0x48(%rbp), %rax
movl 0x28(%rax), %ecx
orl $0x8, %ecx
movl %ecx, 0x28(%rax)
jmp 0x49144e
movzwl -0x102(%rbp), %eax
andl $0x24, %eax
cmpl $0x0, %eax
je 0x4913bf
movq -0x48(%rbp), %rax
movl 0x28(%rax), %ecx
orl $0x22, %ecx
movl %ecx, 0x28(%rax)
movq -0x38(%rbp), %rdi
movq -0x18(%rbp), %rax
movl 0x40(%rax), %esi
movq -0x20(%rbp), %rdx
movzwl -0xd4(%rbp), %ecx
movq -0x50(%rbp), %r8
callq 0x491ab0
movw %ax, %cx
movq -0x48(%rbp), %rax
movw %cx, 0x1a(%rax)
movq -0x50(%rbp), %rax
movq %rax, -0x100(%rbp)
movq $0x0, -0xf8(%rbp)
movq -0x50(%rbp), %rax
movzwl 0x12(%rax), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
je 0x4913ba
movq -0x50(%rbp), %rax
addq $0x40, %rax
movq %rax, -0xf8(%rbp)
movq -0x40(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq -0x48(%rbp), %rax
movzwl 0x2c(%rax), %edx
addl $0x1, %edx
callq 0x48f570
cmpl $0x0, %eax
je 0x49137a
jmp 0x4916e3
movq -0xf8(%rbp), %rdx
movq -0x48(%rbp), %rax
movq 0x38(%rax), %rax
movq -0x48(%rbp), %rsi
movw 0x2c(%rsi), %cx
movw %cx, %di
addw $0x1, %di
movw %di, 0x2c(%rsi)
movzwl %cx, %ecx
movq %rdx, (%rax,%rcx,8)
movq -0x48(%rbp), %rax
movl 0x28(%rax), %ecx
orl $0x10, %ecx
movl %ecx, 0x28(%rax)
movq -0x48(%rbp), %rax
movw $0x1, 0x1c(%rax)
jmp 0x49144c
movq -0x48(%rbp), %rax
movl 0x28(%rax), %ecx
orl $0x12, %ecx
movl %ecx, 0x28(%rax)
movq -0x38(%rbp), %rdi
movq -0x18(%rbp), %rax
movl 0x40(%rax), %esi
movq -0x20(%rbp), %rdx
movzwl -0xd4(%rbp), %ecx
movq -0x50(%rbp), %r8
callq 0x491ab0
movw %ax, %cx
movq -0x48(%rbp), %rax
movw %cx, 0x1c(%rax)
movq -0x50(%rbp), %rax
movq %rax, -0xf8(%rbp)
movq -0x48(%rbp), %rax
movl 0x28(%rax), %eax
andl $0x20, %eax
cmpl $0x0, %eax
je 0x491433
movq -0x48(%rbp), %rax
movq 0x38(%rax), %rax
movq -0x48(%rbp), %rcx
movzwl 0x2c(%rcx), %ecx
subl $0x2, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x138(%rbp)
jmp 0x49143e
xorl %eax, %eax
movq %rax, -0x138(%rbp)
jmp 0x49143e
movq -0x138(%rbp), %rax
movq %rax, -0x100(%rbp)
jmp 0x49144e
jmp 0x491450
jmp 0x491452
movq -0x48(%rbp), %rax
movl 0x28(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x491485
movq -0x38(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x100(%rbp), %rdx
movq -0xf8(%rbp), %rcx
movq -0x48(%rbp), %r8
callq 0x491cc0
jmp 0x49154e
movq -0x48(%rbp), %rcx
movw 0x18(%rcx), %ax
addw $0x1, %ax
movw %ax, 0x18(%rcx)
movzwl %ax, %eax
movl %eax, -0x12c(%rbp)
movq -0x50(%rbp), %rax
movswl 0x10(%rax), %eax
cmpl $0x0, %eax
jg 0x4914ef
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movzwl -0xd4(%rbp), %ecx
movswl (%rax,%rcx,2), %eax
cmpl $0x0, %eax
jl 0x4914ef
movq -0x50(%rbp), %rax
movswl 0x10(%rax), %edx
movq -0x48(%rbp), %rax
movswl 0x16(%rax), %ecx
addl %edx, %ecx
movw %cx, 0x16(%rax)
movl -0x10c(%rbp), %edx
movq -0x48(%rbp), %rax
movswl 0x16(%rax), %ecx
subl %edx, %ecx
movw %cx, 0x16(%rax)
jmp 0x49154c
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x12c(%rbp), %rcx
movswl (%rax,%rcx,2), %edx
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x12c(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movswl (%rax,%rcx,2), %eax
subl %eax, %edx
movq -0x48(%rbp), %rax
movswl 0x16(%rax), %ecx
addl %edx, %ecx
movw %cx, 0x16(%rax)
movzwl -0x102(%rbp), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
je 0x49154a
movq -0x48(%rbp), %rax
movswl 0x16(%rax), %ecx
addl $0xa, %ecx
movw %cx, 0x16(%rax)
jmp 0x49154c
jmp 0x49154e
movq -0x48(%rbp), %rax
movswl 0x16(%rax), %eax
addl $0x1, %eax
movl %eax, -0x13c(%rbp)
movq -0x20(%rbp), %rax
movswl 0x5c(%rax), %eax
imull $0xf, %eax, %eax
movq -0x18(%rbp), %rcx
movq 0x20(%rcx), %rcx
movswl 0x4a(%rcx), %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0x13c(%rbp), %eax
addl %ecx, %eax
movw %ax, -0x104(%rbp)
movw -0xec(%rbp), %ax
movswl %ax, %edi
movswl -0x104(%rbp), %esi
callq 0x484f50
movw %ax, %cx
movq -0x48(%rbp), %rax
movw %cx, 0x14(%rax)
movq -0x48(%rbp), %rax
movl 0x28(%rax), %eax
andl $0x140, %eax            # imm = 0x140
cmpl $0x0, %eax
jne 0x4915e5
movq -0x48(%rbp), %rax
movw 0x14(%rax), %cx
movq -0x48(%rbp), %rax
movswl 0x16(%rax), %eax
addl $0x10, %eax
movswl %cx, %edi
movswl %ax, %esi
callq 0x484f50
movw %ax, %cx
movq -0x48(%rbp), %rax
movw %cx, 0x14(%rax)
movq -0x48(%rbp), %rax
movw 0x16(%rax), %ax
movw %ax, -0x106(%rbp)
movswl -0x22(%rbp), %edx
addl -0x10c(%rbp), %edx
movq -0x48(%rbp), %rax
movswl 0x14(%rax), %ecx
addl %edx, %ecx
movw %cx, 0x14(%rax)
movswl -0x22(%rbp), %edx
addl -0x10c(%rbp), %edx
movq -0x48(%rbp), %rax
movswl 0x16(%rax), %ecx
addl %edx, %ecx
movw %cx, 0x16(%rax)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x48(%rbp), %rsi
movswl -0xea(%rbp), %edx
callq 0x490a70
movq -0x10(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x48fd10
movl %eax, -0xe8(%rbp)
movq -0x48(%rbp), %rax
movl 0x28(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x49166f
movw -0xe2(%rbp), %cx
movq -0x48(%rbp), %rax
movw %cx, 0x16(%rax)
jmp 0x49167e
movw -0x106(%rbp), %cx
movq -0x48(%rbp), %rax
movw %cx, 0x16(%rax)
movq -0x48(%rbp), %rax
movl 0x28(%rax), %eax
andl $0x10, %eax
cmpl $0x0, %eax
jne 0x4916bf
movq -0x48(%rbp), %rax
movzwl 0x18(%rax), %eax
movq -0x20(%rbp), %rcx
movzwl 0x60(%rcx), %ecx
cmpl %ecx, %eax
jge 0x4916bf
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movswl -0x22(%rbp), %eax
addl -0x10c(%rbp), %eax
movswl %ax, %ecx
callq 0x490ce0
movw -0xe2(%rbp), %cx
movq -0x48(%rbp), %rax
movw %cx, 0x16(%rax)
leaq -0xc8(%rbp), %rdi
callq 0x48d7a0
movq %rax, -0x50(%rbp)
jmp 0x490e73
movq -0xd0(%rbp), %rcx
movq -0x48(%rbp), %rax
movq %rcx, (%rax)
movw -0xd4(%rbp), %cx
movq -0x48(%rbp), %rax
movw %cx, 0x18(%rax)
movw -0xd6(%rbp), %cx
movq -0x48(%rbp), %rax
movw %cx, 0x1a(%rax)
movw -0xd8(%rbp), %cx
movq -0x48(%rbp), %rax
movw %cx, 0x1c(%rax)
movw -0xda(%rbp), %cx
movq -0x48(%rbp), %rax
movw %cx, 0x2e(%rax)
movl -0xe0(%rbp), %ecx
movq -0x48(%rbp), %rax
movl %ecx, 0x28(%rax)
movw -0xe2(%rbp), %cx
movq -0x48(%rbp), %rax
movw %cx, 0x16(%rax)
movw -0xd2(%rbp), %cx
movq -0x48(%rbp), %rax
movw %cx, 0x2c(%rax)
movzwl -0xd4(%rbp), %eax
movzwl -0xda(%rbp), %ecx
cmpl %ecx, %eax
jne 0x49190f
movzwl -0xd4(%rbp), %eax
addl $0x1, %eax
movq -0x20(%rbp), %rcx
movzwl 0x5e(%rcx), %ecx
cmpl %ecx, %eax
jge 0x49190f
movq -0x20(%rbp), %rax
movw 0x63(%rax), %ax
shrw $0x6, %ax
andw $0x1, %ax
movzwl %ax, %eax
cmpl $0x0, %eax
jne 0x49190f
movq -0x40(%rbp), %rax
movzwl 0x5c(%rax), %eax
andl $0x4000, %eax           # imm = 0x4000
cmpl $0x0, %eax
jne 0x49190f
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movzwl -0xd4(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movswl (%rax,%rcx,2), %eax
cmpl $0x2a, %eax
jl 0x49190f
movq -0x40(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq -0x48(%rbp), %rax
movzwl 0x2c(%rax), %edx
addl $0x1, %edx
callq 0x48f570
movl %eax, -0xe8(%rbp)
cmpl $0x0, %eax
jne 0x49190f
movq -0x48(%rbp), %rax
movw 0x18(%rax), %cx
addw $0x1, %cx
movw %cx, 0x18(%rax)
movq -0x48(%rbp), %rax
movw 0x2e(%rax), %cx
addw $0x1, %cx
movw %cx, 0x2e(%rax)
movq -0x48(%rbp), %rax
movq 0x38(%rax), %rax
movq -0x48(%rbp), %rdx
movw 0x2c(%rdx), %cx
movw %cx, %si
addw $0x1, %si
movw %si, 0x2c(%rdx)
movzwl %cx, %ecx
movq $0x0, (%rax,%rcx,8)
movq -0x48(%rbp), %rax
movl 0x28(%rax), %ecx
orl $0x8000, %ecx           # imm = 0x8000
movl %ecx, 0x28(%rax)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movzwl -0xd4(%rbp), %ecx
movswl (%rax,%rcx,2), %eax
movq -0x20(%rbp), %rcx
movq 0x10(%rcx), %rcx
movzwl -0xd4(%rbp), %edx
addl $0x1, %edx
movslq %edx, %rdx
movswl (%rcx,%rdx,2), %ecx
subl %ecx, %eax
movw %ax, -0x12e(%rbp)
movswl -0x12e(%rbp), %edx
movq -0x48(%rbp), %rax
movswl 0x16(%rax), %ecx
subl %edx, %ecx
movw %cx, 0x16(%rax)
movswl -0x12e(%rbp), %eax
addl $0x5, %eax
movw %ax, -0x12e(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movswl -0x12e(%rbp), %eax
movswl -0x22(%rbp), %ecx
addl %ecx, %eax
movswl %ax, %ecx
callq 0x490ce0
movw -0xe2(%rbp), %cx
movq -0x48(%rbp), %rax
movw %cx, 0x16(%rax)
movw -0xd4(%rbp), %cx
movq -0x48(%rbp), %rax
movw %cx, 0x18(%rax)
movw -0xda(%rbp), %cx
movq -0x48(%rbp), %rax
movw %cx, 0x2e(%rax)
movl -0xe0(%rbp), %ecx
movq -0x48(%rbp), %rax
movl %ecx, 0x28(%rax)
movl -0xe8(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
nopw %cs:(%rax,%rax)