// File: /workspace/github_c_makefile_star2_O3/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
subq $0x18, %rsp
testq %rdi, %rdi
je 0x19ad37
movq %rdi, %r14
movl 0x58(%rdi), %edi
testb $0x3, %dil
je 0x19ac86
movq %rdx, %r12
movq %rsi, %rbp
xorl %eax, %eax
andl $0x2, %edi
je 0x19ac20
movl 0x48(%r14), %eax
movl %edi, %edx
shrl %edx
addl %eax, %edx
addl 0x44(%r14), %edx
movl 0x4c(%r14), %eax
addl %eax, %edx
movq %rdx, (%rcx)
testq %rbp, %rbp
je 0x19ac94
movq %rax, 0x8(%rsp)
movq %rcx, 0x10(%rsp)
xorl %r13d, %r13d
testq %r12, %r12
je 0x19ac9b
addq $0x8, %rbp
xorl %r15d, %r15d
xorl %ebx, %ebx
movq (%rbp), %rdi
cmpq %r15, %rdi
cmovaq %rdi, %r15
testb $0x2, 0x58(%r14)
je 0x19ac74
callq 0x2f09dd
cltq
imulq -0x8(%rbp), %rax
addq %rax, %rbx
addq $0x10, %rbp
decq %r12
jne 0x19ac53
movl 0x58(%r14), %edi
andl $0x2, %edi
jmp 0x19aca0
xorps %xmm0, %xmm0
movups %xmm0, (%rcx)
movq $0x0, 0x10(%rcx)
xorl %eax, %eax
jmp 0x19ad28
xorl %ebx, %ebx
xorl %r15d, %r15d
movq (%r14), %rax
movl 0x40(%r14), %esi
xorl %edx, %edx
divq %rsi
movq %rax, %r12
addq 0x8(%r14), %r12
testl %edi, %edi
je 0x19acc2
movq %r15, %rdi
callq 0x2f09dd
movl %eax, %r13d
addl 0x44(%r14), %r13d
imulq %r13, %r12
addq %rbx, %r12
movq 0x8(%rsp), %rbx
testq %rbx, %rbx
je 0x19ace7
movq (%r14), %rsi
movq 0x50(%r14), %rdi
callq *(%rdi)
imulq %rbx, %rax
addq %rax, %r12
testb $0x2, 0x58(%r14)
jne 0x19acfa
movl 0x4c(%r14), %ebx
addl 0x44(%r14), %ebx
xorl %eax, %eax
jmp 0x19ad10
movl 0x44(%r14), %ebx
addl 0x48(%r14), %ebx
addl 0x4c(%r14), %ebx
movq %r15, %rdi
callq 0x2f09dd
cltq
movl %ebx, %ecx
imulq %rcx, %r15
addq %rax, %r15
movq 0x10(%rsp), %rax
movq %r15, 0x8(%rax)
movq %r12, 0x10(%rax)
movb $0x1, %al
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x5ef8f