// File: /workspace/github_c_makefile_star2_O0/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
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movl %r8d, -0x1c(%rbp)
movq %r9, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x6769d
movq -0x10(%rbp), %rax
cmpq $0x0, 0x48(%rax)
je 0x67691
movq -0x30(%rbp), %rdi
callq 0x67890
movl %eax, %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
movl -0x14(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x68(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rsi
movq -0x28(%rbp), %rax
movl (%rax), %edx
movl $0x8, %ecx
callq 0x67920
jmp 0x6769b
movq -0x28(%rbp), %rax
movl $0x0, (%rax)
jmp 0x6769d
movq -0x10(%rbp), %rax
movzwl 0x54(%rax), %eax
movl %eax, -0x48(%rbp)
movq -0x8(%rbp), %rdi
movl -0x48(%rbp), %esi
addl $0x1, %esi
callq 0x67c30
movl %eax, -0x44(%rbp)
movq -0x30(%rbp), %rdi
movl -0x14(%rbp), %edx
movl -0x44(%rbp), %ecx
addl -0x48(%rbp), %ecx
movl $0x60, %esi
callq 0x5e0c0
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x48(%rbp), %eax
jge 0x6775e
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x34(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
movq -0x40(%rbp), %rcx
movswl 0x40(%rcx), %ecx
cmpl %ecx, %eax
jne 0x6771d
movq -0x30(%rbp), %rdi
movl -0x44(%rbp), %edx
addl -0x48(%rbp), %edx
movl -0x44(%rbp), %ecx
addl -0x34(%rbp), %ecx
movl $0x1d, %esi
callq 0x5e0c0
jmp 0x6774e
movq -0x30(%rbp), %rdi
movl -0x14(%rbp), %edx
movl -0x4c(%rbp), %ecx
movl -0x44(%rbp), %r8d
addl -0x34(%rbp), %r8d
movl $0x29, %esi
callq 0x5e0f0
movq -0x30(%rbp), %rdi
movq -0x40(%rbp), %rsi
movl -0x4c(%rbp), %edx
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
callq 0x67ca0
jmp 0x67750
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x676d8
cmpl $0x0, -0x1c(%rbp)
je 0x677cc
movq -0x40(%rbp), %rax
cmpq $0x0, 0x18(%rax)
jne 0x67782
movq -0x8(%rbp), %rax
movq (%rax), %rax
movzwl 0x4c(%rax), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0x6778c
movq $0x0, -0x58(%rbp)
jmp 0x6779d
movq -0x30(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x67d80
movq %rax, -0x58(%rbp)
movq -0x30(%rbp), %rdi
movl -0x44(%rbp), %edx
movl -0x48(%rbp), %ecx
addl $0x1, %ecx
movl -0x18(%rbp), %r8d
movl $0x2b, %esi
callq 0x5e0f0
movq -0x30(%rbp), %rdi
movq -0x58(%rbp), %rdx
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %ecx, %ecx
callq 0x13c20
movq -0x8(%rbp), %rdi
movl -0x44(%rbp), %esi
movl -0x48(%rbp), %edx
addl $0x1, %edx
callq 0x67e90
movl -0x44(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw (%rax,%rax)