// File: /workspace/github_c_makefile_star2_O2/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
movq %rsi, %rbx
movl %edi, 0x4(%rsp)
pushq $0x1
popq %r13
cmpl 0x4(%rsp), %r13d
jge 0x3f53
movslq %r13d, %r14
movq (%rbx,%r14,8), %r12
movzbl (%r12), %ebp
leal -0x2d(%rbp), %r15d
negl %r15d
movl %r15d, %eax
cmpl $0x2d, %ebp
jne 0x3b1b
movzbl 0x1(%r12), %eax
subl $0x63, %eax
jne 0x3b19
movzbl 0x2(%r12), %eax
negl %eax
testl %eax, %eax
je 0x3e12
leaq 0xcf05(%rip), %rdi      # 0x10a2f
movq %r12, %rsi
callq 0x2300
testl %eax, %eax
je 0x3e12
movl %r15d, %eax
cmpb $0x2d, %bpl
jne 0x3b56
movzbl 0x1(%r12), %eax
subl $0x67, %eax
jne 0x3b54
movzbl 0x2(%r12), %eax
negl %eax
testl %eax, %eax
je 0x3e2a
leaq 0xced3(%rip), %rdi      # 0x10a38
movq %r12, %rsi
callq 0x2300
testl %eax, %eax
je 0x3e2a
movl %r15d, %eax
cmpb $0x2d, %bpl
jne 0x3b91
movzbl 0x1(%r12), %eax
subl $0x6f, %eax
jne 0x3b8f
movzbl 0x2(%r12), %eax
negl %eax
testl %eax, %eax
je 0x3e3b
leaq 0xcea0(%rip), %rdi      # 0x10a40
movq %r12, %rsi
callq 0x2300
testl %eax, %eax
je 0x3e3b
leaq 0xce92(%rip), %rdi      # 0x10a49
movq %r12, %rsi
callq 0x2300
testl %eax, %eax
je 0x3e4c
leaq 0xce7f(%rip), %rdi      # 0x10a4d
movq %r12, %rsi
callq 0x2300
testl %eax, %eax
je 0x3e4c
movl %r15d, %eax
cmpb $0x2d, %bpl
jne 0x3bfa
movzbl 0x1(%r12), %eax
subl $0x74, %eax
jne 0x3bf8
movzbl 0x2(%r12), %eax
negl %eax
testl %eax, %eax
je 0x3e6f
leaq 0xce52(%rip), %rdi      # 0x10a5b
movq %r12, %rsi
callq 0x2300
testl %eax, %eax
je 0x3e6f
movl %r15d, %eax
cmpb $0x2d, %bpl
jne 0x3c35
movzbl 0x1(%r12), %eax
subl $0x73, %eax
jne 0x3c33
movzbl 0x2(%r12), %eax
negl %eax
testl %eax, %eax
je 0x3e84
leaq 0xce1e(%rip), %rdi      # 0x10a62
movq %r12, %rsi
callq 0x2300
testl %eax, %eax
je 0x3e84
movl %r15d, %eax
cmpb $0x2d, %bpl
jne 0x3c70
movzbl 0x1(%r12), %eax
subl $0x6d, %eax
jne 0x3c6e
movzbl 0x2(%r12), %eax
negl %eax
testl %eax, %eax
je 0x3e99
leaq 0xcdea(%rip), %rdi      # 0x10a69
movq %r12, %rsi
callq 0x2300
testl %eax, %eax
je 0x3e99
movl %r15d, %eax
cmpb $0x2d, %bpl
jne 0x3cab
movzbl 0x1(%r12), %eax
subl $0x66, %eax
jne 0x3ca9
movzbl 0x2(%r12), %eax
negl %eax
testl %eax, %eax
je 0x3ec1
leaq 0xcdb8(%rip), %rdi      # 0x10a72
movq %r12, %rsi
callq 0x2300
testl %eax, %eax
je 0x3ec1
movl %r15d, %eax
cmpb $0x2d, %bpl
jne 0x3ce6
movzbl 0x1(%r12), %eax
subl $0x64, %eax
jne 0x3ce4
movzbl 0x2(%r12), %eax
negl %eax
testl %eax, %eax
je 0x3ef3
leaq 0xcd86(%rip), %rdi      # 0x10a7b
movq %r12, %rsi
callq 0x2300
testl %eax, %eax
je 0x3ef3
movl %r15d, %eax
cmpb $0x2d, %bpl
jne 0x3d21
movzbl 0x1(%r12), %eax
subl $0x75, %eax
jne 0x3d1f
movzbl 0x2(%r12), %eax
negl %eax
testl %eax, %eax
je 0x3eff
leaq 0xcd56(%rip), %rdi      # 0x10a86
movq %r12, %rsi
callq 0x2300
testl %eax, %eax
je 0x3eff
cmpb $0x2d, %bpl
jne 0x3d5b
movzbl 0x1(%r12), %r15d
subl $0x72, %r15d
jne 0x3d58
movzbl 0x2(%r12), %r15d
negl %r15d
testl %r15d, %r15d
je 0x3f0b
leaq 0xcd28(%rip), %rdi      # 0x10a93
movq %r12, %rsi
callq 0x2300
testl %eax, %eax
je 0x3f0b
leaq 0xcd1a(%rip), %rdi      # 0x10a9c
movq %r12, %rsi
callq 0x2300
testl %eax, %eax
je 0x3f23
leaq 0xcd07(%rip), %rdi      # 0x10aa0
movq %r12, %rsi
callq 0x2300
testl %eax, %eax
je 0x3f23
leaq 0xccf8(%rip), %rdi      # 0x10aa8
movq %r12, %rsi
callq 0x2300
testl %eax, %eax
je 0x3f3b
leaq 0xcce5(%rip), %rdi      # 0x10aac
movq %r12, %rsi
callq 0x2300
testl %eax, %eax
je 0x3f3b
leaq 0xccdb(%rip), %rdi      # 0x10ab9
movq %r12, %rsi
callq 0x2300
testl %eax, %eax
je 0x3dfd
leaq 0xcccc(%rip), %rdi      # 0x10abd
movq %r12, %rsi
callq 0x2300
testl %eax, %eax
jne 0x3e67
incl %r13d
movq 0x8(%rbx,%r14,8), %rdi
callq 0x2350
movl %eax, 0x15924(%rip)     # 0x19734
jmp 0x3e67
movb $0x1, 0x15909(%rip)     # 0x19722
incl %r13d
movq 0x8(%rbx,%r14,8), %rsi
leaq 0x14cf8(%rip), %rdi     # 0x18b20
jmp 0x3e62
incl %r13d
movq 0x8(%rbx,%r14,8), %rsi
leaq 0x144e7(%rip), %rdi     # 0x18320
jmp 0x3e62
incl %r13d
movq 0x8(%rbx,%r14,8), %rsi
leaq 0x150d6(%rip), %rdi     # 0x18f20
jmp 0x3e62
movb $0x1, 0x158ce(%rip)     # 0x19721
incl %r13d
movq 0x8(%rbx,%r14,8), %rsi
leaq 0x154be(%rip), %rdi     # 0x19320
callq 0x21e0
incl %r13d
jmp 0x3ae2
incl %r13d
movq 0x8(%rbx,%r14,8), %rdi
callq 0x4034
movl %eax, 0x158ce(%rip)     # 0x19750
jmp 0x3e67
incl %r13d
movq 0x8(%rbx,%r14,8), %rdi
callq 0x2350
movl %eax, 0x1588d(%rip)     # 0x19724
jmp 0x3e67
movq 0x8(%rbx,%r14,8), %rdi
callq 0x3fb2
movl %eax, 0x1589f(%rip)     # 0x19748
cmpl $0x2, %eax
je 0x3ed6
cmpl $0x3, %eax
jne 0x3eeb
addl $0x2, %r13d
movq 0x10(%rbx,%r14,8), %rsi
jmp 0x3e21
incl %r13d
movq 0x8(%rbx,%r14,8), %rdi
callq 0x3ffe
movl %eax, 0x15878(%rip)     # 0x1974c
jmp 0x3e67
addl $0x2, %r13d
movq 0x10(%rbx,%r14,8), %rsi
leaq 0x1483a(%rip), %rdi     # 0x18720
jmp 0x3e62
incl %r13d
jmp 0x3e67
movb $0x1, 0x15826(%rip)     # 0x19720
jmp 0x3e67
movb $0x0, 0x1581a(%rip)     # 0x19720
jmp 0x3e67
incl %r13d
movq 0x8(%rbx,%r14,8), %rdi
callq 0x2350
movl %eax, 0x1580a(%rip)     # 0x19728
jmp 0x3e67
incl %r13d
movq 0x8(%rbx,%r14,8), %rdi
callq 0x2350
movl %eax, 0x157f6(%rip)     # 0x1972c
jmp 0x3e67
incl %r13d
movq 0x8(%rbx,%r14,8), %rdi
callq 0x2350
movl %eax, 0x157e2(%rip)     # 0x19730
jmp 0x3e67
movl 0x157d3(%rip), %edi     # 0x1972c
testl %edi, %edi
jns 0x3f67
xorl %edi, %edi
callq 0x21d0
movq %rax, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xaaf8