// File: /workspace/github_c_makefile_star2_O1/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 0x32727(%rip), %rbx     # 0x93520
xorl %ecx, %ecx
leaq 0x1525e(%rip), %rdx     # 0x76060
movq (%rbx), %r15
movq %r15, %r14
movl %eax, %r8d
testb %al, %al
je 0x60e38
movq %rsi, %r9
movl %eax, %r8d
movq %r15, %r14
movzbl %r8b, %r10d
movb (%r10,%rdx), %r10b
movzbl (%r14), %r11d
cmpb (%r11,%rdx), %r10b
jne 0x60e38
incq %r14
movb (%r9), %r8b
incq %r9
testb %r8b, %r8b
jne 0x60e18
movzbl %r8b, %r8d
movb (%r8,%rdx), %r8b
movzbl (%r14), %r9d
cmpb (%r9,%rdx), %r8b
je 0x60e5d
incl %ecx
addq $0x10, %rbx
cmpl $0x11, %ecx
jne 0x60e02
xorl %r13d, %r13d
jmp 0x60ef2
movq (%rdi), %r14
movq %rdi, -0x30(%rbp)
callq 0x45b57
movl $0x1, %r13d
testq %rax, %rax
je 0x60ef2
movq -0x38(%rbp), %rdi
testq %rdi, %rdi
je 0x60ea9
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 0x60cbc
testb %al, %al
je 0x60ec3
orl %ebx, 0x2c(%r14)
jmp 0x60ede
movl 0x8(%rbx), %eax
xorl %edx, %edx
testl %eax, 0x2c(%r14)
setne %dl
movq -0x30(%rbp), %rdi
movq %r15, %rsi
callq 0x6089a
jmp 0x60ef2
movl %ebx, %eax
notl %eax
andl %eax, 0x2c(%r14)
cmpl $0x1000000, %ebx        # imm = 0x1000000
jne 0x60ede
movq $0x0, 0x320(%r14)
movq %r12, %rdi
movl $0x84, %esi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x45b9e
movl %r13d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq