// File: /workspace/github_cpp_makefile_star2_O3/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 0xc72c
leaq 0x5977(%rip), %rsi      # 0x13d00
leaq 0xb0(%rsp), %r15
movl $0xa0, %edx
movq %r15, %rdi
callq 0x31b0
xorl %ebx, %ebx
leaq 0x1601(%rip), %r12      # 0xf9a8
leaq 0xc(%rsp), %r13
movl %ebp, %edi
movq %r14, %rsi
movq %r12, %rdx
movq %r15, %rcx
movq %r13, %r8
callq 0x3440
cmpl $0x71, %eax
jg 0xe3d8
cmpl $-0x1, %eax
je 0xe400
cmpl $0x6f, %eax
je 0xe3f4
cmpl $0x68, %eax
jne 0xe3ac
jmp 0xe478
cmpl $0x72, %eax
je 0xe3eb
cmpl $0x75, %eax
jne 0xe3ac
movb $0x0, 0x5e8f(%rip)      # 0x14278
jmp 0xe3ac
movb $0x1, 0x5e8d(%rip)      # 0x1427f
jmp 0xe3ac
movq 0x5bbd(%rip), %rax      # 0x13fb8
movq (%rax), %rbx
jmp 0xe3ac
movq 0x5bc9(%rip), %rax      # 0x13fd0
cmpl %ebp, (%rax)
jge 0xe478
movslq %ebp, %rax
movq -0x8(%r14,%rax,8), %r14
testq %r14, %r14
je 0xe478
testq %rbx, %rbx
je 0xe478
movq %rbx, %rdi
callq 0xc798
testb %al, %al
jne 0xe44f
leaq 0x20(%rsp), %rsi
movq %rbx, %rdi
callq 0x31f0
movq %rbx, %rdi
testl %eax, %eax
je 0xe487
movl $0x1fd, %esi            # imm = 0x1FD
callq 0x30f0
testl %eax, %eax
jne 0xe4e8
movq %r14, %rdi
movq %rbx, %rsi
callq 0xe23e
leaq 0x10(%rsp), %rdi
callq 0xc746
xorl %eax, %eax
addq $0x158, %rsp            # imm = 0x158
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0xe1f4
movl $0x1, %edi
callq 0x32f0
callq 0x30e0
movq 0x5b35(%rip), %rdi      # 0x13fc8
movq %rbx, %rsi
movq %rax, %rdx
callq 0x32a0
movq 0x5b23(%rip), %rdi      # 0x13fc8
leaq 0x1502(%rip), %rsi      # 0xf9ae
movl $0xe, %edx
callq 0x32a0
movq 0x5b0b(%rip), %rdi      # 0x13fc8
callq 0x3100
movq 0x5aff(%rip), %rdi      # 0x13fc8
leaq 0x14ed(%rip), %rsi      # 0xf9bd
movl $0x31, %edx
callq 0x32a0
movq 0x5ae7(%rip), %rdi      # 0x13fc8
callq 0x3100
jmp 0xe47d
movq 0x5ad9(%rip), %rdi      # 0x13fc8
leaq 0x14f9(%rip), %rsi      # 0xf9ef
movl $0x11, %edx
callq 0x32a0
movq %rbx, %rdi
callq 0x30e0
movq 0x5ab9(%rip), %rdi      # 0x13fc8
movq %rbx, %rsi
movq %rax, %rdx
callq 0x32a0
movq 0x5aa7(%rip), %rdi      # 0x13fc8
callq 0x3100
movq 0x5a9b(%rip), %rdi      # 0x13fc8
leaq 0x14cd(%rip), %rsi      # 0xfa01
movl $0x3d, %edx
callq 0x32a0
movq 0x5a83(%rip), %rdi      # 0x13fc8
callq 0x3100
jmp 0xe47d
jmp 0xe551
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0xc746
movq %rbx, %rdi
callq 0x3460