// File: /workspace/github_cpp_makefile_star2_O2/gasparfm[P]anapache/anapache.cc
// Function: main
int main(int argc, char* argv[])
{
  AnapacheApp anapache(argv[0]);

  /* anapache.readLog("/var/log/apache2/access.log"); */
  /* anapache.readLog("alog.log"); */
  int verbose = 0;      /* flag */
  char *user=NULL, *pass=NULL, *host=NULL;
  int port = 0;
  int i;
  int l;
  int c;
  int oindex;
  char output[10]="none";
  /* getopt vars */
  extern char* optarg;
  extern int optind;
  extern int optopt;
  extern int opterr;
  opterr = 0;
  struct option cli_options[] = {
    {"verbose", 0, NULL, 'v'},
    {"from", 1, NULL, 'f'},
    {"to", 1, NULL, 't'},
    {"all", 0, NULL, 'a'},
    {"help", 0, NULL, 'h'},
    {NULL, 0, NULL, 0}
  };

  try
    {
      while ((c = getopt_long (argc, argv, "vahf:t:", cli_options, &oindex)) != -1)
	{
	  //      printf ("c = %d(%c) index = %d\n", c, c, oindex);
	  switch (c)
	    {
	    case 0:
	      cerr << "Wrong argument!!"<<endl;
	      break;
	    case 'v':
	      verbose=1;
	      break;
	    case 'f':
	      anapache.setFromDate(optarg);
	      break;
	    case 't':
	      anapache.setToDate(optarg);
	      break;
	    case 'a':
	      cout << "ALL ANALYSIS, IT'S THE ONLY WAY NOW\n";
	      break;
	    case 'h':
	      help(argv[0]);
	      break;
	    case '?':
	      if (((string)"ft").find(optopt) != string::npos)
		cerr << "Option -"<<(char)optopt<<" requires an argument.\n";
	      else if (optopt=='?')
		help(argv[0]);
	      else if (isprint (optopt))
		cerr << "Unknown option '-"<<(char)optopt<<"'.\n";
	      else
		cerr << "Invalid char '"<<(char)optopt<<"'.\n";

	      help(argv[0]);
	    default:
	      std::exit(1);
	    }
	}
    } 
  catch (AnaException &e)
    {
      cerr << "An error ocurred: "<< e.what() << std::endl;
      exit(4);
    }

  anapache.summary();

  /* Several files in the future */
  /* for (i = optind; i < argc; i++) */
  /*   anapache.readLog(argv[i]); */

  if (optind < argc)
    anapache.readLog(argv[optind]);
  else
    cerr << "No log files specified" << std::endl;
  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x228, %rsp            # imm = 0x228
movq %rsi, %rbx
movl %edi, %ebp
movq (%rsi), %rsi
leaq 0x58(%rsp), %rdi
leaq 0x160(%rsp), %rdx
callq 0x3d2c
leaq 0xb8(%rsp), %rdi
leaq 0x58(%rsp), %rsi
callq 0x3e08
leaq 0x58(%rsp), %rdi
callq 0x35d8
movq 0xa602(%rip), %rax      # 0xdfc0
andl $0x0, (%rax)
leaq 0xa258(%rip), %rsi      # 0xdc20
leaq 0x160(%rsp), %r14
movl $0xc0, %edx
movq %r14, %rdi
callq 0x32a0
leaq 0x564a(%rip), %r15      # 0x902e
leaq 0x14(%rsp), %r12
leaq 0x78(%rsp), %r13
movl %ebp, 0x10(%rsp)
movl %ebp, %edi
movq %rbx, %rsi
movq %r15, %rdx
movq %r14, %rcx
movq %r12, %r8
callq 0x3510
testl %eax, %eax
je 0x3a88
cmpl $0x61, %eax
je 0x3aa8
cmpl $0x66, %eax
je 0x3a2a
cmpl $0x74, %eax
je 0x3ac0
cmpl $0x76, %eax
je 0x39f2
jmp 0x3af4
movq %rbx, %rbp
movq %r12, %rbx
movq %r15, %r12
movq %r14, %r15
movq %r13, %r14
movq 0xa550(%rip), %rax      # 0xdf90
movq (%rax), %rsi
leaq 0x98(%rsp), %r13
movq %r13, %rdi
leaq 0x18(%rsp), %rdx
callq 0x3d2c
leaq 0xb8(%rsp), %rdi
movq %r13, %rsi
callq 0x4fd0
movq %r13, %rdi
callq 0x35d8
movq %r14, %r13
movq %r15, %r14
movq %r12, %r15
movq %rbx, %r12
movq %rbp, %rbx
movl 0x10(%rsp), %ebp
jmp 0x39f2
movq 0xa551(%rip), %rdi      # 0xdfe0
leaq 0x55a0(%rip), %rsi      # 0x9036
callq 0x3330
movq %rax, %rdi
callq 0x3190
jmp 0x39f2
movq 0xa501(%rip), %rdi      # 0xdfb0
leaq 0x5591(%rip), %rsi      # 0x9047
callq 0x3330
jmp 0x39f2
movq 0xa4c9(%rip), %rax      # 0xdf90
movq (%rax), %rsi
movq %r13, %rdi
leaq 0x18(%rsp), %rdx
callq 0x3d2c
leaq 0xb8(%rsp), %rdi
movq %r13, %rsi
callq 0x5158
movq %r13, %rdi
callq 0x35d8
jmp 0x39f2
cmpl $-0x1, %eax
jne 0x3b85
leaq 0xb8(%rsp), %rdi
callq 0x51e8
movq 0xa4a7(%rip), %rax      # 0xdfb8
movslq (%rax), %rax
cmpl %ebp, %eax
jge 0x3b49
movq (%rbx,%rax,8), %rsi
leaq 0x38(%rsp), %rdi
leaq 0x18(%rsp), %rdx
callq 0x3d2c
leaq 0xb8(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x4496
leaq 0x38(%rsp), %rdi
callq 0x35d8
jmp 0x3b64
movq 0xa490(%rip), %rdi      # 0xdfe0
leaq 0x5571(%rip), %rsi      # 0x90c8
callq 0x3330
movq %rax, %rdi
callq 0x3190
leaq 0xb8(%rsp), %rdi
callq 0x445a
xorl %eax, %eax
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x3f, %eax
je 0x3b98
cmpl $0x68, %eax
jne 0x3c1b
callq 0x394c
leaq 0x54cd(%rip), %rsi      # 0x906c
leaq 0x18(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x3d2c
movq 0xa3f3(%rip), %r15      # 0xdfa8
movsbl (%r15), %esi
leaq 0x18(%rsp), %rbx
movq %rbx, %rdi
xorl %edx, %edx
callq 0x3440
movq %rax, %r14
movq %rbx, %rdi
callq 0x35d8
cmpq $-0x1, %r14
jne 0x3c22
movl (%r15), %edi
cmpl $0x3f, %edi
je 0x3b93
callq 0x3540
testl %eax, %eax
leaq 0x54b7(%rip), %rax      # 0x90a6
leaq 0x549a(%rip), %rsi      # 0x9090
cmoveq %rax, %rsi
movq 0xa3df(%rip), %rdi      # 0xdfe0
callq 0x3330
movsbl (%r15), %esi
movq %rax, %rdi
callq 0x33c0
leaq 0x5489(%rip), %rsi      # 0x90a2
jmp 0x3c48
pushq $0x1
jmp 0x3d00
movq 0xa3b7(%rip), %rdi      # 0xdfe0
leaq 0x543f(%rip), %rsi      # 0x906f
callq 0x3330
movsbl (%r15), %esi
movq %rax, %rdi
callq 0x33c0
leaq 0x5430(%rip), %rsi      # 0x9078
movq %rax, %rdi
callq 0x3330
jmp 0x3b93
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x35d8
jmp 0x3d0e
jmp 0x3c83
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x35d8
jmp 0x3d1b
movq %rax, %rbx
jmp 0x3d1b
movq %rax, %rbx
jmp 0x3d0e
jmp 0x3cb5
movq %rdx, %r14
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
jmp 0x3ca8
movq %rdx, %r14
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
callq 0x35d8
jmp 0x3cbb
jmp 0x3cb5
jmp 0x3cb5
jmp 0x3cb5
movq %rdx, %r14
movq %rax, %rbx
cmpl $0x1, %r14d
jne 0x3d0e
movq %rbx, %rdi
callq 0x3160
movq %rax, %rbx
movq 0xa30d(%rip), %rdi      # 0xdfe0
leaq 0x53db(%rip), %rsi      # 0x90b5
callq 0x3330
movq %rax, %r14
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
movq %r14, %rdi
movq %rax, %rsi
callq 0x3330
movq %rax, %rdi
callq 0x3190
pushq $0x4
popq %rdi
callq 0x3400
movq %rax, %rbx
callq 0x3500
leaq 0xb8(%rsp), %rdi
callq 0x445a
movq %rbx, %rdi
callq 0x3530
movq %rax, %rdi
callq 0x3d67
nop