// File: /workspace/github_c_makefile_star2_O2/skeeto[P]flappy/sqlite3.c
// Function: sqlite3GenerateIndexKey
SQLITE_PRIVATE int sqlite3GenerateIndexKey(
  Parse *pParse,       /* Parsing context */
  Index *pIdx,         /* The index for which to generate a key */
  int iDataCur,        /* Cursor number from which to take column data */
  int regOut,          /* Put the new key into this register if not 0 */
  int prefixOnly,      /* Compute only a unique prefix of the key */
  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;
  Index *pPk;

  if( piPartIdxLabel ){
    if( pIdx->pPartIdxWhere ){
      *piPartIdxLabel = sqlite3VdbeMakeLabel(v);
      pParse->iPartIdxTab = iDataCur;
      sqlite3ExprIfFalse(pParse, pIdx->pPartIdxWhere, *piPartIdxLabel, 
                         SQLITE_JUMPIFNULL);
    }else{
      *piPartIdxLabel = 0;
    }
  }
  nCol = (prefixOnly && pIdx->uniqNotNull) ? pIdx->nKeyCol : pIdx->nColumn;
  regBase = sqlite3GetTempRange(pParse, nCol);
  pPk = HasRowid(pTab) ? 0 : sqlite3PrimaryKeyIndex(pTab);
  for(j=0; j<nCol; j++){
    i16 idx = pIdx->aiColumn[j];
    if( pPk ) idx = sqlite3ColumnOfIndex(pPk, idx);
    if( idx<0 || idx==pTab->iPKey ){
      sqlite3VdbeAddOp2(v, OP_Rowid, iDataCur, regBase+j);
    }else{
      sqlite3VdbeAddOp3(v, OP_Column, iDataCur, idx, regBase+j);
      sqlite3ColumnDefault(v, pTab, pIdx->aiColumn[j], -1);
    }
  }
  if( regOut ){
    const char *zAff;
    if( pTab->pSelect
     || OptimizationDisabled(pParse->db, SQLITE_IdxRealAsInt)
    ){
      zAff = 0;
    }else{
      zAff = sqlite3IndexAffinityStr(v, pIdx);
    }
    sqlite3VdbeAddOp3(v, OP_MakeRecord, regBase, nCol, regOut);
    sqlite3VdbeChangeP4(v, -1, zAff, P4_TRANSIENT);
  }
  sqlite3ReleaseTempRange(pParse, regBase, nCol);
  return regBase;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %r8d, %r12d
movl %ecx, %ebp
movl %edx, 0xc(%rsp)
movq %rsi, %r15
movq %rdi, %rbx
movq 0x10(%rdi), %r14
movq 0x18(%rsi), %rax
movq %rax, 0x10(%rsp)
testq %r9, %r9
je 0x4c3b2
movq %r9, %r13
cmpq $0x0, 0x48(%r15)
je 0x4c3ad
movq %r14, %rdi
callq 0x4595f
movl %eax, (%r13)
movl 0xc(%rsp), %eax
movl %eax, 0x68(%rbx)
movq 0x48(%r15), %rsi
movl (%r13), %edx
pushq $0x8
popq %rcx
movq %rbx, %rdi
callq 0x4636b
jmp 0x4c3b2
andl $0x0, (%r13)
testl %r12d, %r12d
je 0x4c3be
testb $0x8, 0x63(%r15)
jne 0x4c3c2
pushq $0x60
jmp 0x4c3c4
pushq $0x5e
popq %rax
movq 0x10(%rsp), %r12
movzwl (%r15,%rax), %esi
movq %rbx, %rdi
movl %esi, 0x8(%rsp)
callq 0x45b5d
movl %eax, %r13d
testb $0x20, 0x48(%r12)
movq %rbx, 0x20(%rsp)
movl %ebp, 0x1c(%rsp)
jne 0x4c3f4
xorl %r12d, %r12d
jmp 0x4c3ff
movq %r12, %rdi
callq 0x30033
movq %rax, %r12
movl 0x8(%rsp), %ebp
xorl %ebx, %ebx
cmpq %rbx, %rbp
je 0x4c47a
movq 0x8(%r15), %rax
movzwl (%rax,%rbx,2), %eax
testq %r12, %r12
je 0x4c422
movswl %ax, %esi
movq %r12, %rdi
callq 0x467ab
testw %ax, %ax
js 0x4c432
movq 0x10(%rsp), %rcx
cmpw 0x40(%rcx), %ax
jne 0x4c447
leal (%rbx,%r13), %ecx
movq %r14, %rdi
pushq $0x62
popq %rsi
movl 0xc(%rsp), %edx
callq 0x43f64
jmp 0x4c475
movswl %ax, %ecx
leal (%rbx,%r13), %r8d
movq %r14, %rdi
pushq $0x2b
popq %rsi
movl 0xc(%rsp), %edx
callq 0x43f69
movq 0x8(%r15), %rax
movswl (%rax,%rbx,2), %edx
movq %r14, %rdi
movq 0x10(%rsp), %rsi
pushq $-0x1
popq %rcx
callq 0x467ca
incq %rbx
jmp 0x4c405
movl 0x1c(%rsp), %ebp
testl %ebp, %ebp
movq 0x20(%rsp), %r12
je 0x4c4d4
movq 0x10(%rsp), %rax
cmpq $0x0, 0x18(%rax)
jne 0x4c4ad
movq (%r12), %rax
testb $0x10, 0x4c(%rax)
jne 0x4c4ad
movq %r14, %rdi
movq %r15, %rsi
callq 0x4c5f6
movq %rax, %rbx
jmp 0x4c4af
xorl %ebx, %ebx
pushq $0x2d
popq %rsi
movq %r14, %rdi
movl %r13d, %edx
movl 0x8(%rsp), %ecx
movl %ebp, %r8d
callq 0x43f69
pushq $-0x1
popq %rsi
movq %r14, %rdi
movq %rbx, %rdx
xorl %ecx, %ecx
callq 0x10de3
movq %r12, %rdi
movl %r13d, %esi
movl 0x8(%rsp), %edx
callq 0x45c24
movl %r13d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq