// File: /workspace/github_c_makefile_star2_O1/jsh58[P]Genrich/Genrich.c
// Function: processAlns
void processAlns(char* qname, Aln* aln, int alnLen,
    double* totalLen, uint64_t* pairedPr,
    uint64_t* singlePr, uint64_t* orphan, bool singleOpt,
    bool extendOpt, int extend, bool avgExtOpt,
    Aln*** unpair, int* unpairIdx, int* unpairLen,
    int* unpairMem, float asDiff, bool atacOpt,
    int atacLen5, int atacLen3, bool atacAdj, File bed,
    bool bedOpt, bool gzOut, bool ctrl, int sample,
    bool dupsOpt, Read*** readPr, int* readIdxPr,
    int* readLenPr, int* readMemPr, Read*** readDc,
    int* readIdxDc, int* readLenDc, int* readMemDc,
    Read*** readSn, int* readIdxSn, int* readLenSn,
    int* readMemSn, uint16_t qualR1, uint16_t qualR2,
    uint64_t* errCount, bool verbose) {

  // determine if paired alns are valid, and best score
  float scorePr = NOSCORE, scoreR1 = NOSCORE,
    scoreR2 = NOSCORE;
  bool pair = false, singleR1 = false, singleR2 = false;
  for (int i = 0; i < alnLen; i++) {
    Aln* a = aln + i;
    if (a->paired) {
      if (a->full) {
        // valid paired aln
        if (! pair || scorePr < a->score)
          scorePr = a->score; // best score so far
        pair = true;
      } else
        (*orphan)++;  // incomplete paired alignment
    } else if (singleOpt && ! pair) {
      // update best scores of unpaired alns
      if (a->first && scoreR1 <= a->score) {
        scoreR1 = a->score;
        singleR1 = true;
      } else if (! a->first && scoreR2 <= a->score) {
        scoreR2 = a->score;
        singleR2 = true;
      }
    }
  }

  if (dupsOpt)
    // save alignments for later evaluation of duplicates
    saveAlns(qname, aln, alnLen, pair, singleOpt, singleR1,
      singleR2, scorePr, scoreR1, scoreR2, asDiff,
      readPr, readIdxPr, readLenPr, readMemPr,
      readDc, readIdxDc, readLenDc, readMemDc,
      readSn, readIdxSn, readLenSn, readMemSn,
      qualR1, qualR2);

  else {
    // process alns directly
    if (pair)
      // process paired alignments
      *pairedPr += processPair(qname, aln, alnLen,
        totalLen, scorePr, asDiff, atacOpt, atacLen5,
        atacLen3, atacAdj, bed, bedOpt, gzOut, ctrl,
        sample, errCount, verbose);
    else if (singleOpt) {
      // process unpaired alignments (separately for R1, R2)
      if (singleR1)
        *singlePr += processSingle(qname, aln, alnLen,
          extendOpt, extend, avgExtOpt,
          unpair, unpairIdx, unpairLen, unpairMem,
          scoreR1, asDiff, true,
          atacOpt, atacLen5, atacLen3, atacAdj,
          bed, bedOpt, gzOut, ctrl, sample, errCount,
          verbose);
      if (singleR2)
        *singlePr += processSingle(qname, aln, alnLen,
          extendOpt, extend, avgExtOpt,
          unpair, unpairIdx, unpairLen, unpairMem,
          scoreR2, asDiff, false,
          atacOpt, atacLen5, atacLen3, atacAdj,
          bed, bedOpt, gzOut, ctrl, sample, errCount,
          verbose);
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movaps %xmm0, %xmm3
movl %edx, %ebp
movq %rsi, %r14
movb 0x100(%rsp), %sil
movb 0x78(%rsp), %al
testl %edx, %edx
jle 0x9e6d
movq 0x70(%rsp), %r12
movl %ebp, %edx
shlq $0x3, %rdx
leaq (%rdx,%rdx,4), %rbx
movss 0x839d(%rip), %xmm0     # 0x12178
xorl %r10d, %r10d
xorl %r15d, %r15d
xorl %edx, %edx
xorl %r13d, %r13d
movaps %xmm0, %xmm2
movaps %xmm0, %xmm1
cmpb $0x1, 0xd(%r14,%r10)
jne 0x9e1d
cmpb $0x1, 0xe(%r14,%r10)
jne 0x9e57
testb $0x1, %r13b
je 0x9e11
movss 0x8(%r14,%r10), %xmm4
movb $0x1, %r13b
ucomiss %xmm0, %xmm4
jbe 0x9e5b
movss 0x8(%r14,%r10), %xmm0
movb $0x1, %r13b
jmp 0x9e5b
testb %al, %al
je 0x9e5b
testb $0x1, %r13b
jne 0x9e5b
movb 0xf(%r14,%r10), %r11b
cmpb $0x1, %r11b
jne 0x9e43
movss 0x8(%r14,%r10), %xmm4
ucomiss %xmm1, %xmm4
jae 0x9e66
testb %r11b, %r11b
jne 0x9e5b
movss 0x8(%r14,%r10), %xmm4
ucomiss %xmm2, %xmm4
jb 0x9e5b
movb $0x1, %r15b
movaps %xmm4, %xmm2
jmp 0x9e5b
incq (%r12)
addq $0x28, %r10
cmpq %r10, %rbx
jne 0x9dec
jmp 0x9e83
movaps %xmm4, %xmm1
movb $0x1, %dl
jmp 0x9e5b
movss 0x8303(%rip), %xmm1     # 0x12178
xorl %r13d, %r13d
movaps %xmm1, %xmm2
xorl %edx, %edx
xorl %r15d, %r15d
movaps %xmm1, %xmm0
testb %sil, %sil
je 0x9f2e
movzwl 0x168(%rsp), %ecx
subq $0x8, %rsp
movzwl 0x178(%rsp), %r11d
movzwl %cx, %ebx
movzbl %r15b, %r10d
andl $0x1, %r10d
movzbl %al, %r8d
movzbl %r13b, %ecx
andl $0x1, %ecx
movzbl %dl, %r9d
andl $0x1, %r9d
movq %r14, %rsi
movl %ebp, %edx
pushq %r11
pushq %rbx
pushq 0x178(%rsp)
pushq 0x178(%rsp)
pushq 0x178(%rsp)
pushq 0x178(%rsp)
pushq 0x178(%rsp)
pushq 0x178(%rsp)
pushq 0x178(%rsp)
pushq 0x178(%rsp)
pushq 0x178(%rsp)
pushq 0x178(%rsp)
pushq 0x178(%rsp)
pushq 0x178(%rsp)
pushq %r10
callq 0x94fa
addq $0xb8, %rsp
jmp 0xa190
movq %r15, 0x30(%rsp)
movq %r8, 0x8(%rsp)
movq %r9, 0x18(%rsp)
movb 0x180(%rsp), %r11b
movb 0xf0(%rsp), %bl
movb 0xe8(%rsp), %r10b
movb 0xe0(%rsp), %sil
movb 0xd0(%rsp), %r12b
movl 0xc8(%rsp), %r8d
movl 0xc0(%rsp), %r15d
movb 0xb8(%rsp), %r9b
testb $0x1, %r13b
je 0x9fe4
subq $0x8, %rsp
movzbl %r11b, %eax
movzbl %bl, %r11d
movzbl %r10b, %r10d
movzbl %sil, %ebx
movzbl %r12b, %r13d
movq %r8, %r12
movzbl %r9b, %r8d
movq %r14, %rsi
movl %ebp, %edx
movaps %xmm3, %xmm1
movl %r15d, %r9d
pushq %rax
pushq 0x188(%rsp)
movl 0x110(%rsp), %eax
pushq %rax
pushq %r11
pushq %r10
pushq %rbx
pushq 0x110(%rsp)
pushq %r13
pushq %r12
callq 0x9b16
addq $0x50, %rsp
movl %eax, %eax
movq 0x8(%rsp), %rcx
addq %rax, (%rcx)
jmp 0xa18c
testb %al, %al
je 0xa18c
movl 0x88(%rsp), %r8d
movzbl %r11b, %eax
movzbl %bl, %r15d
movzbl %r10b, %ebx
movzbl %sil, %r11d
movzbl %r12b, %r13d
movzbl %r9b, %r12d
movzbl 0x80(%rsp), %ecx
movzbl 0x90(%rsp), %r9d
testb $0x1, %dl
je 0xa114
movq %rdi, 0x8(%rsp)
movq 0x8(%rsp), %rdi
movq %r14, %rsi
movl %ebp, %edx
movl %ecx, (%rsp)
movl (%rsp), %ecx
movl %r9d, 0x4(%rsp)
movl 0x4(%rsp), %r9d
movaps %xmm1, %xmm0
movaps %xmm3, %xmm1
pushq %rax
pushq 0x180(%rsp)
movq %rax, 0x30(%rsp)
movl 0x108(%rsp), %eax
pushq %rax
pushq %r15
pushq %rbx
pushq %r11
pushq 0x108(%rsp)
pushq %r13
movl 0x108(%rsp), %eax
pushq %rax
movl 0x108(%rsp), %eax
pushq %rax
pushq %r12
pushq $0x1
pushq 0x110(%rsp)
pushq 0x110(%rsp)
pushq 0x110(%rsp)
pushq 0x110(%rsp)
movss %xmm3, 0x94(%rsp)
movss %xmm2, 0x90(%rsp)
movq %r15, 0xa8(%rsp)
movq %rbx, %r15
movq %r11, %rbx
callq 0x977b
movl 0x84(%rsp), %r9d
movl 0x108(%rsp), %r8d
movq 0x88(%rsp), %rdi
movq %rbx, %r11
movq %r15, %rbx
movq 0xa8(%rsp), %r15
movss 0x90(%rsp), %xmm2
movss 0x94(%rsp), %xmm3
addq $0x80, %rsp
movl %eax, %eax
movq 0x18(%rsp), %rcx
addq %rax, (%rcx)
movl (%rsp), %ecx
movq 0x20(%rsp), %rax
testb $0x1, 0x30(%rsp)
je 0xa18c
movq %r14, %rsi
movl %ebp, %edx
movaps %xmm2, %xmm0
movaps %xmm3, %xmm1
pushq %rax
pushq 0x180(%rsp)
movl 0x108(%rsp), %eax
pushq %rax
pushq %r15
pushq %rbx
pushq %r11
pushq 0x108(%rsp)
pushq %r13
movl 0x108(%rsp), %eax
pushq %rax
movl 0x108(%rsp), %eax
pushq %rax
pushq %r12
pushq $0x0
pushq 0x110(%rsp)
pushq 0x110(%rsp)
pushq 0x110(%rsp)
pushq 0x110(%rsp)
callq 0x977b
addq $0x80, %rsp
movl %eax, %eax
movq 0x18(%rsp), %rcx
jmp 0x9fdc
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq