// File: /workspace/github_c_makefile_star2_O1/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 %rcx, -0x38(%rbp)
movq %rdx, %r11
movq %rdi, -0x78(%rbp)
movq (%rdi), %r15
movl $0xffffffff, 0x2c(%r9)  # imm = 0xFFFFFFFF
movq $0x0, 0x40(%r9)
movq $0x0, -0xa8(%rbp)
testq %rsi, %rsi
movq %rdx, -0x58(%rbp)
movq %r8, -0x98(%rbp)
movq %r9, -0x40(%rbp)
movq %r15, -0xc0(%rbp)
je 0x471bf
testb $0x14, 0x30(%r8)
je 0x4798f
movq $0x0, -0x60(%rbp)
xorl %r10d, %r10d
testq %r10, %r10
sete %al
testq %r11, %r11
setne %cl
andb %al, %cl
movb %cl, -0x29(%rbp)
leaq 0x3(%r11), %rax
movq %rax, -0xb0(%rbp)
leaq 0x2ee73(%rip), %r15     # 0x76060
movq $0x0, -0x88(%rbp)
movl $0x0, -0x90(%rbp)
xorl %r9d, %r9d
xorl %r13d, %r13d
movq -0x98(%rbp), %rax
movq %rax, -0x80(%rbp)
movq %r10, -0x68(%rbp)
cmpq $0x0, -0x80(%rbp)
movl %r13d, %eax
je 0x4791d
testl %eax, %eax
jne 0x4791d
movq -0x80(%rbp), %rax
movq 0x8(%rax), %rbx
testq %rbx, %rbx
je 0x4753e
movzbl (%rbx), %r8d
testl %r8d, %r8d
je 0x47542
addq $0x8, %rbx
xorl %edx, %edx
movl $0x0, -0x44(%rbp)
movl %r9d, %r12d
movl %r8d, -0x8c(%rbp)
movq 0x20(%rbx), %rsi
movq 0x28(%rbx), %rax
testq %rax, %rax
je 0x47339
testb $0x2, 0xb(%rax)
je 0x47339
movq (%rax), %rax
movslq (%rax), %r13
testq %r13, %r13
jle 0x47324
movq %r12, -0xb8(%rbp)
movq %rsi, -0xa0(%rbp)
movl %edx, -0x6c(%rbp)
movq %rbx, -0x50(%rbp)
movq 0x8(%rax), %r14
addq $0x10, %r14
xorl %ebx, %ebx
xorl %r12d, %r12d
movq (%r14), %rdi
movq -0x38(%rbp), %rsi
movq %r11, %rdx
movq %r10, %rcx
callq 0x47d9e
testl %eax, %eax
je 0x472ec
incl -0x44(%rbp)
movq -0x40(%rbp), %rax
movw %bx, 0x30(%rax)
movl $0x2, %eax
movq %rax, -0xb8(%rbp)
movl $0x1, %r12d
movq -0x50(%rbp), %rax
movq %rax, -0x88(%rbp)
incq %rbx
addq $0x20, %r14
cmpq %rbx, %r13
movq -0x58(%rbp), %r11
movq -0x68(%rbp), %r10
jne 0x472ae
testl %r12d, %r12d
sete %al
movq -0x50(%rbp), %rbx
movl -0x8c(%rbp), %r8d
movl -0x6c(%rbp), %edx
movq -0xa0(%rbp), %rsi
movq -0xb8(%rbp), %r12
jmp 0x47326
movb $0x1, %al
testq %r11, %r11
sete %cl
xorb $0x1, %al
orb %cl, %al
movl %r12d, %r9d
jne 0x4752a
testq %r10, %r10
je 0x4734c
movq -0x60(%rbp), %rax
cmpq %rax, 0x68(%rsi)
jne 0x474e5
testq %r11, %r11
je 0x473aa
movq 0x18(%rbx), %rax
testq %rax, %rax
jne 0x4735d
movq (%rsi), %rax
movq %rsi, %r14
movl %edx, %r9d
movb (%rax), %cl
testb %cl, %cl
je 0x4738d
incq %rax
movq %r11, %rdx
movzbl %cl, %esi
movb (%rsi,%r15), %sil
movzbl (%rdx), %edi
cmpb (%rdi,%r15), %sil
jne 0x47390
incq %rdx
movb (%rax), %cl
incq %rax
testb %cl, %cl
jne 0x4736f
jmp 0x47390
movq %r11, %rdx
movzbl %cl, %eax
movb (%rax,%r15), %al
movzbl (%rdx), %ecx
cmpb (%rcx,%r15), %al
movl %r9d, %edx
movq %r14, %rsi
jne 0x474e5
leal 0x1(%r12), %r9d
testl %r12d, %r12d
movq -0x88(%rbp), %rax
cmoveq %rbx, %rax
movq %rax, -0x88(%rbp)
movswl 0x42(%rsi), %ecx
testl %ecx, %ecx
jle 0x4752a
movl %edx, -0x6c(%rbp)
movl %r9d, -0x50(%rbp)
movq %rsi, -0xa0(%rbp)
movq 0x8(%rsi), %rdx
xorl %eax, %eax
movq (%rdx), %r8
movb (%r8), %sil
testb %sil, %sil
je 0x47418
incq %r8
movq -0x38(%rbp), %rdi
movzbl %sil, %r9d
movb (%r9,%r15), %r9b
movzbl (%rdi), %r10d
cmpb (%r10,%r15), %r9b
jne 0x4741c
incq %rdi
movb (%r8), %sil
incq %r8
testb %sil, %sil
jne 0x473f6
jmp 0x4741c
movq -0x38(%rbp), %rdi
movq %rbx, %r13
movzbl %sil, %esi
movb (%rsi,%r15), %sil
movzbl (%rdi), %edi
cmpb (%rdi,%r15), %sil
jne 0x474d2
cmpl $0x1, -0x44(%rbp)
jne 0x474ea
testb $0x4, 0x38(%r13)
jne 0x474d2
movq 0x48(%r13), %rdi
testq %rdi, %rdi
je 0x474ea
movslq 0x8(%rdi), %rsi
testq %rsi, %rsi
jle 0x474ea
movq (%rdi), %rdi
movb $0x1, %r9b
xorl %r8d, %r8d
movq %r8, %r10
shlq $0x4, %r10
movq (%rdi,%r10), %rbx
movb (%rbx), %r10b
testb %r10b, %r10b
je 0x474a8
incq %rbx
movq -0x38(%rbp), %r11
movzbl %r10b, %r14d
movb (%r14,%r15), %r14b
movzbl (%r11), %r12d
cmpb (%r12,%r15), %r14b
jne 0x474ac
incq %r11
movb (%rbx), %r10b
incq %rbx
testb %r10b, %r10b
jne 0x47486
jmp 0x474ac
movq -0x38(%rbp), %r11
movzbl %r10b, %r10d
movb (%r10,%r15), %r10b
movzbl (%r11), %r11d
cmpb (%r11,%r15), %r10b
je 0x474cc
incq %r8
cmpq %rsi, %r8
setb %r9b
jne 0x4746c
jmp 0x474ea
testb $0x1, %r9b
je 0x474ea
incl %eax
addq $0x30, %rdx
cmpl %ecx, %eax
movq %r13, %rbx
jne 0x473e4
jmp 0x47514
movl %r12d, %r9d
jmp 0x4752a
incl -0x44(%rbp)
movq -0xa0(%rbp), %rcx
movswl 0x40(%rcx), %ecx
cmpl %ecx, %eax
movl $0xffff, %ecx           # imm = 0xFFFF
cmovel %ecx, %eax
movq -0x40(%rbp), %rcx
movw %ax, 0x30(%rcx)
movq %r13, %rbx
movq %r13, -0x88(%rbp)
movq -0x58(%rbp), %r11
movq -0x68(%rbp), %r10
movl -0x50(%rbp), %r9d
movl -0x8c(%rbp), %r8d
movl -0x6c(%rbp), %edx
incl %edx
addq $0x68, %rbx
movl %r9d, %r12d
cmpl %r8d, %edx
jne 0x47262
jmp 0x47549
xorl %eax, %eax
jmp 0x4757f
movl $0x0, -0x44(%rbp)
movq -0x88(%rbp), %rcx
testq %rcx, %rcx
je 0x47571
movl 0x3c(%rcx), %eax
movq -0x40(%rbp), %rdx
movl %eax, 0x2c(%rdx)
movq 0x20(%rcx), %rax
movq %rax, 0x40(%rdx)
movq 0x68(%rax), %rax
movq %rax, -0x60(%rbp)
jmp 0x4757c
movq $0x0, -0x88(%rbp)
movl -0x44(%rbp), %eax
movl %eax, %r13d
testl %eax, %eax
sete %al
andb -0x29(%rbp), %al
cmpb $0x1, %al
jne 0x47782
movq -0x78(%rbp), %rax
movq 0x1e0(%rax), %r14
testq %r14, %r14
je 0x475e3
movb 0x1f4(%rax), %al
cmpb $0x6a, %al
movq -0x40(%rbp), %r8
jne 0x475eb
movb $0x6f, %al
xorl %ecx, %ecx
movzbl %al, %edx
movb (%rdx,%r15), %dl
movzbl (%r11,%rcx), %esi
cmpb (%rsi,%r15), %dl
jne 0x4761e
leaq 0x339d9(%rip), %rax     # 0x7afa6
movb 0x1(%rcx,%rax), %al
incq %rcx
cmpq $0x3, %rcx
jne 0x475b4
movq -0xb0(%rbp), %rcx
jmp 0x47621
xorl %r13d, %r13d
jmp 0x47782
movb $0x6e, %cl
xorl %edx, %edx
movzbl %cl, %esi
movb (%rsi,%r15), %sil
movzbl (%r11,%rdx), %edi
cmpb (%rdi,%r15), %sil
jne 0x47635
leaq 0x3399a(%rip), %rcx     # 0x7afa2
movb 0x1(%rdx,%rcx), %cl
incq %rdx
cmpq $0x3, %rdx
jne 0x475ef
movq -0xb0(%rbp), %rdx
jmp 0x47638
addq %r11, %rcx
movzbl %al, %eax
movb (%rax,%r15), %al
movzbl (%rcx), %edx
xorl %ecx, %ecx
cmpb (%rdx,%r15), %al
je 0x4764d
jmp 0x4765b
addq %r11, %rdx
movzbl %cl, %ecx
movb (%rcx,%r15), %sil
movzbl (%rdx), %edx
movl $0x1, %ecx
cmpb (%rdx,%r15), %sil
jne 0x47653
movl %ecx, 0x2c(%r8)
jmp 0x4765e
cmpb $0x69, %al
jne 0x475b0
xorl %r14d, %r14d
testq %r14, %r14
movl $0x0, %r13d
je 0x47782
movswl 0x42(%r14), %r12d
testl %r12d, %r12d
jle 0x476ea
movq 0x8(%r14), %rax
xorl %ebx, %ebx
movslq %ebx, %rcx
leaq (%rcx,%rcx,2), %rcx
shlq $0x4, %rcx
movq (%rax,%rcx), %rsi
movb (%rsi), %cl
testb %cl, %cl
je 0x476b8
incq %rsi
movq -0x38(%rbp), %rdx
movzbl %cl, %edi
movb (%rdi,%r15), %dil
movzbl (%rdx), %r8d
cmpb (%r8,%r15), %dil
jne 0x476bc
incq %rdx
movb (%rsi), %cl
incq %rsi
testb %cl, %cl
jne 0x47699
jmp 0x476bc
movq -0x38(%rbp), %rdx
movzbl %cl, %ecx
movb (%rcx,%r15), %cl
movzbl (%rdx), %edx
movb (%rdx,%r15), %dl
cmpb %dl, %cl
jne 0x476dd
movswl 0x40(%r14), %esi
cmpl %esi, %ebx
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
cmovel %esi, %ebx
cmpb %dl, %cl
je 0x476ec
incl %ebx
cmpl %r12d, %ebx
jl 0x4767d
jmp 0x476ec
xorl %ebx, %ebx
movq 0x68(%r14), %rax
movq %rax, -0x60(%rbp)
cmpl %r12d, %ebx
jl 0x4771b
movq -0x38(%rbp), %rdi
movl %r9d, %r13d
callq 0x47e93
movl %r13d, %r9d
movq -0x68(%rbp), %r10
movq -0x58(%rbp), %r11
negl %eax
movl $0x0, %eax
sbbl %eax, %eax
orl %eax, %ebx
incl %r9d
xorl %r13d, %r13d
cmpl %r12d, %ebx
jge 0x47782
testl %ebx, %ebx
js 0x47754
movl $0x1, %eax
movl %ebx, %ecx
shll %cl, %eax
cmpl $0x20, %ebx
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmovgel %ecx, %eax
movq -0x40(%rbp), %rdx
cmpl $0x0, 0x2c(%rdx)
je 0x4775e
movq -0x78(%rbp), %rcx
orl %eax, 0x1f0(%rcx)
jmp 0x47768
movq -0x40(%rbp), %rdx
movb $0x64, 0x1(%rdx)
jmp 0x47768
movq -0x78(%rbp), %rcx
orl %eax, 0x1ec(%rcx)
movw %bx, 0x30(%rdx)
movq %r14, 0x40(%rdx)
movl $0x1, %eax
movq %rax, -0xa8(%rbp)
movl $0x1, %r13d
testl %r13d, %r13d
movl %r9d, -0x50(%rbp)
jne 0x477c3
cmpl $0x1, %r9d
jne 0x477c3
movq -0x38(%rbp), %rdi
callq 0x47e93
testl %eax, %eax
je 0x477b4
movq -0x40(%rbp), %rax
movw $0xffff, 0x30(%rax)     # imm = 0xFFFF
movb $0x64, 0x1(%rax)
movl $0x1, %r13d
jmp 0x477b7
xorl %r13d, %r13d
movq -0x58(%rbp), %r11
movq -0x68(%rbp), %r10
movl -0x50(%rbp), %r9d
testl %r13d, %r13d
jne 0x478eb
testq %r11, %r11
jne 0x478eb
movq -0x80(%rbp), %rax
movq 0x10(%rax), %rbx
testq %rbx, %rbx
je 0x478eb
cmpl $0x0, (%rbx)
jle 0x478e8
xorl %r14d, %r14d
xorl %r13d, %r13d
movq 0x8(%rbx), %rax
movq %r14, %rcx
shlq $0x5, %rcx
movq 0x8(%rax,%rcx), %rdx
movb $0x1, %r12b
testq %rdx, %rdx
je 0x4783f
movb (%rdx), %sil
testb %sil, %sil
je 0x47843
leaq 0x1(%rdx), %r8
movq -0x38(%rbp), %rdi
movzbl %sil, %r9d
movb (%r9,%r15), %r9b
movzbl (%rdi), %r10d
cmpb (%r10,%r15), %r9b
jne 0x47847
incq %rdi
movb (%r8), %sil
incq %r8
testb %sil, %sil
jne 0x4781d
jmp 0x47847
xorl %eax, %eax
jmp 0x478b6
movq -0x38(%rbp), %rdi
movzbl %sil, %esi
movb (%rsi,%r15), %sil
movzbl (%rdi), %edi
cmpb (%rdi,%r15), %sil
jne 0x478a8
movq -0x80(%rbp), %rsi
testb $0x1, 0x30(%rsi)
jne 0x4786c
movq (%rax,%rcx), %rax
testb $0x2, 0x2(%rax)
jne 0x478cc
movq -0x78(%rbp), %rdi
movq %rbx, %rsi
movl %r14d, %edx
movq -0x40(%rbp), %rcx
leaq 0x36adf(%rip), %r8      # 0x7e360
movl -0x90(%rbp), %r9d
callq 0x47f91
movl $0x1, %r13d
movl $0x16, %eax
movq $0x0, -0x88(%rbp)
xorl %r12d, %r12d
jmp 0x478aa
xorl %eax, %eax
movq -0x58(%rbp), %r11
movq -0x68(%rbp), %r10
movl -0x50(%rbp), %r9d
testb %r12b, %r12b
je 0x47904
incq %r14
movslq (%rbx), %rax
cmpq %rax, %r14
jl 0x477f5
jmp 0x478eb
xorl %r12d, %r12d
movq -0x78(%rbp), %rdi
leaq 0x336d0(%rip), %rsi     # 0x7afaa
xorl %eax, %eax
callq 0x11724
movl $0x1, %eax
jmp 0x478aa
xorl %r13d, %r13d
xorl %eax, %eax
testl %r13d, %r13d
jne 0x47904
movq -0x80(%rbp), %rcx
movq 0x20(%rcx), %rcx
movq %rcx, -0x80(%rbp)
incl -0x90(%rbp)
testl %eax, %eax
je 0x47217
cmpl $0x16, %eax
jne 0x47985
movq -0x98(%rbp), %r14
jmp 0x47afb
testq %r11, %r11
jne 0x47934
testl %eax, %eax
jne 0x47934
movq -0x40(%rbp), %rcx
testb $0x40, 0x2(%rcx)
jne 0x47a1c
cmpl $0x1, %eax
movq -0x98(%rbp), %r14
movq -0x78(%rbp), %rbx
je 0x47a86
testl %eax, %eax
leaq 0x33678(%rip), %rax     # 0x7afc9
leaq 0x33680(%rip), %rdx     # 0x7afd8
cmoveq %rax, %rdx
testq %r10, %r10
je 0x47a4a
leaq 0x33682(%rip), %rsi     # 0x7afee
movq %rbx, %rdi
movq %r10, %rcx
movq %r11, %r8
movq -0x38(%rbp), %r9
xorl %eax, %eax
callq 0x11724
jmp 0x47a7e
movl $0x2, %eax
jmp 0x47c00
movq %rsi, %r10
movslq 0x28(%r15), %rax
testq %rax, %rax
jle 0x47a0f
movq %r10, %r12
movq 0x20(%r15), %rcx
movq $0x0, -0x60(%rbp)
leaq 0x2e6af(%rip), %rdx     # 0x76060
xorl %esi, %esi
movq %rsi, %rdi
shlq $0x5, %rdi
movq (%rcx,%rdi), %r10
movb (%r10), %r14b
testb %r14b, %r14b
je 0x479ef
incq %r10
movq %r12, %r13
movzbl %r14b, %r11d
movb (%r11,%rdx), %r11b
movzbl (%r13), %ebx
cmpb (%rbx,%rdx), %r11b
jne 0x479f2
incq %r13
movb (%r10), %r14b
incq %r10
testb %r14b, %r14b
jne 0x479cc
jmp 0x479f2
movq %r12, %r13
movzbl %r14b, %r10d
movb (%r10,%rdx), %r10b
movzbl (%r13), %r11d
cmpb (%r11,%rdx), %r10b
je 0x47a35
incq %rsi
cmpq %rax, %rsi
jne 0x479b3
jmp 0x47a3e
movq $0x0, -0x60(%rbp)
jmp 0x471ca
movq -0x40(%rbp), %rax
movb $0x5e, (%rax)
movq $0x0, 0x40(%rax)
movl $0x1, %eax
jmp 0x47c00
movq 0x18(%rcx,%rdi), %rax
movq %rax, -0x60(%rbp)
movq -0x58(%rbp), %r11
movq %r12, %r10
jmp 0x471ca
testq %r11, %r11
je 0x47a69
leaq 0x32fb4(%rip), %rsi     # 0x7aa0a
movq %rbx, %rdi
movq %r11, %rcx
movq -0x38(%rbp), %r8
xorl %eax, %eax
callq 0x11724
jmp 0x47a7e
leaq 0x32fa4(%rip), %rsi     # 0x7aa14
movq %rbx, %rdi
movq -0x38(%rbp), %rcx
xorl %eax, %eax
callq 0x11724
movb $0x1, 0x1d(%rbx)
incl 0x2c(%r14)
movq -0x40(%rbp), %rax
movzwl 0x30(%rax), %eax
testw %ax, %ax
movq -0x88(%rbp), %rdx
js 0x47ab7
testq %rdx, %rdx
je 0x47ab7
cmpw $0x3f, %ax
movl $0x3f, %ecx
cmovbl %eax, %ecx
movl $0x1, %eax
shlq %cl, %rax
orq %rax, 0x50(%rdx)
movq -0x40(%rbp), %r15
movq 0x10(%r15), %rsi
movq -0xc0(%rbp), %r12
movq %r12, %rdi
callq 0x34068
xorl %ebx, %ebx
movq %rbx, 0x10(%r15)
movq 0x18(%r15), %rsi
movq %r12, %rdi
callq 0x34068
movq %rbx, 0x18(%r15)
cmpl $0x0, -0xa8(%rbp)
movl $0x98, %eax
movl $0x3c, %ecx
cmovel %eax, %ecx
movb %cl, (%r15)
movq -0x78(%rbp), %r8
movl $0x2, %eax
cmpl $0x1, %r13d
jne 0x47c00
movq -0x40(%rbp), %rbx
movb (%rbx), %al
cmpb $0x18, %al
je 0x47be1
movq (%r8), %rcx
cmpq $0x0, 0x180(%rcx)
je 0x47be1
cmpq $0x0, -0x60(%rbp)
je 0x47b5e
movl 0x28(%rcx), %edx
testl %edx, %edx
jle 0x47b65
movq 0x20(%rcx), %rsi
addq $0x18, %rsi
xorl %ecx, %ecx
movq -0x60(%rbp), %rdi
cmpq %rdi, (%rsi)
je 0x47b67
incq %rcx
addq $0x20, %rsi
cmpq %rcx, %rdx
jne 0x47b49
movl %edx, %ecx
jmp 0x47b67
movl $0xfff0bdc0, %ecx       # imm = 0xFFF0BDC0
jmp 0x47b67
xorl %ecx, %ecx
testl %ecx, %ecx
js 0x47be1
cmpb $0x3c, %al
jne 0x47b7b
leaq 0x1e0(%r8), %rdx
movq (%rdx), %rax
jmp 0x47ba6
movq -0x80(%rbp), %rax
movq 0x8(%rax), %rdx
movzbl (%rdx), %esi
testq %rsi, %rsi
je 0x47ba4
movl 0x2c(%rbx), %edi
addq $0x28, %rdx
xorl %eax, %eax
cmpl 0x1c(%rdx), %edi
je 0x47b76
addq $0x68, %rdx
decq %rsi
jne 0x47b94
jmp 0x47ba6
xorl %eax, %eax
testq %rax, %rax
je 0x47be1
movswq 0x30(%rbx), %rdx
testw %dx, %dx
jns 0x47bbf
movswq 0x40(%rax), %rdx
testq %rdx, %rdx
js 0x47c12
leaq (%rdx,%rdx,2), %rdx
shlq $0x4, %rdx
addq 0x8(%rax), %rdx
movq (%rdx), %rdx
movq (%rax), %rsi
movq %r8, %rdi
callq 0x489a1
cmpl $0x2, %eax
jne 0x47be1
movb $0x62, (%rbx)
incl 0x28(%r14)
movl $0x1, %eax
movq -0x80(%rbp), %rcx
cmpq %r14, %rcx
je 0x47c00
movq 0x20(%r14), %r14
incl 0x28(%r14)
cmpq %rcx, %r14
jne 0x47bf3
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x333ea(%rip), %rdx     # 0x7b003
jmp 0x47bce