// File: /workspace/github_c_makefile_star2_O1/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 $0x38, %rsp
movq %r9, %rbp
movl %edx, 0xc(%rsp)
movq 0x70(%rsp), %r15
testb $0x10, 0x48(%rsi)
jne 0x5f4b6
movl %ecx, %r14d
movq %rsi, %r12
movq %rdi, %r13
movq 0x70(%rsi), %rax
testq %rax, %rax
movq %r8, 0x10(%rsp)
je 0x5f4cb
movq (%r13), %rdx
movl 0x28(%rdx), %ecx
testl %ecx, %ecx
jle 0x5f4d2
movq 0x20(%rdx), %rdx
addq $0x18, %rdx
xorl %ebx, %ebx
cmpq %rax, (%rdx)
je 0x5f4d4
incq %rbx
addq $0x20, %rdx
cmpq %rbx, %rcx
jne 0x5f4a1
movl %ecx, %ebx
jmp 0x5f4d4
movl $0x0, (%rbp)
movl $0x1, (%r15)
xorl %ebp, %ebp
jmp 0x5f609
movl $0xfff0bdc0, %ebx       # imm = 0xFFF0BDC0
jmp 0x5f4d4
xorl %ebx, %ebx
movq %r13, %rdi
callq 0x47f6a
movq %rax, 0x30(%rsp)
testl %r14d, %r14d
jns 0x5f4ea
movl 0x54(%r13), %r14d
testq %rbp, %rbp
movq 0x10(%rsp), %rax
je 0x5f4f8
movl %r14d, (%rbp)
testb $0x20, 0x48(%r12)
jne 0x5f521
testq %rax, %rax
je 0x5f50a
cmpb $0x0, (%rax)
je 0x5f521
movq %r13, %rdi
movl %r14d, %esi
movl %ebx, %edx
movq %r12, %rcx
movl 0xc(%rsp), %r8d
callq 0x48081
jmp 0x5f53e
movl 0x3c(%r12), %edx
xorl %ecx, %ecx
cmpl $0x33, 0xc(%rsp)
sete %cl
movq (%r12), %r8
movq %r13, %rdi
movl %ebx, %esi
callq 0x4814a
incl %r14d
testq %r15, %r15
je 0x5f549
movl %r14d, (%r15)
movq %r13, 0x20(%rsp)
movq 0x10(%r12), %r15
testq %r15, %r15
movq 0x10(%rsp), %rcx
je 0x5f5f8
movq %r12, 0x28(%rsp)
movq %rbp, %r12
movl %r14d, 0x1c(%rsp)
movl %r14d, %r14d
xorl %ebp, %ebp
leaq (%r14,%rbp), %rdx
movb 0x63(%r15), %al
andb $0x3, %al
cmpb $0x2, %al
jne 0x5f596
testq %r12, %r12
je 0x5f596
movq 0x28(%rsp), %rax
movb 0x48(%rax), %al
andb $0x20, %al
je 0x5f596
movl %edx, (%r12)
testq %rcx, %rcx
je 0x5f5a2
cmpb $0x0, 0x1(%rcx,%rbp)
je 0x5f5e2
movl 0x58(%r15), %ecx
movq 0x30(%rsp), %rdi
movl 0xc(%rsp), %esi
movl %ebx, %r8d
callq 0x47fb1
movq 0x20(%rsp), %rdi
movq 0x10(%rdi), %r13
movq %r15, %rsi
callq 0x48266
movq %r13, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movq %rax, %rdx
movl $0xfffffffa, %ecx       # imm = 0xFFFFFFFA
callq 0x11ea3
movq 0x10(%rsp), %rcx
incq %rbp
movq 0x28(%r15), %r15
testq %r15, %r15
jne 0x5f573
movl 0x1c(%rsp), %r14d
addl %ebp, %r14d
jmp 0x5f5fa
xorl %ebp, %ebp
movq 0x20(%rsp), %rax
cmpl 0x54(%rax), %r14d
jle 0x5f609
movl %r14d, 0x54(%rax)
movl %ebp, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq