// File: /workspace/github_c_makefile_star2_O3/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, 0x10(%rsp)
movq %rdi, 0x8(%rsp)
testq %r8, %r8
je 0x1fcf1b
movq %r8, %rbx
movq %rdx, %r12
movl %esi, %ebp
movq $0x0, 0x18(%r8)
movq (%r8), %r8
movq 0x8(%rbx), %r9
movq %r9, %r13
subq %r8, %r13
jbe 0x1fcdbf
addq 0x18(%rbx), %r13
movq 0x10(%rbx), %r15
movq %r13, %r14
subq %r15, %r14
ja 0x1fce56
movq 0x8(%rsp), %rdi
movl %ebp, %esi
movq %rbx, %rdx
movq 0x10(%rsp), %rcx
callq 0x1fcf25
xorl %r9d, %r9d
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movl $0x0, %r8d
cmpq %r15, %r13
jne 0x1fcd76
jmp 0x1fcefd
testq %r12, %r12
je 0x1fce2d
movq %r12, %rdi
leaq 0x18(%rsp), %rsi
callq 0xeae9a
testb %al, %al
je 0x1fce2d
movq 0x18(%rsp), %r8
movq 0x20(%rsp), %r9
movq %r9, %r14
subq %r8, %r14
je 0x1fcf16
addq 0x18(%rbx), %r14
movq 0x10(%rbx), %r15
movq %r14, %r13
subq %r15, %r13
ja 0x1fce80
movq 0x8(%rsp), %rdi
movl %ebp, %esi
movq %rbx, %rdx
movq 0x10(%rsp), %rcx
callq 0x1fcf25
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
cmpq %r15, %r14
je 0x1fcefa
xorl %r9d, %r9d
xorl %r8d, %r8d
jmp 0x1fcd76
movq 0x18(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
jae 0x1fcefa
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rdx
callq 0x1fca21
incq 0x18(%rbx)
movb $0x1, %r9b
jmp 0x1fcefd
movl %ebp, %eax
andl $-0x3, %eax
cmpl $0x1, %eax
jne 0x1fceab
addq %r14, %r8
movq 0x8(%rsp), %rdi
movl %ebp, %esi
movq %rbx, %rdx
movq 0x10(%rsp), %rcx
callq 0x1fcf25
addq (%rbx), %r14
movq %r14, 0x8(%rbx)
jmp 0x1fcefa
movl %ebp, %eax
andl $-0x3, %eax
cmpl $0x1, %eax
jne 0x1fcece
addq %r13, %r8
movq 0x8(%rsp), %rdi
movl %ebp, %esi
movq %rbx, %rdx
movq 0x10(%rsp), %rcx
callq 0x1fcf25
movq 0x18(%rsp), %rax
addq %rax, %r13
jmp 0x1fcef3
subq %r14, %r9
movq 0x8(%rsp), %rdi
movl %ebp, %esi
movq %rbx, %rdx
movq 0x10(%rsp), %rcx
callq 0x1fcf25
movq 0x8(%rbx), %rax
subq %r14, %rax
movq %rax, (%rbx)
jmp 0x1fcefa
subq %r13, %r9
movq 0x8(%rsp), %rdi
movl %ebp, %esi
movq %rbx, %rdx
movq 0x10(%rsp), %rcx
callq 0x1fcf25
movq 0x20(%rsp), %rcx
movq %rcx, %rax
subq %r13, %rax
movq %rcx, %r13
movq %rax, (%rbx)
movq %r13, 0x8(%rbx)
xorl %r9d, %r9d
cmpq $0x0, 0x18(%rbx)
je 0x1fcf20
movl %r9d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x7e446
callq 0x7e4b8
callq 0x7e47f