// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/core/bitbuffer.c
// Function: gt_bitbuffer_write_bytestring
GtUword gt_bitbuffer_write_bytestring(GtBitbuffer *bb,
                                       uint8_t *bytestring,
                                       GtUword bytestring_offset,
                                       GT_UNUSED GtUword bytestring_length,
                                       GtUword value,
                                       GtBitcount_type bitsforvalue)
{
  GtBitcount_type bits2store = bitsforvalue;

  gt_assert(bb != NULL && bb->fp == NULL);
  bb->numberofallvalues++;
  SHOWCURRENT;
  while (true)
  {
    gt_assert(bits2store > 0);
    if (bb->remainingbitsinbuffer >= bits2store)
    {
      bb->remainingbitsinbuffer -= bits2store;
      bb->currentbitbuffer |= (uint64_t)
        ((value & ((1UL << bits2store) - 1)) << bb->remainingbitsinbuffer);
      SHOWCURRENT;
      break;
    }
    if (bb->remainingbitsinbuffer == 0) /* buffer full */
    {
      SHOWCURRENT;
      gt_assert(bytestring_offset < bytestring_length &&
                bb->currentbitbuffer <= UINT8_MAX);
      bytestring[bytestring_offset++] = (uint8_t) bb->currentbitbuffer;
      bb->currentbitbuffer = 0;
      bb->remainingbitsinbuffer = bb->bitsinbuffer;
    } else
    {
      gt_assert(bits2store > bb->remainingbitsinbuffer);
      bits2store -= bb->remainingbitsinbuffer;
      bb->currentbitbuffer |= ((uint64_t) value >> bits2store) & UINT8_MAX;
      bb->remainingbitsinbuffer = 0;
      SHOWCURRENT;
    }
  }
  return bytestring_offset;
}

// Assembly:
subq $0x38, %rsp
movw %r9w, %ax
movq %rdi, 0x30(%rsp)
movq %rsi, 0x28(%rsp)
movq %rdx, 0x20(%rsp)
movq %rcx, 0x18(%rsp)
movq %r8, 0x10(%rsp)
movw %ax, 0xe(%rsp)
movw 0xe(%rsp), %ax
movw %ax, 0xc(%rsp)
cmpq $0x0, 0x30(%rsp)
je 0x88d74
movq 0x30(%rsp), %rax
cmpq $0x0, 0x18(%rax)
je 0x88dac
movq 0x5b3225(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x48d28e(%rip), %rsi    # 0x516013
leaq 0x4a8150(%rip), %rdx    # 0x530edc
leaq 0x4a8166(%rip), %rcx    # 0x530ef9
leaq 0x4a8084(%rip), %r8     # 0x530e1e
movl $0x7a, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x88dae
movq 0x30(%rsp), %rax
movq 0x8(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x8(%rax)
jmp 0x88dc1
movzwl 0xc(%rsp), %eax
cmpl $0x0, %eax
jg 0x88e03
movq 0x5b31ce(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x48d237(%rip), %rsi    # 0x516013
leaq 0x4a80c3(%rip), %rdx    # 0x530ea6
leaq 0x4a810f(%rip), %rcx    # 0x530ef9
leaq 0x4a802d(%rip), %r8     # 0x530e1e
movl $0x7f, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x88e05
movq 0x30(%rsp), %rax
movzwl 0x10(%rax), %eax
movzwl 0xc(%rsp), %ecx
cmpl %ecx, %eax
jl 0x88e6a
movzwl 0xc(%rsp), %edx
movq 0x30(%rsp), %rax
movzwl 0x10(%rax), %ecx
subl %edx, %ecx
movw %cx, 0x10(%rax)
movq 0x10(%rsp), %rax
movzwl 0xc(%rsp), %ecx
movl %ecx, %ecx
movl $0x1, %edx
shlq %cl, %rdx
movq %rdx, %rcx
subq $0x1, %rcx
andq %rcx, %rax
movq 0x30(%rsp), %rcx
movzwl 0x10(%rcx), %ecx
movl %ecx, %ecx
shlq %cl, %rax
movq %rax, %rcx
movq 0x30(%rsp), %rax
orq (%rax), %rcx
movq %rcx, (%rax)
jmp 0x88faf
movq 0x30(%rsp), %rax
movzwl 0x10(%rax), %eax
cmpl $0x0, %eax
jne 0x88f18
jmp 0x88e7e
movq 0x20(%rsp), %rax
cmpq 0x18(%rsp), %rax
jae 0x88e98
movq 0x30(%rsp), %rax
cmpq $0xff, (%rax)
jbe 0x88ed0
movq 0x5b3101(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x48d16a(%rip), %rsi    # 0x516013
leaq 0x4a8067(%rip), %rdx    # 0x530f17
leaq 0x4a8042(%rip), %rcx    # 0x530ef9
leaq 0x4a7f60(%rip), %r8     # 0x530e1e
movl $0x8c, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x88ed2
movq 0x30(%rsp), %rax
movq (%rax), %rax
movb %al, %dl
movq 0x28(%rsp), %rax
movq 0x20(%rsp), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, 0x20(%rsp)
movb %dl, (%rax,%rcx)
movq 0x30(%rsp), %rax
movq $0x0, (%rax)
movq 0x30(%rsp), %rax
movw 0x14(%rax), %cx
movq 0x30(%rsp), %rax
movw %cx, 0x10(%rax)
jmp 0x88faa
jmp 0x88f1a
movzwl 0xc(%rsp), %eax
movq 0x30(%rsp), %rcx
movzwl 0x10(%rcx), %ecx
cmpl %ecx, %eax
jg 0x88f64
movq 0x5b306d(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x48d0d6(%rip), %rsi    # 0x516013
leaq 0x4a7f71(%rip), %rdx    # 0x530eb5
leaq 0x4a7fae(%rip), %rcx    # 0x530ef9
leaq 0x4a7ecc(%rip), %r8     # 0x530e1e
movl $0x92, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x88f66
movq 0x30(%rsp), %rax
movzwl 0x10(%rax), %ecx
movzwl 0xc(%rsp), %eax
subl %ecx, %eax
movw %ax, 0xc(%rsp)
movq 0x10(%rsp), %rax
movzwl 0xc(%rsp), %ecx
movl %ecx, %ecx
shrq %cl, %rax
movq %rax, %rcx
andq $0xff, %rcx
movq 0x30(%rsp), %rax
orq (%rax), %rcx
movq %rcx, (%rax)
movq 0x30(%rsp), %rax
movw $0x0, 0x10(%rax)
jmp 0x88dbf
movq 0x20(%rsp), %rax
addq $0x38, %rsp
retq
nopl (%rax)