// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: analyzeOneTable
static void analyzeOneTable(
  Parse *pParse,   /* Parser context */
  Table *pTab,     /* Table whose indices are to be analyzed */
  Index *pOnlyIdx, /* If not NULL, only analyze this one index */
  int iStatCur,    /* Index of VdbeCursor that writes the sqlite_stat1 table */
  int iMem         /* Available memory locations begin here */
){
  sqlite3 *db = pParse->db;    /* Database handle */
  Index *pIdx;                 /* An index to being analyzed */
  int iIdxCur;                 /* Cursor open on index being analyzed */
  Vdbe *v;                     /* The virtual machine being built up */
  int i;                       /* Loop counter */
  int topOfLoop;               /* The top of the loop */
  int endOfLoop;               /* The end of the loop */
  int jZeroRows = -1;          /* Jump from here if number of rows is zero */
  int iDb;                     /* Index of database containing pTab */
  u8 needTableCnt = 1;         /* True to count the table */
  int regTabname = iMem++;     /* Register containing table name */
  int regIdxname = iMem++;     /* Register containing index name */
  int regStat1 = iMem++;       /* The stat column of sqlite_stat1 */
#ifdef SQLITE_ENABLE_STAT3
  int regNumEq = regStat1;     /* Number of instances.  Same as regStat1 */
  int regNumLt = iMem++;       /* Number of keys less than regSample */
  int regNumDLt = iMem++;      /* Number of distinct keys less than regSample */
  int regSample = iMem++;      /* The next sample value */
  int regRowid = regSample;    /* Rowid of a sample */
  int regAccum = iMem++;       /* Register to hold Stat3Accum object */
  int regLoop = iMem++;        /* Loop counter */
  int regCount = iMem++;       /* Number of rows in the table or index */
  int regTemp1 = iMem++;       /* Intermediate register */
  int regTemp2 = iMem++;       /* Intermediate register */
  int once = 1;                /* One-time initialization */
  int shortJump = 0;           /* Instruction address */
  int iTabCur = pParse->nTab++; /* Table cursor */
#endif
  int regCol = iMem++;         /* Content of a column in analyzed table */
  int regRec = iMem++;         /* Register holding completed record */
  int regTemp = iMem++;        /* Temporary use register */
  int regNewRowid = iMem++;    /* Rowid for the inserted record */


  v = sqlite3GetVdbe(pParse);
  if( v==0 || NEVER(pTab==0) ){
    return;
  }
  if( pTab->tnum==0 ){
    /* Do not gather statistics on views or virtual tables */
    return;
  }
  if( sqlite3_strnicmp(pTab->zName, "sqlite_", 7)==0 ){
    /* Do not gather statistics on system tables */
    return;
  }
  assert( sqlite3BtreeHoldsAllMutexes(db) );
  iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
  assert( iDb>=0 );
  assert( sqlite3SchemaMutexHeld(db, iDb, 0) );
#ifndef SQLITE_OMIT_AUTHORIZATION
  if( sqlite3AuthCheck(pParse, SQLITE_ANALYZE, pTab->zName, 0,
      db->aDb[iDb].zName ) ){
    return;
  }
#endif

  /* Establish a read-lock on the table at the shared-cache level. */
  sqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName);

  iIdxCur = pParse->nTab++;
  sqlite3VdbeAddOp4(v, OP_String8, 0, regTabname, 0, pTab->zName, 0);
  for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
    int nCol;
    KeyInfo *pKey;
    int addrIfNot = 0;           /* address of OP_IfNot */
    int *aChngAddr;              /* Array of jump instruction addresses */

    if( pOnlyIdx && pOnlyIdx!=pIdx ) continue;
    if( pIdx->pPartIdxWhere==0 ) needTableCnt = 0;
    VdbeNoopComment((v, "Begin analysis of %s", pIdx->zName));
    nCol = pIdx->nColumn;
    aChngAddr = sqlite3DbMallocRaw(db, sizeof(int)*nCol);
    if( aChngAddr==0 ) continue;
    pKey = sqlite3IndexKeyinfo(pParse, pIdx);
    if( iMem+1+(nCol*2)>pParse->nMem ){
      pParse->nMem = iMem+1+(nCol*2);
    }

    /* Open a cursor to the index to be analyzed. */
    assert( iDb==sqlite3SchemaToIndex(db, pIdx->pSchema) );
    sqlite3VdbeAddOp4(v, OP_OpenRead, iIdxCur, pIdx->tnum, iDb,
        (char *)pKey, P4_KEYINFO_HANDOFF);
    VdbeComment((v, "%s", pIdx->zName));

    /* Populate the register containing the index name. */
    sqlite3VdbeAddOp4(v, OP_String8, 0, regIdxname, 0, pIdx->zName, 0);

#ifdef SQLITE_ENABLE_STAT3
    if( once ){
      once = 0;
      sqlite3OpenTable(pParse, iTabCur, iDb, pTab, OP_OpenRead);
    }
    sqlite3VdbeAddOp2(v, OP_Count, iIdxCur, regCount);
    sqlite3VdbeAddOp2(v, OP_Integer, SQLITE_STAT3_SAMPLES, regTemp1);
    sqlite3VdbeAddOp2(v, OP_Integer, 0, regNumEq);
    sqlite3VdbeAddOp2(v, OP_Integer, 0, regNumLt);
    sqlite3VdbeAddOp2(v, OP_Integer, -1, regNumDLt);
    sqlite3VdbeAddOp3(v, OP_Null, 0, regSample, regAccum);
    sqlite3VdbeAddOp4(v, OP_Function, 1, regCount, regAccum,
                      (char*)&stat3InitFuncdef, P4_FUNCDEF);
    sqlite3VdbeChangeP5(v, 2);
#endif /* SQLITE_ENABLE_STAT3 */

    /* The block of memory cells initialized here is used as follows.
    **
    **    iMem:                
    **        The total number of rows in the table.
    **
    **    iMem+1 .. iMem+nCol: 
    **        Number of distinct entries in index considering the 
    **        left-most N columns only, where N is between 1 and nCol, 
    **        inclusive.
    **
    **    iMem+nCol+1 .. Mem+2*nCol:  
    **        Previous value of indexed columns, from left to right.
    **
    ** Cells iMem through iMem+nCol are initialized to 0. The others are 
    ** initialized to contain an SQL NULL.
    */
    for(i=0; i<=nCol; i++){
      sqlite3VdbeAddOp2(v, OP_Integer, 0, iMem+i);
    }
    for(i=0; i<nCol; i++){
      sqlite3VdbeAddOp2(v, OP_Null, 0, iMem+nCol+i+1);
    }

    /* Start the analysis loop. This loop runs through all the entries in
    ** the index b-tree.  */
    endOfLoop = sqlite3VdbeMakeLabel(v);
    sqlite3VdbeAddOp2(v, OP_Rewind, iIdxCur, endOfLoop);
    topOfLoop = sqlite3VdbeCurrentAddr(v);
    sqlite3VdbeAddOp2(v, OP_AddImm, iMem, 1);  /* Increment row counter */

    for(i=0; i<nCol; i++){
      CollSeq *pColl;
      sqlite3VdbeAddOp3(v, OP_Column, iIdxCur, i, regCol);
      if( i==0 ){
        /* Always record the very first row */
        addrIfNot = sqlite3VdbeAddOp1(v, OP_IfNot, iMem+1);
      }
      assert( pIdx->azColl!=0 );
      assert( pIdx->azColl[i]!=0 );
      pColl = sqlite3LocateCollSeq(pParse, pIdx->azColl[i]);
      aChngAddr[i] = sqlite3VdbeAddOp4(v, OP_Ne, regCol, 0, iMem+nCol+i+1,
                                      (char*)pColl, P4_COLLSEQ);
      sqlite3VdbeChangeP5(v, SQLITE_NULLEQ);
      VdbeComment((v, "jump if column %d changed", i));
#ifdef SQLITE_ENABLE_STAT3
      if( i==0 ){
        sqlite3VdbeAddOp2(v, OP_AddImm, regNumEq, 1);
        VdbeComment((v, "incr repeat count"));
      }
#endif
    }
    sqlite3VdbeAddOp2(v, OP_Goto, 0, endOfLoop);
    for(i=0; i<nCol; i++){
      sqlite3VdbeJumpHere(v, aChngAddr[i]);  /* Set jump dest for the OP_Ne */
      if( i==0 ){
        sqlite3VdbeJumpHere(v, addrIfNot);   /* Jump dest for OP_IfNot */
#ifdef SQLITE_ENABLE_STAT3
        sqlite3VdbeAddOp4(v, OP_Function, 1, regNumEq, regTemp2,
                          (char*)&stat3PushFuncdef, P4_FUNCDEF);
        sqlite3VdbeChangeP5(v, 5);
        sqlite3VdbeAddOp3(v, OP_Column, iIdxCur, pIdx->nColumn, regRowid);
        sqlite3VdbeAddOp3(v, OP_Add, regNumEq, regNumLt, regNumLt);
        sqlite3VdbeAddOp2(v, OP_AddImm, regNumDLt, 1);
        sqlite3VdbeAddOp2(v, OP_Integer, 1, regNumEq);
#endif        
      }
      sqlite3VdbeAddOp2(v, OP_AddImm, iMem+i+1, 1);
      sqlite3VdbeAddOp3(v, OP_Column, iIdxCur, i, iMem+nCol+i+1);
    }
    sqlite3DbFree(db, aChngAddr);

    /* Always jump here after updating the iMem+1...iMem+1+nCol counters */
    sqlite3VdbeResolveLabel(v, endOfLoop);

    sqlite3VdbeAddOp2(v, OP_Next, iIdxCur, topOfLoop);
    sqlite3VdbeAddOp1(v, OP_Close, iIdxCur);
#ifdef SQLITE_ENABLE_STAT3
    sqlite3VdbeAddOp4(v, OP_Function, 1, regNumEq, regTemp2,
                      (char*)&stat3PushFuncdef, P4_FUNCDEF);
    sqlite3VdbeChangeP5(v, 5);
    sqlite3VdbeAddOp2(v, OP_Integer, -1, regLoop);
    shortJump = 
    sqlite3VdbeAddOp2(v, OP_AddImm, regLoop, 1);
    sqlite3VdbeAddOp4(v, OP_Function, 1, regAccum, regTemp1,
                      (char*)&stat3GetFuncdef, P4_FUNCDEF);
    sqlite3VdbeChangeP5(v, 2);
    sqlite3VdbeAddOp1(v, OP_IsNull, regTemp1);
    sqlite3VdbeAddOp3(v, OP_NotExists, iTabCur, shortJump, regTemp1);
    sqlite3VdbeAddOp3(v, OP_Column, iTabCur, pIdx->aiColumn[0], regSample);
    sqlite3ColumnDefault(v, pTab, pIdx->aiColumn[0], regSample);
    sqlite3VdbeAddOp4(v, OP_Function, 1, regAccum, regNumEq,
                      (char*)&stat3GetFuncdef, P4_FUNCDEF);
    sqlite3VdbeChangeP5(v, 3);
    sqlite3VdbeAddOp4(v, OP_Function, 1, regAccum, regNumLt,
                      (char*)&stat3GetFuncdef, P4_FUNCDEF);
    sqlite3VdbeChangeP5(v, 4);
    sqlite3VdbeAddOp4(v, OP_Function, 1, regAccum, regNumDLt,
                      (char*)&stat3GetFuncdef, P4_FUNCDEF);
    sqlite3VdbeChangeP5(v, 5);
    sqlite3VdbeAddOp4(v, OP_MakeRecord, regTabname, 6, regRec, "bbbbbb", 0);
    sqlite3VdbeAddOp2(v, OP_NewRowid, iStatCur+1, regNewRowid);
    sqlite3VdbeAddOp3(v, OP_Insert, iStatCur+1, regRec, regNewRowid);
    sqlite3VdbeAddOp2(v, OP_Goto, 0, shortJump);
    sqlite3VdbeJumpHere(v, shortJump+2);
#endif        

    /* Store the results in sqlite_stat1.
    **
    ** The result is a single row of the sqlite_stat1 table.  The first
    ** two columns are the names of the table and index.  The third column
    ** is a string composed of a list of integer statistics about the
    ** index.  The first integer in the list is the total number of entries
    ** in the index.  There is one additional integer in the list for each
    ** column of the table.  This additional integer is a guess of how many
    ** rows of the table the index will select.  If D is the count of distinct
    ** values and K is the total number of rows, then the integer is computed
    ** as:
    **
    **        I = (K+D-1)/D
    **
    ** If K==0 then no entry is made into the sqlite_stat1 table.  
    ** If K>0 then it is always the case the D>0 so division by zero
    ** is never possible.
    */
    sqlite3VdbeAddOp2(v, OP_SCopy, iMem, regStat1);
    jZeroRows = sqlite3VdbeAddOp1(v, OP_IfNot, iMem);
    for(i=0; i<nCol; i++){
      sqlite3VdbeAddOp4(v, OP_String8, 0, regTemp, 0, " ", 0);
      sqlite3VdbeAddOp3(v, OP_Concat, regTemp, regStat1, regStat1);
      sqlite3VdbeAddOp3(v, OP_Add, iMem, iMem+i+1, regTemp);
      sqlite3VdbeAddOp2(v, OP_AddImm, regTemp, -1);
      sqlite3VdbeAddOp3(v, OP_Divide, iMem+i+1, regTemp, regTemp);
      sqlite3VdbeAddOp1(v, OP_ToInt, regTemp);
      sqlite3VdbeAddOp3(v, OP_Concat, regTemp, regStat1, regStat1);
    }
    if( pIdx->pPartIdxWhere!=0 ) sqlite3VdbeJumpHere(v, jZeroRows);
    sqlite3VdbeAddOp4(v, OP_MakeRecord, regTabname, 3, regRec, "aaa", 0);
    sqlite3VdbeAddOp2(v, OP_NewRowid, iStatCur, regNewRowid);
    sqlite3VdbeAddOp3(v, OP_Insert, iStatCur, regRec, regNewRowid);
    sqlite3VdbeChangeP5(v, OPFLAG_APPEND);
    if( pIdx->pPartIdxWhere==0 ) sqlite3VdbeJumpHere(v, jZeroRows);
  }

  /* Create a single sqlite_stat1 entry containing NULL as the index
  ** name and the row count as the content.
  */
  if( pOnlyIdx==0 && needTableCnt ){
    sqlite3VdbeAddOp3(v, OP_OpenRead, iIdxCur, pTab->tnum, iDb);
    VdbeComment((v, "%s", pTab->zName));
    sqlite3VdbeAddOp2(v, OP_Count, iIdxCur, regStat1);
    sqlite3VdbeAddOp1(v, OP_Close, iIdxCur);
    jZeroRows = sqlite3VdbeAddOp1(v, OP_IfNot, regStat1);
    sqlite3VdbeAddOp2(v, OP_Null, 0, regIdxname);
    sqlite3VdbeAddOp4(v, OP_MakeRecord, regTabname, 3, regRec, "aaa", 0);
    sqlite3VdbeAddOp2(v, OP_NewRowid, iStatCur, regNewRowid);
    sqlite3VdbeAddOp3(v, OP_Insert, iStatCur, regRec, regNewRowid);
    sqlite3VdbeChangeP5(v, OPFLAG_APPEND);
    sqlite3VdbeJumpHere(v, jZeroRows);
  }
  if( pParse->nMem<regRec ) pParse->nMem = regRec;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %r8, -0xa8(%rbp)
movl %ecx, -0x70(%rbp)
movq %rdx, %r12
movq %rsi, %r15
movq (%rdi), %rax
movq %rax, -0xa0(%rbp)
movq %rdi, -0x38(%rbp)
callq 0x41ef4
movq %rax, %r14
testq %rax, %rax
sete %al
testq %r15, %r15
sete %cl
orb %al, %cl
jne 0x57ba1
cmpl $0x0, 0x3c(%r15)
je 0x57ba1
movq (%r15), %rbx
leaq 0x15990(%rip), %rsi     # 0x6ce0c
pushq $0x7
popq %rdx
movq %rbx, %rdi
callq 0x8f45
testl %eax, %eax
je 0x57ba1
movq 0x68(%r15), %rsi
movq -0xa0(%rbp), %r13
movq %r13, %rdi
callq 0x1064e
movq 0x20(%r13), %rdx
movl %eax, -0x44(%rbp)
movslq %eax, %rcx
shlq $0x5, %rcx
movq (%rdx,%rcx), %r8
pushq $0x1c
popq %rsi
movq -0x38(%rbp), %rdi
movq %rbx, %rdx
xorl %ecx, %ecx
callq 0x42151
testl %eax, %eax
jne 0x57ba1
movq %r12, -0xb8(%rbp)
movq %r15, %r12
movq -0xa8(%rbp), %r13
leal 0x1(%r13), %eax
movl %eax, -0x64(%rbp)
leal 0x2(%r13), %eax
movl %eax, -0x4c(%rbp)
leal 0x3(%r13), %eax
movl %eax, -0x74(%rbp)
leal 0x4(%r13), %eax
movl %eax, -0x6c(%rbp)
leal 0x5(%r13), %eax
movl %eax, -0xb0(%rbp)
leal 0x6(%r13), %eax
movl %eax, -0x68(%rbp)
leal 0x7(%r13), %eax
movl %eax, -0x50(%rbp)
movl %r13d, %eax
movq %rax, -0xc0(%rbp)
movl 0x3c(%r15), %edx
movq (%r15), %r8
movq -0x38(%rbp), %r15
movq %r15, %rdi
movl -0x44(%rbp), %esi
xorl %ecx, %ecx
callq 0x4207f
movl 0x54(%r15), %eax
movq %rax, -0x58(%rbp)
incl %eax
movl %eax, 0x54(%r15)
movq (%r12), %r9
andl $0x0, (%rsp)
pushq $0x5e
popq %rsi
movq %r14, %rdi
xorl %edx, %edx
movl %r13d, %ecx
xorl %r8d, %r8d
callq 0x41fd2
movq %r12, -0xc8(%rbp)
leaq 0x10(%r12), %rsi
movq -0xb8(%rbp), %r12
leal 0x8(%r13), %eax
movq %rax, -0x80(%rbp)
movb $0x1, %dl
pushq $0x29
popq %rbx
movq %r14, -0x88(%rbp)
movq (%rsi), %rsi
testq %rsi, %rsi
je 0x57a9e
testq %r12, %r12
setne %al
cmpq %r12, %rsi
setne %cl
testb %cl, %al
jne 0x57a95
cmpq $0x0, 0x48(%rsi)
movzbl %dl, %edx
movl $0x0, %eax
cmovel %eax, %edx
movl %edx, -0x2c(%rbp)
movq %rsi, %r13
movzwl 0x54(%rsi), %r14d
leal (,%r14,4), %esi
movq -0xa0(%rbp), %rdi
callq 0x103b4
testq %rax, %rax
je 0x57a88
movq %rax, %r15
movq -0x38(%rbp), %r12
movq %r12, %rdi
movq %r13, -0x90(%rbp)
movq %r13, %rsi
callq 0x476ae
movq -0x80(%rbp), %rcx
leal (%rcx,%r14,2), %ecx
cmpl 0x58(%r12), %ecx
movq %r14, %r13
jle 0x5760e
movq -0x38(%rbp), %rdx
movl %ecx, 0x58(%rdx)
movq -0x90(%rbp), %r12
movl 0x50(%r12), %ecx
movl $0xfffffff0, (%rsp)     # imm = 0xFFFFFFF0
movq -0x88(%rbp), %r14
movq %r14, %rdi
pushq $0x30
popq %rsi
movq -0x58(%rbp), %rdx
movl -0x44(%rbp), %r8d
movq %rax, %r9
callq 0x41fd2
movq (%r12), %r9
andl $0x0, (%rsp)
movq %r14, %rdi
pushq $0x5e
popq %rsi
xorl %edx, %edx
movl -0x64(%rbp), %ecx
xorl %r8d, %r8d
callq 0x41fd2
movq %r13, -0x40(%rbp)
movl %r13d, %r12d
negl %r12d
pushq $0x7
popq %rax
movl %eax, %r13d
leal (%r12,%r13), %eax
cmpl $0x8, %eax
je 0x5768f
movq -0xa8(%rbp), %rax
leal (%rax,%r13), %ecx
movq %r14, %rdi
pushq $0x15
popq %rsi
xorl %edx, %edx
callq 0x41f42
incl %r13d
jmp 0x57669
movq -0x80(%rbp), %rax
movq -0x40(%rbp), %rcx
leal (%rax,%rcx), %r12d
movl %r12d, -0x98(%rbp)
movl %ecx, %r13d
movq %r14, %rdi
subl $0x1, %r13d
jb 0x576c0
pushq $0x18
popq %rsi
xorl %edx, %edx
movl %r12d, %ecx
callq 0x41f42
incl %r12d
jmp 0x576a5
callq 0x47934
movq %r14, %rdi
pushq $0x65
popq %rsi
movq -0x58(%rbp), %rdx
movl %eax, -0x48(%rbp)
movl %eax, %ecx
callq 0x41f42
movl 0x34(%r14), %eax
movl %eax, -0xac(%rbp)
movq %r14, %rdi
pushq $0x20
popq %rsi
movl -0x50(%rbp), %edx
pushq $0x1
popq %rcx
callq 0x41f42
movl -0x40(%rbp), %eax
movq %rax, -0x60(%rbp)
movl -0x98(%rbp), %eax
movq %rax, -0x98(%rbp)
xorl %r13d, %r13d
movl $0x0, -0x30(%rbp)
movl -0x74(%rbp), %r12d
cmpq %r13, -0x60(%rbp)
je 0x577aa
movq %r14, %rdi
movl %ebx, %esi
movq -0x58(%rbp), %rdx
movl %r13d, %ecx
movl %r12d, %r8d
callq 0x41f4c
testq %r13, %r13
jne 0x5774b
movq %r14, %rdi
pushq $0x28
popq %rsi
movq -0x80(%rbp), %rdx
callq 0x42436
movl %eax, -0x30(%rbp)
movq -0x90(%rbp), %rax
movq 0x40(%rax), %rax
movq (%rax,%r13,8), %rsi
movq -0x38(%rbp), %rdi
callq 0x47213
movq -0x98(%rbp), %rcx
leal (%rcx,%r13), %r8d
movl $0xfffffffc, (%rsp)     # imm = 0xFFFFFFFC
movq %r14, %rdi
pushq $0x4b
popq %rsi
movl %r12d, %edx
xorl %ecx, %ecx
movq %rax, %r9
callq 0x41fd2
movl %eax, (%r15,%r13,4)
movq 0x8(%r14), %rax
testq %rax, %rax
je 0x577a2
movslq 0x34(%r14), %rcx
imulq $0x18, %rcx, %rcx
movb $-0x80, -0x15(%rax,%rcx)
incq %r13
jmp 0x57712
movq %r14, %rdi
pushq $0xe
popq %rsi
xorl %edx, %edx
movl -0x48(%rbp), %ecx
callq 0x41f42
movl -0x30(%rbp), %eax
imulq $0x18, %rax, %rax
movq %rax, -0xd0(%rbp)
xorl %r13d, %r13d
movq -0xc0(%rbp), %r12
cmpq %r13, -0x60(%rbp)
je 0x5785e
movslq (%r15,%r13,4), %rax
testq %rax, %rax
js 0x577f9
movl 0x34(%r14), %ecx
cmpl %eax, %ecx
jbe 0x577f9
movq 0x8(%r14), %rdx
imulq $0x18, %rax, %rax
movl %ecx, 0x8(%rdx,%rax)
cmpl $0x0, -0x30(%rbp)
setns %al
testq %r13, %r13
sete %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x57825
movl 0x34(%r14), %eax
cmpl -0x30(%rbp), %eax
jbe 0x57825
movq 0x8(%r14), %rcx
movq -0xd0(%rbp), %rdx
movl %eax, 0x8(%rcx,%rdx)
leal (%r12,%r13), %edx
addl $0x8, %edx
movq %r14, %rdi
pushq $0x20
popq %rsi
pushq $0x1
popq %rcx
callq 0x41f42
movq -0x98(%rbp), %rax
leal (%rax,%r13), %r8d
movq %r14, %rdi
movl %ebx, %esi
movq -0x58(%rbp), %rdx
movl %r13d, %ecx
callq 0x41f4c
incq %r13
jmp 0x577d2
movq -0xa0(%rbp), %rdi
movq %r15, %rsi
callq 0x968b
cmpl $0x0, -0x48(%rbp)
jns 0x5788a
movq 0x40(%r14), %rax
testq %rax, %rax
je 0x5788a
movl -0x48(%rbp), %edx
notl %edx
movl 0x34(%r14), %ecx
movl %edx, %edx
movl %ecx, (%rax,%rdx,4)
movq %r14, %rdi
pushq $0x7
popq %rsi
movq -0x58(%rbp), %r12
movl %r12d, %edx
movl -0xac(%rbp), %ecx
callq 0x41f42
movq %r14, %rdi
pushq $0x36
popq %rsi
movl %r12d, %edx
callq 0x42436
movq %r14, %rdi
pushq $0x1d
popq %rsi
movl -0x50(%rbp), %r12d
movl %r12d, %edx
movl -0x4c(%rbp), %ecx
callq 0x41f42
movq %r14, %rdi
pushq $0x28
popq %rsi
movl %r12d, %edx
callq 0x42436
movl %eax, %r13d
movq -0x80(%rbp), %rax
movl %eax, -0x60(%rbp)
movq -0x40(%rbp), %r14
subl $0x1, %r14d
jb 0x579a5
andl $0x0, (%rsp)
movq -0x88(%rbp), %r12
movq %r12, %rdi
pushq $0x5e
popq %rsi
xorl %edx, %edx
movl -0xb0(%rbp), %r15d
movl %r15d, %ecx
xorl %r8d, %r8d
leaq 0x15a60(%rip), %r9      # 0x6d372
callq 0x41fd2
movq %r12, %rdi
pushq $0x5b
popq %rsi
movl %r15d, %edx
movq %r14, -0x40(%rbp)
movl %r13d, %r14d
movl -0x4c(%rbp), %r13d
movl %r13d, %ecx
movl %r13d, %r8d
callq 0x41f4c
movq %r12, %rdi
pushq $0x56
popq %rsi
movl -0x50(%rbp), %edx
movl -0x60(%rbp), %ebx
movl %ebx, %ecx
movl %r15d, %r8d
callq 0x41f4c
movq %r12, %rdi
pushq $0x20
popq %rsi
movl %r15d, %edx
pushq $-0x1
popq %rcx
callq 0x41f42
movq %r12, %rdi
pushq $0x59
popq %rsi
movl %ebx, %edx
movl %r15d, %ecx
movl %r15d, %r8d
callq 0x41f4c
movq %r12, %rdi
movl $0x90, %esi
movl %r15d, %edx
callq 0x42436
movq %r12, %rdi
pushq $0x5b
popq %rsi
movl %r15d, %edx
movl %r13d, %ecx
movl %r13d, %r8d
movl %r14d, %r13d
movq -0x40(%rbp), %r14
callq 0x41f4c
incl %ebx
movl %ebx, -0x60(%rbp)
jmp 0x578e1
movq -0x90(%rbp), %rax
cmpq $0x0, 0x48(%rax)
setne %al
testl %r13d, %r13d
setns %cl
andb %al, %cl
movl %r13d, %esi
cmpb $0x1, %cl
movq -0x88(%rbp), %r14
jne 0x579e0
movl 0x34(%r14), %eax
cmpl %r13d, %eax
jbe 0x579e0
movq 0x8(%r14), %rcx
imulq $0x18, %rsi, %rdx
movl %eax, 0x8(%rcx,%rdx)
movq %rsi, -0x40(%rbp)
andl $0x0, (%rsp)
movq %r14, %rdi
pushq $0x2b
popq %rsi
movq -0xc0(%rbp), %rdx
pushq $0x3
popq %rcx
movl -0x6c(%rbp), %r12d
movl %r12d, %r8d
leaq 0x16e8e(%rip), %r9      # 0x6e894
callq 0x41fd2
movq %r14, %rdi
pushq $0x41
popq %rsi
movl -0x70(%rbp), %ebx
movl %ebx, %edx
movl -0x68(%rbp), %r15d
movl %r15d, %ecx
callq 0x41f42
movq %r14, %rdi
pushq $0x42
popq %rsi
movl %ebx, %edx
movl %r12d, %ecx
movl %r15d, %r8d
callq 0x41f4c
movq 0x8(%r14), %rax
testq %rax, %rax
pushq $0x29
popq %rbx
je 0x57a4e
movslq 0x34(%r14), %rcx
imulq $0x18, %rcx, %rcx
movb $0x8, -0x15(%rax,%rcx)
testl %r13d, %r13d
setns %cl
movq -0x90(%rbp), %rsi
cmpq $0x0, 0x48(%rsi)
sete %dl
andb %cl, %dl
cmpb $0x1, %dl
movq -0xb8(%rbp), %r12
jne 0x57a83
movl 0x34(%r14), %ecx
cmpl %r13d, %ecx
jbe 0x57a83
imulq $0x18, -0x40(%rbp), %rdx
movl %ecx, 0x8(%rax,%rdx)
movl -0x2c(%rbp), %edx
jmp 0x57a95
movl -0x2c(%rbp), %edx
movq %r13, %rsi
movq -0x88(%rbp), %r14
addq $0x28, %rsi
jmp 0x57584
testq %r12, %r12
movl -0x6c(%rbp), %r15d
movq -0xc8(%rbp), %rax
movl -0x44(%rbp), %r8d
jne 0x57b8f
testb %dl, %dl
je 0x57b8f
movl 0x3c(%rax), %ecx
pushq $0x30
popq %rsi
movq %r14, %rdi
movq -0x58(%rbp), %r12
movl %r12d, %edx
callq 0x41f4c
pushq $0x2c
popq %rsi
movq %r14, %rdi
movl %r12d, %edx
movl -0x4c(%rbp), %ebx
movl %ebx, %ecx
callq 0x41f42
pushq $0x36
popq %rsi
movq %r14, %rdi
movl %r12d, %edx
callq 0x42436
pushq $0x28
popq %rsi
movq %r14, %rdi
movl %ebx, %edx
callq 0x42436
movl %eax, %ebx
pushq $0x18
popq %rsi
movq %r14, %rdi
xorl %edx, %edx
movl -0x64(%rbp), %ecx
callq 0x41f42
andl $0x0, (%rsp)
leaq 0x16d76(%rip), %r9      # 0x6e894
pushq $0x2b
popq %rsi
pushq $0x3
popq %rcx
movq %r14, %rdi
movq -0xa8(%rbp), %rdx
movl %r15d, %r8d
callq 0x41fd2
pushq $0x41
popq %rsi
movq %r14, %rdi
movl -0x70(%rbp), %r13d
movl %r13d, %edx
movl -0x68(%rbp), %r12d
movl %r12d, %ecx
callq 0x41f42
pushq $0x42
popq %rsi
movq %r14, %rdi
movl %r13d, %edx
movl %r15d, %ecx
movl %r12d, %r8d
callq 0x41f4c
movq 0x8(%r14), %rax
testq %rax, %rax
je 0x57b79
movslq 0x34(%r14), %rcx
imulq $0x18, %rcx, %rcx
movb $0x8, -0x15(%rax,%rcx)
testl %ebx, %ebx
js 0x57b8f
movl 0x34(%r14), %ecx
cmpl %ebx, %ecx
jbe 0x57b8f
movl %ebx, %edx
imulq $0x18, %rdx, %rdx
movl %ecx, 0x8(%rax,%rdx)
movq -0x38(%rbp), %rax
cmpl %r15d, 0x58(%rax)
jge 0x57ba1
movq -0x38(%rbp), %rax
movl %r15d, 0x58(%rax)
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq