// File: /workspace/github_c_makefile_star2_O0/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 $0x148, %rsp            # imm = 0x148
movl %r8d, %r11d
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %r15
movb %r9b, %r10b
movb %cl, %bl
movb 0x1f8(%rsp), %al
movq 0x1f0(%rsp), %rcx
movl 0x1e8(%rsp), %ecx
movb 0x1e0(%rsp), %cl
movb 0x1d8(%rsp), %dl
movb 0x1d0(%rsp), %sil
movq 0x1c8(%rsp), %r12
movb 0x1c0(%rsp), %dil
movl 0x1b8(%rsp), %r8d
movl 0x1b0(%rsp), %r8d
movb 0x1a8(%rsp), %r8b
movb 0x1a0(%rsp), %r9b
movq 0x198(%rsp), %r13
movq 0x190(%rsp), %r13
movq 0x188(%rsp), %r13
movq 0x180(%rsp), %r13
movq %r12, 0x138(%rsp)
movq %r15, 0x130(%rsp)
movq %r14, 0x128(%rsp)
movl %ebp, 0x124(%rsp)
andb $0x1, %bl
movb %bl, 0x123(%rsp)
movl %r11d, 0x11c(%rsp)
andb $0x1, %r10b
movb %r10b, 0x11b(%rsp)
movss %xmm0, 0x114(%rsp)
movss %xmm1, 0x110(%rsp)
andb $0x1, %r9b
movb %r9b, 0x10f(%rsp)
andb $0x1, %r8b
movb %r8b, 0x10e(%rsp)
andb $0x1, %dil
movb %dil, 0x10d(%rsp)
andb $0x1, %sil
movb %sil, 0x10c(%rsp)
andb $0x1, %dl
movb %dl, 0x10b(%rsp)
andb $0x1, %cl
movb %cl, 0x10a(%rsp)
andb $0x1, %al
movb %al, 0x109(%rsp)
movss 0x114(%rsp), %xmm0
movss 0x108ba(%rip), %xmm1    # 0x1e1b4
ucomiss %xmm1, %xmm0
jne 0xd903
jp 0xd903
jmp 0xd922
movss 0x110(%rsp), %xmm1
movss 0x114(%rsp), %xmm0
subss %xmm1, %xmm0
movss %xmm0, 0x114(%rsp)
movb $0x0, 0x108(%rsp)
movl $0x0, 0x104(%rsp)
movl 0x104(%rsp), %eax
cmpl 0x124(%rsp), %eax
jge 0xd9fa
movq 0x128(%rsp), %rax
movslq 0x104(%rsp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, 0xf8(%rsp)
movq 0xf8(%rsp), %rax
testb $0x1, 0xd(%rax)
jne 0xd9e2
movq 0xf8(%rsp), %rax
movb 0xf(%rax), %al
andb $0x1, %al
movzbl %al, %eax
movb 0x10f(%rsp), %cl
andb $0x1, %cl
movzbl %cl, %ecx
cmpl %ecx, %eax
jne 0xd9e2
movq 0xf8(%rsp), %rax
movss 0x8(%rax), %xmm0
ucomiss 0x114(%rsp), %xmm0
jb 0xd9e2
movq 0xf8(%rsp), %rax
movq 0x20(%rax), %rax
testb $0x1, 0xd(%rax)
je 0xd9e2
movq 0xf8(%rsp), %rax
movq 0x20(%rax), %rax
testb $0x1, 0xc(%rax)
jne 0xd9e2
movb 0x108(%rsp), %al
addb $0x1, %al
movb %al, 0x108(%rsp)
jmp 0xd9e4
movl 0x104(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x104(%rsp)
jmp 0xd935
cmpb $0x0, 0x108(%rsp)
jne 0xda14
movl $0x0, 0x144(%rsp)
jmp 0xdd0e
movzbl 0x108(%rsp), %eax
cmpl $0xa, %eax
jg 0xda3b
movzbl 0x108(%rsp), %eax
cmpl $0x7, %eax
je 0xda3b
movzbl 0x108(%rsp), %eax
cmpl $0x9, %eax
jne 0xda6b
movq 0x128(%rsp), %rdi
movl 0x124(%rsp), %esi
movb 0x10f(%rsp), %al
leaq 0x108(%rsp), %rcx
leaq 0x114(%rsp), %r8
andb $0x1, %al
movzbl %al, %edx
callq 0xd5e0
movb $0x0, 0xf7(%rsp)
movl $0x0, 0xf0(%rsp)
movl 0xf0(%rsp), %eax
cmpl 0x124(%rsp), %eax
jge 0xdcad
movq 0x128(%rsp), %rax
movslq 0xf0(%rsp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, 0xe8(%rsp)
movq 0xe8(%rsp), %rax
testb $0x1, 0xd(%rax)
jne 0xdc95
movq 0xe8(%rsp), %rax
movb 0xf(%rax), %al
andb $0x1, %al
movzbl %al, %eax
movb 0x10f(%rsp), %cl
andb $0x1, %cl
movzbl %cl, %ecx
cmpl %ecx, %eax
jne 0xdc95
movq 0xe8(%rsp), %rax
movss 0x8(%rax), %xmm0
ucomiss 0x114(%rsp), %xmm0
jb 0xdc95
movq 0xe8(%rsp), %rax
movq 0x20(%rax), %rax
testb $0x1, 0xd(%rax)
je 0xdc95
movq 0xe8(%rsp), %rax
movq 0x20(%rax), %rax
testb $0x1, 0xc(%rax)
jne 0xdc95
testb $0x1, 0x11b(%rsp)
je 0xdb81
movq 0x130(%rsp), %rdi
movq 0xe8(%rsp), %rsi
movb 0x108(%rsp), %dl
movq 0x180(%rsp), %rcx
movq 0x188(%rsp), %r8
movq 0x190(%rsp), %r9
movq 0x198(%rsp), %rax
movzbl %dl, %edx
movq %rax, (%rsp)
callq 0xc010
jmp 0xdc72
movq 0x130(%rsp), %rdi
movq 0xe8(%rsp), %rsi
movb 0x108(%rsp), %dl
movb 0x123(%rsp), %cl
movl 0x11c(%rsp), %r8d
movb 0x10e(%rsp), %r9b
movl 0x1b0(%rsp), %eax
movl %eax, 0x58(%rsp)
movl 0x1b8(%rsp), %r13d
movb 0x10d(%rsp), %r12b
movb 0x10c(%rsp), %r14b
movb 0x10b(%rsp), %bpl
movb 0x10a(%rsp), %bl
movl 0x1e8(%rsp), %r11d
movq 0x1f0(%rsp), %r10
movb 0x109(%rsp), %al
movq 0x138(%rsp), %r15
andb $0x1, %cl
andb $0x1, %r9b
andb $0x1, %r12b
andb $0x1, %r14b
andb $0x1, %bpl
andb $0x1, %bl
andb $0x1, %al
movb %al, 0x5f(%rsp)
movl 0x58(%rsp), %eax
movzbl %dl, %edx
movzbl %cl, %ecx
movzbl %r9b, %r9d
movl %eax, (%rsp)
movb 0x5f(%rsp), %al
movl %r13d, 0x8(%rsp)
movzbl %r12b, %r12d
movl %r12d, 0x10(%rsp)
movq %r15, 0x18(%rsp)
movzbl %r14b, %r14d
movl %r14d, 0x20(%rsp)
movzbl %bpl, %ebp
movl %ebp, 0x28(%rsp)
movzbl %bl, %ebx
movl %ebx, 0x30(%rsp)
movl %r11d, 0x38(%rsp)
movq %r10, 0x40(%rsp)
movzbl %al, %eax
movl %eax, 0x48(%rsp)
callq 0xc190
movb 0xf7(%rsp), %al
addb $0x1, %al
movb %al, 0xf7(%rsp)
movzbl %al, %eax
movzbl 0x108(%rsp), %ecx
cmpl %ecx, %eax
jne 0xdc93
jmp 0xdcad
jmp 0xdc95
jmp 0xdc97
movl 0xf0(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xf0(%rsp)
jmp 0xda7e
movzbl 0xf7(%rsp), %eax
movzbl 0x108(%rsp), %ecx
cmpl %ecx, %eax
je 0xdd03
leaq 0x60(%rsp), %rdi
movzbl 0xf7(%rsp), %edx
movq 0x130(%rsp), %rcx
movzbl 0x108(%rsp), %r8d
leaq 0x11f97(%rip), %rsi     # 0x1fc7d
movb $0x0, %al
callq 0x22a0
leaq 0x60(%rsp), %rdi
movl $0x21, %esi
callq 0x2840
movl %eax, %edi
callq 0x22b0
movl $0x1, 0x144(%rsp)
movl 0x144(%rsp), %eax
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopw (%rax,%rax)