// File: /workspace/github_c_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
cmpb $0x2, 0x200(%rdi)
jne 0x4f258
movl %r8d, %r12d
movl %ecx, %r15d
movq 0x40(%rdx), %rcx
movl 0x28(%rcx), %r8d
btl $0xd, %r8d
jb 0x4f258
movzwl %r9w, %eax
testb $0x40, %al
jne 0x4f258
movq %rcx, -0x38(%rbp)
movzbl 0x20(%rdx), %ecx
imulq $0x68, %rcx, %rcx
leaq (%rsi,%rcx), %r14
addq $0x8, %r14
movq (%rdi), %r13
movl %r8d, %ebx
leaq 0x1eca4(%rip), %rdx     # 0x6db5e
andl $0x30, %ebx
movl %r8d, -0x2c(%rbp)
jne 0x4eee8
btl $0xa, %r8d
jb 0x4eed4
movq -0x38(%rbp), %rcx
cmpl $0x0, 0x18(%rcx)
jg 0x4eee8
testb $0x3, %al
leaq 0x1ec88(%rip), %rax     # 0x6db65
leaq 0x1ec7a(%rip), %rdx     # 0x6db5e
cmoveq %rax, %rdx
movq 0x10(%rdi), %rax
movq %rax, -0x70(%rbp)
movl 0x210(%rdi), %eax
movl %eax, -0x54(%rbp)
leaq 0x1c7f9(%rip), %rsi     # 0x6b6f9
movq %r13, %rdi
xorl %eax, %eax
callq 0x10594
cmpq $0x0, 0x28(%r14)
je 0x4ef2f
movzbl 0x3a(%r14), %r8d
leaq 0x1e795(%rip), %rdx     # 0x6d6b2
movq %r13, %rdi
movq %rax, %rsi
movq %rax, %rcx
xorl %eax, %eax
callq 0x2ee1d
jmp 0x4ef4a
movq 0x10(%r14), %r8
leaq 0x1ec30(%rip), %rdx     # 0x6db6a
movq %r13, %rdi
movq %rax, %rsi
movq %rax, %rcx
xorl %eax, %eax
callq 0x2ee1d
movq %rax, %rsi
movq 0x18(%r14), %r8
testq %r8, %r8
je 0x4ef6d
leaq 0x1ec19(%rip), %rdx     # 0x6db76
movq %r13, %rdi
movq %rsi, %rcx
xorl %eax, %eax
callq 0x2ee1d
movq %rax, %rsi
movl -0x2c(%rbp), %edi
testw $0x500, %di             # imm = 0x500
je 0x4efe7
btl $0x8, %edi
setae %al
testb $0xf, %dil
sete %cl
orb %al, %cl
je 0x4efb8
btl $0xa, %edi
jae 0x4f226
movq -0x38(%rbp), %rax
movl 0x18(%rax), %r8d
movq 0x20(%rax), %r9
leaq 0x1ec77(%rip), %rdx     # 0x6dc1d
movq %r13, %rdi
movq %rsi, %rcx
xorl %eax, %eax
callq 0x2ee1d
jmp 0x4f223
leaq 0x1ec01(%rip), %rdx     # 0x6dbc0
movq %r13, %rdi
movq %rsi, %rcx
xorl %eax, %eax
callq 0x2ee1d
movl -0x2c(%rbp), %ecx
movq %rax, %rsi
testb $0x5, %cl
je 0x4f0e2
leaq 0x1ebfb(%rip), %rdx     # 0x6dbdd
jmp 0x4f216
movq -0x38(%rbp), %rax
movq 0x20(%rax), %r9
testq %r9, %r9
je 0x4ef77
movq %r13, -0x60(%rbp)
movl %r15d, -0x50(%rbp)
movq 0x20(%r14), %rax
movq -0x38(%rbp), %rcx
movl 0x18(%rcx), %r13d
movq 0x8(%rax), %rax
movq %rax, -0x48(%rbp)
movq 0x8(%r9), %rax
movq %rax, -0x40(%rbp)
testl %r13d, %r13d
jne 0x4f027
testb $0x30, 0x28(%rcx)
je 0x4f267
movq %r9, %r15
movq %rsi, -0x68(%rbp)
movl %r12d, -0x4c(%rbp)
xorps %xmm0, %xmm0
leaq -0x98(%rbp), %rdi
andq $0x0, 0x18(%rdi)
movups %xmm0, 0x8(%rdi)
movl $0x3b9aca00, 0x20(%rdi) # imm = 0x3B9ACA00
movw $0x1, 0x24(%rdi)
movq -0x60(%rbp), %rax
movq %rax, (%rdi)
leaq 0x20e67(%rip), %rsi     # 0x6fec7
pushq $0x2
popq %rdx
callq 0x155e3
xorl %ebx, %ebx
testl %r13d, %r13d
cmovlel %ebx, %r13d
leaq 0x1cf1c(%rip), %r12     # 0x6bf94
leaq 0x20ba3(%rip), %r14     # 0x6fc22
cmpq %rbx, %r13
movq %r15, %rcx
je 0x4f0bd
movzwl 0x54(%rcx), %eax
movq %r12, %rdx
cmpq %rax, %rbx
je 0x4f0a7
movq -0x40(%rbp), %rax
movslq (%rax,%rbx,4), %rax
imulq $0x30, %rax, %rax
movq -0x48(%rbp), %rcx
movq (%rcx,%rax), %rdx
leaq -0x98(%rbp), %rdi
movl %ebx, %esi
movq %r14, %rcx
callq 0x5233d
incq %rbx
jmp 0x4f07f
movq -0x38(%rbp), %r14
movl 0x28(%r14), %eax
movl %r13d, %ebx
testb $0x20, %al
movl -0x4c(%rbp), %r12d
je 0x4f146
movzwl 0x54(%rcx), %eax
cmpl %eax, %r13d
jne 0x4f111
leaq 0x1ceb4(%rip), %rdx     # 0x6bf94
jmp 0x4f125
cmpl $0x30, %ebx
jne 0x4f0f3
leaq 0x1eafc(%rip), %rdx     # 0x6dbea
jmp 0x4f216
testb $0x20, %cl
jne 0x4f20f
testb $0x10, %cl
je 0x4f226
leaq 0x1eb04(%rip), %rdx     # 0x6dc10
jmp 0x4f216
movq -0x40(%rbp), %rax
movslq (%rax,%r13,4), %rax
imulq $0x30, %rax, %rax
movq -0x48(%rbp), %rcx
movq (%rcx,%rax), %rdx
leal 0x1(%r13), %ebx
leaq 0x1eb0a(%rip), %rcx     # 0x6dc3a
leaq -0x98(%rbp), %rdi
movl %r13d, %esi
callq 0x5233d
movl 0x28(%r14), %eax
movq %r15, %rcx
testb $0x10, %al
je 0x4f185
movzwl 0x54(%rcx), %eax
cmpl %eax, %r13d
jne 0x4f15c
leaq 0x1ce3a(%rip), %rdx     # 0x6bf94
jmp 0x4f170
movq -0x40(%rbp), %rax
movslq (%rax,%r13,4), %rax
imulq $0x30, %rax, %rax
movq -0x48(%rbp), %rcx
movq (%rcx,%rax), %rdx
leaq 0x1eac5(%rip), %rcx     # 0x6dc3c
leaq -0x98(%rbp), %rdi
movl %ebx, %esi
callq 0x5233d
leaq 0x1e1e9(%rip), %rsi     # 0x6d375
leaq -0x98(%rbp), %rbx
pushq $0x1
popq %rdx
movq %rbx, %rdi
callq 0x155e3
movq %rbx, %rdi
callq 0xadc3
movq %rax, %r15
movq 0x20(%r14), %r9
movq -0x68(%rbp), %rsi
movl -0x2c(%rbp), %edi
btl $0xe, %edi
leaq 0x1e9e1(%rip), %rax     # 0x6dba0
leaq 0x1e9b9(%rip), %rdx     # 0x6db7f
cmovaeq %rax, %rdx
testb $0x40, %dil
leaq 0x21170(%rip), %rax     # 0x70345
leaq 0x1e9da(%rip), %r8      # 0x6dbb6
cmoveq %rax, %r8
movq (%r9), %r9
movq %r15, (%rsp)
movq -0x60(%rbp), %r13
movq %r13, %rdi
movq %rsi, %rcx
xorl %eax, %eax
callq 0x2ee1d
movq %rax, %rbx
movq %r13, %rdi
movq %r15, %rsi
callq 0x968b
movq %rbx, %rsi
movl -0x50(%rbp), %r15d
jmp 0x4f226
leaq 0x1e9ed(%rip), %rdx     # 0x6dc03
movq %r13, %rdi
movq %rsi, %rcx
xorl %eax, %eax
callq 0x2ee1d
movq %rax, %rsi
leaq 0x1c4cc(%rip), %rdx     # 0x6b6f9
movq %r13, %rdi
movq %rsi, %rcx
xorl %eax, %eax
callq 0x2ee1d
orl $-0x1, (%rsp)
movq -0x70(%rbp), %rdi
movl $0x96, %esi
movl -0x54(%rbp), %edx
movl %r15d, %ecx
movl %r12d, %r8d
movq %rax, %r9
callq 0x41fd2
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r15d, %r15d
jmp 0x4f1b4