// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x60, %rsp
movb %cl, %al
movq 0x18(%rbp), %rcx
movq 0x10(%rbp), %rcx
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movb %al, -0x1d(%rbp)
movl %r8d, -0x24(%rbp)
movq %r9, -0x30(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, 0x54(%rax)
je 0x45a70e
movl $0x0, -0x4(%rbp)
jmp 0x45a8c7
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rax
movq 0x70(%rax), %rsi
callq 0x3cb770
movl %eax, -0x38(%rbp)
movq -0x10(%rbp), %rdi
callq 0x4299d0
movq %rax, -0x50(%rbp)
cmpl $0x0, -0x24(%rbp)
jge 0x45a742
movq -0x10(%rbp), %rax
movl 0x34(%rax), %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x24(%rbp)
movl %eax, -0x3c(%rbp)
cmpq $0x0, 0x10(%rbp)
je 0x45a760
movl -0x3c(%rbp), %ecx
movq 0x10(%rbp), %rax
movl %ecx, (%rax)
movq -0x18(%rbp), %rax
movl 0x40(%rax), %eax
andl $0x80, %eax
cmpl $0x0, %eax
jne 0x45a79d
cmpq $0x0, -0x30(%rbp)
je 0x45a784
movq -0x30(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x0, %eax
je 0x45a79d
movq -0x10(%rbp), %rdi
movl -0x3c(%rbp), %esi
movl -0x38(%rbp), %edx
movq -0x18(%rbp), %rcx
movl -0x1c(%rbp), %r8d
callq 0x429e70
jmp 0x45a7c6
movq -0x10(%rbp), %rdi
movl -0x38(%rbp), %esi
movq -0x18(%rbp), %rax
movl 0x38(%rax), %edx
cmpl $0x61, -0x1c(%rbp)
sete %al
andb $0x1, %al
movzbl %al, %eax
movq -0x18(%rbp), %rcx
movq (%rcx), %r8
movzbl %al, %ecx
callq 0x429f80
cmpq $0x0, 0x18(%rbp)
je 0x45a7d6
movl -0x24(%rbp), %ecx
movq 0x18(%rbp), %rax
movl %ecx, (%rax)
movl $0x0, -0x34(%rbp)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
je 0x45a8ab
movl -0x24(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x24(%rbp)
movl %eax, -0x54(%rbp)
movq -0x48(%rbp), %rax
movw 0x63(%rax), %ax
andw $0x3, %ax
movzwl %ax, %eax
cmpl $0x2, %eax
jne 0x45a83b
movq -0x18(%rbp), %rax
movl 0x40(%rax), %eax
andl $0x80, %eax
cmpl $0x0, %eax
je 0x45a83b
cmpq $0x0, 0x10(%rbp)
je 0x45a837
movl -0x54(%rbp), %ecx
movq 0x10(%rbp), %rax
movl %ecx, (%rax)
movb $0x0, -0x1d(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x45a858
movq -0x30(%rbp), %rax
movl -0x34(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x0, %eax
je 0x45a88f
movq -0x50(%rbp), %rdi
movl -0x1c(%rbp), %esi
movl -0x54(%rbp), %edx
movq -0x48(%rbp), %rax
movl 0x58(%rax), %ecx
movl -0x38(%rbp), %r8d
callq 0x410130
movq -0x10(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x42a150
movq -0x50(%rbp), %rdi
movzbl -0x1d(%rbp), %eax
movzwl %ax, %esi
callq 0x3cb9f0
jmp 0x45a891
movq -0x48(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x48(%rbp)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x45a7e9
movl -0x24(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x34(%rcx), %eax
jle 0x45a8c1
movl -0x24(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x34(%rax)
movl -0x34(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq