// File: /workspace/github_c_makefile_star2_O1/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 %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rdi, %rbx
callq 0x69ef2
movq %rax, %r14
leaq 0x68(%rsp), %r12
movq %r12, -0x10(%r12)
movq 0x2e240(%rip), %rsi     # 0x960f8
movq 0x2e241(%rip), %rdx     # 0x96100
addq %rsi, %rdx
leaq 0x58(%rsp), %r15
movq %r15, %rdi
callq 0x68e74
leaq 0x1648a(%rip), %rsi     # 0x7e360
movq %r15, %rdi
callq 0x80f0
testl %eax, %eax
je 0x67f45
callq 0x70744
callq 0x68f04
leaq 0x78(%rsp), %rdi
leaq 0x58(%rsp), %rsi
callq 0x6a19e
leaq 0x2e246(%rip), %rdi     # 0x96148
leaq 0x16457(%rip), %rsi     # 0x7e360
callq 0x80f0
movl %eax, %ebp
testl %eax, %eax
sete %r15b
je 0x6807d
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
movq 0x2e21c(%rip), %rsi     # 0x96148
movq 0x2e21d(%rip), %rdx     # 0x96150
addq %rsi, %rdx
leaq 0x8(%rsp), %rdi
callq 0x68e74
jmp 0x680e8
leaq 0x38(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x156b3(%rip), %rsi     # 0x7d608
leaq 0x156b6(%rip), %rdx     # 0x7d612
leaq 0x28(%rsp), %rdi
callq 0x68de4
leaq 0x18(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x163ea(%rip), %rdx     # 0x7e360
leaq 0x8(%rsp), %rdi
movq %rdx, %rsi
callq 0x68de4
leaq 0x78(%rsp), %rdi
leaq 0x28(%rsp), %rdx
leaq 0x8(%rsp), %rcx
movq %r14, %rsi
callq 0x69e9a
leaq 0x163bf(%rip), %rsi     # 0x7e360
leaq 0x78(%rsp), %rdi
callq 0x80f0
movl %eax, %ebp
leaq 0x88(%rsp), %r12
movq -0x10(%r12), %rdi
cmpq %r12, %rdi
je 0x67fc4
callq 0x8390
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x67fd3
callq 0x8390
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x67fe2
callq 0x8390
testl %ebp, %ebp
je 0x682b2
leaq 0x28(%rsp), %rdi
movq %r15, (%rdi)
leaq 0x1560f(%rip), %rsi     # 0x7d608
leaq 0x15612(%rip), %rdx     # 0x7d612
callq 0x68de4
leaq 0x8(%rsp), %rdi
movq %r13, (%rdi)
leaq 0x1634c(%rip), %rdx     # 0x7e360
movq %rdx, %rsi
callq 0x68de4
leaq 0x78(%rsp), %rdi
leaq 0x28(%rsp), %rdx
leaq 0x8(%rsp), %rcx
movq %r14, %rsi
callq 0x69e9a
leaq 0x58(%rsp), %rdi
leaq 0x78(%rsp), %rsi
callq 0x81f0
movq 0x78(%rsp), %rdi
cmpq %r12, %rdi
je 0x68051
callq 0x8390
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
leaq 0x68(%rsp), %r12
je 0x68065
callq 0x8390
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x67ee2
callq 0x8390
jmp 0x67ee2
leaq 0xf8(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x155c4(%rip), %rsi     # 0x7d654
leaq 0x155cb(%rip), %rdx     # 0x7d662
leaq 0xe8(%rsp), %rdi
callq 0x68de4
leaq 0xd8(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x155ac(%rip), %rsi     # 0x7d663
leaq 0x155ac(%rip), %rdx     # 0x7d66a
leaq 0xc8(%rsp), %rdi
callq 0x68de4
leaq 0x8(%rsp), %rdi
leaq 0xe8(%rsp), %rdx
leaq 0xc8(%rsp), %rcx
movq %r14, %rsi
callq 0x69e9a
testl %ebp, %ebp
jne 0x68118
leaq 0xd8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x68102
callq 0x8390
leaq 0xf8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x68118
callq 0x8390
leaq 0x8(%rsp), %rdi
callq 0x6df20
movq %rax, %r15
testq %rax, %rax
je 0x68185
movl 0x2e098(%rip), %edx     # 0x961c8
leaq 0x78(%rsp), %rdi
movq %rbx, %rsi
callq 0x6a790
movq %rax, %r14
movzbl 0x2e191(%rip), %esi     # 0x962d8
xorl $0x1, %esi
movq %r15, %rdi
callq 0x6e110
movq (%r15), %rax
movq 0x2be54(%rip), %rdx     # 0x93fb0
movq %r15, %rdi
movq %r14, %rsi
callq *0x10(%rax)
xorl %ebx, %ebx
testq %r14, %r14
je 0x68272
movq %r14, %rdi
callq 0x68c5e
movq %r14, %rdi
callq 0x8390
jmp 0x68272
movq 0x2be5c(%rip), %rdi     # 0x93fe8
leaq 0x154d8(%rip), %rsi     # 0x7d66b
movl $0x12, %edx
callq 0x8470
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq 0x2be3a(%rip), %rdi     # 0x93fe8
callq 0x8470
movq %rax, %rbx
leaq 0x16186(%rip), %rsi     # 0x7e343
movl $0x1, %edx
movq %rax, %rdi
callq 0x8470
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x83c0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x8040
movq %rax, %rdi
callq 0x8250
leaq 0x28(%rsp), %rsi
movb $0xa, (%rsi)
movq 0x2bde8(%rip), %rdi     # 0x93fe8
movl $0x1, %edx
callq 0x8470
leaq 0x28(%rsp), %rdi
callq 0x6df58
leaq 0xb8(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x15457(%rip), %rsi     # 0x7d67e
leaq 0x15456(%rip), %rdx     # 0x7d684
leaq 0xa8(%rsp), %rdi
callq 0x68de4
leaq 0x28(%rsp), %rsi
leaq 0xa8(%rsp), %rdx
callq 0x67ccc
movq 0xa8(%rsp), %rdi
cmpq %r14, %rdi
je 0x6825f
callq 0x8390
leaq 0x28(%rsp), %rdi
movq 0x10(%rdi), %rsi
callq 0x68c98
movl $0x1, %ebx
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x68285
callq 0x8390
leaq 0x78(%rsp), %rdi
callq 0x6b12c
movq 0x58(%rsp), %rdi
cmpq %r12, %rdi
je 0x6829e
callq 0x8390
movl %ebx, %eax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x2bd2f(%rip), %rdi     # 0x93fe8
leaq 0x15353(%rip), %rsi     # 0x7d613
movl $0x31, %edx
leaq 0x68(%rsp), %r12
callq 0x8470
movq 0x2bd12(%rip), %rbx     # 0x93fe8
leaq 0x15368(%rip), %rsi     # 0x7d645
movl $0xe, %edx
movq %rbx, %rdi
callq 0x8470
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x83c0
movsbl %al, %esi
movq 0x2bce0(%rip), %rdi     # 0x93fe8
callq 0x8040
movl $0x1, %ebx
movq %rax, %rdi
callq 0x8250
jmp 0x6828f
movq %rax, %rbx
movq 0x78(%rsp), %rdi
cmpq %r12, %rdi
jne 0x683a1
jmp 0x683ab
jmp 0x683a8
jmp 0x683bc
jmp 0x6843f
movq %rax, %rbx
movq 0xa8(%rsp), %rdi
cmpq %r14, %rdi
je 0x68354
callq 0x8390
jmp 0x68354
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
movq 0x10(%rdi), %rsi
callq 0x68c98
jmp 0x68420
movq %rax, %rbx
movb $0x1, %r15b
jmp 0x683f4
movq %rax, %rbx
movb $0x1, %r15b
jmp 0x6840f
movq %rax, %rbx
movq %r14, %rdi
callq 0x8390
jmp 0x68420
movq %rax, %rbx
leaq 0x88(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x683ab
callq 0x8390
jmp 0x683ab
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x683bf
callq 0x8390
jmp 0x683bf
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x68442
callq 0x8390
jmp 0x68442
jmp 0x6843f
jmp 0x6841d
movq %rax, %rbx
testl %ebp, %ebp
jne 0x683f4
leaq 0xd8(%rsp), %rax
movq -0x10(%rax), %rdi
movb $0x1, %r15b
cmpq %rax, %rdi
je 0x683f4
callq 0x8390
testb %r15b, %r15b
je 0x6840f
leaq 0xf8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x6840f
callq 0x8390
testb %r15b, %r15b
jmp 0x68433
movq %rax, %rbx
jmp 0x68433
jmp 0x6841d
jmp 0x6843f
movq %rax, %rbx
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x68433
callq 0x8390
leaq 0x78(%rsp), %rdi
callq 0x6b12c
jmp 0x68442
movq %rax, %rbx
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x68456
callq 0x8390
movq %rbx, %rdi
callq 0x8720
movq %rax, %rdi
callq 0x68c53