// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3GenerateIndexKey
SQLITE_PRIVATE int sqlite3GenerateIndexKey(
  Parse *pParse,       /* Parsing context */
  Index *pIdx,         /* The index for which to generate a key */
  int iCur,            /* Cursor number for the pIdx->pTable table */
  int regOut,          /* Write the new index key to this register */
  int doMakeRec,       /* Run the OP_MakeRecord instruction if true */
  int *piPartIdxLabel  /* OUT: Jump to this label to skip partial index */
){
  Vdbe *v = pParse->pVdbe;
  int j;
  Table *pTab = pIdx->pTable;
  int regBase;
  int nCol;

  if( piPartIdxLabel ){
    if( pIdx->pPartIdxWhere ){
      *piPartIdxLabel = sqlite3VdbeMakeLabel(v);
      pParse->iPartIdxTab = iCur;
      sqlite3ExprIfFalse(pParse, pIdx->pPartIdxWhere, *piPartIdxLabel, 
                         SQLITE_JUMPIFNULL);
    }else{
      *piPartIdxLabel = 0;
    }
  }
  nCol = pIdx->nColumn;
  regBase = sqlite3GetTempRange(pParse, nCol+1);
  sqlite3VdbeAddOp2(v, OP_Rowid, iCur, regBase+nCol);
  for(j=0; j<nCol; j++){
    int idx = pIdx->aiColumn[j];
    if( idx==pTab->iPKey ){
      sqlite3VdbeAddOp2(v, OP_SCopy, regBase+nCol, regBase+j);
    }else{
      sqlite3VdbeAddOp3(v, OP_Column, iCur, idx, regBase+j);
      sqlite3ColumnDefault(v, pTab, idx, -1);
    }
  }
  if( doMakeRec ){
    const char *zAff;
    if( pTab->pSelect
     || OptimizationDisabled(pParse->db, SQLITE_IdxRealAsInt)
    ){
      zAff = 0;
    }else{
      zAff = sqlite3IndexAffinityStr(v, pIdx);
    }
    sqlite3VdbeAddOp3(v, OP_MakeRecord, regBase, nCol+1, regOut);
    sqlite3VdbeChangeP4(v, -1, zAff, P4_TRANSIENT);
  }
  sqlite3ReleaseTempRange(pParse, regBase, nCol+1);
  return regBase;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %r8d, -0x40(%rbp)
movl %ecx, -0x3c(%rbp)
movl %edx, %ebx
movq %rsi, %r13
movq %rdi, %r15
movq 0x10(%rdi), %r14
movq 0x18(%rsi), %r12
testq %r9, %r9
movq %r14, -0x30(%rbp)
je 0x4779f
cmpq $0x0, 0x48(%r13)
je 0x47797
movq -0x30(%rbp), %r14
movq %r14, %rdi
movq %r9, -0x38(%rbp)
callq 0x47934
movq -0x38(%rbp), %rcx
movl %eax, (%rcx)
movl %ebx, 0x68(%r15)
movq 0x48(%r13), %rsi
movl (%rcx), %edx
pushq $0x8
popq %rcx
movq %r15, %rdi
callq 0x4797e
jmp 0x4779f
andl $0x0, (%r9)
movq -0x30(%rbp), %r14
movq %r13, -0x50(%rbp)
movzwl 0x54(%r13), %r13d
leal 0x1(%r13), %esi
movq %r15, -0x58(%rbp)
movq %r15, %rdi
movl %esi, -0x44(%rbp)
callq 0x47c2c
movl %eax, %ecx
movl %eax, %eax
movq %rax, -0x38(%rbp)
addl %r13d, %ecx
pushq $0x60
popq %rsi
movq %r14, %rdi
movl %ebx, %edx
movl %ecx, -0x48(%rbp)
callq 0x41f42
xorl %r15d, %r15d
movl %ebx, %r14d
movq %r12, -0x60(%rbp)
cmpq %r15, %r13
je 0x4784a
movq -0x50(%rbp), %rax
movq 0x8(%rax), %rax
movl (%rax,%r15,4), %ebx
movswl 0x40(%r12), %eax
movq -0x38(%rbp), %rcx
leaq (%rcx,%r15), %r8
cmpl %eax, %ebx
jne 0x47817
movq -0x30(%rbp), %rdi
pushq $0x1d
popq %rsi
movl -0x48(%rbp), %edx
movl %r8d, %ecx
callq 0x41f42
jmp 0x47845
movq %r13, %r12
movq -0x30(%rbp), %r13
movq %r13, %rdi
pushq $0x29
popq %rsi
movl %r14d, %edx
movl %ebx, %ecx
callq 0x41f4c
movq %r13, %rdi
movq %r12, %r13
movq -0x60(%rbp), %r12
movq %r12, %rsi
movl %ebx, %edx
pushq $-0x1
popq %rcx
callq 0x47c51
incq %r15
jmp 0x477e0
cmpl $0x0, -0x40(%rbp)
movq -0x58(%rbp), %r15
movl -0x44(%rbp), %r13d
je 0x478ae
cmpq $0x0, 0x18(%r12)
je 0x47868
xorl %ebx, %ebx
movq -0x30(%rbp), %r14
jmp 0x47888
movq (%r15), %rax
testb $0x10, 0x4c(%rax)
movq -0x30(%rbp), %r14
jne 0x47886
movq %r14, %rdi
movq -0x50(%rbp), %rsi
callq 0x47ce5
movq %rax, %rbx
jmp 0x47888
xorl %ebx, %ebx
pushq $0x2b
popq %rsi
movq %r14, %rdi
movq -0x38(%rbp), %rdx
movl %r13d, %ecx
movl -0x3c(%rbp), %r8d
callq 0x41f4c
pushq $-0x1
popq %rsi
movq %r14, %rdi
movq %rbx, %rdx
xorl %ecx, %ecx
callq 0x1074b
movq %r15, %rdi
movq -0x38(%rbp), %rbx
movl %ebx, %esi
movl %r13d, %edx
callq 0x47d6c
movl %ebx, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq