// File: /workspace/github_c_makefile_star2_O3/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 0x5fc5d
movl %ecx, %r14d
movq %rsi, %r12
movq %rdi, %r13
movq 0x70(%rsi), %rax
testq %rax, %rax
movq %r8, 0x10(%rsp)
je 0x5fc72
movq (%r13), %rdx
movl 0x28(%rdx), %ecx
testl %ecx, %ecx
jle 0x5fc79
movq 0x20(%rdx), %rdx
addq $0x18, %rdx
xorl %ebx, %ebx
cmpq %rax, (%rdx)
je 0x5fc7b
incq %rbx
addq $0x20, %rdx
cmpq %rbx, %rcx
jne 0x5fc48
movl %ecx, %ebx
jmp 0x5fc7b
movl $0x0, (%rbp)
movl $0x1, (%r15)
xorl %ebp, %ebp
jmp 0x5fdb0
movl $0xfff0bdc0, %ebx       # imm = 0xFFF0BDC0
jmp 0x5fc7b
xorl %ebx, %ebx
movq %r13, %rdi
callq 0x48791
movq %rax, 0x30(%rsp)
testl %r14d, %r14d
jns 0x5fc91
movl 0x54(%r13), %r14d
testq %rbp, %rbp
movq 0x10(%rsp), %rax
je 0x5fc9f
movl %r14d, (%rbp)
testb $0x20, 0x48(%r12)
jne 0x5fcc8
testq %rax, %rax
je 0x5fcb1
cmpb $0x0, (%rax)
je 0x5fcc8
movq %r13, %rdi
movl %r14d, %esi
movl %ebx, %edx
movq %r12, %rcx
movl 0xc(%rsp), %r8d
callq 0x488b9
jmp 0x5fce5
movl 0x3c(%r12), %edx
xorl %ecx, %ecx
cmpl $0x33, 0xc(%rsp)
sete %cl
movq (%r12), %r8
movq %r13, %rdi
movl %ebx, %esi
callq 0x48985
incl %r14d
testq %r15, %r15
je 0x5fcf0
movl %r14d, (%r15)
movq %r13, 0x20(%rsp)
movq 0x10(%r12), %r15
testq %r15, %r15
movq 0x10(%rsp), %rcx
je 0x5fd9f
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 0x5fd3d
testq %r12, %r12
je 0x5fd3d
movq 0x28(%rsp), %rax
movb 0x48(%rax), %al
andb $0x20, %al
je 0x5fd3d
movl %edx, (%r12)
testq %rcx, %rcx
je 0x5fd49
cmpb $0x0, 0x1(%rcx,%rbp)
je 0x5fd89
movl 0x58(%r15), %ecx
movq 0x30(%rsp), %rdi
movl 0xc(%rsp), %esi
movl %ebx, %r8d
callq 0x487d8
movq 0x20(%rsp), %rdi
movq 0x10(%rdi), %r13
movq %r15, %rsi
callq 0x48a99
movq %r13, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movq %rax, %rdx
movl $0xfffffffa, %ecx       # imm = 0xFFFFFFFA
callq 0x12044
movq 0x10(%rsp), %rcx
incq %rbp
movq 0x28(%r15), %r15
testq %r15, %r15
jne 0x5fd1a
movl 0x1c(%rsp), %r14d
addl %ebp, %r14d
jmp 0x5fda1
xorl %ebp, %ebp
movq 0x20(%rsp), %rax
cmpl 0x54(%rax), %r14d
jle 0x5fdb0
movl %r14d, 0x54(%rax)
movl %ebp, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq