// File: /workspace/github_c_makefile_star2_O3/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 $0xc8, %rsp
movq %r9, 0x68(%rsp)
movq %r8, 0x60(%rsp)
movl %ecx, 0x24(%rsp)
movq %rdx, 0x98(%rsp)
movq %rsi, %r14
movq (%rdi), %rax
movq %rax, 0x70(%rsp)
movq %rdi, 0x18(%rsp)
callq 0x48791
movq %rax, 0x8(%rsp)
movswq 0x42(%r14), %rsi
testb $0x20, 0x48(%r14)
jne 0x62d9f
movl $0x1, %eax
movq %rax, 0x78(%rsp)
xorl %edx, %edx
jmp 0x62dbe
leaq 0x10(%r14), %rax
movq (%rax), %rdx
movb 0x63(%rdx), %cl
andb $0x3, %cl
leaq 0x28(%rdx), %rax
cmpb $0x2, %cl
jne 0x62da3
movzwl 0x5e(%rdx), %eax
movq %rax, 0x78(%rsp)
movq %rdx, 0x80(%rsp)
movzbl 0x110(%rsp), %eax
movl %eax, 0x54(%rsp)
testw %si, %si
movq %r14, 0x10(%rsp)
jle 0x62fa6
movq 0x68(%rsp), %rax
incl %eax
movq %rax, 0x28(%rsp)
xorl %r15d, %r15d
xorl %r13d, %r13d
movq %rsi, 0x30(%rsp)
movq 0x8(%rsp), %rbx
movswq 0x40(%r14), %rax
movl %eax, %eax
cmpq %rax, %r13
je 0x62f91
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rax
movb 0x28(%rax,%r15), %cl
testb %cl, %cl
je 0x62f91
cmpb $0xa, %cl
movzbl %cl, %ecx
movl $0x2, %edx
cmovel %edx, %ecx
movl 0x54(%rsp), %edx
cmpb $0xa, %dl
cmovnel %edx, %ecx
cmpb $0x5, %cl
jne 0x62e54
xorl %ecx, %ecx
cmpq $0x0, 0x8(%rax,%r15)
setne %cl
leal (%rcx,%rcx,2), %r12d
addl $0x2, %r12d
jmp 0x62e58
movzbl %cl, %r12d
movq 0x10(%rsp), %r14
leal -0x1(%r12), %ecx
cmpl $0x3, %ecx
ja 0x62f31
leaq 0xb3ce(%rip), %rdx      # 0x6e240
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movq 0x18(%rsp), %rdx
movq 0x1e0(%rdx), %rcx
testq %rcx, %rcx
cmoveq %rdx, %rcx
movb $0x1, 0x24(%rcx)
movq (%r14), %rdx
movq (%rax,%r15), %rcx
movq 0x70(%rsp), %rdi
leaq 0xf9e0(%rip), %rsi      # 0x72885
xorl %eax, %eax
callq 0x11e78
movq %rax, %rbp
movq 0x28(%rsp), %rax
leal (%rax,%r13), %r8d
movq %rbx, %rdi
movl $0x15, %esi
movl $0x513, %edx            # imm = 0x513
movl %r12d, %ecx
callq 0x487d8
movq %rbx, %rdi
movl %eax, %esi
movq %rbp, %rdx
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
callq 0x12044
movq 0x8(%rbx), %rax
testq %rax, %rax
movq 0x30(%rsp), %rsi
je 0x62f91
movq 0x8(%rsp), %rcx
movslq 0x34(%rcx), %rcx
leaq (%rcx,%rcx,2), %rcx
movb $0x1, -0x15(%rax,%rcx,8)
jmp 0x62f91
movq 0x28(%rsp), %rax
leal (%rax,%r13), %edx
movq 0x8(%rsp), %rdi
movl $0x4a, %esi
movl 0x118(%rsp), %ecx
xorl %r8d, %r8d
callq 0x487d8
movq 0x30(%rsp), %rsi
jmp 0x62f91
movq 0x28(%rsp), %rax
leal (%rax,%r13), %r12d
movq 0x8(%rsp), %rdi
movl $0x4b, %esi
movl %r12d, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x487d8
movl %eax, %ebp
movq 0x8(%r14), %rax
movq 0x8(%rax,%r15), %rsi
movq 0x18(%rsp), %rdi
movl %r12d, %edx
callq 0x4885f
movq 0x30(%rsp), %rsi
testl %ebp, %ebp
js 0x62f91
movq 0x8(%rsp), %rax
movl 0x34(%rax), %eax
cmpl %ebp, %eax
jbe 0x62f91
movq 0x8(%rsp), %rcx
movq 0x8(%rcx), %rcx
movl %ebp, %edx
leaq (%rdx,%rdx,2), %rdx
movl %eax, 0x8(%rcx,%rdx,8)
incq %r13
addq $0x30, %r15
cmpq %r13, %rsi
movq 0x10(%rsp), %r14
jne 0x62dfc
movq 0x30(%r14), %rbx
testq %rbx, %rbx
movq 0x18(%rsp), %r14
je 0x630ce
movq 0x70(%rsp), %rax
testb $0x20, 0x2d(%rax)
jne 0x630ce
movq 0x68(%rsp), %rax
incl %eax
movl %eax, 0x64(%r14)
cmpl $0x0, (%rbx)
jle 0x630ce
movl 0x54(%rsp), %eax
cmpb $0xa, %al
movl $0x2, %ecx
cmovel %ecx, %eax
movzbl %al, %eax
movl %eax, 0x30(%rsp)
xorl %r13d, %r13d
xorl %r12d, %r12d
movq %rbx, 0x28(%rsp)
movq 0x8(%rsp), %rdi
callq 0x4a501
movl %eax, %r15d
movq 0x8(%rbx), %rax
movq (%rax,%r13), %rsi
movq %r14, %rbp
movq %r14, %rdi
movl %r15d, %edx
movl $0x8, %ecx
callq 0x4ce6b
movl 0x30(%rsp), %edx
cmpl $0x4, %edx
jne 0x63054
movq 0x8(%rsp), %rdi
movl $0x10, %esi
xorl %edx, %edx
movl 0x118(%rsp), %ecx
xorl %r8d, %r8d
callq 0x487d8
movl $0x4, 0x30(%rsp)
movq %rbp, %r14
jmp 0x63092
movq 0x8(%rbx), %rax
movq 0x8(%rax,%r13), %rcx
testq %rcx, %rcx
jne 0x6306a
movq 0x10(%rsp), %rax
movq (%rax), %rcx
cmpl $0x5, %edx
movl $0x2, %eax
cmovel %eax, %edx
movq %rbp, %r14
movq %rbp, %rdi
movl $0x113, %esi            # imm = 0x113
movl %edx, 0x30(%rsp)
xorl %r8d, %r8d
movl $0x3, %r9d
callq 0x4b546
testl %r15d, %r15d
movq 0x28(%rsp), %rbx
jns 0x630bb
movq 0x8(%rsp), %rax
movq 0x40(%rax), %rax
testq %rax, %rax
je 0x630bb
notl %r15d
movq 0x8(%rsp), %rcx
movl 0x34(%rcx), %ecx
movl %r15d, %edx
movl %ecx, (%rax,%rdx,4)
incq %r12
movslq (%rbx), %rax
addq $0x20, %r13
cmpq %rax, %r12
jl 0x62ffb
cmpb $0x0, 0x108(%rsp)
sete %al
cmpq $0x0, 0x80(%rsp)
setne %cl
orb %al, %cl
jne 0x6317d
movq 0x8(%rsp), %rdi
callq 0x4a501
movl %eax, %ebp
movb 0x110(%rsp), %al
movl %eax, %r15d
cmpb $0xa, %al
jne 0x6311c
movq 0x10(%rsp), %rax
movzbl 0x49(%rax), %eax
cmpb $0xa, %al
movl $0x2, %r15d
cmovnel %eax, %r15d
movl 0x100(%rsp), %r8d
testl %r8d, %r8d
movq 0x68(%rsp), %r13
je 0x63142
movq 0x8(%rsp), %rdi
movl $0x4d, %esi
movl %r13d, %edx
movl %ebp, %ecx
callq 0x487d8
xorl %r12d, %r12d
cmpb $0x5, 0x110(%rsp)
je 0x631d6
cmpb $0x5, %r15b
jne 0x631d6
movq 0x10(%rsp), %rax
movq 0x10(%rax), %rax
testq %rax, %rax
je 0x631a0
movb 0x62(%rax), %cl
addb $-0x3, %cl
cmpb $0x1, %cl
jbe 0x631bd
movq 0x28(%rax), %rax
testq %rax, %rax
jne 0x63167
jmp 0x631d6
movl $0x0, 0x4c(%rsp)
movl $0x0, 0x50(%rsp)
movq $0x0, 0x38(%rsp)
movq 0x68(%rsp), %r13
jmp 0x633e7
movq 0x8(%rsp), %rdi
movl $0x41, %esi
movl 0x24(%rsp), %edx
movl %ebp, %ecx
movl %r13d, %r8d
callq 0x487d8
xorl %r12d, %r12d
jmp 0x63210
movq 0x8(%rsp), %rdi
movl $0x10, %esi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x487d8
movl %eax, %r12d
movq 0x8(%rsp), %rdi
movl $0x41, %esi
movl 0x24(%rsp), %edx
movl %ebp, %ecx
movl %r13d, %r8d
callq 0x487d8
movzbl %r15b, %eax
leal -0x1(%rax), %ecx
cmpl $0x3, %ecx
jb 0x632e5
cmpl $0x4, %eax
je 0x632b9
cmpl $0x5, %eax
jne 0x632e2
movq 0x70(%rsp), %rax
testb $0x4, 0x2e(%rax)
je 0x6325f
movq %r14, %rdi
movq 0x10(%rsp), %rsi
movl $0x6b, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x5f8ca
testq %rax, %rax
je 0x6325f
movq 0x1e0(%r14), %rcx
testq %rcx, %rcx
cmoveq %r14, %rcx
movb $0x1, 0x23(%rcx)
movl $0x1, %r10d
movq %r14, %rdi
movq 0x10(%rsp), %rsi
movq %rax, %rdx
jmp 0x6333e
movq (%r14), %rax
testb $0x8, 0x2e(%rax)
movq 0x10(%rsp), %r14
jne 0x63301
movl $0x1, %eax
movq %rax, 0x38(%rsp)
cmpq $0x0, 0x10(%r14)
je 0x63acd
movq 0x18(%rsp), %rdi
movq 0x1e0(%rdi), %rax
testq %rax, %rax
cmoveq %rdi, %rax
movb $0x1, 0x23(%rax)
movq %r14, %rsi
movq %rdi, %r14
movl 0x24(%rsp), %edx
movq 0x60(%rsp), %rcx
xorl %r8d, %r8d
callq 0x60c7d
jmp 0x63365
movq $0x0, 0x38(%rsp)
movq 0x8(%rsp), %rdi
movl $0x10, %esi
xorl %edx, %edx
movl 0x118(%rsp), %ecx
xorl %r8d, %r8d
callq 0x487d8
jmp 0x63365
movb $0x2, %r15b
movzbl %r15b, %esi
movq %r14, %rdi
movq 0x10(%rsp), %rdx
callq 0x63ccb
movq $0x0, 0x38(%rsp)
jmp 0x63365
movq %r14, %rdi
callq 0x52fb1
testq %rax, %rax
jne 0x63319
cmpq $0x0, 0x20(%r14)
je 0x63271
movq 0x18(%rsp), %rdi
movq 0x1e0(%rdi), %rax
testq %rax, %rax
cmoveq %rdi, %rax
movb $0x1, 0x23(%rax)
movl $0x1, %r10d
movq %r14, %rsi
movq %rdi, %r14
xorl %edx, %edx
movl 0x24(%rsp), %ecx
movq 0x60(%rsp), %r8
movl %r13d, %r9d
pushq %r10
pushq $0x5
pushq $0x0
movl $0x1, %eax
movq %rax, 0x50(%rsp)
pushq %r10
callq 0x5fe4c
addq $0x20, %rsp
testl %ebp, %ebp
jns 0x63386
movq 0x8(%rsp), %rax
movq 0x40(%rax), %rax
testq %rax, %rax
je 0x63386
notl %ebp
movq 0x8(%rsp), %rcx
movl 0x34(%rcx), %ecx
movl %ebp, %edx
movl %ecx, (%rax,%rdx,4)
testl %r12d, %r12d
je 0x633d7
movq 0x8(%rsp), %rdi
movl $0x10, %esi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x487d8
testl %r12d, %r12d
movq 0x10(%rsp), %rbp
movl %r12d, 0x50(%rsp)
movl %eax, 0x4c(%rsp)
js 0x633ec
movq 0x8(%rsp), %rcx
movl 0x34(%rcx), %esi
cmpl %r12d, %esi
jbe 0x633ec
movq 0x8(%rsp), %rax
movq 0x8(%rax), %rcx
movl %r12d, %edx
leaq (%rdx,%rdx,2), %rdx
movl %esi, 0x8(%rcx,%rdx,8)
jmp 0x633ec
movl $0x0, 0x4c(%rsp)
movl $0x0, 0x50(%rsp)
movq 0x10(%rsp), %rbp
movq 0x10(%rbp), %r15
testq %r15, %r15
je 0x63a66
leal 0x1(%r13), %eax
movl %eax, 0x30(%rsp)
movl 0x100(%rsp), %eax
leal 0x1(%rax), %esi
xorl %r12d, %r12d
movswl 0x78(%rsp), %eax
movq %rax, 0xb0(%rsp)
movl %esi, 0xac(%rsp)
movq 0x98(%rsp), %rax
cmpl $0x0, (%rax,%r12,4)
je 0x63a56
movq 0x8(%rsp), %r13
movq %r13, %rdi
callq 0x4a501
movl %eax, %ebx
cmpq $0x0, 0x48(%r15)
je 0x6348c
movq 0x98(%rsp), %rax
movl (%rax,%r12,4), %ecx
movq %r13, %rdi
movl $0x1a, %esi
xorl %edx, %edx
xorl %r8d, %r8d
callq 0x487d8
movl 0x30(%rsp), %eax
movl %eax, 0x64(%r14)
movq 0x48(%r15), %rsi
movq %r14, %rdi
movl %ebx, %edx
movl $0x8, %ecx
callq 0x4b278
movl $0x0, 0x64(%r14)
movl %ebx, 0x28(%rsp)
movzwl 0x60(%r15), %eax
movl 0x48(%r14), %ecx
subl %eax, %ecx
movq %r12, 0x88(%rsp)
jge 0x634b4
movl 0x58(%r14), %ecx
leal 0x1(%rcx), %esi
addl %eax, %ecx
movl %ecx, 0x58(%r14)
jmp 0x634c3
movl 0x4c(%r14), %esi
leal (%rsi,%rax), %edx
movl %edx, 0x4c(%r14)
movl %ecx, 0x48(%r14)
movq %r13, %rbx
testl %eax, %eax
movq 0x68(%rsp), %r13
movq %rsi, 0x40(%rsp)
je 0x6351c
movl %esi, %r14d
xorl %r12d, %r12d
movq 0x8(%r15), %rax
movswl (%rax,%r12,2), %eax
movl %r13d, %edx
testl %eax, %eax
js 0x634f9
movl %r13d, %edx
cmpw 0x40(%rbp), %ax
je 0x634f9
addl 0x30(%rsp), %eax
movl %eax, %edx
leal (%r14,%r12), %ecx
movq %rbx, %rdi
movl $0x1f, %esi
xorl %r8d, %r8d
callq 0x487d8
incq %r12
movzwl 0x60(%r15), %ecx
cmpq %rcx, %r12
jb 0x634da
jmp 0x6351e
xorl %ecx, %ecx
cmpb $0x0, 0x108(%rsp)
setne %bpl
movl 0x100(%rsp), %eax
testl %eax, %eax
sete 0xa0(%rsp)
movq 0x98(%rsp), %rax
movq 0x88(%rsp), %r12
movl (%rax,%r12,4), %r8d
movq %rbx, %rdi
movl $0x2d, %esi
movq %rbx, %r14
movq 0x40(%rsp), %rbx
movl %ebx, %edx
callq 0x487d8
movq %r14, %rdi
movq %r15, %rsi
callq 0x52a33
movq %r14, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movq %rax, %rdx
xorl %ecx, %ecx
callq 0x12044
movzwl 0x60(%r15), %edx
movq 0x18(%rsp), %rdi
movl %ebx, %esi
callq 0x4a54e
cmpq %r15, 0x80(%rsp)
setne %al
orb %bpl, %al
orb 0xa0(%rsp), %al
je 0x63655
movb 0x62(%r15), %al
testb %al, %al
je 0x6366c
cmpb $0xa, %al
movzbl %al, %r14d
movl $0x2, %eax
cmovel %eax, %r14d
cmpb $0xa, 0x110(%rsp)
cmovnel 0x54(%rsp), %r14d
movzwl 0x5e(%r15), %ebp
movq 0x60(%rsp), %rax
addl %eax, %r12d
movq 0x8(%rsp), %r13
movq %r13, %rdi
movl $0x3e, %esi
movl %r12d, %edx
movl 0x28(%rsp), %ecx
movq 0x40(%rsp), %rbx
movl %ebx, %r8d
callq 0x487d8
movq %r13, %rdi
movl %eax, %esi
movq %rbp, %rdx
movl $0xfffffff2, %ecx       # imm = 0xFFFFFFF2
callq 0x12044
movl %ebx, %ecx
movq 0x80(%rsp), %rbp
cmpq %rbp, %r15
movq 0x10(%rsp), %rdx
movq 0x78(%rsp), %rdi
je 0x636dc
movq 0x18(%rsp), %rsi
movl 0x48(%rsi), %eax
subl %edi, %eax
jge 0x636d1
movl 0x58(%rsi), %eax
leal 0x1(%rax), %ecx
addl %edi, %eax
movl %eax, 0x58(%rsi)
jmp 0x636dc
movl 0x28(%rsp), %edx
testl %edx, %edx
js 0x636b0
movq 0x10(%rsp), %rbp
movq 0x18(%rsp), %r14
jmp 0x63a56
movzwl 0x60(%r15), %ebp
movq 0x18(%rsp), %rbx
movq %rbx, %rdi
movq 0x40(%rsp), %r14
movl %r14d, %esi
movl %ebp, %edx
callq 0x4a54e
movq %rbx, %rcx
cmpl %ebp, 0x48(%rbx)
jge 0x63697
movl %ebp, 0x48(%rcx)
movl %r14d, 0x4c(%rcx)
movl 0x28(%rsp), %edx
testl %edx, %edx
js 0x63923
movq 0x10(%rsp), %rbp
movq %rcx, %r14
jmp 0x63a56
movq 0x8(%rsp), %rax
movq 0x40(%rax), %rax
testq %rax, %rax
movq 0x10(%rsp), %rbp
movq 0x18(%rsp), %r14
jne 0x6393d
jmp 0x63a56
movl 0x4c(%rsi), %ecx
addl %ecx, %edi
movl %edi, 0x4c(%rsi)
movl %eax, 0x48(%rsi)
movzbl %r14b, %esi
testb $0x20, 0x48(%rdx)
movq %rcx, 0x58(%rsp)
movq %rsi, 0xb8(%rsp)
movq %r15, 0x90(%rsp)
jne 0x63744
movq 0x8(%rsp), %rdi
movl $0x6b, %esi
movl %r12d, %edx
xorl %r8d, %r8d
callq 0x487d8
movl 0x100(%rsp), %eax
testl %eax, %eax
movl 0x28(%rsp), %ecx
je 0x638b4
movq 0x8(%rsp), %rdi
movl $0x4d, %esi
movq 0x58(%rsp), %rdx
movl 0x100(%rsp), %r8d
callq 0x487d8
jmp 0x638b4
movl 0x100(%rsp), %r14d
testl %r14d, %r14d
sete %al
cmpl $0x5, %esi
setne %cl
cmpq %rbp, %r15
movq 0x8(%rsp), %rbx
je 0x637d1
andb %cl, %al
jne 0x637d1
cmpw $0x0, 0x5e(%rbp)
je 0x637d1
xorl %r13d, %r13d
movzwl 0x60(%r15), %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
testq %rax, %rax
movq 0x58(%rsp), %r8
je 0x637b2
movq 0x8(%rbp), %rdx
movzwl (%rdx,%r13,2), %edx
movq 0x8(%r15), %rsi
shll $0x10, %eax
xorl %edi, %edi
cmpw %dx, (%rsi)
je 0x637ad
addq $0x10000, %rdi          # imm = 0x10000
addq $0x2, %rsi
cmpq %rdi, %rax
jne 0x63796
jmp 0x637b2
sarl $0x10, %edi
movl %edi, %ecx
addl %r13d, %r8d
movq %rbx, %rdi
movl $0x2b, %esi
movl %r12d, %edx
callq 0x487d8
incq %r13
movzwl 0x5e(%rbp), %eax
cmpq %rax, %r13
jb 0x63770
testl %r14d, %r14d
movl 0xac(%rsp), %r13d
movl $0x4d, %ebx
je 0x638b4
movq %rbp, %r15
movzwl 0x5e(%rbp), %r12d
testl %r12d, %r12d
je 0x638b4
movq 0x90(%rsp), %rax
movb 0x63(%rax), %al
andb $0x3, %al
cmpb $0x2, %al
movq 0x58(%rsp), %rax
cmovel 0x40(%rsp), %eax
movq %rax, 0xc0(%rsp)
movq 0x8(%rsp), %rax
addl 0x34(%rax), %r12d
movl $0x4c, %ebp
xorl %r14d, %r14d
movq 0x40(%r15), %rax
movq (%rax,%r14,8), %rsi
movq 0x18(%rsp), %rdi
callq 0x48c12
movq %rax, 0xa0(%rsp)
movq 0x8(%r15), %rax
movswl (%rax,%r14,2), %edx
movzwl 0x5e(%r15), %eax
decl %eax
cmpq %rax, %r14
cmovel 0x28(%rsp), %r12d
cmovel %ebx, %ebp
addl %r13d, %edx
movq 0xc0(%rsp), %rax
leal (%rax,%r14), %r8d
movl %r13d, %ebx
movq 0x8(%rsp), %r13
movq %r13, %rdi
movl %ebp, %esi
movl %r12d, %ecx
callq 0x487d8
movq %r13, %rdi
movl %ebx, %r13d
movl $0x4d, %ebx
movl %eax, %esi
movq 0xa0(%rsp), %rdx
movl $0xfffffffc, %ecx       # imm = 0xFFFFFFFC
callq 0x12044
incq %r14
movzwl 0x5e(%r15), %eax
cmpq %rax, %r14
jb 0x6382a
movq 0x8(%rsp), %rcx
movq 0xb8(%rsp), %rsi
leal -0x1(%rsi), %eax
cmpl $0x3, %eax
jae 0x638e6
movq 0x18(%rsp), %r14
movq %r14, %rdi
movq 0x90(%rsp), %r15
movq %r15, %rdx
callq 0x5291b
jmp 0x639ce
cmpl $0x4, %esi
movq 0x10(%rsp), %r14
movq 0x80(%rsp), %rbx
movq 0x90(%rsp), %r15
jne 0x63951
movq %rcx, %rdi
movl $0x10, %esi
xorl %edx, %edx
movl 0x118(%rsp), %ecx
xorl %r8d, %r8d
callq 0x487d8
movq 0x18(%rsp), %r14
jmp 0x639ce
movq 0x8(%rsp), %rax
movq 0x40(%rax), %rax
testq %rax, %rax
movq 0x10(%rsp), %rbp
movq %rcx, %r14
je 0x63a56
notl %edx
movq 0x8(%rsp), %rcx
movl 0x34(%rcx), %ecx
movl %edx, %edx
movl %ecx, (%rax,%rdx,4)
jmp 0x63a56
movq 0x18(%rsp), %r12
movq 0x1e0(%r12), %rax
testq %rax, %rax
cmoveq %r12, %rax
movb $0x1, 0x23(%rax)
movq 0x70(%rsp), %rax
testb $0x4, 0x2e(%rax)
jne 0x63978
xorl %edx, %edx
jmp 0x63990
movq %r12, %rdi
movq %r14, %rsi
movl $0x6b, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x5f8ca
movq %rax, %rdx
movq 0x58(%rsp), %r9
xorl %eax, %eax
cmpq %rbx, %r15
sete %al
movq %r12, %rdi
movq %r14, %rsi
movl 0x24(%rsp), %ecx
movq 0x60(%rsp), %r8
pushq %rax
pushq $0x5
pushq $0x0
pushq 0xc8(%rsp)
callq 0x5fe4c
addq $0x20, %rsp
movl $0x1, %eax
movq %rax, 0x38(%rsp)
movq %r12, %r14
movq 0x40(%rsp), %r12
movl 0x28(%rsp), %edx
testl %edx, %edx
jns 0x639f8
movq 0x8(%rsp), %rax
movq 0x40(%rax), %rax
testq %rax, %rax
je 0x639f8
notl %edx
movq 0x8(%rsp), %rcx
movl 0x34(%rcx), %ecx
movl %edx, %edx
movl %ecx, (%rax,%rdx,4)
movzwl 0x60(%r15), %ebp
movq %r14, %rdi
movl %r12d, %esi
movl %ebp, %edx
callq 0x4a54e
cmpl %ebp, 0x48(%r14)
jge 0x63a18
movl %ebp, 0x48(%r14)
movl %r12d, 0x4c(%r14)
movq 0x58(%rsp), %rbx
cmpl %r12d, %ebx
jne 0x63a29
movq 0x10(%rsp), %rbp
jmp 0x63a4e
movq %r14, %rdi
movl %ebx, %esi
movq 0x78(%rsp), %r12
movl %r12d, %edx
callq 0x4a54e
cmpl %r12d, 0x48(%r14)
movq 0x10(%rsp), %rbp
jge 0x63a4e
movl %r12d, 0x48(%r14)
movl %ebx, 0x4c(%r14)
movq 0x88(%rsp), %r12
incq %r12
movq 0x28(%r15), %r15
testq %r15, %r15
jne 0x63422
movq 0x120(%rsp), %r14
movl 0x50(%rsp), %ecx
testl %ecx, %ecx
movl 0x4c(%rsp), %ebp
je 0x63ab3
incl %ecx
movq 0x8(%rsp), %rdi
movl $0x10, %esi
xorl %edx, %edx
xorl %r8d, %r8d
callq 0x487d8
testl %ebp, %ebp
js 0x63ab3
movq 0x8(%rsp), %rax
movl 0x34(%rax), %eax
cmpl %ebp, %eax
jbe 0x63ab3
movq 0x8(%rsp), %rcx
movq 0x8(%rcx), %rcx
movl %ebp, %edx
leaq (%rdx,%rdx,2), %rdx
movl %eax, 0x8(%rcx,%rdx,8)
movq 0x38(%rsp), %rax
movl %eax, (%r14)
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x18(%rsp), %r14
jmp 0x63365