// File: /workspace/github_c_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
xorl %r15d, %r15d
testq %rdx, %rdx
je 0x473b5d
movq %rdi, %rbx
cmpq $0x0, 0x180(%rdi)
jne 0x473b5d
movq %rdx, %r14
cmpq $0x0, 0x68(%rdx)
jne 0x473b5d
movl %ecx, %r12d
movq %rsi, %r13
movl %r8d, 0x44(%rsp)
movq (%rbx), %rbp
movq %rbx, %rdi
callq 0x45ae46
testq %rax, %rax
jne 0x473b5d
movq %rbp, 0x50(%rsp)
cmpl $0x0, 0x54(%r13)
jne 0x473b5d
cmpl $0xb, %r12d
jne 0x473176
cmpw $0x0, 0x44(%r13)
js 0x473164
movzbl 0x4c(%r13), %eax
jmp 0x473169
movl $0xb, %eax
cmpl $0xb, %eax
movl $0x2, %r12d
cmovnel %eax, %r12d
movq 0x28(%r14), %rdx
cmpl $0x1, (%rdx)
jne 0x473b5d
cmpq $0x0, 0x30(%rdx)
jne 0x473b5d
cmpq $0x0, 0x30(%r14)
jne 0x473b5d
cmpq $0x0, 0x48(%r14)
jne 0x473b5d
cmpq $0x0, 0x38(%r14)
jne 0x473b5d
cmpq $0x0, 0x60(%r14)
jne 0x473b5d
cmpq $0x0, 0x50(%r14)
jne 0x473b5d
testb $0x1, 0xc(%r14)
jne 0x473b5d
movq (%r14), %rax
cmpl $0x1, (%rax)
jne 0x473b5d
movq 0x8(%rax), %rax
cmpb $-0x58, (%rax)
jne 0x473b5d
addq $0x8, %rdx
xorl %r15d, %r15d
movq %rbx, %rdi
xorl %esi, %esi
callq 0x458ad2
movq %rax, %rbp
testq %rax, %rax
sete %al
cmpq %r13, %rbp
sete %cl
orb %al, %cl
jne 0x473b5d
movl 0x40(%rbp), %eax
xorl 0x40(%r13), %eax
testb $0x20, %al
jne 0x473b5d
cmpl $0x0, 0x54(%rbp)
jne 0x473b5d
cmpq $0x0, 0x18(%rbp)
jne 0x473b5d
movzwl 0x46(%r13), %eax
movq %rax, 0x28(%rsp)
cmpw 0x46(%rbp), %ax
jne 0x473b5d
movzwl 0x44(%r13), %eax
cmpw 0x44(%rbp), %ax
jne 0x473b5d
cmpw $0x0, 0x28(%rsp)
jle 0x473357
movq 0x8(%r13), %rax
movq %rax, 0x18(%rsp)
movq 0x8(%rbp), %rax
movq %rax, 0x8(%rsp)
movq 0x28(%rsp), %rax
shll $0x5, %eax
movq %rax, 0x28(%rsp)
xorl %r15d, %r15d
xorl %r14d, %r14d
movq 0x18(%rsp), %rax
movb 0x19(%rax,%r14), %al
movq 0x8(%rsp), %rcx
cmpb 0x19(%rcx,%r14), %al
jne 0x473b5d
movq 0x18(%rsp), %rax
movq 0x10(%rax,%r14), %rdi
movq 0x8(%rsp), %rax
movq 0x10(%rax,%r14), %rsi
testq %rdi, %rdi
je 0x4732c8
testq %rsi, %rsi
je 0x4732d4
callq 0x407729
jmp 0x4732d9
negq %rsi
movl $0x0, %eax
sbbl %eax, %eax
jmp 0x4732d9
movl $0x1, %eax
testl %eax, %eax
jne 0x473b5d
movq 0x18(%rsp), %rax
cmpb $0x0, 0x18(%rax,%r14)
je 0x4732ff
movq 0x8(%rsp), %rax
cmpb $0x0, 0x18(%rax,%r14)
je 0x473b5d
testq %r14, %r14
je 0x473348
movq 0x18(%rsp), %rax
movq 0x8(%rax,%r14), %rax
testq %rax, %rax
sete %dl
movq 0x8(%rsp), %rcx
movq 0x8(%rcx,%r14), %rcx
testq %rcx, %rcx
setne %sil
cmpb %sil, %dl
je 0x473b5d
testq %rax, %rax
je 0x473348
movq 0x8(%rax), %rdi
movq 0x8(%rcx), %rsi
callq 0x4010c8
testl %eax, %eax
jne 0x473b5d
addq $0x20, %r14
cmpq %r14, 0x28(%rsp)
jne 0x473289
movq 0x10(%r13), %rax
movq %rax, 0x18(%rsp)
testq %rax, %rax
je 0x4733c2
xorl %r15d, %r15d
movl $0x0, 0x38(%rsp)
movq 0x18(%rsp), %rax
cmpb $0x0, 0x62(%rax)
movl 0x38(%rsp), %eax
movl $0x1, %ecx
cmovnel %ecx, %eax
movl %eax, 0x38(%rsp)
movq 0x10(%rbp), %r14
testq %r14, %r14
je 0x473b5d
movq 0x18(%rsp), %rdi
movq %r14, %rsi
callq 0x473fa9
testl %eax, %eax
jne 0x4733ad
movq 0x28(%r14), %r14
jmp 0x47338d
movq 0x18(%rsp), %rax
movq 0x28(%rax), %rax
movq %rax, 0x18(%rsp)
testq %rax, %rax
jne 0x473370
jmp 0x4733ca
movl $0x0, 0x38(%rsp)
movq 0x30(%r13), %rsi
testq %rsi, %rsi
je 0x4733e5
movq 0x30(%rbp), %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x452f83
testl %eax, %eax
jne 0x4733f7
movq 0x50(%rsp), %rax
movl 0x30(%rax), %eax
btl $0xe, %eax
jb 0x4733ff
testb %al, %al
jns 0x473415
xorl %r15d, %r15d
jmp 0x473b5d
xorl %r15d, %r15d
testb %al, %al
js 0x473b5d
cmpq $0x0, 0x20(%r13)
jne 0x473b5d
movq 0x70(%rbp), %rax
testq %rax, %rax
je 0x473445
movq 0x50(%rsp), %rcx
movq 0x20(%rcx), %rcx
addq $0x18, %rcx
movl $0xffffffff, 0x34(%rsp) # imm = 0xFFFFFFFF
incl 0x34(%rsp)
leaq 0x20(%rcx), %rdx
cmpq %rax, (%rcx)
movq %rdx, %rcx
jne 0x473433
jmp 0x47344d
movl $0xfff0bdc0, 0x34(%rsp) # imm = 0xFFF0BDC0
movq %rbx, %rdi
callq 0x44e8aa
movq %rax, 0x8(%rsp)
movq %rbx, %rdi
movl 0x34(%rsp), %esi
callq 0x454653
movl 0x34(%rbx), %eax
movq %rax, 0x28(%rsp)
addl $0x2, %eax
movl %eax, 0x34(%rbx)
movq %rbx, %rdi
movl 0x44(%rsp), %esi
movq %r13, %rdx
callq 0x473b6f
movl %eax, 0x18(%rsp)
movb 0x1f(%rbx), %al
testb %al, %al
je 0x4734a3
decb %al
movb %al, 0x1f(%rbx)
movzbl %al, %eax
movl 0xc4(%rbx,%rax,4), %eax
movl %eax, 0x30(%rsp)
jmp 0x4734af
movl 0x38(%rbx), %eax
incl %eax
movl %eax, 0x30(%rsp)
movl %eax, 0x38(%rbx)
movq 0x28(%rsp), %rax
incl %eax
movl %eax, 0x14(%rsp)
movb 0x1f(%rbx), %al
testb %al, %al
je 0x4734d6
decb %al
movb %al, 0x1f(%rbx)
movzbl %al, %eax
movl 0xc4(%rbx,%rax,4), %eax
movl %eax, 0x24(%rsp)
jmp 0x4734e2
movl 0x38(%rbx), %eax
incl %eax
movl %eax, 0x24(%rsp)
movl %eax, 0x38(%rbx)
movq %rbx, %rdi
movl 0x14(%rsp), %esi
movl 0x44(%rsp), %edx
movq %r13, %rcx
movl $0x6e, %r8d
callq 0x44eaae
movl $0x0, 0x4c(%rsp)
movq 0x50(%rsp), %rax
testb $0x4, 0x2c(%rax)
jne 0x4735a2
cmpw $0x0, 0x44(%r13)
jns 0x473521
cmpq $0x0, 0x10(%r13)
jne 0x473532
cmpl $0x0, 0x38(%rsp)
jne 0x473532
leal -0x3(%r12), %eax
cmpl $-0x3, %eax
ja 0x4735a2
movq 0x8(%rsp), %r15
movq %r15, %rdi
movl $0x24, %esi
movl 0x14(%rsp), %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x43bae0
movl %eax, %r14d
movq %r15, %rdi
movl $0xb, %esi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x43bae0
movl %eax, 0x4c(%rsp)
movl 0xb8(%r15), %eax
movq (%r15), %rcx
cmpb $0x0, 0x61(%rcx)
je 0x473581
leaq 0x131889(%rip), %rcx    # 0x5a4e08
jmp 0x47359f
leal -0x1(%rax), %ecx
testl %r14d, %r14d
cmovnsl %r14d, %ecx
movslq %ecx, %rcx
leaq (%rcx,%rcx,2), %rcx
shlq $0x3, %rcx
movq 0x8(%rsp), %rdx
addq 0x68(%rdx), %rcx
movl %eax, 0x8(%rcx)
testb $0x20, 0x40(%rbp)
jne 0x473656
movq %rbx, %rdi
movq 0x28(%rsp), %r14
movl %r14d, %esi
movl 0x34(%rsp), %edx
movq %rbp, %rcx
movl $0x6d, %r8d
callq 0x44eaae
movq 0x8(%rsp), %rdi
movl $0x24, %esi
movl %r14d, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x43bae0
movl %eax, 0x48(%rsp)
cmpw $0x0, 0x44(%r13)
js 0x473691
movq 0x8(%rsp), %r15
movq %r15, %rdi
movl $0x81, %esi
movq 0x28(%rsp), %rdx
movl 0x24(%rsp), %r14d
movl %r14d, %ecx
xorl %r8d, %r8d
callq 0x43bae0
movl %eax, 0x38(%rsp)
movq %r15, %rdi
movl $0x1f, %esi
movl 0x14(%rsp), %edx
xorl %ecx, %ecx
movl %r14d, %r8d
callq 0x43bae0
movl %eax, %r14d
movq %rbx, %rdi
movl %r12d, %esi
movq %r13, %rdx
callq 0x472df1
movl 0xb8(%r15), %eax
movq (%r15), %rcx
cmpb $0x0, 0x61(%rcx)
je 0x4736a9
leaq 0x1317b4(%rip), %rcx    # 0x5a4e08
jmp 0x4736c7
movl 0x38(%r13), %edx
movq (%r13), %r8
movq %rbx, %rdi
movl 0x44(%rsp), %esi
movl $0x1, %ecx
callq 0x44ebb0
movl 0x38(%rbp), %edx
movq (%rbp), %r8
movl $0x0, 0x48(%rsp)
movq %rbx, %rdi
movl 0x34(%rsp), %esi
xorl %ecx, %ecx
callq 0x44ebb0
jmp 0x4737f1
cmpq $0x0, 0x10(%r13)
je 0x4736ec
movq 0x8(%rsp), %rdi
movl $0x81, %esi
movq 0x28(%rsp), %rdx
jmp 0x4736fa
leal -0x1(%rax), %ecx
testl %r14d, %r14d
cmovnsl %r14d, %ecx
movslq %ecx, %rcx
leaq (%rcx,%rcx,2), %rcx
shlq $0x3, %rcx
movq 0x8(%rsp), %rdx
addq 0x68(%rdx), %rcx
movl %eax, 0x8(%rcx)
cmpl $0x0, 0x18(%rsp)
jle 0x47370a
movq 0x10(%rbx), %rdi
movl $0x98, %esi
movl 0x18(%rsp), %edx
movl 0x24(%rsp), %ecx
xorl %r8d, %r8d
callq 0x43bae0
jmp 0x47370a
movq 0x8(%rsp), %rdi
movl $0x79, %esi
movl 0x14(%rsp), %edx
movl 0x24(%rsp), %ecx
xorl %r8d, %r8d
callq 0x43bae0
movl %eax, 0x38(%rsp)
movq 0x8(%rsp), %rdi
movl $0x80, %esi
movq 0x28(%rsp), %rdx
movl 0x30(%rsp), %ecx
movl $0x1, %r8d
callq 0x43bae0
movw $0x29, %r14w
movq 0x50(%rsp), %rax
testb $0x4, 0x2c(%rax)
je 0x473755
movq 0x8(%rsp), %rdi
movl $0x83, %esi
movl 0x14(%rsp), %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x43bae0
movw $0x39, %r14w
movq 0x8(%rsp), %r15
movq %r15, %rdi
movl $0x7a, %esi
movl 0x14(%rsp), %edx
movl 0x30(%rsp), %ecx
movl 0x24(%rsp), %r8d
callq 0x43bae0
movq %r15, %rdi
movl %eax, %esi
movq %r13, %rdx
movl $0xfffffffa, %ecx       # imm = 0xFFFFFFFA
callq 0x40e507
movslq 0xb8(%r15), %rax
testq %rax, %rax
jle 0x4737a5
movq 0x8(%rsp), %rcx
movq 0x68(%rcx), %rcx
leaq (%rax,%rax,2), %rax
movw %r14w, -0x16(%rcx,%rax,8)
movq 0x8(%rsp), %r14
movq %r14, %rdi
movl $0x5, %esi
movq 0x28(%rsp), %r15
movl %r15d, %edx
movl 0x38(%rsp), %ecx
xorl %r8d, %r8d
callq 0x43bae0
movq %r14, %rdi
movl $0x75, %esi
movl %r15d, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x43bae0
movq %r14, %rdi
movl $0x75, %esi
movl 0x14(%rsp), %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x43bae0
movq 0x10(%r13), %rax
movq %rax, 0x18(%rsp)
testq %rax, %rax
je 0x473a42
movq 0x10(%rbp), %r12
testq %r12, %r12
je 0x473824
movq 0x18(%rsp), %rdi
movq %r12, %rsi
callq 0x473fa9
testl %eax, %eax
jne 0x473824
movq 0x28(%r12), %r12
jmp 0x473807
movl 0x58(%r12), %ecx
movq 0x8(%rsp), %r14
movq %r14, %rdi
movl $0x6d, %esi
movq 0x28(%rsp), %rdx
movl 0x34(%rsp), %r8d
callq 0x43bae0
movq %rbx, %rdi
movq %r12, %rsi
callq 0x44ecd4
movq 0x18(%rsp), %r15
movl 0x58(%r15), %ecx
movq %r14, %rdi
movl $0x6e, %esi
movl 0x14(%rsp), %edx
movl 0x44(%rsp), %r8d
callq 0x43bae0
movq %rbx, %rdi
movq %r15, %rsi
callq 0x44ecd4
movslq 0xb8(%r14), %rax
testq %rax, %rax
jle 0x47389a
movq 0x8(%rsp), %rcx
movq 0x68(%rcx), %rcx
leaq (%rax,%rax,2), %rax
movw $0x1, -0x16(%rcx,%rax,8)
xorl %r14d, %r14d
movq 0x8(%rsp), %r13
movq %r13, %rdi
movl $0x24, %esi
movq 0x28(%rsp), %r15
movl %r15d, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x43bae0
movq %rax, 0x38(%rsp)
movq %r13, %rdi
movl $0x80, %esi
movl %r15d, %edx
movl 0x30(%rsp), %ecx
movl $0x1, %r8d
callq 0x43bae0
movq 0x50(%rsp), %rax
testb $0x4, 0x2c(%rax)
je 0x473945
movzwl 0x60(%r12), %r15d
testl %r15d, %r15d
je 0x473920
movq 0x40(%r12), %r12
movl %r15d, %r13d
xorl %r14d, %r14d
movq (%r12,%r14,8), %rsi
testq %rsi, %rsi
je 0x473920
leaq 0xd92c4(%rip), %rdi     # 0x54cbd0
callq 0x407729
testl %eax, %eax
jne 0x473920
incq %r14
cmpq %r14, %r13
jne 0x4738fc
movl %r15d, %r14d
cmpl %r15d, %r14d
jne 0x473942
movq 0x8(%rsp), %rdi
movl $0x83, %esi
movl 0x14(%rsp), %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x43bae0
movb $0x10, %r14b
jmp 0x473945
xorl %r14d, %r14d
testb $0x20, 0x40(%rbp)
je 0x473961
movq 0x18(%rsp), %rax
movzwl 0x63(%rax), %eax
andl $0x3, %eax
cmpw $0x2, %ax
sete %al
orb %al, %r14b
movq 0x8(%rsp), %r12
movq %r12, %rdi
movl $0x85, %esi
movl 0x14(%rsp), %edx
movl 0x30(%rsp), %ecx
xorl %r8d, %r8d
callq 0x43bae0
movslq 0xb8(%r12), %rax
testq %rax, %rax
jle 0x4739a5
orb $0x8, %r14b
movzbl %r14b, %ecx
movq 0x8(%rsp), %rdx
movq 0x68(%rdx), %rdx
leaq (%rax,%rax,2), %rax
movw %cx, -0x16(%rdx,%rax,8)
movq 0x38(%rsp), %rax
leal 0x1(%rax), %ecx
movq 0x8(%rsp), %r14
movq %r14, %rdi
movl $0x5, %esi
movq 0x28(%rsp), %rdx
xorl %r8d, %r8d
callq 0x43bae0
movl 0xb8(%r14), %eax
movq (%r14), %rcx
cmpb $0x0, 0x61(%rcx)
leaq 0x13142c(%rip), %rcx    # 0x5a4e08
jne 0x4739ff
leal -0x1(%rax), %ecx
movq 0x38(%rsp), %rdx
testl %edx, %edx
cmovnsl %edx, %ecx
movslq %ecx, %rcx
leaq (%rcx,%rcx,2), %rcx
shlq $0x3, %rcx
movq 0x8(%rsp), %rdx
addq 0x68(%rdx), %rcx
movl %eax, 0x8(%rcx)
movq 0x8(%rsp), %r14
movq %r14, %rdi
movl $0x75, %esi
movq 0x28(%rsp), %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x43bae0
movq %r14, %rdi
movl $0x75, %esi
movl 0x14(%rsp), %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x43bae0
movq 0x18(%rsp), %rax
movq 0x28(%rax), %rax
jmp 0x4737f5
cmpl $0x0, 0x48(%rsp)
je 0x473a89
movq 0x8(%rsp), %rcx
movl 0xb8(%rcx), %eax
movq (%rcx), %rcx
cmpb $0x0, 0x61(%rcx)
je 0x473a66
leaq 0x1313a4(%rip), %rcx    # 0x5a4e08
jmp 0x473a86
leal -0x1(%rax), %ecx
movl 0x48(%rsp), %edx
testl %edx, %edx
cmovnsl %edx, %ecx
movslq %ecx, %rcx
leaq (%rcx,%rcx,2), %rcx
shlq $0x3, %rcx
movq 0x8(%rsp), %rdx
addq 0x68(%rdx), %rcx
movl %eax, 0x8(%rcx)
cmpl $0x0, 0x24(%rsp)
je 0x473aab
movzbl 0x1f(%rbx), %eax
cmpq $0x7, %rax
ja 0x473aab
leal 0x1(%rax), %ecx
movb %cl, 0x1f(%rbx)
movl 0x24(%rsp), %ecx
movl %ecx, 0xc4(%rbx,%rax,4)
cmpl $0x0, 0x30(%rsp)
je 0x473acd
movzbl 0x1f(%rbx), %eax
cmpq $0x7, %rax
ja 0x473acd
leal 0x1(%rax), %ecx
movb %cl, 0x1f(%rbx)
movl 0x30(%rsp), %ecx
movl %ecx, 0xc4(%rbx,%rax,4)
cmpl $0x0, 0x4c(%rsp)
je 0x473b1a
cmpq $0x0, 0x98(%rbx)
je 0x473ae6
movq %rbx, %rdi
callq 0x471451
xorl %r15d, %r15d
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
movl $0x45, %esi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x43bae0
movl 0xb8(%rbx), %eax
movq (%rbx), %rcx
cmpb $0x0, 0x61(%rcx)
je 0x473b22
leaq 0x1312f0(%rip), %rcx    # 0x5a4e08
jmp 0x473b42
movl $0x1, %r15d
jmp 0x473b5d
leal -0x1(%rax), %ecx
movl 0x4c(%rsp), %edx
testl %edx, %edx
cmovnsl %edx, %ecx
movslq %ecx, %rcx
leaq (%rcx,%rcx,2), %rcx
shlq $0x3, %rcx
movq 0x8(%rsp), %rdx
addq 0x68(%rdx), %rcx
movl %eax, 0x8(%rcx)
movq 0x8(%rsp), %rdi
movl $0x75, %esi
movl 0x14(%rsp), %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x43bae0
movl %r15d, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq