// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/core/bitpackstringop32.c
// Function: gt_bsGetUniformUInt32Array
void
gt_bsGetUniformUInt32Array(constBitString str, BitOffset offset,
                           unsigned numBits, size_t numValues,
                           uint32_t val[])
{
  /* idea: read as much as possible from str in each iteration,
   * accumulate if bitsLeft < numBits */
  size_t j = 0;
  BitOffset totalBitsLeft = numValues * numBits;
  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, valMask = ~(GtUword)0;
  if (numBits < (sizeof (val[0])*CHAR_BIT))
    valMask = ~(valMask << numBits);
  gt_assert(str && val);
  gt_assert(numBits <= sizeof (val[0])*CHAR_BIT);
  /* 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 < numBits && 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;
      }
    }
    /* now we have enough bits in accum */
    while (bitsInAccum >= numBits)
    {
      val[j++] = ((accum >> (bitsInAccum - numBits)) & valMask);
      bitsInAccum -= numBits;
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, (%rsp)
movq $-0x1, %r9
movl %edx, %ecx
shlq %cl, %r9
cmpl $0x20, %edx
notq %r9
movl $0xffffffff, %r10d      # imm = 0xFFFFFFFF
cmovbq %r9, %r10
testq %rdi, %rdi
je 0xde4b0
testq %r8, %r8
je 0xde4b0
cmpl $0x21, %edx
jae 0xde4b5
movl %edx, %r11d
imulq (%rsp), %r11
testq %r11, %r11
je 0xde4a1
movq %rsi, %rcx
shrq $0x3, %rcx
andl $0x7, %esi
addq %rcx, %rdi
testl %esi, %esi
je 0xde3fa
movl $0x8, %r9d
subl %esi, %r9d
cmpq %r9, %r11
movq %r9, %rsi
cmovbq %r11, %rsi
subl %esi, %r9d
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %esi, %ecx
shll %cl, %ebx
notl %ebx
movl %r9d, %ecx
shlq %cl, %rbx
movzbl (%rdi), %ecx
incq %rdi
andl %ecx, %ebx
movl %r9d, %ecx
shrq %cl, %rbx
subq %rsi, %r11
jmp 0xde3fe
xorl %ebx, %ebx
xorl %esi, %esi
cmpq $0x0, (%rsp)
je 0xde4a1
movl %edx, %r9d
negl %r9d
xorl %r14d, %r14d
xorl %r15d, %r15d
xorl %ebp, %ebp
cmpl %edx, %esi
jae 0xde493
testq %r11, %r11
je 0xde493
movq %rdi, %r12
movl $0x40, %ecx
subl %esi, %ecx
movl $0x8, %edi
subl %ebp, %edi
cmpl %edi, %ecx
cmovbl %ecx, %edi
cmpq %rdi, %r11
cmovbq %r11, %rdi
movq $-0x1, %r13
movl %edi, %ecx
shlq %cl, %r13
movq %rbx, %rax
shlq %cl, %rax
movzbl (%r12), %ebx
addl %edi, %ebp
movb $0x8, %cl
subb %bpl, %cl
shrl %cl, %ebx
notl %r13d
andl %r13d, %ebx
orq %rax, %rbx
addl %edi, %esi
subq %rdi, %r11
xorl %edi, %edi
cmpl $0x8, %ebp
sete %dil
cmovel %r14d, %ebp
addq %r12, %rdi
jmp 0xde417
leal (%r9,%rsi), %ecx
subl %edx, %esi
movq %rbx, %rax
shrq %cl, %rax
andl %r10d, %eax
movl %eax, (%r8,%r15,4)
incq %r15
cmpl %edx, %esi
jae 0xde47d
cmpq (%rsp), %r15
jb 0xde417
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x33d95
callq 0x33dce