// File: /workspace/github_c_makefile_star2_O0/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: explainOneScan
static void explainOneScan(
  Parse *pParse,                  /* Parse context */
  SrcList *pTabList,              /* Table list this loop refers to */
  WhereLevel *pLevel,             /* Scan to write OP_Explain opcode for */
  int iLevel,                     /* Value for "level" column of output */
  int iFrom,                      /* Value for "from" column of output */
  u16 wctrlFlags                  /* Flags passed to sqlite3WhereBegin() */
){
  if( pParse->explain==2 ){
    struct SrcList_item *pItem = &pTabList->a[pLevel->iFrom];
    Vdbe *v = pParse->pVdbe;      /* VM being constructed */
    sqlite3 *db = pParse->db;     /* Database handle */
    char *zMsg;                   /* Text to add to EQP output */
    int iId = pParse->iSelectId;  /* Select id (left-most output column) */
    int isSearch;                 /* True for a SEARCH. False for SCAN. */
    WhereLoop *pLoop;             /* The controlling WhereLoop object */
    u32 flags;                    /* Flags that describe this loop */

    pLoop = pLevel->pWLoop;
    flags = pLoop->wsFlags;
    if( (flags&WHERE_MULTI_OR) || (wctrlFlags&WHERE_ONETABLE_ONLY) ) return;

    isSearch = (flags&(WHERE_BTM_LIMIT|WHERE_TOP_LIMIT))!=0
            || ((flags&WHERE_VIRTUALTABLE)==0 && (pLoop->u.btree.nEq>0))
            || (wctrlFlags&(WHERE_ORDERBY_MIN|WHERE_ORDERBY_MAX));

    zMsg = sqlite3MPrintf(db, "%s", isSearch?"SEARCH":"SCAN");
    if( pItem->pSelect ){
      zMsg = sqlite3MAppendf(db, zMsg, "%s SUBQUERY %d", zMsg,pItem->iSelectId);
    }else{
      zMsg = sqlite3MAppendf(db, zMsg, "%s TABLE %s", zMsg, pItem->zName);
    }

    if( pItem->zAlias ){
      zMsg = sqlite3MAppendf(db, zMsg, "%s AS %s", zMsg, pItem->zAlias);
    }
    if( (flags & (WHERE_IPK|WHERE_VIRTUALTABLE))==0
     && ALWAYS(pLoop->u.btree.pIndex!=0)
    ){
      char *zWhere = explainIndexRange(db, pLoop, pItem->pTab);
      zMsg = sqlite3MAppendf(db, zMsg,
               ((flags & WHERE_AUTO_INDEX) ? 
                   "%s USING AUTOMATIC %sINDEX%.0s%s" :
                   "%s USING %sINDEX %s%s"), 
               zMsg, ((flags & WHERE_IDX_ONLY) ? "COVERING " : ""),
               pLoop->u.btree.pIndex->zName, zWhere);
      sqlite3DbFree(db, zWhere);
    }else if( (flags & WHERE_IPK)!=0 && (flags & WHERE_CONSTRAINT)!=0 ){
      zMsg = sqlite3MAppendf(db, zMsg, "%s USING INTEGER PRIMARY KEY", zMsg);

      if( flags&(WHERE_COLUMN_EQ|WHERE_COLUMN_IN) ){
        zMsg = sqlite3MAppendf(db, zMsg, "%s (rowid=?)", zMsg);
      }else if( (flags&WHERE_BOTH_LIMIT)==WHERE_BOTH_LIMIT ){
        zMsg = sqlite3MAppendf(db, zMsg, "%s (rowid>? AND rowid<?)", zMsg);
      }else if( flags&WHERE_BTM_LIMIT ){
        zMsg = sqlite3MAppendf(db, zMsg, "%s (rowid>?)", zMsg);
      }else if( ALWAYS(flags&WHERE_TOP_LIMIT) ){
        zMsg = sqlite3MAppendf(db, zMsg, "%s (rowid<?)", zMsg);
      }
    }
#ifndef SQLITE_OMIT_VIRTUALTABLE
    else if( (flags & WHERE_VIRTUALTABLE)!=0 ){
      zMsg = sqlite3MAppendf(db, zMsg, "%s VIRTUAL TABLE INDEX %d:%s", zMsg,
                  pLoop->u.vtab.idxNum, pLoop->u.vtab.idxStr);
    }
#endif
    zMsg = sqlite3MAppendf(db, zMsg, "%s", zMsg);
    sqlite3VdbeAddOp4(v, OP_Explain, iId, iLevel, iFrom, zMsg, P4_DYNAMIC);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movw %r9w, %ax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movl %r8d, -0x20(%rbp)
movw %ax, -0x22(%rbp)
movq -0x8(%rbp), %rax
movzbl 0x200(%rax), %eax
cmpl $0x2, %eax
jne 0x73791
movq -0x10(%rbp), %rax
addq $0x8, %rax
movq -0x18(%rbp), %rcx
movzbl 0x20(%rcx), %ecx
imulq $0x68, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rax
movl 0x210(%rax), %eax
movl %eax, -0x4c(%rbp)
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movl 0x28(%rax), %eax
movl %eax, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
jne 0x73468
movzwl -0x22(%rbp), %eax
andl $0x40, %eax
cmpl $0x0, %eax
je 0x7346d
jmp 0x73791
movl -0x5c(%rbp), %ecx
andl $0x30, %ecx
movb $0x1, %al
cmpl $0x0, %ecx
movb %al, -0x69(%rbp)
jne 0x734a9
movl -0x5c(%rbp), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
jne 0x73499
movq -0x58(%rbp), %rcx
movb $0x1, %al
cmpl $0x0, 0x18(%rcx)
movb %al, -0x69(%rbp)
jg 0x734a9
movzwl -0x22(%rbp), %eax
andl $0x3, %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x69(%rbp)
movb -0x69(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x50(%rbp)
movq -0x40(%rbp), %rdi
movl -0x50(%rbp), %ecx
leaq 0x3d17f(%rip), %rdx     # 0xb0641
leaq 0x3d171(%rip), %rax     # 0xb063a
cmpl $0x0, %ecx
cmovneq %rax, %rdx
leaq 0x3acf9(%rip), %rsi     # 0xae1d0
movb $0x0, %al
callq 0x137f0
movq %rax, -0x48(%rbp)
movq -0x30(%rbp), %rax
cmpq $0x0, 0x28(%rax)
je 0x73516
movq -0x40(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq -0x48(%rbp), %rcx
movq -0x30(%rbp), %rax
movzbl 0x3a(%rax), %r8d
leaq 0x3cc85(%rip), %rdx     # 0xb018e
movb $0x0, %al
callq 0x46800
movq %rax, -0x48(%rbp)
jmp 0x7353c
movq -0x40(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq -0x48(%rbp), %rcx
movq -0x30(%rbp), %rax
movq 0x10(%rax), %r8
leaq 0x3d115(%rip), %rdx     # 0xb0646
movb $0x0, %al
callq 0x46800
movq %rax, -0x48(%rbp)
movq -0x30(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x7356d
movq -0x40(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq -0x48(%rbp), %rcx
movq -0x30(%rbp), %rax
movq 0x18(%rax), %r8
leaq 0x3d0f0(%rip), %rdx     # 0xb0652
movb $0x0, %al
callq 0x46800
movq %rax, -0x48(%rbp)
movl -0x5c(%rbp), %eax
andl $0x500, %eax            # imm = 0x500
cmpl $0x0, %eax
jne 0x7361e
movq -0x58(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0x7361e
movq -0x40(%rbp), %rdi
movq -0x58(%rbp), %rsi
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rdx
callq 0x7ade0
movq %rax, -0x68(%rbp)
movq -0x40(%rbp), %rdi
movq -0x48(%rbp), %rsi
movl -0x5c(%rbp), %ecx
andl $0x4000, %ecx           # imm = 0x4000
leaq 0x3d0be(%rip), %rdx     # 0xb067c
leaq 0x3d096(%rip), %rax     # 0xb065b
cmpl $0x0, %ecx
cmovneq %rax, %rdx
movq -0x48(%rbp), %rcx
movl -0x5c(%rbp), %r9d
andl $0x40, %r9d
leaq 0x3f816(%rip), %r8      # 0xb2df5
leaq 0x3d0ac(%rip), %rax     # 0xb0692
cmpl $0x0, %r9d
cmovneq %rax, %r8
movq -0x58(%rbp), %rax
movq 0x20(%rax), %rax
movq (%rax), %r9
movq -0x68(%rbp), %rax
movq %rax, (%rsp)
movb $0x0, %al
callq 0x46800
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rdi
movq -0x68(%rbp), %rsi
callq 0x9cd0
jmp 0x73750
movl -0x5c(%rbp), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
je 0x73711
movl -0x5c(%rbp), %eax
andl $0xf, %eax
cmpl $0x0, %eax
je 0x73711
movq -0x40(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq -0x48(%rbp), %rcx
leaq 0x3d04b(%rip), %rdx     # 0xb069c
movb $0x0, %al
callq 0x46800
movq %rax, -0x48(%rbp)
movl -0x5c(%rbp), %eax
andl $0x5, %eax
cmpl $0x0, %eax
je 0x7368a
movq -0x40(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq -0x48(%rbp), %rcx
leaq 0x3d03f(%rip), %rdx     # 0xb06b9
movb $0x0, %al
callq 0x46800
movq %rax, -0x48(%rbp)
jmp 0x7370f
movl -0x5c(%rbp), %eax
andl $0x30, %eax
cmpl $0x30, %eax
jne 0x736b5
movq -0x40(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq -0x48(%rbp), %rcx
leaq 0x3d01e(%rip), %rdx     # 0xb06c6
movb $0x0, %al
callq 0x46800
movq %rax, -0x48(%rbp)
jmp 0x7370d
movl -0x5c(%rbp), %eax
andl $0x20, %eax
cmpl $0x0, %eax
je 0x736e0
movq -0x40(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq -0x48(%rbp), %rcx
leaq 0x3d00c(%rip), %rdx     # 0xb06df
movb $0x0, %al
callq 0x46800
movq %rax, -0x48(%rbp)
jmp 0x7370b
movl -0x5c(%rbp), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0x73709
movq -0x40(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq -0x48(%rbp), %rcx
leaq 0x3cfee(%rip), %rdx     # 0xb06ec
movb $0x0, %al
callq 0x46800
movq %rax, -0x48(%rbp)
jmp 0x7370b
jmp 0x7370d
jmp 0x7370f
jmp 0x7374e
movl -0x5c(%rbp), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
je 0x7374c
movq -0x40(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq -0x48(%rbp), %rcx
movq -0x58(%rbp), %rax
movl 0x18(%rax), %r8d
movq -0x58(%rbp), %rax
movq 0x20(%rax), %r9
leaq 0x3cfb8(%rip), %rdx     # 0xb06f9
movb $0x0, %al
callq 0x46800
movq %rax, -0x48(%rbp)
jmp 0x7374e
jmp 0x73750
movq -0x40(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq -0x48(%rbp), %rcx
leaq 0x3aa6d(%rip), %rdx     # 0xae1d0
movb $0x0, %al
callq 0x46800
movq %rax, -0x48(%rbp)
movq -0x38(%rbp), %rdi
movl -0x4c(%rbp), %edx
movl -0x1c(%rbp), %ecx
movl -0x20(%rbp), %r8d
movq -0x48(%rbp), %r9
movl $0x96, %esi
movl $0xffffffff, (%rsp)     # imm = 0xFFFFFFFF
callq 0x5e1b0
addq $0x80, %rsp
popq %rbp
retq
nopw (%rax,%rax)