// File: /workspace/github_c_makefile_star2_O1/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, %r13d
movl %ecx, %ebp
movl %edx, 0x4(%rsp)
movq %rsi, %r15
movq %rdi, %r12
movq 0x10(%rdi), %r14
movq 0x18(%rsi), %rax
movq %rax, 0x10(%rsp)
testq %r9, %r9
je 0x5218f
movq %r9, %rbx
cmpq $0x0, 0x48(%r15)
je 0x52189
movq %r14, %rdi
callq 0x49cbd
movl %eax, (%rbx)
movl 0x4(%rsp), %eax
movl %eax, 0x68(%r12)
movq 0x48(%r15), %rsi
movl (%rbx), %edx
movq %r12, %rdi
movl $0x8, %ecx
callq 0x4aa7d
jmp 0x5218f
movl $0x0, (%rbx)
testl %r13d, %r13d
je 0x521a0
movl $0x5e, %eax
testb $0x8, 0x63(%r15)
jne 0x521a5
movl $0x60, %eax
movzwl (%r15,%rax), %edx
movl 0x48(%r12), %eax
subl %edx, %eax
movq 0x10(%rsp), %rsi
jge 0x521ca
movl 0x58(%r12), %eax
leal 0x1(%rax), %r13d
addl %edx, %eax
movl %eax, 0x58(%r12)
jmp 0x521dd
movl 0x4c(%r12), %r13d
leal (%rdx,%r13), %ecx
movl %ecx, 0x4c(%r12)
movl %eax, 0x48(%r12)
movq %rdx, 0x8(%rsp)
testb $0x20, 0x48(%rsi)
movq %r12, 0x20(%rsp)
movl %ebp, 0x1c(%rsp)
jne 0x52339
xorl %ebx, %ebx
cmpl $0x0, 0x8(%rsp)
je 0x522a5
movl 0x8(%rsp), %r12d
xorl %ebp, %ebp
movq 0x8(%r15), %rax
movzwl (%rax,%rbp,2), %eax
testq %rbx, %rbx
je 0x5223b
movzwl 0x60(%rbx), %ecx
testq %rcx, %rcx
je 0x52233
movq 0x8(%rbx), %rsi
xorl %edx, %edx
cmpw %ax, (%rsi,%rdx,2)
je 0x52239
incq %rdx
cmpq %rdx, %rcx
jne 0x52225
movw $0xffff, %ax            # imm = 0xFFFF
jmp 0x5223b
movl %edx, %eax
testw %ax, %ax
js 0x5224b
movq 0x10(%rsp), %rcx
cmpw 0x40(%rcx), %ax
jne 0x52266
leal (%r13,%rbp), %ecx
movq %r14, %rdi
movl $0x62, %esi
movl 0x4(%rsp), %edx
xorl %r8d, %r8d
callq 0x47fb1
jmp 0x52299
movswl %ax, %ecx
leal (%r13,%rbp), %r8d
movq %r14, %rdi
movl $0x2b, %esi
movl 0x4(%rsp), %edx
callq 0x47fb1
movq 0x8(%r15), %rax
movswl (%rax,%rbp,2), %edx
movq %r14, %rdi
movq 0x10(%rsp), %rsi
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
callq 0x4af4f
incq %rbp
cmpq %r12, %rbp
jne 0x52209
movl 0x1c(%rsp), %ebp
testl %ebp, %ebp
movq 0x20(%rsp), %r12
je 0x52304
movq 0x10(%rsp), %rax
cmpq $0x0, 0x18(%rax)
jne 0x522d8
movq (%r12), %rax
testb $0x10, 0x4c(%rax)
jne 0x522d8
movq %r14, %rdi
movq %r15, %rsi
callq 0x5246d
movq %rax, %rbx
jmp 0x522da
xorl %ebx, %ebx
movq %r14, %rdi
movl $0x2d, %esi
movl %r13d, %edx
movq 0x8(%rsp), %rcx
movl %ebp, %r8d
callq 0x47fb1
movq %r14, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movq %rbx, %rdx
xorl %ecx, %ecx
callq 0x11ea3
movq %r12, %rdi
movl %r13d, %esi
movq 0x8(%rsp), %rbx
movl %ebx, %edx
callq 0x49d08
cmpl %ebx, 0x48(%r12)
jge 0x52327
movl %ebx, 0x48(%r12)
movl %r13d, 0x4c(%r12)
movl %r13d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x10(%rsi), %rbx
testq %rbx, %rbx
je 0x521f7
movb 0x63(%rbx), %al
andb $0x3, %al
cmpb $0x2, %al
je 0x521f7
movq 0x28(%rbx), %rbx
jmp 0x5233d