// File: /workspace/github_c_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %r9, 0x60(%rsp)
movl %r8d, 0x34(%rsp)
movl %ecx, 0x30(%rsp)
movq %rdx, 0x20(%rsp)
movq %rsi, %r12
movq %rdi, %rbx
movq (%rdi), %rax
movq %rax, 0x78(%rsp)
callq 0x47f6a
movq %rax, %r14
movswq 0x42(%r12), %rsi
testb $0x20, 0x48(%r12)
jne 0x62698
movl $0x1, %eax
movq $0x0, 0x38(%rsp)
jmp 0x626ba
movq 0x10(%r12), %rcx
testq %rcx, %rcx
je 0x626b1
movb 0x63(%rcx), %al
andb $0x3, %al
cmpb $0x2, %al
je 0x626b1
movq 0x28(%rcx), %rcx
jmp 0x6269d
movq %rcx, 0x38(%rsp)
movzwl 0x5e(%rcx), %eax
movq %rax, 0x80(%rsp)
movzbl 0x100(%rsp), %eax
movl %eax, 0x5c(%rsp)
testw %si, %si
movq %r12, 0x8(%rsp)
movq %r14, (%rsp)
jle 0x62899
movq 0x60(%rsp), %rax
incl %eax
movq %rax, 0x50(%rsp)
xorl %r15d, %r15d
xorl %r13d, %r13d
movq %rsi, 0x18(%rsp)
movswq 0x40(%r12), %rax
movl %eax, %eax
cmpq %rax, %r13
je 0x62889
movq 0x8(%r12), %rax
movb 0x28(%rax,%r15), %cl
testb %cl, %cl
je 0x62889
cmpb $0xa, %cl
movzbl %cl, %ecx
movl $0x2, %edx
cmovel %edx, %ecx
movl 0x5c(%rsp), %edx
cmpb $0xa, %dl
cmovnel %edx, %ecx
cmpb $0x5, %cl
jne 0x6274c
xorl %ecx, %ecx
cmpq $0x0, 0x8(%rax,%r15)
setne %cl
leal (%rcx,%rcx,2), %r14d
addl $0x2, %r14d
jmp 0x62750
movzbl %cl, %r14d
leal -0x1(%r14), %ecx
cmpl $0x3, %ecx
ja 0x6282a
leaq 0xaaa8(%rip), %rdx      # 0x6d20c
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movq 0x1e0(%rbx), %rcx
testq %rcx, %rcx
cmoveq %rbx, %rcx
movb $0x1, 0x24(%rcx)
movq 0x8(%rsp), %r12
movq (%r12), %rdx
movq (%rax,%r15), %rcx
movq 0x78(%rsp), %rdi
leaq 0xf04d(%rip), %rsi      # 0x717e5
xorl %eax, %eax
callq 0x11ce7
movq %rax, %rbp
movq 0x50(%rsp), %rax
leal (%rax,%r13), %r8d
movq (%rsp), %rdi
movl $0x15, %esi
movl $0x513, %edx            # imm = 0x513
movl %r14d, %ecx
movq %rdi, %r14
callq 0x47fb1
movq %r14, %rdi
movl %eax, %esi
movq %rbp, %rdx
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
callq 0x11ea3
movq 0x8(%r14), %rax
testq %rax, %rax
movq 0x18(%rsp), %rsi
je 0x62889
movslq 0x34(%r14), %rcx
leaq (%rcx,%rcx,2), %rcx
movb $0x1, -0x15(%rax,%rcx,8)
jmp 0x62889
movq 0x50(%rsp), %rax
leal (%rax,%r13), %edx
movq (%rsp), %r14
movq %r14, %rdi
movl $0x4a, %esi
movl 0x108(%rsp), %ecx
xorl %r8d, %r8d
callq 0x47fb1
movq 0x8(%rsp), %r12
movq 0x18(%rsp), %rsi
jmp 0x62889
movq 0x50(%rsp), %rax
leal (%rax,%r13), %r12d
movq (%rsp), %r14
movq %r14, %rdi
movl $0x4b, %esi
movl %r12d, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x47fb1
movl %eax, %ebp
movq 0x8(%rsp), %rcx
movq 0x8(%rcx), %rax
movq 0x8(%rax,%r15), %rsi
movq %rbx, %rdi
movl %r12d, %edx
movq %rcx, %r12
callq 0x4802e
movq 0x18(%rsp), %rsi
testl %ebp, %ebp
js 0x62889
movl 0x34(%r14), %eax
cmpl %ebp, %eax
jbe 0x62889
movq 0x8(%r14), %rcx
movl %ebp, %edx
leaq (%rdx,%rdx,2), %rdx
movl %eax, 0x8(%rcx,%rdx,8)
incq %r13
addq $0x30, %r15
cmpq %r13, %rsi
jne 0x626f7
movq 0x30(%r12), %rsi
testq %rsi, %rsi
je 0x629be
movq 0x78(%rsp), %rax
testb $0x20, 0x2d(%rax)
jne 0x629be
movq 0x60(%rsp), %rax
incl %eax
movl %eax, 0x64(%rbx)
cmpl $0x0, (%rsi)
jle 0x629be
movl 0x5c(%rsp), %eax
cmpb $0xa, %al
movl $0x2, %ecx
cmovel %ecx, %eax
movzbl %al, %eax
movl %eax, 0x18(%rsp)
xorl %r13d, %r13d
xorl %r12d, %r12d
movq %rsi, 0x50(%rsp)
movq %rbx, 0x48(%rsp)
movq %r14, %rdi
movq %r14, %rbp
movq %rsi, %r14
callq 0x49cbd
movl %eax, %r15d
movq 0x8(%r14), %rax
movq (%rax,%r13), %rsi
movq %rbx, %rdi
movl %r15d, %edx
movl $0x8, %ecx
callq 0x4c753
movl 0x18(%rsp), %edx
cmpl $0x4, %edx
jne 0x62948
movq %rbp, %rdi
movl $0x10, %esi
xorl %edx, %edx
movl 0x108(%rsp), %ecx
xorl %r8d, %r8d
callq 0x47fb1
movl $0x4, 0x18(%rsp)
movq 0x48(%rsp), %rbx
jmp 0x62988
movq 0x8(%r14), %rax
movq 0x8(%rax,%r13), %rcx
testq %rcx, %rcx
jne 0x6295e
movq 0x8(%rsp), %rax
movq (%rax), %rcx
cmpl $0x5, %edx
movl $0x2, %eax
cmovel %eax, %edx
movq 0x48(%rsp), %rbx
movq %rbx, %rdi
movl $0x113, %esi            # imm = 0x113
movl %edx, 0x18(%rsp)
xorl %r8d, %r8d
movl $0x3, %r9d
callq 0x4ad4b
movq %rbp, %r14
testl %r15d, %r15d
movq 0x50(%rsp), %rsi
jns 0x629ab
movq 0x40(%r14), %rax
testq %rax, %rax
je 0x629ab
notl %r15d
movl 0x34(%r14), %ecx
movl %r15d, %edx
movl %ecx, (%rax,%rdx,4)
incq %r12
movslq (%rsi), %rax
addq $0x20, %r13
cmpq %rax, %r12
jl 0x628ee
xorl %esi, %esi
cmpb $0x0, 0xf8(%rsp)
je 0x62a76
movl $0x0, %r14d
movl $0x0, %eax
movq %rax, 0x40(%rsp)
cmpq $0x0, 0x38(%rsp)
movq 0x60(%rsp), %r12
movq 0x20(%rsp), %r13
jne 0x62b8e
movq (%rsp), %r14
movq %r14, %rdi
callq 0x49cbd
movl %eax, %ebp
movb 0x100(%rsp), %al
movl %eax, %r15d
cmpb $0xa, %al
jne 0x62a25
movq 0x8(%rsp), %rax
movzbl 0x49(%rax), %eax
cmpb $0xa, %al
movl $0x2, %r15d
cmovnel %eax, %r15d
movl 0xf0(%rsp), %r8d
testl %r8d, %r8d
je 0x62a44
movq %r14, %rdi
movl $0x4d, %esi
movl %r12d, %edx
movl %ebp, %ecx
callq 0x47fb1
xorl %r14d, %r14d
cmpb $0x5, 0x100(%rsp)
je 0x62aa9
cmpb $0x5, %r15b
jne 0x62aa9
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rax
testq %rax, %rax
je 0x62aa9
movb 0x62(%rax), %cl
addb $-0x3, %cl
cmpb $0x1, %cl
jbe 0x62a91
movq 0x28(%rax), %rax
jmp 0x62a60
xorl %r14d, %r14d
movq $0x0, 0x40(%rsp)
movq 0x60(%rsp), %r12
movq 0x20(%rsp), %r13
jmp 0x62b8e
movq (%rsp), %rdi
movl $0x10, %esi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x47fb1
movl %eax, %r14d
movq (%rsp), %rdi
movl $0x41, %esi
movl 0x30(%rsp), %edx
movl %ebp, %ecx
movl %r12d, %r8d
callq 0x47fb1
movzbl %r15b, %eax
leal -0x1(%rax), %ecx
cmpl $0x3, %ecx
jb 0x62b15
cmpl $0x4, %eax
je 0x62aed
cmpl $0x5, %eax
jne 0x62b12
movq 0x78(%rsp), %rax
testb $0x4, 0x2e(%rax)
jne 0x6324d
xorl %r15d, %r15d
jmp 0x63267
movq $0x0, 0x40(%rsp)
movq (%rsp), %rdi
movl $0x10, %esi
xorl %edx, %edx
movl 0x108(%rsp), %ecx
xorl %r8d, %r8d
callq 0x47fb1
jmp 0x62b2f
movb $0x2, %r15b
movzbl %r15b, %esi
movq %rbx, %rdi
movq 0x8(%rsp), %rdx
callq 0x634f6
movq $0x0, 0x40(%rsp)
testl %ebp, %ebp
jns 0x62b4e
movq (%rsp), %rax
movq 0x40(%rax), %rax
testq %rax, %rax
je 0x62b4e
notl %ebp
movq (%rsp), %rcx
movl 0x34(%rcx), %ecx
movl %ebp, %edx
movl %ecx, (%rax,%rdx,4)
testl %r14d, %r14d
je 0x62b8c
movq (%rsp), %r15
movq %r15, %rdi
movl $0x10, %esi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x47fb1
movl %eax, %esi
testl %r14d, %r14d
js 0x62b8e
movl 0x34(%r15), %eax
cmpl %r14d, %eax
jbe 0x62b8e
movq 0x8(%r15), %rcx
movl %r14d, %edx
leaq (%rdx,%rdx,2), %rdx
movl %eax, 0x8(%rcx,%rdx,8)
jmp 0x62b8e
xorl %esi, %esi
movl %esi, 0x8c(%rsp)
movl %r14d, 0x90(%rsp)
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rbp
testq %rbp, %rbp
je 0x631e8
leal 0x1(%r12), %eax
movl %eax, 0x74(%rsp)
movl 0xf0(%rsp), %eax
leal 0x1(%rax), %esi
movl 0x34(%rsp), %eax
movq %rax, 0xa0(%rsp)
xorl %r15d, %r15d
movswl 0x80(%rsp), %eax
movq %rax, 0x98(%rsp)
movq (%rsp), %r14
movq %rbx, 0x48(%rsp)
movl %esi, 0x94(%rsp)
cmpl $0x0, (%r13,%r15,4)
je 0x631d6
movq %r14, %rdi
callq 0x49cbd
movl %eax, %r13d
cmpq $0x0, 0x48(%rbp)
je 0x62c4c
movq 0x20(%rsp), %rax
movl (%rax,%r15,4), %ecx
movq %r14, %rdi
movl $0x1a, %esi
xorl %edx, %edx
xorl %r8d, %r8d
callq 0x47fb1
movl 0x74(%rsp), %eax
movl %eax, 0x64(%rbx)
movq 0x48(%rbp), %rsi
movq %rbx, %rdi
movl %r13d, %edx
movl $0x8, %ecx
callq 0x4aa7d
movl $0x0, 0x64(%rbx)
movl %r13d, 0x18(%rsp)
movzwl 0x60(%rbp), %eax
movl 0x48(%rbx), %ecx
subl %eax, %ecx
jge 0x62c6d
movl 0x58(%rbx), %ecx
leal 0x1(%rcx), %edx
movl %edx, 0x14(%rsp)
addl %ecx, %eax
movl %eax, 0x58(%rbx)
jmp 0x62c7c
movl 0x4c(%rbx), %edx
movl %edx, 0x14(%rsp)
addl %edx, %eax
movl %eax, 0x4c(%rbx)
movl %ecx, 0x48(%rbx)
movq 0x20(%rsp), %r13
movq %r15, 0x28(%rsp)
movzwl 0x60(%rbp), %eax
testw %ax, %ax
je 0x62cde
movl 0x14(%rsp), %r14d
xorl %r15d, %r15d
movl 0x74(%rsp), %ebx
movq 0x8(%rbp), %rax
movswl (%rax,%r15,2), %eax
movl %r12d, %edx
testl %eax, %eax
js 0x62cbd
movl %r12d, %edx
movq 0x8(%rsp), %rcx
cmpw 0x40(%rcx), %ax
je 0x62cbd
addl %ebx, %eax
movl %eax, %edx
leal (%r14,%r15), %ecx
movq (%rsp), %rdi
movl $0x1f, %esi
xorl %r8d, %r8d
callq 0x47fb1
incq %r15
movzwl 0x60(%rbp), %eax
cmpq %rax, %r15
jb 0x62c9b
cmpb $0x0, 0xf8(%rsp)
setne %r14b
movl 0xf0(%rsp), %ecx
testl %ecx, %ecx
sete %r15b
movzwl %ax, %ecx
movq 0x28(%rsp), %rax
movl (%r13,%rax,4), %r8d
movq (%rsp), %rbx
movq %rbx, %rdi
movl $0x2d, %esi
movl 0x14(%rsp), %r13d
movl %r13d, %edx
callq 0x47fb1
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x5246d
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movq %rax, %rdx
xorl %ecx, %ecx
callq 0x11ea3
movzwl 0x60(%rbp), %edx
movq 0x48(%rsp), %rbx
movq %rbx, %rdi
movl %r13d, %esi
callq 0x49d08
cmpq %rbp, 0x38(%rsp)
setne %al
orb %r14b, %al
orb %r15b, %al
je 0x62e0b
movb 0x62(%rbp), %al
testb %al, %al
je 0x62e1c
movq 0xa0(%rsp), %rcx
movq 0x28(%rsp), %rdx
leaq (%rdx,%rcx), %r12
cmpb $0xa, %al
movzbl %al, %r14d
movl $0x2, %eax
cmovel %eax, %r14d
cmpb $0xa, 0x100(%rsp)
cmovnel 0x5c(%rsp), %r14d
movzwl 0x5e(%rbp), %r15d
movq (%rsp), %rbx
movq %rbx, %rdi
movl $0x3e, %esi
movl %r12d, %edx
movl 0x18(%rsp), %ecx
movl 0x14(%rsp), %r13d
movl %r13d, %r8d
callq 0x47fb1
movq %rbx, %rdi
movq 0x48(%rsp), %rbx
movl %eax, %esi
movq %r15, %rdx
movl $0xfffffff2, %ecx       # imm = 0xFFFFFFF2
callq 0x11ea3
movl %r13d, %ecx
movq 0x38(%rsp), %r13
cmpq %r13, %rbp
je 0x62e8c
movl 0x48(%rbx), %eax
movq 0x80(%rsp), %rdx
subl %edx, %eax
jge 0x62e81
movl 0x58(%rbx), %eax
leal 0x1(%rax), %ecx
addl %edx, %eax
movl %eax, 0x58(%rbx)
jmp 0x62e8c
movl 0x18(%rsp), %edx
testl %edx, %edx
js 0x62e61
movq (%rsp), %r14
jmp 0x631cc
movzwl 0x60(%rbp), %r15d
movq %rbx, %rdi
movl 0x14(%rsp), %r14d
movl %r14d, %esi
movl %r15d, %edx
callq 0x49d08
cmpl %r15d, 0x48(%rbx)
jge 0x62e42
movl %r15d, 0x48(%rbx)
movl %r14d, 0x4c(%rbx)
movl 0x18(%rsp), %edx
testl %edx, %edx
movq 0x20(%rsp), %r13
js 0x630b7
movq (%rsp), %r14
movq 0x28(%rsp), %r15
jmp 0x631d6
movq (%rsp), %r14
movq 0x40(%r14), %rax
testq %rax, %rax
movq 0x28(%rsp), %r15
movq 0x20(%rsp), %r13
jne 0x630cd
jmp 0x631d6
movl 0x4c(%rbx), %ecx
addl %ecx, %edx
movl %edx, 0x4c(%rbx)
movl %eax, 0x48(%rbx)
movzbl %r14b, %edx
movq 0x8(%rsp), %rax
testb $0x20, 0x48(%rax)
movq %rcx, 0x68(%rsp)
movq %rdx, 0xa8(%rsp)
jne 0x62ef1
movq (%rsp), %rbx
movq %rbx, %rdi
movl $0x6b, %esi
movl %r12d, %edx
xorl %r8d, %r8d
callq 0x47fb1
movl 0xf0(%rsp), %eax
testl %eax, %eax
movl 0x18(%rsp), %ecx
je 0x6304e
movq %rbx, %rdi
movl $0x4d, %esi
movq 0x68(%rsp), %rdx
movl 0xf0(%rsp), %r8d
callq 0x47fb1
jmp 0x6304e
movl 0xf0(%rsp), %r14d
testl %r14d, %r14d
sete %al
cmpl $0x5, %edx
setne %cl
cmpq %r13, %rbp
je 0x62f7b
andb %cl, %al
jne 0x62f7b
cmpw $0x0, 0x5e(%r13)
je 0x62f7b
xorl %r15d, %r15d
movzwl 0x60(%rbp), %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
testq %rax, %rax
movq 0x68(%rsp), %r8
je 0x62f5a
movq 0x8(%r13), %rdx
movzwl (%rdx,%r15,2), %edx
movq 0x8(%rbp), %rsi
shll $0x10, %eax
xorl %edi, %edi
cmpw %dx, (%rsi)
je 0x62f55
addq $0x10000, %rdi          # imm = 0x10000
addq $0x2, %rsi
cmpq %rdi, %rax
jne 0x62f3e
jmp 0x62f5a
sarl $0x10, %edi
movl %edi, %ecx
addl %r15d, %r8d
movq (%rsp), %rdi
movl $0x2b, %esi
movl %r12d, %edx
callq 0x47fb1
incq %r15
movzwl 0x5e(%r13), %eax
cmpq %rax, %r15
jb 0x62f19
testl %r14d, %r14d
je 0x6304e
cmpw $0x0, 0x5e(%r13)
je 0x6304e
movb 0x63(%rbp), %al
andb $0x3, %al
cmpb $0x2, %al
movq 0x68(%rsp), %rax
cmovel 0x14(%rsp), %eax
movq %rax, 0xb0(%rsp)
movzwl 0x5e(%r13), %r12d
movq (%rsp), %rax
addl 0x34(%rax), %r12d
movl $0x4c, %r15d
xorl %r14d, %r14d
movq 0x40(%r13), %rax
movq (%rax,%r14,8), %rsi
movq %rbx, %rdi
callq 0x483de
movq %rax, 0x50(%rsp)
movq 0x38(%rsp), %rax
movq 0x8(%rax), %rax
movswl (%rax,%r14,2), %edx
movq 0x38(%rsp), %rax
movzwl 0x5e(%rax), %eax
decl %eax
cmpq %rax, %r14
cmovel 0x18(%rsp), %r12d
movl $0x4d, %eax
cmovel %eax, %r15d
addl 0x94(%rsp), %edx
movq 0xb0(%rsp), %rax
leal (%rax,%r14), %r8d
movq (%rsp), %r13
movq %r13, %rdi
movl %r15d, %esi
movl %r12d, %ecx
callq 0x47fb1
movq %r13, %rdi
movl %eax, %esi
movq 0x50(%rsp), %rdx
movq 0x38(%rsp), %r13
movl $0xfffffffc, %ecx       # imm = 0xFFFFFFFC
callq 0x11ea3
incq %r14
movzwl 0x5e(%r13), %eax
cmpq %rax, %r14
jb 0x62fbf
movq 0xa8(%rsp), %rsi
leal -0x1(%rsi), %eax
cmpl $0x3, %eax
jae 0x63081
movq 0x48(%rsp), %rbx
movq %rbx, %rdi
movq %rbp, %rdx
callq 0x52359
movq 0x60(%rsp), %r12
movq (%rsp), %r14
movl 0x14(%rsp), %r13d
jmp 0x63161
cmpl $0x4, %esi
movq 0x60(%rsp), %r12
movq 0x48(%rsp), %rbx
movl 0x14(%rsp), %r13d
jne 0x630dd
movq (%rsp), %r14
movq %r14, %rdi
movl $0x10, %esi
xorl %edx, %edx
movl 0x108(%rsp), %ecx
xorl %r8d, %r8d
callq 0x47fb1
jmp 0x63161
movq (%rsp), %r14
movq 0x40(%r14), %rax
testq %rax, %rax
movq 0x28(%rsp), %r15
je 0x631d6
notl %edx
movl 0x34(%r14), %ecx
movl %edx, %edx
movl %ecx, (%rax,%rdx,4)
jmp 0x631d6
movq 0x1e0(%rbx), %rax
testq %rax, %rax
cmoveq %rbx, %rax
movb $0x1, 0x23(%rax)
movq 0x78(%rsp), %rax
testb $0x4, 0x2e(%rax)
jne 0x63103
xorl %edx, %edx
movq 0x8(%rsp), %r15
jmp 0x63120
movq %rbx, %rdi
movq 0x8(%rsp), %r15
movq %r15, %rsi
movl $0x6b, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x5f168
movq %rax, %rdx
movq 0x68(%rsp), %r9
xorl %eax, %eax
cmpq 0x38(%rsp), %rbp
sete %al
movq %rbx, %rdi
movq %r15, %rsi
movl 0x30(%rsp), %ecx
movl 0x34(%rsp), %r8d
pushq %rax
pushq $0x5
pushq $0x0
pushq 0xb0(%rsp)
callq 0x5f6b0
addq $0x20, %rsp
movl $0x1, %eax
movq %rax, 0x40(%rsp)
movq (%rsp), %r14
movl 0x18(%rsp), %edx
testl %edx, %edx
jns 0x6317d
movq 0x40(%r14), %rax
testq %rax, %rax
je 0x6317d
notl %edx
movl 0x34(%r14), %ecx
movl %edx, %edx
movl %ecx, (%rax,%rdx,4)
movzwl 0x60(%rbp), %r15d
movq %rbx, %rdi
movl %r13d, %esi
movl %r15d, %edx
callq 0x49d08
cmpl %r15d, 0x48(%rbx)
jge 0x6319e
movl %r15d, 0x48(%rbx)
movl %r13d, 0x4c(%rbx)
movq 0x68(%rsp), %rsi
cmpl %r13d, %esi
je 0x631cc
movq %rbx, %rdi
movq 0x80(%rsp), %r15
movl %r15d, %edx
movq %rsi, %r13
callq 0x49d08
cmpl %r15d, 0x48(%rbx)
jge 0x631cc
movl %r15d, 0x48(%rbx)
movl %r13d, 0x4c(%rbx)
movq 0x28(%rsp), %r15
movq 0x20(%rsp), %r13
incq %r15
movq 0x28(%rbp), %rbp
testq %rbp, %rbp
jne 0x62bf1
jmp 0x631ec
movq (%rsp), %r14
movq 0x110(%rsp), %rbx
movl 0x90(%rsp), %ecx
testl %ecx, %ecx
movl 0x8c(%rsp), %ebp
je 0x63234
incl %ecx
movq %r14, %rdi
movl $0x10, %esi
xorl %edx, %edx
xorl %r8d, %r8d
callq 0x47fb1
testl %ebp, %ebp
js 0x63234
movl 0x34(%r14), %eax
cmpl %ebp, %eax
jbe 0x63234
movq 0x8(%r14), %rcx
movl %ebp, %edx
leaq (%rdx,%rdx,2), %rdx
movl %eax, 0x8(%rcx,%rdx,8)
movq 0x40(%rsp), %rax
movl %eax, (%rbx)
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
movq 0x8(%rsp), %rsi
movl $0x6b, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x5f168
movq %rax, %r15
testq %r15, %r15
je 0x632bb
movq 0x1e0(%rbx), %rax
testq %rax, %rax
cmoveq %rbx, %rax
movb $0x1, 0x23(%rax)
movl $0x1, %r10d
movq %rbx, %rdi
movq 0x8(%rsp), %rsi
movq %r15, %rdx
movl 0x30(%rsp), %ecx
movl 0x34(%rsp), %r8d
movl %r12d, %r9d
pushq %r10
pushq $0x5
pushq $0x0
movl $0x1, %eax
movq %rax, 0x58(%rsp)
pushq %r10
callq 0x5f6b0
addq $0x20, %rsp
jmp 0x62b2f
movq (%rbx), %rax
testb $0x8, 0x2e(%rax)
jne 0x63308
movl $0x1, %eax
movq %rax, 0x40(%rsp)
movq 0x8(%rsp), %rsi
cmpq $0x0, 0x10(%rsi)
je 0x62b2f
movq 0x1e0(%rbx), %rax
testq %rax, %rax
cmoveq %rbx, %rax
movb $0x1, 0x23(%rax)
movq %rbx, %rdi
movl 0x30(%rsp), %edx
movl 0x34(%rsp), %ecx
xorl %r8d, %r8d
callq 0x60550
jmp 0x62b2f
movq 0x8(%rsp), %rdi
callq 0x529ef
testq %rax, %rax
jne 0x6326c
movq 0x8(%rsp), %rax
cmpq $0x0, 0x20(%rax)
jne 0x6326c
jmp 0x632c4