// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3GenerateConstraintChecks
SQLITE_PRIVATE void sqlite3GenerateConstraintChecks(
  Parse *pParse,      /* The parser context */
  Table *pTab,        /* the table into which we are inserting */
  int baseCur,        /* Index of a read/write cursor pointing at pTab */
  int regRowid,       /* Index of the range of input registers */
  int *aRegIdx,       /* Register used by each index.  0 for unused indices */
  int rowidChng,      /* True if the rowid might collide with existing entry */
  int isUpdate,       /* True for UPDATE, False for INSERT */
  int 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 */
){
  int i;              /* loop counter */
  Vdbe *v;            /* VDBE under constrution */
  int nCol;           /* Number of columns */
  int onError;        /* Conflict resolution strategy */
  int j1;             /* Addresss of jump instruction */
  int j2 = 0, j3;     /* Addresses of jump instructions */
  int regData;        /* Register containing first data column */
  int iCur;           /* Table cursor number */
  Index *pIdx;         /* Pointer to one of the indices */
  sqlite3 *db;         /* Database connection */
  int seenReplace = 0; /* True if REPLACE is used to resolve INT PK conflict */
  int regOldRowid = (rowidChng && isUpdate) ? rowidChng : regRowid;

  db = pParse->db;
  v = sqlite3GetVdbe(pParse);
  assert( v!=0 );
  assert( pTab->pSelect==0 );  /* This table is not a VIEW */
  nCol = pTab->nCol;
  regData = regRowid + 1;

  /* 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);
      case OE_Rollback:
      case OE_Fail: {
        char *zMsg;
        sqlite3VdbeAddOp3(v, OP_HaltIfNull,
                          SQLITE_CONSTRAINT_NOTNULL, onError, regData+i);
        zMsg = sqlite3MPrintf(db, "%s.%s may not be NULL",
                              pTab->zName, pTab->aCol[i].zName);
        sqlite3VdbeChangeP4(v, -1, zMsg, P4_DYNAMIC);
        break;
      }
      case OE_Ignore: {
        sqlite3VdbeAddOp2(v, OP_IsNull, regData+i, ignoreDest);
        break;
      }
      default: {
        assert( onError==OE_Replace );
        j1 = sqlite3VdbeAddOp1(v, OP_NotNull, regData+i);
        sqlite3ExprCode(pParse, pTab->aCol[i].pDflt, regData+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 = regData;
    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 *zConsName = pCheck->a[i].zName;
        if( onError==OE_Replace ) onError = OE_Abort; /* IMP: R-15569-63625 */
        if( zConsName ){
          zConsName = sqlite3MPrintf(db, "constraint %s failed", zConsName);
        }else{
          zConsName = 0;
        }
        sqlite3HaltConstraint(pParse, SQLITE_CONSTRAINT_CHECK,
                              onError, zConsName, P4_DYNAMIC);
      }
      sqlite3VdbeResolveLabel(v, allOk);
    }
  }
#endif /* !defined(SQLITE_OMIT_CHECK) */

  /* If we have an INTEGER PRIMARY KEY, make sure the primary key
  ** of the new record does not previously exist.  Except, if this
  ** is an UPDATE and the primary key is not changing, that is OK.
  */
  if( rowidChng ){
    onError = pTab->keyConf;
    if( overrideError!=OE_Default ){
      onError = overrideError;
    }else if( onError==OE_Default ){
      onError = OE_Abort;
    }
    
    if( isUpdate ){
      j2 = sqlite3VdbeAddOp3(v, OP_Eq, regRowid, 0, rowidChng);
    }
    j3 = sqlite3VdbeAddOp3(v, OP_NotExists, baseCur, 0, regRowid);
    switch( onError ){
      default: {
        onError = OE_Abort;
        /* Fall thru into the next case */
      }
      case OE_Rollback:
      case OE_Abort:
      case OE_Fail: {
        sqlite3HaltConstraint(pParse, SQLITE_CONSTRAINT_PRIMARYKEY,
           onError, "PRIMARY KEY must be unique", P4_STATIC);
        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, baseCur, regRowid, 0, pTrigger, OE_Replace
          );
        }else if( pTab->pIndex ){
          sqlite3MultiWrite(pParse);
          sqlite3GenerateRowIndexDelete(pParse, pTab, baseCur, 0);
        }
        seenReplace = 1;
        break;
      }
      case OE_Ignore: {
        assert( seenReplace==0 );
        sqlite3VdbeAddOp2(v, OP_Goto, 0, ignoreDest);
        break;
      }
    }
    sqlite3VdbeJumpHere(v, j3);
    if( isUpdate ){
      sqlite3VdbeJumpHere(v, j2);
    }
  }

  /* Test all UNIQUE constraints by creating entries for each UNIQUE
  ** index and making sure that duplicate entries do not already exist.
  ** Add the new records to the indices as we go.
  */
  for(iCur=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, iCur++){
    int regIdx;
    int regR;
    int addrSkipRow = 0;

    if( aRegIdx[iCur]==0 ) continue;  /* Skip unused indices */

    if( pIdx->pPartIdxWhere ){
      sqlite3VdbeAddOp2(v, OP_Null, 0, aRegIdx[iCur]);
      addrSkipRow = sqlite3VdbeMakeLabel(v);
      pParse->ckBase = regData;
      sqlite3ExprIfFalse(pParse, pIdx->pPartIdxWhere, addrSkipRow,
                         SQLITE_JUMPIFNULL);
      pParse->ckBase = 0;
    }

    /* Create a key for accessing the index entry */
    regIdx = sqlite3GetTempRange(pParse, pIdx->nColumn+1);
    for(i=0; i<pIdx->nColumn; i++){
      int idx = pIdx->aiColumn[i];
      if( idx==pTab->iPKey ){
        sqlite3VdbeAddOp2(v, OP_SCopy, regRowid, regIdx+i);
      }else{
        sqlite3VdbeAddOp2(v, OP_SCopy, regData+idx, regIdx+i);
      }
    }
    sqlite3VdbeAddOp2(v, OP_SCopy, regRowid, regIdx+i);
    sqlite3VdbeAddOp3(v, OP_MakeRecord, regIdx, pIdx->nColumn+1, aRegIdx[iCur]);
    sqlite3VdbeChangeP4(v, -1, sqlite3IndexAffinityStr(v, pIdx), P4_TRANSIENT);
    sqlite3ExprCacheAffinityChange(pParse, regIdx, pIdx->nColumn+1);

    /* Find out what action to take in case there is an indexing conflict */
    onError = pIdx->onError;
    if( onError==OE_None ){ 
      sqlite3ReleaseTempRange(pParse, regIdx, pIdx->nColumn+1);
      sqlite3VdbeResolveLabel(v, addrSkipRow);
      continue;  /* pIdx is not a UNIQUE index */
    }
    if( overrideError!=OE_Default ){
      onError = overrideError;
    }else if( onError==OE_Default ){
      onError = OE_Abort;
    }
    if( seenReplace ){
      if( onError==OE_Ignore ) onError = OE_Replace;
      else if( onError==OE_Fail ) onError = OE_Abort;
    }
    
    /* Check to see if the new index entry will be unique */
    regR = sqlite3GetTempReg(pParse);
    sqlite3VdbeAddOp2(v, OP_SCopy, regOldRowid, regR);
    j3 = sqlite3VdbeAddOp4(v, OP_IsUnique, baseCur+iCur+1, 0,
                           regR, SQLITE_INT_TO_PTR(regIdx),
                           P4_INT32);
    sqlite3ReleaseTempRange(pParse, regIdx, pIdx->nColumn+1);

    /* 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: {
        int j;
        StrAccum errMsg;
        const char *zSep;
        char *zErr;

        sqlite3StrAccumInit(&errMsg, 0, 0, 200);
        errMsg.db = db;
        zSep = pIdx->nColumn>1 ? "columns " : "column ";
        for(j=0; j<pIdx->nColumn; j++){
          char *zCol = pTab->aCol[pIdx->aiColumn[j]].zName;
          sqlite3StrAccumAppend(&errMsg, zSep, -1);
          zSep = ", ";
          sqlite3StrAccumAppend(&errMsg, zCol, -1);
        }
        sqlite3StrAccumAppend(&errMsg,
            pIdx->nColumn>1 ? " are not unique" : " is not unique", -1);
        zErr = sqlite3StrAccumFinish(&errMsg);
        sqlite3HaltConstraint(pParse, SQLITE_CONSTRAINT_UNIQUE,
                              onError, zErr, 0);
        sqlite3DbFree(errMsg.db, zErr);
        break;
      }
      case OE_Ignore: {
        assert( seenReplace==0 );
        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, baseCur, regR, 0, pTrigger, OE_Replace
        );
        seenReplace = 1;
        break;
      }
    }
    sqlite3VdbeJumpHere(v, j3);
    sqlite3VdbeResolveLabel(v, addrSkipRow);
    sqlite3ReleaseTempReg(pParse, regR);
  }
  
  if( pbMayReplace ){
    *pbMayReplace = seenReplace;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %r8, -0x98(%rbp)
movl %ecx, %ebx
movq %rdx, -0x68(%rbp)
movq %rsi, %r12
movq %rdi, %r15
cmpl $0x0, 0x10(%rbp)
movl %ecx, %eax
cmovnel %r9d, %eax
movl %r9d, -0x58(%rbp)
testl %r9d, %r9d
cmovel %ecx, %eax
movl %eax, -0x8c(%rbp)
movq (%rdi), %rax
movq %rax, -0x70(%rbp)
callq 0x45ece
movq %rax, %r14
movswq 0x42(%r12), %rsi
movq %rbx, -0x78(%rbp)
leal 0x1(%rbx), %eax
movq %rax, -0x88(%rbp)
testq %rsi, %rsi
movq %r14, -0x30(%rbp)
jle 0x5f075
movl -0x88(%rbp), %eax
movq %rax, -0x40(%rbp)
movl $0x28, %ebx
xorl %r13d, %r13d
movq %rsi, -0x48(%rbp)
movswq 0x40(%r12), %rax
movl %eax, %eax
cmpq %rax, %r13
je 0x5f065
movq 0x8(%r12), %rax
movb (%rax,%rbx), %cl
testb %cl, %cl
je 0x5f065
cmpb $0x63, %cl
movzbl %cl, %ecx
movl $0x2, %edx
cmovel %edx, %ecx
movl 0x18(%rbp), %edx
cmpl $0x63, %edx
movzbl %cl, %ecx
cmovnel %edx, %ecx
leal -0x1(%rcx), %edx
cmpl $0x4, %edx
ja 0x5ef9a
leaq 0x16fb3(%rip), %rsi     # 0x75f1c
movslq (%rsi,%rdx,4), %rdx
addq %rsi, %rdx
jmpq *%rdx
movq -0x40(%rbp), %rax
leal (%rax,%r13), %edx
movq %r14, %rdi
movl $0x49, %esi
movl 0x20(%rbp), %ecx
xorl %r8d, %r8d
callq 0x45f15
jmp 0x5f061
cmpq $0x0, -0x20(%rax,%rbx)
je 0x5effb
movq -0x40(%rbp), %rax
leal (%rax,%r13), %r14d
movq -0x30(%rbp), %rdi
movl $0x4a, %esi
movl %r14d, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x45f15
movl %eax, -0x38(%rbp)
movq 0x8(%r12), %rax
movq -0x20(%rax,%rbx), %rsi
movq %r15, %rdi
movl %r14d, %edx
movq -0x30(%rbp), %r14
callq 0x4e50a
movl -0x38(%rbp), %edx
testl %edx, %edx
movq -0x48(%rbp), %rsi
js 0x5f065
movl 0x34(%r14), %eax
cmpl %edx, %eax
jbe 0x5f065
movq 0x8(%r14), %rcx
movl %edx, %edx
leaq (%rdx,%rdx,2), %rdx
movl %eax, 0x8(%rcx,%rdx,8)
jmp 0x5f065
movq 0x1d8(%r15), %rax
testq %rax, %rax
cmoveq %r15, %rax
movb $0x1, 0x24(%rax)
movl $0x2, %ecx
movq -0x40(%rbp), %rax
leal (%rax,%r13), %r8d
movq %r14, %rdi
movl $0x12, %esi
movl $0x513, %edx            # imm = 0x513
callq 0x45f15
movq (%r12), %rdx
movq 0x8(%r12), %rax
movq -0x28(%rax,%rbx), %rcx
movq -0x70(%rbp), %rdi
leaq 0x1cdb5(%rip), %rsi     # 0x7bdfa
xorl %eax, %eax
callq 0x11900
movq %r14, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movq %rax, %rdx
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
callq 0x11a9f
movq -0x48(%rbp), %rsi
incq %r13
addq $0x30, %rbx
cmpq %r13, %rsi
jne 0x5ef1f
movq 0x30(%r12), %rsi
testq %rsi, %rsi
je 0x5f1b9
movq -0x70(%rbp), %rax
testb $0x20, 0x2d(%rax)
jne 0x5f1b9
movq -0x88(%rbp), %rax
movl %eax, 0x64(%r15)
cmpl $0x0, (%rsi)
jle 0x5f1b9
movl 0x18(%rbp), %eax
cmpl $0x63, %eax
movl $0x2, %ecx
cmovel %ecx, %eax
movl %eax, -0x48(%rbp)
xorl %ebx, %ebx
xorl %r13d, %r13d
movq %rsi, -0x40(%rbp)
movq %r15, -0x50(%rbp)
movq %r12, -0x60(%rbp)
movq %r14, %rdi
movq %rsi, %r12
callq 0x4c5eb
movl %eax, %r14d
movq 0x8(%r12), %rax
movq (%rax,%rbx), %rsi
movq %r15, %rdi
movl %r14d, %edx
movl $0x8, %ecx
callq 0x4ca74
movl -0x48(%rbp), %r8d
cmpl $0x4, %r8d
jne 0x5f11f
movq -0x30(%rbp), %rdi
movl $0xe, %esi
xorl %edx, %edx
movl 0x20(%rbp), %ecx
xorl %r8d, %r8d
callq 0x45f15
movl $0x4, -0x48(%rbp)
movq -0x60(%rbp), %r12
movq -0x50(%rbp), %r15
jmp 0x5f17c
movq 0x8(%r12), %rax
movq 0x8(%rax,%rbx), %rdx
cmpl $0x5, %r8d
movl $0x2, %eax
cmovel %eax, %r8d
testq %rdx, %rdx
je 0x5f158
movq -0x70(%rbp), %rdi
leaq 0x1ccca(%rip), %rsi     # 0x7be10
xorl %eax, %eax
movl %r8d, %r15d
callq 0x11900
movl %r15d, %r8d
movq %rax, %rcx
jmp 0x5f15a
xorl %ecx, %ecx
movq -0x60(%rbp), %r12
movq -0x50(%rbp), %r15
movq %r15, %rdi
movl $0x113, %esi            # imm = 0x113
movl %r8d, -0x48(%rbp)
movl %r8d, %edx
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
callq 0x4c573
testl %r14d, %r14d
movq -0x40(%rbp), %rsi
jns 0x5f1a2
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rax
testq %rax, %rax
je 0x5f1a2
notl %r14d
movq -0x30(%rbp), %rcx
movl 0x34(%rcx), %ecx
movl %r14d, %edx
movl %ecx, (%rax,%rdx,4)
incq %r13
movslq (%rsi), %rax
addq $0x20, %rbx
cmpq %rax, %r13
movq -0x30(%rbp), %r14
jl 0x5f0c7
movl -0x58(%rbp), %r8d
testl %r8d, %r8d
je 0x5f203
movl 0x18(%rbp), %eax
movl %eax, %r13d
cmpl $0x63, %eax
movq -0x78(%rbp), %rbx
jne 0x5f1e5
movzbl 0x47(%r12), %eax
cmpb $0x63, %al
movl $0x2, %ecx
cmovnel %eax, %ecx
movzbl %cl, %r13d
cmpl $0x0, 0x10(%rbp)
je 0x5f20f
movq %r14, %rdi
movl $0x4c, %esi
movl %ebx, %edx
xorl %ecx, %ecx
callq 0x45f15
movq %rbx, %r8
movl %eax, %ebx
jmp 0x5f214
movl $0x0, -0x34(%rbp)
jmp 0x5f341
movq %rbx, %r8
xorl %ebx, %ebx
movl $0x0, -0x34(%rbp)
movq %r14, %rdi
movl $0x3f, %esi
movq -0x68(%rbp), %rdx
xorl %ecx, %ecx
callq 0x45f15
movl %eax, %r14d
leal -0x1(%r13), %eax
cmpl $0x3, %eax
jb 0x5f2cd
cmpl $0x4, %r13d
je 0x5f2a8
cmpl $0x5, %r13d
jne 0x5f2c7
movq -0x70(%rbp), %rax
testb $0x4, 0x2e(%rax)
je 0x5f8b6
movq %r15, %rdi
movq %r12, %rsi
movl $0x6a, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x5be5e
testq %rax, %rax
je 0x5f8b6
movq 0x1d8(%r15), %rcx
testq %rcx, %rcx
cmoveq %r15, %rcx
movb $0x1, 0x23(%rcx)
movl $0x5, (%rsp)
movq %r15, %rdi
movq %r12, %rsi
movq -0x68(%rbp), %rdx
movq -0x78(%rbp), %rcx
xorl %r8d, %r8d
movq %rax, %r9
jmp 0x5f93c
movl $0x0, -0x34(%rbp)
movq -0x30(%rbp), %rdi
movl $0xe, %esi
xorl %edx, %edx
movl 0x20(%rbp), %ecx
xorl %r8d, %r8d
callq 0x45f15
jmp 0x5f2ea
movl $0x2, %r13d
leaq 0x1cb51(%rip), %rcx     # 0x7be25
movq %r15, %rdi
movl $0x613, %esi            # imm = 0x613
movl %r13d, %edx
movl $0xfffffffe, %r8d       # imm = 0xFFFFFFFE
callq 0x4c573
testl %r14d, %r14d
js 0x5f30e
movq -0x30(%rbp), %rax
movl 0x34(%rax), %eax
cmpl %r14d, %eax
jbe 0x5f30e
movq -0x30(%rbp), %rcx
movq 0x8(%rcx), %rcx
movl %r14d, %edx
leaq (%rdx,%rdx,2), %rdx
movl %eax, 0x8(%rcx,%rdx,8)
cmpl $0x0, 0x10(%rbp)
setne %al
testl %ebx, %ebx
setns %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x5f33d
movq -0x30(%rbp), %r14
movl 0x34(%r14), %eax
cmpl %ebx, %eax
jbe 0x5f341
movq 0x8(%r14), %rcx
movl %ebx, %edx
leaq (%rdx,%rdx,2), %rdx
movl %eax, 0x8(%rcx,%rdx,8)
jmp 0x5f341
movq -0x30(%rbp), %r14
movq 0x10(%r12), %rbx
testq %rbx, %rbx
je 0x5f896
movq -0x68(%rbp), %rax
incl %eax
movq %rax, -0xa0(%rbp)
xorl %r13d, %r13d
movq %r15, -0x50(%rbp)
movq %r12, -0x60(%rbp)
movq -0x98(%rbp), %rax
movl (%rax,%r13,4), %ecx
testl %ecx, %ecx
je 0x5f886
cmpq $0x0, 0x48(%rbx)
je 0x5f3c6
movq %r14, %rdi
movl $0x18, %esi
xorl %edx, %edx
xorl %r8d, %r8d
callq 0x45f15
movq %r14, %rdi
callq 0x4c5eb
movl %eax, %edx
movq -0x88(%rbp), %rax
movl %eax, 0x64(%r15)
movq 0x48(%rbx), %rsi
movq %r15, %rdi
movl %edx, -0x38(%rbp)
movl $0x8, %ecx
callq 0x4c638
movl $0x0, 0x64(%r15)
jmp 0x5f3cd
movl $0x0, -0x38(%rbp)
movzwl 0x54(%rbx), %eax
leal 0x1(%rax), %ecx
movl 0x48(%r15), %edx
cmpl %eax, %edx
jle 0x5f3f0
movl 0x4c(%r15), %r12d
leal (%r12,%rcx), %esi
movl %esi, 0x4c(%r15)
subl %ecx, %edx
movl %edx, 0x48(%r15)
jmp 0x5f3fe
movl 0x58(%r15), %edx
leal 0x1(%rdx), %r12d
addl %edx, %ecx
movl %ecx, 0x58(%r15)
movq %r13, -0x40(%rbp)
testw %ax, %ax
je 0x5f46c
movq %r12, -0x58(%rbp)
movl %r12d, %eax
movq %rax, -0x48(%rbp)
xorl %r13d, %r13d
movq -0x78(%rbp), %r12
movq -0x30(%rbp), %r14
movq -0x88(%rbp), %r15
movq 0x8(%rbx), %rax
movl (%rax,%r13,4), %eax
movq -0x60(%rbp), %rcx
movswl 0x40(%rcx), %ecx
leal (%rax,%r15), %edx
cmpl %ecx, %eax
cmovel %r12d, %edx
movq -0x48(%rbp), %rax
leal (%rax,%r13), %ecx
movq %r14, %rdi
movl $0x1d, %esi
xorl %r8d, %r8d
callq 0x45f15
incq %r13
movzwl 0x54(%rbx), %eax
cmpq %rax, %r13
jb 0x5f424
movq -0x50(%rbp), %r15
movq -0x58(%rbp), %r12
jmp 0x5f46f
xorl %r13d, %r13d
addl %r12d, %r13d
movq -0x30(%rbp), %r14
movq %r14, %rdi
movl $0x1d, %esi
movq -0x78(%rbp), %rdx
movl %r13d, %ecx
xorl %r8d, %r8d
callq 0x45f15
movzwl 0x54(%rbx), %ecx
incl %ecx
movq -0x98(%rbp), %rax
movq -0x40(%rbp), %r13
movl (%rax,%r13,4), %r8d
movq %r14, %rdi
movl $0x2b, %esi
movl %r12d, %edx
callq 0x45f15
movq %r14, %rdi
movq %rbx, %rsi
callq 0x4c9e0
movq %r14, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movq %rax, %rdx
xorl %ecx, %ecx
callq 0x11a9f
movzwl 0x54(%rbx), %edx
incl %edx
movq %r15, %rdi
movl %r12d, %esi
callq 0x4e564
movb 0x56(%rbx), %al
movl -0x38(%rbp), %ecx
notl %ecx
movl %ecx, -0x7c(%rbp)
testb %al, %al
je 0x5f548
cmpb $0x63, %al
movzbl %al, %eax
movl $0x2, %ecx
cmovel %ecx, %eax
movl 0x18(%rbp), %ecx
cmpl $0x63, %ecx
movzbl %al, %eax
cmovnel %ecx, %eax
cmpl $0x0, -0x34(%rbp)
je 0x5f523
movl $0x5, %ecx
cmpl $0x4, %eax
je 0x5f525
cmpl $0x3, %eax
movl $0x2, %ecx
cmovel %ecx, %eax
movl %eax, %ecx
movq %rcx, -0x48(%rbp)
movb 0x1f(%r15), %al
testb %al, %al
movq %rbx, -0xa8(%rbp)
je 0x5f589
decb %al
movb %al, 0x1f(%r15)
movzbl %al, %eax
movl 0x28(%r15,%rax,4), %ecx
jmp 0x5f593
movzwl 0x54(%rbx), %r15d
leal 0x1(%r15), %r13d
movq -0x50(%rbp), %rdi
movl %r12d, %esi
movl %r13d, %edx
callq 0x4e564
movq -0x50(%rbp), %rax
cmpl %r15d, 0x48(%rax)
movq -0x50(%rbp), %r15
jg 0x5f576
movl %r13d, 0x48(%r15)
movl %r12d, 0x4c(%r15)
cmpl $0x0, -0x38(%rbp)
js 0x5f78b
movq -0x40(%rbp), %r13
jmp 0x5f886
movl 0x58(%r15), %ecx
incl %ecx
movl %ecx, 0x58(%r15)
movq %r15, %r14
movq -0x30(%rbp), %rbx
movq %rbx, %rdi
movl $0x1d, %esi
movl -0x8c(%rbp), %edx
movl %ecx, %r15d
xorl %r8d, %r8d
callq 0x45f15
movq -0xa0(%rbp), %rax
leal (%rax,%r13), %edx
movslq %r12d, %r13
movq %rbx, %rdi
movl $0x3e, %esi
xorl %ecx, %ecx
movl %r15d, -0x58(%rbp)
movl %r15d, %r8d
callq 0x45f15
movq %rbx, %rdi
movl %eax, -0x90(%rbp)
movl %eax, %esi
movq %r13, %rdx
movl $0xfffffff2, %ecx       # imm = 0xFFFFFFF2
callq 0x11a9f
movq -0xa8(%rbp), %rbx
movzwl 0x54(%rbx), %r15d
leal 0x1(%r15), %r13d
movq %r14, %rdi
movl %r12d, %esi
movl %r13d, %edx
callq 0x4e564
cmpl %r15d, 0x48(%r14)
movq %r14, %r15
jg 0x5f61e
movl %r13d, 0x48(%r15)
movl %r12d, 0x4c(%r15)
movq -0x48(%rbp), %rcx
leal -0x1(%rcx), %eax
cmpl $0x3, %eax
leaq -0xd0(%rbp), %r14
jae 0x5f764
leaq -0xc8(%rbp), %rax
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq $0x0, 0x10(%rax)
movl $0xc8, -0xb0(%rbp)
movw $0x1, -0xac(%rbp)
movq -0x70(%rbp), %rax
movq %rax, -0xd0(%rbp)
movzwl 0x54(%rbx), %eax
leaq 0x1c7e1(%rip), %rsi     # 0x7be54
testw %ax, %ax
movq -0x40(%rbp), %r13
je 0x5f71d
cmpw $0x1, %ax
leaq 0x1c7b5(%rip), %rsi     # 0x7be40
leaq 0x1c7b7(%rip), %rax     # 0x7be49
cmoveq %rax, %rsi
xorl %r15d, %r15d
movq %rbx, %r12
leaq 0x1c7ae(%rip), %rbx     # 0x7be51
movq -0x60(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x8(%r12), %rcx
movslq (%rcx,%r15,4), %rcx
leaq (%rcx,%rcx,2), %rcx
shlq $0x4, %rcx
movq (%rax,%rcx), %r14
leaq -0xd0(%rbp), %r13
movq %r13, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x172f3
movq %r13, %rdi
movq %r14, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x172f3
incq %r15
movzwl 0x54(%r12), %eax
movq %rbx, %rsi
cmpq %rax, %r15
jb 0x5f6a3
cmpw $0x2, %ax
leaq 0x1c754(%rip), %rsi     # 0x7be54
leaq 0x1bf0c(%rip), %rax     # 0x7b613
cmovaeq %rax, %rsi
movq -0x50(%rbp), %r15
leaq -0xd0(%rbp), %r14
movq %r12, %rbx
movq -0x40(%rbp), %r13
movq %r14, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x172f3
movq %r14, %rdi
callq 0xb7d6
movq %rax, %r14
movq %r15, %rdi
movl $0x813, %esi            # imm = 0x813
movq -0x48(%rbp), %rdx
movq %rax, %rcx
xorl %r8d, %r8d
callq 0x4c573
movq -0xd0(%rbp), %rdi
movq %r14, %rsi
callq 0x9ca4
movq -0x30(%rbp), %r14
jmp 0x5f80f
cmpl $0x4, %ecx
movq -0x40(%rbp), %r13
jne 0x5f7ab
movq -0x30(%rbp), %r14
movq %r14, %rdi
movl $0xe, %esi
xorl %edx, %edx
movl 0x20(%rbp), %ecx
xorl %r8d, %r8d
callq 0x45f15
jmp 0x5f80f
movq 0x40(%r14), %rax
testq %rax, %rax
movq -0x40(%rbp), %r13
je 0x5f886
movl 0x34(%r14), %ecx
movl -0x7c(%rbp), %edx
movl %ecx, (%rax,%rdx,4)
jmp 0x5f886
movq 0x1d8(%r15), %rax
testq %rax, %rax
cmoveq %r15, %rax
movb $0x1, 0x23(%rax)
movq -0x70(%rbp), %rax
testb $0x4, 0x2e(%rax)
movq -0x30(%rbp), %r14
movq -0x60(%rbp), %r12
jne 0x5f7d4
xorl %r9d, %r9d
jmp 0x5f7ec
movq %r15, %rdi
movq %r12, %rsi
movl $0x6a, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x5be5e
movq %rax, %r9
movl -0x58(%rbp), %ecx
movl $0x5, (%rsp)
movq %r15, %rdi
movq %r12, %rsi
movq -0x68(%rbp), %rdx
xorl %r8d, %r8d
callq 0x5c450
movl $0x1, -0x34(%rbp)
movl -0x90(%rbp), %edx
testl %edx, %edx
js 0x5f82f
movl 0x34(%r14), %eax
cmpl %edx, %eax
jbe 0x5f82f
movq 0x8(%r14), %rcx
movl %edx, %edx
leaq (%rdx,%rdx,2), %rdx
movl %eax, 0x8(%rcx,%rdx,8)
cmpl $0x0, -0x38(%rbp)
movl -0x58(%rbp), %esi
jns 0x5f84b
movq 0x40(%r14), %rax
testq %rax, %rax
je 0x5f84b
movl 0x34(%r14), %ecx
movl -0x7c(%rbp), %edx
movl %ecx, (%rax,%rdx,4)
testl %esi, %esi
je 0x5f886
movzbl 0x1f(%r15), %eax
cmpq $0x7, %rax
ja 0x5f886
xorl %ecx, %ecx
cmpl %esi, 0x84(%r15,%rcx)
je 0x5f880
addq $0x18, %rcx
cmpl $0xf0, %ecx
jne 0x5f85c
leal 0x1(%rax), %ecx
movb %cl, 0x1f(%r15)
movl %esi, 0x28(%r15,%rax,4)
jmp 0x5f886
movb $0x1, 0x7c(%r15,%rcx)
incq %r13
movq 0x28(%rbx), %rbx
testq %rbx, %rbx
jne 0x5f367
movq 0x28(%rbp), %rcx
testq %rcx, %rcx
je 0x5f8a4
movl -0x34(%rbp), %eax
movl %eax, (%rcx)
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%r15), %rax
testb $0x8, 0x2e(%rax)
jne 0x5f8fa
movl $0x1, -0x34(%rbp)
cmpq $0x0, 0x10(%r12)
je 0x5f2ea
movq 0x1d8(%r15), %rax
testq %rax, %rax
cmoveq %r15, %rax
movb $0x1, 0x23(%rax)
movq %r15, %rdi
movq %r12, %rsi
movq -0x68(%rbp), %rdx
xorl %ecx, %ecx
callq 0x5cff7
jmp 0x5f2ea
movq %r12, %rdi
callq 0x4fce3
testq %rax, %rax
jne 0x5f90f
cmpq $0x0, 0x20(%r12)
je 0x5f8bf
movq 0x1d8(%r15), %rax
testq %rax, %rax
cmoveq %r15, %rax
movb $0x1, 0x23(%rax)
movl $0x5, (%rsp)
movq %r15, %rdi
movq %r12, %rsi
movq -0x68(%rbp), %rdx
movq -0x78(%rbp), %rcx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x5c450
movl $0x1, -0x34(%rbp)
jmp 0x5f2ea