// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/core/bitpackstringop64.c
// Function: gt_bsGetNonUniformInt64Array
void
gt_bsGetNonUniformInt64Array(
  constBitString str, BitOffset offset, size_t numValues,
  BitOffset numBitsTotal, unsigned numBitsList[], int64_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 = (numBits < 64)
          ? ~((~(GtUint64)0) << numBits) : ~(GtUint64)0;
        int64_t m = (int64_t)1 << (numBits - 1);
        gt_assert(numBits <= sizeof (val[0])*CHAR_BIT);
        val[j++] = ((((accum >> (bitsInAccum - numBits)) & valMask)
                              ^ m) - m);
        bitsInAccum -= numBits;
      }
    }
  }
}

// Assembly:
subq $0xd8, %rsp
movq %rdi, 0xd0(%rsp)
movq %rsi, 0xc8(%rsp)
movq %rdx, 0xc0(%rsp)
movq %rcx, 0xb8(%rsp)
movq %r8, 0xb0(%rsp)
movq %r9, 0xa8(%rsp)
movq $0x0, 0xa0(%rsp)
movq 0xb8(%rsp), %rax
movq %rax, 0x98(%rsp)
movq 0xc8(%rsp), %rax
shrq $0x3, %rax
movq %rax, 0x90(%rsp)
movq 0xc8(%rsp), %rax
andq $0x7, %rax
movl %eax, 0x8c(%rsp)
movl $0x0, 0x88(%rsp)
movq 0xd0(%rsp), %rax
addq 0x90(%rsp), %rax
movq %rax, 0x80(%rsp)
movl $0x0, 0x7c(%rsp)
movq $0x0, 0x70(%rsp)
cmpq $0x0, 0xd0(%rsp)
je 0x477cd4
cmpq $0x0, 0xa8(%rsp)
jne 0x477d0c
movq 0x1c42c5(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x9e32e(%rip), %rsi     # 0x516013
leaq 0x138077(%rip), %rdx    # 0x5afd63
leaq 0x138384(%rip), %rcx    # 0x5b0077
leaq 0x138316(%rip), %r8     # 0x5b0010
movl $0x12e, %r9d            # imm = 0x12E
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x477d0e
cmpq $0x0, 0x98(%rsp)
jne 0x477d1e
jmp 0x4780de
cmpl $0x0, 0x8c(%rsp)
je 0x477df3
movl $0x8, %eax
subl 0x8c(%rsp), %eax
movl %eax, %eax
cmpq 0x98(%rsp), %rax
jae 0x477d59
movl $0x8, %eax
subl 0x8c(%rsp), %eax
movl %eax, %eax
movq %rax, 0x30(%rsp)
jmp 0x477d66
movq 0x98(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x30(%rsp), %rax
movl %eax, 0x64(%rsp)
movl $0x8, %eax
subl 0x8c(%rsp), %eax
subl 0x64(%rsp), %eax
movl %eax, 0x60(%rsp)
movl 0x64(%rsp), %eax
movl %eax, %ecx
movq $-0x1, %rax
shlq %cl, %rax
xorq $-0x1, %rax
movl 0x60(%rsp), %ecx
shlq %cl, %rax
movq %rax, 0x68(%rsp)
movq 0x80(%rsp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, 0x80(%rsp)
movzbl (%rax), %eax
andq 0x68(%rsp), %rax
movl 0x60(%rsp), %ecx
shrq %cl, %rax
movq %rax, 0x70(%rsp)
movl 0x64(%rsp), %eax
addl 0x7c(%rsp), %eax
movl %eax, 0x7c(%rsp)
movl 0x64(%rsp), %eax
movl %eax, %ecx
movq 0x98(%rsp), %rax
subq %rcx, %rax
movq %rax, 0x98(%rsp)
jmp 0x477df5
movq 0xa0(%rsp), %rax
cmpq 0xc0(%rsp), %rax
jae 0x4780de
jmp 0x477e0d
movl 0x7c(%rsp), %ecx
movq 0xb0(%rsp), %rdx
movq 0xa0(%rsp), %rsi
xorl %eax, %eax
cmpl (%rdx,%rsi,4), %ecx
movb %al, 0x2f(%rsp)
jae 0x477e3c
cmpq $0x0, 0x98(%rsp)
setne %al
movb %al, 0x2f(%rsp)
movb 0x2f(%rsp), %al
testb $0x1, %al
jne 0x477e49
jmp 0x477fa2
movl 0x7c(%rsp), %eax
movl %eax, %ecx
movl $0x40, %eax
subq %rcx, %rax
movl %eax, 0x58(%rsp)
movl 0x58(%rsp), %eax
movl $0x8, %ecx
subl 0x88(%rsp), %ecx
cmpl %ecx, %eax
jae 0x477ea1
movl 0x58(%rsp), %eax
cmpq 0x98(%rsp), %rax
jae 0x477e88
movl 0x58(%rsp), %eax
movq %rax, 0x20(%rsp)
jmp 0x477e95
movq 0x98(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rax
movq %rax, 0x18(%rsp)
jmp 0x477ee5
movl $0x8, %eax
subl 0x88(%rsp), %eax
movl %eax, %eax
cmpq 0x98(%rsp), %rax
jae 0x477ece
movl $0x8, %eax
subl 0x88(%rsp), %eax
movl %eax, %eax
movq %rax, 0x10(%rsp)
jmp 0x477edb
movq 0x98(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rax
movl %eax, 0x5c(%rsp)
movl 0x5c(%rsp), %eax
movl %eax, %ecx
movq $-0x1, %rax
shlq %cl, %rax
xorq $-0x1, %rax
movq %rax, 0x50(%rsp)
movq 0x70(%rsp), %rax
movl 0x5c(%rsp), %ecx
shlq %cl, %rax
movq 0x80(%rsp), %rcx
movzbl (%rcx), %edx
movl $0x8, %ecx
subl 0x5c(%rsp), %ecx
subl 0x88(%rsp), %ecx
sarl %cl, %edx
movl %edx, %ecx
movslq %ecx, %rcx
andq 0x50(%rsp), %rcx
orq %rcx, %rax
movq %rax, 0x70(%rsp)
movl 0x5c(%rsp), %eax
addl 0x7c(%rsp), %eax
movl %eax, 0x7c(%rsp)
movl 0x5c(%rsp), %eax
movl %eax, %ecx
movq 0x98(%rsp), %rax
subq %rcx, %rax
movq %rax, 0x98(%rsp)
movl 0x5c(%rsp), %eax
addl 0x88(%rsp), %eax
movl %eax, 0x88(%rsp)
cmpl $0x8, %eax
jne 0x477f9d
movq 0x80(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x80(%rsp)
movl $0x0, 0x88(%rsp)
jmp 0x477e0d
jmp 0x477fa4
movq 0xa0(%rsp), %rcx
xorl %eax, %eax
cmpq 0xc0(%rsp), %rcx
movb %al, 0xf(%rsp)
jae 0x477fe0
movl 0x7c(%rsp), %eax
movq 0xb0(%rsp), %rcx
movq 0xa0(%rsp), %rdx
movl (%rcx,%rdx,4), %ecx
movl %ecx, 0x4c(%rsp)
cmpl %ecx, %eax
setae %al
movb %al, 0xf(%rsp)
movb 0xf(%rsp), %al
testb $0x1, %al
jne 0x477fed
jmp 0x4780d9
cmpl $0x40, 0x4c(%rsp)
jae 0x47800e
movl 0x4c(%rsp), %eax
movl %eax, %ecx
movq $-0x1, %rax
shlq %cl, %rax
xorq $-0x1, %rax
movq %rax, (%rsp)
jmp 0x47801b
movq $-0x1, %rax
movq %rax, (%rsp)
jmp 0x47801b
movq (%rsp), %rax
movq %rax, 0x40(%rsp)
movl 0x4c(%rsp), %eax
subl $0x1, %eax
movl %eax, %eax
movl %eax, %ecx
movl $0x1, %eax
shlq %cl, %rax
movq %rax, 0x38(%rsp)
movl 0x4c(%rsp), %eax
cmpq $0x40, %rax
jbe 0x47807e
movq 0x1c3f53(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x9dfbc(%rip), %rsi     # 0x516013
leaq 0x137d2b(%rip), %rdx    # 0x5afd89
leaq 0x138012(%rip), %rcx    # 0x5b0077
leaq 0x137fa4(%rip), %r8     # 0x5b0010
movl $0x159, %r9d            # imm = 0x159
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x478080
movq 0x70(%rsp), %rdx
movl 0x7c(%rsp), %eax
subl 0x4c(%rsp), %eax
movl %eax, %eax
movl %eax, %ecx
shrq %cl, %rdx
andq 0x40(%rsp), %rdx
xorq 0x38(%rsp), %rdx
subq 0x38(%rsp), %rdx
movq 0xa8(%rsp), %rax
movq 0xa0(%rsp), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, 0xa0(%rsp)
movq %rdx, (%rax,%rcx,8)
movl 0x4c(%rsp), %ecx
movl 0x7c(%rsp), %eax
subl %ecx, %eax
movl %eax, 0x7c(%rsp)
jmp 0x477fa4
jmp 0x477df5
addq $0xd8, %rsp
retq
nopw %cs:(%rax,%rax)