// File: /workspace/github_c_makefile_star2_O3/jsh58[P]Genrich/Genrich.c
// Function: processSingle
int processSingle(char* qname, Aln* aln, int alnLen,
    bool extendOpt, int extend, bool avgExtOpt,
    Aln*** unpair, int* unpairIdx, int* unpairLen,
    int* unpairMem, float score, float asDiff,
    bool first, bool atacOpt, int atacLen5,
    int atacLen3, bool atacAdj, File bed, bool bedOpt,
    bool gzOut, bool ctrl, int sample, uint64_t* errCount,
    bool verbose) {

  // adjust AS tolerance for secondary alns
  if (score != NOSCORE)
    score -= asDiff;

  // determine number of valid unpaired alignments
  //   (within score threshold and not to skipped chrom)
  uint8_t count = 0;
  for (int i = 0; i < alnLen; i++) {
    Aln* a = aln + i;
    if (! a->paired && a->first == first
        && a->score >= score && a->chrom->save
        && ! a->chrom->skip)
      count++;
  }
  if (! count)
    return 0;

  // adjust score so that num alns is OK (1/2/3/4/5/6/8/10)
  if (count > 10 || count == 7 || count == 9)
    subsampleSingle(aln, alnLen, first, &count, &score);

  // find unpaired alns to save
  uint8_t saved = 0;
  for (int i = 0; i < alnLen; i++) {
    Aln* a = aln + i;
    if (! a->paired && a->first == first
        && a->score >= score && a->chrom->save
        && ! a->chrom->skip) {

      if (avgExtOpt)
        // for average-extension option, save alignment
        //   for later processing by processAvgExt()
        saveAvgExt(qname, a, count, unpair,
          unpairIdx, unpairLen, unpairMem);

      else
        // for other options, save interval
        saveUnpair(qname, a, count, extendOpt, extend,
          atacOpt, atacLen5, atacLen3, atacAdj, bed,
          bedOpt, gzOut, ctrl, sample, errCount, verbose);

      if (++saved == count)
        break;  // in case of AS ties
    }
  }

  // check for error saving alignments
  if (saved != count) {
    char msg[MAX_ALNS];
    sprintf(msg, "Saved %d alignments for read %s; should have been %d",
      saved, qname, count);
    exit(error(msg, ERRISSUE));
  }

  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movaps %xmm0, %xmm2
subss %xmm1, %xmm2
movss 0x88ae(%rip), %xmm1     # 0x12174
cmpneqss %xmm0, %xmm1
andps %xmm1, %xmm2
andnps %xmm0, %xmm1
orps %xmm2, %xmm1
movss %xmm1, 0x8(%rsp)
testl %edx, %edx
jle 0x9b3f
movl %ecx, %r10d
movl %edx, %r12d
movq %rsi, %r15
movl %r8d, 0x18(%rsp)
movl %r9d, 0x1c(%rsp)
movq %rdi, 0x20(%rsp)
movb 0x188(%rsp), %sil
movb 0x170(%rsp), %r9b
movb 0x168(%rsp), %r8b
movb 0x160(%rsp), %dil
movb 0x150(%rsp), %r11b
movb 0x138(%rsp), %r13b
movb 0x130(%rsp), %bl
movl %edx, %ebp
leaq (,%rbp,8), %rax
leaq (%rax,%rax,4), %rax
xorl %ecx, %ecx
xorl %r14d, %r14d
cmpb $0x0, 0xd(%r15,%rcx)
jne 0x9973
cmpb %bl, 0xf(%r15,%rcx)
jne 0x9973
movss 0x8(%r15,%rcx), %xmm0
ucomiss %xmm1, %xmm0
jb 0x9973
movq 0x20(%r15,%rcx), %rdx
cmpb $0x1, 0xd(%rdx)
jne 0x9973
movb 0xc(%rdx), %dl
xorb $0x1, %dl
addb %dl, %r14b
addq $0x28, %rcx
cmpq %rcx, %rax
jne 0x9944
movb %r14b, 0x7(%rsp)
testb %r14b, %r14b
je 0x9b3f
cmpb $0xa, %r14b
ja 0x999f
cmpb $0x9, %r14b
je 0x999f
movzbl %r14b, %eax
cmpl $0x7, %eax
jne 0x99f3
movzbl %bl, %edx
leaq 0x7(%rsp), %r14
leaq 0x8(%rsp), %r8
movq %r15, %rdi
movl %r12d, %esi
movq %r14, %rcx
movl %r10d, %r13d
callq 0x97c3
movb 0x150(%rsp), %r11b
movb 0x170(%rsp), %r9b
movb 0x168(%rsp), %r8b
movb 0x160(%rsp), %dil
movl %r13d, %r10d
movb 0x138(%rsp), %r13b
movb 0x188(%rsp), %sil
movb (%r14), %r14b
testl %r12d, %r12d
jle 0x9b43
movss 0x8(%rsp), %xmm1
xorl %r12d, %r12d
movzbl %r14b, %edx
movzbl %sil, %eax
movq %rax, 0x48(%rsp)
movzbl %r9b, %eax
movq %rax, 0x40(%rsp)
movzbl %r8b, %eax
movq %rax, 0x38(%rsp)
movzbl %dil, %eax
movq %rax, 0x30(%rsp)
movzbl %r11b, %eax
movq %rax, 0x28(%rsp)
movzbl %r10b, %eax
movl %eax, 0x10(%rsp)
movzbl %r13b, %eax
movl %eax, 0xc(%rsp)
cmpb $0x0, 0xd(%r15)
jne 0x9b30
cmpb %bl, 0xf(%r15)
jne 0x9b30
movss 0x8(%r15), %xmm0
ucomiss %xmm1, %xmm0
jb 0x9b30
movq 0x20(%r15), %rax
cmpb $0x1, 0xd(%rax)
jne 0x9b30
cmpb $0x0, 0xc(%rax)
jne 0x9b30
movss %xmm1, 0x14(%rsp)
cmpb $0x0, 0x1c(%rsp)
movq 0x20(%rsp), %rdi
je 0x9ac8
subq $0x8, %rsp
movq %r15, %rsi
movl %edx, %r13d
movq 0x118(%rsp), %rcx
movq 0x120(%rsp), %r8
movq 0x128(%rsp), %r9
pushq 0x130(%rsp)
callq 0x8d41
addq $0x10, %rsp
jmp 0x9b1f
movq %r15, %rsi
movl %edx, %r13d
movl 0x10(%rsp), %ecx
movl 0x18(%rsp), %r8d
movl 0xc(%rsp), %r9d
pushq 0x48(%rsp)
pushq 0x188(%rsp)
movl 0x188(%rsp), %eax
pushq %rax
pushq 0x58(%rsp)
pushq 0x58(%rsp)
pushq 0x58(%rsp)
pushq 0x188(%rsp)
pushq 0x60(%rsp)
movl 0x188(%rsp), %eax
pushq %rax
movl 0x188(%rsp), %eax
pushq %rax
callq 0x8e32
addq $0x50, %rsp
incb %r12b
cmpb %r14b, %r12b
movss 0x14(%rsp), %xmm1
movl %r13d, %edx
je 0x9b62
addq $0x28, %r15
decq %rbp
jne 0x9a46
jmp 0x9b46
xorl %eax, %eax
jmp 0x9b50
xorl %r12d, %r12d
movl $0x1, %eax
cmpb %r14b, %r12b
jne 0x9b69
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x1, %eax
jmp 0x9b50
movzbl %r12b, %edi
movzbl %r14b, %edx
leaq 0x50(%rsp), %rsi
movq 0x20(%rsp), %rcx
callq 0x2ee1