// File: /workspace/github_c_makefile_star2_O3/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 0x52757
movq %r9, %rbx
cmpq $0x0, 0x48(%r15)
je 0x52751
movq %r14, %rdi
callq 0x4a501
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 0x4b278
jmp 0x52757
movl $0x0, (%rbx)
testl %r13d, %r13d
je 0x52768
movl $0x5e, %eax
testb $0x8, 0x63(%r15)
jne 0x5276d
movl $0x60, %eax
movzwl (%r15,%rax), %edx
movl 0x48(%r12), %eax
subl %edx, %eax
movq 0x10(%rsp), %rsi
jge 0x52792
movl 0x58(%r12), %eax
leal 0x1(%rax), %r13d
addl %edx, %eax
movl %eax, 0x58(%r12)
jmp 0x527a5
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 0x528fb
xorl %ebx, %ebx
cmpl $0x0, 0x8(%rsp)
je 0x52867
movl 0x8(%rsp), %ebp
xorl %r12d, %r12d
movq 0x8(%r15), %rax
movzwl (%rax,%r12,2), %eax
testq %rbx, %rbx
je 0x52800
movzwl 0x60(%rbx), %ecx
testq %rcx, %rcx
je 0x52810
movq 0x8(%rbx), %rsi
xorl %edx, %edx
cmpw %ax, (%rsi,%rdx,2)
je 0x527fe
incq %rdx
cmpq %rdx, %rcx
jne 0x527ee
jmp 0x52810
movl %edx, %eax
testw %ax, %ax
js 0x52810
movq 0x10(%rsp), %rcx
cmpw 0x40(%rcx), %ax
jne 0x52832
leal (%r12,%r13), %ecx
movq %r14, %rdi
movl $0x62, %esi
movl 0x4(%rsp), %edx
xorl %r8d, %r8d
callq 0x487d8
incq %r12
cmpq %rbp, %r12
jne 0x527d1
jmp 0x52867
movswl %ax, %ecx
leal (%r12,%r13), %r8d
movq %r14, %rdi
movl $0x2b, %esi
movl 0x4(%rsp), %edx
callq 0x487d8
movq 0x8(%r15), %rax
movswl (%rax,%r12,2), %edx
movq %r14, %rdi
movq 0x10(%rsp), %rsi
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
callq 0x4b73d
jmp 0x52828
movl 0x1c(%rsp), %ebp
testl %ebp, %ebp
movq 0x20(%rsp), %r12
je 0x528c6
movq 0x10(%rsp), %rax
cmpq $0x0, 0x18(%rax)
jne 0x5289a
movq (%r12), %rax
testb $0x10, 0x4c(%rax)
jne 0x5289a
movq %r14, %rdi
movq %r15, %rsi
callq 0x52a33
movq %rax, %rbx
jmp 0x5289c
xorl %ebx, %ebx
movq %r14, %rdi
movl $0x2d, %esi
movl %r13d, %edx
movq 0x8(%rsp), %rcx
movl %ebp, %r8d
callq 0x487d8
movq %r14, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movq %rbx, %rdx
xorl %ecx, %ecx
callq 0x12044
movq %r12, %rdi
movl %r13d, %esi
movq 0x8(%rsp), %rbx
movl %ebx, %edx
callq 0x4a54e
cmpl %ebx, 0x48(%r12)
jge 0x528e9
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 0x527bd
movb 0x63(%rbx), %al
andb $0x3, %al
cmpb $0x2, %al
je 0x527bf
movq 0x28(%rbx), %rbx
jmp 0x528ff