// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/core/bitpackstringop32.c
// Function: gt_bsGetNonUniformUInt32Array
void
gt_bsGetNonUniformUInt32Array(
  constBitString str, BitOffset offset, size_t numValues,
  BitOffset numBitsTotal, unsigned numBitsList[], uint32_t val[])
{
  /* idea: read as much as possible from str in each iteration,
   * accumulate if bitsLeft < numBits */
  size_t j = 0;
  BitOffset totalBitsLeft = numBitsTotal;
  size_t elemStart = offset/bitElemBits;
  unsigned bitTop = offset%bitElemBits,
    bitsRead = 0; /*< how many bits in current *p are read */
  const BitElem *p = str + elemStart;
  unsigned bitsInAccum = 0;
  GtUword accum = 0;
  gt_assert(str && val);
  /* user requested zero values, ugly but must be handled, since legal */
  if (!totalBitsLeft)
  {
    return;
  }
  /* get bits of first element if not aligned */
  if (bitTop)
  {
    GtUword mask; /*< all of the bits we want to get from *p */
    unsigned bits2Read = GT_MIN(bitElemBits - bitTop, totalBitsLeft);
    unsigned unreadRightBits = (bitElemBits - bitTop - bits2Read);
    mask = (~((~(GtUword)0) << bits2Read)) << unreadRightBits;
    accum = ((*p++) & mask) >> unreadRightBits;
    bitsInAccum += bits2Read;
    totalBitsLeft -= bits2Read;
  }
  while (j < numValues)
  {
    while (bitsInAccum < numBitsList[j] && totalBitsLeft)
    {
      unsigned bits2Read, bitsFree = sizeof (accum)*CHAR_BIT - bitsInAccum;
      GtUword mask;
      bits2Read = GT_MIN3(bitsFree, bitElemBits - bitsRead, totalBitsLeft);
      mask = (~((~(GtUword)0) << bits2Read));
      accum = accum << bits2Read | (((*p) >> (bitElemBits
                                              - bits2Read - bitsRead)) & mask);
      bitsInAccum += bits2Read;
      totalBitsLeft -= bits2Read;
      /* all of *p consumed? */
      if ((bitsRead += bits2Read) == bitElemBits)
      {
        ++p, bitsRead = 0;
      }
    }
    {
      unsigned numBits;
      /* now we have enough bits in accum */
      while (j < numValues && bitsInAccum >= (numBits = numBitsList[j]))
      {
        GtUword valMask;
        gt_assert(numBits <= sizeof (val[0])*CHAR_BIT);
        valMask = ~(GtUword)0;
        if (numBits < (sizeof (val[0])*CHAR_BIT))
          valMask = ~(valMask << numBits);
        val[j++] = ((accum >> (bitsInAccum - numBits)) & valMask );
        bitsInAccum -= numBits;
      }
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0xddf25
testq %r9, %r9
je 0xddf25
movq %rcx, %rax
testq %rcx, %rcx
je 0xddf11
movq %rsi, %rcx
shrq $0x3, %rcx
andl $0x7, %esi
addq %rcx, %rdi
testl %esi, %esi
je 0xdde36
movl $0x8, %r10d
subl %esi, %r10d
cmpq %rax, %r10
movq %rax, %rsi
cmovbq %r10, %rsi
subl %esi, %r10d
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %esi, %ecx
shll %cl, %ebp
notl %ebp
movl %r10d, %ecx
shlq %cl, %rbp
movzbl (%rdi), %ecx
incq %rdi
andl %ecx, %ebp
movl %r10d, %ecx
shrq %cl, %rbp
subq %rsi, %rax
jmp 0xdde3a
xorl %ebp, %ebp
xorl %esi, %esi
testq %rdx, %rdx
je 0xddf11
xorl %ebx, %ebx
xorl %r15d, %r15d
xorl %r14d, %r14d
movl (%r8,%r15,4), %r10d
cmpl %r10d, %esi
jae 0xddeb9
testq %rax, %rax
je 0xddeb9
movq %rdi, %r12
movl $0x40, %ecx
subl %esi, %ecx
movl $0x8, %edi
subl %r14d, %edi
cmpl %edi, %ecx
cmovbl %ecx, %edi
cmpq %rdi, %rax
cmovbq %rax, %rdi
movq $-0x1, %r13
movl %edi, %ecx
shlq %cl, %r13
movq %rbp, %r11
shlq %cl, %r11
movzbl (%r12), %ebp
addl %edi, %r14d
movb $0x8, %cl
subb %r14b, %cl
shrl %cl, %ebp
notl %r13d
andl %r13d, %ebp
orq %r11, %rbp
addl %edi, %esi
subq %rdi, %rax
xorl %edi, %edi
cmpl $0x8, %r14d
sete %dil
cmovel %ebx, %r14d
addq %r12, %rdi
jmp 0xdde4f
cmpq %rdx, %r15
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
jae 0xddf08
movl (%r8,%r15,4), %r10d
cmpl %r10d, %esi
jb 0xddf08
cmpl $0x21, %r10d
jae 0xddf20
movq $-0x1, %r11
movl %r10d, %ecx
shlq %cl, %r11
subl %r10d, %esi
movq %rbp, %r12
movl %esi, %ecx
shrq %cl, %r12
cmpq $0x20, %r10
notl %r11d
cmovel %r13d, %r11d
andl %r11d, %r12d
movl %r12d, (%r9,%r15,4)
incq %r15
cmpq %r15, %rdx
jne 0xddec4
movq %rdx, %r15
cmpq %rdx, %r15
jb 0xdde4b
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x3448f
callq 0x34456