// File: /workspace/github_cpp_makefile_star2_O1/4n6ist[P]usn_analytics/src/main.cpp
// Function: main
int main(int argc, char **argv) {
    
  char *ifname = NULL;
  char *odname = NULL;
  timer measure_time;

  int opt;
  int longindex;
  
  struct option longopts[] = {
    {"help", no_argument, NULL, 'h'},
    {"output", required_argument, NULL, 'o'},
    {"raw", no_argument, NULL, 'r'}, 
    {"utc", no_argument, NULL, 'u'}, 
    {0, 0, 0, 0},
  };

  while((opt = getopt_long(argc, argv, "ho:ru", longopts, &longindex)) != -1) {
    switch(opt) {     
      case 'h':
        usage();
        exit(EXIT_FAILURE);
      case 'o':
        odname = optarg;
        break;
      case 'r':
        raw = true;
        break;
      case 'u':
        lt = false;
        break;
    }
  }
  for (int i = optind; i < argc; i++)
    ifname = argv[i];

  if (!ifname || !odname) {
    usage();
    exit(EXIT_FAILURE);
  }
  
  struct stat st;
  if (is_empty_dir(odname) == false) {
    if (stat(odname, &st) == 0) {
      std::cout << odname << " already exist" << std::endl;
      std::cout << "Please specify a empty directory or new directory" << std::endl;
      exit(EXIT_FAILURE);
    }
    int dresult;
    // try to create directory
#ifdef _WIN32
    dresult = _mkdir(odname);
#else
    dresult = mkdir(odname, 0775);
#endif

    if(dresult != 0) {
      std::cout << "unable to create " << odname << std::endl;
      std::cout << "Please check existence of parent directory and/or permissions" << std::endl;
      exit(EXIT_FAILURE);
    }
  } 

  process(ifname, odname);
  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x158, %rsp            # imm = 0x158
movq %rsi, %r14
movl %edi, %ebp
leaq 0x10(%rsp), %rdi
callq 0xc734
leaq 0x594b(%rip), %rsi      # 0x13d00
leaq 0xb0(%rsp), %r15
movl $0xa0, %edx
movq %r15, %rdi
callq 0x31b0
xorl %ebx, %ebx
leaq 0x15d6(%rip), %r12      # 0xf9a9
leaq 0xc(%rsp), %r13
movl %ebp, %edi
movq %r14, %rsi
movq %r12, %rdx
movq %r15, %rcx
movq %r13, %r8
callq 0x3450
cmpl $0x71, %eax
jg 0xe404
cmpl $-0x1, %eax
je 0xe42c
cmpl $0x6f, %eax
je 0xe420
cmpl $0x68, %eax
jne 0xe3d8
jmp 0xe4aa
cmpl $0x72, %eax
je 0xe417
cmpl $0x75, %eax
jne 0xe3d8
movb $0x0, 0x5e6b(%rip)      # 0x14280
jmp 0xe3d8
movb $0x1, 0x5e69(%rip)      # 0x14287
jmp 0xe3d8
movq 0x5b91(%rip), %rax      # 0x13fb8
movq (%rax), %rbx
jmp 0xe3d8
movq 0x5b9d(%rip), %rax      # 0x13fd0
cmpl %ebp, (%rax)
jge 0xe442
decl %ebp
movslq %ebp, %rax
movq (%r14,%rax,8), %r14
jmp 0xe445
xorl %r14d, %r14d
testq %r14, %r14
je 0xe4aa
testq %rbx, %rbx
je 0xe4aa
movq %rbx, %rdi
callq 0xc7a0
testb %al, %al
jne 0xe481
leaq 0x20(%rsp), %rsi
movq %rbx, %rdi
callq 0x31f0
movq %rbx, %rdi
testl %eax, %eax
je 0xe4b9
movl $0x1fd, %esi            # imm = 0x1FD
callq 0x30f0
testl %eax, %eax
jne 0xe51a
movq %r14, %rdi
movq %rbx, %rsi
callq 0xe26a
leaq 0x10(%rsp), %rdi
callq 0xc74e
xorl %eax, %eax
addq $0x158, %rsp            # imm = 0x158
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0xe220
movl $0x1, %edi
callq 0x32f0
callq 0x30e0
movq 0x5b03(%rip), %rdi      # 0x13fc8
movq %rbx, %rsi
movq %rax, %rdx
callq 0x32a0
movq 0x5af1(%rip), %rdi      # 0x13fc8
leaq 0x14d1(%rip), %rsi      # 0xf9af
movl $0xe, %edx
callq 0x32a0
movq 0x5ad9(%rip), %rdi      # 0x13fc8
callq 0x3100
movq 0x5acd(%rip), %rdi      # 0x13fc8
leaq 0x14bc(%rip), %rsi      # 0xf9be
movl $0x31, %edx
callq 0x32a0
movq 0x5ab5(%rip), %rdi      # 0x13fc8
callq 0x3100
jmp 0xe4af
movq 0x5aa7(%rip), %rdi      # 0x13fc8
leaq 0x14c8(%rip), %rsi      # 0xf9f0
movl $0x11, %edx
callq 0x32a0
movq %rbx, %rdi
callq 0x30e0
movq 0x5a87(%rip), %rdi      # 0x13fc8
movq %rbx, %rsi
movq %rax, %rdx
callq 0x32a0
movq 0x5a75(%rip), %rdi      # 0x13fc8
callq 0x3100
movq 0x5a69(%rip), %rdi      # 0x13fc8
leaq 0x149c(%rip), %rsi      # 0xfa02
movl $0x3d, %edx
callq 0x32a0
movq 0x5a51(%rip), %rdi      # 0x13fc8
callq 0x3100
jmp 0xe4af
jmp 0xe583
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0xc74e
movq %rbx, %rdi
callq 0x3470