// File: /workspace/github_c_makefile_star2_O3/jsh58[P]Genrich/Genrich.c
// Function: processPair
int processPair(char* qname, Aln* aln, int alnLen,
    double* totalLen, float score, float asDiff,
    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 paired 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->full && 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)
    subsamplePair(aln, alnLen, &count, &score);

  // find full fragments to save
  uint64_t fragLen = 0;     // local sum of fragment lengths
  uint8_t saved = 0;
  for (int i = 0; i < alnLen; i++) {
    Aln* a = aln + i;
    if (a->paired && a->full && a->score >= score
        && a->chrom->save && ! a->chrom->skip) {

      // save full fragment
      fragLen += saveFragment(qname, a, count,
        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));
  }

  *totalLen += (double) fragLen / count;
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %rcx, 0x48(%rsp)
movaps %xmm0, %xmm2
subss %xmm1, %xmm2
movss 0x84e5(%rip), %xmm1     # 0x12174
cmpneqss %xmm0, %xmm1
andps %xmm1, %xmm2
andnps %xmm0, %xmm1
orps %xmm2, %xmm1
movss %xmm1, 0x4(%rsp)
testl %edx, %edx
jle 0x9ed4
movl %edx, %r12d
movq %rsi, %r15
movl %r9d, 0x14(%rsp)
movq %rdi, 0x18(%rsp)
movb 0x150(%rsp), %sil
movb 0x138(%rsp), %r11b
movb 0x130(%rsp), %bl
movb 0x128(%rsp), %dil
movb 0x118(%rsp), %r13b
movl %edx, %ebp
leaq (,%rbp,8), %rax
leaq (%rax,%rax,4), %rax
xorl %ecx, %ecx
xorl %r14d, %r14d
cmpb $0x1, 0xd(%r15,%rcx)
jne 0x9d25
cmpb $0x1, 0xe(%r15,%rcx)
jne 0x9d25
movss 0x8(%r15,%rcx), %xmm0
ucomiss %xmm1, %xmm0
jb 0x9d25
movq 0x20(%r15,%rcx), %rdx
cmpb $0x1, 0xd(%rdx)
jne 0x9d25
movb 0xc(%rdx), %dl
xorb $0x1, %dl
addb %dl, %r14b
addq $0x28, %rcx
cmpq %rcx, %rax
jne 0x9cf5
movb %r14b, 0x3(%rsp)
testb %r14b, %r14b
je 0x9ed4
cmpb $0xa, %r14b
ja 0x9d51
cmpb $0x9, %r14b
je 0x9d51
movzbl %r14b, %eax
cmpl $0x7, %eax
jne 0x9d97
leaq 0x3(%rsp), %r14
leaq 0x4(%rsp), %rcx
movq %r15, %rdi
movl %r12d, %esi
movq %r14, %rdx
movl %r8d, %ebx
movl %r11d, %r13d
callq 0x9b80
movl %r13d, %r11d
movb 0x118(%rsp), %r13b
movb 0x128(%rsp), %dil
movl %ebx, %r8d
movb 0x130(%rsp), %bl
movb 0x150(%rsp), %sil
movb (%r14), %r14b
testl %r12d, %r12d
jle 0x9ed8
movss 0x4(%rsp), %xmm1
xorl %r9d, %r9d
movzbl %sil, %r10d
movzbl %r11b, %r11d
movzbl %bl, %r12d
movzbl %dil, %eax
movq %rax, 0x40(%rsp)
movzbl %r13b, %eax
movq %rax, 0x38(%rsp)
movzbl %r14b, %edx
movzbl %r8b, %ecx
xorl %r8d, %r8d
cmpb $0x1, 0xd(%r15)
jne 0x9ea4
cmpb $0x1, 0xe(%r15)
jne 0x9ea4
movss 0x8(%r15), %xmm0
ucomiss %xmm1, %xmm0
jb 0x9ea4
movq 0x20(%r15), %rax
cmpb $0x1, 0xd(%rax)
jne 0x9ea4
cmpb $0x0, 0xc(%rax)
jne 0x9ea4
movq 0x18(%rsp), %rdi
movq %r15, %rsi
movq %r8, 0x20(%rsp)
movq %r9, 0x30(%rsp)
movl %edx, 0xc(%rsp)
movl 0x14(%rsp), %r8d
movl %ecx, 0x8(%rsp)
movl 0x110(%rsp), %r9d
pushq %r10
pushq 0x150(%rsp)
movl 0x150(%rsp), %eax
pushq %rax
pushq %r11
pushq %r12
pushq 0x68(%rsp)
pushq 0x150(%rsp)
pushq 0x70(%rsp)
movss %xmm1, 0x50(%rsp)
movq %r10, %rbx
movq %r12, 0x68(%rsp)
movq %r11, %r12
callq 0x90d6
movl 0x48(%rsp), %ecx
movl 0x4c(%rsp), %edx
movq 0x60(%rsp), %r8
movq 0x70(%rsp), %r9
movq %r12, %r11
movq 0x68(%rsp), %r12
movq %rbx, %r10
movss 0x50(%rsp), %xmm1
addq $0x40, %rsp
movl %eax, %eax
addq %rax, %r8
incb %r9b
cmpb %dl, %r9b
je 0x9f16
addq $0x28, %r15
decq %rbp
jne 0x9dd2
movq %r8, %xmm1
punpckldq 0x8392(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x839a(%rip), %xmm1     # 0x12260
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
jmp 0x9ede
xorl %eax, %eax
jmp 0x9f04
xorps %xmm0, %xmm0
xorl %r9d, %r9d
cmpb %r14b, %r9b
jne 0x9f1b
movzbl %r14b, %eax
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
divsd %xmm1, %xmm0
movq 0x48(%rsp), %rax
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
movl $0x1, %eax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %r14d, %r9d
jmp 0x9eb1
movzbl %r9b, %edi
movzbl %r14b, %edx
leaq 0x50(%rsp), %rsi
movq 0x18(%rsp), %rcx
callq 0x2f13