// File: /workspace/github_c_makefile_star2_O0/shifengbin[P]bishe/Output/../Persistence/sqlite3.c
// Function: sqlite3RefillIndex
static void sqlite3RefillIndex(Parse *pParse, Index *pIndex, int memRootPage){
  Table *pTab = pIndex->pTable;  /* The table that is indexed */
  int iTab = pParse->nTab++;     /* Btree cursor used for pTab */
  int iIdx = pParse->nTab++;     /* Btree cursor used for pIndex */
  int iSorter;                   /* Cursor opened by OpenSorter (if in use) */
  int addr1;                     /* Address of top of loop */
  int addr2;                     /* Address to jump to for next iteration */
  int tnum;                      /* Root page of index */
  int iPartIdxLabel;             /* Jump to this label to skip a row */
  Vdbe *v;                       /* Generate code into this virtual machine */
  KeyInfo *pKey;                 /* KeyInfo for index */
  int regRecord;                 /* Register holding assembled index record */
  sqlite3 *db = pParse->db;      /* The database connection */
  int iDb = sqlite3SchemaToIndex(db, pIndex->pSchema);

#ifndef SQLITE_OMIT_AUTHORIZATION
  if( sqlite3AuthCheck(pParse, SQLITE_REINDEX, pIndex->zName, 0,
      db->aDb[iDb].zName ) ){
    return;
  }
#endif

  /* Require a write-lock on the table to perform this operation */
  sqlite3TableLock(pParse, iDb, pTab->tnum, 1, pTab->zName);

  v = sqlite3GetVdbe(pParse);
  if( v==0 ) return;
  if( memRootPage>=0 ){
    tnum = memRootPage;
  }else{
    tnum = pIndex->tnum;
  }
  pKey = sqlite3KeyInfoOfIndex(pParse, pIndex);

  /* Open the sorter cursor if we are to use one. */
  iSorter = pParse->nTab++;
  sqlite3VdbeAddOp4(v, OP_SorterOpen, iSorter, 0, pIndex->nKeyCol, (char*)
                    sqlite3KeyInfoRef(pKey), P4_KEYINFO);

  /* Open the table. Loop through all rows of the table, inserting index
  ** records into the sorter. */
  sqlite3OpenTable(pParse, iTab, iDb, pTab, OP_OpenRead);
  addr1 = sqlite3VdbeAddOp2(v, OP_Rewind, iTab, 0); VdbeCoverage(v);
  regRecord = sqlite3GetTempReg(pParse);

  sqlite3GenerateIndexKey(pParse,pIndex,iTab,regRecord,0,&iPartIdxLabel,0,0);
  sqlite3VdbeAddOp2(v, OP_SorterInsert, iSorter, regRecord);
  sqlite3ResolvePartIdxLabel(pParse, iPartIdxLabel);
  sqlite3VdbeAddOp2(v, OP_Next, iTab, addr1+1); VdbeCoverage(v);
  sqlite3VdbeJumpHere(v, addr1);
  if( memRootPage<0 ) sqlite3VdbeAddOp2(v, OP_Clear, tnum, iDb);
  sqlite3VdbeAddOp4(v, OP_OpenWrite, iIdx, tnum, iDb, 
                    (char *)pKey, P4_KEYINFO);
  sqlite3VdbeChangeP5(v, OPFLAG_BULKCSR|((memRootPage>=0)?OPFLAG_P2ISREG:0));

  addr1 = sqlite3VdbeAddOp2(v, OP_SorterSort, iSorter, 0); VdbeCoverage(v);
  assert( pKey!=0 || db->mallocFailed || pParse->nErr );
  if( IsUniqueIndex(pIndex) && pKey!=0 ){
    int j2 = sqlite3VdbeCurrentAddr(v) + 3;
    sqlite3VdbeGoto(v, j2);
    addr2 = sqlite3VdbeCurrentAddr(v);
    sqlite3VdbeAddOp4Int(v, OP_SorterCompare, iSorter, j2, regRecord,
                         pIndex->nKeyCol); VdbeCoverage(v);
    sqlite3UniqueConstraint(pParse, OE_Abort, pIndex);
  }else{
    addr2 = sqlite3VdbeCurrentAddr(v);
  }
  sqlite3VdbeAddOp3(v, OP_SorterData, iSorter, regRecord, iIdx);
  sqlite3VdbeAddOp3(v, OP_Last, iIdx, 0, -1);
  sqlite3VdbeAddOp3(v, OP_IdxInsert, iIdx, regRecord, 0);
  sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT);
  sqlite3ReleaseTempReg(pParse, regRecord);
  sqlite3VdbeAddOp2(v, OP_SorterNext, iSorter, addr2); VdbeCoverage(v);
  sqlite3VdbeJumpHere(v, addr1);

  sqlite3VdbeAddOp1(v, OP_Close, iTab);
  sqlite3VdbeAddOp1(v, OP_Close, iIdx);
  sqlite3VdbeAddOp1(v, OP_Close, iSorter);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rcx
movl 0x50(%rcx), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, 0x50(%rcx)
movl %eax, -0x24(%rbp)
movq -0x8(%rbp), %rcx
movl 0x50(%rcx), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, 0x50(%rcx)
movl %eax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rsi
callq 0x17ab0
movl %eax, -0x64(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rdx
movq -0x60(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x64(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq (%rax), %r8
movl $0x1b, %esi
xorl %eax, %eax
movl %eax, %ecx
callq 0x73440
cmpl $0x0, %eax
je 0x7af5e
jmp 0x7b261
movq -0x8(%rbp), %rdi
movl -0x64(%rbp), %esi
movq -0x20(%rbp), %rax
movl 0x38(%rax), %edx
movq -0x20(%rbp), %rax
movq (%rax), %r8
movl $0x1, %ecx
callq 0x6c340
movq -0x8(%rbp), %rdi
callq 0x6bd00
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0x7af96
jmp 0x7b261
cmpl $0x0, -0x14(%rbp)
jl 0x7afa4
movl -0x14(%rbp), %eax
movl %eax, -0x38(%rbp)
jmp 0x7afae
movq -0x10(%rbp), %rax
movl 0x58(%rax), %eax
movl %eax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x6c530
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rcx
movl 0x50(%rcx), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, 0x50(%rcx)
movl %eax, -0x2c(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x78(%rbp)
movl -0x2c(%rbp), %eax
movl %eax, -0x70(%rbp)
movq -0x10(%rbp), %rax
movzwl 0x5e(%rax), %eax
movl %eax, -0x6c(%rbp)
movq -0x50(%rbp), %rdi
callq 0x7b560
movq -0x78(%rbp), %rdi
movl -0x70(%rbp), %edx
movl -0x6c(%rbp), %r8d
movq %rax, %r9
movl $0x3b, %esi
xorl %ecx, %ecx
movl $0xfffffffa, (%rsp)     # imm = 0xFFFFFFFA
callq 0x6be70
movq -0x8(%rbp), %rdi
movl -0x24(%rbp), %esi
movl -0x64(%rbp), %edx
movq -0x20(%rbp), %rcx
movl $0x37, %r8d
callq 0x6c1e0
movq -0x48(%rbp), %rdi
movl -0x24(%rbp), %edx
movl $0x6e, %esi
xorl %ecx, %ecx
callq 0x6c310
movl %eax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
callq 0x6f960
movl %eax, -0x54(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x24(%rbp), %edx
movl -0x54(%rbp), %ecx
xorl %r8d, %r8d
leaq -0x3c(%rbp), %r9
xorl %eax, %eax
movq $0x0, (%rsp)
movl $0x0, 0x8(%rsp)
callq 0x7b580
movq -0x48(%rbp), %rdi
movl -0x2c(%rbp), %edx
movl -0x54(%rbp), %ecx
movl $0x6f, %esi
callq 0x6c310
movq -0x8(%rbp), %rdi
movl -0x3c(%rbp), %esi
callq 0x7b740
movq -0x48(%rbp), %rdi
movl -0x24(%rbp), %edx
movl -0x30(%rbp), %ecx
addl $0x1, %ecx
movl $0x8, %esi
callq 0x6c310
movq -0x48(%rbp), %rdi
movl -0x30(%rbp), %esi
callq 0x6be30
cmpl $0x0, -0x14(%rbp)
jge 0x7b0d8
movq -0x48(%rbp), %rdi
movl -0x38(%rbp), %edx
movl -0x64(%rbp), %ecx
movl $0x78, %esi
callq 0x6c310
movq -0x48(%rbp), %rdi
movl -0x28(%rbp), %edx
movl -0x38(%rbp), %ecx
movl -0x64(%rbp), %r8d
movq -0x50(%rbp), %r9
movl $0x38, %esi
movl $0xfffffffa, (%rsp)     # imm = 0xFFFFFFFA
callq 0x6be70
movq -0x48(%rbp), %rdi
movl -0x14(%rbp), %edx
xorl %eax, %eax
movl $0x10, %ecx
cmpl $0x0, %edx
cmovgel %ecx, %eax
orl $0x1, %eax
movzbl %al, %esi
callq 0x17b70
movq -0x48(%rbp), %rdi
movl -0x2c(%rbp), %edx
movl $0x6c, %esi
xorl %ecx, %ecx
callq 0x6c310
movl %eax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movzbl 0x62(%rax), %eax
cmpl $0x0, %eax
je 0x7b1a0
cmpq $0x0, -0x50(%rbp)
je 0x7b1a0
movq -0x48(%rbp), %rdi
callq 0x6c2b0
addl $0x3, %eax
movl %eax, -0x68(%rbp)
movq -0x48(%rbp), %rdi
movl -0x68(%rbp), %esi
callq 0x6c1b0
movq -0x48(%rbp), %rdi
callq 0x6c2b0
movl %eax, -0x34(%rbp)
movq -0x48(%rbp), %rdi
movl -0x2c(%rbp), %edx
movl -0x68(%rbp), %ecx
movl -0x54(%rbp), %r8d
movq -0x10(%rbp), %rax
movzwl 0x5e(%rax), %r9d
movl $0x65, %esi
callq 0x17b10
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rdx
movl $0x2, %esi
callq 0x7b780
jmp 0x7b1ac
movq -0x48(%rbp), %rdi
callq 0x6c2b0
movl %eax, -0x34(%rbp)
movq -0x48(%rbp), %rdi
movl -0x2c(%rbp), %edx
movl -0x54(%rbp), %ecx
movl -0x28(%rbp), %r8d
movl $0x66, %esi
callq 0x56c10
movq -0x48(%rbp), %rdi
movl -0x28(%rbp), %edx
movl $0x6b, %esi
xorl %ecx, %ecx
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
callq 0x56c10
movq -0x48(%rbp), %rdi
movl -0x28(%rbp), %edx
movl -0x54(%rbp), %ecx
movl $0x70, %esi
xorl %r8d, %r8d
callq 0x56c10
movq -0x48(%rbp), %rdi
movl $0x10, %esi
callq 0x17b70
movq -0x8(%rbp), %rdi
movl -0x54(%rbp), %esi
callq 0x6f9b0
movq -0x48(%rbp), %rdi
movl -0x2c(%rbp), %edx
movl -0x34(%rbp), %ecx
movl $0x4, %esi
callq 0x6c310
movq -0x48(%rbp), %rdi
movl -0x30(%rbp), %esi
callq 0x6be30
movq -0x48(%rbp), %rdi
movl -0x24(%rbp), %edx
movl $0x3e, %esi
callq 0x6e570
movq -0x48(%rbp), %rdi
movl -0x28(%rbp), %edx
movl $0x3e, %esi
callq 0x6e570
movq -0x48(%rbp), %rdi
movl -0x2c(%rbp), %edx
movl $0x3e, %esi
callq 0x6e570
addq $0x90, %rsp
popq %rbp
retq
nopw (%rax,%rax)