// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/external/sqlite-3.33.0/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 */
  Index *pPrior,       /* Previously generated index key */
  int regPrior         /* Register holding previous generated key */
){
  Vdbe *v = pParse->pVdbe;
  int j;
  int regBase;
  int nCol;

  if( piPartIdxLabel ){
    if( pIdx->pPartIdxWhere ){
      *piPartIdxLabel = sqlite3VdbeMakeLabel(pParse);
      pParse->iSelfTab = iDataCur + 1;
      sqlite3ExprIfFalseDup(pParse, pIdx->pPartIdxWhere, *piPartIdxLabel,
                            SQLITE_JUMPIFNULL);
      pParse->iSelfTab = 0;
      pPrior = 0; /* Ticket a9efb42811fa41ee 2019-11-02;
                  ** pPartIdxWhere may have corrupted regPrior registers */
    }else{
      *piPartIdxLabel = 0;
    }
  }
  nCol = (prefixOnly && pIdx->uniqNotNull) ? pIdx->nKeyCol : pIdx->nColumn;
  regBase = sqlite3GetTempRange(pParse, nCol);
  if( pPrior && (regBase!=regPrior || pPrior->pPartIdxWhere) ) pPrior = 0;
  for(j=0; j<nCol; j++){
    if( pPrior
     && pPrior->aiColumn[j]==pIdx->aiColumn[j]
     && pPrior->aiColumn[j]!=XN_EXPR
    ){
      /* This column was already computed by the previous index */
      continue;
    }
    sqlite3ExprCodeLoadIndexColumn(pParse, pIdx, iDataCur, j, regBase+j);
    /* If the column affinity is REAL but the number is an integer, then it
    ** might be stored in the table as an integer (using a compact
    ** representation) then converted to REAL by an OP_RealAffinity opcode.
    ** But we are getting ready to store this value back into an index, where
    ** it should be converted by to INTEGER again.  So omit the OP_RealAffinity
    ** opcode if it is present */
    sqlite3VdbeDeletePriorOpcode(v, OP_RealAffinity);
  }
  if( regOut ){
    sqlite3VdbeAddOp3(v, OP_MakeRecord, regBase, nCol, regOut);
    if( pIdx->pTable->pSelect ){
      const char *zAff = sqlite3IndexAffinityStr(pParse->db, pIdx);
      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, %ebp
movl %ecx, 0x20(%rsp)
movq %rdx, 0x8(%rsp)
movq %rsi, %r15
movq %rdi, %rbx
movq 0x60(%rsp), %r13
movq 0x10(%rdi), %rax
movq %rax, (%rsp)
testq %r9, %r9
je 0x2700b9
movq 0x48(%r15), %rsi
testq %rsi, %rsi
je 0x2700b5
movl 0x44(%rbx), %eax
decl %eax
movl %eax, 0x44(%rbx)
movl %eax, (%r9)
movq 0x8(%rsp), %rax
incl %eax
movl %eax, 0x40(%rbx)
movl (%r9), %edx
movq %rbx, %rdi
callq 0x270357
andl $0x0, 0x40(%rbx)
xorl %r13d, %r13d
jmp 0x2700b9
andl $0x0, (%r9)
testl %ebp, %ebp
je 0x2700c4
testb $0x8, 0x63(%r15)
jne 0x2700c8
pushq $0x60
jmp 0x2700ca
pushq $0x5e
popq %rax
movzwl (%r15,%rax), %ebp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x266492
movl %eax, %eax
testq %r13, %r13
movq %rax, 0x10(%rsp)
je 0x2700f3
cmpl 0x68(%rsp), %eax
jne 0x2700f3
cmpq $0x0, 0x48(%r13)
je 0x2700f6
xorl %r13d, %r13d
movq 0x8(%rsp), %rax
incl %eax
movl %eax, 0x24(%rsp)
movl %ebp, 0x1c(%rsp)
movl %ebp, %r12d
pushq $0x8
popq %rbp
xorl %r14d, %r14d
cmpq %r14, %r12
je 0x2701c4
movq 0x8(%r15), %rax
testq %r13, %r13
je 0x27013b
movq 0x8(%r13), %rcx
movzwl (%rcx,%r14,2), %ecx
movzwl (%rax,%r14,2), %eax
cmpw $-0x2, %cx
je 0x270140
cmpw %ax, %cx
je 0x2701b8
jmp 0x270140
movzwl (%rax,%r14,2), %eax
cmpw $-0x2, %ax
jne 0x27016c
movl 0x24(%rsp), %eax
movl %eax, 0x40(%rbx)
movq 0x50(%r15), %rax
movq (%rax,%rbp), %rsi
movq 0x10(%rsp), %rax
leal (%rax,%r14), %edx
movq %rbx, %rdi
callq 0x267657
andl $0x0, 0x40(%rbx)
jmp 0x27018a
movswl %ax, %ecx
movq 0x10(%rbx), %rdi
movq 0x18(%r15), %rsi
movq 0x10(%rsp), %rax
leal (%rax,%r14), %r8d
movq 0x8(%rsp), %rdx
callq 0x26769b
movq (%rsp), %rax
movl 0x90(%rax), %esi
testl %esi, %esi
jle 0x2701b8
movq (%rsp), %rax
movq 0x88(%rax), %rax
decl %esi
imulq $0x18, %rsi, %rcx
cmpb $0x53, (%rax,%rcx)
jne 0x2701b8
movq (%rsp), %rdi
callq 0x2697c6
incq %r14
addq $0x18, %rbp
jmp 0x27010e
movl 0x20(%rsp), %r8d
testl %r8d, %r8d
movl 0x1c(%rsp), %ebp
movq 0x10(%rsp), %r14
je 0x27020f
pushq $0x5b
popq %rsi
movq (%rsp), %rdi
movl %r14d, %edx
movl %ebp, %ecx
callq 0x24d51f
movq 0x18(%r15), %rax
cmpq $0x0, 0x18(%rax)
je 0x27020f
movq (%rbx), %rdi
movq %r15, %rsi
callq 0x27039e
pushq $-0x1
popq %rsi
movq (%rsp), %rdi
movq %rax, %rdx
xorl %ecx, %ecx
callq 0x2270ee
movq %rbx, %rdi
movl %r14d, %esi
movl %ebp, %edx
callq 0x2666df
movl %r14d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq