// File: /workspace/github_c_makefile_star2_O1/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 0x164315(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x16431d(%rip), %xmm0   # 0x3508f0
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 0x193660
movq %rax, %xmm0
punpckldq 0x1642d6(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x1642de(%rip), %xmm0   # 0x3508f0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
mulsd 0x16e0ea(%rip), %xmm1   # 0x35a710
incl %ebx
ucomisd (%rsp), %xmm1
jbe 0x1ec5ed
movl %ebp, %edi
callq 0x1bed24
cmpl %ebx, %eax
cmovbl %eax, %ebx
testl %r14d, %r14d
je 0x1ec6ce
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 0x193660
movq %rax, %xmm0
punpckldq 0x164258(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x164260(%rip), %xmm0   # 0x3508f0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
mulsd 0x1d252c(%rip), %xmm1   # 0x3bebd0
incl %r13d
ucomisd (%rsp), %xmm1
jbe 0x1ec66a
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