// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/match/sfx-apfxlen.c
// Function: gt_whatisthemaximalprefixlength
unsigned int gt_whatisthemaximalprefixlength(unsigned int numofchars,
                                             GtUword totallength,
                                             unsigned int prefixlenbits,
                                             bool withspecialsuffixes)
{
  unsigned int maxprefixlen, mbp;

  maxprefixlen = prefixlengthwithmaxspace(numofchars,totallength,
                                          GT_MAXMULTIPLIEROFTOTALLENGTH,
                                          totallength+1,
                                          withspecialsuffixes);
  mbp = gt_maxbasepower(numofchars);
  maxprefixlen = GT_MIN(mbp,maxprefixlen);
  if (prefixlenbits > 0)
  {
    unsigned int tmplength;
    tmplength
      = prefixlengthwithmaxspace(numofchars,
                                 (GtUword)
                                 MAXREMAININGAFTERPREFIXLEN(prefixlenbits),
                                 GT_RECOMMENDED_MULTIPLIER_DEFAULT,
                                 totallength+1,
                                 withspecialsuffixes);
    if (tmplength > 0 && maxprefixlen > tmplength)
    {
      maxprefixlen = tmplength;
    }
    tmplength = GT_MAXVALUEWITHBITS(prefixlenbits);
    if (tmplength > 0 && maxprefixlen > tmplength)
    {
      maxprefixlen = tmplength;
    }
  }
  if (maxprefixlen == 0)
  {
    return 1U;
  }
  return maxprefixlen;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edx, %r14d
movq %rsi, %r15
movl %edi, %ebp
movq %rsi, %xmm0
incq %r15
punpckldq 0x164ba5(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x164bad(%rip), %xmm0   # 0x3478f0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movapd %xmm1, (%rsp)
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movzbl %cl, %r12d
leal 0x2(%rbx), %esi
movl %ebp, %edi
movq %r15, %rdx
movl %r12d, %ecx
callq 0x18b00c
movq %rax, %xmm0
punpckldq 0x164b66(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x164b6e(%rip), %xmm0   # 0x3478f0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
mulsd 0x16e942(%rip), %xmm1   # 0x3516d8
incl %ebx
ucomisd (%rsp), %xmm1
jbe 0x1e2d5d
movl %ebp, %edi
callq 0x1b62a4
cmpl %ebx, %eax
cmovbl %eax, %ebx
testl %r14d, %r14d
je 0x1e2e3e
leal 0x20(%r14), %ecx
negl %ecx
movq $-0x1, %rax
shlq %cl, %rax
notq %rax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movsd %xmm0, (%rsp)
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
leal 0x2(%r13), %esi
movl %ebp, %edi
movq %r15, %rdx
movl %r12d, %ecx
callq 0x18b00c
movq %rax, %xmm0
punpckldq 0x164ae8(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x164af0(%rip), %xmm0   # 0x3478f0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
mulsd 0x1d279c(%rip), %xmm1   # 0x3b55b0
incl %r13d
ucomisd (%rsp), %xmm1
jbe 0x1e2dda
cmpl %r13d, %ebx
movl %r13d, %eax
cmovbl %ebx, %eax
testl %r13d, %r13d
cmovel %ebx, %eax
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %r14d, %ecx
shll %cl, %ebx
notl %ebx
cmpl %ebx, %eax
cmovbl %eax, %ebx
cmpl $0x1, %ebx
adcl $0x0, %ebx
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq