// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/extended/hpol_processor.c
// Function: gt_hpol_processor_adjust_hlen_of_a_segment
static bool gt_hpol_processor_adjust_hlen_of_a_segment(GtAlignedSegment *as,
    char c, GtUword r_hstart, GtUword coverage,
    GtUword r_hlen, GtUword r_supp, GtUword a_hlen,
    GtUword a_supp, GtUword clenmax, bool allow_partial,
    bool allow_multiple, GtUword s_hmin, GtUword qmax,
    bool output_stats, GtFile *outfp_stats)
{
  GtUword left, right, s_hlen = 0, q_sum = 0, s_free = 0;
  char *s, *q;
  bool edited = false;
  double q_ave = 0.0;
  left = gt_aligned_segment_offset_for_refpos(as, r_hstart);
  right = gt_aligned_segment_offset_for_refpos(as, r_hstart + r_hlen);
  if (left == GT_UNDEF_UWORD || left == 0 ||
      right == GT_UNDEF_UWORD || right == gt_aligned_segment_length(as))
    return edited;
  right--;
  s = gt_aligned_segment_seq(as);
  q = gt_aligned_segment_qual(as);
#ifdef GG_DEBUG
  if (left > 0)
    s_hlen = gt_hpol_processor_determine_hlen_backwards(s, q, left - 1UL,
          c, &q_sum, &s_free);
  if (s_hlen > 0)
    printf("backwards_hlen = "GT_WU"\n", s_hlen);
  s_free = 0;
  q_sum = 0;
#endif
  s_hlen = gt_hpol_processor_determine_hlen_forwards(s, q, left, right, c,
      &q_sum, &s_free);
  if (s_hlen == 0 || s_hlen < s_hmin)
    return edited;
#ifdef GG_DEBUG
  if (s_hlen != r_hlen)
  {
    GtUword i;
    gt_aligned_segment_show(as, NULL);
    printf("   ");
    for (i = 0; i < left; i++)
      printf(" ");
    printf("|");
    for (/**/; i < right - 1UL; i++)
      printf(".");
    printf("|\n");
    printf("[s_hlen="GT_WU", r_hlen="GT_WU"]\n", s_hlen, r_hlen);
    printf("\n");
  }
  else
  {
    printf("s_hlen == r_hlen = "GT_WU"\n\n", s_hlen);
  }
#endif
  /* do the editing if necessary and possible */
  gt_assert(q_sum > GT_HPOL_PROCESSOR_PHREDOFFSET * s_hlen);
  q_ave = (double)(q_sum - GT_HPOL_PROCESSOR_PHREDOFFSET * s_hlen)
    / (double)s_hlen;
  if (s_hlen < r_hlen)
  {
    if (s_free > 0)
    {
      GtUword hlen_diff = r_hlen - s_hlen;
      if (hlen_diff <= clenmax &&
          (q_ave <= (double)qmax) &&
          (s_free >= hlen_diff || allow_partial) &&
          (!gt_aligned_segment_seq_edited(as) || allow_multiple))
      {
        if (output_stats)
        {
          gt_hpol_processor_output_stats(as, r_hstart, coverage, r_hlen, r_supp,
              s_hlen, a_hlen, a_supp, c, q_ave, GT_MIN(s_free, hlen_diff),
              outfp_stats);
        }
        gt_aligned_segment_seq_set_edited(as);
        gt_hpol_processor_enlarge_hpol(s, q, left, right,
            GT_MIN(s_free, hlen_diff), c, (char)(q_sum / s_hlen));
        edited = true;
      }
    }
  }
  else if (s_hlen > r_hlen)
  {
    GtUword hlen_diff = s_hlen - r_hlen;
    if (hlen_diff <= clenmax &&
       (q_ave <= (double)qmax) &&
       (!gt_aligned_segment_seq_edited(as) || allow_multiple))
    {
      if (output_stats)
      {
        gt_hpol_processor_output_stats(as, r_hstart, coverage, r_hlen, r_supp,
            s_hlen, a_hlen, a_supp, c, q_ave, hlen_diff, outfp_stats);
      }
      gt_aligned_segment_seq_set_edited(as);
      gt_hpol_processor_shrink_hpol(s, q, left, right, hlen_diff, c);
      edited = true;
    }
  }
  return edited;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x158, %rsp            # imm = 0x158
movq %rcx, 0xb0(%rsp)
movq %rdx, 0xb8(%rsp)
movl %esi, %eax
movq 0xb0(%rsp), %rsi
movq %rdi, %r11
movq 0xb8(%rsp), %rdi
movb %al, %r10b
movq 0x1b0(%rsp), %rax
movb 0x1a8(%rsp), %al
movq 0x1a0(%rsp), %rcx
movq 0x198(%rsp), %rcx
movb 0x190(%rsp), %cl
movb 0x188(%rsp), %dl
movq 0x180(%rsp), %rbx
movq 0x178(%rsp), %rbx
movq 0x170(%rsp), %rbx
movq %r11, 0x148(%rsp)
movb %r10b, 0x147(%rsp)
movq %rdi, 0x138(%rsp)
movq %rsi, 0x130(%rsp)
movq %r8, 0x128(%rsp)
movq %r9, 0x120(%rsp)
andb $0x1, %dl
movb %dl, 0x11f(%rsp)
andb $0x1, %cl
movb %cl, 0x11e(%rsp)
andb $0x1, %al
movb %al, 0x11d(%rsp)
movq $0x0, 0x100(%rsp)
movq $0x0, 0xf8(%rsp)
movq $0x0, 0xf0(%rsp)
movb $0x0, 0xdf(%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, 0xd0(%rsp)
movq 0x148(%rsp), %rdi
movq 0x138(%rsp), %rsi
callq 0x488450
movq %rax, 0x110(%rsp)
movq 0x148(%rsp), %rdi
movq 0x138(%rsp), %rsi
addq 0x128(%rsp), %rsi
callq 0x488450
movq %rax, 0x108(%rsp)
cmpq $-0x1, 0x110(%rsp)
je 0x19059c
cmpq $0x0, 0x110(%rsp)
je 0x19059c
cmpq $-0x1, 0x108(%rsp)
je 0x19059c
movq 0x108(%rsp), %rax
movq %rax, 0xa8(%rsp)
movq 0x148(%rsp), %rdi
callq 0x488300
movq %rax, %rcx
movq 0xa8(%rsp), %rax
cmpq %rcx, %rax
jne 0x1905b1
movb 0xdf(%rsp), %al
andb $0x1, %al
movb %al, 0x157(%rsp)
jmp 0x190b8a
movq 0x108(%rsp), %rax
addq $-0x1, %rax
movq %rax, 0x108(%rsp)
movq 0x148(%rsp), %rdi
callq 0x488210
movq %rax, 0xe8(%rsp)
movq 0x148(%rsp), %rdi
callq 0x488260
movq %rax, 0xe0(%rsp)
movq 0xe8(%rsp), %rdi
movq 0xe0(%rsp), %rsi
movq 0x110(%rsp), %rdx
movq 0x108(%rsp), %rcx
leaq 0xf8(%rsp), %r9
leaq 0xf0(%rsp), %rax
movsbl 0x147(%rsp), %r8d
movq %rax, (%rsp)
callq 0x190340
movq %rax, 0x100(%rsp)
cmpq $0x0, 0x100(%rsp)
je 0x190656
movq 0x100(%rsp), %rax
cmpq 0x198(%rsp), %rax
jae 0x19066b
movb 0xdf(%rsp), %al
andb $0x1, %al
movb %al, 0x157(%rsp)
jmp 0x190b8a
jmp 0x19066d
movq 0xf8(%rsp), %rax
imulq $0x21, 0x100(%rsp), %rcx
cmpq %rcx, %rax
ja 0x1906bb
movq 0x4ab916(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x38597f(%rip), %rsi    # 0x516013
leaq 0x3c5f65(%rip), %rdx    # 0x556600
leaq 0x3c5f8d(%rip), %rcx    # 0x55662f
leaq 0x3c5657(%rip), %r8     # 0x555d00
movl $0x29d, %r9d            # imm = 0x29D
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x1906bd
movq 0xf8(%rsp), %rcx
movq 0x100(%rsp), %rax
movq %rax, %rsi
shlq $0x5, %rsi
movq %rax, %rdx
addq %rsi, %rdx
subq %rdx, %rcx
movq %rcx, %xmm0
movaps 0x388247(%rip), %xmm3   # 0x518930
punpckldq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
movapd 0x38824b(%rip), %xmm2   # 0x518940
subpd %xmm2, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movq %rax, %xmm1
punpckldq %xmm3, %xmm1    # xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1]
subpd %xmm2, %xmm1
movaps %xmm1, %xmm2
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0xd0(%rsp)
movq 0x100(%rsp), %rax
cmpq 0x128(%rsp), %rax
jae 0x1909f8
cmpq $0x0, 0xf0(%rsp)
jbe 0x1909f3
movq 0x128(%rsp), %rax
subq 0x100(%rsp), %rax
movq %rax, 0xc8(%rsp)
movq 0xc8(%rsp), %rax
cmpq 0x180(%rsp), %rax
ja 0x1909f1
movsd 0xd0(%rsp), %xmm1
movaps 0x3881a4(%rip), %xmm2   # 0x518930
movq 0x1a0(%rsp), %xmm0
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
movapd 0x38819f(%rip), %xmm2   # 0x518940
subpd %xmm2, %xmm0
movaps %xmm0, %xmm2
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm2, %xmm0
ucomisd %xmm1, %xmm0
jb 0x1909f1
movq 0xf0(%rsp), %rax
cmpq 0xc8(%rsp), %rax
jae 0x1907da
testb $0x1, 0x11f(%rsp)
je 0x1909f1
movq 0x148(%rsp), %rdi
callq 0x488c70
testb $0x1, %al
jne 0x1907ed
jmp 0x1907fb
testb $0x1, 0x11e(%rsp)
je 0x1909f1
testb $0x1, 0x11d(%rsp)
je 0x190938
movq 0x148(%rsp), %rax
movq %rax, 0x58(%rsp)
movq 0x138(%rsp), %rax
movq %rax, 0x60(%rsp)
movq 0x130(%rsp), %rax
movq %rax, 0x68(%rsp)
movq 0x128(%rsp), %rax
movq %rax, 0x70(%rsp)
movq 0x120(%rsp), %rax
movq %rax, 0x78(%rsp)
movq 0x100(%rsp), %rax
movq %rax, 0x80(%rsp)
movq 0x170(%rsp), %rax
movq %rax, 0x88(%rsp)
movq 0x178(%rsp), %rax
movq %rax, 0x90(%rsp)
movb 0x147(%rsp), %al
movb %al, 0x9f(%rsp)
movsd 0xd0(%rsp), %xmm0
movsd %xmm0, 0xa0(%rsp)
movq 0xf0(%rsp), %rax
cmpq 0xc8(%rsp), %rax
jae 0x1908bb
movq 0xf0(%rsp), %rax
movq %rax, 0x50(%rsp)
jmp 0x1908c8
movq 0xc8(%rsp), %rax
movq %rax, 0x50(%rsp)
movsd 0xa0(%rsp), %xmm0
movb 0x9f(%rsp), %r11b
movq 0x90(%rsp), %rbx
movq 0x88(%rsp), %r14
movq 0x80(%rsp), %r9
movq 0x78(%rsp), %r8
movq 0x70(%rsp), %rcx
movq 0x68(%rsp), %rdx
movq 0x60(%rsp), %rsi
movq 0x58(%rsp), %rdi
movq 0x50(%rsp), %r10
movq 0x1b0(%rsp), %rax
movq %r14, (%rsp)
movq %rbx, 0x8(%rsp)
movsbl %r11b, %r11d
movl %r11d, 0x10(%rsp)
movq %r10, 0x18(%rsp)
movq %rax, 0x20(%rsp)
callq 0x190ba0
movq 0x148(%rsp), %rdi
callq 0x488c20
movq 0xe8(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0xe0(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0x110(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x108(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0xf0(%rsp), %rax
cmpq 0xc8(%rsp), %rax
jae 0x19099a
movq 0xf0(%rsp), %rax
movq %rax, 0x28(%rsp)
jmp 0x1909a7
movq 0xc8(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x48(%rsp), %rcx
movq 0x38(%rsp), %rsi
movq 0x30(%rsp), %rdi
movq 0x28(%rsp), %r8
movb 0x147(%rsp), %r9b
movq 0xf8(%rsp), %rax
xorl %edx, %edx
divq 0x100(%rsp)
movq 0x40(%rsp), %rdx
movsbl %r9b, %r9d
movsbl %al, %eax
movl %eax, (%rsp)
callq 0x191640
movb $0x1, 0xdf(%rsp)
jmp 0x1909f3
jmp 0x190b7a
movq 0x100(%rsp), %rax
cmpq 0x128(%rsp), %rax
jbe 0x190b78
movq 0x100(%rsp), %rax
subq 0x128(%rsp), %rax
movq %rax, 0xc0(%rsp)
movq 0xc0(%rsp), %rax
cmpq 0x180(%rsp), %rax
ja 0x190b76
movsd 0xd0(%rsp), %xmm1
movaps 0x387ee4(%rip), %xmm2   # 0x518930
movq 0x1a0(%rsp), %xmm0
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
movapd 0x387edf(%rip), %xmm2   # 0x518940
subpd %xmm2, %xmm0
movaps %xmm0, %xmm2
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm2, %xmm0
ucomisd %xmm1, %xmm0
jb 0x190b76
movq 0x148(%rsp), %rdi
callq 0x488c70
testb $0x1, %al
jne 0x190a8d
jmp 0x190a9b
testb $0x1, 0x11e(%rsp)
je 0x190b76
testb $0x1, 0x11d(%rsp)
je 0x190b2b
movq 0x148(%rsp), %rdi
movq 0x138(%rsp), %rsi
movq 0x130(%rsp), %rdx
movq 0x128(%rsp), %rcx
movq 0x120(%rsp), %r8
movq 0x100(%rsp), %r9
movq 0x170(%rsp), %r14
movq 0x178(%rsp), %rbx
movb 0x147(%rsp), %r11b
movsd 0xd0(%rsp), %xmm0
movq 0xc0(%rsp), %r10
movq 0x1b0(%rsp), %rax
movq %r14, (%rsp)
movq %rbx, 0x8(%rsp)
movsbl %r11b, %r11d
movl %r11d, 0x10(%rsp)
movq %r10, 0x18(%rsp)
movq %rax, 0x20(%rsp)
callq 0x190ba0
movq 0x148(%rsp), %rdi
callq 0x488c20
movq 0xe8(%rsp), %rdi
movq 0xe0(%rsp), %rsi
movq 0x110(%rsp), %rdx
movq 0x108(%rsp), %rcx
movq 0xc0(%rsp), %r8
movsbl 0x147(%rsp), %r9d
callq 0x1916b0
movb $0x1, 0xdf(%rsp)
jmp 0x190b78
jmp 0x190b7a
movb 0xdf(%rsp), %al
andb $0x1, %al
movb %al, 0x157(%rsp)
movb 0x157(%rsp), %al
andb $0x1, %al
addq $0x158, %rsp            # imm = 0x158
popq %rbx
popq %r14
retq
nop