// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/core/bitpackstringop.c
// Function: gt_bsPrint
int gt_bsPrint(FILE *fp, constBitString str, BitOffset offset,
               BitOffset numBits)
{
  uint32_t accum = 0;
  unsigned bitsLeft = numBits, bitTop = offset%bitElemBits, bitsInAccum = 0;
  size_t elemStart = offset/bitElemBits;
  const BitElem *p = str + elemStart;
  char buf[sizeof (accum) * CHAR_BIT];
  int ioGtError = 0;
  gt_assert(str);
  do {
    if (bitTop)
    {
      uint32_t mask;
      unsigned bits2Read = GT_MIN(bitElemBits - bitTop, bitsLeft);
      unsigned unreadRightBits = (bitElemBits - bitTop - bits2Read);
      mask = (~((~(uint32_t)0) << bits2Read)) << unreadRightBits;
      ACCUM2FP(((*p++) & mask) >> unreadRightBits, bits2Read);
      bitsLeft -= bits2Read;
    }
    /* get bits from intervening elems */
    while (bitsLeft >= bitElemBits && !ioGtError)
    {
      while (bitsLeft >= bitElemBits
             && sizeof (accum) * CHAR_BIT - bitElemBits >= bitsInAccum)
      {
        accum = accum << bitElemBits | (*p++);
        bitsLeft -= bitElemBits;
        bitsInAccum += bitElemBits;
      }
      ACCUM2FP(accum, bitsInAccum);
      accum = 0; bitsInAccum = 0;
    }
    if (ioGtError)
      break;
    /* get bits from last elem */
    if (bitsLeft)
    {
      accum = ((*p) & ((~(uint32_t)0)<<(bitElemBits - bitsLeft)))
        >> (bitElemBits - bitsLeft);
      ACCUM2FP(accum, bitsLeft);
    }
  } while (0);
  return ioGtError?-1:0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
testq %rsi, %rsi
je 0x28b3d7
movq %rcx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movl %edx, %ecx
andl $0x7, %ecx
shrq $0x3, %rdx
addq %rdx, %r15
pushq $-0x1
popq %rbp
testl %ecx, %ecx
je 0x28b343
pushq $0x8
popq %rax
subl %ecx, %eax
cmpl %r14d, %eax
movl %r14d, %r12d
cmovbl %eax, %r12d
movl %ebp, %edx
movl %r12d, %ecx
shll %cl, %edx
subl %r12d, %eax
notl %edx
movzbl (%r15), %esi
movl %eax, %ecx
shrl %cl, %esi
andl %edx, %esi
movq %rsp, %r13
movq %r13, %rdi
movl %r12d, %edx
callq 0x28b40f
movq %r13, %rdi
movq %rbx, %rsi
callq 0x17870
cmpl $-0x1, %eax
je 0x28b3c6
incq %r15
subl %r12d, %r14d
movq %rsp, %r12
cmpl $0x8, %r14d
jb 0x28b38a
xorl %edx, %edx
xorl %esi, %esi
cmpl $0x8, %r14d
jb 0x28b370
cmpl $0x18, %edx
ja 0x28b370
shll $0x8, %esi
movzbl (%r15), %eax
incq %r15
orl %eax, %esi
addl $-0x8, %r14d
addl $0x8, %edx
jmp 0x28b350
movq %r12, %rdi
callq 0x28b40f
movq %r12, %rdi
movq %rbx, %rsi
callq 0x17870
cmpl $-0x1, %eax
jne 0x28b346
jmp 0x28b3c6
testl %r14d, %r14d
je 0x28b3c4
movzbl (%r15), %esi
movb $0x8, %cl
subb %r14b, %cl
shrl %cl, %esi
shll %cl, %esi
shrl %cl, %esi
movq %rsp, %r15
movq %r15, %rdi
movl %r14d, %edx
callq 0x28b40f
movq %r15, %rdi
movq %rbx, %rsi
callq 0x17870
xorl %ebp, %ebp
cmpl $-0x1, %eax
sete %bpl
negl %ebp
jmp 0x28b3c6
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x1acb8a(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x59c2b(%rip), %rsi     # 0x2e5013
leaq 0x86c35(%rip), %rdx     # 0x312024
leaq 0xef8e3(%rip), %rcx     # 0x37acd9
leaq 0xef890(%rip), %r8      # 0x37ac8d
movl $0x203, %r9d            # imm = 0x203
xorl %eax, %eax
callq 0x17a50
callq 0x17390