// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/ash_query.cpp
// Function: main
int main(int argc, char ** argv) {
  // Load the config from the environment.
  Config & config = Config::instance();

  if (argc == 1) {  // No flags.
    if (config.sets("DEFAULT_QUERY")) {
      return execute(config.get_string("DEFAULT_QUERY"));
    }
    if (!config.sets("HIDE_USAGE_FOR_NO_ARGS")) {
      Flag::parse(&argc, &argv, true);  // Sets the prog name in help output.
      Flag::show_help(cerr);
    }
    return 1;
  }

  // Parse the flags, removing from argv and argc.
  Flag::parse(&argc, &argv, true);

  // Abort if unrecognized flags were used on the command line.
  if (argc != 0 && !config.sets("IGNORE_UNKNOWN_FLAGS")) {
    cerr << "unrecognized flag: " << argv[0] << endl;
    Flag::show_help(cerr);
    return 1;
  }

  // Display version, if that's all that was wanted.
  if (FLAGS_version) {
    cout << ASH_VERSION << endl;
    return 0;
  }

  // Display available query names, if requested.
  if (FLAGS_list_queries) {
    display(cout, Queries::get_desc(), "Query");
    return 0;
  }

  // Initialize the available formatters.
  CsvFormatter::init();
  NullFormatter::init();
  SpacedFormatter::init();
  GroupedFormatter::init();

  // Diaplay the available format names.
  if (FLAGS_list_formats) {
    display(cout, Formatter::get_desc(), "Format");
    return 0;
  }

  // Print the requested query (both generic and actual, if different).
  if (FLAGS_print_query != "") {
    string sql = Queries::get_sql(FLAGS_print_query);
    string raw = Queries::get_raw_sql(FLAGS_print_query);
    if (raw == "") {
      cout << "Query not found: " << FLAGS_print_query << "\nAvailable:\n";
      display(cout, Queries::get_desc(), "Query");
      return 1;
    }
    cout << "Query: " << FLAGS_print_query << endl;
    if (raw != sql) {
      cout << "Template Form:\n" << raw << "\nActual SQL:\n";
    }
    cout << sql << endl;
    return 0;
  }

  // Make sure the requested query exists.
  string sql = Queries::get_sql(FLAGS_query);
  if (sql == "") {
    cout << "Query not found: " << FLAGS_query << "\nAvailable:\n";
    display(cout, Queries::get_desc(), "Query");
    return 1;
  }

  // Execute the requested query.
  return execute(sql);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xc0, %rsp
movl %edi, 0x4(%rsp)
movq %rsi, 0x58(%rsp)
callq 0x69ef2
movq %rax, %rbx
cmpl $0x1, 0x4(%rsp)
jne 0x6857f
leaq 0x38(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x151e4(%rip), %rsi     # 0x7d685
leaq 0x151ea(%rip), %rdx     # 0x7d692
leaq 0x28(%rsp), %rdi
callq 0x68de4
leaq 0x28(%rsp), %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x69d80
movl %eax, %ebp
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
je 0x684d2
callq 0x8390
testb %bpl, %bpl
je 0x685e1
leaq 0x90(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x15197(%rip), %rsi     # 0x7d685
leaq 0x1519d(%rip), %rdx     # 0x7d692
leaq 0x80(%rsp), %rdi
callq 0x68de4
leaq 0x18(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x15e4d(%rip), %rdx     # 0x7e360
leaq 0x8(%rsp), %rdi
movq %rdx, %rsi
callq 0x68de4
leaq 0x28(%rsp), %rdi
leaq 0x80(%rsp), %rdx
leaq 0x8(%rsp), %rcx
movq %rbx, %rsi
callq 0x69e9a
leaq 0x28(%rsp), %rdi
callq 0x67e8b
movl %eax, %ebx
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
je 0x68555
callq 0x8390
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x68564
callq 0x8390
movq 0x80(%rsp), %rdi
cmpq %r15, %rdi
je 0x68819
callq 0x8390
jmp 0x68819
leaq 0x4(%rsp), %r14
leaq 0x58(%rsp), %rsi
movq %r14, %rdi
movl $0x1, %edx
callq 0x6c9f0
movl (%r14), %ebp
testl %ebp, %ebp
je 0x6864f
leaq 0x90(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x150f6(%rip), %rsi     # 0x7d6aa
leaq 0x15103(%rip), %rdx     # 0x7d6be
leaq 0x80(%rsp), %rdi
callq 0x68de4
leaq 0x80(%rsp), %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x69d80
movl %eax, %ebx
xorb $0x1, %bl
jmp 0x68651
leaq 0x28(%rsp), %rdi
movq %r14, (%rdi)
leaq 0x150a3(%rip), %rsi     # 0x7d693
leaq 0x150b2(%rip), %rdx     # 0x7d6a9
callq 0x68de4
leaq 0x28(%rsp), %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x69d80
movl %eax, %ebp
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
je 0x6861c
callq 0x8390
movl $0x1, %ebx
testb %bpl, %bpl
jne 0x68819
leaq 0x4(%rsp), %rdi
leaq 0x58(%rsp), %rsi
movl $0x1, %edx
callq 0x6c9f0
movq 0x2b9a3(%rip), %rdi     # 0x93fe8
callq 0x6c8c4
jmp 0x68819
xorl %ebx, %ebx
testl %ebp, %ebp
je 0x6866b
leaq 0x90(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x6866b
callq 0x8390
testb %bl, %bl
je 0x686ba
movq 0x2b972(%rip), %rbx     # 0x93fe8
leaq 0x15042(%rip), %rsi     # 0x7d6bf
movl $0x13, %edx
movq %rbx, %rdi
callq 0x8470
movq 0x58(%rsp), %rax
movq (%rax), %r14
testq %r14, %r14
je 0x68756
movq %r14, %rdi
callq 0x8190
movq 0x2b93e(%rip), %rdi     # 0x93fe8
movq %r14, %rsi
movq %rax, %rdx
callq 0x8470
jmp 0x6876d
cmpb $0x1, 0x2dc87(%rip)     # 0x96348
jne 0x6870a
movq 0x2b8e6(%rip), %rbx     # 0x93fb0
leaq 0x15002(%rip), %rsi     # 0x7d6d3
movl $0x5, %edx
movq %rbx, %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
jmp 0x68817
cmpb $0x1, 0x2dbff(%rip)     # 0x96310
jne 0x687a3
leaq 0x28(%rsp), %rdi
callq 0x712d8
leaq 0x18(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x14fa8(%rip), %rsi     # 0x7d6d9
leaq 0x14fa6(%rip), %rdx     # 0x7d6de
leaq 0x8(%rsp), %rdi
callq 0x68de4
leaq 0x28(%rsp), %rsi
leaq 0x8(%rsp), %rdx
callq 0x67ccc
jmp 0x687fa
movq (%rbx), %rax
movq -0x18(%rax), %rax
leaq (%rbx,%rax), %rdi
movl 0x20(%rbx,%rax), %esi
orl $0x1, %esi
callq 0x86b0
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
movq %rbx, %rdi
callq 0x6c8c4
movl $0x1, %ebx
jmp 0x68819
callq 0x6e722
callq 0x6e8b8
callq 0x6e116
callq 0x6ea34
cmpb $0x1, 0x2dae2(%rip)     # 0x962a0
jne 0x6882b
leaq 0x28(%rsp), %rdi
callq 0x6df58
leaq 0x18(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x14ea4(%rip), %rsi     # 0x7d67e
leaq 0x14ea3(%rip), %rdx     # 0x7d684
leaq 0x8(%rsp), %rdi
callq 0x68de4
leaq 0x28(%rsp), %rsi
leaq 0x8(%rsp), %rdx
callq 0x67ccc
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x68809
callq 0x8390
leaq 0x28(%rsp), %rdi
movq 0x10(%rdi), %rsi
callq 0x68c98
xorl %ebx, %ebx
movl %ebx, %eax
addq $0xc0, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2d99e(%rip), %rdi     # 0x961d0
leaq 0x15b27(%rip), %rsi     # 0x7e360
callq 0x80f0
testl %eax, %eax
je 0x68945
leaq 0x2d983(%rip), %rbx     # 0x961d0
leaq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq 0x7160c
leaq 0x60(%rsp), %rdi
movq %rbx, %rsi
callq 0x715a2
leaq 0x15af2(%rip), %rsi     # 0x7e360
leaq 0x60(%rsp), %rdi
callq 0x80f0
testl %eax, %eax
je 0x68981
movq 0x2b729(%rip), %rdi     # 0x93fb0
leaq 0x14e70(%rip), %rsi     # 0x7d6fe
movl $0x7, %edx
callq 0x8470
movq 0x2d931(%rip), %rsi     # 0x961d0
movq 0x2d932(%rip), %rdx     # 0x961d8
movq 0x2b703(%rip), %rdi     # 0x93fb0
callq 0x8470
movq %rax, %rdi
callq 0x81c0
movq 0x68(%rsp), %rdx
cmpq 0x10(%rsp), %rdx
jne 0x688de
testq %rdx, %rdx
je 0x68920
movq 0x8(%rsp), %rsi
movq 0x60(%rsp), %rdi
callq 0x8410
testl %eax, %eax
je 0x68920
movq 0x2b6cb(%rip), %rdi     # 0x93fb0
leaq 0x14e1a(%rip), %rsi     # 0x7d706
movl $0xf, %edx
callq 0x8470
movq 0x60(%rsp), %rsi
movq 0x68(%rsp), %rdx
movq 0x2b6a9(%rip), %rdi     # 0x93fb0
callq 0x8470
leaq 0x14e03(%rip), %rsi     # 0x7d716
movl $0xd, %edx
movq %rax, %rdi
callq 0x8470
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq 0x2b67f(%rip), %rdi     # 0x93fb0
callq 0x8470
xorl %ebx, %ebx
movq %rax, %rdi
callq 0x81c0
jmp 0x68a2f
leaq 0x2d8d4(%rip), %rsi     # 0x96220
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x7160c
leaq 0x15a00(%rip), %rsi     # 0x7e360
movq %rbx, %rdi
callq 0x80f0
testl %eax, %eax
je 0x68a4b
leaq 0x8(%rsp), %rdi
callq 0x67e8b
movl %eax, %ebx
jmp 0x68aed
movq 0x2b628(%rip), %rdi     # 0x93fb0
leaq 0x14d50(%rip), %rsi     # 0x7d6df
movl $0x11, %edx
callq 0x8470
movq 0x2d830(%rip), %rsi     # 0x961d0
movq 0x2d831(%rip), %rdx     # 0x961d8
movq 0x2b602(%rip), %rdi     # 0x93fb0
callq 0x8470
leaq 0x14d37(%rip), %rsi     # 0x7d6f1
movl $0xc, %edx
movq %rax, %rdi
callq 0x8470
leaq 0x28(%rsp), %rdi
callq 0x712d8
leaq 0xb0(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x14cf5(%rip), %rsi     # 0x7d6d9
leaq 0x14cf3(%rip), %rdx     # 0x7d6de
leaq 0xa0(%rsp), %rdi
callq 0x68de4
leaq 0x28(%rsp), %rsi
leaq 0xa0(%rsp), %rdx
callq 0x67ccc
movq 0xa0(%rsp), %rdi
cmpq %r14, %rdi
je 0x68a1c
callq 0x8390
leaq 0x28(%rsp), %rdi
movq 0x10(%rdi), %rsi
callq 0x68c98
movl $0x1, %ebx
leaq 0x70(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x68aed
callq 0x8390
jmp 0x68aed
movq 0x2b55e(%rip), %rdi     # 0x93fb0
leaq 0x14c86(%rip), %rsi     # 0x7d6df
movl $0x11, %edx
callq 0x8470
movq 0x2d7b6(%rip), %rsi     # 0x96220
movq 0x2d7b7(%rip), %rdx     # 0x96228
movq 0x2b538(%rip), %rdi     # 0x93fb0
callq 0x8470
leaq 0x14c6d(%rip), %rsi     # 0x7d6f1
movl $0xc, %edx
movq %rax, %rdi
callq 0x8470
leaq 0x28(%rsp), %rdi
callq 0x712d8
leaq 0x70(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x14c2e(%rip), %rsi     # 0x7d6d9
leaq 0x14c2c(%rip), %rdx     # 0x7d6de
leaq 0x60(%rsp), %rdi
callq 0x68de4
leaq 0x28(%rsp), %rsi
leaq 0x60(%rsp), %rdx
callq 0x67ccc
movq 0x60(%rsp), %rdi
cmpq %r14, %rdi
je 0x68ada
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
jne 0x68575
jmp 0x68819
movq %rax, %rbx
movq 0x60(%rsp), %rdi
cmpq %r14, %rdi
je 0x68b1b
callq 0x8390
jmp 0x68b1b
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
movq 0x10(%rdi), %rsi
callq 0x68c98
jmp 0x68bd5
movq %rax, %rbx
movq 0xa0(%rsp), %rdi
cmpq %r14, %rdi
je 0x68b48
callq 0x8390
jmp 0x68b48
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
movq 0x10(%rdi), %rsi
callq 0x68c98
jmp 0x68bc2
jmp 0x68b88
jmp 0x68bbf
jmp 0x68b88
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x68b75
callq 0x8390
jmp 0x68b75
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
movq 0x10(%rdi), %rsi
callq 0x68c98
jmp 0x68c4b
movq %rax, %rbx
jmp 0x68bd5
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x68ba4
callq 0x8390
jmp 0x68ba4
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
movq 0x10(%rdi), %rsi
callq 0x68c98
jmp 0x68c4b
movq %rax, %rdi
callq 0x68c53
movq %rax, %rbx
leaq 0x70(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x68bd5
callq 0x8390
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x68c41
jmp 0x68c4b
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
je 0x68bfc
callq 0x8390
jmp 0x68bfc
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x68c12
callq 0x8390
jmp 0x68c12
jmp 0x68c34
movq %rax, %rbx
movq 0x80(%rsp), %rdi
cmpq %r15, %rdi
jne 0x68c41
jmp 0x68c4b
jmp 0x68c48
jmp 0x68c48
movq %rax, %rbx
movq 0x80(%rsp), %rdi
jmp 0x68c3c
jmp 0x68c48
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
je 0x68c4b
callq 0x8390
jmp 0x68c4b
movq %rax, %rbx
movq %rbx, %rdi
callq 0x8720