// File: /workspace/github_c_makefile_star2_O2/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 0x1b0278
movq %r8, %rbx
movq %rdx, %r12
movl %esi, %ebp
andq $0x0, 0x18(%r8)
movq (%r8), %r8
movq 0x8(%rbx), %r9
movq %r9, %r13
subq %r8, %r13
jbe 0x1b00e9
addq 0x18(%rbx), %r13
movq 0x10(%rbx), %r15
movq %r13, %r14
subq %r15, %r14
ja 0x1b0180
movq 0x8(%rsp), %rdi
movl %ebp, %esi
movq %rbx, %rdx
movq 0x10(%rsp), %rcx
callq 0x1b02d4
xorl %r9d, %r9d
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movl $0x0, %r8d
cmpq %r15, %r13
jne 0x1b00a0
jmp 0x1b0227
testq %r12, %r12
je 0x1b0157
movq %r12, %rdi
leaq 0x18(%rsp), %rsi
callq 0x7428b
testb %al, %al
je 0x1b0157
movq 0x18(%rsp), %r8
movq 0x20(%rsp), %r9
movq %r9, %r14
subq %r8, %r14
je 0x1b0240
addq 0x18(%rbx), %r14
movq 0x10(%rbx), %r15
movq %r14, %r13
subq %r15, %r13
ja 0x1b01aa
movq 0x8(%rsp), %rdi
movl %ebp, %esi
movq %rbx, %rdx
movq 0x10(%rsp), %rcx
callq 0x1b02d4
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
cmpq %r15, %r14
je 0x1b0224
xorl %r9d, %r9d
xorl %r8d, %r8d
jmp 0x1b00a0
movq 0x18(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
jae 0x1b0224
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rdx
callq 0x1afa63
incq 0x18(%rbx)
movb $0x1, %r9b
jmp 0x1b0227
movl %ebp, %eax
andl $-0x3, %eax
cmpl $0x1, %eax
jne 0x1b01d5
addq %r14, %r8
movq 0x8(%rsp), %rdi
movl %ebp, %esi
movq %rbx, %rdx
movq 0x10(%rsp), %rcx
callq 0x1b02d4
addq (%rbx), %r14
movq %r14, 0x8(%rbx)
jmp 0x1b0224
movl %ebp, %eax
andl $-0x3, %eax
cmpl $0x1, %eax
jne 0x1b01f8
addq %r13, %r8
movq 0x8(%rsp), %rdi
movl %ebp, %esi
movq %rbx, %rdx
movq 0x10(%rsp), %rcx
callq 0x1b02d4
movq 0x18(%rsp), %rax
addq %rax, %r13
jmp 0x1b021d
subq %r14, %r9
movq 0x8(%rsp), %rdi
movl %ebp, %esi
movq %rbx, %rdx
movq 0x10(%rsp), %rcx
callq 0x1b02d4
movq 0x8(%rbx), %rax
subq %r14, %rax
movq %rax, (%rbx)
jmp 0x1b0224
subq %r13, %r9
movq 0x8(%rsp), %rdi
movl %ebp, %esi
movq %rbx, %rdx
movq 0x10(%rsp), %rcx
callq 0x1b02d4
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 0x1b02a6
movl %r9d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x287d21(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x134dc2(%rip), %rsi    # 0x2e5013
leaq 0x1d33c2(%rip), %rdx    # 0x38361a
leaq 0x1ab6bc(%rip), %rcx    # 0x35b91b
leaq 0x1ab152(%rip), %r8     # 0x35b3b8
movl $0x281, %r9d            # imm = 0x281
xorl %eax, %eax
callq 0x17a50
callq 0x17390
movq 0x287ce9(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x134d8a(%rip), %rsi    # 0x2e5013
leaq 0x1ab668(%rip), %rdx    # 0x35b8f8
leaq 0x1ab684(%rip), %rcx    # 0x35b91b
leaq 0x1ab11a(%rip), %r8     # 0x35b3b8
movl $0x252, %r9d            # imm = 0x252
jmp 0x1b026c
movq 0x287cbb(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x134d5c(%rip), %rsi    # 0x2e5013
leaq 0x1ab67c(%rip), %rdx    # 0x35b93a
leaq 0x1ab656(%rip), %rcx    # 0x35b91b
leaq 0x1ab0ec(%rip), %r8     # 0x35b3b8
movl $0x2b0, %r9d            # imm = 0x2B0
jmp 0x1b026c