// File: /workspace/github_c_makefile_star2_O0/skeeto[P]flappy/sqlite3.c
// Function: sqlite3DeleteFrom
SQLITE_PRIVATE void sqlite3DeleteFrom(
  Parse *pParse,         /* The parser context */
  SrcList *pTabList,     /* The table from which we should delete things */
  Expr *pWhere           /* The WHERE clause.  May be null */
){
  Vdbe *v;               /* The virtual database engine */
  Table *pTab;           /* The table from which records will be deleted */
  const char *zDb;       /* Name of database holding pTab */
  int i;                 /* Loop counter */
  WhereInfo *pWInfo;     /* Information about the WHERE clause */
  Index *pIdx;           /* For looping over indices of the table */
  int iTabCur;           /* Cursor number for the table */
  int iDataCur;          /* VDBE cursor for the canonical data source */
  int iIdxCur;           /* Cursor number of the first index */
  int nIdx;              /* Number of indices */
  sqlite3 *db;           /* Main database structure */
  AuthContext sContext;  /* Authorization context */
  NameContext sNC;       /* Name context to resolve expressions in */
  int iDb;               /* Database number */
  int memCnt = -1;       /* Memory cell used for change counting */
  int rcauth;            /* Value returned by authorization callback */
  int okOnePass;         /* True for one-pass algorithm without the FIFO */
  int aiCurOnePass[2];   /* The write cursors opened by WHERE_ONEPASS */
  u8 *aToOpen = 0;       /* Open cursor iTabCur+j if aToOpen[j] is true */
  Index *pPk;            /* The PRIMARY KEY index on the table */
  int iPk = 0;           /* First of nPk registers holding PRIMARY KEY value */
  i16 nPk = 1;           /* Number of columns in the PRIMARY KEY */
  int iKey;              /* Memory cell holding key of row to be deleted */
  i16 nKey;              /* Number of memory cells in the row key */
  int iEphCur = 0;       /* Ephemeral table holding all primary key values */
  int iRowSet = 0;       /* Register for rowset of rows to delete */
  int addrBypass = 0;    /* Address of jump over the delete logic */
  int addrLoop = 0;      /* Top of the delete loop */
  int addrDelete = 0;    /* Jump directly to the delete logic */
  int addrEphOpen = 0;   /* Instruction to open the Ephermeral table */
 
#ifndef SQLITE_OMIT_TRIGGER
  int isView;                  /* True if attempting to delete from a view */
  Trigger *pTrigger;           /* List of table triggers, if required */
#endif

  memset(&sContext, 0, sizeof(sContext));
  db = pParse->db;
  if( pParse->nErr || db->mallocFailed ){
    goto delete_from_cleanup;
  }
  assert( pTabList->nSrc==1 );

  /* Locate the table which we want to delete.  This table has to be
  ** put in an SrcList structure because some of the subroutines we
  ** will be calling are designed to work with multiple tables and expect
  ** an SrcList* parameter instead of just a Table* parameter.
  */
  pTab = sqlite3SrcListLookup(pParse, pTabList);
  if( pTab==0 )  goto delete_from_cleanup;

  /* Figure out if we have any triggers and if the table being
  ** deleted from is a view
  */
#ifndef SQLITE_OMIT_TRIGGER
  pTrigger = sqlite3TriggersExist(pParse, pTab, TK_DELETE, 0, 0);
  isView = pTab->pSelect!=0;
#else
# define pTrigger 0
# define isView 0
#endif
#ifdef SQLITE_OMIT_VIEW
# undef isView
# define isView 0
#endif

  /* If pTab is really a view, make sure it has been initialized.
  */
  if( sqlite3ViewGetColumnNames(pParse, pTab) ){
    goto delete_from_cleanup;
  }

  if( sqlite3IsReadOnly(pParse, pTab, (pTrigger?1:0)) ){
    goto delete_from_cleanup;
  }
  iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
  assert( iDb<db->nDb );
  zDb = db->aDb[iDb].zName;
  rcauth = sqlite3AuthCheck(pParse, SQLITE_DELETE, pTab->zName, 0, zDb);
  assert( rcauth==SQLITE_OK || rcauth==SQLITE_DENY || rcauth==SQLITE_IGNORE );
  if( rcauth==SQLITE_DENY ){
    goto delete_from_cleanup;
  }
  assert(!isView || pTrigger);

  /* Assign cursor numbers to the table and all its indices.
  */
  assert( pTabList->nSrc==1 );
  iTabCur = pTabList->a[0].iCursor = pParse->nTab++;
  for(nIdx=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, nIdx++){
    pParse->nTab++;
  }

  /* Start the view context
  */
  if( isView ){
    sqlite3AuthContextPush(pParse, &sContext, pTab->zName);
  }

  /* Begin generating code.
  */
  v = sqlite3GetVdbe(pParse);
  if( v==0 ){
    goto delete_from_cleanup;
  }
  if( pParse->nested==0 ) sqlite3VdbeCountChanges(v);
  sqlite3BeginWriteOperation(pParse, 1, iDb);

  /* If we are trying to delete from a view, realize that view into
  ** a ephemeral table.
  */
#if !defined(SQLITE_OMIT_VIEW) && !defined(SQLITE_OMIT_TRIGGER)
  if( isView ){
    sqlite3MaterializeView(pParse, pTab, pWhere, iTabCur);
    iDataCur = iIdxCur = iTabCur;
  }
#endif

  /* Resolve the column names in the WHERE clause.
  */
  memset(&sNC, 0, sizeof(sNC));
  sNC.pParse = pParse;
  sNC.pSrcList = pTabList;
  if( sqlite3ResolveExprNames(&sNC, pWhere) ){
    goto delete_from_cleanup;
  }

  /* Initialize the counter of the number of rows deleted, if
  ** we are counting rows.
  */
  if( db->flags & SQLITE_CountRows ){
    memCnt = ++pParse->nMem;
    sqlite3VdbeAddOp2(v, OP_Integer, 0, memCnt);
  }

#ifndef SQLITE_OMIT_TRUNCATE_OPTIMIZATION
  /* Special case: A DELETE without a WHERE clause deletes everything.
  ** It is easier just to erase the whole table. Prior to version 3.6.5,
  ** this optimization caused the row change count (the value returned by 
  ** API function sqlite3_count_changes) to be set incorrectly.  */
  if( rcauth==SQLITE_OK && pWhere==0 && !pTrigger && !IsVirtual(pTab) 
   && 0==sqlite3FkRequired(pParse, pTab, 0, 0)
  ){
    assert( !isView );
    sqlite3TableLock(pParse, iDb, pTab->tnum, 1, pTab->zName);
    if( HasRowid(pTab) ){
      sqlite3VdbeAddOp4(v, OP_Clear, pTab->tnum, iDb, memCnt,
                        pTab->zName, P4_STATIC);
    }
    for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
      assert( pIdx->pSchema==pTab->pSchema );
      sqlite3VdbeAddOp2(v, OP_Clear, pIdx->tnum, iDb);
    }
  }else
#endif /* SQLITE_OMIT_TRUNCATE_OPTIMIZATION */
  {
    if( HasRowid(pTab) ){
      /* For a rowid table, initialize the RowSet to an empty set */
      pPk = 0;
      nPk = 1;
      iRowSet = ++pParse->nMem;
      sqlite3VdbeAddOp2(v, OP_Null, 0, iRowSet);
    }else{
      /* For a WITHOUT ROWID table, create an ephermeral table used to
      ** hold all primary keys for rows to be deleted. */
      pPk = sqlite3PrimaryKeyIndex(pTab);
      assert( pPk!=0 );
      nPk = pPk->nKeyCol;
      iPk = pParse->nMem+1;
      pParse->nMem += nPk;
      iEphCur = pParse->nTab++;
      addrEphOpen = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, iEphCur, nPk);
      sqlite3VdbeSetP4KeyInfo(pParse, pPk);
    }
  
    /* Construct a query to find the rowid or primary key for every row
    ** to be deleted, based on the WHERE clause.
    */
    pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, 0, 0, 
                               WHERE_ONEPASS_DESIRED|WHERE_DUPLICATES_OK,
                               iTabCur+1);
    if( pWInfo==0 ) goto delete_from_cleanup;
    okOnePass = sqlite3WhereOkOnePass(pWInfo, aiCurOnePass);
  
    /* Keep track of the number of rows to be deleted */
    if( db->flags & SQLITE_CountRows ){
      sqlite3VdbeAddOp2(v, OP_AddImm, memCnt, 1);
    }
  
    /* Extract the rowid or primary key for the current row */
    if( pPk ){
      for(i=0; i<nPk; i++){
        sqlite3ExprCodeGetColumnOfTable(v, pTab, iTabCur,
                                        pPk->aiColumn[i], iPk+i);
      }
      iKey = iPk;
    }else{
      iKey = pParse->nMem + 1;
      iKey = sqlite3ExprCodeGetColumn(pParse, pTab, -1, iTabCur, iKey, 0);
      if( iKey>pParse->nMem ) pParse->nMem = iKey;
    }
  
    if( okOnePass ){
      /* For ONEPASS, no need to store the rowid/primary-key.  There is only
      ** one, so just keep it in its register(s) and fall through to the
      ** delete code.
      */
      nKey = nPk; /* OP_Found will use an unpacked key */
      aToOpen = sqlite3DbMallocRaw(db, nIdx+2);
      if( aToOpen==0 ){
        sqlite3WhereEnd(pWInfo);
        goto delete_from_cleanup;
      }
      memset(aToOpen, 1, nIdx+1);
      aToOpen[nIdx+1] = 0;
      if( aiCurOnePass[0]>=0 ) aToOpen[aiCurOnePass[0]-iTabCur] = 0;
      if( aiCurOnePass[1]>=0 ) aToOpen[aiCurOnePass[1]-iTabCur] = 0;
      if( addrEphOpen ) sqlite3VdbeChangeToNoop(v, addrEphOpen);
      addrDelete = sqlite3VdbeAddOp0(v, OP_Goto); /* Jump to DELETE logic */
    }else if( pPk ){
      /* Construct a composite key for the row to be deleted and remember it */
      iKey = ++pParse->nMem;
      nKey = 0;   /* Zero tells OP_Found to use a composite key */
      sqlite3VdbeAddOp4(v, OP_MakeRecord, iPk, nPk, iKey,
                        sqlite3IndexAffinityStr(v, pPk), P4_TRANSIENT);
      sqlite3VdbeAddOp2(v, OP_IdxInsert, iEphCur, iKey);
    }else{
      /* Get the rowid of the row to be deleted and remember it in the RowSet */
      nKey = 1;  /* OP_Seek always uses a single rowid */
      sqlite3VdbeAddOp2(v, OP_RowSetAdd, iRowSet, iKey);
    }
  
    /* End of the WHERE loop */
    sqlite3WhereEnd(pWInfo);
    if( okOnePass ){
      /* Bypass the delete logic below if the WHERE loop found zero rows */
      addrBypass = sqlite3VdbeMakeLabel(v);
      sqlite3VdbeAddOp2(v, OP_Goto, 0, addrBypass);
      sqlite3VdbeJumpHere(v, addrDelete);
    }
  
    /* Unless this is a view, open cursors for the table we are 
    ** deleting from and all its indices. If this is a view, then the
    ** only effect this statement has is to fire the INSTEAD OF 
    ** triggers.
    */
    if( !isView ){
      sqlite3OpenTableAndIndices(pParse, pTab, OP_OpenWrite, iTabCur, aToOpen,
                                 &iDataCur, &iIdxCur);
      assert( pPk || iDataCur==iTabCur );
      assert( pPk || iIdxCur==iDataCur+1 );
    }
  
    /* Set up a loop over the rowids/primary-keys that were found in the
    ** where-clause loop above.
    */
    if( okOnePass ){
      /* Just one row.  Hence the top-of-loop is a no-op */
      assert( nKey==nPk ); /* OP_Found will use an unpacked key */
      if( aToOpen[iDataCur-iTabCur] ){
        assert( pPk!=0 );
        sqlite3VdbeAddOp4Int(v, OP_NotFound, iDataCur, addrBypass, iKey, nKey);
      }
    }else if( pPk ){
      addrLoop = sqlite3VdbeAddOp1(v, OP_Rewind, iEphCur);
      sqlite3VdbeAddOp2(v, OP_RowKey, iEphCur, iKey);
      assert( nKey==0 );  /* OP_Found will use a composite key */
    }else{
      addrLoop = sqlite3VdbeAddOp3(v, OP_RowSetRead, iRowSet, 0, iKey);
      assert( nKey==1 );
    }  
  
    /* Delete the row */
#ifndef SQLITE_OMIT_VIRTUALTABLE
    if( IsVirtual(pTab) ){
      const char *pVTab = (const char *)sqlite3GetVTable(db, pTab);
      sqlite3VtabMakeWritable(pParse, pTab);
      sqlite3VdbeAddOp4(v, OP_VUpdate, 0, 1, iKey, pVTab, P4_VTAB);
      sqlite3VdbeChangeP5(v, OE_Abort);
      sqlite3MayAbort(pParse);
    }else
#endif
    {
      int count = (pParse->nested==0);    /* True to count changes */
      sqlite3GenerateRowDelete(pParse, pTab, pTrigger, iDataCur, iIdxCur,
                               iKey, nKey, count, OE_Default, okOnePass);
    }
  
    /* End of the loop over all rowids/primary-keys. */
    if( okOnePass ){
      sqlite3VdbeResolveLabel(v, addrBypass);
    }else if( pPk ){
      sqlite3VdbeAddOp2(v, OP_Next, iEphCur, addrLoop+1);
      sqlite3VdbeJumpHere(v, addrLoop);
    }else{
      sqlite3VdbeAddOp2(v, OP_Goto, 0, addrLoop);
      sqlite3VdbeJumpHere(v, addrLoop);
    }     
  
    /* Close the cursors open on the table and its indexes. */
    if( !isView && !IsVirtual(pTab) ){
      if( !pPk ) sqlite3VdbeAddOp1(v, OP_Close, iDataCur);
      for(i=0, pIdx=pTab->pIndex; pIdx; i++, pIdx=pIdx->pNext){
        sqlite3VdbeAddOp1(v, OP_Close, iIdxCur + i);
      }
    }
  } /* End non-truncate path */

  /* Update the sqlite_sequence table by storing the content of the
  ** maximum rowid counter values recorded while inserting into
  ** autoincrement tables.
  */
  if( pParse->nested==0 && pParse->pTriggerTab==0 ){
    sqlite3AutoincrementEnd(pParse);
  }

  /* Return the number of rows that were deleted. If this routine is 
  ** generating code because of a call to sqlite3NestedParse(), do not
  ** invoke the callback function.
  */
  if( (db->flags&SQLITE_CountRows) && !pParse->nested && !pParse->pTriggerTab ){
    sqlite3VdbeAddOp2(v, OP_ResultRow, memCnt, 1);
    sqlite3VdbeSetNumCols(v, 1);
    sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "rows deleted", SQLITE_STATIC);
  }

delete_from_cleanup:
  sqlite3AuthContextPop(&sContext);
  sqlite3SrcListDelete(db, pTabList);
  sqlite3ExprDelete(db, pWhere);
  sqlite3DbFree(db, aToOpen);
  return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x150, %rsp            # imm = 0x150
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl $0xffffffff, -0xb0(%rbp) # imm = 0xFFFFFFFF
movq $0x0, -0xc8(%rbp)
movl $0x0, -0xd4(%rbp)
movw $0x1, -0xd6(%rbp)
movl $0x0, -0xe4(%rbp)
movl $0x0, -0xe8(%rbp)
movl $0x0, -0xec(%rbp)
movl $0x0, -0xf0(%rbp)
movl $0x0, -0xf4(%rbp)
movl $0x0, -0xf8(%rbp)
leaq -0x70(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x71a0
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x60(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x0, 0x50(%rax)
jne 0x59a5d
movq -0x60(%rbp), %rax
movzbl 0x50(%rax), %eax
cmpl $0x0, %eax
je 0x59a62
jmp 0x5a512
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x71360
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x59a7f
jmp 0x5a512
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
movl $0x6b, %edx
xorl %eax, %eax
movl %eax, %r8d
movq %r8, %rcx
callq 0x836d0
movq %rax, -0x108(%rbp)
movq -0x28(%rbp), %rax
cmpq $0x0, 0x18(%rax)
setne %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0xfc(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x6f8a0
cmpl $0x0, %eax
je 0x59ace
jmp 0x5a512
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x108(%rbp), %rcx
xorl %edx, %edx
movl $0x1, %eax
cmpq $0x0, %rcx
cmovnel %eax, %edx
callq 0x837b0
cmpl $0x0, %eax
je 0x59afa
jmp 0x5a512
movq -0x60(%rbp), %rdi
movq -0x28(%rbp), %rax
movq 0x70(%rax), %rsi
callq 0x16b60
movl %eax, -0xac(%rbp)
movq -0x60(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0xac(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rax
movq (%rax), %rdx
movq -0x30(%rbp), %r8
movl $0x9, %esi
xorl %eax, %eax
movl %eax, %ecx
callq 0x6a8a0
movl %eax, -0xb4(%rbp)
cmpl $0x1, -0xb4(%rbp)
jne 0x59b5f
jmp 0x5a512
movq -0x8(%rbp), %rcx
movl 0x54(%rcx), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, 0x54(%rcx)
movq -0x10(%rbp), %rcx
movl %eax, 0x44(%rcx)
movl %eax, -0x4c(%rbp)
movl $0x0, -0x58(%rbp)
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
je 0x59bb6
movq -0x8(%rbp), %rax
movl 0x54(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x54(%rax)
movq -0x48(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x48(%rbp)
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0x59b8b
cmpl $0x0, -0xfc(%rbp)
je 0x59bd3
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rax
movq (%rax), %rdx
leaq -0x70(%rbp), %rsi
callq 0x83890
movq -0x8(%rbp), %rdi
callq 0x638c0
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x59bec
jmp 0x5a512
movq -0x8(%rbp), %rax
movzbl 0x1e(%rax), %eax
cmpl $0x0, %eax
jne 0x59c02
movq -0x20(%rbp), %rdi
callq 0x838d0
movq -0x8(%rbp), %rdi
movl -0xac(%rbp), %edx
movl $0x1, %esi
callq 0x6acb0
cmpl $0x0, -0xfc(%rbp)
je 0x59c3c
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x18(%rbp), %rdx
movl -0x4c(%rbp), %ecx
callq 0x83900
movl -0x4c(%rbp), %eax
movl %eax, -0x54(%rbp)
movl %eax, -0x50(%rbp)
leaq -0xa8(%rbp), %rdi
xorl %esi, %esi
movl $0x38, %edx
callq 0x71a0
movq -0x8(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq -0x18(%rbp), %rsi
leaq -0xa8(%rbp), %rdi
callq 0x6bca0
cmpl $0x0, %eax
je 0x59c7f
jmp 0x5a512
movq -0x60(%rbp), %rax
movl 0x2c(%rax), %eax
andl $0x80, %eax
cmpl $0x0, %eax
je 0x59cb9
movq -0x8(%rbp), %rcx
movl 0x58(%rcx), %eax
addl $0x1, %eax
movl %eax, 0x58(%rcx)
movl %eax, -0xb0(%rbp)
movq -0x20(%rbp), %rdi
movl -0xb0(%rbp), %ecx
movl $0x17, %esi
xorl %edx, %edx
callq 0x63980
cmpl $0x0, -0xb4(%rbp)
jne 0x59db5
cmpq $0x0, -0x18(%rbp)
jne 0x59db5
cmpq $0x0, -0x108(%rbp)
jne 0x59db5
movq -0x28(%rbp), %rax
movzbl 0x48(%rax), %eax
andl $0x10, %eax
cmpl $0x0, %eax
jne 0x59db5
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
xorl %ecx, %ecx
callq 0x83a40
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x59db5
movq -0x8(%rbp), %rdi
movl -0xac(%rbp), %esi
movq -0x28(%rbp), %rax
movl 0x3c(%rax), %edx
movq -0x28(%rbp), %rax
movq (%rax), %r8
movl $0x1, %ecx
callq 0x63f00
movq -0x28(%rbp), %rax
movzbl 0x48(%rax), %eax
andl $0x20, %eax
cmpl $0x0, %eax
jne 0x59d74
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rax
movl 0x3c(%rax), %edx
movl -0xac(%rbp), %ecx
movl -0xb0(%rbp), %r8d
movq -0x28(%rbp), %rax
movq (%rax), %r9
movl $0x6f, %esi
movl $0xfffffffe, (%rsp)     # imm = 0xFFFFFFFE
callq 0x63a70
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
je 0x59db0
movq -0x20(%rbp), %rdi
movq -0x48(%rbp), %rax
movl 0x58(%rax), %edx
movl -0xac(%rbp), %ecx
movl $0x6f, %esi
callq 0x63980
movq -0x48(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x48(%rbp)
jmp 0x59d80
jmp 0x5a483
movq -0x28(%rbp), %rax
movzbl 0x48(%rax), %eax
andl $0x20, %eax
cmpl $0x0, %eax
jne 0x59e07
movq $0x0, -0xd0(%rbp)
movw $0x1, -0xd6(%rbp)
movq -0x8(%rbp), %rcx
movl 0x58(%rcx), %eax
addl $0x1, %eax
movl %eax, 0x58(%rcx)
movl %eax, -0xe8(%rbp)
movq -0x20(%rbp), %rdi
movl -0xe8(%rbp), %ecx
movl $0x1a, %esi
xorl %edx, %edx
callq 0x63980
jmp 0x59e90
movq -0x28(%rbp), %rdi
callq 0x4b190
movq %rax, -0xd0(%rbp)
movq -0xd0(%rbp), %rax
movw 0x5e(%rax), %ax
movw %ax, -0xd6(%rbp)
movq -0x8(%rbp), %rax
movl 0x58(%rax), %eax
addl $0x1, %eax
movl %eax, -0xd4(%rbp)
movswl -0xd6(%rbp), %ecx
movq -0x8(%rbp), %rax
addl 0x58(%rax), %ecx
movl %ecx, 0x58(%rax)
movq -0x8(%rbp), %rcx
movl 0x54(%rcx), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, 0x54(%rcx)
movl %eax, -0xe4(%rbp)
movq -0x20(%rbp), %rdi
movl -0xe4(%rbp), %edx
movswl -0xd6(%rbp), %ecx
movl $0x35, %esi
callq 0x63980
movl %eax, -0xf8(%rbp)
movq -0x8(%rbp), %rdi
movq -0xd0(%rbp), %rsi
callq 0x64100
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movl -0x4c(%rbp), %eax
addl $0x1, %eax
xorl %ecx, %ecx
movl %ecx, %r8d
movl $0xc, %r9d
movq %r8, %rcx
movl %eax, (%rsp)
callq 0x746d0
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x59ec8
jmp 0x5a512
movq -0x40(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x83b50
movl %eax, -0xb8(%rbp)
movq -0x60(%rbp), %rax
movl 0x2c(%rax), %eax
andl $0x80, %eax
cmpl $0x0, %eax
je 0x59f08
movq -0x20(%rbp), %rdi
movl -0xb0(%rbp), %edx
movl $0x22, %esi
movl $0x1, %ecx
callq 0x63980
cmpq $0x0, -0xd0(%rbp)
je 0x59f6e
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
movswl -0xd6(%rbp), %ecx
cmpl %ecx, %eax
jge 0x59f60
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
movl -0x4c(%rbp), %edx
movq -0xd0(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x34(%rbp), %rcx
movswl (%rax,%rcx,2), %ecx
movl -0xd4(%rbp), %r8d
addl -0x34(%rbp), %r8d
callq 0x678d0
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x59f19
movl -0xd4(%rbp), %eax
movl %eax, -0xdc(%rbp)
jmp 0x59fc1
movq -0x8(%rbp), %rax
movl 0x58(%rax), %eax
addl $0x1, %eax
movl %eax, -0xdc(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
movl -0x4c(%rbp), %ecx
movl -0xdc(%rbp), %r8d
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
xorl %r9d, %r9d
callq 0x65a30
movl %eax, -0xdc(%rbp)
movl -0xdc(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x58(%rcx), %eax
jle 0x59fbf
movl -0xdc(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x58(%rax)
jmp 0x59fc1
cmpl $0x0, -0xb8(%rbp)
je 0x5a0a9
movw -0xd6(%rbp), %ax
movw %ax, -0xde(%rbp)
movq -0x60(%rbp), %rdi
movl -0x58(%rbp), %esi
addl $0x2, %esi
callq 0x16700
movq %rax, -0xc8(%rbp)
cmpq $0x0, -0xc8(%rbp)
jne 0x5a00a
movq -0x40(%rbp), %rdi
callq 0x75aa0
jmp 0x5a512
movq -0xc8(%rbp), %rdi
movl -0x58(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdx
movl $0x1, %esi
callq 0x71a0
movq -0xc8(%rbp), %rax
movl -0x58(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movb $0x0, (%rax,%rcx)
cmpl $0x0, -0xc0(%rbp)
jl 0x5a058
movq -0xc8(%rbp), %rax
movl -0xc0(%rbp), %ecx
subl -0x4c(%rbp), %ecx
movslq %ecx, %rcx
movb $0x0, (%rax,%rcx)
cmpl $0x0, -0xbc(%rbp)
jl 0x5a078
movq -0xc8(%rbp), %rax
movl -0xbc(%rbp), %ecx
subl -0x4c(%rbp), %ecx
movslq %ecx, %rcx
movb $0x0, (%rax,%rcx)
cmpl $0x0, -0xf8(%rbp)
je 0x5a090
movq -0x20(%rbp), %rdi
movl -0xf8(%rbp), %esi
callq 0x16fd0
movq -0x20(%rbp), %rdi
movl $0x10, %esi
callq 0x63920
movl %eax, -0xf4(%rbp)
jmp 0x5a184
cmpq $0x0, -0xd0(%rbp)
je 0x5a15f
movq -0x8(%rbp), %rcx
movl 0x58(%rcx), %eax
addl $0x1, %eax
movl %eax, 0x58(%rcx)
movl %eax, -0xdc(%rbp)
movw $0x0, -0xde(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x128(%rbp)
movl -0xd4(%rbp), %eax
movl %eax, -0x120(%rbp)
movswl -0xd6(%rbp), %eax
movl %eax, -0x11c(%rbp)
movl -0xdc(%rbp), %eax
movl %eax, -0x118(%rbp)
movq -0x20(%rbp), %rdi
movq -0xd0(%rbp), %rsi
callq 0x72130
movq -0x128(%rbp), %rdi
movl -0x120(%rbp), %edx
movl -0x11c(%rbp), %ecx
movl -0x118(%rbp), %r8d
movq %rax, %r9
movl $0x2d, %esi
xorl %eax, %eax
movl $0x0, (%rsp)
callq 0x63a70
movq -0x20(%rbp), %rdi
movl -0xe4(%rbp), %edx
movl -0xdc(%rbp), %ecx
movl $0x69, %esi
callq 0x63980
jmp 0x5a182
movw $0x1, -0xde(%rbp)
movq -0x20(%rbp), %rdi
movl -0xe8(%rbp), %edx
movl -0xdc(%rbp), %ecx
movl $0x78, %esi
callq 0x63980
jmp 0x5a184
movq -0x40(%rbp), %rdi
callq 0x75aa0
cmpl $0x0, -0xb8(%rbp)
je 0x5a1ca
movq -0x20(%rbp), %rdi
callq 0x662a0
movl %eax, -0xec(%rbp)
movq -0x20(%rbp), %rdi
movl -0xec(%rbp), %ecx
movl $0x10, %esi
xorl %edx, %edx
callq 0x63980
movq -0x20(%rbp), %rdi
movl -0xf4(%rbp), %esi
callq 0x63950
cmpl $0x0, -0xfc(%rbp)
jne 0x5a1fb
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
movl -0x4c(%rbp), %ecx
movq -0xc8(%rbp), %r8
movl $0x33, %edx
leaq -0x50(%rbp), %r9
leaq -0x54(%rbp), %rax
movq %rax, (%rsp)
callq 0x83b80
cmpl $0x0, -0xb8(%rbp)
je 0x5a242
movq -0xc8(%rbp), %rax
movl -0x50(%rbp), %ecx
subl -0x4c(%rbp), %ecx
movslq %ecx, %rcx
cmpb $0x0, (%rax,%rcx)
je 0x5a240
movq -0x20(%rbp), %rdi
movl -0x50(%rbp), %edx
movl -0xec(%rbp), %ecx
movl -0xdc(%rbp), %r8d
movswl -0xde(%rbp), %r9d
movl $0x3f, %esi
callq 0x640a0
jmp 0x5a2a7
cmpq $0x0, -0xd0(%rbp)
je 0x5a282
movq -0x20(%rbp), %rdi
movl -0xe4(%rbp), %edx
movl $0x67, %esi
callq 0x66020
movl %eax, -0xf0(%rbp)
movq -0x20(%rbp), %rdi
movl -0xe4(%rbp), %edx
movl -0xdc(%rbp), %ecx
movl $0x60, %esi
callq 0x63980
jmp 0x5a2a5
movq -0x20(%rbp), %rdi
movl -0xe8(%rbp), %edx
movl -0xdc(%rbp), %r8d
movl $0x79, %esi
xorl %ecx, %ecx
callq 0x639b0
movl %eax, -0xf0(%rbp)
jmp 0x5a2a7
movq -0x28(%rbp), %rax
movzbl 0x48(%rax), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0x5a31b
movq -0x60(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x4dec0
movq %rax, -0x110(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x83d80
movq -0x20(%rbp), %rdi
movl -0xdc(%rbp), %r8d
movq -0x110(%rbp), %r9
movl $0xf, %esi
xorl %edx, %edx
movl $0x1, %ecx
movl $0xfffffff6, (%rsp)     # imm = 0xFFFFFFF6
callq 0x63a70
movq -0x20(%rbp), %rdi
movl $0x2, %esi
callq 0x63ec0
movq -0x8(%rbp), %rdi
callq 0x67780
jmp 0x5a38d
movq -0x8(%rbp), %rax
movzbl 0x1e(%rax), %eax
cmpl $0x0, %eax
sete %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x114(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x108(%rbp), %rdx
movl -0x50(%rbp), %ecx
movl -0x54(%rbp), %r8d
movl -0xdc(%rbp), %r9d
movw -0xde(%rbp), %r11w
movl -0x114(%rbp), %eax
movb %al, %r10b
movl -0xb8(%rbp), %eax
movswl %r11w, %r11d
movl %r11d, (%rsp)
movzbl %r10b, %r10d
movl %r10d, 0x8(%rsp)
movl $0xa, 0x10(%rsp)
movzbl %al, %eax
movl %eax, 0x18(%rsp)
callq 0x83e90
cmpl $0x0, -0xb8(%rbp)
je 0x5a3a7
movq -0x20(%rbp), %rdi
movl -0xec(%rbp), %esi
callq 0x66470
jmp 0x5a406
cmpq $0x0, -0xd0(%rbp)
je 0x5a3df
movq -0x20(%rbp), %rdi
movl -0xe4(%rbp), %edx
movl -0xf0(%rbp), %ecx
addl $0x1, %ecx
movl $0x9, %esi
callq 0x63980
movq -0x20(%rbp), %rdi
movl -0xf0(%rbp), %esi
callq 0x63950
jmp 0x5a404
movq -0x20(%rbp), %rdi
movl -0xf0(%rbp), %ecx
movl $0x10, %esi
xorl %edx, %edx
callq 0x63980
movq -0x20(%rbp), %rdi
movl -0xf0(%rbp), %esi
callq 0x63950
jmp 0x5a406
cmpl $0x0, -0xfc(%rbp)
jne 0x5a481
movq -0x28(%rbp), %rax
movzbl 0x48(%rax), %eax
andl $0x10, %eax
cmpl $0x0, %eax
jne 0x5a481
cmpq $0x0, -0xd0(%rbp)
jne 0x5a43a
movq -0x20(%rbp), %rdi
movl -0x50(%rbp), %edx
movl $0x38, %esi
callq 0x66020
movl $0x0, -0x34(%rbp)
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
je 0x5a47f
movq -0x20(%rbp), %rdi
movl -0x54(%rbp), %edx
addl -0x34(%rbp), %edx
movl $0x38, %esi
callq 0x66020
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
movq -0x48(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x48(%rbp)
jmp 0x5a44d
jmp 0x5a481
jmp 0x5a483
movq -0x8(%rbp), %rax
movzbl 0x1e(%rax), %eax
cmpl $0x0, %eax
jne 0x5a4a7
movq -0x8(%rbp), %rax
cmpq $0x0, 0x1e8(%rax)
jne 0x5a4a7
movq -0x8(%rbp), %rdi
callq 0x84170
movq -0x60(%rbp), %rax
movl 0x2c(%rax), %eax
andl $0x80, %eax
cmpl $0x0, %eax
je 0x5a510
movq -0x8(%rbp), %rax
cmpb $0x0, 0x1e(%rax)
jne 0x5a510
movq -0x8(%rbp), %rax
cmpq $0x0, 0x1e8(%rax)
jne 0x5a510
movq -0x20(%rbp), %rdi
movl -0xb0(%rbp), %edx
movl $0x20, %esi
movl $0x1, %ecx
callq 0x63980
movq -0x20(%rbp), %rdi
movl $0x1, %esi
callq 0x50660
movq -0x20(%rbp), %rdi
xorl %edx, %edx
leaq 0x4125e(%rip), %rcx     # 0x9b762
xorl %eax, %eax
movl %eax, %r8d
movl %edx, %esi
callq 0x50730
jmp 0x5a512
leaq -0x70(%rbp), %rdi
callq 0x84360
movq -0x60(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x4bbe0
movq -0x60(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x4b970
movq -0x60(%rbp), %rdi
movq -0xc8(%rbp), %rsi
callq 0xc760
addq $0x150, %rsp            # imm = 0x150
popq %rbp
retq
nop