// File: /workspace/github_c_makefile_star2_O1/ComplexNetworks-DCC-FCUP[P]gtrieScanner/CmdLine.cpp
// Function: CmdLine::parse_cmdargs(int, char**)
void CmdLine::parse_cmdargs(int argc, char **argv) {
    
  for (int i=1; i<argc; i++) {

    // Create g-trie ?
    if (!strcmp("-c",argv[i]) || !strcmp("--create",argv[i])) {
      create=true;
      strcpy(subgraphs_file, argv[++i]);
    }
    
    // Graph file
    else if (!strcmp("-g",argv[i]) || !strcmp("--graph",argv[i])) {
      strcpy(graph_file, argv[++i]);
    }

    // Output file
    else if (!strcmp("-o",argv[i]) || !strcmp("--output",argv[i])) {
      strcpy(output_file, argv[++i]);
    }

    // Output file
    else if (!strcmp("-oc",argv[i]) || !strcmp("--occurrences",argv[i])) {
      occurrences = true;
      strcpy(occ_file, argv[++i]);
    }

    // Output format
    else if (!strcmp("-t",argv[i]) || !strcmp("--type",argv[i])) {
      output = str_to_output(argv[++i]);
    }

    // Size of motifs to consider
    else if (!strcmp("-s",argv[i]) || !strcmp("--size",argv[i])) {
      motif_size = atoi(argv[++i]);
    }

    // Method for set of subgraphs
    else if (!strcmp("-m",argv[i]) || !strcmp("--method",argv[i])) {
      method = str_to_method(argv[++i]);
      if (method == SUBGRAPHS) strcpy(subgraphs_file, argv[++i]);
      else if (method == GTRIE) strcpy(gtrie_file, argv[++i]);
    }

    // Graph format
    else if (!strcmp("-f",argv[i]) || !strcmp("--format",argv[i])) {
      format = str_to_format(argv[++i]);
    }
    
    // Directed Graph
    else if (!strcmp("-d",argv[i]) || !strcmp("--directed",argv[i])) {
      dir=true;
    }

    // Undirected Graph
    else if (!strcmp("-u",argv[i]) || !strcmp("--undirected",argv[i])) {
      dir=false;
    }

    // Number of random networks
    else if (!strcmp("-r",argv[i]) || !strcmp("--random",argv[i])) {
      random_number = atoi(argv[++i]);
    }

    // Random seed
    else if (!strcmp("-rs",argv[i]) || !strcmp("--rseed",argv[i])) {
      random_seed = atoi(argv[++i]);
    }

    // Number of exchanges per edge
    else if (!strcmp("-re",argv[i]) || !strcmp("--rexchanges",argv[i])) {
      random_exchanges = atoi(argv[++i]);
    }

    // Number of tries per node
    else if (!strcmp("-rt",argv[i]) || !strcmp("--rtries",argv[i])) {
      random_tries = atoi(argv[++i]);
    }

  }

  // If no random seed given, initialize with time
  // (not an optimal choice, but present here for portability)
  if (random_seed<0) Random::seed(time(NULL));
  else               Random::seed(random_seed);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
cmpl $0x2, %edi
jl 0x4254
movq %rsi, %rbx
movl %edi, %ebp
movl $0x1, %r15d
leaq 0xdbc3(%rip), %r14      # 0x11a2f
movslq %r15d, %r12
movq (%rbx,%r12,8), %r13
movq %r14, %rdi
movq %r13, %rsi
callq 0x22c0
testl %eax, %eax
je 0x4102
leaq 0xdba5(%rip), %rdi      # 0x11a32
movq %r13, %rsi
callq 0x22c0
testl %eax, %eax
je 0x4102
leaq 0xdb97(%rip), %rdi      # 0x11a3b
movq %r13, %rsi
callq 0x22c0
testl %eax, %eax
je 0x411a
leaq 0xdb83(%rip), %rdi      # 0x11a3e
movq %r13, %rsi
callq 0x22c0
testl %eax, %eax
je 0x411a
leaq 0xdb74(%rip), %rdi      # 0x11a46
movq %r13, %rsi
callq 0x22c0
testl %eax, %eax
je 0x412b
leaq 0xdb60(%rip), %rdi      # 0x11a49
movq %r13, %rsi
callq 0x22c0
testl %eax, %eax
je 0x412b
leaq 0xdb52(%rip), %rdi      # 0x11a52
movq %r13, %rsi
callq 0x22c0
testl %eax, %eax
je 0x413c
leaq 0xdb3f(%rip), %rdi      # 0x11a56
movq %r13, %rsi
callq 0x22c0
testl %eax, %eax
je 0x413c
leaq 0xdb36(%rip), %rdi      # 0x11a64
movq %r13, %rsi
callq 0x22c0
testl %eax, %eax
je 0x4168
leaq 0xdb22(%rip), %rdi      # 0x11a67
movq %r13, %rsi
callq 0x22c0
testl %eax, %eax
je 0x4168
leaq 0xdb12(%rip), %rdi      # 0x11a6e
movq %r13, %rsi
callq 0x22c0
testl %eax, %eax
je 0x417d
leaq 0xdafe(%rip), %rdi      # 0x11a71
movq %r13, %rsi
callq 0x22c0
testl %eax, %eax
je 0x417d
leaq 0xdaee(%rip), %rdi      # 0x11a78
movq %r13, %rsi
callq 0x22c0
testl %eax, %eax
je 0x4192
leaq 0xdada(%rip), %rdi      # 0x11a7b
movq %r13, %rsi
callq 0x22c0
testl %eax, %eax
je 0x4192
leaq 0xdacc(%rip), %rdi      # 0x11a84
movq %r13, %rsi
callq 0x22c0
testl %eax, %eax
je 0x41ba
leaq 0xdab8(%rip), %rdi      # 0x11a87
movq %r13, %rsi
callq 0x22c0
testl %eax, %eax
je 0x41ba
leaq 0xdaaa(%rip), %rdi      # 0x11a90
movq %r13, %rsi
callq 0x22c0
testl %eax, %eax
je 0x41ee
leaq 0xda96(%rip), %rdi      # 0x11a93
movq %r13, %rsi
callq 0x22c0
testl %eax, %eax
je 0x41ee
leaq 0xda8a(%rip), %rdi      # 0x11a9e
movq %r13, %rsi
callq 0x22c0
testl %eax, %eax
je 0x41fa
leaq 0xda76(%rip), %rdi      # 0x11aa1
movq %r13, %rsi
callq 0x22c0
testl %eax, %eax
je 0x41fa
leaq 0xda6c(%rip), %rdi      # 0x11aae
movq %r13, %rsi
callq 0x22c0
testl %eax, %eax
je 0x4206
leaq 0xda58(%rip), %rdi      # 0x11ab1
movq %r13, %rsi
callq 0x22c0
testl %eax, %eax
je 0x4206
leaq 0xda4a(%rip), %rdi      # 0x11aba
movq %r13, %rsi
callq 0x22c0
testl %eax, %eax
je 0x4220
leaq 0xda37(%rip), %rdi      # 0x11abe
movq %r13, %rsi
callq 0x22c0
testl %eax, %eax
je 0x4220
leaq 0xda28(%rip), %rdi      # 0x11ac6
movq %r13, %rsi
callq 0x22c0
testl %eax, %eax
je 0x423a
leaq 0xda15(%rip), %rdi      # 0x11aca
movq %r13, %rsi
callq 0x22c0
testl %eax, %eax
je 0x423a
leaq 0xda0b(%rip), %rdi      # 0x11ad7
movq %r13, %rsi
callq 0x22c0
testl %eax, %eax
je 0x40eb
leaq 0xd9fc(%rip), %rdi      # 0x11adb
movq %r13, %rsi
callq 0x22c0
testl %eax, %eax
jne 0x4157
leal 0x1(%r12), %r15d
movq 0x8(%rbx,%r12,8), %rdi
callq 0x2310
movl %eax, 0x15614(%rip)     # 0x19714
jmp 0x4157
movb $0x1, 0x155f9(%rip)     # 0x19702
incl %r15d
movq 0x8(%rbx,%r12,8), %rsi
leaq 0x149e8(%rip), %rdi     # 0x18b00
jmp 0x4152
incl %r15d
movq 0x8(%rbx,%r12,8), %rsi
leaq 0x141d7(%rip), %rdi     # 0x18300
jmp 0x4152
incl %r15d
movq 0x8(%rbx,%r12,8), %rsi
leaq 0x14dc6(%rip), %rdi     # 0x18f00
jmp 0x4152
movb $0x1, 0x155be(%rip)     # 0x19701
incl %r15d
movq 0x8(%rbx,%r12,8), %rsi
leaq 0x151ae(%rip), %rdi     # 0x19300
callq 0x21d0
incl %r15d
cmpl %ebp, %r15d
jl 0x3e6c
jmp 0x4254
incl %r15d
movq 0x8(%rbx,%r12,8), %rdi
callq 0x433c
movl %eax, 0x155b5(%rip)     # 0x19730
jmp 0x4157
incl %r15d
movq 0x8(%rbx,%r12,8), %rdi
callq 0x2310
movl %eax, 0x15574(%rip)     # 0x19704
jmp 0x4157
movq 0x8(%rbx,%r12,8), %rdi
callq 0x42b4
movl %eax, 0x15586(%rip)     # 0x19728
cmpl $0x2, %eax
je 0x41d1
cmpl $0x3, %eax
jne 0x41e6
addl $0x2, %r15d
movq 0x10(%rbx,%r12,8), %rsi
jmp 0x4111
leal 0x1(%r12), %r15d
movq 0x8(%rbx,%r12,8), %rdi
callq 0x4304
movl %eax, 0x1555d(%rip)     # 0x1972c
jmp 0x4157
addl $0x2, %r15d
movq 0x10(%rbx,%r12,8), %rsi
leaq 0x1451f(%rip), %rdi     # 0x18700
jmp 0x4152
incl %r15d
jmp 0x4157
movb $0x1, 0x1550b(%rip)     # 0x19700
jmp 0x4157
movb $0x0, 0x154ff(%rip)     # 0x19700
jmp 0x4157
leal 0x1(%r12), %r15d
movq 0x8(%rbx,%r12,8), %rdi
callq 0x2310
movl %eax, 0x154ed(%rip)     # 0x19708
jmp 0x4157
leal 0x1(%r12), %r15d
movq 0x8(%rbx,%r12,8), %rdi
callq 0x2310
movl %eax, 0x154d7(%rip)     # 0x1970c
jmp 0x4157
leal 0x1(%r12), %r15d
movq 0x8(%rbx,%r12,8), %rdi
callq 0x2310
movl %eax, 0x154c1(%rip)     # 0x19710
jmp 0x4157
movl 0x154b2(%rip), %edi     # 0x1970c
testl %edi, %edi
jns 0x4268
xorl %edi, %edi
callq 0x21c0
movq %rax, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xb1dc
nop