// File: 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
movq %rsp, %rbp
subq $0x340, %rsp            # imm = 0x340
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x2a8(%rbp)
leaq -0xd9(%rbp), %rdi
movq %rdi, -0x2a0(%rbp)
callq 0x46e0
movq -0x2a8(%rbp), %rsi
movq -0x2a0(%rbp), %rdx
leaq -0xd8(%rbp), %rdi
callq 0x5700
jmp 0x4f76
leaq -0xb8(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0x5a50
jmp 0x4f8b
leaq -0xd8(%rbp), %rdi
callq 0x47a8
leaq -0xd9(%rbp), %rdi
callq 0x4490
movl $0x0, -0xf0(%rbp)
movq $0x0, -0xf8(%rbp)
movq $0x0, -0x100(%rbp)
movq $0x0, -0x108(%rbp)
movl $0x0, -0x10c(%rbp)
movq 0xe12a(%rip), %rax      # 0x13109
movq %rax, -0x126(%rbp)
movw 0xe124(%rip), %ax       # 0x13111
movw %ax, -0x11e(%rbp)
movq 0x16fc5(%rip), %rax     # 0x1bfc0
movl $0x0, (%rax)
leaq -0x1f0(%rbp), %rdi
leaq 0x16c01(%rip), %rsi     # 0x1bc10
movl $0xc0, %edx
callq 0x4370
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
leaq -0x1f0(%rbp), %rcx
leaq 0xe000(%rip), %rdx      # 0x1302e
leaq -0x11c(%rbp), %r8
callq 0x4680
movl %eax, -0x118(%rbp)
cmpl $-0x1, %eax
je 0x556e
movl -0x118(%rbp), %eax
movl %eax, -0x2ac(%rbp)
testl %eax, %eax
je 0x510b
jmp 0x505f
movl -0x2ac(%rbp), %eax
subl $0x3f, %eax
je 0x52fe
jmp 0x5070
movl -0x2ac(%rbp), %eax
subl $0x61, %eax
je 0x52d1
jmp 0x5081
movl -0x2ac(%rbp), %eax
subl $0x66, %eax
je 0x5167
jmp 0x5092
movl -0x2ac(%rbp), %eax
subl $0x68, %eax
je 0x52eb
jmp 0x50a3
movl -0x2ac(%rbp), %eax
subl $0x74, %eax
je 0x521c
jmp 0x50b4
movl -0x2ac(%rbp), %eax
subl $0x76, %eax
je 0x5158
jmp 0x555f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe8(%rbp)
movl %eax, -0xec(%rbp)
jmp 0x50fa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe8(%rbp)
movl %eax, -0xec(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x47a8
leaq -0xd9(%rbp), %rdi
callq 0x4490
jmp 0x56dd
movq 0x16ece(%rip), %rdi     # 0x1bfe0
leaq 0xdf1d(%rip), %rsi      # 0x13036
callq 0x4410
movq %rax, -0x2b8(%rbp)
jmp 0x5127
movq -0x2b8(%rbp), %rdi
movq 0x16e43(%rip), %rsi     # 0x1bf78
callq 0x4470
jmp 0x513c
jmp 0x5569
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe8(%rbp)
movl %eax, -0xec(%rbp)
jmp 0x53ec
movl $0x1, -0xf0(%rbp)
jmp 0x5569
movq 0x16e12(%rip), %rax     # 0x1bf80
movq (%rax), %rax
movq %rax, -0x2c8(%rbp)
leaq -0x211(%rbp), %rdi
movq %rdi, -0x2c0(%rbp)
callq 0x46e0
movq -0x2c8(%rbp), %rsi
movq -0x2c0(%rbp), %rdx
leaq -0x210(%rbp), %rdi
callq 0x5700
jmp 0x51a7
leaq -0xb8(%rbp), %rdi
leaq -0x210(%rbp), %rsi
callq 0x7da0
jmp 0x51bc
leaq -0x210(%rbp), %rdi
callq 0x47a8
leaq -0x211(%rbp), %rdi
callq 0x4490
jmp 0x5569
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe8(%rbp)
movl %eax, -0xec(%rbp)
jmp 0x520b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe8(%rbp)
movl %eax, -0xec(%rbp)
leaq -0x210(%rbp), %rdi
callq 0x47a8
leaq -0x211(%rbp), %rdi
callq 0x4490
jmp 0x53ec
movq 0x16d5d(%rip), %rax     # 0x1bf80
movq (%rax), %rax
movq %rax, -0x2d8(%rbp)
leaq -0x239(%rbp), %rdi
movq %rdi, -0x2d0(%rbp)
callq 0x46e0
movq -0x2d8(%rbp), %rsi
movq -0x2d0(%rbp), %rdx
leaq -0x238(%rbp), %rdi
callq 0x5700
jmp 0x525c
leaq -0xb8(%rbp), %rdi
leaq -0x238(%rbp), %rsi
callq 0x8040
jmp 0x5271
leaq -0x238(%rbp), %rdi
callq 0x47a8
leaq -0x239(%rbp), %rdi
callq 0x4490
jmp 0x5569
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe8(%rbp)
movl %eax, -0xec(%rbp)
jmp 0x52c0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe8(%rbp)
movl %eax, -0xec(%rbp)
leaq -0x238(%rbp), %rdi
callq 0x47a8
leaq -0x239(%rbp), %rdi
callq 0x4490
jmp 0x53ec
movq 0x16cd8(%rip), %rdi     # 0x1bfb0
leaq 0xdd68(%rip), %rsi      # 0x13047
callq 0x4410
jmp 0x52e6
jmp 0x5569
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x4ee0
jmp 0x52f9
jmp 0x5569
leaq -0x261(%rbp), %rdi
movq %rdi, -0x2e0(%rbp)
callq 0x46e0
movq -0x2e0(%rbp), %rdx
leaq 0xdd4d(%rip), %rsi      # 0x1306c
leaq -0x260(%rbp), %rdi
callq 0x5700
jmp 0x532d
movq 0x16c6c(%rip), %rax     # 0x1bfa0
movl (%rax), %eax
leaq -0x260(%rbp), %rdi
xorl %ecx, %ecx
movl %ecx, %edx
movsbl %al, %esi
callq 0x4590
movq %rax, -0x2e8(%rbp)
leaq -0x260(%rbp), %rdi
callq 0x47a8
leaq -0x261(%rbp), %rdi
callq 0x4490
movq -0x2e8(%rbp), %rax
cmpq $-0x1, %rax
je 0x5475
movq 0x16c60(%rip), %rdi     # 0x1bfe0
leaq 0xdce8(%rip), %rsi      # 0x1306f
callq 0x4410
movq %rax, -0x2f0(%rbp)
jmp 0x5395
movq -0x2f0(%rbp), %rdi
movq 0x16bfd(%rip), %rax     # 0x1bfa0
movsbl (%rax), %esi
callq 0x4500
movq %rax, -0x2f8(%rbp)
jmp 0x53b4
movq -0x2f8(%rbp), %rdi
leaq 0xdcb6(%rip), %rsi      # 0x13078
callq 0x4410
jmp 0x53c9
jmp 0x554f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe8(%rbp)
movl %eax, -0xec(%rbp)
leaq -0x261(%rbp), %rdi
callq 0x4490
movl -0xec(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x56d1
movq -0xe8(%rbp), %rdi
callq 0x41c0
movq %rax, -0x270(%rbp)
movq 0x16bc7(%rip), %rdi     # 0x1bfe0
leaq 0xdc95(%rip), %rsi      # 0x130b5
callq 0x4410
movq %rax, -0x300(%rbp)
jmp 0x542e
movq -0x270(%rbp), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
movq -0x300(%rbp), %rdi
movq %rax, %rsi
callq 0x4410
movq %rax, -0x308(%rbp)
jmp 0x5456
movq -0x308(%rbp), %rdi
movq 0x16b14(%rip), %rsi     # 0x1bf78
callq 0x4470
jmp 0x546b
movl $0x4, %edi
callq 0x4540
movq 0x16b24(%rip), %rax     # 0x1bfa0
cmpl $0x3f, (%rax)
jne 0x5494
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x4ee0
jmp 0x548f
jmp 0x554d
movq 0x16b05(%rip), %rax     # 0x1bfa0
movl (%rax), %edi
callq 0x46d0
cmpl $0x0, %eax
je 0x54f9
movq 0x16b32(%rip), %rdi     # 0x1bfe0
leaq 0xdbdb(%rip), %rsi      # 0x13090
callq 0x4410
movq %rax, -0x310(%rbp)
jmp 0x54c3
movq -0x310(%rbp), %rdi
movq 0x16acf(%rip), %rax     # 0x1bfa0
movsbl (%rax), %esi
callq 0x4500
movq %rax, -0x318(%rbp)
jmp 0x54e2
movq -0x318(%rbp), %rdi
leaq 0xdbb2(%rip), %rsi      # 0x130a2
callq 0x4410
jmp 0x54f7
jmp 0x554b
movq 0x16ae0(%rip), %rdi     # 0x1bfe0
leaq 0xdb9f(%rip), %rsi      # 0x130a6
callq 0x4410
movq %rax, -0x320(%rbp)
jmp 0x5515
movq -0x320(%rbp), %rdi
movq 0x16a7d(%rip), %rax     # 0x1bfa0
movsbl (%rax), %esi
callq 0x4500
movq %rax, -0x328(%rbp)
jmp 0x5534
movq -0x328(%rbp), %rdi
leaq 0xdb60(%rip), %rsi      # 0x130a2
callq 0x4410
jmp 0x5549
jmp 0x554b
jmp 0x554d
jmp 0x554f
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x4ee0
jmp 0x555d
jmp 0x555f
movl $0x1, %edi
callq 0x4540
jmp 0x5019
jmp 0x558e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe8(%rbp)
movl %eax, -0xec(%rbp)
callq 0x4670
jmp 0x5589
jmp 0x56d1
leaq -0xb8(%rbp), %rdi
callq 0x8110
jmp 0x559c
movq 0x16a15(%rip), %rax     # 0x1bfb8
movl (%rax), %eax
cmpl -0x8(%rbp), %eax
jge 0x567f
movq -0x10(%rbp), %rax
movq 0x169ff(%rip), %rcx     # 0x1bfb8
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x338(%rbp)
leaq -0x291(%rbp), %rdi
movq %rdi, -0x330(%rbp)
callq 0x46e0
movq -0x338(%rbp), %rsi
movq -0x330(%rbp), %rdx
leaq -0x290(%rbp), %rdi
callq 0x5700
jmp 0x55f6
leaq -0xb8(%rbp), %rdi
leaq -0x290(%rbp), %rsi
callq 0x65a0
jmp 0x560b
leaq -0x290(%rbp), %rdi
callq 0x47a8
leaq -0x291(%rbp), %rdi
callq 0x4490
jmp 0x56b2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe8(%rbp)
movl %eax, -0xec(%rbp)
jmp 0x56d1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe8(%rbp)
movl %eax, -0xec(%rbp)
jmp 0x5671
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe8(%rbp)
movl %eax, -0xec(%rbp)
leaq -0x290(%rbp), %rdi
callq 0x47a8
leaq -0x291(%rbp), %rdi
callq 0x4490
jmp 0x56d1
movq 0x1695a(%rip), %rdi     # 0x1bfe0
leaq 0xda3b(%rip), %rsi      # 0x130c8
callq 0x4410
movq %rax, -0x340(%rbp)
jmp 0x569b
movq -0x340(%rbp), %rdi
movq 0x168cf(%rip), %rsi     # 0x1bf78
callq 0x4470
jmp 0x56b0
jmp 0x56b2
movl $0x0, -0x4(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0x6530
movl -0x4(%rbp), %eax
addq $0x340, %rsp            # imm = 0x340
popq %rbp
retq
leaq -0xb8(%rbp), %rdi
callq 0x6530
movq -0xe8(%rbp), %rdi
callq 0x46c0
movq %rax, %rdi
callq 0x57b0
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)