// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: flagPragma
static int flagPragma(Parse *pParse, const char *zLeft, const char *zRight){
  static const struct sPragmaType {
    const char *zName;  /* Name of the pragma */
    int mask;           /* Mask for the db->flags value */
  } aPragma[] = {
    { "full_column_names",        SQLITE_FullColNames  },
    { "short_column_names",       SQLITE_ShortColNames },
    { "count_changes",            SQLITE_CountRows     },
    { "empty_result_callbacks",   SQLITE_NullCallback  },
    { "legacy_file_format",       SQLITE_LegacyFileFmt },
    { "fullfsync",                SQLITE_FullFSync     },
    { "checkpoint_fullfsync",     SQLITE_CkptFullFSync },
    { "cache_spill",              SQLITE_CacheSpill    },
    { "reverse_unordered_selects", SQLITE_ReverseOrder  },
    { "query_only",               SQLITE_QueryOnly     },
#ifndef SQLITE_OMIT_AUTOMATIC_INDEX
    { "automatic_index",          SQLITE_AutoIndex     },
#endif
#ifdef SQLITE_DEBUG
    { "sql_trace",                SQLITE_SqlTrace      },
    { "vdbe_listing",             SQLITE_VdbeListing   },
    { "vdbe_trace",               SQLITE_VdbeTrace     },
    { "vdbe_addoptrace",          SQLITE_VdbeAddopTrace},
    { "vdbe_debug",    SQLITE_SqlTrace | SQLITE_VdbeListing
                               | SQLITE_VdbeTrace      },
#endif
#ifndef SQLITE_OMIT_CHECK
    { "ignore_check_constraints", SQLITE_IgnoreChecks  },
#endif
    /* The following is VERY experimental */
    { "writable_schema",          SQLITE_WriteSchema|SQLITE_RecoveryMode },

    /* TODO: Maybe it shouldn't be possible to change the ReadUncommitted
    ** flag if there are any active statements. */
    { "read_uncommitted",         SQLITE_ReadUncommitted },
    { "recursive_triggers",       SQLITE_RecTriggers   },

    /* This flag may only be set if both foreign-key and trigger support
    ** are present in the build.  */
#if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER)
    { "foreign_keys",             SQLITE_ForeignKeys   },
    { "defer_foreign_keys",       SQLITE_DeferFKs      },
#endif
  };
  int i;
  const struct sPragmaType *p;
  for(i=0, p=aPragma; i<ArraySize(aPragma); i++, p++){
    if( sqlite3StrICmp(zLeft, p->zName)==0 ){
      sqlite3 *db = pParse->db;
      Vdbe *v;
      v = sqlite3GetVdbe(pParse);
      assert( v!=0 );  /* Already allocated by sqlite3Pragma() */
      if( ALWAYS(v) ){
        if( zRight==0 ){
          returnSingleInt(pParse, p->zName, (db->flags & p->mask)!=0 );
        }else{
          int mask = p->mask;          /* Mask of bits to set or clear. */
          if( db->autoCommit==0 ){
            /* Foreign key support may not be enabled or disabled while not
            ** in auto-commit mode.  */
            mask &= ~(SQLITE_ForeignKeys);
          }

          if( sqlite3GetBoolean(zRight, 0) ){
            db->flags |= mask;
          }else{
            db->flags &= ~mask;
            if( mask==SQLITE_DeferFKs ) db->nDeferredImmCons = 0;
          }

          /* Many of the flag-pragmas modify the code generated by the SQL 
          ** compiler (eg. count_changes). So add an opcode to expire all
          ** compiled SQL statements after modifying a pragma value.
          */
          sqlite3VdbeAddOp2(v, OP_Expire, 0, 0);
        }
      }

      return 1;
    }
  }
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, -0x38(%rbp)
movb (%rsi), %al
incq %rsi
leaq 0x32808(%rip), %rbx     # 0x93520
xorl %ecx, %ecx
leaq 0x1538f(%rip), %rdx     # 0x760b0
movq (%rbx), %r15
testb %al, %al
je 0x60d53
movq %rsi, %r8
movl %eax, %r9d
movq %r15, %r14
movzbl %r9b, %r9d
movb (%r9,%rdx), %r10b
movzbl (%r14), %r11d
cmpb (%r11,%rdx), %r10b
jne 0x60d59
incq %r14
movb (%r8), %r9b
incq %r8
testb %r9b, %r9b
jne 0x60d31
jmp 0x60d56
movq %r15, %r14
xorl %r9d, %r9d
movb (%r9,%rdx), %r8b
movzbl (%r14), %r9d
cmpb (%r9,%rdx), %r8b
je 0x60d7a
incl %ecx
addq $0x10, %rbx
cmpl $0x11, %ecx
jne 0x60d21
xorl %r13d, %r13d
jmp 0x60e0f
movq (%rdi), %r14
movq %rdi, -0x30(%rbp)
callq 0x45ece
movl $0x1, %r13d
testq %rax, %rax
je 0x60e0f
movq -0x38(%rbp), %rdi
testq %rdi, %rdi
je 0x60dc6
movq %rax, %r12
movl 0x8(%rbx), %eax
movl %eax, %ebx
andl $0xfff7ffff, %ebx       # imm = 0xFFF7FFFF
cmpb $0x0, 0x4e(%r14)
cmovnel %eax, %ebx
movl $0x1, %esi
xorl %edx, %edx
callq 0x60b8f
testb %al, %al
je 0x60de0
orl %ebx, 0x2c(%r14)
jmp 0x60dfb
movl 0x8(%rbx), %eax
xorl %edx, %edx
testl %eax, 0x2c(%r14)
setne %dl
movq -0x30(%rbp), %rdi
movq %r15, %rsi
callq 0x60762
jmp 0x60e0f
movl %ebx, %eax
notl %eax
andl %eax, 0x2c(%r14)
cmpl $0x1000000, %ebx        # imm = 0x1000000
jne 0x60dfb
movq $0x0, 0x320(%r14)
movq %r12, %rdi
movl $0x84, %esi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x45f15
movl %r13d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq