// File: /workspace/github_c_makefile_star2_O3/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
movl %edi, 0x4(%rsp)
cmpl $0x2, %edi
jl 0x42e5
movq %rsi, %rbx
movl $0x1, %r13d
movslq %r13d, %r14
movq (%rbx,%r14,8), %r12
movzbl (%r12), %ebp
leal -0x2d(%rbp), %r15d
negl %r15d
movl %r15d, %eax
cmpl $0x2d, %ebp
jne 0x3e9d
movzbl 0x1(%r12), %eax
subl $0x63, %eax
jne 0x3e9b
movzbl 0x2(%r12), %eax
negl %eax
testl %eax, %eax
je 0x4195
leaq 0xdb83(%rip), %rdi      # 0x11a2f
movq %r12, %rsi
callq 0x22c0
testl %eax, %eax
je 0x4195
movl %r15d, %eax
cmpb $0x2d, %bpl
jne 0x3ed8
movzbl 0x1(%r12), %eax
subl $0x67, %eax
jne 0x3ed6
movzbl 0x2(%r12), %eax
negl %eax
testl %eax, %eax
je 0x41ad
leaq 0xdb51(%rip), %rdi      # 0x11a38
movq %r12, %rsi
callq 0x22c0
testl %eax, %eax
je 0x41ad
movl %r15d, %eax
cmpb $0x2d, %bpl
jne 0x3f13
movzbl 0x1(%r12), %eax
subl $0x6f, %eax
jne 0x3f11
movzbl 0x2(%r12), %eax
negl %eax
testl %eax, %eax
je 0x41be
leaq 0xdb1e(%rip), %rdi      # 0x11a40
movq %r12, %rsi
callq 0x22c0
testl %eax, %eax
je 0x41be
leaq 0xdb10(%rip), %rdi      # 0x11a49
movq %r12, %rsi
callq 0x22c0
testl %eax, %eax
je 0x41cf
leaq 0xdafd(%rip), %rdi      # 0x11a4d
movq %r12, %rsi
callq 0x22c0
testl %eax, %eax
je 0x41cf
movl %r15d, %eax
cmpb $0x2d, %bpl
jne 0x3f7c
movzbl 0x1(%r12), %eax
subl $0x74, %eax
jne 0x3f7a
movzbl 0x2(%r12), %eax
negl %eax
testl %eax, %eax
je 0x41fd
leaq 0xdad0(%rip), %rdi      # 0x11a5b
movq %r12, %rsi
callq 0x22c0
testl %eax, %eax
je 0x41fd
movl %r15d, %eax
cmpb $0x2d, %bpl
jne 0x3fb7
movzbl 0x1(%r12), %eax
subl $0x73, %eax
jne 0x3fb5
movzbl 0x2(%r12), %eax
negl %eax
testl %eax, %eax
je 0x4212
leaq 0xda9c(%rip), %rdi      # 0x11a62
movq %r12, %rsi
callq 0x22c0
testl %eax, %eax
je 0x4212
movl %r15d, %eax
cmpb $0x2d, %bpl
jne 0x3ff2
movzbl 0x1(%r12), %eax
subl $0x6d, %eax
jne 0x3ff0
movzbl 0x2(%r12), %eax
negl %eax
testl %eax, %eax
je 0x4227
leaq 0xda68(%rip), %rdi      # 0x11a69
movq %r12, %rsi
callq 0x22c0
testl %eax, %eax
je 0x4227
movl %r15d, %eax
cmpb $0x2d, %bpl
jne 0x402d
movzbl 0x1(%r12), %eax
subl $0x66, %eax
jne 0x402b
movzbl 0x2(%r12), %eax
negl %eax
testl %eax, %eax
je 0x424f
leaq 0xda36(%rip), %rdi      # 0x11a72
movq %r12, %rsi
callq 0x22c0
testl %eax, %eax
je 0x424f
movl %r15d, %eax
cmpb $0x2d, %bpl
jne 0x4068
movzbl 0x1(%r12), %eax
subl $0x64, %eax
jne 0x4066
movzbl 0x2(%r12), %eax
negl %eax
testl %eax, %eax
je 0x4282
leaq 0xda04(%rip), %rdi      # 0x11a7b
movq %r12, %rsi
callq 0x22c0
testl %eax, %eax
je 0x4282
movl %r15d, %eax
cmpb $0x2d, %bpl
jne 0x40a3
movzbl 0x1(%r12), %eax
subl $0x75, %eax
jne 0x40a1
movzbl 0x2(%r12), %eax
negl %eax
testl %eax, %eax
je 0x428e
leaq 0xd9d4(%rip), %rdi      # 0x11a86
movq %r12, %rsi
callq 0x22c0
testl %eax, %eax
je 0x428e
cmpb $0x2d, %bpl
jne 0x40dd
movzbl 0x1(%r12), %r15d
subl $0x72, %r15d
jne 0x40da
movzbl 0x2(%r12), %r15d
negl %r15d
testl %r15d, %r15d
je 0x429a
leaq 0xd9a6(%rip), %rdi      # 0x11a93
movq %r12, %rsi
callq 0x22c0
testl %eax, %eax
je 0x429a
leaq 0xd998(%rip), %rdi      # 0x11a9c
movq %r12, %rsi
callq 0x22c0
testl %eax, %eax
je 0x42b3
leaq 0xd985(%rip), %rdi      # 0x11aa0
movq %r12, %rsi
callq 0x22c0
testl %eax, %eax
je 0x42b3
leaq 0xd976(%rip), %rdi      # 0x11aa8
movq %r12, %rsi
callq 0x22c0
testl %eax, %eax
je 0x42cc
leaq 0xd963(%rip), %rdi      # 0x11aac
movq %r12, %rsi
callq 0x22c0
testl %eax, %eax
je 0x42cc
leaq 0xd959(%rip), %rdi      # 0x11ab9
movq %r12, %rsi
callq 0x22c0
testl %eax, %eax
je 0x417f
leaq 0xd94a(%rip), %rdi      # 0x11abd
movq %r12, %rsi
callq 0x22c0
testl %eax, %eax
jne 0x41ea
leal 0x1(%r14), %r13d
movq 0x8(%rbx,%r14,8), %rdi
callq 0x2310
movl %eax, 0x15581(%rip)     # 0x19714
jmp 0x41ea
movb $0x1, 0x15566(%rip)     # 0x19702
incl %r13d
movq 0x8(%rbx,%r14,8), %rsi
leaq 0x14955(%rip), %rdi     # 0x18b00
jmp 0x41e5
incl %r13d
movq 0x8(%rbx,%r14,8), %rsi
leaq 0x14144(%rip), %rdi     # 0x18300
jmp 0x41e5
incl %r13d
movq 0x8(%rbx,%r14,8), %rsi
leaq 0x14d33(%rip), %rdi     # 0x18f00
jmp 0x41e5
movb $0x1, 0x1552b(%rip)     # 0x19701
incl %r13d
movq 0x8(%rbx,%r14,8), %rsi
leaq 0x1511b(%rip), %rdi     # 0x19300
callq 0x21d0
incl %r13d
cmpl 0x4(%rsp), %r13d
jl 0x3e6f
jmp 0x42e5
incl %r13d
movq 0x8(%rbx,%r14,8), %rdi
callq 0x43cc
movl %eax, 0x15520(%rip)     # 0x19730
jmp 0x41ea
incl %r13d
movq 0x8(%rbx,%r14,8), %rdi
callq 0x2310
movl %eax, 0x154df(%rip)     # 0x19704
jmp 0x41ea
movq 0x8(%rbx,%r14,8), %rdi
callq 0x4344
movl %eax, 0x154f1(%rip)     # 0x19728
cmpl $0x2, %eax
je 0x4265
cmpl $0x3, %eax
jne 0x427a
addl $0x2, %r13d
movq 0x10(%rbx,%r14,8), %rsi
jmp 0x41a4
leal 0x1(%r14), %r13d
movq 0x8(%rbx,%r14,8), %rdi
callq 0x4394
movl %eax, 0x154c9(%rip)     # 0x1972c
jmp 0x41ea
addl $0x2, %r13d
movq 0x10(%rbx,%r14,8), %rsi
leaq 0x1448b(%rip), %rdi     # 0x18700
jmp 0x41e5
incl %r13d
jmp 0x41ea
movb $0x1, 0x15477(%rip)     # 0x19700
jmp 0x41ea
movb $0x0, 0x1546b(%rip)     # 0x19700
jmp 0x41ea
leal 0x1(%r14), %r13d
movq 0x8(%rbx,%r14,8), %rdi
callq 0x2310
movl %eax, 0x1545a(%rip)     # 0x19708
jmp 0x41ea
leal 0x1(%r14), %r13d
movq 0x8(%rbx,%r14,8), %rdi
callq 0x2310
movl %eax, 0x15445(%rip)     # 0x1970c
jmp 0x41ea
leal 0x1(%r14), %r13d
movq 0x8(%rbx,%r14,8), %rdi
callq 0x2310
movl %eax, 0x15430(%rip)     # 0x19710
jmp 0x41ea
movl 0x15421(%rip), %edi     # 0x1970c
testl %edi, %edi
jns 0x42f9
xorl %edi, %edi
callq 0x21c0
movq %rax, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xb358