// File: /workspace/github_c_makefile_star2_O2/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
movq %rdi, 0x10(%rsp)
cmpq %r9, %rcx
je 0xf0382
movq %rdx, %r14
movq %r8, 0x60(%rsp)
movsd %xmm0, 0x30(%rsp)
testq %rdx, %rdx
je 0xf03b0
movq %r9, %r13
movq %rcx, %r15
movq %rsi, %r12
movb 0xd0(%rsp), %al
movb %al, 0xf(%rsp)
movq 0x10(%rsp), %rbp
movq %rbp, %rdi
callq 0x29693c
movq %rax, 0x78(%rsp)
movq %rbp, %rdi
callq 0x2962a8
movq %rax, 0x80(%rsp)
movq %rbp, %rdi
callq 0x296370
movq %rax, %rbx
movq %rbp, %rdi
movq %r12, %rsi
callq 0x2965ea
movq %rax, 0x28(%rsp)
movq %rbp, %rdi
movq %r12, 0x58(%rsp)
movq %r12, %rsi
callq 0x296501
movq %rax, %r12
movq %r13, 0x18(%rsp)
leaq 0x1(%r13), %rdi
leaq 0x2339b6(%rip), %rsi    # 0x3239c1
movl $0x19f, %edx            # imm = 0x19F
callq 0x93160
movq %rax, 0x38(%rsp)
movq %r12, %rcx
movq %r12, %rax
subq $0x1, %rax
jb 0xf031c
movsbq -0x1(%rbx,%rcx), %rbp
movq %rax, %rcx
cmpq $0x7f, %rbp
je 0xf0020
addq $-0x21, %rbp
cmpq $-0x1, %rbp
je 0xf031c
movq %r15, 0x68(%rsp)
movq 0x10(%rsp), %rdi
callq 0x2964bf
testb %al, %al
movq %r14, 0x70(%rsp)
pushq $-0x1
popq %r15
je 0xf00be
xorl %esi, %esi
movq %r15, 0x20(%rsp)
xorl %r13d, %r13d
movq 0x18(%rsp), %rax
movq 0x38(%rsp), %rdx
testq %rax, %rax
je 0xf0113
movb (%rbx,%r12), %cl
cmpb $0x7f, %cl
je 0xf00b9
movb %cl, -0x1(%rdx,%rax)
decq %rax
movsbq (%rbx,%r12), %r13
addq $-0x21, %r13
movq 0x20(%rsp), %rcx
cmpq %rcx, %r13
cmovbq %r13, %rcx
movq %rcx, 0x20(%rsp)
cmpq %rsi, %r13
cmovaq %r13, %rsi
cmpq $-0x1, %r15
cmoveq %r13, %r15
incq %r12
jmp 0xf0077
xorl %esi, %esi
movq %r15, 0x20(%rsp)
xorl %r13d, %r13d
xorl %eax, %eax
movq 0x38(%rsp), %rdx
cmpq 0x18(%rsp), %rax
jae 0xf0113
movb (%rbx,%r12), %cl
cmpb $0x7f, %cl
je 0xf010e
movb %cl, (%rdx,%rax)
incq %rax
movsbq (%rbx,%r12), %r13
addq $-0x21, %r13
movq 0x20(%rsp), %rcx
cmpq %rcx, %r13
cmovbq %r13, %rcx
movq %rcx, 0x20(%rsp)
cmpq %rsi, %r13
cmovaq %r13, %rsi
cmpq $-0x1, %r15
cmoveq %r13, %r15
incq %r12
jmp 0xf00cf
movq %rsi, 0x40(%rsp)
movq 0x18(%rsp), %rax
movq 0x38(%rsp), %rcx
movb $0x0, (%rcx,%rax)
movq 0x10(%rsp), %rdi
callq 0x2963f6
cmpq %rax, %r12
jae 0xf034a
movsbq (%rbx,%r12), %r14
incq %r12
cmpq $0x7f, %r14
je 0xf0126
addq $-0x21, %r14
cmpq $-0x1, %r14
je 0xf034a
movq 0x20(%rsp), %rax
cmpq $-0x1, %rax
je 0xf03de
movq 0x40(%rsp), %rbx
subq %rax, %rbx
movq 0x28(%rsp), %r12
jb 0xf040f
leaq 0x1(%r12), %rax
movq %rax, 0x48(%rsp)
movq 0x10(%rsp), %rdi
callq 0x2964bf
testb %al, %al
je 0xf01fb
callq 0x89da4
movq %rax, 0x10(%rsp)
movsbl 0xf(%rsp), %esi
leaq 0xd0(%rsp), %rdi
movq %rax, %rdx
callq 0x292b2c
movq 0x10(%rsp), %rdi
callq 0x8a045
movq 0x18(%rsp), %r10
subq %r10, %r12
addq $0x2, %r12
pushq $0x2d
popq %rax
movq %rax, 0x10(%rsp)
leaq 0xd0(%rsp), %rax
movb (%rax), %dil
movq %rbp, 0x50(%rsp)
movq %r13, 0x28(%rsp)
movq 0x48(%rsp), %r9
movq %r12, %r8
movsd 0x30(%rsp), %xmm0
movq 0x58(%rsp), %rcx
movq 0x60(%rsp), %rsi
jmp 0xf0238
movq 0x18(%rsp), %r10
addq %r10, %r12
pushq $0x2b
popq %rax
movq %rax, 0x10(%rsp)
movq %r14, 0x50(%rsp)
movq %rbp, %r14
movq %r15, 0x28(%rsp)
movq %r13, %r15
movq %r12, %r9
movsd 0x30(%rsp), %xmm0
movq 0x58(%rsp), %rcx
movq 0x60(%rsp), %rsi
movb 0xf(%rsp), %dil
movq 0x48(%rsp), %r8
incq %rcx
incq %rbx
imulq $0x64, 0xc8(%rsp), %rax
xorl %edx, %edx
movq 0x70(%rsp), %rbp
divq %rbp
movq %rax, 0x30(%rsp)
imulq $0x64, %rsi, %rax
xorl %edx, %edx
divq %rbp
movq %rax, %r11
xorl %eax, %eax
movq %rcx, %rdx
movq 0x68(%rsp), %r12
cmpq %r10, %r12
seta %al
leal (%rax,%rax,4), %ecx
addl $0x44, %ecx
movsbl %dil, %eax
movq %rax, 0x18(%rsp)
subq $0x8, %rsp
leaq 0x234127(%rip), %rsi    # 0x3243b3
movq 0xe8(%rsp), %rdi
movb $0x1, %al
pushq 0x80(%rsp)
movq 0x48(%rsp), %r13
pushq %r13
pushq 0x68(%rsp)
pushq %r15
pushq %rbx
pushq 0x70(%rsp)
pushq 0x58(%rsp)
pushq 0x68(%rsp)
pushq %r14
pushq 0xd0(%rsp)
pushq 0x88(%rsp)
pushq 0x120(%rsp)
pushq %r10
pushq %r11
pushq %r12
pushq %rbp
pushq 0x160(%rsp)
pushq 0xa0(%rsp)
pushq 0xb0(%rsp)
callq 0x8d432
addq $0xa0, %rsp
leaq 0x2336c4(%rip), %rsi    # 0x3239c1
movq %r13, %rdi
movl $0x206, %edx            # imm = 0x206
callq 0x936f9
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x347c45(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1f4ce6(%rip), %rsi    # 0x2e5013
leaq 0x234024(%rip), %rdx    # 0x324358
leaq 0x233ff1(%rip), %rcx    # 0x32432c
leaq 0x23367f(%rip), %r8     # 0x3239c1
movl $0x1aa, %r9d            # imm = 0x1AA
jmp 0xf0376
movq 0x347c17(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1f4cb8(%rip), %rsi    # 0x2e5013
leaq 0x234010(%rip), %rdx    # 0x324372
leaq 0x233fc3(%rip), %rcx    # 0x32432c
leaq 0x233651(%rip), %r8     # 0x3239c1
movl $0x1de, %r9d            # imm = 0x1DE
xorl %eax, %eax
callq 0x17a50
callq 0x17390
movq 0x347bdf(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1f4c80(%rip), %rsi    # 0x2e5013
leaq 0x233f81(%rip), %rdx    # 0x32431b
leaq 0x233f8b(%rip), %rcx    # 0x32432c
leaq 0x233619(%rip), %r8     # 0x3239c1
movl $0x194, %r9d            # imm = 0x194
jmp 0xf0376
movq 0x347bb1(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1f4c52(%rip), %rsi    # 0x2e5013
leaq 0x233f83(%rip), %rdx    # 0x32434b
leaq 0x233f5d(%rip), %rcx    # 0x32432c
leaq 0x2335eb(%rip), %r8     # 0x3239c1
movl $0x196, %r9d            # imm = 0x196
jmp 0xf0376
movq 0x347b83(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1f4c24(%rip), %rsi    # 0x2e5013
leaq 0x233f96(%rip), %rdx    # 0x32438c
leaq 0x233f2f(%rip), %rcx    # 0x32432c
leaq 0x2335bd(%rip), %r8     # 0x3239c1
movl $0x1df, %r9d            # imm = 0x1DF
jmp 0xf0376
movq 0x347b52(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1f4bf3(%rip), %rsi    # 0x2e5013
leaq 0x233f79(%rip), %rdx    # 0x3243a0
leaq 0x233efe(%rip), %rcx    # 0x32432c
leaq 0x23358c(%rip), %r8     # 0x3239c1
movl $0x1e0, %r9d            # imm = 0x1E0
jmp 0xf0376