// File: /workspace/github_c_makefile_star2_O0/skeeto[P]flappy/sqlite3.c
// Function: sqlite3GenerateConstraintChecks
SQLITE_PRIVATE void sqlite3GenerateConstraintChecks(
  Parse *pParse,       /* The parser context */
  Table *pTab,         /* The table being inserted or updated */
  int *aRegIdx,        /* Use register aRegIdx[i] for index i.  0 for unused */
  int iDataCur,        /* Canonical data cursor (main table or PK index) */
  int iIdxCur,         /* First index cursor */
  int regNewData,      /* First register in a range holding values to insert */
  int regOldData,      /* Previous content.  0 for INSERTs */
  u8 pkChng,           /* Non-zero if the rowid or PRIMARY KEY changed */
  u8 overrideError,    /* Override onError to this if not OE_Default */
  int ignoreDest,      /* Jump to this label on an OE_Ignore resolution */
  int *pbMayReplace    /* OUT: Set to true if constraint may cause a replace */
){
  Vdbe *v;             /* VDBE under constrution */
  Index *pIdx;         /* Pointer to one of the indices */
  Index *pPk = 0;      /* The PRIMARY KEY index */
  sqlite3 *db;         /* Database connection */
  int i;               /* loop counter */
  int ix;              /* Index loop counter */
  int nCol;            /* Number of columns */
  int onError;         /* Conflict resolution strategy */
  int j1;              /* Addresss of jump instruction */
  int seenReplace = 0; /* True if REPLACE is used to resolve INT PK conflict */
  int nPkField;        /* Number of fields in PRIMARY KEY. 1 for ROWID tables */
  int ipkTop = 0;      /* Top of the rowid change constraint check */
  int ipkBottom = 0;   /* Bottom of the rowid change constraint check */
  u8 isUpdate;         /* True if this is an UPDATE operation */

  isUpdate = regOldData!=0;
  db = pParse->db;
  v = sqlite3GetVdbe(pParse);
  assert( v!=0 );
  assert( pTab->pSelect==0 );  /* This table is not a VIEW */
  nCol = pTab->nCol;
  
  /* pPk is the PRIMARY KEY index for WITHOUT ROWID tables and NULL for
  ** normal rowid tables.  nPkField is the number of key fields in the 
  ** pPk index or 1 for a rowid table.  In other words, nPkField is the
  ** number of fields in the true primary key of the table. */
  if( HasRowid(pTab) ){
    pPk = 0;
    nPkField = 1;
  }else{
    pPk = sqlite3PrimaryKeyIndex(pTab);
    nPkField = pPk->nKeyCol;
  }

  /* Record that this module has started */
  VdbeModuleComment((v, "BEGIN: GenCnstCks(%d,%d,%d,%d,%d)",
                     iDataCur, iIdxCur, regNewData, regOldData, pkChng));

  /* Test all NOT NULL constraints.
  */
  for(i=0; i<nCol; i++){
    if( i==pTab->iPKey ){
      continue;
    }
    onError = pTab->aCol[i].notNull;
    if( onError==OE_None ) continue;
    if( overrideError!=OE_Default ){
      onError = overrideError;
    }else if( onError==OE_Default ){
      onError = OE_Abort;
    }
    if( onError==OE_Replace && pTab->aCol[i].pDflt==0 ){
      onError = OE_Abort;
    }
    assert( onError==OE_Rollback || onError==OE_Abort || onError==OE_Fail
        || onError==OE_Ignore || onError==OE_Replace );
    switch( onError ){
      case OE_Abort:
        sqlite3MayAbort(pParse);
        /* Fall through */
      case OE_Rollback:
      case OE_Fail: {
        char *zMsg = sqlite3MPrintf(db, "%s.%s", pTab->zName,
                                    pTab->aCol[i].zName);
        sqlite3VdbeAddOp4(v, OP_HaltIfNull, SQLITE_CONSTRAINT_NOTNULL, onError,
                          regNewData+1+i, zMsg, P4_DYNAMIC);
        sqlite3VdbeChangeP5(v, P5_ConstraintNotNull);
        break;
      }
      case OE_Ignore: {
        sqlite3VdbeAddOp2(v, OP_IsNull, regNewData+1+i, ignoreDest);
        break;
      }
      default: {
        assert( onError==OE_Replace );
        j1 = sqlite3VdbeAddOp1(v, OP_NotNull, regNewData+1+i);
        sqlite3ExprCode(pParse, pTab->aCol[i].pDflt, regNewData+1+i);
        sqlite3VdbeJumpHere(v, j1);
        break;
      }
    }
  }

  /* Test all CHECK constraints
  */
#ifndef SQLITE_OMIT_CHECK
  if( pTab->pCheck && (db->flags & SQLITE_IgnoreChecks)==0 ){
    ExprList *pCheck = pTab->pCheck;
    pParse->ckBase = regNewData+1;
    onError = overrideError!=OE_Default ? overrideError : OE_Abort;
    for(i=0; i<pCheck->nExpr; i++){
      int allOk = sqlite3VdbeMakeLabel(v);
      sqlite3ExprIfTrue(pParse, pCheck->a[i].pExpr, allOk, SQLITE_JUMPIFNULL);
      if( onError==OE_Ignore ){
        sqlite3VdbeAddOp2(v, OP_Goto, 0, ignoreDest);
      }else{
        char *zName = pCheck->a[i].zName;
        if( zName==0 ) zName = pTab->zName;
        if( onError==OE_Replace ) onError = OE_Abort; /* IMP: R-15569-63625 */
        sqlite3HaltConstraint(pParse, SQLITE_CONSTRAINT_CHECK,
                              onError, zName, P4_TRANSIENT,
                              P5_ConstraintCheck);
      }
      sqlite3VdbeResolveLabel(v, allOk);
    }
  }
#endif /* !defined(SQLITE_OMIT_CHECK) */

  /* If rowid is changing, make sure the new rowid does not previously
  ** exist in the table.
  */
  if( pkChng && pPk==0 ){
    int addrRowidOk = sqlite3VdbeMakeLabel(v);

    /* Figure out what action to take in case of a rowid collision */
    onError = pTab->keyConf;
    if( overrideError!=OE_Default ){
      onError = overrideError;
    }else if( onError==OE_Default ){
      onError = OE_Abort;
    }

    if( isUpdate ){
      /* pkChng!=0 does not mean that the rowid has change, only that
      ** it might have changed.  Skip the conflict logic below if the rowid
      ** is unchanged. */
      sqlite3VdbeAddOp3(v, OP_Eq, regNewData, addrRowidOk, regOldData);
    }

    /* If the response to a rowid conflict is REPLACE but the response
    ** to some other UNIQUE constraint is FAIL or IGNORE, then we need
    ** to defer the running of the rowid conflict checking until after
    ** the UNIQUE constraints have run.
    */
    if( onError==OE_Replace && overrideError!=OE_Replace ){
      for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
        if( pIdx->onError==OE_Ignore || pIdx->onError==OE_Fail ){
          ipkTop = sqlite3VdbeAddOp0(v, OP_Goto);
          break;
        }
      }
    }

    /* Check to see if the new rowid already exists in the table.  Skip
    ** the following conflict logic if it does not. */
    sqlite3VdbeAddOp3(v, OP_NotExists, iDataCur, addrRowidOk, regNewData);

    /* Generate code that deals with a rowid collision */
    switch( onError ){
      default: {
        onError = OE_Abort;
        /* Fall thru into the next case */
      }
      case OE_Rollback:
      case OE_Abort:
      case OE_Fail: {
        sqlite3RowidConstraint(pParse, onError, pTab);
        break;
      }
      case OE_Replace: {
        /* If there are DELETE triggers on this table and the
        ** recursive-triggers flag is set, call GenerateRowDelete() to
        ** remove the conflicting row from the table. This will fire
        ** the triggers and remove both the table and index b-tree entries.
        **
        ** Otherwise, if there are no triggers or the recursive-triggers
        ** flag is not set, but the table has one or more indexes, call 
        ** GenerateRowIndexDelete(). This removes the index b-tree entries 
        ** only. The table b-tree entry will be replaced by the new entry 
        ** when it is inserted.  
        **
        ** If either GenerateRowDelete() or GenerateRowIndexDelete() is called,
        ** also invoke MultiWrite() to indicate that this VDBE may require
        ** statement rollback (if the statement is aborted after the delete
        ** takes place). Earlier versions called sqlite3MultiWrite() regardless,
        ** but being more selective here allows statements like:
        **
        **   REPLACE INTO t(rowid) VALUES($newrowid)
        **
        ** to run without a statement journal if there are no indexes on the
        ** table.
        */
        Trigger *pTrigger = 0;
        if( db->flags&SQLITE_RecTriggers ){
          pTrigger = sqlite3TriggersExist(pParse, pTab, TK_DELETE, 0, 0);
        }
        if( pTrigger || sqlite3FkRequired(pParse, pTab, 0, 0) ){
          sqlite3MultiWrite(pParse);
          sqlite3GenerateRowDelete(pParse, pTab, pTrigger, iDataCur, iIdxCur,
                                   regNewData, 1, 0, OE_Replace, 1);
        }else if( pTab->pIndex ){
          sqlite3MultiWrite(pParse);
          sqlite3GenerateRowIndexDelete(pParse, pTab, iDataCur, iIdxCur, 0);
        }
        seenReplace = 1;
        break;
      }
      case OE_Ignore: {
        /*assert( seenReplace==0 );*/
        sqlite3VdbeAddOp2(v, OP_Goto, 0, ignoreDest);
        break;
      }
    }
    sqlite3VdbeResolveLabel(v, addrRowidOk);
    if( ipkTop ){
      ipkBottom = sqlite3VdbeAddOp0(v, OP_Goto);
      sqlite3VdbeJumpHere(v, ipkTop);
    }
  }

  /* Test all UNIQUE constraints by creating entries for each UNIQUE
  ** index and making sure that duplicate entries do not already exist.
  ** Compute the revised record entries for indices as we go.
  **
  ** This loop also handles the case of the PRIMARY KEY index for a
  ** WITHOUT ROWID table.
  */
  for(ix=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, ix++){
    int regIdx;          /* Range of registers hold conent for pIdx */
    int regR;            /* Range of registers holding conflicting PK */
    int iThisCur;        /* Cursor for this UNIQUE index */
    int addrUniqueOk;    /* Jump here if the UNIQUE constraint is satisfied */

    if( aRegIdx[ix]==0 ) continue;  /* Skip indices that do not change */
    iThisCur = iIdxCur+ix;
    addrUniqueOk = sqlite3VdbeMakeLabel(v);

    /* Skip partial indices for which the WHERE clause is not true */
    if( pIdx->pPartIdxWhere ){
      sqlite3VdbeAddOp2(v, OP_Null, 0, aRegIdx[ix]);
      pParse->ckBase = regNewData+1;
      sqlite3ExprIfFalse(pParse, pIdx->pPartIdxWhere, addrUniqueOk,
                         SQLITE_JUMPIFNULL);
      pParse->ckBase = 0;
    }

    /* Create a record for this index entry as it should appear after
    ** the insert or update.  Store that record in the aRegIdx[ix] register
    */
    regIdx = sqlite3GetTempRange(pParse, pIdx->nColumn);
    for(i=0; i<pIdx->nColumn; i++){
      int iField = pIdx->aiColumn[i];
      int x;
      if( iField<0 || iField==pTab->iPKey ){
        x = regNewData;
      }else{
        x = iField + regNewData + 1;
      }
      sqlite3VdbeAddOp2(v, OP_SCopy, x, regIdx+i);
      VdbeComment((v, "%s", iField<0 ? "rowid" : pTab->aCol[iField].zName));
    }
    sqlite3VdbeAddOp3(v, OP_MakeRecord, regIdx, pIdx->nColumn, aRegIdx[ix]);
    sqlite3VdbeChangeP4(v, -1, sqlite3IndexAffinityStr(v, pIdx), P4_TRANSIENT);
    VdbeComment((v, "for %s", pIdx->zName));
    sqlite3ExprCacheAffinityChange(pParse, regIdx, pIdx->nColumn);

    /* In an UPDATE operation, if this index is the PRIMARY KEY index 
    ** of a WITHOUT ROWID table and there has been no change the
    ** primary key, then no collision is possible.  The collision detection
    ** logic below can all be skipped. */
    if( isUpdate && pPk==pIdx && pkChng==0 ){
      sqlite3VdbeResolveLabel(v, addrUniqueOk);
      continue;
    }

    /* Find out what action to take in case there is a uniqueness conflict */
    onError = pIdx->onError;
    if( onError==OE_None ){ 
      sqlite3ReleaseTempRange(pParse, regIdx, pIdx->nColumn);
      sqlite3VdbeResolveLabel(v, addrUniqueOk);
      continue;  /* pIdx is not a UNIQUE index */
    }
    if( overrideError!=OE_Default ){
      onError = overrideError;
    }else if( onError==OE_Default ){
      onError = OE_Abort;
    }
    
    /* Check to see if the new index entry will be unique */
    sqlite3VdbeAddOp4Int(v, OP_NoConflict, iThisCur, addrUniqueOk,
                         regIdx, pIdx->nKeyCol);

    /* Generate code to handle collisions */
    regR = (pIdx==pPk) ? regIdx : sqlite3GetTempRange(pParse, nPkField);
    if( HasRowid(pTab) ){
      sqlite3VdbeAddOp2(v, OP_IdxRowid, iThisCur, regR);
      /* Conflict only if the rowid of the existing index entry
      ** is different from old-rowid */
      if( isUpdate ){
        sqlite3VdbeAddOp3(v, OP_Eq, regR, addrUniqueOk, regOldData);
      }
    }else{
      int x;
      /* Extract the PRIMARY KEY from the end of the index entry and
      ** store it in registers regR..regR+nPk-1 */
      if( (isUpdate || onError==OE_Replace) && pIdx!=pPk ){
        for(i=0; i<pPk->nKeyCol; i++){
          x = sqlite3ColumnOfIndex(pIdx, pPk->aiColumn[i]);
          sqlite3VdbeAddOp3(v, OP_Column, iThisCur, x, regR+i);
          VdbeComment((v, "%s.%s", pTab->zName,
                       pTab->aCol[pPk->aiColumn[i]].zName));
        }
      }
      if( isUpdate ){
        /* If currently processing the PRIMARY KEY of a WITHOUT ROWID 
        ** table, only conflict if the new PRIMARY KEY values are actually
        ** different from the old.
        **
        ** For a UNIQUE index, only conflict if the PRIMARY KEY values
        ** of the matched index row are different from the original PRIMARY
        ** KEY values of this row before the update.  */
        int addrJump = sqlite3VdbeCurrentAddr(v)+pPk->nKeyCol;
        int op = OP_Ne;
        int regCmp = (pIdx->autoIndex==2 ? regIdx : regR);

        for(i=0; i<pPk->nKeyCol; i++){
          char *p4 = (char*)sqlite3LocateCollSeq(pParse, pPk->azColl[i]);
          x = pPk->aiColumn[i];
          if( i==(pPk->nKeyCol-1) ){
            addrJump = addrUniqueOk;
            op = OP_Eq;
          }
          sqlite3VdbeAddOp4(v, op, 
              regOldData+1+x, addrJump, regCmp+i, p4, P4_COLLSEQ
          );
        }
      }
    }

    /* Generate code that executes if the new index entry is not unique */
    assert( onError==OE_Rollback || onError==OE_Abort || onError==OE_Fail
        || onError==OE_Ignore || onError==OE_Replace );
    switch( onError ){
      case OE_Rollback:
      case OE_Abort:
      case OE_Fail: {
        sqlite3UniqueConstraint(pParse, onError, pIdx);
        break;
      }
      case OE_Ignore: {
        sqlite3VdbeAddOp2(v, OP_Goto, 0, ignoreDest);
        break;
      }
      default: {
        Trigger *pTrigger = 0;
        assert( onError==OE_Replace );
        sqlite3MultiWrite(pParse);
        if( db->flags&SQLITE_RecTriggers ){
          pTrigger = sqlite3TriggersExist(pParse, pTab, TK_DELETE, 0, 0);
        }
        sqlite3GenerateRowDelete(pParse, pTab, pTrigger, iDataCur, iIdxCur,
                                 regR, nPkField, 0, OE_Replace, pIdx==pPk);
        seenReplace = 1;
        break;
      }
    }
    sqlite3VdbeResolveLabel(v, addrUniqueOk);
    sqlite3ReleaseTempRange(pParse, regIdx, pIdx->nColumn);
    if( regR!=regIdx ) sqlite3ReleaseTempRange(pParse, regR, nPkField);
  }
  if( ipkTop ){
    sqlite3VdbeAddOp2(v, OP_Goto, 0, ipkTop+1);
    sqlite3VdbeJumpHere(v, ipkBottom);
  }
  
  *pbMayReplace = seenReplace;
  VdbeModuleComment((v, "END: GenCnstCks(%d)", seenReplace));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
movq 0x30(%rbp), %rax
movl 0x28(%rbp), %eax
movb 0x20(%rbp), %al
movb 0x18(%rbp), %al
movl 0x10(%rbp), %eax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movl %r8d, -0x20(%rbp)
movl %r9d, -0x24(%rbp)
movq $0x0, -0x40(%rbp)
movl $0x0, -0x60(%rbp)
movl $0x0, -0x68(%rbp)
movl $0x0, -0x6c(%rbp)
cmpl $0x0, 0x10(%rbp)
setne %al
andb $0x1, %al
movzbl %al, %eax
movb %al, -0x6d(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rdi
callq 0x638c0
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movswl 0x42(%rax), %eax
movl %eax, -0x54(%rbp)
movq -0x10(%rbp), %rax
movzbl 0x48(%rax), %eax
andl $0x20, %eax
cmpl $0x0, %eax
jne 0x87662
movq $0x0, -0x40(%rbp)
movl $0x1, -0x64(%rbp)
jmp 0x8767a
movq -0x10(%rbp), %rdi
callq 0x4b190
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movzwl 0x5e(%rax), %eax
movl %eax, -0x64(%rbp)
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
cmpl -0x54(%rbp), %eax
jge 0x87830
movl -0x4c(%rbp), %eax
movq -0x10(%rbp), %rcx
movswl 0x40(%rcx), %ecx
cmpl %ecx, %eax
jne 0x876a1
jmp 0x87822
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x4c(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movzbl 0x28(%rax), %eax
movl %eax, -0x58(%rbp)
cmpl $0x0, -0x58(%rbp)
jne 0x876c6
jmp 0x87822
movzbl 0x20(%rbp), %eax
cmpl $0xa, %eax
je 0x876d8
movzbl 0x20(%rbp), %eax
movl %eax, -0x58(%rbp)
jmp 0x876e7
cmpl $0xa, -0x58(%rbp)
jne 0x876e5
movl $0x2, -0x58(%rbp)
jmp 0x876e7
cmpl $0x5, -0x58(%rbp)
jne 0x8770e
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x4c(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
cmpq $0x0, 0x8(%rax)
jne 0x8770e
movl $0x2, -0x58(%rbp)
movl -0x58(%rbp), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0xe0(%rbp)
subl $0x3, %eax
ja 0x877d1
movq -0xe0(%rbp), %rax
leaq 0xe281(%rip), %rcx      # 0x959b4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x8(%rbp), %rdi
callq 0x67780
movq -0x48(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rdx
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x4c(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rcx
leaq 0x12b84(%rip), %rsi     # 0x9a2f1
movb $0x0, %al
callq 0x16a10
movq %rax, -0x78(%rbp)
movq -0x30(%rbp), %rdi
movl -0x58(%rbp), %ecx
movl -0x24(%rbp), %r8d
addl $0x1, %r8d
addl -0x4c(%rbp), %r8d
movq -0x78(%rbp), %r9
movl $0x15, %esi
movl $0x513, %edx            # imm = 0x513
movl $0xffffffff, (%rsp)     # imm = 0xFFFFFFFF
callq 0x63a70
movq -0x30(%rbp), %rdi
movl $0x1, %esi
callq 0x63ec0
jmp 0x87820
movq -0x30(%rbp), %rdi
movl -0x24(%rbp), %edx
addl $0x1, %edx
addl -0x4c(%rbp), %edx
movl 0x28(%rbp), %ecx
movl $0x4a, %esi
callq 0x63980
jmp 0x87820
movq -0x30(%rbp), %rdi
movl -0x24(%rbp), %edx
addl $0x1, %edx
addl -0x4c(%rbp), %edx
movl $0x4b, %esi
callq 0x66020
movl %eax, -0x5c(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x4c(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rsi
movl -0x24(%rbp), %edx
addl $0x1, %edx
addl -0x4c(%rbp), %edx
callq 0x63d40
movq -0x30(%rbp), %rdi
movl -0x5c(%rbp), %esi
callq 0x63950
jmp 0x87822
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x87681
movq -0x10(%rbp), %rax
cmpq $0x0, 0x30(%rax)
je 0x87985
movq -0x48(%rbp), %rax
movl 0x2c(%rax), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
jne 0x87985
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x80(%rbp)
movl -0x24(%rbp), %ecx
addl $0x1, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x64(%rax)
movzbl 0x20(%rbp), %eax
cmpl $0xa, %eax
je 0x87882
movzbl 0x20(%rbp), %eax
movl %eax, -0xe4(%rbp)
jmp 0x8788f
movl $0x2, %eax
movl %eax, -0xe4(%rbp)
jmp 0x8788f
movl -0xe4(%rbp), %eax
movl %eax, -0x58(%rbp)
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
movq -0x80(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x87983
movq -0x30(%rbp), %rdi
callq 0x662a0
movl %eax, -0x84(%rbp)
movq -0x8(%rbp), %rdi
movq -0x80(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x4c(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq (%rax), %rsi
movl -0x84(%rbp), %edx
movl $0x8, %ecx
callq 0x6a460
cmpl $0x4, -0x58(%rbp)
jne 0x87902
movq -0x30(%rbp), %rdi
movl 0x28(%rbp), %ecx
movl $0x10, %esi
xorl %edx, %edx
callq 0x63980
jmp 0x87966
movq -0x80(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x4c(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq %rax, -0x90(%rbp)
cmpq $0x0, -0x90(%rbp)
jne 0x87938
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x90(%rbp)
cmpl $0x5, -0x58(%rbp)
jne 0x87945
movl $0x2, -0x58(%rbp)
movq -0x8(%rbp), %rdi
movl -0x58(%rbp), %edx
movq -0x90(%rbp), %rcx
movl $0x113, %esi            # imm = 0x113
xorl %r8d, %r8d
movl $0x3, %r9d
callq 0x677d0
movq -0x30(%rbp), %rdi
movl -0x84(%rbp), %esi
callq 0x66470
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x8789f
jmp 0x87985
movzbl 0x18(%rbp), %eax
cmpl $0x0, %eax
je 0x87be9
cmpq $0x0, -0x40(%rbp)
jne 0x87be9
movq -0x30(%rbp), %rdi
callq 0x662a0
movl %eax, -0x94(%rbp)
movq -0x10(%rbp), %rax
movzbl 0x49(%rax), %eax
movl %eax, -0x58(%rbp)
movzbl 0x20(%rbp), %eax
cmpl $0xa, %eax
je 0x879c9
movzbl 0x20(%rbp), %eax
movl %eax, -0x58(%rbp)
jmp 0x879d8
cmpl $0xa, -0x58(%rbp)
jne 0x879d6
movl $0x2, -0x58(%rbp)
jmp 0x879d8
cmpb $0x0, -0x6d(%rbp)
je 0x879f9
movq -0x30(%rbp), %rdi
movl -0x24(%rbp), %edx
movl -0x94(%rbp), %ecx
movl 0x10(%rbp), %r8d
movl $0x4d, %esi
callq 0x639b0
cmpl $0x5, -0x58(%rbp)
jne 0x87a5a
movzbl 0x20(%rbp), %eax
cmpl $0x5, %eax
je 0x87a5a
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x87a58
movq -0x38(%rbp), %rax
movzbl 0x62(%rax), %eax
cmpl $0x4, %eax
je 0x87a35
movq -0x38(%rbp), %rax
movzbl 0x62(%rax), %eax
cmpl $0x3, %eax
jne 0x87a48
movq -0x30(%rbp), %rdi
movl $0x10, %esi
callq 0x63920
movl %eax, -0x68(%rbp)
jmp 0x87a58
jmp 0x87a4a
movq -0x38(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x38(%rbp)
jmp 0x87a14
jmp 0x87a5a
movq -0x30(%rbp), %rdi
movl -0x1c(%rbp), %edx
movl -0x94(%rbp), %ecx
movl -0x24(%rbp), %r8d
movl $0x41, %esi
callq 0x639b0
movl -0x58(%rbp), %eax
movl %eax, -0xe8(%rbp)
decl %eax
subl $0x3, %eax
jb 0x87aac
jmp 0x87a87
movl -0xe8(%rbp), %eax
subl $0x4, %eax
je 0x87ba2
jmp 0x87a98
movl -0xe8(%rbp), %eax
subl $0x5, %eax
je 0x87ac1
jmp 0x87aa5
movl $0x2, -0x58(%rbp)
movq -0x8(%rbp), %rdi
movl -0x58(%rbp), %esi
movq -0x10(%rbp), %rdx
callq 0x88450
jmp 0x87bb5
movq $0x0, -0xa0(%rbp)
movq -0x48(%rbp), %rax
movl 0x2c(%rax), %eax
andl $0x40000, %eax          # imm = 0x40000
cmpl $0x0, %eax
je 0x87afe
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl $0x6b, %edx
xorl %eax, %eax
movl %eax, %r8d
movq %r8, %rcx
callq 0x836d0
movq %rax, -0xa0(%rbp)
cmpq $0x0, -0xa0(%rbp)
jne 0x87b20
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
xorl %ecx, %ecx
callq 0x83a40
cmpl $0x0, %eax
je 0x87b6b
movq -0x8(%rbp), %rdi
callq 0x88500
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0xa0(%rbp), %rdx
movl -0x1c(%rbp), %ecx
movl -0x20(%rbp), %r8d
movl -0x24(%rbp), %r9d
xorl %eax, %eax
movl $0x1, (%rsp)
movl $0x0, 0x8(%rsp)
movl $0x5, 0x10(%rsp)
movl $0x1, 0x18(%rsp)
callq 0x83e90
jmp 0x87b99
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x87b97
movq -0x8(%rbp), %rdi
callq 0x88500
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x1c(%rbp), %edx
movl -0x20(%rbp), %ecx
xorl %eax, %eax
movl %eax, %r8d
callq 0x84ef0
jmp 0x87b99
movl $0x1, -0x60(%rbp)
jmp 0x87bb5
movq -0x30(%rbp), %rdi
movl 0x28(%rbp), %ecx
movl $0x10, %esi
xorl %edx, %edx
callq 0x63980
movq -0x30(%rbp), %rdi
movl -0x94(%rbp), %esi
callq 0x66470
cmpl $0x0, -0x68(%rbp)
je 0x87be7
movq -0x30(%rbp), %rdi
movl $0x10, %esi
callq 0x63920
movl %eax, -0x6c(%rbp)
movq -0x30(%rbp), %rdi
movl -0x68(%rbp), %esi
callq 0x63950
jmp 0x87be9
movl $0x0, -0x50(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x881e1
movq -0x18(%rbp), %rax
movslq -0x50(%rbp), %rcx
cmpl $0x0, (%rax,%rcx,4)
jne 0x87c1a
jmp 0x881c7
movl -0x20(%rbp), %eax
addl -0x50(%rbp), %eax
movl %eax, -0xac(%rbp)
movq -0x30(%rbp), %rdi
callq 0x662a0
movl %eax, -0xb0(%rbp)
movq -0x38(%rbp), %rax
cmpq $0x0, 0x48(%rax)
je 0x87c8f
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rax
movslq -0x50(%rbp), %rcx
movl (%rax,%rcx,4), %ecx
movl $0x1a, %esi
xorl %edx, %edx
callq 0x63980
movl -0x24(%rbp), %ecx
addl $0x1, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x64(%rax)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rax
movq 0x48(%rax), %rsi
movl -0xb0(%rbp), %edx
movl $0x8, %ecx
callq 0x67470
movq -0x8(%rbp), %rax
movl $0x0, 0x64(%rax)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rax
movzwl 0x60(%rax), %esi
callq 0x66680
movl %eax, -0xa4(%rbp)
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
movq -0x38(%rbp), %rcx
movzwl 0x60(%rcx), %ecx
cmpl %ecx, %eax
jge 0x87d35
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x4c(%rbp), %rcx
movswl (%rax,%rcx,2), %eax
movl %eax, -0xb4(%rbp)
cmpl $0x0, -0xb4(%rbp)
jl 0x87ced
movl -0xb4(%rbp), %eax
movq -0x10(%rbp), %rcx
movswl 0x40(%rcx), %ecx
cmpl %ecx, %eax
jne 0x87cf8
movl -0x24(%rbp), %eax
movl %eax, -0xb8(%rbp)
jmp 0x87d0a
movl -0xb4(%rbp), %eax
addl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb8(%rbp)
movq -0x30(%rbp), %rdi
movl -0xb8(%rbp), %edx
movl -0xa4(%rbp), %ecx
addl -0x4c(%rbp), %ecx
movl $0x1f, %esi
callq 0x63980
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x87cad
movq -0x30(%rbp), %rdi
movl -0xa4(%rbp), %edx
movq -0x38(%rbp), %rax
movzwl 0x60(%rax), %ecx
movq -0x18(%rbp), %rax
movslq -0x50(%rbp), %rsi
movl (%rax,%rsi,4), %r8d
movl $0x2d, %esi
callq 0x639b0
movq -0x30(%rbp), %rax
movq %rax, -0xf0(%rbp)
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x72130
movq -0xf0(%rbp), %rdi
movq %rax, %rdx
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %ecx, %ecx
callq 0x16e40
movq -0x8(%rbp), %rdi
movl -0xa4(%rbp), %esi
movq -0x38(%rbp), %rax
movzwl 0x60(%rax), %edx
callq 0x66050
movzbl -0x6d(%rbp), %eax
cmpl $0x0, %eax
je 0x87dd2
movq -0x40(%rbp), %rax
cmpq -0x38(%rbp), %rax
jne 0x87dd2
movzbl 0x18(%rbp), %eax
cmpl $0x0, %eax
jne 0x87dd2
movq -0x30(%rbp), %rdi
movl -0xb0(%rbp), %esi
callq 0x66470
jmp 0x881c7
movq -0x38(%rbp), %rax
movzbl 0x62(%rax), %eax
movl %eax, -0x58(%rbp)
cmpl $0x0, -0x58(%rbp)
jne 0x87e0e
movq -0x8(%rbp), %rdi
movl -0xa4(%rbp), %esi
movq -0x38(%rbp), %rax
movzwl 0x60(%rax), %edx
callq 0x66a70
movq -0x30(%rbp), %rdi
movl -0xb0(%rbp), %esi
callq 0x66470
jmp 0x881c7
movzbl 0x20(%rbp), %eax
cmpl $0xa, %eax
je 0x87e20
movzbl 0x20(%rbp), %eax
movl %eax, -0x58(%rbp)
jmp 0x87e2f
cmpl $0xa, -0x58(%rbp)
jne 0x87e2d
movl $0x2, -0x58(%rbp)
jmp 0x87e2f
movq -0x30(%rbp), %rdi
movl -0xac(%rbp), %edx
movl -0xb0(%rbp), %ecx
movl -0xa4(%rbp), %r8d
movq -0x38(%rbp), %rax
movzwl 0x5e(%rax), %r9d
movl $0x3e, %esi
callq 0x640a0
movq -0x38(%rbp), %rax
cmpq -0x40(%rbp), %rax
jne 0x87e71
movl -0xa4(%rbp), %eax
movl %eax, -0xf4(%rbp)
jmp 0x87e83
movq -0x8(%rbp), %rdi
movl -0x64(%rbp), %esi
callq 0x66680
movl %eax, -0xf4(%rbp)
movl -0xf4(%rbp), %eax
movl %eax, -0xa8(%rbp)
movq -0x10(%rbp), %rax
movzbl 0x48(%rax), %eax
andl $0x20, %eax
cmpl $0x0, %eax
jne 0x87ee2
movq -0x30(%rbp), %rdi
movl -0xac(%rbp), %edx
movl -0xa8(%rbp), %ecx
movl $0x6b, %esi
callq 0x63980
cmpb $0x0, -0x6d(%rbp)
je 0x87edd
movq -0x30(%rbp), %rdi
movl -0xa8(%rbp), %edx
movl -0xb0(%rbp), %ecx
movl 0x10(%rbp), %r8d
movl $0x4d, %esi
callq 0x639b0
jmp 0x8808b
movzbl -0x6d(%rbp), %eax
cmpl $0x0, %eax
jne 0x87ef1
cmpl $0x5, -0x58(%rbp)
jne 0x87f63
movq -0x38(%rbp), %rax
cmpq -0x40(%rbp), %rax
je 0x87f63
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
movq -0x40(%rbp), %rcx
movzwl 0x5e(%rcx), %ecx
cmpl %ecx, %eax
jge 0x87f61
movq -0x38(%rbp), %rdi
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x4c(%rbp), %rcx
movswl (%rax,%rcx,2), %esi
callq 0x67b20
cwtl
movl %eax, -0xbc(%rbp)
movq -0x30(%rbp), %rdi
movl -0xac(%rbp), %edx
movl -0xbc(%rbp), %ecx
movl -0xa8(%rbp), %r8d
addl -0x4c(%rbp), %r8d
movl $0x2b, %esi
callq 0x639b0
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x87f02
jmp 0x87f63
cmpb $0x0, -0x6d(%rbp)
je 0x88089
movq -0x30(%rbp), %rdi
callq 0x63ea0
movq -0x40(%rbp), %rcx
movzwl 0x5e(%rcx), %ecx
addl %ecx, %eax
movl %eax, -0xc0(%rbp)
movl $0x4c, -0xc4(%rbp)
movq -0x38(%rbp), %rax
movb 0x63(%rax), %al
andb $0x3, %al
movzbl %al, %eax
cmpl $0x2, %eax
jne 0x87faf
movl -0xa4(%rbp), %eax
movl %eax, -0xf8(%rbp)
jmp 0x87fbb
movl -0xa8(%rbp), %eax
movl %eax, -0xf8(%rbp)
movl -0xf8(%rbp), %eax
movl %eax, -0xc8(%rbp)
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
movq -0x40(%rbp), %rcx
movzwl 0x5e(%rcx), %ecx
cmpl %ecx, %eax
jge 0x88087
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x4c(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x643a0
movq %rax, -0xd0(%rbp)
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x4c(%rbp), %rcx
movswl (%rax,%rcx,2), %eax
movl %eax, -0xbc(%rbp)
movl -0x4c(%rbp), %eax
movq -0x40(%rbp), %rcx
movzwl 0x5e(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jne 0x8803f
movl -0xb0(%rbp), %eax
movl %eax, -0xc0(%rbp)
movl $0x4d, -0xc4(%rbp)
movq -0x30(%rbp), %rdi
movl -0xc4(%rbp), %esi
movl 0x10(%rbp), %edx
addl $0x1, %edx
addl -0xbc(%rbp), %edx
movl -0xc0(%rbp), %ecx
movl -0xc8(%rbp), %r8d
addl -0x4c(%rbp), %r8d
movq -0xd0(%rbp), %r9
movl $0xfffffffc, (%rsp)     # imm = 0xFFFFFFFC
callq 0x63a70
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x87fce
jmp 0x88089
jmp 0x8808b
movl -0x58(%rbp), %eax
movl %eax, -0xfc(%rbp)
decl %eax
subl $0x3, %eax
jb 0x880aa
jmp 0x8809d
movl -0xfc(%rbp), %eax
subl $0x4, %eax
je 0x880bf
jmp 0x880d7
movq -0x8(%rbp), %rdi
movl -0x58(%rbp), %esi
movq -0x38(%rbp), %rdx
callq 0x72000
jmp 0x8817f
movq -0x30(%rbp), %rdi
movl 0x28(%rbp), %ecx
movl $0x10, %esi
xorl %edx, %edx
callq 0x63980
jmp 0x8817f
movq $0x0, -0xd8(%rbp)
movq -0x8(%rbp), %rdi
callq 0x88500
movq -0x48(%rbp), %rax
movl 0x2c(%rax), %eax
andl $0x40000, %eax          # imm = 0x40000
cmpl $0x0, %eax
je 0x8811d
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl $0x6b, %edx
xorl %eax, %eax
movl %eax, %r8d
movq %r8, %rcx
callq 0x836d0
movq %rax, -0xd8(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0xd8(%rbp), %rdx
movl -0x1c(%rbp), %ecx
movl -0x20(%rbp), %r8d
movl -0xa8(%rbp), %r9d
movl -0x64(%rbp), %eax
movw %ax, %r10w
movq -0x38(%rbp), %rax
cmpq -0x40(%rbp), %rax
sete %al
andb $0x1, %al
movzbl %al, %eax
xorl %r11d, %r11d
movswl %r10w, %r10d
movl %r10d, (%rsp)
movl $0x0, 0x8(%rsp)
movl $0x5, 0x10(%rsp)
movzbl %al, %eax
movl %eax, 0x18(%rsp)
callq 0x83e90
movl $0x1, -0x60(%rbp)
movq -0x30(%rbp), %rdi
movl -0xb0(%rbp), %esi
callq 0x66470
movq -0x8(%rbp), %rdi
movl -0xa4(%rbp), %esi
movq -0x38(%rbp), %rax
movzwl 0x60(%rax), %edx
callq 0x66a70
movl -0xa8(%rbp), %eax
cmpl -0xa4(%rbp), %eax
je 0x881c5
movq -0x8(%rbp), %rdi
movl -0xa8(%rbp), %esi
movl -0x64(%rbp), %edx
callq 0x66a70
jmp 0x881c7
movq -0x38(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x38(%rbp)
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0x87bfc
cmpl $0x0, -0x68(%rbp)
je 0x88209
movq -0x30(%rbp), %rdi
movl -0x68(%rbp), %ecx
addl $0x1, %ecx
movl $0x10, %esi
xorl %edx, %edx
callq 0x63980
movq -0x30(%rbp), %rdi
movl -0x6c(%rbp), %esi
callq 0x63950
movl -0x60(%rbp), %ecx
movq 0x30(%rbp), %rax
movl %ecx, (%rax)
addq $0x120, %rsp            # imm = 0x120
popq %rbp
retq
nopl (%rax,%rax)