// File: /workspace/github_c_makefile_star2_O3/jsh58[P]Genrich/Genrich.c
// Function: getArgs
void getArgs(int argc, char** argv) {

  // default parameters/filenames
  char* outFile = NULL, *inFile = NULL, *ctrlFile = NULL,
    *logFile = NULL, *pileFile = NULL, *bedFile = NULL,
    *xFile = NULL, *dupsFile = NULL;
  char* xchrom = NULL;
  uint64_t genomeLen = 0;
  int extend = 0, minMapQ = 0, minLen = DEFMINLEN,
    maxGap = DEFMAXGAP, atacLen5 = DEFATAC, atacLen3 = 0;
  float asDiff = 0.0f, pqvalue = DEFPVAL, minAUC = DEFAUC;
  bool singleOpt = false, extendOpt = false,
    avgExtOpt = false, atacOpt = false, atacAdj = true,
    gzOut = false, qvalOpt = false, dupsOpt = false,
    peaksOpt = true, peaksOnly = false, sortOpt = true;
  bool verbose = false;

  // parse argv
  int c;
  while ( (c = getopt_long(argc, argv, OPTIONS, long_options, NULL)) != -1 )
    switch (c) {
      case INFILE: inFile = optarg; break;
      case CTRLFILE: ctrlFile = optarg; break;
      case OUTFILE: outFile = optarg; break;
      case LOGFILE: logFile = optarg; break;
      case PILEFILE: pileFile = optarg; break;
      case BEDFILE: bedFile = optarg; break;
      case GZOPT: gzOut = true; break;
      case UNPAIROPT: singleOpt = true; break;
      case EXTENDOPT: extend = getInt(optarg); extendOpt = true; break;
      case AVGEXTOPT: avgExtOpt = true; break;
      case ATACOPT: atacOpt = true; break;
      case ATACLEN: atacLen5 = getInt(optarg); break;
      case DNASEOPT: atacAdj = false; break;
      case XCHROM: xchrom = optarg; break;
      case XFILE: xFile = optarg; break;
      case MINMAPQ: minMapQ = getInt(optarg); break;
      case ASDIFF: asDiff = getFloat(optarg); break;
      case PVALUE: pqvalue = getFloat(optarg); break;
      case QVALUE: pqvalue = getFloat(optarg); qvalOpt = true; break;
      case MINAUC: minAUC = getFloat(optarg); break;
      case MINLEN: minLen = getInt(optarg); break;
      case MAXGAP: maxGap = getInt(optarg); break;
      case DUPSOPT: dupsOpt = true; break;
      case DUPSFILE: dupsFile = optarg; break;
      case NOPEAKS: peaksOpt = false; break;
      case PEAKSONLY: peaksOnly = true; break;
      case SORTOPT: sortOpt = false; break;
      case GENOMELEN: genomeLen = getLong(optarg); break;
      case VERBOSE: verbose = true; break;
      case VERSOPT: printVersion(); break;
      case HELP: usage(); break;
      default: exit(EXIT_FAILURE);
    }
  if (optind < argc)
    exit(error(argv[optind], ERRPARAM));

  // check for argument errors
  if ((peaksOpt && outFile == NULL)
      || (peaksOnly && logFile == NULL)
      || (!peaksOnly && inFile == NULL)) {
    error("", ERRFILE);
    usage();
  }
  if (avgExtOpt) {
    singleOpt = true;
    extendOpt = false; // avgExtOpt takes precedence
  }
  if (extendOpt) {
    singleOpt = true;
    if (extend <= 0)
      exit(error("", ERREXTEND));
  }
  if (atacOpt) {
    avgExtOpt = extendOpt = false;  // no unpaired extensions in ATAC-seq mode
    if (atacLen5 <= 0)
      exit(error("", ERRATAC));
    // split atacLen into atacLen5 and atacLen3
    atacLen3 = (int) (atacLen5 / 2.0f + 0.5f);  // round up for 3' end
    atacLen5 /= 2;
  }
  if (minLen < 0)
    exit(error("", ERRMINLEN));
  if (minAUC < 0.0f)
    exit(error("", ERRMINAUC));
  if (asDiff < 0.0f)
    exit(error("", ERRASDIFF));
  if (genomeLen < 0)
    exit(error("", ERRGENLEN));

  // save list of chromosomes to exclude
  int xcount = 0;
  char** xchrList = NULL;
  if (xchrom != NULL)
    xcount = saveXChrom(xchrom, &xchrList);

  // adjust significance level to -log scale
  if (pqvalue <= 0.0f || pqvalue > 1.0f)
    exit(error("", ERRPQVAL));
  pqvalue = -log10f(pqvalue);

  // send arguments to runProgram()
  runProgram(inFile, ctrlFile, outFile, logFile, pileFile,
    bedFile, gzOut, singleOpt, extendOpt, extend,
    avgExtOpt, minMapQ, xcount, xchrList, xFile, pqvalue,
    qvalOpt, minLen, maxGap, minAUC, asDiff,
    atacOpt, atacLen5, atacLen3, atacAdj, dupsOpt,
    dupsFile, peaksOpt, peaksOnly, sortOpt, genomeLen,
    verbose);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movq %rsi, %r12
movl %edi, %ebp
movb $0x1, %al
movl %eax, 0x38(%rsp)
movss 0x14bd(%rip), %xmm0     # 0x1217c
movss %xmm0, 0x4(%rsp)
movss 0x14b3(%rip), %xmm0     # 0x12180
movss %xmm0, 0x28(%rsp)
xorps %xmm0, %xmm0
movss %xmm0, (%rsp)
movl $0x64, %eax
movq %rax, 0xd0(%rsp)
movq $0x0, 0x70(%rsp)
leaq 0x3250(%rip), %r14      # 0x13f48
leaq 0x9601(%rip), %r13      # 0x1a300
leaq 0x16ae(%rip), %r15      # 0x123b4
movq $0x0, 0xb0(%rsp)
movq $0x0, 0x68(%rsp)
movq $0x0, 0xa0(%rsp)
movq $0x0, 0x98(%rsp)
movq $0x0, 0xc8(%rsp)
movq $0x0, 0xb8(%rsp)
movq $0x0, 0x10(%rsp)
movq $0x0, 0xa8(%rsp)
movq $0x0, 0x50(%rsp)
movq $0x0, 0xc0(%rsp)
movq $0x0, 0x58(%rsp)
movl $0x64, %eax
movq %rax, 0x20(%rsp)
movq $0x0, 0x18(%rsp)
movq $0x0, 0x40(%rsp)
movl $0x0, 0x8(%rsp)
movq $0x0, 0x48(%rsp)
xorl %eax, %eax
movq $0x0, 0x90(%rsp)
movq $0x0, 0x88(%rsp)
movb $0x1, %cl
movl %ecx, 0x3c(%rsp)
movq $0x0, 0xd8(%rsp)
movb $0x1, %cl
movl %ecx, 0x34(%rsp)
movq $0x0, 0x80(%rsp)
movq $0x0, 0x60(%rsp)
movl %eax, %ebx
movl %ebp, %edi
movq %r12, %rsi
movq %r14, %rdx
movq %r13, %rcx
xorl %r8d, %r8d
callq 0x2100
leal -0x44(%rax), %ecx
cmpl $0x36, %ecx
ja 0x1109b
movslq (%r15,%rcx,4), %rcx
addq %r15, %rcx
movb $0x1, %al
jmpq *%rcx
movl $0x0, 0x38(%rsp)
movl %ebx, %eax
jmp 0x10df2
movq 0x91a7(%rip), %rax      # 0x19fd8
movq (%rax), %rdi
callq 0x3937
movss %xmm0, (%rsp)
movl %ebx, %eax
jmp 0x10df2
movq 0x918f(%rip), %rax      # 0x19fd8
movq (%rax), %rdi
callq 0x3937
movss %xmm0, 0x28(%rsp)
movl %ebx, %eax
jmp 0x10df2
movb $0x1, %al
movq %rax, 0x80(%rsp)
movl %ebx, %eax
jmp 0x10df2
movq 0x9168(%rip), %rax      # 0x19fd8
movq (%rax), %rax
movq %rax, 0x68(%rsp)
movl %ebx, %eax
jmp 0x10df2
movq 0x9152(%rip), %rax      # 0x19fd8
movq (%rax), %rdi
callq 0x3961
movq %rax, 0x58(%rsp)
movl %ebx, %eax
jmp 0x10df2
movb $0x1, %al
movq %rax, 0x48(%rsp)
movl %ebx, %eax
jmp 0x10df2
movl $0x0, 0x3c(%rsp)
movl %ebx, %eax
jmp 0x10df2
movq 0x911a(%rip), %rax      # 0x19fd8
movq (%rax), %rdi
callq 0x3961
movq %rax, 0x20(%rsp)
movl %ebx, %eax
jmp 0x10df2
movb $0x1, %al
movq %rax, 0xd8(%rsp)
movl %ebx, %eax
jmp 0x10df2
movq 0x90ee(%rip), %rax      # 0x19fd8
movq (%rax), %rax
movq %rax, 0x60(%rsp)
movl %ebx, %eax
jmp 0x10df2
movq 0x90d8(%rip), %rax      # 0x19fd8
movq (%rax), %rax
movq %rax, 0xa0(%rsp)
movl %ebx, %eax
jmp 0x10df2
movq 0x90bf(%rip), %rax      # 0x19fd8
movq (%rax), %rdi
callq 0x3937
movss %xmm0, 0x4(%rsp)
movl %ebx, %eax
jmp 0x10df2
movq 0x90a3(%rip), %rax      # 0x19fd8
movq (%rax), %rax
movq %rax, 0xb8(%rsp)
movl %ebx, %eax
jmp 0x10df2
movq 0x908a(%rip), %rax      # 0x19fd8
movq (%rax), %rdi
callq 0x3990
movq %rax, 0xa8(%rsp)
movl %ebx, %eax
jmp 0x10df2
movq 0x906c(%rip), %rax      # 0x19fd8
movq (%rax), %rax
movq %rax, 0xb0(%rsp)
movl %ebx, %eax
jmp 0x10df2
movl $0x0, 0x34(%rsp)
movl %ebx, %eax
jmp 0x10df2
movq 0x9044(%rip), %rax      # 0x19fd8
movq (%rax), %rax
movq %rax, 0xc8(%rsp)
movl %ebx, %eax
jmp 0x10df2
movb $0x1, %al
movq %rax, 0x18(%rsp)
movl %ebx, %eax
jmp 0x10df2
movq 0x901d(%rip), %rax      # 0x19fd8
movq (%rax), %rax
movq %rax, 0x98(%rsp)
movl %ebx, %eax
jmp 0x10df2
movq 0x9004(%rip), %rax      # 0x19fd8
movq (%rax), %rax
movq %rax, 0x10(%rsp)
movl %ebx, %eax
jmp 0x10df2
movq 0x8fee(%rip), %rax      # 0x19fd8
movq (%rax), %rdi
callq 0x3961
movq %rax, 0xc0(%rsp)
movl %ebx, %eax
jmp 0x10df2
movq 0x8fd0(%rip), %rax      # 0x19fd8
movq (%rax), %rdi
callq 0x3961
movq %rax, 0xd0(%rsp)
movl %ebx, %eax
jmp 0x10df2
movq 0x8fb2(%rip), %rax      # 0x19fd8
movq (%rax), %rdi
callq 0x3961
movq %rax, 0x50(%rsp)
movb $0x1, %al
movq %rax, 0x40(%rsp)
movl %ebx, %eax
jmp 0x10df2
movq 0x8f90(%rip), %rax      # 0x19fd8
movq (%rax), %rdi
callq 0x3937
movss %xmm0, 0x28(%rsp)
movb $0x1, %al
movq %rax, 0x90(%rsp)
movl %ebx, %eax
jmp 0x10df2
movq 0x8f6a(%rip), %rax      # 0x19fd8
movq (%rax), %rax
movq %rax, 0x70(%rsp)
movl %ebx, %eax
jmp 0x10df2
movb $0x1, %al
movl %eax, 0x8(%rsp)
movl %ebx, %eax
jmp 0x10df2
movb $0x1, %al
movq %rax, 0x88(%rsp)
movl %ebx, %eax
jmp 0x10df2
cmpl $-0x1, %eax
jne 0x11331
movq 0x8f25(%rip), %rax      # 0x19fd0
movl (%rax), %edi
cmpl %ebp, %edi
jl 0x11345
cmpq $0x0, 0x60(%rsp)
sete %cl
movq 0xd8(%rsp), %r15
testb $0x1, %r15b
movq 0x70(%rsp), %rax
cmovneq 0x68(%rsp), %rax
movl 0x3c(%rsp), %ebp
testb %cl, %bpl
movq 0x48(%rsp), %r14
jne 0x1134d
testq %rax, %rax
je 0x1134d
movzbl 0x40(%rsp), %esi
xorl %edx, %edx
movl 0x8(%rsp), %ecx
testb $0x1, %cl
cmovnel %edx, %esi
testb $0x1, %sil
je 0x1111f
movb $0x1, %al
movq %rax, 0x18(%rsp)
cmpl $0x0, 0x50(%rsp)
movq 0x20(%rsp), %rax
jg 0x11130
callq 0x3427
movq 0x18(%rsp), %rax
orb %cl, %al
movq %rax, 0x18(%rsp)
movq 0x20(%rsp), %rax
testb $0x1, %r14b
je 0x1115f
testl %eax, %eax
jle 0x11366
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
movss 0x100b(%rip), %xmm1     # 0x12158
mulss %xmm1, %xmm0
addss %xmm1, %xmm0
cvttss2si %xmm0, %edx
shrl %eax
xorl %esi, %esi
xorl %ecx, %ecx
cmpl $0x0, 0x58(%rsp)
js 0x11352
xorps %xmm0, %xmm0
ucomiss 0x4(%rsp), %xmm0
ja 0x11357
ucomiss (%rsp), %xmm0
ja 0x1135c
movl %esi, 0x7c(%rsp)
movq %rdx, 0x40(%rsp)
movl %ecx, 0x8(%rsp)
movq %rax, 0x20(%rsp)
movq $0x0, 0xe0(%rsp)
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x111be
leaq 0xe0(%rsp), %rsi
callq 0x10c01
movq %rax, 0x10(%rsp)
jmp 0x111c7
movq $0x0, 0x10(%rsp)
xorps %xmm0, %xmm0
movss 0x28(%rsp), %xmm1
ucomiss %xmm1, %xmm0
jae 0x11361
movaps %xmm1, %xmm0
ucomiss 0xf85(%rip), %xmm1      # 0x12168
ja 0x11361
callq 0x21e0
xorps 0x110b(%rip), %xmm0     # 0x12300
subq $0x8, %rsp
movzbl 0x88(%rsp), %r12d
andl $0x1, %r12d
movzbl 0x3c(%rsp), %r10d
andl $0x1, %r10d
movzbl %r15b, %r11d
andl $0x1, %r11d
movzbl %bpl, %ebp
andl $0x1, %ebp
movzbl 0x90(%rsp), %r15d
andl $0x1, %r15d
movzbl 0x40(%rsp), %eax
andl $0x1, %eax
movzbl %r14b, %r14d
andl $0x1, %r14d
movzbl 0x98(%rsp), %r13d
andl $0x1, %r13d
movzbl 0x10(%rsp), %ecx
andl $0x1, %ecx
movq %rcx, 0x50(%rsp)
movzbl 0x84(%rsp), %ecx
andl $0x1, %ecx
movq %rcx, 0x30(%rsp)
movzbl 0x20(%rsp), %ecx
andl $0x1, %ecx
movq %rcx, 0x10(%rsp)
movzbl %bl, %ebx
andl $0x1, %ebx
movq 0xa8(%rsp), %r8
movq 0xa0(%rsp), %r9
movq 0x78(%rsp), %rdi
movq 0xb8(%rsp), %rsi
movq 0x68(%rsp), %rdx
movq 0x70(%rsp), %rcx
movss 0xc(%rsp), %xmm1
movss 0x8(%rsp), %xmm2
pushq %r12
pushq 0xb8(%rsp)
pushq %r10
pushq %r11
pushq %rbp
pushq 0xe8(%rsp)
pushq %r15
pushq %rax
pushq 0x88(%rsp)
pushq 0x70(%rsp)
pushq %r14
pushq 0x130(%rsp)
pushq 0xc0(%rsp)
pushq %r13
pushq 0x140(%rsp)
pushq 0x160(%rsp)
pushq 0x98(%rsp)
pushq 0x150(%rsp)
pushq 0xe0(%rsp)
pushq 0xf0(%rsp)
pushq 0xd0(%rsp)
pushq 0xb8(%rsp)
pushq %rbx
callq 0xf352
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x1, %edi
callq 0x22a0
callq 0x357c
callq 0x35bf
movq %r12, %rsi
callq 0x346b
callq 0x343f
callq 0x33f7
callq 0x33df
callq 0x33c7
callq 0x33af
callq 0x340f