// File: /workspace/github_c_makefile_star2_O1/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, 0x30(%rsp)
movss 0x1493(%rip), %xmm0     # 0x12180
movss %xmm0, 0x4(%rsp)
movss 0x1489(%rip), %xmm0     # 0x12184
movss %xmm0, 0x20(%rsp)
xorps %xmm0, %xmm0
movss %xmm0, (%rsp)
movl $0x64, %eax
movq %rax, 0xc8(%rsp)
movq $0x0, 0x70(%rsp)
leaq 0x322e(%rip), %r14      # 0x13f54
leaq 0x95d3(%rip), %r13      # 0x1a300
leaq 0x1680(%rip), %rbx      # 0x123b4
movq $0x0, 0xb0(%rsp)
movq $0x0, 0x68(%rsp)
movq $0x0, 0xa0(%rsp)
movq $0x0, 0x98(%rsp)
movq $0x0, 0xd0(%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, 0x18(%rsp)
movq $0x0, 0x40(%rsp)
movq $0x0, 0x38(%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, 0x34(%rsp)
movq $0x0, 0xd8(%rsp)
movb $0x1, %cl
movl %ecx, 0x2c(%rsp)
movq $0x0, 0x80(%rsp)
movq $0x0, 0x60(%rsp)
movl %eax, %r15d
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 0x110e6
movslq (%rbx,%rcx,4), %rcx
addq %rbx, %rcx
movb $0x1, %al
jmpq *%rcx
movl $0x0, 0x30(%rsp)
movl %r15d, %eax
jmp 0x10e20
movq 0x9177(%rip), %rax      # 0x19fd8
movq (%rax), %rdi
callq 0x3927
movss %xmm0, (%rsp)
movl %r15d, %eax
jmp 0x10e20
movq 0x915e(%rip), %rax      # 0x19fd8
movq (%rax), %rdi
callq 0x3927
movss %xmm0, 0x20(%rsp)
movl %r15d, %eax
jmp 0x10e20
movb $0x1, %al
movq %rax, 0x80(%rsp)
movl %r15d, %eax
jmp 0x10e20
movq 0x9135(%rip), %rax      # 0x19fd8
movq (%rax), %rax
movq %rax, 0x68(%rsp)
movl %r15d, %eax
jmp 0x10e20
movq 0x911e(%rip), %rax      # 0x19fd8
movq (%rax), %rdi
callq 0x3951
movq %rax, 0x58(%rsp)
movl %r15d, %eax
jmp 0x10e20
movb $0x1, %al
movq %rax, 0x48(%rsp)
movl %r15d, %eax
jmp 0x10e20
movl $0x0, 0x34(%rsp)
movl %r15d, %eax
jmp 0x10e20
movq 0x90e3(%rip), %rax      # 0x19fd8
movq (%rax), %rdi
callq 0x3951
movq %rax, 0x18(%rsp)
movl %r15d, %eax
jmp 0x10e20
movb $0x1, %al
movq %rax, 0xd8(%rsp)
movl %r15d, %eax
jmp 0x10e20
movq 0x90b5(%rip), %rax      # 0x19fd8
movq (%rax), %rax
movq %rax, 0x60(%rsp)
movl %r15d, %eax
jmp 0x10e20
movq 0x909e(%rip), %rax      # 0x19fd8
movq (%rax), %rax
movq %rax, 0xa0(%rsp)
movl %r15d, %eax
jmp 0x10e20
movq 0x9084(%rip), %rax      # 0x19fd8
movq (%rax), %rdi
callq 0x3927
movss %xmm0, 0x4(%rsp)
movl %r15d, %eax
jmp 0x10e20
movq 0x9067(%rip), %rax      # 0x19fd8
movq (%rax), %rax
movq %rax, 0xb8(%rsp)
movl %r15d, %eax
jmp 0x10e20
movq 0x904d(%rip), %rax      # 0x19fd8
movq (%rax), %rdi
callq 0x3980
movq %rax, 0xa8(%rsp)
movl %r15d, %eax
jmp 0x10e20
movq 0x902e(%rip), %rax      # 0x19fd8
movq (%rax), %rax
movq %rax, 0xb0(%rsp)
movl %r15d, %eax
jmp 0x10e20
movl $0x0, 0x2c(%rsp)
movl %r15d, %eax
jmp 0x10e20
movq 0x9004(%rip), %rax      # 0x19fd8
movq (%rax), %rax
movq %rax, 0xd0(%rsp)
movl %r15d, %eax
jmp 0x10e20
movb $0x1, %al
movq %rax, 0x40(%rsp)
movl %r15d, %eax
jmp 0x10e20
movq 0x8fdb(%rip), %rax      # 0x19fd8
movq (%rax), %rax
movq %rax, 0x98(%rsp)
movl %r15d, %eax
jmp 0x10e20
movq 0x8fc1(%rip), %rax      # 0x19fd8
movq (%rax), %rax
movq %rax, 0x10(%rsp)
movl %r15d, %eax
jmp 0x10e20
movq 0x8faa(%rip), %rax      # 0x19fd8
movq (%rax), %rdi
callq 0x3951
movq %rax, 0xc0(%rsp)
movl %r15d, %eax
jmp 0x10e20
movq 0x8f8b(%rip), %rax      # 0x19fd8
movq (%rax), %rdi
callq 0x3951
movq %rax, 0xc8(%rsp)
movl %r15d, %eax
jmp 0x10e20
movq 0x8f6c(%rip), %rax      # 0x19fd8
movq (%rax), %rdi
callq 0x3951
movq %rax, 0x50(%rsp)
movb $0x1, %al
movq %rax, 0x38(%rsp)
movl %r15d, %eax
jmp 0x10e20
movq 0x8f49(%rip), %rax      # 0x19fd8
movq (%rax), %rdi
callq 0x3927
movss %xmm0, 0x20(%rsp)
movb $0x1, %al
movq %rax, 0x90(%rsp)
movl %r15d, %eax
jmp 0x10e20
movq 0x8f22(%rip), %rax      # 0x19fd8
movq (%rax), %rax
movq %rax, 0x70(%rsp)
movl %r15d, %eax
jmp 0x10e20
movb $0x1, %al
movl %eax, 0x8(%rsp)
movl %r15d, %eax
jmp 0x10e20
movb $0x1, %al
movq %rax, 0x88(%rsp)
movl %r15d, %eax
jmp 0x10e20
cmpl $-0x1, %eax
jne 0x1137a
movq 0x8eda(%rip), %rax      # 0x19fd0
movl (%rax), %edi
cmpl %ebp, %edi
jl 0x1138e
cmpq $0x0, 0x60(%rsp)
sete %cl
movq 0xd8(%rsp), %r14
testb $0x1, %r14b
movq 0x70(%rsp), %rax
cmovneq 0x68(%rsp), %rax
movl 0x34(%rsp), %ebp
testb %cl, %bpl
movq 0x48(%rsp), %rbx
jne 0x11396
testq %rax, %rax
je 0x11396
movzbl 0x40(%rsp), %eax
xorl %ecx, %ecx
testb $0x1, 0x8(%rsp)
movl $0x1, %edx
cmovel %eax, %edx
movzbl 0x38(%rsp), %esi
cmovnel %ecx, %esi
testb $0x1, %sil
je 0x11170
movb $0x1, %dl
cmpl $0x0, 0x50(%rsp)
movq 0x18(%rsp), %rax
jg 0x11175
callq 0x3424
movq 0x18(%rsp), %rax
testb $0x1, %bl
je 0x111a9
testl %eax, %eax
jle 0x113af
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
movss 0xfcf(%rip), %xmm1      # 0x12160
mulss %xmm1, %xmm0
addss %xmm1, %xmm0
cvttss2si %xmm0, %ecx
shrl %eax
xorl %esi, %esi
movl $0x0, 0x8(%rsp)
cmpl $0x0, 0x58(%rsp)
js 0x1139b
xorps %xmm0, %xmm0
ucomiss 0x4(%rsp), %xmm0
ja 0x113a0
ucomiss (%rsp), %xmm0
ja 0x113a5
movl %esi, 0x7c(%rsp)
movl %edx, 0x38(%rsp)
movq %rcx, 0x40(%rsp)
movq %rax, 0x18(%rsp)
movq $0x0, 0xe0(%rsp)
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x11208
leaq 0xe0(%rsp), %rsi
callq 0x10c2f
movq %rax, 0x10(%rsp)
jmp 0x11211
movq $0x0, 0x10(%rsp)
xorps %xmm0, %xmm0
movss 0x20(%rsp), %xmm1
ucomiss %xmm1, %xmm0
jae 0x113aa
movaps %xmm1, %xmm0
ucomiss 0xf43(%rip), %xmm1      # 0x12170
ja 0x113aa
callq 0x21e0
xorps 0x10c1(%rip), %xmm0     # 0x12300
subq $0x8, %rsp
movzbl 0x88(%rsp), %r12d
andl $0x1, %r12d
movzbl 0x34(%rsp), %r10d
andl $0x1, %r10d
movzbl %r14b, %r11d
andl $0x1, %r11d
movzbl %bpl, %r13d
andl $0x1, %r13d
movzbl 0x90(%rsp), %ebp
andl $0x1, %ebp
movzbl 0x38(%rsp), %eax
andl $0x1, %eax
movzbl %bl, %ebx
andl $0x1, %ebx
movzbl 0x98(%rsp), %r14d
andl $0x1, %r14d
movzbl 0x10(%rsp), %ecx
andl $0x1, %ecx
movq %rcx, 0x50(%rsp)
movzbl 0x84(%rsp), %ecx
andl $0x1, %ecx
movq %rcx, 0x28(%rsp)
movzbl 0x40(%rsp), %ecx
andl $0x1, %ecx
movq %rcx, 0x10(%rsp)
movzbl %r15b, %r15d
andl $0x1, %r15d
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 %r13
pushq 0xe8(%rsp)
pushq %rbp
pushq %rax
pushq 0x88(%rsp)
pushq 0x68(%rsp)
pushq %rbx
pushq 0x128(%rsp)
pushq 0xc0(%rsp)
pushq %r14
pushq 0x148(%rsp)
pushq 0x160(%rsp)
pushq 0x98(%rsp)
pushq 0x150(%rsp)
pushq 0xe0(%rsp)
pushq 0xf0(%rsp)
pushq 0xc8(%rsp)
pushq 0xb8(%rsp)
pushq %r15
callq 0xf365
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x1, %edi
callq 0x22a0
callq 0x356c
callq 0x35af
movq %r12, %rsi
callq 0x3468
callq 0x343c
callq 0x33f4
callq 0x33dc
callq 0x33c4
callq 0x33ac
callq 0x340c