// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/core/bitpackstringop.c
// Function: gt_bsClear
void
gt_bsClear(BitString str, BitOffset offset, BitOffset numBits, int bitVal)
{
  unsigned bitsLeft = numBits,
    bitTop = offset%bitElemBits;
  size_t elemStart = offset/bitElemBits;
  BitElem *p = str + elemStart;
  GtUword bitPatSource = 0UL;
  gt_assert(str);
  if (bitVal)
    bitPatSource = ~0UL;
  if (bitTop)
  {
    GtUword mask = ~0UL;
    if (bitElemBits < (sizeof (GtUword)*CHAR_BIT))
    {
      mask <<= bitElemBits;
    }
    else
    {
      mask = 0;
    }
    mask = (~mask) >> bitTop;
    if (numBits < bitElemBits - bitTop)
    {
      unsigned backShift = bitElemBits - numBits - bitTop;
      mask &= ~0UL << backShift;
      *p = (*p & ~mask) | (bitPatSource & mask);
      return;
    }
    else
    {
      bitsLeft -= bitElemBits - bitTop;
      *p = (*p & ~mask) | (bitPatSource & mask);
      ++p;
    }
  }
  {
    size_t fullElems = bitsLeft / bitElemBits;
    memset(p, bitPatSource, sizeof (BitElem) * fullElems);
    p += fullElems;
    bitsLeft -= fullElems * bitElemBits;
  }
  if (bitsLeft)
  {
    GtUword mask = ((~0UL)<<(bitElemBits - bitsLeft));
    if (bitElemBits < (sizeof (GtUword)*CHAR_BIT))
      mask &= (~(~0UL<<bitElemBits));
    *p = (*p & ~mask) | (bitPatSource & mask);
  }
}

// Assembly:
subq $0x68, %rsp
movq %rdi, 0x60(%rsp)
movq %rsi, 0x58(%rsp)
movq %rdx, 0x50(%rsp)
movl %ecx, 0x4c(%rsp)
movq 0x50(%rsp), %rax
movl %eax, 0x48(%rsp)
movq 0x58(%rsp), %rax
andq $0x7, %rax
movl %eax, 0x44(%rsp)
movq 0x58(%rsp), %rax
shrq $0x3, %rax
movq %rax, 0x38(%rsp)
movq 0x60(%rsp), %rax
addq 0x38(%rsp), %rax
movq %rax, 0x30(%rsp)
movq $0x0, 0x28(%rsp)
cmpq $0x0, 0x60(%rsp)
jne 0x4705f3
movq 0x1cb9de(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0xa5a47(%rip), %rsi     # 0x516013
leaq 0xd3a8a(%rip), %rdx     # 0x54405d
leaq 0x13f6d4(%rip), %rcx    # 0x5afcae
leaq 0x13f69c(%rip), %r8     # 0x5afc7d
movl $0x190, %r9d            # imm = 0x190
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x4705f5
cmpl $0x0, 0x4c(%rsp)
je 0x470605
movq $-0x1, 0x28(%rsp)
cmpl $0x0, 0x44(%rsp)
je 0x4706fc
movq $-0x1, 0x20(%rsp)
movq 0x20(%rsp), %rax
shlq $0x8, %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rax
xorq $-0x1, %rax
movl 0x44(%rsp), %ecx
shrq %cl, %rax
movq %rax, 0x20(%rsp)
movq 0x50(%rsp), %rax
movl $0x8, %ecx
subl 0x44(%rsp), %ecx
movl %ecx, %ecx
cmpq %rcx, %rax
jae 0x4706af
movl $0x8, %eax
subq 0x50(%rsp), %rax
movl 0x44(%rsp), %ecx
subq %rcx, %rax
movl %eax, 0x1c(%rsp)
movl 0x1c(%rsp), %eax
movl %eax, %ecx
movq $-0x1, %rax
shlq %cl, %rax
andq 0x20(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x30(%rsp), %rax
movzbl (%rax), %eax
movq 0x20(%rsp), %rcx
xorq $-0x1, %rcx
andq %rcx, %rax
movq 0x28(%rsp), %rcx
andq 0x20(%rsp), %rcx
orq %rcx, %rax
movb %al, %cl
movq 0x30(%rsp), %rax
movb %cl, (%rax)
jmp 0x4707a5
movl $0x8, %ecx
subl 0x44(%rsp), %ecx
movl 0x48(%rsp), %eax
subl %ecx, %eax
movl %eax, 0x48(%rsp)
movq 0x30(%rsp), %rax
movzbl (%rax), %eax
movq 0x20(%rsp), %rcx
xorq $-0x1, %rcx
andq %rcx, %rax
movq 0x28(%rsp), %rcx
andq 0x20(%rsp), %rcx
orq %rcx, %rax
movb %al, %cl
movq 0x30(%rsp), %rax
movb %cl, (%rax)
movq 0x30(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x30(%rsp)
jmp 0x4706fc
movl 0x48(%rsp), %eax
shrl $0x3, %eax
movl %eax, %eax
movq %rax, 0x10(%rsp)
movq 0x30(%rsp), %rdi
movq 0x28(%rsp), %rax
movq 0x10(%rsp), %rdx
shlq $0x0, %rdx
movzbl %al, %esi
callq 0x19360
movq 0x10(%rsp), %rax
addq 0x30(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x10(%rsp), %rcx
shlq $0x3, %rcx
movl 0x48(%rsp), %eax
subq %rcx, %rax
movl %eax, 0x48(%rsp)
cmpl $0x0, 0x48(%rsp)
je 0x4707a5
movl $0x8, %eax
subl 0x48(%rsp), %eax
movl %eax, %eax
movl %eax, %ecx
movq $-0x1, %rax
shlq %cl, %rax
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rax
andq $0xff, %rax
movq %rax, 0x8(%rsp)
movq 0x30(%rsp), %rax
movzbl (%rax), %eax
movq 0x8(%rsp), %rcx
xorq $-0x1, %rcx
andq %rcx, %rax
movq 0x28(%rsp), %rcx
andq 0x8(%rsp), %rcx
orq %rcx, %rax
movb %al, %cl
movq 0x30(%rsp), %rax
movb %cl, (%rax)
addq $0x68, %rsp
retq
nopw (%rax,%rax)