// File: /workspace/github_c_makefile_star2_O3/jsh58[P]Genrich/Genrich.c
// Function: callPeaksLog
void callPeaksLog(File in, bool gz, File out, bool gzOut,
    char* line, int xcount, char** xchrList, int xBedLen,
    Bed* xBed, float minPQval, bool qvalOpt, int minLen,
    int maxGap, float minAUC, uint64_t genomeLen,
    bool verbose) {
  // determine index of fields ([pq]-value) to analyze
  int idxQ = -1;
  int idxP = getIdx(in, gz, line, qvalOpt, &idxQ);

  // initialize variables for genomic regions to be excluded
  uint32_t* bed = NULL;         // array of BED coordinates
  int bedLen = 0;               // length of bed array
  int bedIdx = 0;               // index into bed array
  uint32_t bedPos = UINT32_MAX; // next coordinate
  bool save = true;             // status of current interval
  bool warn = false;            // warn of new skipped regions?

  // initialize counting variables
  int count = 0;
  uint64_t peakBP = 0;
  bool genomeOpt = genomeLen == 0;

  // initialize peak variables
  float auc = 0.0f;                     // area under the curve (signif.)
  int64_t peakStart = -1, peakEnd = -1; // ends of potential peak
  float summitVal = -1.0f;              // summit p/q value
  uint32_t summitPos = 0;               // distance from peakStart to summit
  uint32_t summitLen = 0;               // length of summit interval
  float summitPval = -1.0f, summitQval = -1.0f; // summit p- and q-values

  // parse bedgraph records
  char prev[MAX_ALNS];              // previous chrom name
  prev[0] = '\0';
  bool skip = false;                // skip current chrom?
  char* chr, *stat, *pStat, *qStat; // chrom and stats/NA of current interval
  uint32_t start, end;              // coordinates of current interval
  float pqval;                      // [pq]-value of current interval
  while (getLine(line, MAX_SIZE, in, gz) != NULL) {

    // load fields from bedgraph record
    loadBDG(line, &chr, &start, &end, &pStat, idxP,
      &qStat, idxQ, qvalOpt);

    // new chromosome
    if (strcmp(prev, chr)) {
      // check if previous chrom's last peak is valid
      checkPeak(out, gzOut, prev, peakStart, peakEnd,
        &count, auc, summitPval, summitQval, summitPos,
        minAUC, minLen, &peakBP);

      // reset peak variables
      resetVars(&peakStart, &summitVal, &summitLen, &auc);

      // check if new chrom should be skipped
      skip = checkChrom(chr, xcount, xchrList);
      if (verbose && skip) {
        fprintf(stderr, "Warning! Skipping chromosome %s --\n  ", chr);
        fprintf(stderr, "Reads aligning to it were used in the background");
        fprintf(stderr, " pileup calculation,\n  and its length was included");
        fprintf(stderr, " in the genome length %scalculation\n",
          qvalOpt ? "(and q-value) " : "");
      }

      // check for regions to be skipped
      bedLen = 0;
      if (! skip) {
        // load regions from xBed
        // (note: cannot check validity of coordinates)
        saveXBed(chr, UINT32_MAX, &bedLen, &bed, xBedLen,
          xBed, verbose);

        // load next coordinate
        bedIdx = 0;
        bedPos = bedIdx < bedLen ? bed[bedIdx]
          : UINT32_MAX;
        save = true;
      }

      strcpy(prev, chr);  // update current chrom
    }
    if (skip)
      continue; // current chrom to be skipped

    // check stat for 'NA' (skipped region)
    stat = qvalOpt ? qStat : pStat;
    if (!strcmp(stat, NA)) {
      // check if previous peak is valid
      checkPeak(out, gzOut, chr, peakStart, peakEnd,
        &count, auc, summitPval, summitQval, summitPos,
        minAUC, minLen, &peakBP);

      // reset peak variables
      resetVars(&peakStart, &summitVal, &summitLen, &auc);
      continue;
    }
    pqval = getFloat(stat);

    // check if current interval starts at a position
    //   to be skipped (new -E)
    if (bedPos == start) {
      if (save) {
        // check if previous peak is valid
        checkPeak(out, gzOut, chr, peakStart, peakEnd,
          &count, auc, summitPval, summitQval, summitPos,
          minAUC, minLen, &peakBP);
        // reset peak variables
        resetVars(&peakStart, &summitVal, &summitLen, &auc);
      }

      // load next coordinate
      save = ! save;
      bedIdx++;
      bedPos = bedIdx < bedLen ? bed[bedIdx] : UINT32_MAX;
    }

    // check if current interval contains the next position
    //   to be skipped (new -E)
    uint32_t subStart = start;  // start of current subinterval
    while (bedPos > start && bedPos < end) {

      if (save) {
        // interval *not* to be skipped:
        //   update peak if necessary, then print if valid
        if (pqval > minPQval) {
          // interval reaches significance
          updatePeak(&peakStart, &peakEnd, subStart,
            bedPos, &auc, pqval, minPQval,
            qvalOpt ? getFloat(pStat) : pqval,
            qvalOpt ? pqval : SKIP,
            &summitVal, &summitPval, &summitQval,
            &summitPos, &summitLen);
        }
        // check if peak is valid
        checkPeak(out, gzOut, chr, peakStart, peakEnd,
          &count, auc, summitPval, summitQval, summitPos,
          minAUC, minLen, &peakBP);
        // reset peak variables
        resetVars(&peakStart, &summitVal, &summitLen, &auc);
        if (genomeOpt)
          genomeLen += bedPos - subStart; // update genome length
      } else
        warn = true;

      // load next coordinate
      subStart = bedPos;
      save = ! save;
      bedIdx++;
      bedPos = bedIdx < bedLen ? bed[bedIdx] : UINT32_MAX;
    }
    if (! save) {
      warn = true;
      continue;
    }
    start = subStart; // reset start coordinate

    // check [pq]-value for significance
    if (genomeOpt)
      genomeLen += end - start; // update genome length
    if (pqval > minPQval) {

      // interval reaches significance
      updatePeak(&peakStart, &peakEnd, start, end,
        &auc, pqval, minPQval,
        qvalOpt ? getFloat(pStat) : pqval,
        qvalOpt ? pqval : SKIP,
        &summitVal, &summitPval, &summitQval,
        &summitPos, &summitLen);

    } else {

      // interval does not reach significance --
      //   check if distance is beyond maxGap from peak
      if (end - peakEnd > maxGap) {
        // check if previous peak is valid
        checkPeak(out, gzOut, chr, peakStart, peakEnd,
          &count, auc, summitPval, summitQval, summitPos,
          minAUC, minLen, &peakBP);

        // reset peak variables
        resetVars(&peakStart, &summitVal, &summitLen, &auc);
      }
    }

  }

  // check if last peak is valid
  checkPeak(out, gzOut, chr, peakStart, peakEnd,
    &count, auc, summitPval, summitQval, summitPos,
    minAUC, minLen, &peakBP);

  if (verbose) {
    if (warn) {
      fprintf(stderr, "Warning! Skipping given BED regions --\n  ");
      fprintf(stderr, "Reads aligning to them were used in the background");
      fprintf(stderr, " pileup calculation,\n  and the lengths were included");
      fprintf(stderr, " in the genome length %scalculation\n",
        qvalOpt ? "(and q-value) " : "");
    }
    fprintf(stderr, "Peak-calling parameters:\n");
    fprintf(stderr, "  Genome length: %ldbp\n", genomeLen);
    fprintf(stderr, "  Significance threshold: -log(%c) > %.3f\n",
      qvalOpt ? 'q' : 'p', minPQval);
    fprintf(stderr, "  Min. AUC: %.3f\n", minAUC);
    if (minLen)
      fprintf(stderr, "  Min. peak length: %dbp\n", minLen);
    fprintf(stderr, "  Max. gap between sites: %dbp\n", maxGap);
    fprintf(stderr, "Peaks identified: %d (%ldbp)\n",
      count, peakBP);
  }

  free(bed);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
movss %xmm1, 0x50(%rsp)
movss %xmm0, 0x7c(%rsp)
movl %r9d, %r13d
movq %r8, %rbp
movl %ecx, 0x64(%rsp)
movq %rdx, 0x90(%rsp)
movq %rdi, %rbx
movq 0x210(%rsp), %r15
leaq 0x11c(%rsp), %r12
movl $0xffffffff, (%r12)     # imm = 0xFFFFFFFF
movzbl 0x1f8(%rsp), %r14d
movl %esi, 0xe4(%rsp)
movq %r8, %rdx
movl %r14d, %ecx
movq %r12, %r8
callq 0x5f32
movl %eax, 0xe0(%rsp)
leaq 0xa8(%rsp), %rax
movq $0x0, (%rax)
leaq 0x54(%rsp), %rax
movl $0x0, (%rax)
leaq 0x120(%rsp), %rax
movb $0x0, (%rax)
movl (%r12), %eax
movl %eax, 0xdc(%rsp)
movslq 0x200(%rsp), %rax
movq %rax, 0xa0(%rsp)
movl %r13d, 0xd8(%rsp)
movl %r13d, %eax
movq %rax, 0xc8(%rsp)
leaq 0xd57b(%rip), %rax      # 0x13760
leaq 0xd9d3(%rip), %rcx      # 0x13bbf
movl %r14d, 0xb4(%rsp)
testb %r14b, %r14b
cmovneq %rax, %rcx
movq %rcx, 0xf0(%rsp)
movslq 0x208(%rsp), %rax
movq %rax, 0xf8(%rsp)
movl $0xffffffff, 0x70(%rsp) # imm = 0xFFFFFFFF
movb $0x1, %dl
movss 0xbf2b(%rip), %xmm0     # 0x12150
movq $-0x1, %rcx
xorps %xmm6, %xmm6
movq $0x0, 0x98(%rsp)
movaps %xmm0, %xmm3
movss %xmm0, 0x24(%rsp)
movss %xmm0, 0x20(%rsp)
movl $0x0, 0x68(%rsp)
movl $0x0, 0x1c(%rsp)
movq $0x0, 0x88(%rsp)
movq $-0x1, 0x40(%rsp)
movl $0x0, 0x4c(%rsp)
movl $0x0, 0x30(%rsp)
movq $0x0, 0x38(%rsp)
xorl %edi, %edi
movq %r15, 0x58(%rsp)
movq %rdi, 0x80(%rsp)
movb %dl, 0x1b(%rsp)
movss %xmm3, 0x34(%rsp)
movl 0x54(%rsp), %r14d
xorl %r13d, %r13d
movss %xmm6, 0x28(%rsp)
movq %rcx, %r15
cmpb $0x0, 0xe4(%rsp)
je 0x62ce
movq %rbx, %rdi
movq %rbp, %rsi
movl $0xfff0, %edx           # imm = 0xFFF0
callq 0x2090
jmp 0x62de
movq %rbp, %rdi
movl $0xfff0, %esi           # imm = 0xFFF0
movq %rbx, %rdx
callq 0x21a0
testq %rax, %rax
je 0x6d54
movl 0xb4(%rsp), %eax
movl %eax, 0x10(%rsp)
movl 0xdc(%rsp), %eax
movl %eax, 0x8(%rsp)
leaq 0x100(%rsp), %rax
movq %rax, (%rsp)
movq %rbp, %rdi
leaq 0x110(%rsp), %rsi
leaq 0xbc(%rsp), %rdx
leaq 0xb8(%rsp), %rcx
leaq 0x108(%rsp), %r8
movl 0xe0(%rsp), %r9d
callq 0x6056
movq 0x110(%rsp), %r12
leaq 0x120(%rsp), %rdi
movq %r12, %rsi
callq 0x21b0
testl %eax, %eax
jne 0x6367
testb $0x1, %r13b
movb $0x1, %r13b
jne 0x62b2
jmp 0x64c6
movss 0x28(%rsp), %xmm0
ucomiss 0x50(%rsp), %xmm0
jb 0x63e5
cmpq $-0x1, %r15
movq 0x1e0(%rsp), %r13
je 0x63ed
movq 0x40(%rsp), %r8
movq %r8, %r14
subq %r15, %r14
cmpq 0xa0(%rsp), %r14
jl 0x63ed
movl 0x4c(%rsp), %eax
movl %eax, (%rsp)
movzbl 0x64(%rsp), %esi
movq 0x90(%rsp), %rdi
leaq 0x120(%rsp), %rdx
movq %r15, %rcx
movl 0x1c(%rsp), %r13d
movl %r13d, %r9d
movss 0x28(%rsp), %xmm0
movss 0x24(%rsp), %xmm1
movss 0x20(%rsp), %xmm2
callq 0x531e
addq %r14, 0x88(%rsp)
incl %r13d
movl %r13d, 0x1c(%rsp)
movq 0x1e0(%rsp), %r13
cmpl $0x0, 0xd8(%rsp)
jle 0x65d5
movq (%r13), %rdi
movq %r12, %rsi
callq 0x21b0
testl %eax, %eax
je 0x6455
movl $0x1, %ecx
movq %rcx, %r14
cmpq %rcx, 0xc8(%rsp)
je 0x6432
movq (%r13,%r14,8), %rdi
movq %r12, %rsi
callq 0x21b0
leaq 0x1(%r14), %rcx
testl %eax, %eax
jne 0x6410
cmpq 0xc8(%rsp), %r14
setb %al
testb %al, 0x218(%rsp)
jne 0x64b4
cmpq 0xc8(%rsp), %r14
jb 0x645f
jmp 0x65d5
cmpb $0x0, 0x218(%rsp)
jne 0x64b4
leaq 0x120(%rsp), %rdi
movq %r12, %rsi
callq 0x2070
movb $0x1, %r13b
movq $-0x1, %r15
xorps %xmm0, %xmm0
movss %xmm0, 0x28(%rsp)
xorl %r14d, %r14d
movq $0x0, 0x98(%rsp)
movl $0x0, 0x68(%rsp)
movss 0xbcaf(%rip), %xmm0     # 0x12150
movss %xmm0, 0x34(%rsp)
movl $0x0, 0x30(%rsp)
jmp 0x62b2
movq %r12, %rdi
movq 0xf0(%rsp), %rsi
callq 0x2b73
jmp 0x645f
movl %r14d, 0x54(%rsp)
movl 0x70(%rsp), %r14d
movss 0x34(%rsp), %xmm0
movq 0x108(%rsp), %rax
movq %rax, %rdi
cmpb $0x0, 0x1f8(%rsp)
je 0x64f3
movq 0x100(%rsp), %rdi
cmpb $0x4e, (%rdi)
jne 0x6681
cmpb $0x41, 0x1(%rdi)
jne 0x6681
cmpb $0x0, 0x2(%rdi)
jne 0x6681
movl %r14d, 0x70(%rsp)
movl $0x0, 0x30(%rsp)
movss 0x28(%rsp), %xmm0
ucomiss 0x50(%rsp), %xmm0
movq $-0x1, %rcx
xorps %xmm6, %xmm6
movss 0xbc16(%rip), %xmm3     # 0x12150
jb 0x629b
movss 0xbc08(%rip), %xmm3     # 0x12150
cmpq $-0x1, %r15
je 0x629b
movq 0x40(%rsp), %r14
subq %r15, %r14
movss 0xbbee(%rip), %xmm3     # 0x12150
cmpq 0xa0(%rsp), %r14
jl 0x629b
movl 0x4c(%rsp), %eax
movl %eax, (%rsp)
movzbl 0x64(%rsp), %esi
movq 0x90(%rsp), %rdi
movq %r12, %rdx
movq %r15, %rcx
movq 0x40(%rsp), %r8
movl 0x1c(%rsp), %r13d
movl %r13d, %r9d
movss 0x28(%rsp), %xmm0
movss 0x24(%rsp), %xmm1
movss 0x20(%rsp), %xmm2
callq 0x531e
movq $-0x1, %rcx
xorps %xmm6, %xmm6
addq %r14, 0x88(%rsp)
incl %r13d
movl %r13d, 0x1c(%rsp)
movss 0xbb80(%rip), %xmm3     # 0x12150
jmp 0x629b
movl $0x0, 0x54(%rsp)
movzbl 0x218(%rsp), %eax
movl %eax, (%rsp)
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
movq %r12, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
leaq 0x54(%rsp), %rdx
leaq 0xa8(%rsp), %rcx
movl 0x1e8(%rsp), %r8d
movq 0x1f0(%rsp), %r9
callq 0x5cad
movl 0x54(%rsp), %eax
movl %eax, 0x68(%rsp)
testl %eax, %eax
jle 0x662f
movq 0xa8(%rsp), %rax
movl (%rax), %r14d
leaq 0x120(%rsp), %rdi
movq %r12, %rsi
callq 0x2070
xorps %xmm0, %xmm0
movss %xmm0, 0x28(%rsp)
movq $-0x1, %r15
movb $0x1, 0x1b(%rsp)
movq $0x0, 0x80(%rsp)
movl $0x0, 0x30(%rsp)
movss 0xbae0(%rip), %xmm0     # 0x12150
movl 0x68(%rsp), %eax
movq %rax, 0x98(%rsp)
jmp 0x64d6
movq %rax, 0xe8(%rsp)
movss %xmm0, 0x34(%rsp)
callq 0x3937
movaps %xmm0, %xmm4
movl 0xbc(%rsp), %r9d
cmpl %r9d, %r14d
movl %r9d, 0x78(%rsp)
jne 0x6784
movb 0x1b(%rsp), %dl
testb $0x1, %dl
movq 0x80(%rsp), %rdi
movss 0x34(%rsp), %xmm3
je 0x67a1
movl $0x0, 0x30(%rsp)
movss 0x28(%rsp), %xmm0
ucomiss 0x50(%rsp), %xmm0
movq $-0x1, %r10
xorps %xmm5, %xmm5
jb 0x677a
cmpq $-0x1, %r15
je 0x677a
movq 0x40(%rsp), %r8
movq %r8, %r14
subq %r15, %r14
cmpq 0xa0(%rsp), %r14
jl 0x677a
movl 0x4c(%rsp), %eax
movl %eax, (%rsp)
movzbl 0x64(%rsp), %esi
movq 0x90(%rsp), %rdi
movq %r12, %rdx
movq %r15, %rcx
movl 0x1c(%rsp), %r13d
movl %r13d, %r9d
movss 0x28(%rsp), %xmm0
movss 0x24(%rsp), %xmm1
movss 0x20(%rsp), %xmm2
movss %xmm4, 0x60(%rsp)
callq 0x531e
xorps %xmm5, %xmm5
movq $-0x1, %r10
movl 0x78(%rsp), %r9d
movss 0x60(%rsp), %xmm4
movq 0x80(%rsp), %rdi
movb 0x1b(%rsp), %dl
addq %r14, 0x88(%rsp)
incl %r13d
movl %r13d, 0x1c(%rsp)
movss 0xb9ce(%rip), %xmm3     # 0x12150
jmp 0x67aa
movss 0x28(%rsp), %xmm5
movq %r15, %r10
movb 0x1b(%rsp), %dl
movq 0x80(%rsp), %rdi
movss 0x34(%rsp), %xmm3
jmp 0x67c8
movss 0x28(%rsp), %xmm5
movq %r15, %r10
xorb $0x1, %dl
incl %edi
cmpl 0x68(%rsp), %edi
jge 0x6a69
movq 0xa8(%rsp), %rax
movslq %edi, %rcx
movl (%rax,%rcx,4), %r14d
movl 0xb8(%rsp), %r11d
cmpl %r9d, %r14d
seta %al
cmpl %r11d, %r14d
setb %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x6a62
movaps %xmm4, %xmm0
subss 0x7c(%rsp), %xmm0
movss %xmm0, 0xd4(%rsp)
movq 0xa8(%rsp), %r15
movslq %edi, %r8
movslq 0x98(%rsp), %rsi
leal 0x1(%r8), %eax
incq %r8
movl %r9d, %ecx
movl %r11d, 0xb0(%rsp)
movq %r15, 0x68(%rsp)
movq %rsi, 0xc0(%rsp)
movss %xmm4, 0x60(%rsp)
movl %r14d, %r13d
movl %eax, %edi
testb $0x1, %dl
je 0x6940
ucomiss 0x7c(%rsp), %xmm4
movq %rcx, 0x28(%rsp)
jbe 0x694c
movss 0xb8f9(%rip), %xmm2     # 0x12150
movaps %xmm4, %xmm1
cmpb $0x0, 0x1f8(%rsp)
je 0x68d0
movb %dl, 0x1b(%rsp)
movq %r13, 0x70(%rsp)
movq %rdi, %r13
movq 0xe8(%rsp), %rdi
movss %xmm3, 0x34(%rsp)
movq %r10, %r14
movss %xmm5, 0x40(%rsp)
movq %r8, %r15
callq 0x3937
movq 0x28(%rsp), %rcx
movq %r15, %r8
movq 0x68(%rsp), %r15
movl 0xb0(%rsp), %r11d
movss 0x40(%rsp), %xmm5
movq %r14, %r10
movl 0x78(%rsp), %r9d
movss 0x60(%rsp), %xmm4
movss 0x34(%rsp), %xmm3
movq %r13, %rdi
movq 0x70(%rsp), %r13
movb 0x1b(%rsp), %dl
movaps %xmm0, %xmm1
movaps %xmm4, %xmm2
movl %r13d, %eax
subl %ecx, %eax
xorps %xmm0, %xmm0
cvtsi2ss %rax, %xmm0
mulss 0xd4(%rsp), %xmm0
cmpq $-0x1, %r10
movl %ecx, %ecx
cmovneq %r10, %rcx
addss %xmm5, %xmm0
movl %r13d, %esi
movq %rsi, 0x40(%rsp)
ucomiss %xmm3, %xmm4
ja 0x691a
ucomiss %xmm4, %xmm3
jne 0x6936
jp 0x6936
movss 0x24(%rsp), %xmm1
movss 0x20(%rsp), %xmm2
cmpl 0x30(%rsp), %eax
jbe 0x6936
movq 0x28(%rsp), %rax
addl %r13d, %eax
shrl %eax
subl %ecx, %eax
movl %eax, 0x4c(%rsp)
movss %xmm1, 0x24(%rsp)
movss %xmm2, 0x20(%rsp)
movq 0xc0(%rsp), %rsi
jmp 0x6952
movb $0x1, %al
movq %rax, 0x38(%rsp)
jmp 0x6a38
movaps %xmm5, %xmm0
movq %r10, %rcx
ucomiss 0x50(%rsp), %xmm0
jb 0x6a04
cmpq $-0x1, %rcx
je 0x6a04
movq %r8, %r15
movq 0x40(%rsp), %r8
movq %r8, %r14
subq %rcx, %r14
cmpq 0xa0(%rsp), %r14
jl 0x69fc
movl 0x4c(%rsp), %eax
movl %eax, (%rsp)
movzbl 0x64(%rsp), %esi
movb %dl, 0x1b(%rsp)
movq %rdi, 0x80(%rsp)
movq 0x90(%rsp), %rdi
movq %r12, %rdx
movq %r13, 0x70(%rsp)
movl 0x1c(%rsp), %r13d
movl %r13d, %r9d
movss 0x24(%rsp), %xmm1
movss 0x20(%rsp), %xmm2
callq 0x531e
movq 0xc0(%rsp), %rsi
movl 0xb0(%rsp), %r11d
movl 0x78(%rsp), %r9d
movss 0x60(%rsp), %xmm4
movq 0x80(%rsp), %rdi
movb 0x1b(%rsp), %dl
addq %r14, 0x88(%rsp)
incl %r13d
movl %r13d, 0x1c(%rsp)
movq 0x70(%rsp), %r13
movq %r15, %r8
movq 0x68(%rsp), %r15
movl $0x0, 0x30(%rsp)
movq $-0x1, %r10
xorps %xmm5, %xmm5
cmpq $0x0, 0x210(%rsp)
movq 0x28(%rsp), %rcx
jne 0x6a30
movl %r13d, %eax
subl %ecx, %eax
addq %rax, 0x58(%rsp)
movss 0xb718(%rip), %xmm3     # 0x12150
xorb $0x1, %dl
cmpq %rsi, %r8
jge 0x6a82
movl (%r15,%r8,4), %r14d
cmpl %r9d, %r14d
jbe 0x6a5b
leal 0x1(%rdi), %eax
incq %r8
movl %r13d, %ecx
cmpl %r11d, %r14d
jb 0x6831
movl %r14d, 0x70(%rsp)
jmp 0x6a8a
movl %r14d, 0x70(%rsp)
jmp 0x6a79
movl $0xffffffff, 0x70(%rsp) # imm = 0xFFFFFFFF
movl 0xb8(%rsp), %r11d
movq 0x38(%rsp), %rax
movl %eax, %esi
jmp 0x6aa0
movl $0xffffffff, 0x70(%rsp) # imm = 0xFFFFFFFF
movq 0x98(%rsp), %rax
movl %eax, 0x68(%rsp)
movq 0x38(%rsp), %rax
movl %eax, %esi
movl %r13d, %r9d
movb $0x1, %al
movq %rax, 0x38(%rsp)
movaps %xmm5, %xmm6
movq %r10, %rcx
testb $0x1, %dl
je 0x628f
movl %r11d, %r14d
subl %r9d, %r14d
cmpq $0x0, 0x210(%rsp)
movl %r9d, 0xbc(%rsp)
movl $0x0, %r15d
cmoveq %r14, %r15
addq 0x58(%rsp), %r15
ucomiss 0x7c(%rsp), %xmm4
movl %r11d, %r8d
jbe 0x6c03
movss 0xb65e(%rip), %xmm1     # 0x12150
movaps %xmm4, %xmm0
cmpb $0x0, 0x1f8(%rsp)
je 0x6b83
movb %dl, 0x1b(%rsp)
movq %rdi, 0x80(%rsp)
movq 0xe8(%rsp), %rdi
movss %xmm3, 0x34(%rsp)
movss %xmm4, 0x60(%rsp)
movl %r9d, 0x78(%rsp)
movq %r10, %r13
movss %xmm5, 0x40(%rsp)
movq %r14, 0x58(%rsp)
movl %r11d, %r14d
movb %sil, 0x28(%rsp)
movq %r8, 0x38(%rsp)
callq 0x3937
movq 0x38(%rsp), %r8
movb 0x28(%rsp), %sil
movl %r14d, %r11d
movq 0x58(%rsp), %r14
movss 0x40(%rsp), %xmm5
movq %r13, %r10
movl 0x78(%rsp), %r9d
movss 0x60(%rsp), %xmm4
movss 0x34(%rsp), %xmm3
movq 0x80(%rsp), %rdi
movb 0x1b(%rsp), %dl
movaps %xmm4, %xmm1
movl %r14d, %eax
xorps %xmm2, %xmm2
cvtsi2ss %rax, %xmm2
movaps %xmm4, %xmm6
subss 0x7c(%rsp), %xmm6
mulss %xmm2, %xmm6
addss %xmm5, %xmm6
cmpq $-0x1, %r10
movl %r9d, %ecx
cmovneq %r10, %rcx
ucomiss %xmm3, %xmm4
ja 0x6d21
ucomiss %xmm4, %xmm3
movq %r8, 0x40(%rsp)
movl %esi, %eax
movq %rax, 0x38(%rsp)
movq %r15, 0x58(%rsp)
jne 0x628f
jp 0x628f
movq %r8, 0x40(%rsp)
movl %esi, %eax
movq %rax, 0x38(%rsp)
movq %r15, 0x58(%rsp)
movaps %xmm3, %xmm4
movss 0x24(%rsp), %xmm0
movss 0x20(%rsp), %xmm1
cmpl 0x30(%rsp), %r14d
ja 0x6d21
jmp 0x628f
subq 0x40(%rsp), %r8
movaps %xmm5, %xmm6
movq %r10, %rcx
movl %esi, %eax
movq %rax, 0x38(%rsp)
movq %r15, 0x58(%rsp)
cmpq 0xf8(%rsp), %r8
jle 0x628f
movl $0x0, 0x30(%rsp)
ucomiss 0x50(%rsp), %xmm5
xorps %xmm6, %xmm6
movq $-0x1, %rcx
movss 0xb509(%rip), %xmm3     # 0x12150
movl %esi, %eax
movq %rax, 0x38(%rsp)
movq %r15, 0x58(%rsp)
jb 0x628f
movss 0xb4ef(%rip), %xmm3     # 0x12150
movl %esi, %eax
movq %rax, 0x38(%rsp)
movq %r15, 0x58(%rsp)
cmpq $-0x1, %r10
je 0x628f
movq 0x40(%rsp), %r14
subq %r10, %r14
movss 0xb4c9(%rip), %xmm3     # 0x12150
movl %esi, %eax
movq %rax, 0x38(%rsp)
movq %r15, 0x58(%rsp)
cmpq 0xa0(%rsp), %r14
jl 0x628f
movl 0x4c(%rsp), %eax
movl %eax, (%rsp)
movb %sil, 0x28(%rsp)
movzbl 0x64(%rsp), %esi
movb %dl, 0x1b(%rsp)
movq %rdi, 0x80(%rsp)
movq 0x90(%rsp), %rdi
movq %r12, %rdx
movq %r10, %rcx
movq 0x40(%rsp), %r8
movl 0x1c(%rsp), %r13d
movl %r13d, %r9d
movaps %xmm5, %xmm0
movss 0x24(%rsp), %xmm1
movss 0x20(%rsp), %xmm2
callq 0x531e
movq 0x80(%rsp), %rdi
movb 0x1b(%rsp), %dl
addq %r14, 0x88(%rsp)
incl %r13d
movl %r13d, 0x1c(%rsp)
xorps %xmm6, %xmm6
movq $-0x1, %rcx
movss 0xb435(%rip), %xmm3     # 0x12150
movb 0x28(%rsp), %al
jmp 0x6d4a
addl %r9d, %r11d
shrl %r11d
subl %ecx, %r11d
movq %r8, 0x40(%rsp)
movaps %xmm4, %xmm3
movl %r11d, 0x4c(%rsp)
movl %r14d, 0x30(%rsp)
movss %xmm0, 0x24(%rsp)
movss %xmm1, 0x20(%rsp)
movl %esi, %eax
movq %rax, 0x38(%rsp)
jmp 0x628a
movl %r14d, 0x54(%rsp)
movss 0x28(%rsp), %xmm0
ucomiss 0x50(%rsp), %xmm0
jb 0x6dc7
cmpq $-0x1, %r15
je 0x6dc7
movq 0x40(%rsp), %r8
movq %r8, %rbx
subq %r15, %rbx
cmpq 0xa0(%rsp), %rbx
jl 0x6dc7
movl 0x4c(%rsp), %eax
movl %eax, (%rsp)
movzbl 0x64(%rsp), %esi
movq 0x90(%rsp), %rdi
movq %r12, %rdx
movq %r15, %rcx
movl 0x1c(%rsp), %ebp
movl %ebp, %r9d
movss 0x28(%rsp), %xmm0
movss 0x24(%rsp), %xmm1
movss 0x20(%rsp), %xmm2
callq 0x531e
addq %rbx, 0x88(%rsp)
incl %ebp
movl %ebp, 0x1c(%rsp)
cmpb $0x0, 0x218(%rsp)
jne 0x6df0
movq 0xa8(%rsp), %rdi
callq 0x2040
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testb $0x1, 0x38(%rsp)
je 0x6e04
movq 0xf0(%rsp), %rdi
callq 0x2bde
movq 0x131ed(%rip), %rbx     # 0x19ff8
movq (%rbx), %rcx
leaq 0xc6f6(%rip), %rdi      # 0x1350b
movl $0x19, %esi
movl $0x1, %edx
callq 0x22b0
movq (%rbx), %rdi
leaq 0xc6f7(%rip), %rsi      # 0x13525
movq 0x58(%rsp), %rdx
xorl %eax, %eax
callq 0x21d0
movq (%rbx), %rdi
movl 0xb4(%rsp), %edx
orl $0x70, %edx
xorps %xmm0, %xmm0
cvtss2sd 0x7c(%rsp), %xmm0
leaq 0xc6e6(%rip), %rsi      # 0x1353d
movb $0x1, %al
callq 0x21d0
movq (%rbx), %rdi
xorps %xmm0, %xmm0
cvtss2sd 0x50(%rsp), %xmm0
leaq 0xc6f7(%rip), %rsi      # 0x13568
movb $0x1, %al
callq 0x21d0
movl 0x200(%rsp), %edx
testl %edx, %edx
je 0x6e94
movq (%rbx), %rdi
leaq 0xc6ed(%rip), %rsi      # 0x1357a
xorl %eax, %eax
callq 0x21d0
movq (%rbx), %rdi
leaq 0xc6f6(%rip), %rsi      # 0x13594
movl 0x208(%rsp), %edx
xorl %eax, %eax
callq 0x21d0
movq (%rbx), %rdi
leaq 0xc718(%rip), %rsi      # 0x135ce
movl 0x1c(%rsp), %edx
movq 0x88(%rsp), %rcx
xorl %eax, %eax
callq 0x21d0
jmp 0x6dd1