// File: /workspace/github_c_makefile_star2_O2/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)
pushq $-0x1
popq %rax
movl %edx, %ecx
shlq %cl, %rax
cmpl $0x20, %edx
notq %rax
movl $0xffffffff, %r11d      # imm = 0xFFFFFFFF
cmovbq %rax, %r11
testq %rdi, %rdi
je 0xc6e79
testq %r8, %r8
je 0xc6e79
cmpl $0x21, %edx
jae 0xc6ea7
movl %edx, %ebx
imulq (%rsp), %rbx
testq %rbx, %rbx
je 0xc6e6a
movq %rsi, %rax
shrq $0x3, %rax
andl $0x7, %esi
addq %rax, %rdi
pushq $0x8
popq %r13
testl %esi, %esi
je 0xc6dca
movl %r13d, %r9d
subl %esi, %r9d
cmpq %r9, %rbx
movq %r9, %rsi
cmovbq %rbx, %rsi
subl %esi, %r9d
pushq $-0x1
popq %r15
movl %esi, %ecx
shll %cl, %r15d
notl %r15d
movl %r9d, %ecx
shlq %cl, %r15
movzbl (%rdi), %eax
incq %rdi
andl %eax, %r15d
shrq %cl, %r15
subq %rsi, %rbx
jmp 0xc6dcf
xorl %r15d, %r15d
xorl %esi, %esi
movl %edx, %r12d
negl %r12d
xorl %eax, %eax
xorl %r10d, %r10d
cmpq (%rsp), %r10
jae 0xc6e6a
cmpl %edx, %esi
jae 0xc6e5d
testq %rbx, %rbx
je 0xc6e5d
pushq $0x40
popq %rcx
subl %esi, %ecx
movl %r13d, %r9d
subl %eax, %r9d
cmpl %r9d, %ecx
cmovbl %ecx, %r9d
cmpq %r9, %rbx
cmovbq %rbx, %r9
pushq $-0x1
popq %r14
movl %r9d, %ecx
shlq %cl, %r14
shlq %cl, %r15
movzbl (%rdi), %ebp
addl %r9d, %eax
movb $0x8, %cl
subb %al, %cl
shrl %cl, %ebp
notl %r14d
andl %r14d, %ebp
orq %rbp, %r15
addl %r9d, %esi
subq %r9, %rbx
xorl %ecx, %ecx
cmpl $0x8, %eax
sete %cl
movl $0x0, %r9d
cmovel %r9d, %eax
addq %rcx, %rdi
jmp 0xc6de4
addl %r12d, %esi
movq %r15, %r14
movl %esi, %ecx
shrq %cl, %r14
andl %r11d, %r14d
movl %r14d, (%r8,%r10,4)
incq %r10
movl %r9d, %esi
movl %esi, %r9d
subl %edx, %r9d
jae 0xc6e45
jmp 0xc6dda
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x67138(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x31dc(%rip), %rsi      # 0xca066
leaq 0x2e496(%rip), %rdx     # 0xf5327
leaq 0x2e49a(%rip), %rcx     # 0xf5332
leaq 0x2e408(%rip), %r8      # 0xf52a7
movl $0xaf, %r9d
jmp 0xc6ed3
movq 0x6710a(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x31ae(%rip), %rsi      # 0xca066
leaq 0x2e48e(%rip), %rdx     # 0xf534d
leaq 0x2e46c(%rip), %rcx     # 0xf5332
leaq 0x2e3da(%rip), %r8      # 0xf52a7
movl $0xb0, %r9d
xorl %eax, %eax
callq 0xb8c0
callq 0xb300