// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/match/eis-bwtseq-extinfo.c
// Function: locBitsUpperBounds
static bool
locBitsUpperBounds(void *cbState, struct segmentDesc *desc,
                   size_t numSegmentDesc, struct varBitsEstimate *result)
{
  struct addLocateInfoState *state = cbState;
  gt_assert(cbState);
  if (state->featureToggles & (BWTLocateCount | BWTLocateBitmap))
  {
    unsigned maxBitsPerPos = bitsPerPosUpperBound(state);
    result->maxBitsPerPos = maxBitsPerPos;
    if (desc)
    {
      size_t i, maxSegLen = 0;
      BitOffset maxBitsTotal = 0;
      GT_UNUSED GtUword numSegmentsTotal = 0;
      unsigned bitsPerOrigRank = state->bitsPerOrigRank;
      for (i = 0; i < numSegmentDesc; ++i)
      {
        size_t len = desc[i].len;
        maxSegLen = GT_MAX(len, maxSegLen);
        if (state->featureToggles & BWTLocateCount)
          maxBitsTotal += requiredUlongBits(len) * desc[i].repeatCount;
        numSegmentsTotal += desc[i].repeatCount;
      }
      maxBitsTotal +=
        (state->seqLen / state->locateInterval + state->extraLocMarksUpperBound)
        * (((state->featureToggles & BWTLocateCount) ?
            requiredUlongBits(maxSegLen) : 0)
           + state->bitsPerOrigPos);
      if (bitsPerOrigRank)
      {
        GtUword maxRank = specialsRank(state->sprTable, state->seqLen);
        /* rank values stored */
        maxBitsTotal += maxRank * bitsPerOrigRank;
      }
      result->maxBitsPerBucket =
        /* locate marks and rank sorts */
        maxSegLen * bitsPerPosUpperBoundWithoutSegmentAggregates(state)
        /* count of locate marks */
        + ((state->featureToggles & BWTLocateCount) ?
           requiredUlongBits(maxSegLen) : 0);
      result->maxBitsTotal = maxBitsTotal;
      return true;
    }
    else
      return false;
  }
  else
  {
    result->maxBitsTotal = result->maxBitsPerBucket
      = result->maxBitsPerPos = 0;
    return false;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x1455ee
movq %rcx, %rbx
movq %rdi, %r14
movl 0x58(%rdi), %ebp
testb $0x3, %bpl
je 0x1455b9
movq %rdx, %r12
movq %rsi, %r13
movq %r14, %rdi
callq 0x146111
btl $0x1, %ebp
adcl $0x0, %eax
movq %rax, (%rbx)
testq %r13, %r13
je 0x1455c4
movl 0x4c(%r14), %eax
movq %rax, (%rsp)
addq $0x8, %r13
xorl %ebp, %ebp
xorl %r15d, %r15d
subq $0x1, %r12
jb 0x145555
movq (%r13), %rdi
cmpq %r15, %rdi
cmovaq %rdi, %r15
testb $0x2, 0x58(%r14)
je 0x14554f
callq 0x28a939
cltq
imulq -0x8(%r13), %rax
addq %rax, %rbp
addq $0x10, %r13
jmp 0x145528
movq (%r14), %rax
movl 0x40(%r14), %esi
xorl %ecx, %ecx
xorl %edx, %edx
divq %rsi
movq %rax, %r12
addq 0x8(%r14), %r12
testb $0x2, 0x58(%r14)
je 0x14557b
movq %r15, %rdi
callq 0x28a939
movl %eax, %ecx
addl 0x44(%r14), %ecx
imulq %rcx, %r12
addq %rbp, %r12
movq (%rsp), %r13
testq %r13, %r13
je 0x14559f
movq (%r14), %rsi
movq 0x50(%r14), %rdi
callq *(%rdi)
imulq %r13, %rax
addq %rax, %r12
movq %r14, %rdi
callq 0x146111
movl %eax, %r13d
imulq %r15, %r13
testb $0x2, 0x58(%r14)
jne 0x1455c8
xorl %eax, %eax
jmp 0x1455d2
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
andq $0x0, 0x10(%rbx)
xorl %eax, %eax
jmp 0x1455df
movq %r15, %rdi
callq 0x28a939
cltq
addq %r13, %rax
movq %rax, 0x8(%rbx)
movq %r12, 0x10(%rbx)
movb $0x1, %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x2f2973(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x19fa14(%rip), %rsi    # 0x2e5013
leaq 0x1fd67b(%rip), %rdx    # 0x342c81
leaq 0x1fd6b9(%rip), %rcx    # 0x342cc6
leaq 0x1fd2cc(%rip), %r8     # 0x3428e0
movl $0xca, %r9d
xorl %eax, %eax
callq 0x17a50
callq 0x17390