// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/core/bitpackstringop64.c
// Function: gt_bsGetNonUniformUInt64Array
void
gt_bsGetNonUniformUInt64Array(
  constBitString str, BitOffset offset, size_t numValues,
  BitOffset numBitsTotal, unsigned numBitsList[], uint64_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;
  GtUint64 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)
  {
    GtUint64 mask; /*< all of the bits we want to get from *p */
    unsigned bits2Read = GT_MIN(bitElemBits - bitTop, totalBitsLeft);
    unsigned unreadRightBits = (bitElemBits - bitTop - bits2Read);
    mask = (~((~(GtUint64)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;
      GtUint64 mask;
      bits2Read = GT_MIN3(bitsFree, bitElemBits - bitsRead, totalBitsLeft);
      mask = (~((~(GtUint64)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]))
      {
        GtUint64 valMask;
        gt_assert(numBits <= sizeof (val[0])*CHAR_BIT);
        valMask = ~(GtUint64)0;
        if (numBits < (sizeof (val[0])*CHAR_BIT))
          valMask = ~(valMask << numBits);
        val[j++] = ((accum >> (bitsInAccum - numBits)) & valMask );
        bitsInAccum -= numBits;
      }
    }
  }
}

// Assembly:
subq $0xc8, %rsp
movq %rdi, 0xc0(%rsp)
movq %rsi, 0xb8(%rsp)
movq %rdx, 0xb0(%rsp)
movq %rcx, 0xa8(%rsp)
movq %r8, 0xa0(%rsp)
movq %r9, 0x98(%rsp)
movq $0x0, 0x90(%rsp)
movq 0xa8(%rsp), %rax
movq %rax, 0x88(%rsp)
movq 0xb8(%rsp), %rax
shrq $0x3, %rax
movq %rax, 0x80(%rsp)
movq 0xb8(%rsp), %rax
andq $0x7, %rax
movl %eax, 0x7c(%rsp)
movl $0x0, 0x78(%rsp)
movq 0xc0(%rsp), %rax
addq 0x80(%rsp), %rax
movq %rax, 0x70(%rsp)
movl $0x0, 0x6c(%rsp)
movq $0x0, 0x60(%rsp)
cmpq $0x0, 0xc0(%rsp)
je 0x47785b
cmpq $0x0, 0x98(%rsp)
jne 0x477893
movq 0x1c473e(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x9e7a7(%rip), %rsi     # 0x516013
leaq 0x1384f0(%rip), %rdx    # 0x5afd63
leaq 0x1387df(%rip), %rcx    # 0x5b0059
leaq 0x13878f(%rip), %r8     # 0x5b0010
movl $0xeb, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x477895
cmpq $0x0, 0x88(%rsp)
jne 0x4778a5
jmp 0x477c06
cmpl $0x0, 0x7c(%rsp)
je 0x477968
movl $0x8, %eax
subl 0x7c(%rsp), %eax
movl %eax, %eax
cmpq 0x88(%rsp), %rax
jae 0x4778d7
movl $0x8, %eax
subl 0x7c(%rsp), %eax
movl %eax, %eax
movq %rax, 0x28(%rsp)
jmp 0x4778e4
movq 0x88(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x28(%rsp), %rax
movl %eax, 0x54(%rsp)
movl $0x8, %eax
subl 0x7c(%rsp), %eax
subl 0x54(%rsp), %eax
movl %eax, 0x50(%rsp)
movl 0x54(%rsp), %eax
movl %eax, %ecx
movq $-0x1, %rax
shlq %cl, %rax
xorq $-0x1, %rax
movl 0x50(%rsp), %ecx
shlq %cl, %rax
movq %rax, 0x58(%rsp)
movq 0x70(%rsp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, 0x70(%rsp)
movzbl (%rax), %eax
andq 0x58(%rsp), %rax
movl 0x50(%rsp), %ecx
shrq %cl, %rax
movq %rax, 0x60(%rsp)
movl 0x54(%rsp), %eax
addl 0x6c(%rsp), %eax
movl %eax, 0x6c(%rsp)
movl 0x54(%rsp), %eax
movl %eax, %ecx
movq 0x88(%rsp), %rax
subq %rcx, %rax
movq %rax, 0x88(%rsp)
jmp 0x47796a
movq 0x90(%rsp), %rax
cmpq 0xb0(%rsp), %rax
jae 0x477c06
jmp 0x477982
movl 0x6c(%rsp), %ecx
movq 0xa0(%rsp), %rdx
movq 0x90(%rsp), %rsi
xorl %eax, %eax
cmpl (%rdx,%rsi,4), %ecx
movb %al, 0x27(%rsp)
jae 0x4779b1
cmpq $0x0, 0x88(%rsp)
setne %al
movb %al, 0x27(%rsp)
movb 0x27(%rsp), %al
testb $0x1, %al
jne 0x4779be
jmp 0x477af9
movl 0x6c(%rsp), %eax
movl %eax, %ecx
movl $0x40, %eax
subq %rcx, %rax
movl %eax, 0x48(%rsp)
movl 0x48(%rsp), %eax
movl $0x8, %ecx
subl 0x78(%rsp), %ecx
cmpl %ecx, %eax
jae 0x477a13
movl 0x48(%rsp), %eax
cmpq 0x88(%rsp), %rax
jae 0x4779fa
movl 0x48(%rsp), %eax
movq %rax, 0x18(%rsp)
jmp 0x477a07
movq 0x88(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rax
movq %rax, 0x10(%rsp)
jmp 0x477a51
movl $0x8, %eax
subl 0x78(%rsp), %eax
movl %eax, %eax
cmpq 0x88(%rsp), %rax
jae 0x477a3a
movl $0x8, %eax
subl 0x78(%rsp), %eax
movl %eax, %eax
movq %rax, 0x8(%rsp)
jmp 0x477a47
movq 0x88(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rax
movl %eax, 0x4c(%rsp)
movl 0x4c(%rsp), %eax
movl %eax, %ecx
movq $-0x1, %rax
shlq %cl, %rax
xorq $-0x1, %rax
movq %rax, 0x40(%rsp)
movq 0x60(%rsp), %rax
movl 0x4c(%rsp), %ecx
shlq %cl, %rax
movq 0x70(%rsp), %rcx
movzbl (%rcx), %edx
movl $0x8, %ecx
subl 0x4c(%rsp), %ecx
subl 0x78(%rsp), %ecx
sarl %cl, %edx
movl %edx, %ecx
movslq %ecx, %rcx
andq 0x40(%rsp), %rcx
orq %rcx, %rax
movq %rax, 0x60(%rsp)
movl 0x4c(%rsp), %eax
addl 0x6c(%rsp), %eax
movl %eax, 0x6c(%rsp)
movl 0x4c(%rsp), %eax
movl %eax, %ecx
movq 0x88(%rsp), %rax
subq %rcx, %rax
movq %rax, 0x88(%rsp)
movl 0x4c(%rsp), %eax
addl 0x78(%rsp), %eax
movl %eax, 0x78(%rsp)
cmpl $0x8, %eax
jne 0x477af4
movq 0x70(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x70(%rsp)
movl $0x0, 0x78(%rsp)
jmp 0x477982
jmp 0x477afb
movq 0x90(%rsp), %rcx
xorl %eax, %eax
cmpq 0xb0(%rsp), %rcx
movb %al, 0x7(%rsp)
jae 0x477b37
movl 0x6c(%rsp), %eax
movq 0xa0(%rsp), %rcx
movq 0x90(%rsp), %rdx
movl (%rcx,%rdx,4), %ecx
movl %ecx, 0x3c(%rsp)
cmpl %ecx, %eax
setae %al
movb %al, 0x7(%rsp)
movb 0x7(%rsp), %al
testb $0x1, %al
jne 0x477b44
jmp 0x477c01
jmp 0x477b46
movl 0x3c(%rsp), %eax
cmpq $0x40, %rax
jbe 0x477b88
movq 0x1c4449(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x9e4b2(%rip), %rsi     # 0x516013
leaq 0x138221(%rip), %rdx    # 0x5afd89
leaq 0x1384ea(%rip), %rcx    # 0x5b0059
leaq 0x13849a(%rip), %r8     # 0x5b0010
movl $0x114, %r9d            # imm = 0x114
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x477b8a
movq $-0x1, 0x30(%rsp)
movl 0x3c(%rsp), %eax
cmpq $0x40, %rax
jae 0x477bb2
movq 0x30(%rsp), %rax
movl 0x3c(%rsp), %ecx
shlq %cl, %rax
xorq $-0x1, %rax
movq %rax, 0x30(%rsp)
movq 0x60(%rsp), %rdx
movl 0x6c(%rsp), %eax
subl 0x3c(%rsp), %eax
movl %eax, %eax
movl %eax, %ecx
shrq %cl, %rdx
andq 0x30(%rsp), %rdx
movq 0x98(%rsp), %rax
movq 0x90(%rsp), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, 0x90(%rsp)
movq %rdx, (%rax,%rcx,8)
movl 0x3c(%rsp), %ecx
movl 0x6c(%rsp), %eax
subl %ecx, %eax
movl %eax, 0x6c(%rsp)
jmp 0x477afb
jmp 0x47796a
addq $0xc8, %rsp
retq
nop