// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: sqlite3OpenTableAndIndices
SQLITE_PRIVATE int sqlite3OpenTableAndIndices(
  Parse *pParse,   /* Parsing context */
  Table *pTab,     /* Table to be opened */
  int op,          /* OP_OpenRead or OP_OpenWrite */
  u8 p5,           /* P5 value for OP_Open* opcodes (except on WITHOUT ROWID) */
  int iBase,       /* Use this for the table cursor, if there is one */
  u8 *aToOpen,     /* If not NULL: boolean for each table and index */
  int *piDataCur,  /* Write the database source cursor number here */
  int *piIdxCur    /* Write the first index cursor number here */
){
  int i;
  int iDb;
  int iDataCur;
  Index *pIdx;
  Vdbe *v;

  assert( op==OP_OpenRead || op==OP_OpenWrite );
  assert( op==OP_OpenWrite || p5==0 );
  if( IsVirtual(pTab) ){
    /* This routine is a no-op for virtual tables. Leave the output
    ** variables *piDataCur and *piIdxCur uninitialized so that valgrind
    ** can detect if they are used by mistake in the caller. */
    return 0;
  }
  iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
  v = sqlite3GetVdbe(pParse);
  assert( v!=0 );
  if( iBase<0 ) iBase = pParse->nTab;
  iDataCur = iBase++;
  if( piDataCur ) *piDataCur = iDataCur;
  if( HasRowid(pTab) && (aToOpen==0 || aToOpen[0]) ){
    sqlite3OpenTable(pParse, iDataCur, iDb, pTab, op);
  }else{
    sqlite3TableLock(pParse, iDb, pTab->tnum, op==OP_OpenWrite, pTab->zName);
  }
  if( piIdxCur ) *piIdxCur = iBase;
  for(i=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){
    int iIdxCur = iBase++;
    assert( pIdx->pSchema==pTab->pSchema );
    if( IsPrimaryKeyIndex(pIdx) && !HasRowid(pTab) ){
      if( piDataCur ) *piDataCur = iIdxCur;
      p5 = 0;
    }
    if( aToOpen==0 || aToOpen[i+1] ){
      sqlite3VdbeAddOp3(v, op, iIdxCur, pIdx->tnum, iDb);
      sqlite3VdbeSetP4KeyInfo(pParse, pIdx);
      sqlite3VdbeChangeP5(v, p5);
      VdbeComment((v, "%s", pIdx->zName));
    }
  }
  if( iBase>pParse->nTab ) pParse->nTab = iBase;
  return i;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
xorl %ebp, %ebp
cmpl $0x0, 0x54(%rsi)
jne 0x27ed7f
movq %r9, %r14
movl %ecx, %r12d
movq %rsi, %rbx
movq %rdi, %r13
movl %edx, 0x4(%rsp)
movq (%rdi), %rdi
movq 0x70(%rsi), %rsi
movl %r8d, %ebp
callq 0x226e9e
movl %eax, (%rsp)
movq %r13, %rdi
callq 0x2645be
movl %ebp, %esi
movq %rax, %r15
testl %ebp, %ebp
movq %rbx, %rbp
jns 0x27ec57
movl 0x34(%r13), %esi
movq 0x50(%rsp), %rax
testq %rax, %rax
je 0x27ec63
movl %esi, (%rax)
testb $-0x80, 0x40(%rbp)
jne 0x27ec8b
testq %r14, %r14
je 0x27ec74
cmpb $0x0, (%r14)
je 0x27ec8b
movq %r13, %rdi
movl (%rsp), %edx
movq %rbp, %rcx
movl %esi, %ebx
movl 0x4(%rsp), %r8d
callq 0x2646bb
jmp 0x27eca9
movl 0x38(%rbp), %edx
xorl %ecx, %ecx
cmpl $0x61, 0x4(%rsp)
sete %cl
movl %esi, %ebx
movq (%rbp), %r8
movq %r13, %rdi
movl (%rsp), %esi
callq 0x264778
movq %r13, 0x8(%rsp)
incl %ebx
movq 0x58(%rsp), %rax
testq %rax, %rax
je 0x27ecbc
movl %ebx, (%rax)
movq %rbp, 0x10(%rsp)
leaq 0x10(%rbp), %r13
movl %ebx, %ebx
xorl %ebp, %ebp
movq (%r13), %r13
testq %r13, %r13
je 0x27ed6f
leaq (%rbx,%rbp), %rdx
movzwl 0x63(%r13), %eax
andl $0x3, %eax
cmpw $0x2, %ax
jne 0x27ed15
movq 0x50(%rsp), %rsi
testq %rsi, %rsi
sete %al
movq 0x10(%rsp), %rcx
testb $-0x80, 0x40(%rcx)
sete %cl
movzbl %r12b, %r12d
movl $0x0, %edi
cmovnel %edi, %r12d
orb %al, %cl
jne 0x27ed15
movl %edx, (%rsi)
xorl %r12d, %r12d
testq %r14, %r14
je 0x27ed22
cmpb $0x0, 0x1(%r14,%rbp)
je 0x27ed63
movl 0x58(%r13), %ecx
movq %r15, %rdi
movl 0x4(%rsp), %esi
movl (%rsp), %r8d
callq 0x24d51f
movq 0x8(%rsp), %rdi
movq %r13, %rsi
callq 0x264872
movslq 0x90(%r15), %rax
testq %rax, %rax
jle 0x27ed63
movzbl %r12b, %ecx
movq 0x88(%r15), %rdx
imulq $0x18, %rax, %rax
movw %cx, -0x16(%rdx,%rax)
addq $0x28, %r13
incq %rbp
jmp 0x27ecc9
addq %rbp, %rbx
movq 0x8(%rsp), %rax
cmpl 0x34(%rax), %ebx
jle 0x27ed7f
movl %ebx, 0x34(%rax)
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq