// File: /workspace/github_c_makefile_star2_O0/ukontainer[P]sqlite-bench/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].zDbSName ) ){
    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);
  assert( pKey!=0 || db->mallocFailed || pParse->nErr );

  /* 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);
  sqlite3MultiWrite(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);
  if( IsUniqueIndex(pIndex) ){
    int j2 = sqlite3VdbeGoto(v, 1);
    addr2 = sqlite3VdbeCurrentAddr(v);
    sqlite3VdbeVerifyAbortable(v, OE_Abort);
    sqlite3VdbeAddOp4Int(v, OP_SorterCompare, iSorter, j2, regRecord,
                         pIndex->nKeyCol); VdbeCoverage(v);
    sqlite3UniqueConstraint(pParse, OE_Abort, pIndex);
    sqlite3VdbeJumpHere(v, j2);
  }else{
    addr2 = sqlite3VdbeCurrentAddr(v);
  }
  sqlite3VdbeAddOp3(v, OP_SorterData, iSorter, regRecord, iIdx);
  sqlite3VdbeAddOp1(v, OP_SeekEnd, iIdx);
  sqlite3VdbeAddOp2(v, OP_IdxInsert, iIdx, regRecord);
  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 0x34(%rcx), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, 0x34(%rcx)
movl %eax, -0x24(%rbp)
movq -0x8(%rbp), %rcx
movl 0x34(%rcx), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, 0x34(%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 0x4111b0
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 0x4741b0
cmpl $0x0, %eax
je 0x47c30e
jmp 0x47c60a
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 0x46c0a0
movq -0x8(%rbp), %rdi
callq 0x46bb00
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0x47c346
jmp 0x47c60a
cmpl $0x0, -0x14(%rbp)
jl 0x47c354
movl -0x14(%rbp), %eax
movl %eax, -0x38(%rbp)
jmp 0x47c35e
movq -0x10(%rbp), %rax
movl 0x58(%rax), %eax
movl %eax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x46c2c0
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rcx
movl 0x34(%rcx), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, 0x34(%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 0x47c960
movq -0x78(%rbp), %rdi
movl -0x70(%rbp), %edx
movl -0x6c(%rbp), %r8d
movq %rax, %r9
movl $0x72, %esi
xorl %ecx, %ecx
movl $0xfffffff7, (%rsp)     # imm = 0xFFFFFFF7
callq 0x46bbd0
movq -0x8(%rbp), %rdi
movl -0x24(%rbp), %esi
movl -0x64(%rbp), %edx
movq -0x20(%rbp), %rcx
movl $0x6d, %r8d
callq 0x46bf90
movq -0x48(%rbp), %rdi
movl -0x24(%rbp), %edx
movl $0x24, %esi
xorl %ecx, %ecx
callq 0x453790
movl %eax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
callq 0x470ad0
movl %eax, -0x54(%rbp)
movq -0x8(%rbp), %rdi
callq 0x47c980
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 0x47c9d0
movq -0x48(%rbp), %rdi
movl -0x2c(%rbp), %edx
movl -0x54(%rbp), %ecx
movl $0x84, %esi
callq 0x453790
movq -0x8(%rbp), %rdi
movl -0x3c(%rbp), %esi
callq 0x47cbd0
movq -0x48(%rbp), %rdi
movl -0x24(%rbp), %edx
movl -0x30(%rbp), %ecx
addl $0x1, %ecx
movl $0x5, %esi
callq 0x453790
movq -0x48(%rbp), %rdi
movl -0x30(%rbp), %esi
callq 0x46bba0
cmpl $0x0, -0x14(%rbp)
jge 0x47c491
movq -0x48(%rbp), %rdi
movl -0x38(%rbp), %edx
movl -0x64(%rbp), %ecx
movl $0x8a, %esi
callq 0x453790
movq -0x48(%rbp), %rdi
movl -0x28(%rbp), %edx
movl -0x38(%rbp), %ecx
movl -0x64(%rbp), %r8d
movq -0x50(%rbp), %r9
movl $0x6e, %esi
movl $0xfffffff7, (%rsp)     # imm = 0xFFFFFFF7
callq 0x46bbd0
movq -0x48(%rbp), %rdi
movl -0x14(%rbp), %edx
xorl %eax, %eax
movl $0x10, %ecx
cmpl $0x0, %edx
cmovgel %ecx, %eax
orl $0x1, %eax
movzwl %ax, %esi
callq 0x411430
movq -0x48(%rbp), %rdi
movl -0x2c(%rbp), %edx
movl $0x22, %esi
xorl %ecx, %ecx
callq 0x453790
movl %eax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movzbl 0x62(%rax), %eax
cmpl $0x0, %eax
je 0x47c554
movq -0x48(%rbp), %rdi
movl $0x1, %esi
callq 0x46bed0
movl %eax, -0x68(%rbp)
movq -0x48(%rbp), %rdi
callq 0x473080
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 $0x7e, %esi
callq 0x4113b0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rdx
movl $0x2, %esi
callq 0x47cc00
movq -0x48(%rbp), %rdi
movl -0x68(%rbp), %esi
callq 0x46bba0
jmp 0x47c560
movq -0x48(%rbp), %rdi
callq 0x473080
movl %eax, -0x34(%rbp)
movq -0x48(%rbp), %rdi
movl -0x2c(%rbp), %edx
movl -0x54(%rbp), %ecx
movl -0x28(%rbp), %r8d
movl $0x7f, %esi
callq 0x4537c0
movq -0x48(%rbp), %rdi
movl -0x28(%rbp), %edx
movl $0x83, %esi
callq 0x46e2d0
movq -0x48(%rbp), %rdi
movl -0x28(%rbp), %edx
movl -0x54(%rbp), %ecx
movl $0x85, %esi
callq 0x453790
movq -0x48(%rbp), %rdi
movl $0x10, %esi
callq 0x411430
movq -0x8(%rbp), %rdi
movl -0x54(%rbp), %esi
callq 0x470060
movq -0x48(%rbp), %rdi
movl -0x2c(%rbp), %edx
movl -0x34(%rbp), %ecx
movl $0x3, %esi
callq 0x453790
movq -0x48(%rbp), %rdi
movl -0x30(%rbp), %esi
callq 0x46bba0
movq -0x48(%rbp), %rdi
movl -0x24(%rbp), %edx
movl $0x75, %esi
callq 0x46e2d0
movq -0x48(%rbp), %rdi
movl -0x28(%rbp), %edx
movl $0x75, %esi
callq 0x46e2d0
movq -0x48(%rbp), %rdi
movl -0x2c(%rbp), %edx
movl $0x75, %esi
callq 0x46e2d0
addq $0x90, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)