// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/ash_query.cpp
// Function: execute(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
int execute(const string & sql) {
  Config & config = Config::instance();

  // Get the filename backing the database we are about to query.
  string db_file(FLAGS_database);
  if (db_file == "") {
    if (config.get_string("HISTORY_DB") == "") {
      cerr << "Expected either --database or ASH_CFG_HISTORY_DB "
           << "to be defined." << endl;
      return 1;
    }
    db_file = config.get_string("HISTORY_DB");
  }

  // Prepare the DB for reading.
  Session::register_table();
  Command::register_table();
  Database db(db_file);

  // Get the intended Formatter before executing the query.
  string format = FLAGS_format == ""
    ? config.get_string("DEFAULT_FORMAT", "aligned")
    : FLAGS_format;
  Formatter * formatter = Formatter::lookup(format);
  if (!formatter) {
    cerr << "\nUnknown format: '" << format << "'" << endl;
    display(cerr << '\n', Formatter::get_desc(), "Format");
    return 1;
  }

  // Execute the query and display any results.
  ResultSet * rs = db.exec(sql, FLAGS_limit);
  formatter -> show_headings(!FLAGS_hide_headings);
  formatter -> insert(rs, cout);
  if (rs) delete rs;
  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0xc8, %rsp
movq %rdi, %rbx
callq 0x5d6d2
movq %rax, %r14
leaq 0x2d600(%rip), %rsi     # 0x890f8
leaq 0xa8(%rsp), %r15
movq %r15, %rdi
callq 0x8500
leaq 0x14836(%rip), %rsi     # 0x70345
movq %r15, %rdi
callq 0x5c510
testb %al, %al
je 0x5bc3d
leaq 0x13b02(%rip), %rsi     # 0x6f628
leaq 0x28(%rsp), %rdi
leaq 0x58(%rsp), %rdx
callq 0x8150
leaq 0x14809(%rip), %rsi     # 0x70345
leaq 0x8(%rsp), %rdi
leaq 0x6(%rsp), %rdx
callq 0x8150
leaq 0x78(%rsp), %rdi
leaq 0x28(%rsp), %rdx
leaq 0x8(%rsp), %rcx
movq %r14, %rsi
callq 0x5d692
leaq 0x147dc(%rip), %rsi     # 0x70345
leaq 0x78(%rsp), %rdi
callq 0x5c510
movl %eax, %ebp
leaq 0x78(%rsp), %rdi
callq 0x84b0
leaq 0x8(%rsp), %rdi
callq 0x84b0
leaq 0x28(%rsp), %rdi
callq 0x84b0
testb %bpl, %bpl
je 0x5bbca
movq 0x2b451(%rip), %rdi     # 0x86ff0
leaq 0x13a8d(%rip), %rsi     # 0x6f633
callq 0x83a0
leaq 0x13ab3(%rip), %rsi     # 0x6f665
movq %rax, %rdi
callq 0x83a0
movq %rax, %rdi
callq 0x81a0
pushq $0x1
popq %rbx
jmp 0x5bde7
leaq 0x13a57(%rip), %rsi     # 0x6f628
leaq 0x28(%rsp), %rdi
leaq 0x58(%rsp), %rdx
callq 0x8150
leaq 0x1475e(%rip), %rsi     # 0x70345
leaq 0x8(%rsp), %rdi
leaq 0x6(%rsp), %rdx
callq 0x8150
leaq 0x78(%rsp), %rdi
leaq 0x28(%rsp), %rdx
leaq 0x8(%rsp), %rcx
movq %r14, %rsi
callq 0x5d692
leaq 0xa8(%rsp), %rdi
leaq 0x78(%rsp), %rsi
callq 0x81d0
leaq 0x78(%rsp), %rdi
callq 0x84b0
leaq 0x8(%rsp), %rdi
callq 0x84b0
leaq 0x28(%rsp), %rdi
callq 0x84b0
callq 0x630c4
callq 0x5c740
leaq 0x78(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x5d98c
leaq 0x2d4e8(%rip), %rdi     # 0x89148
leaq 0x146de(%rip), %rsi     # 0x70345
callq 0x5c510
testb %al, %al
je 0x5bcc9
leaq 0x139fd(%rip), %rsi     # 0x6f674
leaq 0x28(%rsp), %rdi
leaq 0x6(%rsp), %rdx
callq 0x8150
leaq 0x139f6(%rip), %rsi     # 0x6f683
leaq 0x58(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x8150
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rdx
leaq 0x58(%rsp), %rcx
movq %r14, %rsi
callq 0x5d692
leaq 0x58(%rsp), %rdi
callq 0x84b0
leaq 0x28(%rsp), %rdi
callq 0x84b0
jmp 0x5bcda
leaq 0x2d478(%rip), %rsi     # 0x89148
leaq 0x8(%rsp), %rdi
callq 0x8500
leaq 0x8(%rsp), %rdi
callq 0x60efc
movq %rax, %r15
testq %rax, %rax
je 0x5bd47
movl 0x2d4d6(%rip), %edx     # 0x891c8
leaq 0x78(%rsp), %rdi
movq %rbx, %rsi
callq 0x5de40
movq %rax, %r14
movzbl 0x2d5cf(%rip), %esi     # 0x892d8
xorl $0x1, %esi
movq %r15, %rdi
callq 0x6109c
movq (%r15), %rax
movq 0x2b29a(%rip), %rdx     # 0x86fb8
movq %r15, %rdi
movq %r14, %rsi
callq *0x10(%rax)
xorl %ebx, %ebx
testq %r14, %r14
je 0x5bdd3
movq %r14, %rdi
callq 0x5c51e
movq %r14, %rdi
callq 0x8370
jmp 0x5bdd3
movq 0x2b2a2(%rip), %rdi     # 0x86ff0
leaq 0x13936(%rip), %rsi     # 0x6f68b
callq 0x83a0
leaq 0x8(%rsp), %rsi
movq %rax, %rdi
callq 0x8320
leaq 0x145a1(%rip), %rsi     # 0x7030f
movq %rax, %rdi
callq 0x83a0
movq %rax, %rdi
callq 0x81a0
movq 0x2b26b(%rip), %rdi     # 0x86ff0
pushq $0xa
popq %rsi
callq 0x8460
leaq 0x28(%rsp), %rdi
callq 0x60f34
leaq 0x13900(%rip), %rsi     # 0x6f69e
leaq 0x58(%rsp), %rdi
leaq 0x6(%rsp), %rdx
callq 0x8150
leaq 0x28(%rsp), %rsi
leaq 0x58(%rsp), %rdx
callq 0x5b98c
leaq 0x58(%rsp), %rdi
callq 0x84b0
leaq 0x28(%rsp), %rdi
callq 0x5c56c
pushq $0x1
popq %rbx
leaq 0x8(%rsp), %rdi
callq 0x84b0
leaq 0x78(%rsp), %rdi
callq 0x5e508
leaq 0xa8(%rsp), %rdi
callq 0x84b0
movl %ebx, %eax
addq $0xc8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0x84b0
jmp 0x5be50
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x84b0
jmp 0x5be7a
movq %rax, %rbx
movq %r14, %rdi
callq 0x8370
jmp 0x5bec3
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x84b0
jmp 0x5be89
jmp 0x5bebb
jmp 0x5bed9
movq %rax, %rbx
jmp 0x5be5a
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x84b0
leaq 0x28(%rsp), %rdi
callq 0x84b0
jmp 0x5bedc
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0x84b0
jmp 0x5bea1
jmp 0x5bec0
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x5c56c
jmp 0x5bec3
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x84b0
jmp 0x5becd
jmp 0x5bebb
jmp 0x5bed9
movq %rax, %rbx
jmp 0x5beab
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x84b0
leaq 0x28(%rsp), %rdi
callq 0x84b0
jmp 0x5bedc
jmp 0x5bec0
jmp 0x5bed9
movq %rax, %rbx
jmp 0x5becd
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x84b0
leaq 0x78(%rsp), %rdi
callq 0x5e508
jmp 0x5bedc
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
callq 0x84b0
movq %rbx, %rdi
callq 0x86f0
movq %rax, %rdi
callq 0x5c505