// File: /workspace/github_c_makefile_star2_O0/ukontainer[P]sqlite-bench/sqlite3.c
// Function: xferOptimization
static int xferOptimization(
  Parse *pParse,        /* Parser context */
  Table *pDest,         /* The table we are inserting into */
  Select *pSelect,      /* A SELECT statement to use as the data source */
  int onError,          /* How to handle constraint errors */
  int iDbDest           /* The database of pDest */
){
  sqlite3 *db = pParse->db;
  ExprList *pEList;                /* The result set of the SELECT */
  Table *pSrc;                     /* The table in the FROM clause of SELECT */
  Index *pSrcIdx, *pDestIdx;       /* Source and destination indices */
  struct SrcList_item *pItem;      /* An element of pSelect->pSrc */
  int i;                           /* Loop counter */
  int iDbSrc;                      /* The database of pSrc */
  int iSrc, iDest;                 /* Cursors from source and destination */
  int addr1, addr2;                /* Loop addresses */
  int emptyDestTest = 0;           /* Address of test for empty pDest */
  int emptySrcTest = 0;            /* Address of test for empty pSrc */
  Vdbe *v;                         /* The VDBE we are building */
  int regAutoinc;                  /* Memory register used by AUTOINC */
  int destHasUniqueIdx = 0;        /* True if pDest has a UNIQUE index */
  int regData, regRowid;           /* Registers holding data and rowid */

  if( pSelect==0 ){
    return 0;   /* Must be of the form  INSERT INTO ... SELECT ... */
  }
  if( pParse->pWith || pSelect->pWith ){
    /* Do not attempt to process this query if there are an WITH clauses
    ** attached to it. Proceeding may generate a false "no such table: xxx"
    ** error if pSelect reads from a CTE named "xxx".  */
    return 0;
  }
  if( sqlite3TriggerList(pParse, pDest) ){
    return 0;   /* tab1 must not have triggers */
  }
#ifndef SQLITE_OMIT_VIRTUALTABLE
  if( IsVirtual(pDest) ){
    return 0;   /* tab1 must not be a virtual table */
  }
#endif
  if( onError==OE_Default ){
    if( pDest->iPKey>=0 ) onError = pDest->keyConf;
    if( onError==OE_Default ) onError = OE_Abort;
  }
  assert(pSelect->pSrc);   /* allocated even if there is no FROM clause */
  if( pSelect->pSrc->nSrc!=1 ){
    return 0;   /* FROM clause must have exactly one term */
  }
  if( pSelect->pSrc->a[0].pSelect ){
    return 0;   /* FROM clause cannot contain a subquery */
  }
  if( pSelect->pWhere ){
    return 0;   /* SELECT may not have a WHERE clause */
  }
  if( pSelect->pOrderBy ){
    return 0;   /* SELECT may not have an ORDER BY clause */
  }
  /* Do not need to test for a HAVING clause.  If HAVING is present but
  ** there is no ORDER BY, we will get an error. */
  if( pSelect->pGroupBy ){
    return 0;   /* SELECT may not have a GROUP BY clause */
  }
  if( pSelect->pLimit ){
    return 0;   /* SELECT may not have a LIMIT clause */
  }
  if( pSelect->pPrior ){
    return 0;   /* SELECT may not be a compound query */
  }
  if( pSelect->selFlags & SF_Distinct ){
    return 0;   /* SELECT may not be DISTINCT */
  }
  pEList = pSelect->pEList;
  assert( pEList!=0 );
  if( pEList->nExpr!=1 ){
    return 0;   /* The result set must have exactly one column */
  }
  assert( pEList->a[0].pExpr );
  if( pEList->a[0].pExpr->op!=TK_ASTERISK ){
    return 0;   /* The result set must be the special operator "*" */
  }

  /* At this point we have established that the statement is of the
  ** correct syntactic form to participate in this optimization.  Now
  ** we have to check the semantics.
  */
  pItem = pSelect->pSrc->a;
  pSrc = sqlite3LocateTableItem(pParse, 0, pItem);
  if( pSrc==0 ){
    return 0;   /* FROM clause does not contain a real table */
  }
  if( pSrc==pDest ){
    return 0;   /* tab1 and tab2 may not be the same table */
  }
  if( HasRowid(pDest)!=HasRowid(pSrc) ){
    return 0;   /* source and destination must both be WITHOUT ROWID or not */
  }
#ifndef SQLITE_OMIT_VIRTUALTABLE
  if( IsVirtual(pSrc) ){
    return 0;   /* tab2 must not be a virtual table */
  }
#endif
  if( pSrc->pSelect ){
    return 0;   /* tab2 may not be a view */
  }
  if( pDest->nCol!=pSrc->nCol ){
    return 0;   /* Number of columns must be the same in tab1 and tab2 */
  }
  if( pDest->iPKey!=pSrc->iPKey ){
    return 0;   /* Both tables must have the same INTEGER PRIMARY KEY */
  }
  for(i=0; i<pDest->nCol; i++){
    Column *pDestCol = &pDest->aCol[i];
    Column *pSrcCol = &pSrc->aCol[i];
#ifdef SQLITE_ENABLE_HIDDEN_COLUMNS
    if( (db->mDbFlags & DBFLAG_Vacuum)==0 
     && (pDestCol->colFlags | pSrcCol->colFlags) & COLFLAG_HIDDEN 
    ){
      return 0;    /* Neither table may have __hidden__ columns */
    }
#endif
    if( pDestCol->affinity!=pSrcCol->affinity ){
      return 0;    /* Affinity must be the same on all columns */
    }
    if( sqlite3_stricmp(pDestCol->zColl, pSrcCol->zColl)!=0 ){
      return 0;    /* Collating sequence must be the same on all columns */
    }
    if( pDestCol->notNull && !pSrcCol->notNull ){
      return 0;    /* tab2 must be NOT NULL if tab1 is */
    }
    /* Default values for second and subsequent columns need to match. */
    if( i>0 ){
      assert( pDestCol->pDflt==0 || pDestCol->pDflt->op==TK_SPAN );
      assert( pSrcCol->pDflt==0 || pSrcCol->pDflt->op==TK_SPAN );
      if( (pDestCol->pDflt==0)!=(pSrcCol->pDflt==0) 
       || (pDestCol->pDflt && strcmp(pDestCol->pDflt->u.zToken,
                                       pSrcCol->pDflt->u.zToken)!=0)
      ){
        return 0;    /* Default values must be the same for all columns */
      }
    }
  }
  for(pDestIdx=pDest->pIndex; pDestIdx; pDestIdx=pDestIdx->pNext){
    if( IsUniqueIndex(pDestIdx) ){
      destHasUniqueIdx = 1;
    }
    for(pSrcIdx=pSrc->pIndex; pSrcIdx; pSrcIdx=pSrcIdx->pNext){
      if( xferCompatibleIndex(pDestIdx, pSrcIdx) ) break;
    }
    if( pSrcIdx==0 ){
      return 0;    /* pDestIdx has no corresponding index in pSrc */
    }
  }
#ifndef SQLITE_OMIT_CHECK
  if( pDest->pCheck && sqlite3ExprListCompare(pSrc->pCheck,pDest->pCheck,-1) ){
    return 0;   /* Tables have different CHECK constraints.  Ticket #2252 */
  }
#endif
#ifndef SQLITE_OMIT_FOREIGN_KEY
  /* Disallow the transfer optimization if the destination table constains
  ** any foreign key constraints.  This is more restrictive than necessary.
  ** But the main beneficiary of the transfer optimization is the VACUUM 
  ** command, and the VACUUM command disables foreign key constraints.  So
  ** the extra complication to make this rule less restrictive is probably
  ** not worth the effort.  Ticket [6284df89debdfa61db8073e062908af0c9b6118e]
  */
  if( (db->flags & SQLITE_ForeignKeys)!=0 && pDest->pFKey!=0 ){
    return 0;
  }
#endif
  if( (db->flags & SQLITE_CountRows)!=0 ){
    return 0;  /* xfer opt does not play well with PRAGMA count_changes */
  }

  /* If we get this far, it means that the xfer optimization is at
  ** least a possibility, though it might only work if the destination
  ** table (tab1) is initially empty.
  */
#ifdef SQLITE_TEST
  sqlite3_xferopt_count++;
#endif
  iDbSrc = sqlite3SchemaToIndex(db, pSrc->pSchema);
  v = sqlite3GetVdbe(pParse);
  sqlite3CodeVerifySchema(pParse, iDbSrc);
  iSrc = pParse->nTab++;
  iDest = pParse->nTab++;
  regAutoinc = autoIncBegin(pParse, iDbDest, pDest);
  regData = sqlite3GetTempReg(pParse);
  regRowid = sqlite3GetTempReg(pParse);
  sqlite3OpenTable(pParse, iDest, iDbDest, pDest, OP_OpenWrite);
  assert( HasRowid(pDest) || destHasUniqueIdx );
  if( (db->mDbFlags & DBFLAG_Vacuum)==0 && (
      (pDest->iPKey<0 && pDest->pIndex!=0)          /* (1) */
   || destHasUniqueIdx                              /* (2) */
   || (onError!=OE_Abort && onError!=OE_Rollback)   /* (3) */
  )){
    /* In some circumstances, we are able to run the xfer optimization
    ** only if the destination table is initially empty. Unless the
    ** DBFLAG_Vacuum flag is set, this block generates code to make
    ** that determination. If DBFLAG_Vacuum is set, then the destination
    ** table is always empty.
    **
    ** Conditions under which the destination must be empty:
    **
    ** (1) There is no INTEGER PRIMARY KEY but there are indices.
    **     (If the destination is not initially empty, the rowid fields
    **     of index entries might need to change.)
    **
    ** (2) The destination has a unique index.  (The xfer optimization 
    **     is unable to test uniqueness.)
    **
    ** (3) onError is something other than OE_Abort and OE_Rollback.
    */
    addr1 = sqlite3VdbeAddOp2(v, OP_Rewind, iDest, 0); VdbeCoverage(v);
    emptyDestTest = sqlite3VdbeAddOp0(v, OP_Goto);
    sqlite3VdbeJumpHere(v, addr1);
  }
  if( HasRowid(pSrc) ){
    u8 insFlags;
    sqlite3OpenTable(pParse, iSrc, iDbSrc, pSrc, OP_OpenRead);
    emptySrcTest = sqlite3VdbeAddOp2(v, OP_Rewind, iSrc, 0); VdbeCoverage(v);
    if( pDest->iPKey>=0 ){
      addr1 = sqlite3VdbeAddOp2(v, OP_Rowid, iSrc, regRowid);
      sqlite3VdbeVerifyAbortable(v, onError);
      addr2 = sqlite3VdbeAddOp3(v, OP_NotExists, iDest, 0, regRowid);
      VdbeCoverage(v);
      sqlite3RowidConstraint(pParse, onError, pDest);
      sqlite3VdbeJumpHere(v, addr2);
      autoIncStep(pParse, regAutoinc, regRowid);
    }else if( pDest->pIndex==0 ){
      addr1 = sqlite3VdbeAddOp2(v, OP_NewRowid, iDest, regRowid);
    }else{
      addr1 = sqlite3VdbeAddOp2(v, OP_Rowid, iSrc, regRowid);
      assert( (pDest->tabFlags & TF_Autoincrement)==0 );
    }
    sqlite3VdbeAddOp3(v, OP_RowData, iSrc, regData, 1);
    if( db->mDbFlags & DBFLAG_Vacuum ){
      sqlite3VdbeAddOp1(v, OP_SeekEnd, iDest);
      insFlags = OPFLAG_NCHANGE|OPFLAG_LASTROWID|
                           OPFLAG_APPEND|OPFLAG_USESEEKRESULT;
    }else{
      insFlags = OPFLAG_NCHANGE|OPFLAG_LASTROWID|OPFLAG_APPEND;
    }
    sqlite3VdbeAddOp4(v, OP_Insert, iDest, regData, regRowid,
                      (char*)pDest, P4_TABLE);
    sqlite3VdbeChangeP5(v, insFlags);
    sqlite3VdbeAddOp2(v, OP_Next, iSrc, addr1); VdbeCoverage(v);
    sqlite3VdbeAddOp2(v, OP_Close, iSrc, 0);
    sqlite3VdbeAddOp2(v, OP_Close, iDest, 0);
  }else{
    sqlite3TableLock(pParse, iDbDest, pDest->tnum, 1, pDest->zName);
    sqlite3TableLock(pParse, iDbSrc, pSrc->tnum, 0, pSrc->zName);
  }
  for(pDestIdx=pDest->pIndex; pDestIdx; pDestIdx=pDestIdx->pNext){
    u8 idxInsFlags = 0;
    for(pSrcIdx=pSrc->pIndex; ALWAYS(pSrcIdx); pSrcIdx=pSrcIdx->pNext){
      if( xferCompatibleIndex(pDestIdx, pSrcIdx) ) break;
    }
    assert( pSrcIdx );
    sqlite3VdbeAddOp3(v, OP_OpenRead, iSrc, pSrcIdx->tnum, iDbSrc);
    sqlite3VdbeSetP4KeyInfo(pParse, pSrcIdx);
    VdbeComment((v, "%s", pSrcIdx->zName));
    sqlite3VdbeAddOp3(v, OP_OpenWrite, iDest, pDestIdx->tnum, iDbDest);
    sqlite3VdbeSetP4KeyInfo(pParse, pDestIdx);
    sqlite3VdbeChangeP5(v, OPFLAG_BULKCSR);
    VdbeComment((v, "%s", pDestIdx->zName));
    addr1 = sqlite3VdbeAddOp2(v, OP_Rewind, iSrc, 0); VdbeCoverage(v);
    sqlite3VdbeAddOp3(v, OP_RowData, iSrc, regData, 1);
    if( db->mDbFlags & DBFLAG_Vacuum ){
      /* This INSERT command is part of a VACUUM operation, which guarantees
      ** that the destination table is empty. If all indexed columns use
      ** collation sequence BINARY, then it can also be assumed that the
      ** index will be populated by inserting keys in strictly sorted 
      ** order. In this case, instead of seeking within the b-tree as part
      ** of every OP_IdxInsert opcode, an OP_SeekEnd is added before the
      ** OP_IdxInsert to seek to the point within the b-tree where each key 
      ** should be inserted. This is faster.
      **
      ** If any of the indexed columns use a collation sequence other than
      ** BINARY, this optimization is disabled. This is because the user 
      ** might change the definition of a collation sequence and then run
      ** a VACUUM command. In that case keys may not be written in strictly
      ** sorted order.  */
      for(i=0; i<pSrcIdx->nColumn; i++){
        const char *zColl = pSrcIdx->azColl[i];
        if( sqlite3_stricmp(sqlite3StrBINARY, zColl) ) break;
      }
      if( i==pSrcIdx->nColumn ){
        idxInsFlags = OPFLAG_USESEEKRESULT;
        sqlite3VdbeAddOp1(v, OP_SeekEnd, iDest);
      }
    }
    if( !HasRowid(pSrc) && pDestIdx->idxType==2 ){
      idxInsFlags |= OPFLAG_NCHANGE;
    }
    sqlite3VdbeAddOp2(v, OP_IdxInsert, iDest, regData);
    sqlite3VdbeChangeP5(v, idxInsFlags|OPFLAG_APPEND);
    sqlite3VdbeAddOp2(v, OP_Next, iSrc, addr1+1); VdbeCoverage(v);
    sqlite3VdbeJumpHere(v, addr1);
    sqlite3VdbeAddOp2(v, OP_Close, iSrc, 0);
    sqlite3VdbeAddOp2(v, OP_Close, iDest, 0);
  }
  if( emptySrcTest ) sqlite3VdbeJumpHere(v, emptySrcTest);
  sqlite3ReleaseTempReg(pParse, regRowid);
  sqlite3ReleaseTempReg(pParse, regData);
  if( emptyDestTest ){
    sqlite3AutoincrementEnd(pParse);
    sqlite3VdbeAddOp2(v, OP_Halt, SQLITE_OK, 0);
    sqlite3VdbeJumpHere(v, emptyDestTest);
    sqlite3VdbeAddOp2(v, OP_Close, iDest, 0);
    return 0;
  }else{
    return 1;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movl %r8d, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movl $0x0, -0x74(%rbp)
movl $0x0, -0x78(%rbp)
movl $0x0, -0x88(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x49c724
movl $0x0, -0x4(%rbp)
jmp 0x49d1a5
movq -0x10(%rbp), %rax
cmpq $0x0, 0x180(%rax)
jne 0x49c73d
movq -0x20(%rbp), %rax
cmpq $0x0, 0x68(%rax)
je 0x49c749
movl $0x0, -0x4(%rbp)
jmp 0x49d1a5
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x47d540
cmpq $0x0, %rax
je 0x49c768
movl $0x0, -0x4(%rbp)
jmp 0x49d1a5
movq -0x18(%rbp), %rax
cmpl $0x0, 0x54(%rax)
je 0x49c77e
movl $0x0, -0x4(%rbp)
jmp 0x49d1a5
cmpl $0xb, -0x24(%rbp)
jne 0x49c7ab
movq -0x18(%rbp), %rax
movswl 0x44(%rax), %eax
cmpl $0x0, %eax
jl 0x49c79c
movq -0x18(%rbp), %rax
movzbl 0x4c(%rax), %eax
movl %eax, -0x24(%rbp)
cmpl $0xb, -0x24(%rbp)
jne 0x49c7a9
movl $0x2, -0x24(%rbp)
jmp 0x49c7ab
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rax
cmpl $0x1, (%rax)
je 0x49c7c4
movl $0x0, -0x4(%rbp)
jmp 0x49d1a5
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rax
cmpq $0x0, 0x30(%rax)
je 0x49c7df
movl $0x0, -0x4(%rbp)
jmp 0x49d1a5
movq -0x20(%rbp), %rax
cmpq $0x0, 0x30(%rax)
je 0x49c7f6
movl $0x0, -0x4(%rbp)
jmp 0x49d1a5
movq -0x20(%rbp), %rax
cmpq $0x0, 0x48(%rax)
je 0x49c80d
movl $0x0, -0x4(%rbp)
jmp 0x49d1a5
movq -0x20(%rbp), %rax
cmpq $0x0, 0x38(%rax)
je 0x49c824
movl $0x0, -0x4(%rbp)
jmp 0x49d1a5
movq -0x20(%rbp), %rax
cmpq $0x0, 0x60(%rax)
je 0x49c83b
movl $0x0, -0x4(%rbp)
jmp 0x49d1a5
movq -0x20(%rbp), %rax
cmpq $0x0, 0x50(%rax)
je 0x49c852
movl $0x0, -0x4(%rbp)
jmp 0x49d1a5
movq -0x20(%rbp), %rax
movl 0xc(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x49c86d
movl $0x0, -0x4(%rbp)
jmp 0x49d1a5
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
cmpl $0x1, (%rax)
je 0x49c88d
movl $0x0, -0x4(%rbp)
jmp 0x49d1a5
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
movzbl (%rax), %eax
cmpl $0xa8, %eax
je 0x49c8ab
movl $0x0, -0x4(%rbp)
jmp 0x49d1a5
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rax
addq $0x8, %rax
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rdi
movq -0x58(%rbp), %rdx
xorl %esi, %esi
callq 0x479e00
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x49c8e1
movl $0x0, -0x4(%rbp)
jmp 0x49d1a5
movq -0x40(%rbp), %rax
cmpq -0x18(%rbp), %rax
jne 0x49c8f7
movl $0x0, -0x4(%rbp)
jmp 0x49d1a5
movq -0x18(%rbp), %rax
movl 0x40(%rax), %eax
andl $0x20, %eax
cmpl $0x0, %eax
sete %al
andb $0x1, %al
movzbl %al, %eax
movq -0x40(%rbp), %rcx
movl 0x40(%rcx), %ecx
andl $0x20, %ecx
cmpl $0x0, %ecx
sete %cl
andb $0x1, %cl
movzbl %cl, %ecx
cmpl %ecx, %eax
je 0x49c932
movl $0x0, -0x4(%rbp)
jmp 0x49d1a5
movq -0x40(%rbp), %rax
cmpl $0x0, 0x54(%rax)
je 0x49c948
movl $0x0, -0x4(%rbp)
jmp 0x49d1a5
movq -0x40(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x49c95f
movl $0x0, -0x4(%rbp)
jmp 0x49d1a5
movq -0x18(%rbp), %rax
movswl 0x46(%rax), %eax
movq -0x40(%rbp), %rcx
movswl 0x46(%rcx), %ecx
cmpl %ecx, %eax
je 0x49c97f
movl $0x0, -0x4(%rbp)
jmp 0x49d1a5
movq -0x18(%rbp), %rax
movswl 0x44(%rax), %eax
movq -0x40(%rbp), %rcx
movswl 0x44(%rcx), %ecx
cmpl %ecx, %eax
je 0x49c99f
movl $0x0, -0x4(%rbp)
jmp 0x49d1a5
movl $0x0, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
movq -0x18(%rbp), %rcx
movswl 0x46(%rcx), %ecx
cmpl %ecx, %eax
jge 0x49caef
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x5c(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, -0x98(%rbp)
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x5c(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, -0xa0(%rbp)
movq -0x98(%rbp), %rax
movsbl 0x19(%rax), %eax
movq -0xa0(%rbp), %rcx
movsbl 0x19(%rcx), %ecx
cmpl %ecx, %eax
je 0x49ca13
movl $0x0, -0x4(%rbp)
jmp 0x49d1a5
movq -0x98(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0xa0(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x4096f0
cmpl $0x0, %eax
je 0x49ca3f
movl $0x0, -0x4(%rbp)
jmp 0x49d1a5
movq -0x98(%rbp), %rax
movzbl 0x18(%rax), %eax
cmpl $0x0, %eax
je 0x49ca68
movq -0xa0(%rbp), %rax
cmpb $0x0, 0x18(%rax)
jne 0x49ca68
movl $0x0, -0x4(%rbp)
jmp 0x49d1a5
cmpl $0x0, -0x5c(%rbp)
jle 0x49cadf
movq -0x98(%rbp), %rax
cmpq $0x0, 0x8(%rax)
sete %al
andb $0x1, %al
movzbl %al, %eax
movq -0xa0(%rbp), %rcx
cmpq $0x0, 0x8(%rcx)
sete %cl
andb $0x1, %cl
movzbl %cl, %ecx
cmpl %ecx, %eax
jne 0x49cad1
movq -0x98(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x49cadd
movq -0x98(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rdi
movq -0xa0(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rsi
callq 0x4010c0
cmpl $0x0, %eax
je 0x49cadd
movl $0x0, -0x4(%rbp)
jmp 0x49d1a5
jmp 0x49cadf
jmp 0x49cae1
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0x49c9a6
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x50(%rbp)
je 0x49cb73
movq -0x50(%rbp), %rax
movzbl 0x62(%rax), %eax
cmpl $0x0, %eax
je 0x49cb19
movl $0x1, -0x88(%rbp)
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
je 0x49cb50
movq -0x50(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x49d910
cmpl $0x0, %eax
je 0x49cb40
jmp 0x49cb50
jmp 0x49cb42
movq -0x48(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x48(%rbp)
jmp 0x49cb25
cmpq $0x0, -0x48(%rbp)
jne 0x49cb63
movl $0x0, -0x4(%rbp)
jmp 0x49d1a5
jmp 0x49cb65
movq -0x50(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x50(%rbp)
jmp 0x49cafb
movq -0x18(%rbp), %rax
cmpq $0x0, 0x30(%rax)
je 0x49cba9
movq -0x40(%rbp), %rax
movq 0x30(%rax), %rdi
movq -0x18(%rbp), %rax
movq 0x30(%rax), %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x471900
cmpl $0x0, %eax
je 0x49cba9
movl $0x0, -0x4(%rbp)
jmp 0x49d1a5
movq -0x30(%rbp), %rax
movl 0x30(%rax), %eax
andl $0x4000, %eax           # imm = 0x4000
cmpl $0x0, %eax
je 0x49cbd1
movq -0x18(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0x49cbd1
movl $0x0, -0x4(%rbp)
jmp 0x49d1a5
movq -0x30(%rbp), %rax
movl 0x30(%rax), %eax
andl $0x80, %eax
cmpl $0x0, %eax
je 0x49cbee
movl $0x0, -0x4(%rbp)
jmp 0x49d1a5
movq -0x30(%rbp), %rdi
movq -0x40(%rbp), %rax
movq 0x70(%rax), %rsi
callq 0x4111b0
movl %eax, -0x60(%rbp)
movq -0x10(%rbp), %rdi
callq 0x46bb00
movq %rax, -0x80(%rbp)
movq -0x10(%rbp), %rdi
movl -0x60(%rbp), %esi
callq 0x473c40
movq -0x10(%rbp), %rcx
movl 0x34(%rcx), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, 0x34(%rcx)
movl %eax, -0x64(%rbp)
movq -0x10(%rbp), %rcx
movl 0x34(%rcx), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, 0x34(%rcx)
movl %eax, -0x68(%rbp)
movq -0x10(%rbp), %rdi
movl -0x28(%rbp), %esi
movq -0x18(%rbp), %rdx
callq 0x49d1c0
movl %eax, -0x84(%rbp)
movq -0x10(%rbp), %rdi
callq 0x470ad0
movl %eax, -0x8c(%rbp)
movq -0x10(%rbp), %rdi
callq 0x470ad0
movl %eax, -0x90(%rbp)
movq -0x10(%rbp), %rdi
movl -0x68(%rbp), %esi
movl -0x28(%rbp), %edx
movq -0x18(%rbp), %rcx
movl $0x6e, %r8d
callq 0x46bf90
movq -0x30(%rbp), %rax
movl 0x2c(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
jne 0x49ccfb
movq -0x18(%rbp), %rax
movswl 0x44(%rax), %eax
cmpl $0x0, %eax
jge 0x49ccb3
movq -0x18(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x49ccc8
cmpl $0x0, -0x88(%rbp)
jne 0x49ccc8
cmpl $0x2, -0x24(%rbp)
je 0x49ccfb
cmpl $0x1, -0x24(%rbp)
je 0x49ccfb
movq -0x80(%rbp), %rdi
movl -0x68(%rbp), %edx
movl $0x24, %esi
xorl %ecx, %ecx
callq 0x453790
movl %eax, -0x6c(%rbp)
movq -0x80(%rbp), %rdi
movl $0xb, %esi
callq 0x46bb70
movl %eax, -0x74(%rbp)
movq -0x80(%rbp), %rdi
movl -0x6c(%rbp), %esi
callq 0x46bba0
movq -0x40(%rbp), %rax
movl 0x40(%rax), %eax
andl $0x20, %eax
cmpl $0x0, %eax
jne 0x49cebc
movq -0x10(%rbp), %rdi
movl -0x64(%rbp), %esi
movl -0x60(%rbp), %edx
movq -0x40(%rbp), %rcx
movl $0x6d, %r8d
callq 0x46bf90
movq -0x80(%rbp), %rdi
movl -0x64(%rbp), %edx
movl $0x24, %esi
xorl %ecx, %ecx
callq 0x453790
movl %eax, -0x78(%rbp)
movq -0x18(%rbp), %rax
movswl 0x44(%rax), %eax
cmpl $0x0, %eax
jl 0x49cdb4
movq -0x80(%rbp), %rdi
movl -0x64(%rbp), %edx
movl -0x90(%rbp), %ecx
movl $0x81, %esi
callq 0x453790
movl %eax, -0x6c(%rbp)
movq -0x80(%rbp), %rdi
movl -0x68(%rbp), %edx
movl -0x90(%rbp), %r8d
movl $0x1f, %esi
xorl %ecx, %ecx
callq 0x4537c0
movl %eax, -0x70(%rbp)
movq -0x10(%rbp), %rdi
movl -0x24(%rbp), %esi
movq -0x18(%rbp), %rdx
callq 0x49c3b0
movq -0x80(%rbp), %rdi
movl -0x70(%rbp), %esi
callq 0x46bba0
movq -0x10(%rbp), %rdi
movl -0x84(%rbp), %esi
movl -0x90(%rbp), %edx
callq 0x49d8d0
jmp 0x49cdf7
movq -0x18(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x49cddb
movq -0x80(%rbp), %rdi
movl -0x68(%rbp), %edx
movl -0x90(%rbp), %ecx
movl $0x79, %esi
callq 0x453790
movl %eax, -0x6c(%rbp)
jmp 0x49cdf5
movq -0x80(%rbp), %rdi
movl -0x64(%rbp), %edx
movl -0x90(%rbp), %ecx
movl $0x81, %esi
callq 0x453790
movl %eax, -0x6c(%rbp)
jmp 0x49cdf7
movq -0x80(%rbp), %rdi
movl -0x64(%rbp), %edx
movl -0x8c(%rbp), %ecx
movl $0x80, %esi
movl $0x1, %r8d
callq 0x4537c0
movq -0x30(%rbp), %rax
movl 0x2c(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x49ce3d
movq -0x80(%rbp), %rdi
movl -0x68(%rbp), %edx
movl $0x83, %esi
callq 0x46e2d0
movb $0x39, -0xa1(%rbp)
jmp 0x49ce44
movb $0x29, -0xa1(%rbp)
movq -0x80(%rbp), %rdi
movl -0x68(%rbp), %edx
movl -0x8c(%rbp), %ecx
movl -0x90(%rbp), %r8d
movq -0x18(%rbp), %r9
movl $0x7a, %esi
movl $0xfffffffa, (%rsp)     # imm = 0xFFFFFFFA
callq 0x46bbd0
movq -0x80(%rbp), %rdi
movzbl -0xa1(%rbp), %eax
movzwl %ax, %esi
callq 0x411430
movq -0x80(%rbp), %rdi
movl -0x64(%rbp), %edx
movl -0x6c(%rbp), %ecx
movl $0x5, %esi
callq 0x453790
movq -0x80(%rbp), %rdi
movl -0x64(%rbp), %edx
movl $0x75, %esi
xorl %ecx, %ecx
callq 0x453790
movq -0x80(%rbp), %rdi
movl -0x68(%rbp), %edx
movl $0x75, %esi
xorl %ecx, %ecx
callq 0x453790
jmp 0x49cef7
movq -0x10(%rbp), %rdi
movl -0x28(%rbp), %esi
movq -0x18(%rbp), %rax
movl 0x38(%rax), %edx
movq -0x18(%rbp), %rax
movq (%rax), %r8
movl $0x1, %ecx
callq 0x46c0a0
movq -0x10(%rbp), %rdi
movl -0x60(%rbp), %esi
movq -0x40(%rbp), %rax
movl 0x38(%rax), %edx
movq -0x40(%rbp), %rax
movq (%rax), %r8
xorl %ecx, %ecx
callq 0x46c0a0
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x50(%rbp)
je 0x49d125
movb $0x0, -0xa2(%rbp)
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
je 0x49cf4c
movq -0x50(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x49d910
cmpl $0x0, %eax
je 0x49cf3c
jmp 0x49cf4c
jmp 0x49cf3e
movq -0x48(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x48(%rbp)
jmp 0x49cf21
movq -0x80(%rbp), %rdi
movl -0x64(%rbp), %edx
movq -0x48(%rbp), %rax
movl 0x58(%rax), %ecx
movl -0x60(%rbp), %r8d
movl $0x6d, %esi
callq 0x4537c0
movq -0x10(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x46c270
movq -0x80(%rbp), %rdi
movl -0x68(%rbp), %edx
movq -0x50(%rbp), %rax
movl 0x58(%rax), %ecx
movl -0x28(%rbp), %r8d
movl $0x6e, %esi
callq 0x4537c0
movq -0x10(%rbp), %rdi
movq -0x50(%rbp), %rsi
callq 0x46c270
movq -0x80(%rbp), %rdi
movl $0x1, %esi
callq 0x411430
movq -0x80(%rbp), %rdi
movl -0x64(%rbp), %edx
movl $0x24, %esi
xorl %ecx, %ecx
callq 0x453790
movl %eax, -0x6c(%rbp)
movq -0x80(%rbp), %rdi
movl -0x64(%rbp), %edx
movl -0x8c(%rbp), %ecx
movl $0x80, %esi
movl $0x1, %r8d
callq 0x4537c0
movq -0x30(%rbp), %rax
movl 0x2c(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x49d06b
movl $0x0, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
movq -0x48(%rbp), %rcx
movzwl 0x60(%rcx), %ecx
cmpl %ecx, %eax
jge 0x49d042
movq -0x48(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x5c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xb0(%rbp)
movq -0xb0(%rbp), %rsi
leaq 0xdd32c(%rip), %rdi     # 0x57a355
callq 0x4096f0
cmpl $0x0, %eax
je 0x49d035
jmp 0x49d042
jmp 0x49d037
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0x49cff5
movl -0x5c(%rbp), %eax
movq -0x48(%rbp), %rcx
movzwl 0x60(%rcx), %ecx
cmpl %ecx, %eax
jne 0x49d069
movb $0x10, -0xa2(%rbp)
movq -0x80(%rbp), %rdi
movl -0x68(%rbp), %edx
movl $0x83, %esi
callq 0x46e2d0
jmp 0x49d06b
movq -0x40(%rbp), %rax
movl 0x40(%rax), %eax
andl $0x20, %eax
cmpl $0x0, %eax
je 0x49d09e
movq -0x50(%rbp), %rax
movw 0x63(%rax), %ax
andw $0x3, %ax
movzwl %ax, %eax
cmpl $0x2, %eax
jne 0x49d09e
movzbl -0xa2(%rbp), %eax
orl $0x1, %eax
movb %al, -0xa2(%rbp)
movq -0x80(%rbp), %rdi
movl -0x68(%rbp), %edx
movl -0x8c(%rbp), %ecx
movl $0x85, %esi
callq 0x453790
movq -0x80(%rbp), %rdi
movzbl -0xa2(%rbp), %eax
orl $0x8, %eax
movzwl %ax, %esi
callq 0x411430
movq -0x80(%rbp), %rdi
movl -0x64(%rbp), %edx
movl -0x6c(%rbp), %ecx
addl $0x1, %ecx
movl $0x5, %esi
callq 0x453790
movq -0x80(%rbp), %rdi
movl -0x6c(%rbp), %esi
callq 0x46bba0
movq -0x80(%rbp), %rdi
movl -0x64(%rbp), %edx
movl $0x75, %esi
xorl %ecx, %ecx
callq 0x453790
movq -0x80(%rbp), %rdi
movl -0x68(%rbp), %edx
movl $0x75, %esi
xorl %ecx, %ecx
callq 0x453790
movq -0x50(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x50(%rbp)
jmp 0x49cf03
cmpl $0x0, -0x78(%rbp)
je 0x49d137
movq -0x80(%rbp), %rdi
movl -0x78(%rbp), %esi
callq 0x46bba0
movq -0x10(%rbp), %rdi
movl -0x90(%rbp), %esi
callq 0x470060
movq -0x10(%rbp), %rdi
movl -0x8c(%rbp), %esi
callq 0x470060
cmpl $0x0, -0x74(%rbp)
je 0x49d19e
movq -0x10(%rbp), %rdi
callq 0x497ba0
movq -0x80(%rbp), %rdi
movl $0x45, %esi
xorl %ecx, %ecx
movl %ecx, %edx
callq 0x453790
movq -0x80(%rbp), %rdi
movl -0x74(%rbp), %esi
callq 0x46bba0
movq -0x80(%rbp), %rdi
movl -0x68(%rbp), %edx
movl $0x75, %esi
xorl %ecx, %ecx
callq 0x453790
movl $0x0, -0x4(%rbp)
jmp 0x49d1a5
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xc0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)