// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/extended/hpol_processor.c
// Function: gt_hpol_processor_output_stats
static void gt_hpol_processor_output_stats(GtAlignedSegment *as,
    GtUword r_hpos, GtUword coverage, GtUword r_hlen,
    GtUword r_supp, GtUword s_hlen, GtUword a_hlen,
    GtUword a_supp, char s_char, double s_q_ave,
    GtUword c_len, GtFile *outfp)
{
  GtUword i, pos, s_hpos = 0, s_offset, s_q_bef, s_q_aft, s_q_value,
                s_q_min, s_q_max, s_q_range, s_q_first, s_q_last = 0, s_hend,
                s_mapq;
  char *s_qual, *q, edit, s_or;
  const char *s_id;
  gt_assert(r_hlen != s_hlen);
  edit = r_hlen > s_hlen ? 'I' : 'D';
  gt_assert(coverage > 0);
  r_supp = r_supp * 100 / coverage;
  a_supp = a_supp * 100 / coverage;
  s_id = gt_aligned_segment_description(as);
  s_mapq = gt_aligned_segment_mapping_quality(as);
  q = gt_aligned_segment_qual(as);
  gt_assert(s_hlen > 0);
  s_hpos = gt_aligned_segment_orig_seqpos_for_refpos(as, r_hpos);
  s_offset = gt_aligned_segment_offset_for_refpos(as, r_hpos);
  s_qual = gt_malloc(sizeof (*s_qual) * (s_hlen + 1UL));
  s_q_bef = GT_UNDEF_UWORD;
  for (i = s_offset; i > 0; /**/)
  {
    i--;
    if (q[i] != GT_UNDEF_CHAR)
    {
      s_q_bef = GT_HPOL_PROCESSOR_QUAL(q[i]);
      break;
    }
  }
  gt_assert(s_q_bef != GT_UNDEF_UWORD);
  s_q_min = ULONG_MAX;
  s_q_max = 0;
  s_q_first = GT_UNDEF_UWORD;
  if (!gt_aligned_segment_is_reverse(as))
  {
    for (i = s_offset, pos = 0; pos < s_hlen; i++)
    {
      if (q[i] != GT_UNDEF_CHAR)
      {
        s_qual[pos] = q[i];
        pos++;
        s_q_value = GT_HPOL_PROCESSOR_QUAL(q[i]);
        if (s_q_value < s_q_min)
          s_q_min = s_q_value;
        if (s_q_value > s_q_max)
          s_q_max = s_q_value;
        if (s_q_first == GT_UNDEF_UWORD)
          s_q_first = s_q_value;
        s_q_last = s_q_value;
      }
    }
  }
  else
  {
    for (i = s_offset, pos = s_hlen; pos > 0; i++)
    {
      if (q[i] != GT_UNDEF_CHAR)
      {
        s_qual[pos - 1UL] = q[i];
        pos--;
        s_q_value = GT_HPOL_PROCESSOR_QUAL(q[i]);
        if (s_q_value < s_q_min)
          s_q_min = s_q_value;
        if (s_q_value > s_q_max)
          s_q_max = s_q_value;
        if (s_q_first == GT_UNDEF_UWORD)
          s_q_first = s_q_value;
        s_q_last = s_q_value;
      }
    }
  }
  s_qual[s_hlen] = '\0';
  s_q_aft = GT_UNDEF_UWORD;
  for (/**/; i < gt_aligned_segment_length(as); i++)
  {
    if (q[i] != GT_UNDEF_CHAR)
    {
      s_q_aft = GT_HPOL_PROCESSOR_QUAL(q[i]);
      break;
    }
  }
  gt_assert(s_q_aft != GT_UNDEF_UWORD);
  gt_assert(s_q_min < ULONG_MAX);
  gt_assert(s_q_max >= s_q_min);
  s_q_range = s_q_max - s_q_min + 1UL;
  /* convert to 1-based coordinates */
  r_hpos++;
  s_hpos++;
  /* handle reverse alignments */
  if (gt_aligned_segment_is_reverse(as))
  {
    /* complement char */
    GtError *err = gt_error_new();
    (void)gt_complement(&s_char, s_char, err);
    gt_error_delete(err);
    /* correct coords on s */
    s_hend = s_hpos;
    s_hpos = s_hpos - s_hlen + 1UL;
    s_or = '-';
    /* swap q values */
    s_q_value = s_q_aft;
    s_q_aft = s_q_bef;
    s_q_bef = s_q_value;
    s_q_value = s_q_last;
    s_q_last = s_q_first;
    s_q_first = s_q_value;
  }
  else
  {
    s_hend = s_hpos + s_hlen - 1UL;
    s_or = '+';
  }
  gt_file_xprintf(outfp,
                  GT_WU "\t%c\t" GT_WU "\t" GT_WU "\t%c\t%c\t" GT_WU "\t" GT_WU
                  "\t" GT_WU "\t" GT_WU "\t" GT_WU "\t" GT_WU "\t" GT_WU "\t"
                  GT_WU "\t" GT_WU "\t" GT_WU "\t" GT_WU "\t%.2f\t" GT_WU "\t"
                  GT_WU "\t" GT_WU "\t" GT_WU "\t%s\t%s\n",
                  r_hpos, edit, s_hpos, s_hend, s_char, s_or, c_len, coverage,
                  r_hlen, r_supp, s_hlen, a_hlen, a_supp, s_mapq, s_q_bef,
                  s_q_first, s_q_min, s_q_ave, s_q_max, s_q_range, s_q_last,
                  s_q_aft, s_qual, s_id);
  gt_free(s_qual);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
cmpq %r9, %rcx
je 0x153f9a
movq %rdx, %rbp
movq %r8, 0x48(%rsp)
movsd %xmm0, 0x50(%rsp)
movq %r9, 0x10(%rsp)
movq %rcx, 0x80(%rsp)
testq %rdx, %rdx
je 0x153f9f
movq %rsi, %r15
movq %rdi, %r14
movb 0xd0(%rsp), %al
movb %al, 0x7(%rsp)
callq 0x2fa9f7
movq %rax, 0x68(%rsp)
movq %r14, %rdi
callq 0x2fa78b
movq %rax, 0x70(%rsp)
movq %r14, %rdi
callq 0x2fa7ba
movq %rax, %rbx
movq %r14, %rdi
movq %r15, %rsi
callq 0x2fa87e
movq %rax, 0x18(%rsp)
movq %r14, %rdi
movq %r15, 0x78(%rsp)
movq %r15, %rsi
callq 0x2fa819
movq %rax, %r12
movq 0x10(%rsp), %rax
leaq 0x1(%rax), %rdi
leaq 0x22f97b(%rip), %rsi    # 0x3835b9
movl $0x19f, %edx            # imm = 0x19F
callq 0x104226
movq %r12, %rcx
movq %r12, %rdx
subq $0x1, %rdx
jb 0x153f90
movsbq -0x1(%rbx,%rcx), %r13
movq %rdx, %rcx
cmpq $0x7f, %r13
je 0x153c4e
addq $-0x21, %r13
cmpq $-0x1, %r13
je 0x153f90
movq %rax, 0x28(%rsp)
movq %r14, %rdi
callq 0x2fa80a
testb %al, %al
je 0x153cf5
movq 0x10(%rsp), %rdx
testq %rdx, %rdx
movq 0x28(%rsp), %rsi
je 0x153d5e
movq $-0x1, %rdi
xorl %r15d, %r15d
movq %rdx, %rax
xorl %r8d, %r8d
movq $-0x1, 0x8(%rsp)
movb (%rbx,%r12), %cl
cmpb $0x7f, %cl
je 0x153ceb
movb %cl, -0x1(%rsi,%rax)
decq %rax
movsbq (%rbx,%r12), %r15
addq $-0x21, %r15
movq 0x8(%rsp), %rcx
cmpq %rcx, %r15
cmovbq %r15, %rcx
movq %rcx, 0x8(%rsp)
cmpq %r8, %r15
cmovaq %r15, %r8
cmpq $-0x1, %rdi
cmoveq %r15, %rdi
incq %r12
testq %rax, %rax
jne 0x153cb2
jmp 0x153d74
movq 0x10(%rsp), %rdx
testq %rdx, %rdx
movq 0x28(%rsp), %rsi
je 0x153d5e
movq $-0x1, %rdi
xorl %eax, %eax
xorl %r15d, %r15d
xorl %r8d, %r8d
movq $-0x1, 0x8(%rsp)
movb (%rbx,%r12), %cl
cmpb $0x7f, %cl
je 0x153d54
movb %cl, (%rsi,%rax)
incq %rax
movsbq (%rbx,%r12), %r15
addq $-0x21, %r15
movq 0x8(%rsp), %rcx
cmpq %rcx, %r15
cmovbq %r15, %rcx
movq %rcx, 0x8(%rsp)
cmpq %r8, %r15
cmovaq %r15, %r8
cmpq $-0x1, %rdi
cmoveq %r15, %rdi
incq %r12
cmpq %rdx, %rax
jb 0x153d1c
jmp 0x153d74
movq $-0x1, 0x8(%rsp)
xorl %r8d, %r8d
movq $-0x1, %rdi
xorl %r15d, %r15d
movq %r8, 0x58(%rsp)
movq %rdi, 0x20(%rsp)
movq %rbp, 0x60(%rsp)
movb $0x0, (%rsi,%rdx)
movq %r14, %rdi
callq 0x2fa7da
cmpq %rax, %r12
jae 0x153f95
movsbq (%rbx,%r12), %rbp
cmpq $0x7f, %rbp
jne 0x153da8
incq %r12
jmp 0x153d87
addq $-0x21, %rbp
cmpq $-0x1, %rbp
je 0x153f95
movq 0x8(%rsp), %rax
cmpq $-0x1, %rax
movq 0x58(%rsp), %r12
je 0x153fa4
subq %rax, %r12
movq 0x18(%rsp), %rbx
jb 0x153fa9
leaq 0x1(%rbx), %rax
movq %rax, 0x30(%rsp)
movq %r14, %rdi
callq 0x2fa80a
testb %al, %al
je 0x153e62
callq 0xfcb4c
movq %rax, %r14
movsbl 0x7(%rsp), %esi
leaq 0xd0(%rsp), %rdi
movq %rax, %rdx
callq 0x2f7ce8
movq %r14, %rdi
callq 0xfcccd
movq 0x10(%rsp), %r10
subq %r10, %rbx
addq $0x2, %rbx
movl $0x2d, %eax
movq %rax, 0x18(%rsp)
leaq 0xd0(%rsp), %rax
movb (%rax), %sil
movq %r13, 0x38(%rsp)
movq %r15, 0x40(%rsp)
movq 0x30(%rsp), %r9
movq %rbx, %r8
movsd 0x50(%rsp), %xmm0
movq 0xe0(%rsp), %rdi
movq 0x48(%rsp), %rcx
movq 0xc8(%rsp), %rax
jmp 0x153eb3
movq 0x10(%rsp), %r10
addq %r10, %rbx
movl $0x2b, %eax
movq %rax, 0x18(%rsp)
movq %rbp, 0x38(%rsp)
movq %r13, %rbp
movq 0x20(%rsp), %rax
movq %rax, 0x40(%rsp)
movq %r15, 0x20(%rsp)
movq %rbx, %r9
movsd 0x50(%rsp), %xmm0
movq 0xe0(%rsp), %rdi
movq 0x48(%rsp), %rcx
movb 0x7(%rsp), %sil
movq 0xc8(%rsp), %rax
movq 0x30(%rsp), %r8
movq 0x78(%rsp), %r15
incq %r15
incq %r12
imulq $0x64, %rax, %rax
xorl %edx, %edx
movq 0x60(%rsp), %r13
divq %r13
movq %rax, %rbx
imulq $0x64, %rcx, %rax
xorl %edx, %edx
divq %r13
movq %rax, %r11
xorl %eax, %eax
movq 0x80(%rsp), %r14
cmpq %r10, %r14
seta %al
leal (%rax,%rax,4), %ecx
addl $0x44, %ecx
movsbl %sil, %eax
movq %rax, 0x10(%rsp)
subq $0x8, %rsp
leaq 0x2300a6(%rip), %rsi    # 0x383fab
movq %r15, %rdx
movb $0x1, %al
pushq 0x70(%rsp)
movq 0x38(%rsp), %r15
pushq %r15
pushq 0x50(%rsp)
pushq 0x40(%rsp)
pushq %r12
pushq 0x88(%rsp)
pushq 0x40(%rsp)
pushq 0x80(%rsp)
pushq %rbp
pushq 0xc0(%rsp)
pushq %rbx
pushq 0x120(%rsp)
pushq %r10
pushq %r11
pushq %r14
pushq %r13
pushq 0x160(%rsp)
pushq 0xa8(%rsp)
pushq 0xa8(%rsp)
callq 0xfee51
addq $0xa0, %rsp
leaq 0x22f648(%rip), %rsi    # 0x3835b9
movq %r15, %rdi
movl $0x206, %edx            # imm = 0x206
callq 0x1045eb
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x48c0e
callq 0x48bd5
callq 0x48c80
callq 0x48c47
callq 0x48b9c
callq 0x48b63