// File: /workspace/github_cpp_makefile_star2_O2/kingufl[P]Rmapper/src/buildgraph.cpp
// Function: parseArgs(int, char* const*, Args&)
void parseArgs(int argc, char *const argv[], Args &arg)
{
  int c;
  extern char *optarg;
  extern int optind;

  std::string usage("usage: " + std::string(argv[0]) + " infile [-k ksize] [-d dsize] [-f tf] [-l tl] [-r rev] [-o output]\n\n" +
                    "Computes the bi-labelled de Bruijn graph of the error-corrected rmaps in [infile].\n" +
                    "  ksize: [integer] - k-mer size (def. 6)\n" +
                    "  dsize: [integer] - minimum distance between two k-mers in a bi-label. (def. 15000)\n" +
                    "     tf: [integer] - fragment proximal error tollerance. (def. 500)\n" +
                    "     tl: [integer] - length proximal error tollerance. (def. 2000)\n" +
                    "    rev: [boolean] - include reverse rmaps. (def. false)\n" +
                    " output: [string]  - output directory that must exists. (def. .)\n");

  std::string sarg;
  while ((c = getopt(argc, argv, "k:d:f:l:ro:")) != -1)
  {
    switch (c)
    {
    case 'k':
      sarg.assign(optarg);
      arg.k = stoi(sarg);
      break;
    case 'd':
      sarg.assign(optarg);
      arg.d = stoi(sarg);
      break;
    case 'f':
      sarg.assign(optarg);
      arg.tf = stoi(sarg);
      break;
    case 'l':
      sarg.assign(optarg);
      arg.tl = stoi(sarg);
      break;
    case 'r':
      arg.rev = true;
      break;
    case 'o':
      arg.output.assign(optarg);
      break;
    case 'h':
      cerr << usage;
      exit(1);
    case '?':
      cerr << "Unknown option.\n" << usage;
      exit(1);
    }
  }
  // the only input parameter is the file name
  if (argc == optind + 1)
  {
    arg.filename.assign(argv[optind]);
  }
  else
  {
    cerr << "Invalid number of arguments\n" << usage;
    exit(1);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x158, %rsp            # imm = 0x158
movq %rdx, -0x30(%rbp)
movq %rsi, %r14
movl %edi, %r15d
movq (%rsi), %rsi
leaq -0xa0(%rbp), %rdi
leaq -0x31(%rbp), %rdx
callq 0x30d0
leaq 0x9a5e(%rip), %rsi      # 0x10200
leaq -0xc0(%rbp), %rdi
leaq -0xa0(%rbp), %rdx
callq 0xb81a
leaq 0x9a4c(%rip), %rdx      # 0x10208
leaq -0xe0(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0xb7f1
leaq 0x9a77(%rip), %rdx      # 0x1024d
leaq -0x100(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0xb7f1
leaq 0x9ab1(%rip), %rdx      # 0x102a1
leaq -0x120(%rbp), %rdi
leaq -0x100(%rbp), %rsi
callq 0xb7f1
leaq 0x9ac1(%rip), %rdx      # 0x102cb
leaq -0x140(%rbp), %rdi
leaq -0x120(%rbp), %rsi
callq 0xb7f1
leaq 0x9afd(%rip), %rdx      # 0x10321
leaq -0x160(%rbp), %rdi
leaq -0x140(%rbp), %rsi
callq 0xb7f1
leaq 0x9b28(%rip), %rdx      # 0x10366
leaq -0x180(%rbp), %rdi
leaq -0x160(%rbp), %rsi
callq 0xb7f1
leaq 0x9b52(%rip), %rdx      # 0x103aa
leaq -0x60(%rbp), %rdi
leaq -0x180(%rbp), %rsi
callq 0xb7f1
leaq 0x9b75(%rip), %rdx      # 0x103e4
leaq -0x80(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0xb7f1
leaq -0x60(%rbp), %r12
movq %r12, %rdi
callq 0x30f0
leaq -0x180(%rbp), %rdi
callq 0x30f0
leaq -0x160(%rbp), %rdi
callq 0x30f0
leaq -0x140(%rbp), %rdi
callq 0x30f0
leaq -0x120(%rbp), %rdi
callq 0x30f0
leaq -0x100(%rbp), %rdi
callq 0x30f0
leaq -0xe0(%rbp), %rdi
callq 0x30f0
leaq -0xc0(%rbp), %rdi
callq 0x30f0
leaq -0xa0(%rbp), %rdi
callq 0x30f0
leaq -0x50(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq -0x30(%rbp), %rax
addq $0x48, %rax
movq %rax, -0x40(%rbp)
leaq 0x9b1b(%rip), %r13      # 0x10426
leaq 0x989e(%rip), %rbx      # 0x101b0
movl %r15d, %edi
movq %r14, %rsi
movq %r13, %rdx
callq 0x3080
leal -0x64(%rax), %ecx
cmpl $0xe, %ecx
ja 0x6a0c
movslq (%rbx,%rcx,4), %rax
addq %rbx, %rax
jmpq *%rax
movq 0x1166c(%rip), %rax     # 0x17fa8
movq (%rax), %rsi
movq %r12, %rdi
callq 0x33a0
movq %r12, %rdi
xorl %esi, %esi
pushq $0xa
popq %rdx
callq 0xb848
cltq
movq -0x30(%rbp), %rcx
movq %rax, 0x28(%rcx)
jmp 0x6912
movq 0x11641(%rip), %rax     # 0x17fa8
movq (%rax), %rsi
movq -0x40(%rbp), %rdi
callq 0x33a0
jmp 0x6912
movq 0x1162c(%rip), %rax     # 0x17fa8
movq (%rax), %rsi
movq %r12, %rdi
callq 0x33a0
movq %r12, %rdi
xorl %esi, %esi
pushq $0xa
popq %rdx
callq 0xb848
cltq
movq -0x30(%rbp), %rcx
movq %rax, 0x30(%rcx)
jmp 0x6912
movq 0x115fe(%rip), %rax     # 0x17fa8
movq (%rax), %rsi
movq %r12, %rdi
callq 0x33a0
movq %r12, %rdi
xorl %esi, %esi
pushq $0xa
popq %rdx
callq 0xb848
cltq
movq -0x30(%rbp), %rcx
movq %rax, 0x38(%rcx)
jmp 0x6912
movq 0x115d0(%rip), %rax     # 0x17fa8
movq (%rax), %rsi
movq %r12, %rdi
callq 0x33a0
movq %r12, %rdi
xorl %esi, %esi
pushq $0xa
popq %rdx
callq 0xb848
cltq
movq -0x30(%rbp), %rcx
movq %rax, 0x20(%rcx)
jmp 0x6912
movq -0x30(%rbp), %rax
movb $0x1, 0x40(%rax)
jmp 0x6912
cmpl $-0x1, %eax
je 0x6a3b
cmpl $0x3f, %eax
jne 0x6912
movq 0x115cf(%rip), %rdi     # 0x17ff0
leaq 0x9a0a(%rip), %rsi      # 0x10432
callq 0x3220
leaq -0x80(%rbp), %rsi
movq %rax, %rdi
callq 0x3200
jmp 0x6a8e
movq 0x11586(%rip), %rax     # 0x17fc8
movslq (%rax), %rax
leal 0x1(%rax), %ecx
cmpl %r15d, %ecx
jne 0x6a96
movq (%r14,%rax,8), %rsi
movq -0x30(%rbp), %rdi
callq 0x33a0
leaq -0x60(%rbp), %rdi
callq 0x30f0
leaq -0x80(%rbp), %rdi
callq 0x30f0
addq $0x158, %rsp            # imm = 0x158
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x1156b(%rip), %rdi     # 0x17ff0
leaq -0x80(%rbp), %rsi
callq 0x3200
pushq $0x1
popq %rdi
callq 0x3260
movq 0x11553(%rip), %rdi     # 0x17ff0
leaq 0x999f(%rip), %rsi      # 0x10443
callq 0x3220
leaq -0x80(%rbp), %rsi
movq %rax, %rdi
callq 0x3200
jmp 0x6a8e
movq %rax, %rbx
leaq -0x60(%rbp), %rdi
callq 0x30f0
jmp 0x6ac8
movq %rax, %rbx
leaq -0x180(%rbp), %rdi
callq 0x30f0
jmp 0x6ad9
movq %rax, %rbx
leaq -0x160(%rbp), %rdi
callq 0x30f0
jmp 0x6aea
movq %rax, %rbx
leaq -0x140(%rbp), %rdi
callq 0x30f0
jmp 0x6afb
movq %rax, %rbx
leaq -0x120(%rbp), %rdi
callq 0x30f0
leaq -0x100(%rbp), %rdi
callq 0x30f0
leaq -0xe0(%rbp), %rdi
callq 0x30f0
leaq -0xc0(%rbp), %rdi
callq 0x30f0
leaq -0xa0(%rbp), %rdi
jmp 0x6b5f
movq %rax, %rbx
jmp 0x6b07
movq %rax, %rbx
jmp 0x6b13
movq %rax, %rbx
jmp 0x6b1f
movq %rax, %rbx
jmp 0x6b2b
movq %rax, %rbx
jmp 0x6b64
jmp 0x6b4f
movq %rax, %rbx
leaq -0x60(%rbp), %rdi
callq 0x30f0
leaq -0x80(%rbp), %rdi
callq 0x30f0
movq %rbx, %rdi
callq 0x3380