// File: /workspace/github_c_makefile_star2_O3/skeeto[P]flappy/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 */
  int iTab         /* Next available cursor */
){
  sqlite3 *db = pParse->db;    /* Database handle */
  Index *pIdx;                 /* An index to being analyzed */
  int iIdxCur;                 /* Cursor open on index being analyzed */
  int iTabCur;                 /* Table cursor */
  Vdbe *v;                     /* The virtual machine being built up */
  int i;                       /* Loop counter */
  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 regNewRowid = iMem++;    /* Rowid for the inserted record */
  int regStat4 = iMem++;       /* Register to hold Stat4Accum object */
  int regChng = iMem++;        /* Index of changed index field */
#ifdef SQLITE_ENABLE_STAT3_OR_STAT4
  int regRowid = iMem++;       /* Rowid argument passed to stat_push() */
#endif
  int regTemp = iMem++;        /* Temporary use register */
  int regTabname = iMem++;     /* Register containing table name */
  int regIdxname = iMem++;     /* Register containing index name */
  int regStat1 = iMem++;       /* Value for the stat column of sqlite_stat1 */
  int regPrev = iMem;          /* MUST BE LAST (see below) */

  pParse->nMem = MAX(pParse->nMem, iMem);
  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. 
  ** Open a read-only cursor on the table. Also allocate a cursor number
  ** to use for scanning indexes (iIdxCur). No index cursor is opened at
  ** this time though.  */
  sqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName);
  iTabCur = iTab++;
  iIdxCur = iTab++;
  pParse->nTab = MAX(pParse->nTab, iTab);
  sqlite3OpenTable(pParse, iTabCur, iDb, pTab, OP_OpenRead);
  sqlite3VdbeAddOp4(v, OP_String8, 0, regTabname, 0, pTab->zName, 0);

  for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
    int nCol;                     /* Number of columns indexed by pIdx */
    int *aGotoChng;               /* Array of jump instruction addresses */
    int addrRewind;               /* Address of "OP_Rewind iIdxCur" */
    int addrGotoChng0;            /* Address of "Goto addr_chng_0" */
    int addrNextRow;              /* Address of "next_row:" */
    const char *zIdxName;         /* Name of the index */

    if( pOnlyIdx && pOnlyIdx!=pIdx ) continue;
    if( pIdx->pPartIdxWhere==0 ) needTableCnt = 0;
    VdbeNoopComment((v, "Begin analysis of %s", pIdx->zName));
    nCol = pIdx->nKeyCol;
    aGotoChng = sqlite3DbMallocRaw(db, sizeof(int)*(nCol+1));
    if( aGotoChng==0 ) continue;

    /* Populate the register containing the index name. */
    if( pIdx->autoIndex==2 && !HasRowid(pTab) ){
      zIdxName = pTab->zName;
    }else{
      zIdxName = pIdx->zName;
    }
    sqlite3VdbeAddOp4(v, OP_String8, 0, regIdxname, 0, zIdxName, 0);

    /*
    ** Pseudo-code for loop that calls stat_push():
    **
    **   Rewind csr
    **   if eof(csr) goto end_of_scan;
    **   regChng = 0
    **   goto chng_addr_0;
    **
    **  next_row:
    **   regChng = 0
    **   if( idx(0) != regPrev(0) ) goto chng_addr_0
    **   regChng = 1
    **   if( idx(1) != regPrev(1) ) goto chng_addr_1
    **   ...
    **   regChng = N
    **   goto chng_addr_N
    **
    **  chng_addr_0:
    **   regPrev(0) = idx(0)
    **  chng_addr_1:
    **   regPrev(1) = idx(1)
    **  ...
    **
    **  chng_addr_N:
    **   regRowid = idx(rowid)
    **   stat_push(P, regChng, regRowid)
    **   Next csr
    **   if !eof(csr) goto next_row;
    **
    **  end_of_scan:
    */

    /* Make sure there are enough memory cells allocated to accommodate 
    ** the regPrev array and a trailing rowid (the rowid slot is required
    ** when building a record to insert into the sample column of 
    ** the sqlite_stat4 table.  */
    pParse->nMem = MAX(pParse->nMem, regPrev+nCol);

    /* Open a read-only cursor on the index being analyzed. */
    assert( iDb==sqlite3SchemaToIndex(db, pIdx->pSchema) );
    sqlite3VdbeAddOp3(v, OP_OpenRead, iIdxCur, pIdx->tnum, iDb);
    sqlite3VdbeSetP4KeyInfo(pParse, pIdx);
    VdbeComment((v, "%s", pIdx->zName));

    /* Invoke the stat_init() function. The arguments are:
    ** 
    **    (1) the number of columns in the index including the rowid,
    **    (2) the number of rows in the index,
    **
    ** The second argument is only used for STAT3 and STAT4
    */
#ifdef SQLITE_ENABLE_STAT3_OR_STAT4
    sqlite3VdbeAddOp2(v, OP_Count, iIdxCur, regStat4+2);
#endif
    sqlite3VdbeAddOp2(v, OP_Integer, nCol+1, regStat4+1);
    sqlite3VdbeAddOp3(v, OP_Function, 0, regStat4+1, regStat4);
    sqlite3VdbeChangeP4(v, -1, (char*)&statInitFuncdef, P4_FUNCDEF);
    sqlite3VdbeChangeP5(v, 1+IsStat34);

    /* Implementation of the following:
    **
    **   Rewind csr
    **   if eof(csr) goto end_of_scan;
    **   regChng = 0
    **   goto next_push_0;
    **
    */
    addrRewind = sqlite3VdbeAddOp1(v, OP_Rewind, iIdxCur);
    sqlite3VdbeAddOp2(v, OP_Integer, 0, regChng);
    addrGotoChng0 = sqlite3VdbeAddOp0(v, OP_Goto);

    /*
    **  next_row:
    **   regChng = 0
    **   if( idx(0) != regPrev(0) ) goto chng_addr_0
    **   regChng = 1
    **   if( idx(1) != regPrev(1) ) goto chng_addr_1
    **   ...
    **   regChng = N
    **   goto chng_addr_N
    */
    addrNextRow = sqlite3VdbeCurrentAddr(v);
    for(i=0; i<nCol; i++){
      char *pColl = (char*)sqlite3LocateCollSeq(pParse, pIdx->azColl[i]);
      sqlite3VdbeAddOp2(v, OP_Integer, i, regChng);
      sqlite3VdbeAddOp3(v, OP_Column, iIdxCur, i, regTemp);
      aGotoChng[i] = 
      sqlite3VdbeAddOp4(v, OP_Ne, regTemp, 0, regPrev+i, pColl, P4_COLLSEQ);
      sqlite3VdbeChangeP5(v, SQLITE_NULLEQ);
    }
    sqlite3VdbeAddOp2(v, OP_Integer, nCol, regChng);
    aGotoChng[nCol] = sqlite3VdbeAddOp0(v, OP_Goto);

    /*
    **  chng_addr_0:
    **   regPrev(0) = idx(0)
    **  chng_addr_1:
    **   regPrev(1) = idx(1)
    **  ...
    */
    sqlite3VdbeJumpHere(v, addrGotoChng0);
    for(i=0; i<nCol; i++){
      sqlite3VdbeJumpHere(v, aGotoChng[i]);
      sqlite3VdbeAddOp3(v, OP_Column, iIdxCur, i, regPrev+i);
    }

    /*
    **  chng_addr_N:
    **   regRowid = idx(rowid)            // STAT34 only
    **   stat_push(P, regChng, regRowid)  // 3rd parameter STAT34 only
    **   Next csr
    **   if !eof(csr) goto next_row;
    */
    sqlite3VdbeJumpHere(v, aGotoChng[nCol]);
#ifdef SQLITE_ENABLE_STAT3_OR_STAT4
    assert( regRowid==(regStat4+2) );
    if( HasRowid(pTab) ){
      sqlite3VdbeAddOp2(v, OP_IdxRowid, iIdxCur, regRowid);
    }else{
      Index *pPk = sqlite3PrimaryKeyIndex(pIdx->pTable);
      int j, k, regKey;
      regKey = sqlite3GetTempRange(pParse, pPk->nKeyCol);
      for(j=0; j<pPk->nKeyCol; j++){
        k = sqlite3ColumnOfIndex(pIdx, pPk->aiColumn[j]);
        sqlite3VdbeAddOp3(v, OP_Column, iIdxCur, k, regKey+j);
        VdbeComment((v, "%s", pTab->aCol[pPk->aiColumn[j]].zName));
      }
      sqlite3VdbeAddOp3(v, OP_MakeRecord, regKey, pPk->nKeyCol, regRowid);
      sqlite3ReleaseTempRange(pParse, regKey, pPk->nKeyCol);
    }
#endif
    assert( regChng==(regStat4+1) );
    sqlite3VdbeAddOp3(v, OP_Function, 1, regStat4, regTemp);
    sqlite3VdbeChangeP4(v, -1, (char*)&statPushFuncdef, P4_FUNCDEF);
    sqlite3VdbeChangeP5(v, 2+IsStat34);
    sqlite3VdbeAddOp2(v, OP_Next, iIdxCur, addrNextRow);

    /* Add the entry to the stat1 table. */
    callStatGet(v, regStat4, STAT_GET_STAT1, regStat1);
    sqlite3VdbeAddOp4(v, OP_MakeRecord, regTabname, 3, regTemp, "aaa", 0);
    sqlite3VdbeAddOp2(v, OP_NewRowid, iStatCur, regNewRowid);
    sqlite3VdbeAddOp3(v, OP_Insert, iStatCur, regTemp, regNewRowid);
    sqlite3VdbeChangeP5(v, OPFLAG_APPEND);

    /* Add the entries to the stat3 or stat4 table. */
#ifdef SQLITE_ENABLE_STAT3_OR_STAT4
    {
      int regEq = regStat1;
      int regLt = regStat1+1;
      int regDLt = regStat1+2;
      int regSample = regStat1+3;
      int regCol = regStat1+4;
      int regSampleRowid = regCol + nCol;
      int addrNext;
      int addrIsNull;
      u8 seekOp = HasRowid(pTab) ? OP_NotExists : OP_NotFound;

      pParse->nMem = MAX(pParse->nMem, regCol+nCol+1);

      addrNext = sqlite3VdbeCurrentAddr(v);
      callStatGet(v, regStat4, STAT_GET_ROWID, regSampleRowid);
      addrIsNull = sqlite3VdbeAddOp1(v, OP_IsNull, regSampleRowid);
      callStatGet(v, regStat4, STAT_GET_NEQ, regEq);
      callStatGet(v, regStat4, STAT_GET_NLT, regLt);
      callStatGet(v, regStat4, STAT_GET_NDLT, regDLt);
      sqlite3VdbeAddOp4Int(v, seekOp, iTabCur, addrNext, regSampleRowid, 0);
#ifdef SQLITE_ENABLE_STAT3
      sqlite3ExprCodeGetColumnOfTable(v, pTab, iTabCur, 
                                      pIdx->aiColumn[0], regSample);
#else
      for(i=0; i<nCol; i++){
        i16 iCol = pIdx->aiColumn[i];
        sqlite3ExprCodeGetColumnOfTable(v, pTab, iTabCur, iCol, regCol+i);
      }
      sqlite3VdbeAddOp3(v, OP_MakeRecord, regCol, nCol+1, regSample);
#endif
      sqlite3VdbeAddOp4(v, OP_MakeRecord, regTabname, 6, regTemp, "bbbbbb", 0);
      sqlite3VdbeAddOp2(v, OP_NewRowid, iStatCur+1, regNewRowid);
      sqlite3VdbeAddOp3(v, OP_Insert, iStatCur+1, regTemp, regNewRowid);
      sqlite3VdbeAddOp2(v, OP_Goto, 0, addrNext);
      sqlite3VdbeJumpHere(v, addrIsNull);
    }
#endif /* SQLITE_ENABLE_STAT3_OR_STAT4 */

    /* End of analysis */
    sqlite3VdbeJumpHere(v, addrRewind);
    sqlite3DbFree(db, aGotoChng);
  }


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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movl %r9d, %ebx
movl %r8d, %r15d
movl %ecx, %ebp
movq %rdx, %r12
movq %rsi, %r13
movq (%rdi), %rax
movq %rax, 0x30(%rsp)
leal 0x7(%r15), %ecx
movl 0x58(%rdi), %eax
cmpl %ecx, %eax
movq %rcx, 0x70(%rsp)
cmovlel %ecx, %eax
movl %eax, 0x58(%rdi)
movq %rdi, 0x48(%rsp)
callq 0x48791
movq %rax, %r14
testq %rax, %rax
sete %al
testq %r13, %r13
sete %cl
orb %al, %cl
jne 0x668f3
cmpl $0x0, 0x3c(%r13)
je 0x668f3
leal 0x1(%r15), %eax
movl %eax, 0x2c(%rsp)
leal 0x2(%r15), %eax
movl %eax, 0x14(%rsp)
leal 0x3(%r15), %eax
movl %eax, 0x10(%rsp)
leal 0x4(%r15), %eax
movl %eax, 0x28(%rsp)
leal 0x5(%r15), %eax
movl %eax, 0x40(%rsp)
leal 0x6(%r15), %eax
movl %eax, 0x3c(%rsp)
movq (%r13), %rdx
xorl %ecx, %ecx
leaq 0x7b8e(%rip), %rax      # 0x6e3d0
leaq 0xc578(%rip), %rsi      # 0x72dc1
movzbl (%rdx,%rcx), %edi
testq %rdi, %rdi
je 0x66872
movzbl (%rdi,%rax), %edi
movzbl (%rcx,%rsi), %r8d
movb (%r8,%rax), %r8b
cmpb %r8b, %dil
jne 0x6687c
incq %rcx
cmpq $0x7, %rcx
jne 0x66849
jmp 0x668f3
movzbl (%rcx,%rsi), %ecx
movb (%rcx,%rax), %r8b
xorl %edi, %edi
movzbl %r8b, %eax
cmpl %eax, %edi
je 0x668f3
movq 0x70(%r13), %rax
testq %rax, %rax
je 0x668ba
movq 0x30(%rsp), %rdi
movl 0x28(%rdi), %ecx
testl %ecx, %ecx
jle 0x668c7
movq 0x20(%rdi), %rsi
addq $0x18, %rsi
xorl %r8d, %r8d
cmpq %rax, (%rsi)
je 0x668ca
incq %r8
addq $0x20, %rsi
cmpq %r8, %rcx
jne 0x668a4
movl %ecx, %r8d
jmp 0x668ca
movl $0xfff0bdc0, %r8d       # imm = 0xFFF0BDC0
movq 0x30(%rsp), %rdi
jmp 0x668ca
xorl %r8d, %r8d
movq %r8, 0x58(%rsp)
movq 0x20(%rdi), %rax
movslq %r8d, %rcx
shlq $0x5, %rcx
movq (%rax,%rcx), %r8
movq 0x48(%rsp), %rdi
movl $0x1c, %esi
xorl %ecx, %ecx
callq 0x4d23f
testl %eax, %eax
je 0x66905
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r12, 0x50(%rsp)
movl 0x3c(%r13), %edx
movq (%r13), %r8
movq 0x48(%rsp), %r12
movq %r12, %rdi
movq 0x58(%rsp), %rsi
xorl %ecx, %ecx
callq 0x48985
leal 0x2(%rbx), %eax
movl 0x54(%r12), %ecx
cmpl %eax, %ecx
cmovgl %ecx, %eax
movl %eax, 0x54(%r12)
movq %r12, %rdi
movl %ebx, %esi
movq 0x58(%rsp), %rdx
movq %r13, %rcx
movl $0x32, %r8d
callq 0x488b9
movq %rbx, %r12
movq (%r13), %rbx
movq %r14, %rdi
movl $0x5f, %esi
xorl %edx, %edx
movl 0x28(%rsp), %ecx
xorl %r8d, %r8d
callq 0x487d8
movq %r14, %rdi
movl %eax, %esi
movq %rbx, %rdx
xorl %ecx, %ecx
callq 0x12044
movq 0x10(%r13), %rbx
testq %rbx, %rbx
movq %r12, 0x80(%rsp)
je 0x66e42
leal 0x1(%r12), %eax
movl %eax, 0xc(%rsp)
movl 0x70(%rsp), %eax
movq %rax, 0x78(%rsp)
movb $0x1, %dl
movq 0x50(%rsp), %r12
movq 0x30(%rsp), %rdi
movq %r15, 0x90(%rsp)
movl %ebp, 0x64(%rsp)
movq %r13, 0x88(%rsp)
testq %r12, %r12
setne %al
cmpq %r12, %rbx
setne %cl
testb %cl, %al
jne 0x66e2e
cmpq $0x0, 0x48(%rbx)
movzbl %dl, %edx
movl $0x0, %eax
cmovel %eax, %edx
movl %edx, 0x44(%rsp)
movzwl 0x5e(%rbx), %eax
movq %rax, 0x18(%rsp)
leal 0x4(,%rax,4), %esi
callq 0x11c9d
testq %rax, %rax
je 0x66e25
movq %rax, %r13
movb 0x63(%rbx), %al
andb $0x3, %al
cmpb $0x2, %al
jne 0x66a23
movq 0x88(%rsp), %rax
testb $0x20, 0x48(%rax)
jne 0x66a26
movq %rbx, %rax
movq 0x18(%rsp), %r15
leal 0x1(%r15), %ecx
movl %ecx, 0x24(%rsp)
movq (%rax), %r12
movq %r14, %rdi
movl $0x5f, %esi
xorl %edx, %edx
movl 0x40(%rsp), %ecx
xorl %r8d, %r8d
callq 0x487d8
movq %r14, %rdi
movl %eax, %esi
movq %r12, %rdx
xorl %ecx, %ecx
callq 0x12044
movq 0x48(%rsp), %rbp
movl 0x58(%rbp), %eax
movq 0x70(%rsp), %rcx
addl %r15d, %ecx
cmpl %ecx, %eax
cmovgl %eax, %ecx
movl %ecx, 0x58(%rbp)
movl 0x58(%rbx), %ecx
movq %r14, %rdi
movl $0x32, %esi
movl 0xc(%rsp), %edx
movq 0x58(%rsp), %r8
callq 0x487d8
movq 0x10(%rbp), %r12
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x48a99
movq %r12, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movq %rax, %rdx
movl $0xfffffffa, %ecx       # imm = 0xFFFFFFFA
callq 0x12044
movq %r14, %rdi
movl $0x17, %esi
movl 0x24(%rsp), %edx
movl 0x14(%rsp), %ebp
movl %ebp, %ecx
xorl %r8d, %r8d
callq 0x487d8
movq %r14, %rdi
movl $0x1, %esi
xorl %edx, %edx
movl %ebp, %ecx
movl 0x2c(%rsp), %r8d
callq 0x487d8
movq %r14, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
leaq 0x22f71(%rip), %rdx     # 0x89a60
movl $0xfffffffb, %ecx       # imm = 0xFFFFFFFB
callq 0x12044
movq 0x8(%r14), %rax
testq %rax, %rax
je 0x66b0f
movslq 0x34(%r14), %rcx
leaq (%rcx,%rcx,2), %rcx
movb $0x1, -0x15(%rax,%rcx,8)
movq %r14, %rdi
movl $0x67, %esi
movl 0xc(%rsp), %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x487d8
movl %eax, 0x24(%rsp)
movq %r14, %rdi
movl $0x17, %esi
xorl %edx, %edx
movl 0x14(%rsp), %ecx
xorl %r8d, %r8d
callq 0x487d8
movq %r14, %rdi
movl $0x10, %esi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x487d8
movl %eax, 0x68(%rsp)
movl 0x34(%r14), %eax
movl %eax, 0x6c(%rsp)
cmpq $0x0, 0x18(%rsp)
je 0x66c0c
xorl %ebp, %ebp
movq 0x40(%rbx), %rax
movq (%rax,%rbp,8), %rsi
movq 0x48(%rsp), %rdi
callq 0x48c12
movq %rax, %r12
movq %r14, %rdi
movl $0x17, %esi
movl %ebp, %edx
movl 0x14(%rsp), %ecx
xorl %r8d, %r8d
callq 0x487d8
movq %r14, %rdi
movl $0x2b, %esi
movl 0xc(%rsp), %edx
movl %ebp, %ecx
movl 0x10(%rsp), %r15d
movl %r15d, %r8d
callq 0x487d8
movq 0x78(%rsp), %rax
leal (%rax,%rbp), %r8d
movq %r14, %rdi
movl $0x4c, %esi
movl %r15d, %edx
xorl %ecx, %ecx
callq 0x487d8
movl %eax, %r15d
movq %r14, %rdi
movl %eax, %esi
movq %r12, %rdx
movl $0xfffffffc, %ecx       # imm = 0xFFFFFFFC
callq 0x12044
movl %r15d, (%r13,%rbp,4)
movq 0x8(%r14), %rax
testq %rax, %rax
je 0x66bfe
movslq 0x34(%r14), %rcx
leaq (%rcx,%rcx,2), %rcx
movb $-0x80, -0x15(%rax,%rcx,8)
incq %rbp
cmpq %rbp, 0x18(%rsp)
jne 0x66b6d
movq %r14, %rdi
movl $0x17, %esi
movq 0x18(%rsp), %r15
movl %r15d, %edx
movl 0x14(%rsp), %ecx
xorl %r8d, %r8d
callq 0x487d8
movq %r14, %rdi
movl $0x10, %esi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x487d8
movl %eax, (%r13,%r15,4)
movl 0x68(%rsp), %edx
testl %edx, %edx
js 0x66c5f
movl 0x34(%r14), %eax
cmpl %edx, %eax
jbe 0x66c5f
movq 0x8(%r14), %rcx
movl %edx, %edx
leaq (%rdx,%rdx,2), %rdx
movl %eax, 0x8(%rcx,%rdx,8)
cmpq $0x0, 0x18(%rsp)
je 0x66cb0
movl 0x18(%rsp), %r15d
xorl %ebp, %ebp
movslq (%r13,%rbp,4), %rax
testq %rax, %rax
js 0x66c8c
movl 0x34(%r14), %ecx
cmpl %eax, %ecx
jbe 0x66c8c
movq 0x8(%r14), %rdx
leaq (%rax,%rax,2), %rax
movl %ecx, 0x8(%rdx,%rax,8)
movq 0x78(%rsp), %rax
leal (%rax,%rbp), %r8d
movq %r14, %rdi
movl $0x2b, %esi
movl 0xc(%rsp), %edx
movl %ebp, %ecx
callq 0x487d8
incq %rbp
cmpq %rbp, %r15
jne 0x66c6e
movq 0x18(%rsp), %rax
movslq (%r13,%rax,4), %rax
testq %rax, %rax
js 0x66cd3
movl 0x34(%r14), %ecx
cmpl %eax, %ecx
jbe 0x66cd3
movq 0x8(%r14), %rdx
leaq (%rax,%rax,2), %rax
movl %ecx, 0x8(%rdx,%rax,8)
movq %r14, %rdi
movl $0x1, %esi
movl $0x1, %edx
movl 0x2c(%rsp), %ecx
movl 0x10(%rsp), %r8d
callq 0x487d8
movq %r14, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
leaq 0x22dab(%rip), %rdx     # 0x89aa8
movl $0xfffffffb, %ecx       # imm = 0xFFFFFFFB
callq 0x12044
movq 0x8(%r14), %rax
testq %rax, %rax
movq 0x90(%rsp), %r15
movl 0x64(%rsp), %ebp
je 0x66d29
movslq 0x34(%r14), %rcx
leaq (%rcx,%rcx,2), %rcx
movb $0x2, -0x15(%rax,%rcx,8)
movq %r14, %rdi
movl $0x9, %esi
movl 0xc(%rsp), %edx
movl 0x6c(%rsp), %ecx
xorl %r8d, %r8d
callq 0x487d8
movq %r14, %rdi
movl $0x1, %esi
xorl %edx, %edx
movl 0x2c(%rsp), %ecx
movl 0x3c(%rsp), %r8d
callq 0x487d8
movq %r14, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
leaq 0x22d88(%rip), %rdx     # 0x89af0
movl $0xfffffffb, %ecx       # imm = 0xFFFFFFFB
callq 0x12044
movq 0x8(%r14), %rax
testq %rax, %rax
je 0x66d88
movslq 0x34(%r14), %rcx
leaq (%rcx,%rcx,2), %rcx
movb $0x1, -0x15(%rax,%rcx,8)
movq %r14, %rdi
movl $0x2d, %esi
movl 0x28(%rsp), %edx
movl $0x3, %ecx
movl 0x10(%rsp), %r12d
movl %r12d, %r8d
callq 0x487d8
movq %r14, %rdi
movl %eax, %esi
leaq 0xda65(%rip), %rdx      # 0x74817
xorl %ecx, %ecx
callq 0x12044
movq %r14, %rdi
movl $0x43, %esi
movl %ebp, %edx
movl %r15d, %ecx
xorl %r8d, %r8d
callq 0x487d8
movq %r14, %rdi
movl $0x44, %esi
movl %ebp, %edx
movl %r12d, %ecx
movl %r15d, %r8d
callq 0x487d8
movq 0x8(%r14), %rax
testq %rax, %rax
je 0x66df9
movslq 0x34(%r14), %rcx
leaq (%rcx,%rcx,2), %rcx
movb $0x8, -0x15(%rax,%rcx,8)
movl 0x24(%rsp), %edx
testl %edx, %edx
movq 0x50(%rsp), %r12
js 0x66e18
movl 0x34(%r14), %ecx
cmpl %edx, %ecx
jbe 0x66e18
movl %edx, %edx
leaq (%rdx,%rdx,2), %rdx
movl %ecx, 0x8(%rax,%rdx,8)
movq 0x30(%rsp), %rdi
movq %r13, %rsi
callq 0x9b42
movq 0x30(%rsp), %rdi
movl 0x44(%rsp), %edx
movq 0x28(%rbx), %rbx
testq %rbx, %rbx
jne 0x669c3
testb %dl, %dl
setne %al
jmp 0x66e49
movb $0x1, %al
movq 0x50(%rsp), %r12
testq %r12, %r12
movq 0x80(%rsp), %rdx
jne 0x668f3
testb %al, %al
je 0x668f3
movq %r14, %rdi
movl $0x2e, %esi
movl 0x3c(%rsp), %ebx
movl %ebx, %ecx
xorl %r8d, %r8d
callq 0x487d8
movq %r14, %rdi
movl $0x2a, %esi
movl %ebx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x487d8
movl %eax, %ebx
movq %r14, %rdi
movl $0x1a, %esi
xorl %edx, %edx
movl 0x40(%rsp), %ecx
xorl %r8d, %r8d
callq 0x487d8
movq %r14, %rdi
movl $0x2d, %esi
movl 0x28(%rsp), %edx
movl $0x3, %ecx
movl 0x10(%rsp), %r12d
movl %r12d, %r8d
callq 0x487d8
leaq 0xd94e(%rip), %rdx      # 0x74817
movq %r14, %rdi
movl %eax, %esi
xorl %ecx, %ecx
callq 0x12044
movq %r14, %rdi
movl $0x43, %esi
movl %ebp, %edx
movl %r15d, %ecx
xorl %r8d, %r8d
callq 0x487d8
movq %r14, %rdi
movl $0x44, %esi
movl %ebp, %edx
movl %r12d, %ecx
movl %r15d, %r8d
callq 0x487d8
movq 0x8(%r14), %rax
testq %rax, %rax
je 0x66f15
movslq 0x34(%r14), %rcx
leaq (%rcx,%rcx,2), %rcx
movb $0x8, -0x15(%rax,%rcx,8)
testl %ebx, %ebx
js 0x668f3
movl 0x34(%r14), %ecx
cmpl %ebx, %ecx
jbe 0x668f3
movl %ebx, %edx
leaq (%rdx,%rdx,2), %rdx
movl %ecx, 0x8(%rax,%rdx,8)
jmp 0x668f3