// File: /workspace/github_c_makefile_star2_O3/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 $0x48, %rsp
movaps %xmm0, %xmm3
movl %edx, %ebx
movq %rsi, %r15
movq %rdi, %r12
movb 0x110(%rsp), %dl
movb 0x88(%rsp), %al
testl %ebx, %ebx
jle 0xa09b
movq %r8, %rbp
movb 0x100(%rsp), %r10b
movl %ebx, %esi
shlq $0x3, %rsi
leaq (%rsi,%rsi,4), %rdi
movss 0x81f6(%rip), %xmm0     # 0x12174
movaps %xmm0, %xmm2
movaps %xmm0, %xmm1
movq 0x80(%rsp), %r8
xorl %r14d, %r14d
xorl %r13d, %r13d
xorl %r11d, %r11d
xorl %esi, %esi
cmpb $0x1, 0xd(%r15,%r14)
jne 0x9fc1
cmpb $0x1, 0xe(%r15,%r14)
jne 0x9fe7
movss 0x8(%r15,%r14), %xmm4
testb $0x1, %sil
je 0x9fb9
ucomiss %xmm0, %xmm4
jbe 0x9ff5
movb $0x1, %sil
movaps %xmm4, %xmm0
jmp 0x9fea
testb %al, %al
je 0x9fea
testb $0x1, %sil
jne 0x9fea
movss 0x8(%r15,%r14), %xmm4
cmpb $0x1, 0xf(%r15,%r14)
jne 0x9ffa
ucomiss %xmm1, %xmm4
jb 0x9fea
movaps %xmm4, %xmm1
movb $0x1, %r11b
jmp 0x9fea
incq (%r8)
addq $0x28, %r14
cmpq %r14, %rdi
jne 0x9f97
jmp 0xa007
movb $0x1, %sil
jmp 0x9fea
ucomiss %xmm2, %xmm4
jb 0x9fea
movb $0x1, %r13b
movaps %xmm4, %xmm2
jmp 0x9fea
testb %dl, %dl
jne 0xa0b9
testb $0x1, %sil
je 0xa15e
subq $0x8, %rsp
movzbl 0x198(%rsp), %eax
movzbl %r10b, %r10d
movzbl 0x100(%rsp), %r11d
movzbl 0xf8(%rsp), %r14d
movzbl 0xe8(%rsp), %r13d
movzbl 0xd0(%rsp), %r8d
movq %r12, %rdi
movq %r15, %rsi
movl %ebx, %edx
movaps %xmm3, %xmm1
movl 0xd8(%rsp), %r9d
pushq %rax
pushq 0x198(%rsp)
movl 0x120(%rsp), %eax
pushq %rax
pushq %r10
pushq %r11
pushq %r14
pushq 0x120(%rsp)
pushq %r13
movl 0x120(%rsp), %eax
pushq %rax
callq 0x9c6a
addq $0x50, %rsp
movl %eax, %eax
addq %rax, (%rbp)
jmp 0xa338
testb %dl, %dl
je 0xa338
movss 0x80c9(%rip), %xmm0     # 0x12174
xorl %r13d, %r13d
xorl %r11d, %r11d
xorl %esi, %esi
movaps %xmm0, %xmm2
movaps %xmm0, %xmm1
movzwl 0x178(%rsp), %ecx
subq $0x8, %rsp
movzwl 0x188(%rsp), %r14d
movzwl %cx, %ebp
movzbl %r13b, %r10d
andl $0x1, %r10d
movzbl %al, %r8d
movzbl %sil, %ecx
andl $0x1, %ecx
movzbl %r11b, %r9d
andl $0x1, %r9d
movq %r12, %rdi
movq %r15, %rsi
movl %ebx, %edx
pushq %r14
pushq %rbp
pushq 0x188(%rsp)
pushq 0x188(%rsp)
pushq 0x188(%rsp)
pushq 0x188(%rsp)
pushq 0x188(%rsp)
pushq 0x188(%rsp)
pushq 0x188(%rsp)
pushq 0x188(%rsp)
pushq 0x188(%rsp)
pushq 0x188(%rsp)
pushq 0x188(%rsp)
pushq 0x188(%rsp)
pushq %r10
callq 0x9625
addq $0xc8, %rsp
jmp 0xa33c
testb %al, %al
je 0xa338
movq %r9, 0x10(%rsp)
movl %r10d, %eax
movzbl 0x190(%rsp), %r10d
movzbl %al, %r14d
movzbl 0xf8(%rsp), %ebp
movzbl 0xf0(%rsp), %edx
movzbl 0xe0(%rsp), %eax
movq %rax, 0x20(%rsp)
movzbl 0xc8(%rsp), %eax
movq %rax, 0x18(%rsp)
movzbl 0x90(%rsp), %ecx
movzbl 0xa0(%rsp), %r9d
testb $0x1, %r11b
movq %rdx, 0x40(%rsp)
movq %rbp, 0x38(%rsp)
movq %r14, 0x30(%rsp)
movq %r10, 0x28(%rsp)
je 0xa2a6
movq %r12, %rdi
movq %r15, %rsi
movq %rdx, %r11
movl %ebx, %edx
movl %ecx, (%rsp)
movl (%rsp), %ecx
movl 0x98(%rsp), %r8d
movl %r9d, 0x4(%rsp)
movl 0x4(%rsp), %r9d
movaps %xmm1, %xmm0
movaps %xmm3, %xmm1
pushq %r10
pushq 0x190(%rsp)
movl 0x118(%rsp), %eax
pushq %rax
pushq %r14
pushq %rbp
pushq %r11
pushq 0x118(%rsp)
pushq 0x58(%rsp)
movl 0x118(%rsp), %eax
pushq %rax
movl 0x118(%rsp), %eax
pushq %rax
movq 0x68(%rsp), %rax
pushq %rax
pushq $0x1
pushq 0x120(%rsp)
pushq 0x120(%rsp)
pushq 0x120(%rsp)
pushq 0x120(%rsp)
movss %xmm3, 0x8c(%rsp)
movss %xmm2, 0x88(%rsp)
callq 0x98a6
movl 0x80(%rsp), %ecx
movl 0x84(%rsp), %r9d
movss 0x88(%rsp), %xmm2
movss 0x8c(%rsp), %xmm3
addq $0x80, %rsp
movl %eax, %eax
movq 0x10(%rsp), %r14
addq %rax, (%r14)
testb $0x1, %r13b
jne 0xa2b5
jmp 0xa338
testb $0x1, %r13b
movq 0x10(%rsp), %r14
je 0xa338
movq %r12, %rdi
movq %r15, %rsi
movl %ebx, %edx
movl 0x98(%rsp), %r8d
movaps %xmm2, %xmm0
movaps %xmm3, %xmm1
pushq 0x28(%rsp)
pushq 0x190(%rsp)
movl 0x118(%rsp), %eax
pushq %rax
pushq 0x48(%rsp)
pushq 0x58(%rsp)
pushq 0x68(%rsp)
pushq 0x118(%rsp)
pushq 0x58(%rsp)
movl 0x118(%rsp), %eax
pushq %rax
movl 0x118(%rsp), %eax
pushq %rax
pushq 0x68(%rsp)
pushq $0x0
pushq 0x120(%rsp)
pushq 0x120(%rsp)
pushq 0x120(%rsp)
pushq 0x120(%rsp)
callq 0x98a6
addq $0x80, %rsp
movl %eax, %eax
addq %rax, (%r14)
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq