// File: /workspace/github_c_makefile_star2_O3/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 $0xa0, %rsp
movl %edi, %ebp
movl %edi, 0x24(%rsp)
movq %rsi, 0x78(%rsp)
callq 0x69cd0
movq %rax, %rbx
cmpl $0x1, %ebp
jne 0x6837f
leaq 0x38(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x15423(%rip), %rsi     # 0x7d6d5
leaq 0x15429(%rip), %rdx     # 0x7d6e2
leaq 0x28(%rsp), %rdi
callq 0x68bce
leaq 0x28(%rsp), %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x69b74
movl %eax, %ebp
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
je 0x682e3
callq 0x8390
testb %bpl, %bpl
je 0x68439
leaq 0x10(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x153d9(%rip), %rsi     # 0x7d6d5
leaq 0x153df(%rip), %rdx     # 0x7d6e2
movq %rsp, %rdi
callq 0x68bce
leaq 0x68(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x16094(%rip), %rdx     # 0x7e3b0
leaq 0x58(%rsp), %rdi
movq %rdx, %rsi
callq 0x68bce
leaq 0x28(%rsp), %rdi
movq %rsp, %rdx
leaq 0x58(%rsp), %rcx
movq %rbx, %rsi
callq 0x69c78
leaq 0x28(%rsp), %rdi
callq 0x67cd3
movl %eax, %ebx
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
je 0x68359
callq 0x8390
movq 0x58(%rsp), %rdi
cmpq %r12, %rdi
je 0x68368
callq 0x8390
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x685fc
callq 0x8390
jmp 0x685fc
leaq 0x24(%rsp), %r14
leaq 0x78(%rsp), %rsi
movq %r14, %rdi
movl $0x1, %edx
callq 0x6c778
cmpl $0x0, (%r14)
je 0x683e5
leaq 0x38(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x1534e(%rip), %rsi     # 0x7d6fa
leaq 0x1535b(%rip), %rdx     # 0x7d70e
leaq 0x28(%rsp), %rdi
callq 0x68bce
leaq 0x28(%rsp), %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x69b74
movl %eax, %ebx
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
je 0x683dd
callq 0x8390
testb %bl, %bl
je 0x684ef
cmpb $0x1, 0x2df5c(%rip)     # 0x96348
jne 0x684a7
movq 0x2bbb7(%rip), %rbx     # 0x93fb0
leaq 0x15323(%rip), %rsi     # 0x7d723
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 0x685ad
leaq 0x28(%rsp), %rdi
movq %r14, (%rdi)
leaq 0x1529b(%rip), %rsi     # 0x7d6e3
leaq 0x152aa(%rip), %rdx     # 0x7d6f9
callq 0x68bce
leaq 0x28(%rsp), %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x69b74
movl %eax, %ebp
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
je 0x68474
callq 0x8390
movl $0x1, %ebx
testb %bpl, %bpl
jne 0x685fc
leaq 0x24(%rsp), %rdi
leaq 0x78(%rsp), %rsi
movl $0x1, %edx
callq 0x6c778
movq 0x2bb4b(%rip), %rdi     # 0x93fe8
callq 0x6c64c
jmp 0x685fc
cmpb $0x1, 0x2de62(%rip)     # 0x96310
jne 0x6853a
leaq 0x28(%rsp), %rdi
callq 0x71044
leaq 0x10(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x1525b(%rip), %rsi     # 0x7d729
leaq 0x15259(%rip), %rdx     # 0x7d72e
movq %rsp, %rdi
callq 0x68bce
leaq 0x28(%rsp), %rsi
movq %rsp, %rdx
callq 0x67b14
jmp 0x68591
movq 0x2baf2(%rip), %rbx     # 0x93fe8
leaq 0x15212(%rip), %rsi     # 0x7d70f
movl $0x13, %edx
movq %rbx, %rdi
callq 0x8470
movq 0x78(%rsp), %rax
movq (%rax), %r14
testq %r14, %r14
je 0x685b1
movq %r14, %rdi
callq 0x8190
movq 0x2babe(%rip), %rdi     # 0x93fe8
movq %r14, %rsi
movq %rax, %rdx
callq 0x8470
jmp 0x685c8
callq 0x6e49a
callq 0x6e630
callq 0x6de7a
callq 0x6e7ac
cmpb $0x1, 0x2dd4b(%rip)     # 0x962a0
jne 0x6860e
leaq 0x28(%rsp), %rdi
callq 0x6dcbc
leaq 0x10(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x15159(%rip), %rsi     # 0x7d6ce
leaq 0x15158(%rip), %rdx     # 0x7d6d4
movq %rsp, %rdi
callq 0x68bce
leaq 0x28(%rsp), %rsi
movq %rsp, %rdx
callq 0x67b14
movq (%rsp), %rdi
cmpq %r14, %rdi
je 0x6859f
callq 0x8390
leaq 0x28(%rsp), %rdi
movq 0x10(%rdi), %rsi
callq 0x68a76
xorl %ebx, %ebx
jmp 0x685fc
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 0x6c64c
movl $0x1, %ebx
movl %ebx, %eax
addq $0xa0, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2dbbb(%rip), %rdi     # 0x961d0
leaq 0x15d94(%rip), %rsi     # 0x7e3b0
callq 0x80f0
testl %eax, %eax
je 0x6871c
leaq 0x2dba0(%rip), %rbx     # 0x961d0
movq %rsp, %rdi
movq %rbx, %rsi
callq 0x71378
leaq 0x58(%rsp), %rdi
movq %rbx, %rsi
callq 0x7130e
leaq 0x15d61(%rip), %rsi     # 0x7e3b0
leaq 0x58(%rsp), %rdi
callq 0x80f0
testl %eax, %eax
je 0x68754
movq 0x2b948(%rip), %rdi     # 0x93fb0
leaq 0x150df(%rip), %rsi     # 0x7d74e
movl $0x7, %edx
callq 0x8470
movq 0x2db50(%rip), %rsi     # 0x961d0
movq 0x2db51(%rip), %rdx     # 0x961d8
movq 0x2b922(%rip), %rdi     # 0x93fb0
callq 0x8470
movq %rax, %rdi
callq 0x81c0
movq 0x60(%rsp), %rbx
cmpq 0x8(%rsp), %rbx
jne 0x686cc
movq (%rsp), %r14
testq %rbx, %rbx
je 0x688ab
movq 0x58(%rsp), %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x8410
testl %eax, %eax
je 0x688ad
movq 0x2b8dd(%rip), %rdi     # 0x93fb0
leaq 0x1507c(%rip), %rsi     # 0x7d756
movl $0xf, %edx
callq 0x8470
movq 0x58(%rsp), %rsi
movq 0x60(%rsp), %rdx
movq 0x2b8bb(%rip), %rdi     # 0x93fb0
callq 0x8470
leaq 0x15065(%rip), %rsi     # 0x7d766
movl $0xd, %edx
movq %rax, %rdi
callq 0x8470
movq (%rsp), %r14
movq 0x8(%rsp), %rbx
jmp 0x688ad
leaq 0x2dafd(%rip), %rsi     # 0x96220
movq %rsp, %rbx
movq %rbx, %rdi
callq 0x71378
leaq 0x15c7b(%rip), %rsi     # 0x7e3b0
movq %rbx, %rdi
callq 0x80f0
testl %eax, %eax
je 0x68807
movq %rsp, %rdi
callq 0x67cd3
movl %eax, %ebx
jmp 0x688dc
movq 0x2b855(%rip), %rdi     # 0x93fb0
leaq 0x14fcd(%rip), %rsi     # 0x7d72f
movl $0x11, %edx
callq 0x8470
movq 0x2da5d(%rip), %rsi     # 0x961d0
movq 0x2da5e(%rip), %rdx     # 0x961d8
movq 0x2b82f(%rip), %rdi     # 0x93fb0
callq 0x8470
leaq 0x14fb4(%rip), %rsi     # 0x7d741
movl $0xc, %edx
movq %rax, %rdi
callq 0x8470
leaq 0x28(%rsp), %rdi
callq 0x71044
leaq 0x90(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x14f72(%rip), %rsi     # 0x7d729
leaq 0x14f70(%rip), %rdx     # 0x7d72e
leaq 0x80(%rsp), %rdi
callq 0x68bce
leaq 0x28(%rsp), %rsi
leaq 0x80(%rsp), %rdx
callq 0x67b14
movq 0x80(%rsp), %rdi
cmpq %r14, %rdi
je 0x687ef
callq 0x8390
leaq 0x28(%rsp), %rdi
movq 0x10(%rdi), %rsi
callq 0x68a76
movl $0x1, %ebx
jmp 0x688c9
movq 0x2b7a2(%rip), %rdi     # 0x93fb0
leaq 0x14f1a(%rip), %rsi     # 0x7d72f
movl $0x11, %edx
callq 0x8470
movq 0x2d9fa(%rip), %rsi     # 0x96220
movq 0x2d9fb(%rip), %rdx     # 0x96228
movq 0x2b77c(%rip), %rdi     # 0x93fb0
callq 0x8470
leaq 0x14f01(%rip), %rsi     # 0x7d741
movl $0xc, %edx
movq %rax, %rdi
callq 0x8470
leaq 0x28(%rsp), %rdi
callq 0x71044
leaq 0x68(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x14ec2(%rip), %rsi     # 0x7d729
leaq 0x14ec0(%rip), %rdx     # 0x7d72e
leaq 0x58(%rsp), %rdi
callq 0x68bce
leaq 0x28(%rsp), %rsi
leaq 0x58(%rsp), %rdx
callq 0x67b14
movq 0x58(%rsp), %rdi
cmpq %r14, %rdi
je 0x68896
callq 0x8390
leaq 0x28(%rsp), %rdi
movq 0x10(%rdi), %rsi
callq 0x68a76
movl $0x1, %ebx
jmp 0x688dc
xorl %ebx, %ebx
movq 0x2b6fc(%rip), %rdi     # 0x93fb0
movq %r14, %rsi
movq %rbx, %rdx
callq 0x8470
xorl %ebx, %ebx
movq %rax, %rdi
callq 0x81c0
leaq 0x68(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x688dc
callq 0x8390
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x68375
jmp 0x685fc
movq %rax, %rbx
movq 0x58(%rsp), %rdi
cmpq %r14, %rdi
je 0x6890a
callq 0x8390
jmp 0x6890a
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
movq 0x10(%rdi), %rsi
callq 0x68a76
jmp 0x689c2
movq %rax, %rbx
movq 0x80(%rsp), %rdi
cmpq %r14, %rdi
je 0x68937
callq 0x8390
jmp 0x68937
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
movq 0x10(%rdi), %rsi
callq 0x68a76
jmp 0x689af
jmp 0x68976
jmp 0x689ac
jmp 0x68976
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r14, %rdi
je 0x68963
callq 0x8390
jmp 0x68963
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
movq 0x10(%rdi), %rsi
callq 0x68a76
jmp 0x68a29
movq %rax, %rbx
jmp 0x689c2
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r14, %rdi
je 0x68991
callq 0x8390
jmp 0x68991
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
movq 0x10(%rdi), %rsi
callq 0x68a76
jmp 0x68a29
movq %rax, %rdi
callq 0x68a31
movq %rax, %rbx
leaq 0x68(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x689c2
callq 0x8390
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x68a1f
jmp 0x68a29
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
je 0x689e9
callq 0x8390
jmp 0x689e9
movq %rax, %rbx
movq 0x58(%rsp), %rdi
cmpq %r12, %rdi
je 0x689ff
callq 0x8390
jmp 0x689ff
jmp 0x68a12
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r15, %rdi
jne 0x68a1f
jmp 0x68a29
jmp 0x68a26
jmp 0x68a26
jmp 0x68a12
jmp 0x68a26
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
je 0x68a29
callq 0x8390
jmp 0x68a29
movq %rax, %rbx
movq %rbx, %rdi
callq 0x8720