// File: /workspace/github_c_makefile_star2_O2/skeeto[P]flappy/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 */
  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 );
  if( IsVirtual(pTab) ){
    assert( aToOpen==0 );
    *piDataCur = 0;
    *piIdxCur = 1;
    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( pIdx->autoIndex==2 && !HasRowid(pTab) && piDataCur ){
      *piDataCur = iIdxCur;
    }
    if( aToOpen==0 || aToOpen[i+1] ){
      sqlite3VdbeAddOp3(v, op, iIdxCur, pIdx->tnum, iDb);
      sqlite3VdbeSetP4KeyInfo(pParse, pIdx);
      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
movq %r9, %r12
movl %edx, 0x4(%rsp)
movq 0x50(%rsp), %r14
testb $0x10, 0x48(%rsi)
jne 0x55783
movq %r8, %r15
movl %ecx, %ebp
movq %rsi, %r13
movq %rdi, %rbx
movq (%rdi), %rdi
movq 0x70(%rsi), %rsi
callq 0x10cd8
movl %eax, (%rsp)
movq %rbx, %rdi
callq 0x43f1b
movq %rax, 0x10(%rsp)
testl %ebp, %ebp
jns 0x5574c
movl 0x54(%rbx), %ebp
testq %r12, %r12
je 0x55755
movl %ebp, (%r12)
testb $0x20, 0x48(%r13)
movq %r13, 0x8(%rsp)
jne 0x55796
testq %r15, %r15
je 0x5576c
cmpb $0x0, (%r15)
je 0x55796
movq %rbx, %rdi
movl %ebp, %esi
movl (%rsp), %edx
movq %r13, %rcx
movl 0x4(%rsp), %r8d
callq 0x44068
jmp 0x557b3
andl $0x0, (%r12)
movl $0x1, (%r14)
xorl %ebp, %ebp
jmp 0x5583d
movl 0x3c(%r13), %edx
xorl %ecx, %ecx
cmpl $0x33, 0x4(%rsp)
sete %cl
movq (%r13), %r8
movq %rbx, %rdi
movl (%rsp), %esi
callq 0x4410c
movq %r12, %r13
incl %ebp
testq %r14, %r14
je 0x557c0
movl %ebp, (%r14)
movq 0x8(%rsp), %rax
leaq 0x10(%rax), %r14
movl %ebp, %r12d
xorl %ebp, %ebp
movq (%r14), %r14
testq %r14, %r14
je 0x55830
leaq (%r12,%rbp), %rdx
movb 0x63(%r14), %al
andb $0x3, %al
cmpb $0x2, %al
jne 0x557f9
testq %r13, %r13
je 0x557f9
movq 0x8(%rsp), %rax
movb 0x48(%rax), %al
andb $0x20, %al
je 0x557f9
movl %edx, (%r13)
testq %r15, %r15
je 0x55806
cmpb $0x0, 0x1(%r15,%rbp)
je 0x55827
movl 0x58(%r14), %ecx
movq 0x10(%rsp), %rdi
movl 0x4(%rsp), %esi
movl (%rsp), %r8d
callq 0x43f69
movq %rbx, %rdi
movq %r14, %rsi
callq 0x441fe
addq $0x28, %r14
incq %rbp
jmp 0x557ce
addq %rbp, %r12
cmpl 0x54(%rbx), %r12d
jle 0x5583d
movl %r12d, 0x54(%rbx)
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq