// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/match/sfx-partssuf.c
// Function: gt_suftabparts_fit_memlimit
int gt_suftabparts_fit_memlimit(size_t estimatedspace,
                                GtUword maximumspace,
                                const GtBcktab *bcktab,
                                const GtFirstcodestab *fct,
                                const GtSfxmappedrangelist *sfxmrlist,
                                GtUword totallength,
                                unsigned int bitsforseqnumrelpos,
                                GtUword specialcharacters,
                                GtUword numofsuffixestosort,
                                bool suftabuint,
                                GtError *err)
{
  unsigned int parts;

  gt_error_check(err);
  for (parts = 1U; parts <= 500U; parts++)
  {
    uint64_t suftabsize;
    GtUword numofentries;
    GtSuftabparts *suftabparts = gt_suftabparts_new(parts,
                                                    bcktab,
                                                    (GtCodetype) 1,
                                                    (GtCodetype) 0,
                                                    fct,
                                                    sfxmrlist,
                                                    numofsuffixestosort,
                                                    specialcharacters + 1,
                                                    NULL);
    gt_assert(suftabparts != NULL);
    numofentries = gt_suftabparts_largest_width(suftabparts);
    if (bcktab != NULL)
    {
      gt_assert(fct == NULL);
      suftabsize = gt_suffixsortspace_requiredspace(numofentries,
                                                    totallength,
                                                    suftabuint);
    } else
    {
      gt_assert(fct != NULL);
      suftabsize = (uint64_t) gt_spmsuftab_requiredspace(numofentries,
                                                         totallength,
                                                         bitsforseqnumrelpos);
    }
    if (parts == 1U)
    {
      if (suftabsize + (uint64_t) estimatedspace <= (uint64_t) maximumspace)
      {
        gt_suftabparts_delete(suftabparts);
        return (int) parts;
      }
    } else
    {
      GtUword largest
        = gt_suftabparts_largestsizemappedpartwise(suftabparts);
      GtUword size_mapped = gt_Sfxmappedrangelist_size_entire(sfxmrlist);

      if (suftabsize
          + (uint64_t) largest
          + (uint64_t) estimatedspace
          - (uint64_t) size_mapped <= (uint64_t) maximumspace)
      {
        gt_log_log("return parts = %u as suftabsize=%.2f +"
                   "largest=%.2f + estimated=%.2f - size_mapped=%2.f <= %.2f",
                    parts,
                    GT_MEGABYTES(suftabsize),
                    GT_MEGABYTES(largest),
                    GT_MEGABYTES(estimatedspace),
                    GT_MEGABYTES(size_mapped),
                    GT_MEGABYTES(maximumspace));
        gt_suftabparts_delete(suftabparts);
        return (int) parts;
      }
    }
    gt_suftabparts_delete(suftabparts);
  }
  gt_error_set(err,"cannot compute enhanced suffix array in at most "
               GT_WU" bytes", maximumspace);
  return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r9, 0x20(%rsp)
movq %r8, 0x28(%rsp)
movq %rcx, %r14
movq %rdx, %r12
movq %rsi, 0x8(%rsp)
movq %rdi, 0x10(%rsp)
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x1eff61
callq 0xfcc32
testb %al, %al
jne 0x1f01bf
movq 0x78(%rsp), %rax
incq %rax
movq %rax, 0x30(%rsp)
movl $0x1, %ebx
movzbl 0x88(%rsp), %eax
movl %eax, 0x1c(%rsp)
subq $0x8, %rsp
movl $0x1, %edx
movl %ebx, %edi
movq %r12, %rsi
xorl %ecx, %ecx
movq %r14, %r8
movq 0x30(%rsp), %r9
pushq $0x0
pushq 0x40(%rsp)
pushq 0x98(%rsp)
callq 0x1ef8a9
addq $0x20, %rsp
testq %rax, %rax
je 0x1f01b0
movq %rax, %r15
movq 0x28(%rax), %rdi
testq %r12, %r12
je 0x1effdb
testq %r14, %r14
jne 0x1f01b5
movq 0x20(%rsp), %rsi
movl 0x1c(%rsp), %edx
callq 0x1fc564
jmp 0x1efff2
testq %r14, %r14
je 0x1f01ba
movq 0x20(%rsp), %rsi
movl 0x70(%rsp), %edx
callq 0x1febb2
movq %rax, %r13
cmpl $0x1, %ebx
jne 0x1f000b
addq 0x10(%rsp), %r13
cmpq 0x8(%rsp), %r13
ja 0x1f0032
jmp 0x1f008c
movq 0x20(%r15), %rbp
movq 0x28(%rsp), %rdi
callq 0x1ef570
movq 0x10(%rsp), %rcx
addq %r13, %rcx
addq %rbp, %rcx
subq %rax, %rcx
cmpq 0x8(%rsp), %rcx
jbe 0x1f00bd
movq (%r15), %rdi
leaq 0x1c87d4(%rip), %r13    # 0x3b8810
movq %r13, %rsi
movl $0x17b, %edx            # imm = 0x17B
callq 0x1045eb
movq %r15, %rdi
movq %r13, %rsi
movl $0x17c, %edx            # imm = 0x17C
callq 0x1045eb
incl %ebx
cmpl $0x1f5, %ebx            # imm = 0x1F5
jne 0x1eff7f
leaq 0x1c8bb9(%rip), %rsi    # 0x3b8c27
movq 0x90(%rsp), %rdi
movq 0x8(%rsp), %rdx
xorl %eax, %eax
callq 0xfcb67
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x1f019f
movq (%r15), %rdi
leaq 0x1c877a(%rip), %rbx    # 0x3b8810
movq %rbx, %rsi
movl $0x17b, %edx            # imm = 0x17B
callq 0x1045eb
movq %r15, %rdi
movq %rbx, %rsi
movl $0x17c, %edx            # imm = 0x17C
callq 0x1045eb
movl $0x1, %ebx
jmp 0x1f019f
movq %r13, %xmm1
movq 0x157816(%rip), %xmm4   # 0x3478e0
punpckldq %xmm4, %xmm1    # xmm1 = xmm1[0],xmm4[0],xmm1[1],xmm4[1]
movapd 0x15781a(%rip), %xmm5   # 0x3478f0
subpd %xmm5, %xmm1
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
movsd 0x157812(%rip), %xmm6   # 0x347900
mulsd %xmm6, %xmm0
movq %rbp, %xmm2
punpckldq %xmm4, %xmm2    # xmm2 = xmm2[0],xmm4[0],xmm2[1],xmm4[1]
subpd %xmm5, %xmm2
movapd %xmm2, %xmm1
unpckhpd %xmm2, %xmm1            # xmm1 = xmm1[1],xmm2[1]
addsd %xmm2, %xmm1
mulsd %xmm6, %xmm1
movq 0x10(%rsp), %xmm3
punpckldq %xmm4, %xmm3    # xmm3 = xmm3[0],xmm4[0],xmm3[1],xmm4[1]
subpd %xmm5, %xmm3
movapd %xmm3, %xmm2
unpckhpd %xmm3, %xmm2            # xmm2 = xmm2[1],xmm3[1]
addsd %xmm3, %xmm2
mulsd %xmm6, %xmm2
movq %rax, %xmm7
punpckldq %xmm4, %xmm7    # xmm7 = xmm7[0],xmm4[0],xmm7[1],xmm4[1]
subpd %xmm5, %xmm7
movapd %xmm7, %xmm3
unpckhpd %xmm7, %xmm3            # xmm3 = xmm3[1],xmm7[1]
addsd %xmm7, %xmm3
mulsd %xmm6, %xmm3
movq 0x8(%rsp), %xmm7
punpckldq %xmm4, %xmm7    # xmm7 = xmm7[0],xmm4[0],xmm7[1],xmm4[1]
subpd %xmm5, %xmm7
movapd %xmm7, %xmm4
unpckhpd %xmm7, %xmm4            # xmm4 = xmm4[1],xmm7[1]
addsd %xmm7, %xmm4
mulsd %xmm6, %xmm4
leaq 0x1c8a59(%rip), %rdi    # 0x3b8bc8
movl %ebx, %esi
movb $0x5, %al
callq 0x103d72
movq (%r15), %rdi
leaq 0x1c868e(%rip), %r14    # 0x3b8810
movq %r14, %rsi
movl $0x17b, %edx            # imm = 0x17B
callq 0x1045eb
movq %r15, %rdi
movq %r14, %rsi
movl $0x17c, %edx            # imm = 0x17C
callq 0x1045eb
movl %ebx, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x79efc
callq 0x79e8a
callq 0x79ec3
callq 0x79e51