// File: /workspace/github_c_makefile_star2_O0/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
subq $0x110, %rsp            # imm = 0x110
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
movl $0x0, -0x44(%rbp)
movl $0x0, -0x48(%rbp)
movl $0x0, -0x4c(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x58(%rbp)
movq $0x0, -0x68(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x70(%rbp)
movq $0x0, -0x78(%rbp)
movl $0x0, -0x7c(%rbp)
movq -0x38(%rbp), %rax
movl $0xffffffff, 0x2c(%rax) # imm = 0xFFFFFFFF
movq -0x38(%rbp), %rax
movq $0x0, 0x40(%rax)
cmpq $0x0, -0x18(%rbp)
je 0x604af
movq -0x30(%rbp), %rax
movzbl 0x30(%rax), %eax
andl $0x14, %eax
cmpl $0x0, %eax
je 0x6044a
movq $0x0, -0x18(%rbp)
jmp 0x604ad
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
movq -0x58(%rbp), %rcx
cmpl 0x28(%rcx), %eax
jge 0x604ab
movq -0x58(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x3c(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0xc970
cmpl $0x0, %eax
jne 0x6049e
movq -0x58(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x3c(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rax
movq %rax, -0x78(%rbp)
jmp 0x604ab
jmp 0x604a0
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x60451
jmp 0x604ad
jmp 0x604af
jmp 0x604b1
xorl %eax, %eax
cmpq $0x0, -0x30(%rbp)
movb %al, -0xed(%rbp)
je 0x604cd
cmpl $0x0, -0x44(%rbp)
sete %al
movb %al, -0xed(%rbp)
movb -0xed(%rbp), %al
testb $0x1, %al
jne 0x604dc
jmp 0x60c0a
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x90(%rbp)
cmpq $0x0, -0x90(%rbp)
je 0x607e0
movl $0x0, -0x3c(%rbp)
movq -0x90(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x60(%rbp)
movl -0x3c(%rbp), %eax
movq -0x90(%rbp), %rcx
movzbl (%rcx), %ecx
cmpl %ecx, %eax
jge 0x607a9
movq -0x60(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x98(%rbp)
movq -0x60(%rbp), %rax
cmpq $0x0, 0x28(%rax)
je 0x60611
movq -0x60(%rbp), %rax
movq 0x28(%rax), %rax
movzwl 0xa(%rax), %eax
andl $0x200, %eax            # imm = 0x200
cmpl $0x0, %eax
je 0x60611
movl $0x0, -0xa4(%rbp)
movq -0x60(%rbp), %rax
movq 0x28(%rax), %rax
movq (%rax), %rax
movq %rax, -0x88(%rbp)
movl $0x0, -0x40(%rbp)
movl -0x40(%rbp), %eax
movq -0x88(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x605fa
movq -0x88(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x40(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rdi
movq -0x28(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x18(%rbp), %rcx
callq 0x610b0
cmpl $0x0, %eax
je 0x605ed
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
movl $0x2, -0x48(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x68(%rbp)
movl -0x40(%rbp), %eax
movw %ax, %cx
movq -0x38(%rbp), %rax
movw %cx, 0x30(%rax)
movl $0x1, -0xa4(%rbp)
jmp 0x605ef
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x6057f
cmpl $0x0, -0xa4(%rbp)
jne 0x6060a
cmpq $0x0, -0x20(%rbp)
jne 0x6060f
jmp 0x6078f
jmp 0x60611
cmpq $0x0, -0x18(%rbp)
je 0x6062e
movq -0x98(%rbp), %rax
movq 0x68(%rax), %rax
cmpq -0x78(%rbp), %rax
je 0x6062e
jmp 0x6078f
cmpq $0x0, -0x20(%rbp)
je 0x6068c
movq -0x60(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x60651
movq -0x60(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0xf8(%rbp)
jmp 0x60662
movq -0x98(%rbp), %rax
movq (%rax), %rax
movq %rax, -0xf8(%rbp)
movq -0xf8(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0xb0(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0xc970
cmpl $0x0, %eax
je 0x6068a
jmp 0x6078f
jmp 0x6068c
movl -0x48(%rbp), %ecx
movl %ecx, %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x606a5
movq -0x60(%rbp), %rax
movq %rax, -0x68(%rbp)
movl $0x0, -0x40(%rbp)
movq -0x98(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0xa0(%rbp)
movl -0x40(%rbp), %eax
movq -0x98(%rbp), %rcx
movswl 0x42(%rcx), %ecx
cmpl %ecx, %eax
jge 0x6078d
movq -0xa0(%rbp), %rax
movq (%rax), %rdi
movq -0x28(%rbp), %rsi
callq 0xc970
cmpl $0x0, %eax
jne 0x6076b
cmpl $0x1, -0x44(%rbp)
jne 0x6071e
movq -0x60(%rbp), %rax
movzbl 0x38(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x60704
jmp 0x6076d
movq -0x60(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x28(%rbp), %rsi
callq 0x61230
cmpl $0x0, %eax
je 0x6071c
jmp 0x6076d
jmp 0x6071e
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x68(%rbp)
movl -0x40(%rbp), %eax
movq -0x98(%rbp), %rcx
movswl 0x40(%rcx), %ecx
cmpl %ecx, %eax
jne 0x6074e
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, -0xfc(%rbp)
jmp 0x60758
movl -0x40(%rbp), %eax
cwtl
movl %eax, -0xfc(%rbp)
movl -0xfc(%rbp), %eax
movw %ax, %cx
movq -0x38(%rbp), %rax
movw %cx, 0x30(%rax)
jmp 0x6078d
jmp 0x6076d
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
movq -0xa0(%rbp), %rax
addq $0x30, %rax
movq %rax, -0xa0(%rbp)
jmp 0x606be
jmp 0x6078f
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
movq -0x60(%rbp), %rax
addq $0x68, %rax
movq %rax, -0x60(%rbp)
jmp 0x6050f
cmpq $0x0, -0x68(%rbp)
je 0x607de
movq -0x68(%rbp), %rax
movl 0x3c(%rax), %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x2c(%rax)
movq -0x68(%rbp), %rax
movq 0x20(%rax), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x40(%rax)
movq -0x38(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x68(%rax), %rax
movq %rax, -0x78(%rbp)
jmp 0x607e0
cmpq $0x0, -0x18(%rbp)
jne 0x60a78
cmpq $0x0, -0x20(%rbp)
je 0x60a78
cmpl $0x0, -0x44(%rbp)
jne 0x60a78
movq -0x10(%rbp), %rax
cmpq $0x0, 0x1e0(%rax)
je 0x60a78
movq -0x10(%rbp), %rax
movzbl 0x1f4(%rax), %eax
movl %eax, -0xb4(%rbp)
movq $0x0, -0xc0(%rbp)
cmpl $0x6a, -0xb4(%rbp)
je 0x6086b
movq -0x20(%rbp), %rsi
leaq 0x4f25c(%rip), %rdi     # 0xafa9e
callq 0xc970
cmpl $0x0, %eax
jne 0x6086b
movq -0x38(%rbp), %rax
movl $0x1, 0x2c(%rax)
movq -0x10(%rbp), %rax
movq 0x1e0(%rax), %rax
movq %rax, -0xc0(%rbp)
jmp 0x608a8
cmpl $0x69, -0xb4(%rbp)
je 0x608a6
movq -0x20(%rbp), %rsi
leaq 0x4f223(%rip), %rdi     # 0xafaa2
callq 0xc970
cmpl $0x0, %eax
jne 0x608a6
movq -0x38(%rbp), %rax
movl $0x0, 0x2c(%rax)
movq -0x10(%rbp), %rax
movq 0x1e0(%rax), %rax
movq %rax, -0xc0(%rbp)
jmp 0x608a8
cmpq $0x0, -0xc0(%rbp)
je 0x60a76
movq -0xc0(%rbp), %rax
movq 0x68(%rax), %rax
movq %rax, -0x78(%rbp)
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
movl $0x0, -0xc4(%rbp)
movl -0xc4(%rbp), %eax
movq -0xc0(%rbp), %rcx
movswl 0x42(%rcx), %ecx
cmpl %ecx, %eax
jge 0x6095c
movq -0xc0(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0xc4(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xd0(%rbp)
movq -0xd0(%rbp), %rax
movq (%rax), %rdi
movq -0x28(%rbp), %rsi
callq 0xc970
cmpl $0x0, %eax
jne 0x60946
movl -0xc4(%rbp), %eax
movq -0xc0(%rbp), %rcx
movswl 0x40(%rcx), %ecx
cmpl %ecx, %eax
jne 0x60944
movl $0xffffffff, -0xc4(%rbp) # imm = 0xFFFFFFFF
jmp 0x6095c
jmp 0x60948
movl -0xc4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc4(%rbp)
jmp 0x608d8
movl -0xc4(%rbp), %eax
movq -0xc0(%rbp), %rcx
movswl 0x42(%rcx), %ecx
cmpl %ecx, %eax
jl 0x60989
movq -0x28(%rbp), %rdi
callq 0x612b0
cmpl $0x0, %eax
je 0x60989
movl $0xffffffff, -0xc4(%rbp) # imm = 0xFFFFFFFF
movl -0xc4(%rbp), %eax
movq -0xc0(%rbp), %rcx
movswl 0x42(%rcx), %ecx
cmpl %ecx, %eax
jge 0x60a74
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
cmpl $0x0, -0xc4(%rbp)
jge 0x609c1
movq -0x38(%rbp), %rax
movb $0x64, 0x1(%rax)
jmp 0x60a4d
movq -0x38(%rbp), %rax
cmpl $0x0, 0x2c(%rax)
jne 0x60a0c
cmpl $0x20, -0xc4(%rbp)
jl 0x609e1
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, -0x100(%rbp)
jmp 0x609f4
movl -0xc4(%rbp), %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, -0x100(%rbp)
movl -0x100(%rbp), %ecx
movq -0x10(%rbp), %rax
orl 0x1ec(%rax), %ecx
movl %ecx, 0x1ec(%rax)
jmp 0x60a4b
cmpl $0x20, -0xc4(%rbp)
jl 0x60a22
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, -0x104(%rbp)
jmp 0x60a35
movl -0xc4(%rbp), %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, -0x104(%rbp)
movl -0x104(%rbp), %ecx
movq -0x10(%rbp), %rax
orl 0x1f0(%rax), %ecx
movl %ecx, 0x1f0(%rax)
jmp 0x60a4d
movl -0xc4(%rbp), %eax
movw %ax, %cx
movq -0x38(%rbp), %rax
movw %cx, 0x30(%rax)
movq -0xc0(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x40(%rax)
movl $0x1, -0x7c(%rbp)
jmp 0x60a76
jmp 0x60a78
cmpl $0x0, -0x44(%rbp)
jne 0x60aab
cmpl $0x1, -0x48(%rbp)
jne 0x60aab
movq -0x28(%rbp), %rdi
callq 0x612b0
cmpl $0x0, %eax
je 0x60aab
movl $0x1, -0x44(%rbp)
movq -0x38(%rbp), %rax
movw $0xffff, 0x30(%rax)     # imm = 0xFFFF
movq -0x38(%rbp), %rax
movb $0x64, 0x1(%rax)
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x88(%rbp)
cmpq $0x0, %rax
je 0x60bea
cmpq $0x0, -0x20(%rbp)
jne 0x60bea
cmpl $0x0, -0x44(%rbp)
jne 0x60bea
movl $0x0, -0x40(%rbp)
movl -0x40(%rbp), %eax
movq -0x88(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x60be8
movq -0x88(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x40(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq %rax, -0xd8(%rbp)
cmpq $0x0, -0xd8(%rbp)
je 0x60bd8
movq -0xd8(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0xc970
cmpl $0x0, %eax
jne 0x60bd8
movq -0x88(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x40(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq %rax, -0xe0(%rbp)
movq -0x30(%rbp), %rax
movzbl 0x30(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x60ba2
movq -0xe0(%rbp), %rax
movzwl 0x2(%rax), %eax
andl $0x2, %eax
cmpl $0x2, %eax
jne 0x60ba2
movq -0x10(%rbp), %rdi
movq -0xd8(%rbp), %rdx
leaq 0x4ef17(%rip), %rsi     # 0xafaa6
movb $0x0, %al
callq 0x136f0
movl $0x2, -0x4(%rbp)
jmp 0x60e08
movq -0x10(%rbp), %rdi
movq -0x88(%rbp), %rsi
movl -0x40(%rbp), %edx
movq -0x38(%rbp), %rcx
movl -0x4c(%rbp), %r9d
leaq 0x52236(%rip), %r8      # 0xb2df5
callq 0x61330
movl $0x1, -0x44(%rbp)
movq $0x0, -0x68(%rbp)
jmp 0x60da4
jmp 0x60bda
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x60ae0
jmp 0x60bea
cmpl $0x0, -0x44(%rbp)
jne 0x60c05
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x30(%rbp)
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x604b1
cmpl $0x0, -0x44(%rbp)
jne 0x60c46
cmpq $0x0, -0x20(%rbp)
jne 0x60c46
movq -0x38(%rbp), %rax
movzwl 0x2(%rax), %eax
andl $0x40, %eax
cmpl $0x40, %eax
jne 0x60c46
movq -0x38(%rbp), %rax
movb $0x5e, (%rax)
movq -0x38(%rbp), %rax
movq $0x0, 0x40(%rax)
movl $0x1, -0x4(%rbp)
jmp 0x60e08
cmpl $0x1, -0x44(%rbp)
je 0x60cfb
movl -0x44(%rbp), %edx
leaq 0x4ee7a(%rip), %rax     # 0xafad4
leaq 0x4ee64(%rip), %rcx     # 0xafac5
cmpl $0x0, %edx
cmoveq %rcx, %rax
movq %rax, -0xe8(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x60c9d
movq -0x10(%rbp), %rdi
movq -0xe8(%rbp), %rdx
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %r8
movq -0x28(%rbp), %r9
leaq 0x4ee56(%rip), %rsi     # 0xafaea
movb $0x0, %al
callq 0x136f0
jmp 0x60ce6
cmpq $0x0, -0x20(%rbp)
je 0x60cc7
movq -0x10(%rbp), %rdi
movq -0xe8(%rbp), %rdx
movq -0x20(%rbp), %rcx
movq -0x28(%rbp), %r8
leaq 0x4e848(%rip), %rsi     # 0xaf506
movb $0x0, %al
callq 0x136f0
jmp 0x60ce4
movq -0x10(%rbp), %rdi
movq -0xe8(%rbp), %rdx
movq -0x28(%rbp), %rcx
leaq 0x4e833(%rip), %rsi     # 0xaf510
movb $0x0, %al
callq 0x136f0
jmp 0x60ce6
movq -0x10(%rbp), %rax
movb $0x1, 0x1d(%rax)
movq -0x70(%rbp), %rax
movl 0x2c(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x2c(%rax)
movq -0x38(%rbp), %rax
movswl 0x30(%rax), %eax
cmpl $0x0, %eax
jl 0x60d4f
cmpq $0x0, -0x68(%rbp)
je 0x60d4f
movq -0x38(%rbp), %rax
movswl 0x30(%rax), %eax
movl %eax, -0xec(%rbp)
cmpl $0x40, -0xec(%rbp)
jl 0x60d30
movl $0x3f, -0xec(%rbp)
movl -0xec(%rbp), %eax
movl %eax, %ecx
movl $0x1, %eax
shlq %cl, %rax
movq %rax, %rcx
movq -0x68(%rbp), %rax
orq 0x50(%rax), %rcx
movq %rcx, 0x50(%rax)
movq -0x58(%rbp), %rdi
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x47330
movq -0x38(%rbp), %rax
movq $0x0, 0x10(%rax)
movq -0x58(%rbp), %rdi
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rsi
callq 0x47330
movq -0x38(%rbp), %rax
movq $0x0, 0x18(%rax)
movl -0x7c(%rbp), %edx
movl $0x98, %eax
movl $0x3c, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movb %al, %cl
movq -0x38(%rbp), %rax
movb %cl, (%rax)
cmpl $0x1, -0x44(%rbp)
jne 0x60e01
movq -0x38(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x18, %eax
je 0x60dcf
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x78(%rbp), %rdx
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rcx
callq 0x61510
jmp 0x60dd1
movq -0x70(%rbp), %rax
movl 0x28(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x28(%rax)
movq -0x70(%rbp), %rax
cmpq -0x30(%rbp), %rax
jne 0x60dea
jmp 0x60df8
movq -0x70(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x70(%rbp)
jmp 0x60dd1
movl $0x1, -0x4(%rbp)
jmp 0x60e08
movl $0x2, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
nopw %cs:(%rax,%rax)