// File: /workspace/github_c_makefile_star2_O0/jsh58[P]Genrich/Genrich.c
// Function: parseAlign
bool parseAlign(Aln** aln, int* alnLen, uint16_t flag,
    Chrom* chrom, uint32_t pos, int length, uint32_t pnext,
    uint64_t* paired, uint64_t* single, uint64_t* secPair,
    uint64_t* secSingle, uint64_t* skipped, bool singleOpt,
    float score, bool dupsOpt, char* qual, int qualLen,
    int offset, uint16_t* qualR1, uint16_t* qualR2) {

  // check for linear template or missing index
  if (flag & 0x1) {
    if ((flag & 0xC0) == 0xC0)
      exit(error("", ERRLINEAR));
    if (!(flag & 0xC0))
      exit(error("", ERRINDEX));
  }

  // save sum of quality scores (only if removing dups)
  if (dupsOpt) {
    if (flag & 0x40) {
      if (! *qualR1 && strcmp(qual, "*"))
        *qualR1 = sumQual(qual, qualLen, offset);
    } else {
      if (! *qualR2 && strcmp(qual, "*"))
        *qualR2 = sumQual(qual, qualLen, offset);
    }
  }

  // paired alignment: save alignment information
  if ((flag & 0x3) == 0x3) {

    // update counts
    if (chrom->skip || ! chrom->save)
      (*skipped)++;
    else {
      (*paired)++;
      if (flag & 0x100)
        (*secPair)++;
    }

    // search for matching paired alignment (already analyzed)
    for (int i = 0; i < *alnLen; i++) {
      Aln* a = *aln + i;
      if ( a->paired && ! a->full && a->chrom == chrom
          && (flag & 0x40 ? (! a->first && a->pos[0] == pos)
            : (a->first && a->pos[1] == pos) )
          && (flag & 0x100 ? ! a->primary : a->primary) ) {
        // complete paired alignment
        updatePairedAln(a, flag, pos, length, score);
        return true;
      }
    }

    // not found: start new paired alignment
    return savePairedAln(aln, alnLen, flag, chrom,
      pos, length, pnext, score);
  }

  // unpaired alignment
  if (chrom->skip || ! chrom->save)
    (*skipped)++;
  else {
    (*single)++;
    if (flag & 0x100)
      (*secSingle)++;
  }

  // save alignment info
  if (singleOpt)
    return saveSingleAln(aln, alnLen, flag, chrom,
      pos, length, score);

  return true;
}

// Assembly:
subq $0x68, %rsp
movq %rcx, 0x10(%rsp)
movl %edx, %eax
movq 0x10(%rsp), %rdx
movq %rsi, 0x18(%rsp)
movq %rdi, %r10
movq 0x18(%rsp), %rdi
movw %ax, %si
movq 0xd0(%rsp), %rax
movq 0xc8(%rsp), %rax
movl 0xc0(%rsp), %eax
movl 0xb8(%rsp), %eax
movq 0xb0(%rsp), %rax
movb 0xa8(%rsp), %al
movb 0xa0(%rsp), %cl
movq 0x98(%rsp), %r11
movq 0x90(%rsp), %r11
movq 0x88(%rsp), %r11
movq 0x80(%rsp), %r11
movq 0x78(%rsp), %r11
movl 0x70(%rsp), %r11d
movq %r10, 0x58(%rsp)
movq %rdi, 0x50(%rsp)
movw %si, 0x4e(%rsp)
movq %rdx, 0x40(%rsp)
movl %r8d, 0x3c(%rsp)
movl %r9d, 0x38(%rsp)
andb $0x1, %cl
movb %cl, 0x37(%rsp)
movss %xmm0, 0x30(%rsp)
andb $0x1, %al
movb %al, 0x2f(%rsp)
movzwl 0x4e(%rsp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x1394e
movzwl 0x4e(%rsp), %eax
andl $0xc0, %eax
cmpl $0xc0, %eax
jne 0x13925
leaq 0xc45e(%rip), %rdi      # 0x1fd72
movl $0x1d, %esi
callq 0x2840
movl %eax, %edi
callq 0x22b0
movzwl 0x4e(%rsp), %eax
andl $0xc0, %eax
cmpl $0x0, %eax
jne 0x1394c
leaq 0xc437(%rip), %rdi      # 0x1fd72
movl $0x1e, %esi
callq 0x2840
movl %eax, %edi
callq 0x22b0
jmp 0x1394e
testb $0x1, 0x2f(%rsp)
je 0x13a0c
movzwl 0x4e(%rsp), %eax
andl $0x40, %eax
cmpl $0x0, %eax
je 0x139b8
movq 0xc8(%rsp), %rax
cmpw $0x0, (%rax)
jne 0x139b6
movq 0xb0(%rsp), %rdi
leaq 0xbcb4(%rip), %rsi      # 0x1f637
callq 0x21a0
cmpl $0x0, %eax
je 0x139b6
movq 0xb0(%rsp), %rdi
movl 0xb8(%rsp), %esi
movl 0xc0(%rsp), %edx
callq 0x137a0
movw %ax, %cx
movq 0xc8(%rsp), %rax
movw %cx, (%rax)
jmp 0x13a0a
movq 0xd0(%rsp), %rax
cmpw $0x0, (%rax)
jne 0x13a08
movq 0xb0(%rsp), %rdi
leaq 0xbc62(%rip), %rsi      # 0x1f637
callq 0x21a0
cmpl $0x0, %eax
je 0x13a08
movq 0xb0(%rsp), %rdi
movl 0xb8(%rsp), %esi
movl 0xc0(%rsp), %edx
callq 0x137a0
movw %ax, %cx
movq 0xd0(%rsp), %rax
movw %cx, (%rax)
jmp 0x13a0a
jmp 0x13a0c
movzwl 0x4e(%rsp), %eax
andl $0x3, %eax
cmpl $0x3, %eax
jne 0x13bbe
movq 0x40(%rsp), %rax
testb $0x1, 0xc(%rax)
jne 0x13a33
movq 0x40(%rsp), %rax
testb $0x1, 0xd(%rax)
jne 0x13a47
movq 0x98(%rsp), %rax
movq (%rax), %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
jmp 0x13a79
movq 0x78(%rsp), %rax
movq (%rax), %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
movzwl 0x4e(%rsp), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
je 0x13a77
movq 0x88(%rsp), %rax
movq (%rax), %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
jmp 0x13a79
movl $0x0, 0x28(%rsp)
movl 0x28(%rsp), %eax
movq 0x50(%rsp), %rcx
cmpl (%rcx), %eax
jge 0x13b80
movq 0x58(%rsp), %rax
movq (%rax), %rax
movslq 0x28(%rsp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rax
testb $0x1, 0xd(%rax)
je 0x13b6e
movq 0x20(%rsp), %rax
testb $0x1, 0xe(%rax)
jne 0x13b6e
movq 0x20(%rsp), %rax
movq 0x20(%rax), %rax
cmpq 0x40(%rsp), %rax
jne 0x13b6e
movzwl 0x4e(%rsp), %eax
andl $0x40, %eax
cmpl $0x0, %eax
je 0x13b04
movq 0x20(%rsp), %rax
testb $0x1, 0xf(%rax)
jne 0x13b6e
movq 0x20(%rsp), %rax
movl (%rax), %eax
cmpl 0x3c(%rsp), %eax
je 0x13b1d
jmp 0x13b6e
movq 0x20(%rsp), %rax
testb $0x1, 0xf(%rax)
je 0x13b6e
movq 0x20(%rsp), %rax
movl 0x4(%rax), %eax
cmpl 0x3c(%rsp), %eax
jne 0x13b6e
movzwl 0x4e(%rsp), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
je 0x13b39
movq 0x20(%rsp), %rax
testb $0x1, 0xc(%rax)
jne 0x13b6e
jmp 0x13b44
movq 0x20(%rsp), %rax
testb $0x1, 0xc(%rax)
je 0x13b6e
movq 0x20(%rsp), %rdi
movw 0x4e(%rsp), %ax
movl 0x3c(%rsp), %edx
movl 0x38(%rsp), %ecx
movss 0x30(%rsp), %xmm0
movzwl %ax, %esi
callq 0x13440
movb $0x1, 0x67(%rsp)
jmp 0x13c5d
jmp 0x13b70
movl 0x28(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x28(%rsp)
jmp 0x13a81
movq 0x58(%rsp), %rdi
movq 0x50(%rsp), %rsi
movw 0x4e(%rsp), %dx
movq 0x40(%rsp), %rcx
movl 0x3c(%rsp), %r8d
movl 0x38(%rsp), %r9d
movl 0x70(%rsp), %eax
movss 0x30(%rsp), %xmm0
movzwl %dx, %edx
movl %eax, (%rsp)
callq 0x13530
andb $0x1, %al
movb %al, 0x67(%rsp)
jmp 0x13c5d
movq 0x40(%rsp), %rax
testb $0x1, 0xc(%rax)
jne 0x13bd4
movq 0x40(%rsp), %rax
testb $0x1, 0xd(%rax)
jne 0x13be8
movq 0x98(%rsp), %rax
movq (%rax), %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
jmp 0x13c1d
movq 0x80(%rsp), %rax
movq (%rax), %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
movzwl 0x4e(%rsp), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
je 0x13c1b
movq 0x90(%rsp), %rax
movq (%rax), %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
jmp 0x13c1d
testb $0x1, 0x37(%rsp)
je 0x13c58
movq 0x58(%rsp), %rdi
movq 0x50(%rsp), %rsi
movw 0x4e(%rsp), %ax
movq 0x40(%rsp), %rcx
movl 0x3c(%rsp), %r8d
movl 0x38(%rsp), %r9d
movss 0x30(%rsp), %xmm0
movzwl %ax, %edx
callq 0x13690
andb $0x1, %al
movb %al, 0x67(%rsp)
jmp 0x13c5d
movb $0x1, 0x67(%rsp)
movb 0x67(%rsp), %al
andb $0x1, %al
addq $0x68, %rsp
retq
nopl (%rax,%rax)