// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/core/bitpackstringop32.c
// Function: gt_bsGetUInt32
uint32_t
gt_bsGetUInt32(constBitString str, BitOffset offset, unsigned numBits)
{
  GtUword accum = 0;
  unsigned bitsLeft = numBits, bitTop = offset%bitElemBits;
  size_t elemStart = offset/bitElemBits;
  const BitElem *p = str + elemStart;
  gt_assert(str);
#ifndef NDEBUG
  if (numBits > sizeof (accum)*CHAR_BIT)
    fprintf(stderr, "numBits = %u\n", numBits);
#endif
  gt_assert(numBits <= sizeof (accum)*CHAR_BIT);
  if (bitTop)
  {
    GtUword mask;
    unsigned bits2Read = GT_MIN(bitElemBits - bitTop, bitsLeft);
    unsigned unreadRightBits = (bitElemBits - bitTop - bits2Read);
    mask = (~((~(GtUword)0) << bits2Read)) << unreadRightBits;
    accum = ((*p++) & mask) >> unreadRightBits;
    bitsLeft -= bits2Read;
  }
  /* get bits from intervening elems */
  while (bitsLeft >= bitElemBits)
  {
    accum = accum << bitElemBits | (*p++);
    bitsLeft -= bitElemBits;
  }
  /* get bits from last elem */
  if (bitsLeft)
  {
    accum = accum << bitsLeft |
      (((*p) & ((~(GtUword)0)<<(bitElemBits - bitsLeft)))
       >>(bitElemBits - bitsLeft));
  }
  return accum;
}

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x50(%rsp)
movq %rsi, 0x48(%rsp)
movl %edx, 0x44(%rsp)
movq $0x0, 0x38(%rsp)
movl 0x44(%rsp), %eax
movl %eax, 0x34(%rsp)
movq 0x48(%rsp), %rax
andq $0x7, %rax
movl %eax, 0x30(%rsp)
movq 0x48(%rsp), %rax
shrq $0x3, %rax
movq %rax, 0x28(%rsp)
movq 0x50(%rsp), %rax
addq 0x28(%rsp), %rax
movq %rax, 0x20(%rsp)
cmpq $0x0, 0x50(%rsp)
jne 0x156c1d
movq 0x5d3ec(%rip), %rax     # 0x1b3fd8
movq (%rax), %rdi
leaq 0x7470(%rip), %rsi      # 0x15e066
leaq 0x9dd7(%rip), %rdx      # 0x1609d4
leaq 0x38254(%rip), %rcx     # 0x18ee58
leaq 0x3825c(%rip), %r8      # 0x18ee67
movl $0x22, %r9d
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x156c1f
movl 0x44(%rsp), %eax
cmpq $0x40, %rax
jbe 0x156c45
movq 0x5d3a8(%rip), %rax     # 0x1b3fd8
movq (%rax), %rdi
movl 0x44(%rsp), %edx
leaq 0x38246(%rip), %rsi     # 0x18ee84
movb $0x0, %al
callq 0xb890
jmp 0x156c47
movl 0x44(%rsp), %eax
cmpq $0x40, %rax
jbe 0x156c89
movq 0x5d380(%rip), %rax     # 0x1b3fd8
movq (%rax), %rdi
leaq 0x7404(%rip), %rsi      # 0x15e066
leaq 0x38229(%rip), %rdx     # 0x18ee92
leaq 0x381e8(%rip), %rcx     # 0x18ee58
leaq 0x381f0(%rip), %r8      # 0x18ee67
movl $0x27, %r9d
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x156c8b
cmpl $0x0, 0x30(%rsp)
je 0x156d28
movl $0x8, %eax
subl 0x30(%rsp), %eax
cmpl 0x34(%rsp), %eax
jae 0x156cb4
movl $0x8, %eax
subl 0x30(%rsp), %eax
movl %eax, 0xc(%rsp)
jmp 0x156cbc
movl 0x34(%rsp), %eax
movl %eax, 0xc(%rsp)
movl 0xc(%rsp), %eax
movl %eax, 0x14(%rsp)
movl $0x8, %eax
subl 0x30(%rsp), %eax
subl 0x14(%rsp), %eax
movl %eax, 0x10(%rsp)
movl 0x14(%rsp), %eax
movl %eax, %ecx
movq $-0x1, %rax
shlq %cl, %rax
xorq $-0x1, %rax
movl 0x10(%rsp), %ecx
shlq %cl, %rax
movq %rax, 0x18(%rsp)
movq 0x20(%rsp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, 0x20(%rsp)
movzbl (%rax), %eax
andq 0x18(%rsp), %rax
movl 0x10(%rsp), %ecx
shrq %cl, %rax
movq %rax, 0x38(%rsp)
movl 0x14(%rsp), %ecx
movl 0x34(%rsp), %eax
subl %ecx, %eax
movl %eax, 0x34(%rsp)
jmp 0x156d2a
cmpl $0x8, 0x34(%rsp)
jb 0x156d63
movq 0x38(%rsp), %rax
shlq $0x8, %rax
movq 0x20(%rsp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, 0x20(%rsp)
movzbl (%rcx), %ecx
orq %rcx, %rax
movq %rax, 0x38(%rsp)
movl 0x34(%rsp), %eax
subl $0x8, %eax
movl %eax, 0x34(%rsp)
jmp 0x156d2a
cmpl $0x0, 0x34(%rsp)
je 0x156db4
movq 0x38(%rsp), %rax
movl 0x34(%rsp), %ecx
shlq %cl, %rax
movq 0x20(%rsp), %rcx
movzbl (%rcx), %ecx
movl %ecx, %edx
movl $0x8, %ecx
subl 0x34(%rsp), %ecx
movl %ecx, %ecx
movq $-0x1, %rsi
shlq %cl, %rsi
movq %rsi, %rcx
andq %rcx, %rdx
movl $0x8, %ecx
subl 0x34(%rsp), %ecx
movl %ecx, %ecx
shrq %cl, %rdx
movq %rdx, %rcx
orq %rcx, %rax
movq %rax, 0x38(%rsp)
movq 0x38(%rsp), %rax
addq $0x58, %rsp
retq
nop