// File: /workspace/github_c_makefile_star2_O0/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:
subq $0xb8, %rsp
movq %rdi, 0xb0(%rsp)
movq %rsi, 0xa8(%rsp)
movl %edx, 0xa4(%rsp)
movq %rcx, 0x98(%rsp)
movq %r8, 0x90(%rsp)
movq $0x0, 0x88(%rsp)
movq 0x98(%rsp), %rax
movl 0xa4(%rsp), %ecx
imulq %rcx, %rax
movq %rax, 0x80(%rsp)
movq 0xa8(%rsp), %rax
shrq $0x3, %rax
movq %rax, 0x78(%rsp)
movq 0xa8(%rsp), %rax
andq $0x7, %rax
movl %eax, 0x74(%rsp)
movl $0x0, 0x70(%rsp)
movq 0xb0(%rsp), %rax
addq 0x78(%rsp), %rax
movq %rax, 0x68(%rsp)
movl $0x0, 0x64(%rsp)
movq $0x0, 0x58(%rsp)
movq $-0x1, 0x50(%rsp)
movl 0xa4(%rsp), %eax
cmpq $0x20, %rax
jae 0x15710f
movq 0x50(%rsp), %rax
movl 0xa4(%rsp), %ecx
shlq %cl, %rax
xorq $-0x1, %rax
movq %rax, 0x50(%rsp)
jmp 0x157111
cmpq $0x0, 0xb0(%rsp)
je 0x157127
cmpq $0x0, 0x90(%rsp)
jne 0x15715f
movq 0x5ceaa(%rip), %rax     # 0x1b3fd8
movq (%rax), %rdi
leaq 0x6f2e(%rip), %rsi      # 0x15e066
leaq 0x37da8(%rip), %rdx     # 0x18eee7
leaq 0x37dac(%rip), %rcx     # 0x18eef2
leaq 0x37d1a(%rip), %r8      # 0x18ee67
movl $0xaf, %r9d
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x157161
jmp 0x157163
movl 0xa4(%rsp), %eax
cmpq $0x20, %rax
jbe 0x1571a8
movq 0x5ce61(%rip), %rax     # 0x1b3fd8
movq (%rax), %rdi
leaq 0x6ee5(%rip), %rsi      # 0x15e066
leaq 0x37d85(%rip), %rdx     # 0x18ef0d
leaq 0x37d63(%rip), %rcx     # 0x18eef2
leaq 0x37cd1(%rip), %r8      # 0x18ee67
movl $0xb0, %r9d
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x1571aa
cmpq $0x0, 0x80(%rsp)
jne 0x1571ba
jmp 0x157467
cmpl $0x0, 0x74(%rsp)
je 0x15727d
movl $0x8, %eax
subl 0x74(%rsp), %eax
movl %eax, %eax
cmpq 0x80(%rsp), %rax
jae 0x1571ec
movl $0x8, %eax
subl 0x74(%rsp), %eax
movl %eax, %eax
movq %rax, 0x28(%rsp)
jmp 0x1571f9
movq 0x80(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x28(%rsp), %rax
movl %eax, 0x44(%rsp)
movl $0x8, %eax
subl 0x74(%rsp), %eax
subl 0x44(%rsp), %eax
movl %eax, 0x40(%rsp)
movl 0x44(%rsp), %eax
movl %eax, %ecx
movq $-0x1, %rax
shlq %cl, %rax
xorq $-0x1, %rax
movl 0x40(%rsp), %ecx
shlq %cl, %rax
movq %rax, 0x48(%rsp)
movq 0x68(%rsp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, 0x68(%rsp)
movzbl (%rax), %eax
andq 0x48(%rsp), %rax
movl 0x40(%rsp), %ecx
shrq %cl, %rax
movq %rax, 0x58(%rsp)
movl 0x44(%rsp), %eax
addl 0x64(%rsp), %eax
movl %eax, 0x64(%rsp)
movl 0x44(%rsp), %eax
movl %eax, %ecx
movq 0x80(%rsp), %rax
subq %rcx, %rax
movq %rax, 0x80(%rsp)
jmp 0x15727f
movq 0x88(%rsp), %rax
cmpq 0x98(%rsp), %rax
jae 0x157467
jmp 0x157297
movl 0x64(%rsp), %ecx
xorl %eax, %eax
cmpl 0xa4(%rsp), %ecx
movb %al, 0x27(%rsp)
jae 0x1572ba
cmpq $0x0, 0x80(%rsp)
setne %al
movb %al, 0x27(%rsp)
movb 0x27(%rsp), %al
testb $0x1, %al
jne 0x1572c7
jmp 0x157402
movl 0x64(%rsp), %eax
movl %eax, %ecx
movl $0x40, %eax
subq %rcx, %rax
movl %eax, 0x38(%rsp)
movl 0x38(%rsp), %eax
movl $0x8, %ecx
subl 0x70(%rsp), %ecx
cmpl %ecx, %eax
jae 0x15731c
movl 0x38(%rsp), %eax
cmpq 0x80(%rsp), %rax
jae 0x157303
movl 0x38(%rsp), %eax
movq %rax, 0x18(%rsp)
jmp 0x157310
movq 0x80(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rax
movq %rax, 0x10(%rsp)
jmp 0x15735a
movl $0x8, %eax
subl 0x70(%rsp), %eax
movl %eax, %eax
cmpq 0x80(%rsp), %rax
jae 0x157343
movl $0x8, %eax
subl 0x70(%rsp), %eax
movl %eax, %eax
movq %rax, 0x8(%rsp)
jmp 0x157350
movq 0x80(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rax
movl %eax, 0x3c(%rsp)
movl 0x3c(%rsp), %eax
movl %eax, %ecx
movq $-0x1, %rax
shlq %cl, %rax
xorq $-0x1, %rax
movq %rax, 0x30(%rsp)
movq 0x58(%rsp), %rax
movl 0x3c(%rsp), %ecx
shlq %cl, %rax
movq 0x68(%rsp), %rcx
movzbl (%rcx), %edx
movl $0x8, %ecx
subl 0x3c(%rsp), %ecx
subl 0x70(%rsp), %ecx
sarl %cl, %edx
movl %edx, %ecx
movslq %ecx, %rcx
andq 0x30(%rsp), %rcx
orq %rcx, %rax
movq %rax, 0x58(%rsp)
movl 0x3c(%rsp), %eax
addl 0x64(%rsp), %eax
movl %eax, 0x64(%rsp)
movl 0x3c(%rsp), %eax
movl %eax, %ecx
movq 0x80(%rsp), %rax
subq %rcx, %rax
movq %rax, 0x80(%rsp)
movl 0x3c(%rsp), %eax
addl 0x70(%rsp), %eax
movl %eax, 0x70(%rsp)
cmpl $0x8, %eax
jne 0x1573fd
movq 0x68(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x68(%rsp)
movl $0x0, 0x70(%rsp)
jmp 0x157297
jmp 0x157404
movl 0x64(%rsp), %eax
cmpl 0xa4(%rsp), %eax
jb 0x157462
movq 0x58(%rsp), %rax
movl 0x64(%rsp), %ecx
subl 0xa4(%rsp), %ecx
movl %ecx, %ecx
shrq %cl, %rax
andq 0x50(%rsp), %rax
movl %eax, %edx
movq 0x90(%rsp), %rax
movq 0x88(%rsp), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, 0x88(%rsp)
movl %edx, (%rax,%rcx,4)
movl 0xa4(%rsp), %ecx
movl 0x64(%rsp), %eax
subl %ecx, %eax
movl %eax, 0x64(%rsp)
jmp 0x157404
jmp 0x15727f
addq $0xb8, %rsp
retq
nop