// File: /workspace/github_c_makefile_star2_O1/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 $0xc8, %rsp
movq %r8, -0xa0(%rbp)
movl %ecx, %ebx
movq %rdx, -0x78(%rbp)
movq %rsi, %r12
movq %rdi, %r15
cmpl $0x0, 0x10(%rbp)
movl %ecx, %eax
cmovnel %r9d, %eax
movl %r9d, -0x68(%rbp)
testl %r9d, %r9d
cmovel %ecx, %eax
movl %eax, -0x94(%rbp)
movq (%rdi), %rax
movq %rax, -0x70(%rbp)
callq 0x45b57
movq %rax, -0x30(%rbp)
movswq 0x42(%r12), %r14
movq %rbx, -0x90(%rbp)
leal 0x1(%rbx), %eax
movq %rax, -0x88(%rbp)
testq %r14, %r14
movq %r12, -0x58(%rbp)
jle 0x5f1de
movl -0x88(%rbp), %eax
movq %rax, -0x48(%rbp)
movl $0x28, %r13d
xorl %ebx, %ebx
movswq 0x40(%r12), %rax
movl %eax, %eax
cmpq %rax, %rbx
je 0x5f1ce
movq 0x8(%r12), %rax
movb (%rax,%r13), %cl
testb %cl, %cl
je 0x5f1ce
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
cmpl $0x5, %ecx
jne 0x5f0cb
xorl %ecx, %ecx
cmpq $0x0, -0x20(%rax,%r13)
setne %cl
leal (%rcx,%rcx,2), %ecx
addl $0x2, %ecx
leal -0x1(%rcx), %eax
cmpl $0x3, %eax
ja 0x5f175
leaq 0x16e0a(%rip), %rdx     # 0x75ee8
movslq (%rdx,%rax,4), %rax
addq %rdx, %rax
jmpq *%rax
movq 0x1d8(%r15), %rax
testq %rax, %rax
cmoveq %r15, %rax
movb $0x1, 0x24(%rax)
movq -0x48(%rbp), %rax
leal (%rax,%rbx), %r8d
movq -0x30(%rbp), %r12
movq %r12, %rdi
movl $0x12, %esi
movl $0x513, %edx            # imm = 0x513
callq 0x45b9e
movq -0x58(%rbp), %rax
movq (%rax), %rdx
movq -0x58(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x28(%rax,%r13), %rcx
movq -0x70(%rbp), %rdi
leaq 0x1ccc4(%rip), %rsi     # 0x7bdfa
xorl %eax, %eax
callq 0x117e2
movq %r12, %rdi
movq -0x58(%rbp), %r12
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movq %rax, %rdx
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
callq 0x11975
jmp 0x5f1ce
movq -0x48(%rbp), %rax
leal (%rax,%rbx), %edx
movq -0x30(%rbp), %rdi
movl $0x49, %esi
movl 0x20(%rbp), %ecx
xorl %r8d, %r8d
callq 0x45b9e
jmp 0x5f1ce
movq -0x48(%rbp), %rax
leal (%rax,%rbx), %edx
movl %edx, -0x40(%rbp)
movq -0x30(%rbp), %rdi
movl $0x4a, %esi
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x45b9e
movl %eax, -0x60(%rbp)
movq 0x8(%r12), %rax
movq -0x20(%rax,%r13), %rsi
movq %r15, %rdi
movl -0x40(%rbp), %edx
callq 0x4e4ba
movl -0x60(%rbp), %edx
testl %edx, %edx
js 0x5f1ce
movq -0x30(%rbp), %rax
movl 0x34(%rax), %eax
cmpl %edx, %eax
jbe 0x5f1ce
movq -0x30(%rbp), %rcx
movq 0x8(%rcx), %rcx
movl %edx, %edx
leaq (%rdx,%rdx,2), %rdx
movl %eax, 0x8(%rcx,%rdx,8)
incq %rbx
addq $0x30, %r13
cmpq %rbx, %r14
jne 0x5f079
movq 0x30(%r12), %rsi
testq %rsi, %rsi
je 0x5f322
movq -0x70(%rbp), %rax
testb $0x20, 0x2d(%rax)
jne 0x5f322
movq -0x88(%rbp), %rax
movl %eax, 0x64(%r15)
cmpl $0x0, (%rsi)
jle 0x5f322
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, -0x60(%rbp)
movq %r15, -0x50(%rbp)
movq -0x30(%rbp), %r12
movq %r12, %rdi
movq %rsi, %r14
callq 0x4c4bf
movl %eax, %edx
movq 0x8(%r14), %rax
movq (%rax,%rbx), %rsi
movq %r15, %rdi
movl %edx, -0x40(%rbp)
movl $0x8, %ecx
callq 0x4c94a
movl -0x48(%rbp), %r8d
cmpl $0x4, %r8d
jne 0x5f289
movq %r12, %rdi
movl $0xe, %esi
xorl %edx, %edx
movl 0x20(%rbp), %ecx
xorl %r8d, %r8d
callq 0x45b9e
movl $0x4, -0x48(%rbp)
movq -0x58(%rbp), %r12
movq -0x50(%rbp), %r15
movl -0x40(%rbp), %r14d
jmp 0x5f2e9
movq 0x8(%r14), %rax
movq 0x8(%rax,%rbx), %rdx
cmpl $0x5, %r8d
movl $0x2, %eax
cmovel %eax, %r8d
testq %rdx, %rdx
je 0x5f2c1
movq -0x70(%rbp), %rdi
leaq 0x1cb61(%rip), %rsi     # 0x7be10
xorl %eax, %eax
movl %r8d, %r14d
callq 0x117e2
movl %r14d, %r8d
movq %rax, %rcx
jmp 0x5f2c3
xorl %ecx, %ecx
movq -0x58(%rbp), %r12
movq -0x50(%rbp), %r15
movl -0x40(%rbp), %r14d
movq %r15, %rdi
movl $0x113, %esi            # imm = 0x113
movl %r8d, -0x48(%rbp)
movl %r8d, %edx
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
callq 0x4c44d
testl %r14d, %r14d
movq -0x60(%rbp), %rsi
jns 0x5f30f
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rax
testq %rax, %rax
je 0x5f30f
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
jl 0x5f22c
movl -0x68(%rbp), %r8d
testl %r8d, %r8d
movq -0x30(%rbp), %r14
je 0x5f373
movl 0x18(%rbp), %eax
movl %eax, %r13d
cmpl $0x63, %eax
movq -0x90(%rbp), %rbx
jne 0x5f355
movzbl 0x47(%r12), %eax
cmpb $0x63, %al
movl $0x2, %ecx
cmovnel %eax, %ecx
movzbl %cl, %r13d
cmpl $0x0, 0x10(%rbp)
je 0x5f37f
movq %r14, %rdi
movl $0x4c, %esi
movl %ebx, %edx
xorl %ecx, %ecx
callq 0x45b9e
movq %rbx, %r8
movl %eax, %ebx
jmp 0x5f384
movl $0x0, -0x34(%rbp)
jmp 0x5f465
movq %rbx, %r8
xorl %ebx, %ebx
movl $0x0, -0x34(%rbp)
movq %r14, %rdi
movl $0x3f, %esi
movq -0x78(%rbp), %rdx
xorl %ecx, %ecx
callq 0x45b9e
movl %eax, %r14d
leal -0x1(%r13), %eax
cmpl $0x3, %eax
jb 0x5f3f1
cmpl $0x4, %r13d
je 0x5f3cc
cmpl $0x5, %r13d
jne 0x5f3eb
movq -0x70(%rbp), %rax
testb $0x4, 0x2e(%rax)
jne 0x5f9d9
xorl %r13d, %r13d
jmp 0x5f9f1
movl $0x0, -0x34(%rbp)
movq -0x30(%rbp), %rdi
movl $0xe, %esi
xorl %edx, %edx
movl 0x20(%rbp), %ecx
xorl %r8d, %r8d
callq 0x45b9e
jmp 0x5f40e
movl $0x2, %r13d
leaq 0x1ca2d(%rip), %rcx     # 0x7be25
movq %r15, %rdi
movl $0x613, %esi            # imm = 0x613
movl %r13d, %edx
movl $0xfffffffe, %r8d       # imm = 0xFFFFFFFE
callq 0x4c44d
testl %r14d, %r14d
js 0x5f432
movq -0x30(%rbp), %rax
movl 0x34(%rax), %eax
cmpl %r14d, %eax
jbe 0x5f432
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 0x5f461
movq -0x30(%rbp), %r14
movl 0x34(%r14), %eax
cmpl %ebx, %eax
jbe 0x5f465
movq 0x8(%r14), %rcx
movl %ebx, %edx
leaq (%rdx,%rdx,2), %rdx
movl %eax, 0x8(%rcx,%rdx,8)
jmp 0x5f465
movq -0x30(%rbp), %r14
movq 0x10(%r12), %rbx
testq %rbx, %rbx
je 0x5f9b9
movq -0x78(%rbp), %rax
incl %eax
movq %rax, -0xa8(%rbp)
xorl %r13d, %r13d
movq %r15, -0x50(%rbp)
movq -0xa0(%rbp), %rax
movl (%rax,%r13,4), %ecx
testl %ecx, %ecx
je 0x5f9a9
cmpq $0x0, 0x48(%rbx)
je 0x5f4e6
movq %r14, %rdi
movl $0x18, %esi
xorl %edx, %edx
xorl %r8d, %r8d
callq 0x45b9e
movq %r14, %rdi
callq 0x4c4bf
movl %eax, %edx
movq -0x88(%rbp), %rax
movl %eax, 0x64(%r15)
movq 0x48(%rbx), %rsi
movq %r15, %rdi
movl %edx, -0x60(%rbp)
movl $0x8, %ecx
callq 0x4c50a
movl $0x0, 0x64(%r15)
jmp 0x5f4ed
movl $0x0, -0x60(%rbp)
movzwl 0x54(%rbx), %edx
leal 0x1(%rdx), %eax
movl 0x48(%r15), %ecx
cmpl %edx, %ecx
jle 0x5f510
movl 0x4c(%r15), %r12d
leal (%r12,%rax), %edx
movl %edx, 0x4c(%r15)
subl %eax, %ecx
movl %ecx, 0x48(%r15)
jmp 0x5f51e
movl 0x58(%r15), %ecx
leal 0x1(%rcx), %r12d
addl %ecx, %eax
movl %eax, 0x58(%r15)
movq %r13, -0x40(%rbp)
cmpw $0x0, 0x54(%rbx)
je 0x5f591
movq %r12, -0x68(%rbp)
movl %r12d, %eax
movq %rax, -0x48(%rbp)
xorl %r13d, %r13d
movq -0x90(%rbp), %r12
movq -0x30(%rbp), %r14
movq -0x88(%rbp), %r15
movq 0x8(%rbx), %rax
movl (%rax,%r13,4), %eax
movq -0x58(%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 0x45b9e
incq %r13
movzwl 0x54(%rbx), %eax
cmpq %rax, %r13
jb 0x5f549
movq -0x50(%rbp), %r15
movq -0x68(%rbp), %r12
jmp 0x5f594
xorl %r13d, %r13d
addl %r12d, %r13d
movq -0x30(%rbp), %r14
movq %r14, %rdi
movl $0x1d, %esi
movq -0x90(%rbp), %rdx
movl %r13d, %ecx
xorl %r8d, %r8d
callq 0x45b9e
movzwl 0x54(%rbx), %ecx
incl %ecx
movq -0xa0(%rbp), %rax
movq -0x40(%rbp), %r13
movl (%rax,%r13,4), %r8d
movq %r14, %rdi
movl $0x2b, %esi
movl %r12d, %edx
callq 0x45b9e
movq %r14, %rdi
movq %rbx, %rsi
callq 0x4c8b2
movq %r14, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movq %rax, %rdx
xorl %ecx, %ecx
callq 0x11975
movzwl 0x54(%rbx), %edx
incl %edx
movq %r15, %rdi
movl %r12d, %esi
callq 0x4e50d
movb 0x56(%rbx), %al
movl -0x60(%rbp), %ecx
notl %ecx
movl %ecx, -0x7c(%rbp)
testb %al, %al
je 0x5f670
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 0x5f64b
movl $0x5, %ecx
cmpl $0x4, %eax
je 0x5f64d
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, -0xb0(%rbp)
je 0x5f6b1
decb %al
movb %al, 0x1f(%r15)
movzbl %al, %eax
movl 0x28(%r15,%rax,4), %ecx
jmp 0x5f6bb
movzwl 0x54(%rbx), %r15d
leal 0x1(%r15), %r13d
movq -0x50(%rbp), %rdi
movl %r12d, %esi
movl %r13d, %edx
callq 0x4e50d
movq -0x50(%rbp), %rax
cmpl %r15d, 0x48(%rax)
movq -0x50(%rbp), %r15
jg 0x5f69e
movl %r13d, 0x48(%r15)
movl %r12d, 0x4c(%r15)
cmpl $0x0, -0x60(%rbp)
js 0x5f8ae
movq -0x40(%rbp), %r13
jmp 0x5f9a9
movl 0x58(%r15), %ecx
incl %ecx
movl %ecx, 0x58(%r15)
movq %r15, %r14
movq -0x30(%rbp), %rbx
movq %rbx, %rdi
movl $0x1d, %esi
movl -0x94(%rbp), %edx
movl %ecx, %r15d
xorl %r8d, %r8d
callq 0x45b9e
movq -0xa8(%rbp), %rax
leal (%rax,%r13), %edx
movslq %r12d, %r13
movq %rbx, %rdi
movl $0x3e, %esi
xorl %ecx, %ecx
movl %r15d, -0x68(%rbp)
movl %r15d, %r8d
callq 0x45b9e
movq %rbx, %rdi
movl %eax, -0x98(%rbp)
movl %eax, %esi
movq %r13, %rdx
movl $0xfffffff2, %ecx       # imm = 0xFFFFFFF2
callq 0x11975
movq -0xb0(%rbp), %rbx
movzwl 0x54(%rbx), %r15d
leal 0x1(%r15), %r13d
movq %r14, %rdi
movl %r12d, %esi
movl %r13d, %edx
callq 0x4e50d
cmpl %r15d, 0x48(%r14)
movq %r14, %r15
jg 0x5f746
movl %r13d, 0x48(%r15)
movl %r12d, 0x4c(%r15)
movq -0x48(%rbp), %rcx
leal -0x1(%rcx), %eax
cmpl $0x3, %eax
leaq -0xe0(%rbp), %r14
jae 0x5f887
xorps %xmm0, %xmm0
movaps %xmm0, -0xe0(%rbp)
movaps %xmm0, -0xd0(%rbp)
movl $0xc8, -0xc0(%rbp)
movw $0x1, -0xbc(%rbp)
movq -0x70(%rbp), %rax
movq %rax, -0xe0(%rbp)
cmpw $0x0, 0x54(%rbx)
leaq 0x1c6bc(%rip), %rsi     # 0x7be54
movq -0x40(%rbp), %r13
je 0x5f840
cmpw $0x2, 0x54(%rbx)
leaq 0x1c69b(%rip), %rsi     # 0x7be49
leaq 0x1c68b(%rip), %rax     # 0x7be40
cmovaeq %rax, %rsi
xorl %r15d, %r15d
movq %rbx, %r12
leaq 0x1c68b(%rip), %rbx     # 0x7be51
movq -0x58(%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 -0xe0(%rbp), %r13
movq %r13, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x172ee
movq %r13, %rdi
movq %r14, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x172ee
incq %r15
movzwl 0x54(%r12), %eax
movq %rbx, %rsi
cmpq %rax, %r15
jb 0x5f7c6
cmpw $0x2, %ax
leaq 0x1c631(%rip), %rsi     # 0x7be54
leaq 0x1bde9(%rip), %rax     # 0x7b613
cmovaeq %rax, %rsi
movq -0x50(%rbp), %r15
leaq -0xe0(%rbp), %r14
movq %r12, %rbx
movq -0x40(%rbp), %r13
movq %r14, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x172ee
movq %r14, %rdi
callq 0xb6e7
movq %rax, %r14
movq %r15, %rdi
movl $0x813, %esi            # imm = 0x813
movq -0x48(%rbp), %rdx
movq %rax, %rcx
xorl %r8d, %r8d
callq 0x4c44d
movq -0xe0(%rbp), %rdi
movq %r14, %rsi
callq 0x9c3a
movq -0x30(%rbp), %r14
jmp 0x5f932
cmpl $0x4, %ecx
movq -0x40(%rbp), %r13
jne 0x5f8ce
movq -0x30(%rbp), %r14
movq %r14, %rdi
movl $0xe, %esi
xorl %edx, %edx
movl 0x20(%rbp), %ecx
xorl %r8d, %r8d
callq 0x45b9e
jmp 0x5f932
movq 0x40(%r14), %rax
testq %rax, %rax
movq -0x40(%rbp), %r13
je 0x5f9a9
movl 0x34(%r14), %ecx
movl -0x7c(%rbp), %edx
movl %ecx, (%rax,%rdx,4)
jmp 0x5f9a9
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 -0x58(%rbp), %r12
jne 0x5f8f7
xorl %r9d, %r9d
jmp 0x5f90f
movq %r15, %rdi
movq %r12, %rsi
movl $0x6a, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x5bfc5
movq %rax, %r9
movl -0x68(%rbp), %ecx
movl $0x5, (%rsp)
movq %r15, %rdi
movq %r12, %rsi
movq -0x78(%rbp), %rdx
xorl %r8d, %r8d
callq 0x5c56f
movl $0x1, -0x34(%rbp)
movl -0x98(%rbp), %edx
testl %edx, %edx
js 0x5f952
movl 0x34(%r14), %eax
cmpl %edx, %eax
jbe 0x5f952
movq 0x8(%r14), %rcx
movl %edx, %edx
leaq (%rdx,%rdx,2), %rdx
movl %eax, 0x8(%rcx,%rdx,8)
cmpl $0x0, -0x60(%rbp)
movl -0x68(%rbp), %esi
jns 0x5f96e
movq 0x40(%r14), %rax
testq %rax, %rax
je 0x5f96e
movl 0x34(%r14), %ecx
movl -0x7c(%rbp), %edx
movl %ecx, (%rax,%rdx,4)
testl %esi, %esi
je 0x5f9a9
movzbl 0x1f(%r15), %eax
cmpq $0x7, %rax
ja 0x5f9a9
xorl %ecx, %ecx
cmpl %esi, 0x84(%r15,%rcx)
je 0x5f9a3
addq $0x18, %rcx
cmpl $0xf0, %ecx
jne 0x5f97f
leal 0x1(%rax), %ecx
movb %cl, 0x1f(%r15)
movl %esi, 0x28(%r15,%rax,4)
jmp 0x5f9a9
movb $0x1, 0x7c(%r15,%rcx)
incq %r13
movq 0x28(%rbx), %rbx
testq %rbx, %rbx
jne 0x5f487
movq 0x28(%rbp), %rcx
testq %rcx, %rcx
je 0x5f9c7
movl -0x34(%rbp), %eax
movl %eax, (%rcx)
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r15, %rdi
movq %r12, %rsi
movl $0x6a, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x5bfc5
movq %rax, %r13
testq %r13, %r13
je 0x5fa37
movq 0x1d8(%r15), %rax
testq %rax, %rax
cmoveq %r15, %rax
movb $0x1, 0x23(%rax)
movl $0x5, (%rsp)
movq %r15, %rdi
movq %r12, %rsi
movq -0x78(%rbp), %rdx
movq -0x90(%rbp), %rcx
xorl %r8d, %r8d
movq %r13, %r9
callq 0x5c56f
movl $0x1, -0x34(%rbp)
jmp 0x5f40e
movq (%r15), %rax
testb $0x8, 0x2e(%rax)
jne 0x5fa7b
movl $0x1, -0x34(%rbp)
cmpq $0x0, 0x10(%r12)
je 0x5f40e
movq 0x1d8(%r15), %rax
testq %rax, %rax
cmoveq %r15, %rax
movb $0x1, 0x23(%rax)
movq %r15, %rdi
movq %r12, %rsi
movq -0x78(%rbp), %rdx
xorl %ecx, %ecx
callq 0x5d156
jmp 0x5f40e
movq %r12, %rdi
callq 0x4fce9
testq %rax, %rax
jne 0x5f9f6
cmpq $0x0, 0x20(%r12)
jne 0x5f9f6
jmp 0x5fa40