// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: lookupName
static int lookupName(
  Parse *pParse,       /* The parsing context */
  const char *zDb,     /* Name of the database containing table, or NULL */
  const char *zTab,    /* Name of table containing column, or NULL */
  const char *zCol,    /* Name of the column. */
  NameContext *pNC,    /* The name context used to resolve the name */
  Expr *pExpr          /* Make this EXPR node point to the selected column */
){
  int i, j;                         /* Loop counters */
  int cnt = 0;                      /* Number of matching column names */
  int cntTab = 0;                   /* Number of matching table names */
  int nSubquery = 0;                /* How many levels of subquery */
  sqlite3 *db = pParse->db;         /* The database connection */
  struct SrcList_item *pItem;       /* Use for looping over pSrcList items */
  struct SrcList_item *pMatch = 0;  /* The matching pSrcList item */
  NameContext *pTopNC = pNC;        /* First namecontext in the list */
  Schema *pSchema = 0;              /* Schema of the expression */
  int isTrigger = 0;

  assert( pNC );     /* the name context cannot be NULL. */
  assert( zCol );    /* The Z in X.Y.Z cannot be NULL */
  assert( !ExprHasAnyProperty(pExpr, EP_TokenOnly|EP_Reduced) );

  /* Initialize the node to no-match */
  pExpr->iTable = -1;
  pExpr->pTab = 0;
  ExprSetIrreducible(pExpr);

  /* Translate the schema name in zDb into a pointer to the corresponding
  ** schema.  If not found, pSchema will remain NULL and nothing will match
  ** resulting in an appropriate error message toward the end of this routine
  */
  if( zDb ){
    testcase( pNC->ncFlags & NC_PartIdx );
    testcase( pNC->ncFlags & NC_IsCheck );
    if( (pNC->ncFlags & (NC_PartIdx|NC_IsCheck))!=0 ){
      /* Silently ignore database qualifiers inside CHECK constraints and partial
      ** indices.  Do not raise errors because that might break legacy and
      ** because it does not hurt anything to just ignore the database name. */
      zDb = 0;
    }else{
      for(i=0; i<db->nDb; i++){
        assert( db->aDb[i].zName );
        if( sqlite3StrICmp(db->aDb[i].zName,zDb)==0 ){
          pSchema = db->aDb[i].pSchema;
          break;
        }
      }
    }
  }

  /* Start at the inner-most context and move outward until a match is found */
  while( pNC && cnt==0 ){
    ExprList *pEList;
    SrcList *pSrcList = pNC->pSrcList;

    if( pSrcList ){
      for(i=0, pItem=pSrcList->a; i<pSrcList->nSrc; i++, pItem++){
        Table *pTab;
        Column *pCol;
  
        pTab = pItem->pTab;
        assert( pTab!=0 && pTab->zName!=0 );
        assert( pTab->nCol>0 );
        if( pItem->pSelect && (pItem->pSelect->selFlags & SF_NestedFrom)!=0 ){
          int hit = 0;
          pEList = pItem->pSelect->pEList;
          for(j=0; j<pEList->nExpr; j++){
            if( sqlite3MatchSpanName(pEList->a[j].zSpan, zCol, zTab, zDb) ){
              cnt++;
              cntTab = 2;
              pMatch = pItem;
              pExpr->iColumn = j;
              hit = 1;
            }
          }
          if( hit || zTab==0 ) continue;
        }
        if( zDb && pTab->pSchema!=pSchema ){
          continue;
        }
        if( zTab ){
          const char *zTabName = pItem->zAlias ? pItem->zAlias : pTab->zName;
          assert( zTabName!=0 );
          if( sqlite3StrICmp(zTabName, zTab)!=0 ){
            continue;
          }
        }
        if( 0==(cntTab++) ){
          pMatch = pItem;
        }
        for(j=0, pCol=pTab->aCol; j<pTab->nCol; j++, pCol++){
          if( sqlite3StrICmp(pCol->zName, zCol)==0 ){
            /* If there has been exactly one prior match and this match
            ** is for the right-hand table of a NATURAL JOIN or is in a 
            ** USING clause, then skip this match.
            */
            if( cnt==1 ){
              if( pItem->jointype & JT_NATURAL ) continue;
              if( nameInUsingClause(pItem->pUsing, zCol) ) continue;
            }
            cnt++;
            pMatch = pItem;
            /* Substitute the rowid (column -1) for the INTEGER PRIMARY KEY */
            pExpr->iColumn = j==pTab->iPKey ? -1 : (i16)j;
            break;
          }
        }
      }
      if( pMatch ){
        pExpr->iTable = pMatch->iCursor;
        pExpr->pTab = pMatch->pTab;
        pSchema = pExpr->pTab->pSchema;
      }
    } /* if( pSrcList ) */

#ifndef SQLITE_OMIT_TRIGGER
    /* If we have not already resolved the name, then maybe 
    ** it is a new.* or old.* trigger argument reference
    */
    if( zDb==0 && zTab!=0 && cnt==0 && pParse->pTriggerTab!=0 ){
      int op = pParse->eTriggerOp;
      Table *pTab = 0;
      assert( op==TK_DELETE || op==TK_UPDATE || op==TK_INSERT );
      if( op!=TK_DELETE && sqlite3StrICmp("new",zTab) == 0 ){
        pExpr->iTable = 1;
        pTab = pParse->pTriggerTab;
      }else if( op!=TK_INSERT && sqlite3StrICmp("old",zTab)==0 ){
        pExpr->iTable = 0;
        pTab = pParse->pTriggerTab;
      }

      if( pTab ){ 
        int iCol;
        pSchema = pTab->pSchema;
        cntTab++;
        for(iCol=0; iCol<pTab->nCol; iCol++){
          Column *pCol = &pTab->aCol[iCol];
          if( sqlite3StrICmp(pCol->zName, zCol)==0 ){
            if( iCol==pTab->iPKey ){
              iCol = -1;
            }
            break;
          }
        }
        if( iCol>=pTab->nCol && sqlite3IsRowid(zCol) ){
          iCol = -1;        /* IMP: R-44911-55124 */
        }
        if( iCol<pTab->nCol ){
          cnt++;
          if( iCol<0 ){
            pExpr->affinity = SQLITE_AFF_INTEGER;
          }else if( pExpr->iTable==0 ){
            testcase( iCol==31 );
            testcase( iCol==32 );
            pParse->oldmask |= (iCol>=32 ? 0xffffffff : (((u32)1)<<iCol));
          }else{
            testcase( iCol==31 );
            testcase( iCol==32 );
            pParse->newmask |= (iCol>=32 ? 0xffffffff : (((u32)1)<<iCol));
          }
          pExpr->iColumn = (i16)iCol;
          pExpr->pTab = pTab;
          isTrigger = 1;
        }
      }
    }
#endif /* !defined(SQLITE_OMIT_TRIGGER) */

    /*
    ** Perhaps the name is a reference to the ROWID
    */
    if( cnt==0 && cntTab==1 && sqlite3IsRowid(zCol) ){
      cnt = 1;
      pExpr->iColumn = -1;     /* IMP: R-44911-55124 */
      pExpr->affinity = SQLITE_AFF_INTEGER;
    }

    /*
    ** If the input is of the form Z (not Y.Z or X.Y.Z) then the name Z
    ** might refer to an result-set alias.  This happens, for example, when
    ** we are resolving names in the WHERE clause of the following command:
    **
    **     SELECT a+b AS x FROM table WHERE x<10;
    **
    ** In cases like this, replace pExpr with a copy of the expression that
    ** forms the result set entry ("a+b" in the example) and return immediately.
    ** Note that the expression in the result set should have already been
    ** resolved by the time the WHERE clause is resolved.
    **
    ** The ability to use an output result-set column in the WHERE, GROUP BY,
    ** or HAVING clauses, or as part of a larger expression in the ORDRE BY
    ** clause is not standard SQL.  This is a (goofy) SQLite extension, that
    ** is supported for backwards compatibility only.  TO DO: Issue a warning
    ** on sqlite3_log() whenever the capability is used.
    */
    if( (pEList = pNC->pEList)!=0
     && zTab==0
     && cnt==0
    ){
      for(j=0; j<pEList->nExpr; j++){
        char *zAs = pEList->a[j].zName;
        if( zAs!=0 && sqlite3StrICmp(zAs, zCol)==0 ){
          Expr *pOrig;
          assert( pExpr->pLeft==0 && pExpr->pRight==0 );
          assert( pExpr->x.pList==0 );
          assert( pExpr->x.pSelect==0 );
          pOrig = pEList->a[j].pExpr;
          if( (pNC->ncFlags&NC_AllowAgg)==0 && ExprHasProperty(pOrig, EP_Agg) ){
            sqlite3ErrorMsg(pParse, "misuse of aliased aggregate %s", zAs);
            return WRC_Abort;
          }
          resolveAlias(pParse, pEList, j, pExpr, "", nSubquery);
          cnt = 1;
          pMatch = 0;
          assert( zTab==0 && zDb==0 );
          goto lookupname_end;
        }
      } 
    }

    /* Advance to the next name context.  The loop will exit when either
    ** we have a match (cnt>0) or when we run out of name contexts.
    */
    if( cnt==0 ){
      pNC = pNC->pNext;
      nSubquery++;
    }
  }

  /*
  ** If X and Y are NULL (in other words if only the column name Z is
  ** supplied) and the value of Z is enclosed in double-quotes, then
  ** Z is a string literal if it doesn't match any column names.  In that
  ** case, we need to return right away and not make any changes to
  ** pExpr.
  **
  ** Because no reference was made to outer contexts, the pNC->nRef
  ** fields are not changed in any context.
  */
  if( cnt==0 && zTab==0 && ExprHasProperty(pExpr,EP_DblQuoted) ){
    pExpr->op = TK_STRING;
    pExpr->pTab = 0;
    return WRC_Prune;
  }

  /*
  ** cnt==0 means there was not match.  cnt>1 means there were two or
  ** more matches.  Either way, we have an error.
  */
  if( cnt!=1 ){
    const char *zErr;
    zErr = cnt==0 ? "no such column" : "ambiguous column name";
    if( zDb ){
      sqlite3ErrorMsg(pParse, "%s: %s.%s.%s", zErr, zDb, zTab, zCol);
    }else if( zTab ){
      sqlite3ErrorMsg(pParse, "%s: %s.%s", zErr, zTab, zCol);
    }else{
      sqlite3ErrorMsg(pParse, "%s: %s", zErr, zCol);
    }
    pParse->checkSchema = 1;
    pTopNC->nErr++;
  }

  /* If a column from a table in pSrcList is referenced, then record
  ** this fact in the pSrcList.a[].colUsed bitmask.  Column 0 causes
  ** bit 0 to be set.  Column 1 sets bit 1.  And so forth.  If the
  ** column number is greater than the number of bits in the bitmask
  ** then set the high-order bit of the bitmask.
  */
  if( pExpr->iColumn>=0 && pMatch!=0 ){
    int n = pExpr->iColumn;
    testcase( n==BMS-1 );
    if( n>=BMS ){
      n = BMS-1;
    }
    assert( pMatch->iCursor==pExpr->iTable );
    pMatch->colUsed |= ((Bitmask)1)<<n;
  }

  /* Clean up and return
  */
  sqlite3ExprDelete(db, pExpr->pLeft);
  pExpr->pLeft = 0;
  sqlite3ExprDelete(db, pExpr->pRight);
  pExpr->pRight = 0;
  pExpr->op = (isTrigger ? TK_TRIGGER : TK_COLUMN);
lookupname_end:
  if( cnt==1 ){
    assert( pNC!=0 );
    if( pExpr->op!=TK_AS ){
      sqlite3AuthRead(pParse, pExpr, pSchema, pNC->pSrcList);
    }
    /* Increment the nRef value on all name contexts from TopNC up to
    ** the point where the name matched. */
    for(;;){
      assert( pTopNC!=0 );
      pTopNC->nRef++;
      if( pTopNC==pNC ) break;
      pTopNC = pTopNC->pNext;
    }
    return WRC_Prune;
  } else {
    return WRC_Abort;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %r9, %r13
movq %r8, %r14
movq %rcx, -0x40(%rbp)
movq %rdx, -0x30(%rbp)
movq %rsi, %rcx
movq %rdi, -0x50(%rbp)
movq (%rdi), %r15
movl $0xffffffff, 0x2c(%r9)  # imm = 0xFFFFFFFF
movq $0x0, 0x40(%r9)
testq %rsi, %rsi
movq %r8, -0x88(%rbp)
movq %r9, -0x80(%rbp)
movq %r15, -0xb8(%rbp)
je 0x474a9
testb $0x14, 0x30(%r14)
je 0x474b6
xorl %ecx, %ecx
movq $0x0, -0x60(%rbp)
jmp 0x4754c
movq $0x0, -0x60(%rbp)
jmp 0x47543
movslq 0x28(%r15), %rax
testq %rax, %rax
jle 0x4749c
movq 0x20(%r15), %r12
movq $0x0, -0x60(%rbp)
leaq 0x2ebde(%rip), %rdx     # 0x760b0
xorl %esi, %esi
movq %rcx, %r13
movq %rsi, %rdi
shlq $0x5, %rdi
movq (%r12,%rdi), %r9
movb (%r9), %r10b
testb %r10b, %r10b
je 0x47512
incq %r9
movq %rcx, %r8
movzbl %r10b, %r10d
movb (%r10,%rdx), %r11b
movzbl (%r8), %ebx
cmpb (%rbx,%rdx), %r11b
jne 0x47518
incq %r8
movb (%r9), %r10b
incq %r9
testb %r10b, %r10b
jne 0x474f0
jmp 0x47515
movq %rcx, %r8
xorl %r10d, %r10d
movb (%r10,%rdx), %r9b
movzbl (%r8), %r8d
cmpb (%r8,%rdx), %r9b
je 0x47533
incq %rsi
cmpq %rax, %rsi
movq %r13, %rcx
jne 0x474d7
jmp 0x4753f
movq 0x18(%r12,%rdi), %rax
movq %rax, -0x60(%rbp)
movq %r13, %rcx
movq -0x80(%rbp), %r13
testq %r14, %r14
je 0x47bce
cmpq $0x0, -0x30(%rbp)
setne %al
testq %rcx, %rcx
sete %dl
andb %al, %dl
movb %dl, -0x31(%rbp)
xorl %edi, %edi
leaq 0x2eb48(%rip), %r14     # 0x760b0
movq -0x88(%rbp), %rax
xorl %edx, %edx
movq $0x0, -0x48(%rbp)
movq -0x40(%rbp), %r15
movq %rcx, -0x90(%rbp)
movl %edx, -0x94(%rbp)
movq 0x8(%rax), %r9
testq %r9, %r9
movq %rax, -0x70(%rbp)
je 0x4789d
movzbl (%r9), %eax
movl %eax, -0xa4(%rbp)
testl %eax, %eax
je 0x478a1
addq $0x8, %r9
xorl %r10d, %r10d
movl $0x0, -0x68(%rbp)
movl %edi, %r12d
movq 0x20(%r9), %rsi
movq 0x28(%r9), %rax
testq %rax, %rax
je 0x47696
testb $0x2, 0xb(%rax)
je 0x47696
movq (%rax), %rax
movslq (%rax), %rbx
testq %rbx, %rbx
jle 0x4767f
movq %r12, -0xb0(%rbp)
movq %rsi, -0xa0(%rbp)
movl %r10d, -0x54(%rbp)
movq %r9, -0x78(%rbp)
movq 0x8(%rax), %r15
addq $0x10, %r15
xorl %r12d, %r12d
xorl %r13d, %r13d
movq (%r15), %rdi
movq -0x40(%rbp), %rsi
movq -0x30(%rbp), %rdx
callq 0x4804c
testl %eax, %eax
je 0x47646
incl -0x68(%rbp)
movq -0x80(%rbp), %rax
movw %r12w, 0x30(%rax)
movl $0x2, %eax
movq %rax, -0xb0(%rbp)
movl $0x1, %r13d
movq -0x78(%rbp), %rax
movq %rax, -0x48(%rbp)
incq %r12
addq $0x20, %r15
cmpq %r12, %rbx
movq -0x90(%rbp), %rcx
jne 0x4760c
testl %r13d, %r13d
sete %al
movq -0x80(%rbp), %r13
movq -0x40(%rbp), %r15
movq -0x78(%rbp), %r9
movl -0x54(%rbp), %r10d
movq -0xa0(%rbp), %rsi
movq -0xb0(%rbp), %r12
jmp 0x47681
movb $0x1, %al
cmpq $0x0, -0x30(%rbp)
sete %dl
xorb $0x1, %al
orb %dl, %al
movl %r12d, %edi
jne 0x47884
testq %rcx, %rcx
je 0x476a9
movq -0x60(%rbp), %rax
cmpq %rax, 0x68(%rsi)
jne 0x4783d
cmpq $0x0, -0x30(%rbp)
je 0x47708
movq 0x18(%r9), %rax
testq %rax, %rax
jne 0x476bc
movq (%rsi), %rax
movb (%rax), %dl
testb %dl, %dl
je 0x476f0
movq %rsi, %r11
incq %rax
movq -0x30(%rbp), %r8
movzbl %dl, %edx
movb (%rdx,%r14), %sil
movzbl (%r8), %edi
cmpb (%rdi,%r14), %sil
jne 0x476eb
incq %r8
movb (%rax), %dl
incq %rax
testb %dl, %dl
jne 0x476cc
xorl %edx, %edx
movq %r11, %rsi
jmp 0x476f6
movq -0x30(%rbp), %r8
xorl %edx, %edx
movb (%rdx,%r14), %al
movzbl (%r8), %edx
cmpb (%rdx,%r14), %al
jne 0x4783d
movl %r10d, -0x54(%rbp)
leal 0x1(%r12), %edi
testl %r12d, %r12d
movq -0x48(%rbp), %rax
movq %r9, %r12
cmoveq %r9, %rax
movq %rax, -0x48(%rbp)
movswl 0x42(%rsi), %r13d
testl %r13d, %r13d
jle 0x47879
movq %rdi, -0x78(%rbp)
movq %rsi, -0xa0(%rbp)
movq 0x8(%rsi), %rdx
xorl %eax, %eax
movl -0x68(%rbp), %ecx
movq (%rdx), %rdi
movb (%rdi), %r8b
testb %r8b, %r8b
je 0x47778
incq %rdi
movq %r15, %rsi
movzbl %r8b, %r8d
movb (%r8,%r14), %r9b
movzbl (%rsi), %r10d
cmpb (%r10,%r14), %r9b
jne 0x4777e
incq %rsi
movb (%rdi), %r8b
incq %rdi
testb %r8b, %r8b
jne 0x47756
jmp 0x4777b
movq %r15, %rsi
xorl %r8d, %r8d
movb (%r8,%r14), %dil
movzbl (%rsi), %esi
cmpb (%rsi,%r14), %dil
jne 0x4781d
cmpl $0x1, %ecx
jne 0x47842
testb $0x4, 0x38(%r12)
jne 0x4781d
movq 0x48(%r12), %rdi
testq %rdi, %rdi
je 0x47842
movslq 0x8(%rdi), %rsi
testq %rsi, %rsi
jle 0x47842
movq (%rdi), %rdi
xorl %r8d, %r8d
movq %r8, %r9
shlq $0x4, %r9
movq (%rdi,%r9), %r9
movb (%r9), %r11b
testb %r11b, %r11b
je 0x4780d
xorl %r10d, %r10d
movzbl %r11b, %r11d
movb (%r11,%r14), %r11b
movzbl (%r15,%r10), %ebx
movb (%rbx,%r14), %bl
cmpb %bl, %r11b
jne 0x47806
movb 0x1(%r9,%r10), %r11b
incq %r10
testb %r11b, %r11b
jne 0x477d7
movzbl (%r15,%r10), %r9d
movb (%r9,%r14), %bl
xorl %r11d, %r11d
cmpb %bl, %r11b
jne 0x47813
jmp 0x4781d
cmpb $0x0, (%r15)
je 0x4781d
incq %r8
cmpq %rsi, %r8
jne 0x477c1
jmp 0x47842
incl %eax
addq $0x30, %rdx
cmpl %r13d, %eax
jne 0x47745
movq -0x90(%rbp), %rcx
movq -0x80(%rbp), %r13
movq -0x78(%rbp), %rdi
jmp 0x4787d
movl %r12d, %edi
jmp 0x47884
incl %ecx
movl %ecx, -0x68(%rbp)
movq -0xa0(%rbp), %rcx
movswl 0x40(%rcx), %ecx
cmpl %ecx, %eax
movl $0xffff, %ecx           # imm = 0xFFFF
cmovel %ecx, %eax
movq -0x80(%rbp), %r13
movw %ax, 0x30(%r13)
movq %r12, %r9
movq %r12, -0x48(%rbp)
movq -0x90(%rbp), %rcx
movq -0x78(%rbp), %rdi
jmp 0x47880
movq -0x80(%rbp), %r13
movq %r12, %r9
movl -0x54(%rbp), %r10d
incl %r10d
addq $0x68, %r9
movl %edi, %r12d
cmpl -0xa4(%rbp), %r10d
jne 0x475be
jmp 0x478a8
xorl %ecx, %ecx
jmp 0x478d5
movl $0x0, -0x68(%rbp)
movq -0x48(%rbp), %rcx
testq %rcx, %rcx
je 0x478ca
movl 0x3c(%rcx), %eax
movl %eax, 0x2c(%r13)
movq 0x20(%rcx), %rax
movq %rax, 0x40(%r13)
movq 0x68(%rax), %rax
movq %rax, -0x60(%rbp)
jmp 0x478d2
movq $0x0, -0x48(%rbp)
movl -0x68(%rbp), %ecx
testl %ecx, %ecx
sete %al
andb -0x31(%rbp), %al
cmpb $0x1, %al
jne 0x47a7a
movq -0x50(%rbp), %rax
movq 0x1e0(%rax), %r11
testq %r11, %r11
je 0x47a74
movb 0x1f4(%rax), %al
cmpb $0x6a, %al
jne 0x47950
movb $0x6f, %cl
xorl %eax, %eax
movzbl %cl, %ecx
movb (%rcx,%r14), %cl
movq -0x30(%rbp), %rdx
movzbl (%rdx,%rax), %edx
movb (%rdx,%r14), %dl
cmpb %dl, %cl
jne 0x47940
leaq 0x33681(%rip), %rcx     # 0x7afa6
movb 0x1(%rax,%rcx), %cl
incq %rax
cmpq $0x3, %rax
jne 0x47907
movq -0x30(%rbp), %rax
movzbl 0x3(%rax), %eax
movb (%rax,%r14), %dl
xorl %ecx, %ecx
movb $0x1, %al
cmpb %dl, %cl
movl $0x0, %ecx
je 0x479a0
jmp 0x47a76
movb $0x6e, %dl
xorl %ecx, %ecx
movzbl %dl, %edx
movb (%rdx,%r14), %dl
movq -0x30(%rbp), %rsi
movzbl (%rsi,%rcx), %esi
movb (%rsi,%r14), %sil
cmpb %sil, %dl
jne 0x4798e
leaq 0x3362f(%rip), %rdx     # 0x7afa2
movb 0x1(%rcx,%rdx), %dl
incq %rcx
cmpq $0x3, %rcx
jne 0x47954
movq -0x30(%rbp), %rcx
movzbl 0x3(%rcx), %ecx
movb (%rcx,%r14), %sil
xorl %edx, %edx
xorl %ecx, %ecx
cmpb %sil, %dl
jne 0x47a29
movl $0x1, %ecx
xorl %eax, %eax
movl %eax, -0x78(%rbp)
movl %ecx, 0x2c(%r13)
movq 0x68(%r11), %rax
movq %rax, -0x60(%rbp)
movswl 0x42(%r11), %r12d
testl %r12d, %r12d
movq %r11, -0x68(%rbp)
jle 0x47a33
movq %rdi, %r10
movq 0x8(%r11), %rax
movl %r12d, %ecx
xorl %ebx, %ebx
leaq (%rbx,%rbx,2), %rdx
shlq $0x4, %rdx
movq (%rax,%rdx), %rsi
movb (%rsi), %dil
testb %dil, %dil
je 0x47a06
incq %rsi
movq -0x40(%rbp), %rdx
movzbl %dil, %edi
movb (%rdi,%r14), %r8b
movzbl (%rdx), %r9d
cmpb (%r9,%r14), %r8b
jne 0x47a0c
incq %rdx
movb (%rsi), %dil
incq %rsi
testb %dil, %dil
jne 0x479e4
jmp 0x47a0a
movq -0x40(%rbp), %rdx
xorl %edi, %edi
movb (%rdi,%r14), %sil
movzbl (%rdx), %edx
cmpb (%rdx,%r14), %sil
je 0x47a37
incq %rbx
cmpq %rcx, %rbx
jne 0x479c9
movl %r12d, %ebx
movq %r10, %rdi
jmp 0x47a4f
cmpb $0x69, %al
jne 0x47903
jmp 0x47a76
xorl %ebx, %ebx
jmp 0x47a4a
movswq 0x40(%r11), %rax
cmpq %rax, %rbx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmovel %eax, %ebx
movq %r10, %rdi
cmpl %r12d, %ebx
jl 0x47a69
movq %rdi, %r15
movq -0x40(%rbp), %rdi
callq 0x481b8
movq %r15, %rdi
negl %eax
movl $0x0, %eax
sbbl %eax, %eax
orl %eax, %ebx
cmpl %r12d, %ebx
jl 0x47e5f
incl %edi
xorl %ecx, %ecx
movq -0x40(%rbp), %r15
testl %ecx, %ecx
jne 0x47a9c
cmpl $0x1, %edi
jne 0x47a9c
movq %r15, %rdi
movl %ecx, %ebx
callq 0x481b8
movl %ebx, %ecx
movl $0x1, %edi
testl %eax, %eax
jne 0x47c26
movq %rdi, %r12
testl %ecx, %ecx
jne 0x47b34
cmpq $0x0, -0x30(%rbp)
jne 0x47b34
movq -0x70(%rbp), %rax
movq 0x10(%rax), %rsi
testq %rsi, %rsi
je 0x47b34
movslq (%rsi), %rdi
testq %rdi, %rdi
jle 0x47b3c
movq 0x8(%rsi), %rcx
xorl %edx, %edx
movq %rdx, %r8
shlq $0x5, %r8
movq 0x8(%rcx,%r8), %rax
testq %rax, %rax
je 0x47b2a
movb (%rax), %r11b
testb %r11b, %r11b
je 0x47b16
leaq 0x1(%rax), %r10
movq %r15, %r9
movzbl %r11b, %r11d
movb (%r11,%r14), %bl
movzbl (%r9), %r15d
cmpb (%r15,%r14), %bl
jne 0x47b10
incq %r9
movb (%r10), %r11b
incq %r10
testb %r11b, %r11b
jne 0x47aed
xorl %r11d, %r11d
movq -0x40(%rbp), %r15
jmp 0x47b1c
movq %r15, %r9
xorl %r11d, %r11d
movb (%r11,%r14), %r10b
movzbl (%r9), %r9d
cmpb (%r9,%r14), %r10b
je 0x47b86
incq %rdx
cmpq %rdi, %rdx
jne 0x47acd
jmp 0x47b3c
testl %ecx, %ecx
jne 0x47c34
movq -0x70(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x94(%rbp), %edx
incl %edx
testq %rax, %rax
movq -0x90(%rbp), %rcx
movq %r12, %rdi
jne 0x47584
movq %rax, -0x70(%rbp)
cmpq $0x0, -0x30(%rbp)
sete %al
je 0x47c4b
xorl %eax, %eax
leaq 0x3344f(%rip), %rdx     # 0x7afc9
movq -0x88(%rbp), %r14
jmp 0x47c8e
movq -0x70(%rbp), %r15
testb $0x1, 0x30(%r15)
jne 0x47b9b
movq (%rcx,%r8), %rcx
testb $0x2, 0x2(%rcx)
jne 0x47bf7
leaq 0x3680e(%rip), %r8      # 0x7e3b0
movq -0x50(%rbp), %rdi
movq %r13, %rcx
movl -0x94(%rbp), %r9d
callq 0x482bc
movb (%r13), %bl
cmpb $0x18, %bl
movq -0x88(%rbp), %r14
jne 0x47d6a
jmp 0x47e32
movq $0x0, -0x48(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x47c16
leaq 0x333e5(%rip), %rdx     # 0x7afc9
movq $0x0, -0x70(%rbp)
xorl %eax, %eax
movq -0x40(%rbp), %r15
jmp 0x47c8e
leaq 0x333ac(%rip), %rsi     # 0x7afaa
movq -0x50(%rbp), %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x11842
movl $0x2, %eax
jmp 0x47e4d
movb $0x1, %al
movq $0x0, -0x70(%rbp)
movq -0x40(%rbp), %r15
jmp 0x47c52
movw $0xffff, 0x30(%r13)     # imm = 0xFFFF
movb $0x64, 0x1(%r13)
jmp 0x47c41
cmpq $0x0, -0x30(%rbp)
sete %al
cmpl $0x1, %ecx
jne 0x47c79
movb $-0x68, %bl
movb $0x1, %r12b
jmp 0x47cf8
movq -0x88(%rbp), %r14
testb $0x40, 0x2(%r13)
jne 0x47c62
leaq 0x33369(%rip), %rdx     # 0x7afc9
jmp 0x47c8e
movb $0x5e, (%r13)
movq $0x0, 0x40(%r13)
movl $0x1, %eax
jmp 0x47e4d
leaq 0x33358(%rip), %rdx     # 0x7afd8
movq -0x88(%rbp), %r14
movq -0x90(%rbp), %rcx
testq %rcx, %rcx
je 0x47cb1
leaq 0x33354(%rip), %rsi     # 0x7afee
movq -0x50(%rbp), %rbx
movq %rbx, %rdi
movq -0x30(%rbp), %r8
movq %r15, %r9
xorl %eax, %eax
callq 0x11842
jmp 0x47ceb
testb %al, %al
je 0x47ccf
leaq 0x32d58(%rip), %rsi     # 0x7aa14
movq -0x50(%rbp), %rbx
movq %rbx, %rdi
movq %r15, %rcx
xorl %eax, %eax
callq 0x11842
jmp 0x47ceb
leaq 0x32d34(%rip), %rsi     # 0x7aa0a
movq -0x50(%rbp), %rbx
movq %rbx, %rdi
movq -0x30(%rbp), %rcx
movq %r15, %r8
xorl %eax, %eax
callq 0x11842
movb $0x1, 0x1d(%rbx)
incl 0x2c(%r14)
movb $-0x68, %bl
xorl %r12d, %r12d
movq -0x48(%rbp), %rdx
movzwl 0x30(%r13), %eax
testw %ax, %ax
js 0x47d23
testq %rdx, %rdx
je 0x47d23
cmpw $0x3f, %ax
movl $0x3f, %ecx
cmovbl %eax, %ecx
movl $0x1, %eax
shlq %cl, %rax
orq %rax, 0x50(%rdx)
movq 0x10(%r13), %rsi
movq -0xb8(%rbp), %r14
movq %r14, %rdi
callq 0x3479d
xorl %r15d, %r15d
movq %r15, 0x10(%r13)
movq 0x18(%r13), %rsi
movq %r14, %rdi
callq 0x3479d
movq %r15, 0x18(%r13)
movb %bl, (%r13)
movl $0x2, %eax
testb %r12b, %r12b
movq -0x88(%rbp), %r14
movq -0x70(%rbp), %r15
je 0x47e4d
cmpq $0x0, -0x60(%rbp)
je 0x47e32
movq -0x50(%rbp), %rax
movq (%rax), %rcx
cmpq $0x0, 0x180(%rcx)
je 0x47e32
movq 0x8(%r15), %rax
movl 0x28(%rcx), %edx
testl %edx, %edx
jle 0x47dbc
movq 0x20(%rcx), %rsi
addq $0x18, %rsi
xorl %ecx, %ecx
movq -0x60(%rbp), %rdi
cmpq %rdi, (%rsi)
je 0x47db6
incq %rcx
addq $0x20, %rsi
cmpq %rcx, %rdx
jne 0x47da3
movl %edx, %ecx
testl %ecx, %ecx
jns 0x47dbe
jmp 0x47e32
xorl %ecx, %ecx
cmpb $0x3c, %bl
jne 0x47e14
movq -0x50(%rbp), %rax
addq $0x1e0, %rax            # imm = 0x1E0
movq (%rax), %rax
testq %rax, %rax
je 0x47e32
movswq 0x30(%r13), %rdx
testw %dx, %dx
jns 0x47ded
movswq 0x40(%rax), %rdx
testq %rdx, %rdx
js 0x47ea0
leaq (%rdx,%rdx,2), %rdx
shlq $0x4, %rdx
addq 0x8(%rax), %rdx
movq (%rdx), %rdx
movq (%rax), %rsi
movq -0x50(%rbp), %rdi
callq 0x48cbc
cmpl $0x2, %eax
jne 0x47e32
movb $0x62, (%r13)
jmp 0x47e32
movzbl (%rax), %edx
testq %rdx, %rdx
je 0x47e32
movl 0x2c(%r13), %esi
addq $0x28, %rax
cmpl 0x1c(%rax), %esi
je 0x47dcd
addq $0x68, %rax
decq %rdx
jne 0x47e24
incl 0x28(%r14)
movl $0x1, %eax
cmpq %r14, %r15
je 0x47e4d
movq 0x20(%r14), %r14
incl 0x28(%r14)
cmpq %r15, %r14
jne 0x47e40
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testl %ebx, %ebx
js 0x47e91
movl $0x1, %edx
movl %ebx, %ecx
shll %cl, %edx
cmpl $0x20, %ebx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmovbl %edx, %eax
cmpb $0x0, -0x78(%rbp)
movq -0x48(%rbp), %rdx
movq -0x68(%rbp), %rsi
je 0x47eac
movq -0x50(%rbp), %rcx
orl %eax, 0x1ec(%rcx)
jmp 0x47eb6
movb $0x64, 0x1(%r13)
movq -0x48(%rbp), %rdx
movq -0x68(%rbp), %rsi
jmp 0x47eb6
leaq 0x3315c(%rip), %rdx     # 0x7b003
jmp 0x47dfc
movq -0x50(%rbp), %rcx
orl %eax, 0x1f0(%rcx)
movw %bx, 0x30(%r13)
movq %rsi, 0x40(%r13)
movb $0x3c, %bl
movb $0x1, %r12b
jmp 0x47cfc