// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/match/sfx-suffixgetset.c
// Function: gt_SSSPbuf_fillspecialnextpage
bool gt_SSSPbuf_fillspecialnextpage(GtSuffixsortspace *sssp,
                                    GtReadmode readmode,
                                    GtSpecialrangeiterator *sri,
                                    GtUword totallength,
                                    GtSSSPbuf *sssp_buf)
{
  bool exhausted = false;

  gt_assert(sssp_buf != NULL);
  sssp_buf->nextfree = 0;
  while (true)
  {
    if (sssp_buf->overhang.start < sssp_buf->overhang.end)
    {
      GtUword width = sssp_buf->overhang.end - sssp_buf->overhang.start;
      if (sssp_buf->nextfree + width > sssp_buf->size)
      {
        /* does not fit into the buffer, so only output a part */
        GtUword rest = sssp_buf->nextfree + width - sssp_buf->size;
        gt_assert(rest > 0);
        if (GT_ISDIRREVERSE(readmode))
        {
          gt_SSSPbuf_insertfullspecialrange(sssp,readmode,sssp_buf,totallength,
                                            sssp_buf->overhang.start + rest,
                                            sssp_buf->overhang.end);
          sssp_buf->overhang.end = sssp_buf->overhang.start + rest;
        } else
        {
          gt_SSSPbuf_insertfullspecialrange(sssp,readmode,sssp_buf,totallength,
                                            sssp_buf->overhang.start,
                                            sssp_buf->overhang.end - rest);
          sssp_buf->overhang.start = sssp_buf->overhang.end - rest;
        }
        break;
      }
      if (sssp_buf->nextfree + width == sssp_buf->size)
      { /* overhang fits into the buffer and buffer is full */
        gt_SSSPbuf_insertfullspecialrange(sssp,readmode,sssp_buf,totallength,
                                          sssp_buf->overhang.start,
                                          sssp_buf->overhang.end);
        sssp_buf->overhang.start = sssp_buf->overhang.end = 0;
        break;
      }
      /* overhang fits into the buffer and buffer is not full */
      gt_SSSPbuf_insertfullspecialrange(sssp,readmode,sssp_buf,totallength,
                                        sssp_buf->overhang.start,
                                        sssp_buf->overhang.end);
      sssp_buf->overhang.start = sssp_buf->overhang.end = 0;
    } else
    {
      GtRange range;

      if (sri != NULL && gt_specialrangeiterator_next(sri,&range))
      {
        GtUword width = range.end - range.start;
        gt_assert(width > 0);
        if (sssp_buf->nextfree + width > sssp_buf->size)
        { /* does not fit into the buffer, so only output a part */
          GtUword rest = sssp_buf->nextfree + width - sssp_buf->size;
          if (GT_ISDIRREVERSE(readmode))
          {
            gt_SSSPbuf_insertfullspecialrange(sssp,readmode,sssp_buf,
                                              totallength,
                                              range.start + rest,
                                              range.end);
            sssp_buf->overhang.start = range.start;
            sssp_buf->overhang.end = range.start + rest;
          } else
          {
            gt_SSSPbuf_insertfullspecialrange(sssp,readmode,sssp_buf,
                                              totallength,
                                              range.start,
                                              range.end - rest);
            sssp_buf->overhang.start = range.end - rest;
            sssp_buf->overhang.end = range.end;
          }
          break;
        }
        if (sssp_buf->nextfree + width == sssp_buf->size)
        { /* overhang fits into the buffer and buffer is full */
          gt_SSSPbuf_insertfullspecialrange(sssp,readmode,sssp_buf,totallength,
                                            range.start,range.end);
          sssp_buf->overhang.start = sssp_buf->overhang.end = 0;
          break;
        }
        /* overhang fits into the buffer and buffer is not full */
        gt_SSSPbuf_insertfullspecialrange(sssp,readmode,sssp_buf,totallength,
                                          range.start,range.end);
        sssp_buf->overhang.start = sssp_buf->overhang.end = 0;
      } else
      {
        if (sssp_buf->nextfree < sssp_buf->size)
        {
          /* add last suffix for start position totallength */
          gt_suffixsortspace_setdirect(sssp,sssp_buf->nextfree,totallength);
          sssp_buf->nextfree++;
          exhausted = true;
        }
        break;
      }
    }
  }
  gt_assert(sssp_buf->nextfree > 0);
  return exhausted;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, (%rsp)
movq %rdx, 0x20(%rsp)
testq %r8, %r8
je 0x2065f9
movq %r8, %rbx
movl %esi, %r15d
movq %rdi, %r12
movq $0x0, 0x18(%r8)
movl %esi, %eax
andl $-0x3, %eax
movl %eax, 0x8(%rsp)
movl $0x0, 0xc(%rsp)
movq (%rbx), %r8
movq 0x8(%rbx), %r9
movq %r9, %rbp
subq %r8, %rbp
jbe 0x2064c4
addq 0x18(%rbx), %rbp
movq 0x10(%rbx), %r14
movq %rbp, %r13
subq %r14, %r13
ja 0x206599
movq %r12, %rdi
movl %r15d, %esi
movq %rbx, %rdx
movq (%rsp), %rcx
callq 0x206608
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
cmpq %r14, %rbp
jne 0x20647f
jmp 0x2065dd
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x206525
leaq 0x10(%rsp), %rsi
callq 0xef451
testb %al, %al
je 0x206525
movq 0x10(%rsp), %r8
movq 0x18(%rsp), %r9
movq %r9, %rbp
subq %r8, %rbp
je 0x206603
addq 0x18(%rbx), %rbp
subq 0x10(%rbx), %rbp
jbe 0x206547
cmpl $0x1, 0x8(%rsp)
jne 0x206565
addq %rbp, %r8
movq %r12, %rdi
movl %r15d, %esi
movq %rbx, %rdx
movq (%rsp), %rcx
callq 0x206608
movq 0x10(%rsp), %rax
movq %rax, (%rbx)
addq %rbp, %rax
jmp 0x206588
movq 0x18(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
jae 0x20658c
movq %r12, %rdi
movq (%rsp), %rdx
callq 0x20611f
incq 0x18(%rbx)
movb $0x1, %al
movl %eax, 0xc(%rsp)
jmp 0x20658c
setne %bpl
movq %r12, %rdi
movl %r15d, %esi
movq %rbx, %rdx
movq (%rsp), %rcx
callq 0x206608
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
jmp 0x20658e
subq %rbp, %r9
movq %r12, %rdi
movl %r15d, %esi
movq %rbx, %rdx
movq (%rsp), %rcx
callq 0x206608
movq 0x18(%rsp), %rax
movq %rax, %rcx
subq %rbp, %rcx
movq %rcx, (%rbx)
movq %rax, 0x8(%rbx)
xorl %ebp, %ebp
testb %bpl, %bpl
jne 0x20647f
jmp 0x2065dd
cmpl $0x1, 0x8(%rsp)
jne 0x2065be
addq %r13, %r8
movq %r12, %rdi
movl %r15d, %esi
movq %rbx, %rdx
movq (%rsp), %rcx
callq 0x206608
addq (%rbx), %r13
movq %r13, 0x8(%rbx)
jmp 0x2065dd
subq %r13, %r9
movq %r12, %rdi
movl %r15d, %esi
movq %rbx, %rdx
movq (%rsp), %rcx
callq 0x206608
movq 0x8(%rbx), %rax
subq %r13, %rax
movq %rax, (%rbx)
cmpq $0x0, 0x18(%rbx)
je 0x2065fe
movl 0xc(%rsp), %eax
andb $0x1, %al
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x802c2
callq 0x80289
callq 0x80250