// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x88, %rsp
movq 0xb0(%rsp), %rax
movb 0xa8(%rsp), %al
movq 0xa0(%rsp), %r10
movq 0x98(%rsp), %r10
movl 0x90(%rsp), %r10d
movq %rdi, 0x78(%rsp)
movq %rsi, 0x70(%rsp)
movq %rdx, 0x68(%rsp)
movq %rcx, 0x60(%rsp)
movq %r8, 0x58(%rsp)
movq %r9, 0x50(%rsp)
andb $0x1, %al
movb %al, 0x4f(%rsp)
cmpq $0x0, 0xb0(%rsp)
je 0x2ce528
movq 0xb0(%rsp), %rdi
callq 0xd8a60
testb $0x1, %al
jne 0x2ce4f0
jmp 0x2ce528
movq 0x36daa9(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x247b12(%rip), %rsi    # 0x516013
leaq 0x247cb7(%rip), %rdx    # 0x5161bf
leaq 0x2bd60f(%rip), %rcx    # 0x58bb1e
leaq 0x2bd284(%rip), %r8     # 0x58b79a
movl $0x1cf, %r9d            # imm = 0x1CF
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x2ce52a
movl $0x1, 0x48(%rsp)
cmpl $0x1f4, 0x48(%rsp)      # imm = 0x1F4
ja 0x2ce80e
movl 0x48(%rsp), %edi
movq 0x68(%rsp), %rsi
movq 0x60(%rsp), %r8
movq 0x58(%rsp), %r9
movq 0xa0(%rsp), %r10
movq 0x98(%rsp), %rax
addq $0x1, %rax
movl $0x1, %edx
xorl %ecx, %ecx
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
movq $0x0, 0x10(%rsp)
callq 0x2cd4b0
movq %rax, 0x30(%rsp)
cmpq $0x0, 0x30(%rsp)
jne 0x2ce5ca
movq 0x36da07(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x247a70(%rip), %rsi    # 0x516013
leaq 0x2bf0bb(%rip), %rdx    # 0x58d665
leaq 0x2bd56d(%rip), %rcx    # 0x58bb1e
leaq 0x2bd1e2(%rip), %r8     # 0x58b79a
movl $0x1dd, %r9d            # imm = 0x1DD
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x2ce5cc
movq 0x30(%rsp), %rdi
callq 0x2ce390
movq %rax, 0x38(%rsp)
cmpq $0x0, 0x68(%rsp)
je 0x2ce646
jmp 0x2ce5e5
cmpq $0x0, 0x60(%rsp)
je 0x2ce625
movq 0x36d9ac(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x247a15(%rip), %rsi    # 0x516013
leaq 0x2bd535(%rip), %rdx    # 0x58bb3a
leaq 0x2bd512(%rip), %rcx    # 0x58bb1e
leaq 0x2bd187(%rip), %r8     # 0x58b79a
movl $0x1e1, %r9d            # imm = 0x1E1
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x2ce627
movq 0x38(%rsp), %rdi
movq 0x50(%rsp), %rsi
movb 0x4f(%rsp), %al
andb $0x1, %al
movzbl %al, %edx
callq 0x2e93c0
movq %rax, 0x40(%rsp)
jmp 0x2ce6a5
jmp 0x2ce648
cmpq $0x0, 0x60(%rsp)
jne 0x2ce688
movq 0x36d949(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x2479b2(%rip), %rsi    # 0x516013
leaq 0x2bd4de(%rip), %rdx    # 0x58bb46
leaq 0x2bd4af(%rip), %rcx    # 0x58bb1e
leaq 0x2bd124(%rip), %r8     # 0x58b79a
movl $0x1e7, %r9d            # imm = 0x1E7
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x2ce68a
movq 0x38(%rsp), %rdi
movq 0x50(%rsp), %rsi
movl 0x90(%rsp), %edx
callq 0x2eece0
movq %rax, 0x40(%rsp)
cmpl $0x1, 0x48(%rsp)
jne 0x2ce6dc
movq 0x40(%rsp), %rax
addq 0x78(%rsp), %rax
cmpq 0x70(%rsp), %rax
ja 0x2ce6d7
movq 0x30(%rsp), %rdi
callq 0x2ce1c0
movl 0x48(%rsp), %eax
movl %eax, 0x84(%rsp)
jmp 0x2ce834
jmp 0x2ce7f4
movq 0x30(%rsp), %rdi
callq 0x2ce3e0
movq %rax, 0x28(%rsp)
movq 0x58(%rsp), %rdi
callq 0x2ccd50
movq %rax, 0x20(%rsp)
movq 0x40(%rsp), %rax
addq 0x28(%rsp), %rax
addq 0x78(%rsp), %rax
subq 0x20(%rsp), %rax
cmpq 0x70(%rsp), %rax
ja 0x2ce7f2
movl 0x48(%rsp), %esi
movq 0x40(%rsp), %xmm0
movaps 0x24a206(%rip), %xmm6   # 0x518930
punpckldq %xmm6, %xmm0    # xmm0 = xmm0[0],xmm6[0],xmm0[1],xmm6[1]
movapd 0x24a20a(%rip), %xmm5   # 0x518940
subpd %xmm5, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movsd 0x24a1db(%rip), %xmm4   # 0x518928
mulsd %xmm4, %xmm0
movq 0x28(%rsp), %xmm1
punpckldq %xmm6, %xmm1    # xmm1 = xmm1[0],xmm6[0],xmm1[1],xmm6[1]
subpd %xmm5, %xmm1
movaps %xmm1, %xmm2
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm2, %xmm1
mulsd %xmm4, %xmm1
movq 0x78(%rsp), %xmm2
punpckldq %xmm6, %xmm2    # xmm2 = xmm2[0],xmm6[0],xmm2[1],xmm6[1]
subpd %xmm5, %xmm2
movaps %xmm2, %xmm3
unpckhpd %xmm2, %xmm2            # xmm2 = xmm2[1,1]
addsd %xmm3, %xmm2
mulsd %xmm4, %xmm2
movq 0x20(%rsp), %xmm3
punpckldq %xmm6, %xmm3    # xmm3 = xmm3[0],xmm6[0],xmm3[1],xmm6[1]
subpd %xmm5, %xmm3
movaps %xmm3, %xmm7
unpckhpd %xmm3, %xmm3            # xmm3 = xmm3[1,1]
addsd %xmm7, %xmm3
mulsd %xmm4, %xmm3
movq 0x70(%rsp), %xmm4
punpckldq %xmm6, %xmm4    # xmm4 = xmm4[0],xmm6[0],xmm4[1],xmm6[1]
subpd %xmm5, %xmm4
movaps %xmm4, %xmm5
unpckhpd %xmm4, %xmm4            # xmm4 = xmm4[1,1]
addsd %xmm5, %xmm4
movsd 0x24a157(%rip), %xmm5   # 0x518920
divsd %xmm5, %xmm4
leaq 0x2bd37e(%rip), %rdi    # 0x58bb52
movb $0x5, %al
callq 0xe7740
movq 0x30(%rsp), %rdi
callq 0x2ce1c0
movl 0x48(%rsp), %eax
movl %eax, 0x84(%rsp)
jmp 0x2ce834
jmp 0x2ce7f4
movq 0x30(%rsp), %rdi
callq 0x2ce1c0
movl 0x48(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x48(%rsp)
jmp 0x2ce532
movq 0xb0(%rsp), %rdi
movq 0x70(%rsp), %rdx
leaq 0x2bd38f(%rip), %rsi    # 0x58bbb1
movb $0x0, %al
callq 0xd88c0
movl $0xffffffff, 0x84(%rsp) # imm = 0xFFFFFFFF
movl 0x84(%rsp), %eax
addq $0x88, %rsp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)