// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/core/bitbuffer.c
// Function: gt_bitbuffer_read_bytestring
GtUword gt_bitbuffer_read_bytestring(GtBitbuffer *bb,
                                      GtUword *value,
                                      const uint8_t *bytestring,
                                      GtUword bytestring_offset,
                                      GtBitcount_type bitsforvalue)
{
  unsigned int bits2read = bitsforvalue;

  gt_assert(bb != NULL && bb->fp == NULL && bytestring != NULL);
  while (true)
  {
    if (bb->remainingbitsinbuffer == 0)
    {
      bb->readvalue = bytestring[bytestring_offset++];
      bb->remainingbitsinbuffer = bb->bitsinbuffer;
    }
    if (bb->remainingbitsinbuffer >= bits2read)
    {
      bb->remainingbitsinbuffer -= bits2read;
      if (bits2read < bb->bitsinbuffer)
      {
        bb->currentbitbuffer
          |= (uint64_t) (bb->readvalue >> bb->remainingbitsinbuffer) &
             ((((uint64_t) 1) << bits2read) - 1);
        gt_assert(bb->currentbitbuffer < (1UL << bitsforvalue));
      } else
      {
        bb->currentbitbuffer |= bb->readvalue;
      }
      *value = (GtUword) bb->currentbitbuffer;
      bb->currentbitbuffer = 0;
      break;
    } else
    {
      bits2read -= bb->remainingbitsinbuffer;
      bb->currentbitbuffer
        |= ((((uint64_t) bb->readvalue) &
            ((((uint64_t) 1) << bb->remainingbitsinbuffer) - 1))
           << bits2read);
      bb->remainingbitsinbuffer = 0;
    }
  }
  return bytestring_offset;
}

// Assembly:
subq $0x38, %rsp
movw %r8w, %ax
movq %rdi, 0x30(%rsp)
movq %rsi, 0x28(%rsp)
movq %rdx, 0x20(%rsp)
movq %rcx, 0x18(%rsp)
movw %ax, 0x16(%rsp)
movzwl 0x16(%rsp), %eax
movl %eax, 0x10(%rsp)
cmpq $0x0, 0x30(%rsp)
je 0x89686
movq 0x30(%rsp), %rax
cmpq $0x0, 0x18(%rax)
jne 0x89686
cmpq $0x0, 0x20(%rsp)
jne 0x896be
movq 0x5b2913(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x48c97c(%rip), %rsi    # 0x516013
leaq 0x4a7a67(%rip), %rdx    # 0x531105
leaq 0x4a7a93(%rip), %rcx    # 0x531138
leaq 0x4a7772(%rip), %r8     # 0x530e1e
movl $0x11a, %r9d            # imm = 0x11A
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x896c0
jmp 0x896c2
movq 0x30(%rsp), %rax
movzwl 0x10(%rax), %eax
cmpl $0x0, %eax
jne 0x89703
movq 0x20(%rsp), %rax
movq 0x18(%rsp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, 0x18(%rsp)
movb (%rax,%rcx), %cl
movq 0x30(%rsp), %rax
movb %cl, 0x16(%rax)
movq 0x30(%rsp), %rax
movw 0x14(%rax), %cx
movq 0x30(%rsp), %rax
movw %cx, 0x10(%rax)
movq 0x30(%rsp), %rax
movzwl 0x10(%rax), %eax
cmpl 0x10(%rsp), %eax
jb 0x8980d
movl 0x10(%rsp), %edx
movq 0x30(%rsp), %rax
movzwl 0x10(%rax), %ecx
subl %edx, %ecx
movw %cx, 0x10(%rax)
movl 0x10(%rsp), %eax
movq 0x30(%rsp), %rcx
movzwl 0x14(%rcx), %ecx
cmpl %ecx, %eax
jae 0x897d9
movq 0x30(%rsp), %rax
movzbl 0x16(%rax), %eax
movq 0x30(%rsp), %rcx
movzwl 0x10(%rcx), %ecx
sarl %cl, %eax
cltq
movq %rax, 0x8(%rsp)
movl 0x10(%rsp), %eax
movl %eax, %ecx
movl $0x1, %eax
shlq %cl, %rax
movq 0x8(%rsp), %rcx
subq $0x1, %rax
andq %rax, %rcx
movq 0x30(%rsp), %rax
orq (%rax), %rcx
movq %rcx, (%rax)
movq 0x30(%rsp), %rax
movq (%rax), %rax
movzwl 0x16(%rsp), %ecx
movl %ecx, %ecx
movl $0x1, %edx
shlq %cl, %rdx
movq %rdx, %rcx
cmpq %rcx, %rax
jb 0x897d5
movq 0x5b27fc(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x48c865(%rip), %rsi    # 0x516013
leaq 0x4a79a0(%rip), %rdx    # 0x531155
leaq 0x4a797c(%rip), %rcx    # 0x531138
leaq 0x4a765b(%rip), %r8     # 0x530e1e
movl $0x12a, %r9d            # imm = 0x12A
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x897d7
jmp 0x897ef
movq 0x30(%rsp), %rax
movzbl 0x16(%rax), %eax
movl %eax, %ecx
movq 0x30(%rsp), %rax
orq (%rax), %rcx
movq %rcx, (%rax)
movq 0x30(%rsp), %rax
movq (%rax), %rcx
movq 0x28(%rsp), %rax
movq %rcx, (%rax)
movq 0x30(%rsp), %rax
movq $0x0, (%rax)
jmp 0x8986b
movq 0x30(%rsp), %rax
movzwl 0x10(%rax), %ecx
movl 0x10(%rsp), %eax
subl %ecx, %eax
movl %eax, 0x10(%rsp)
movq 0x30(%rsp), %rax
movzbl 0x16(%rax), %eax
movq 0x30(%rsp), %rcx
movzwl 0x10(%rcx), %ecx
movl %ecx, %ecx
movl $0x1, %edx
shlq %cl, %rdx
movq %rdx, %rcx
subq $0x1, %rcx
andq %rcx, %rax
movl 0x10(%rsp), %ecx
shlq %cl, %rax
movq %rax, %rcx
movq 0x30(%rsp), %rax
orq (%rax), %rcx
movq %rcx, (%rax)
movq 0x30(%rsp), %rax
movw $0x0, 0x10(%rax)
jmp 0x896c2
movq 0x18(%rsp), %rax
addq $0x38, %rsp
retq
nopw %cs:(%rax,%rax)