// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/extended/golomb.c
// Function: gt_golomb_unit_test
int gt_golomb_unit_test(GtError *err)
{
  int had_err = 0,
      stat = -1;
  GtGolomb *golomb;
  GtBittab *code = NULL;
  GtGolombBitwiseDecoder *gbwd = NULL;
  GtUword unit_test_x_size = 128UL,
                idx_i,
                idx_j,
                idx_k,
                number = unit_test_x_size + 1,
                unit_test_b_size = 256UL;

  for (idx_j = 1UL; !had_err && idx_j <= unit_test_b_size; idx_j++) {
    golomb = gt_golomb_new(idx_j);
    gbwd = gt_golomb_bitwise_decoder_new(golomb);
    for (idx_k = 0; !had_err && idx_k <= unit_test_x_size; idx_k++) {
      code = gt_golomb_encode(golomb, idx_k);
      for (idx_i = 0 ; !had_err && idx_i < gt_bittab_size(code) ; idx_i++) {
        if (gt_bittab_bit_is_set(code, idx_i))
          stat = gt_golomb_bitwise_decoder_next(gbwd, true, &number);
        else
          stat = gt_golomb_bitwise_decoder_next(gbwd, false, &number);
        gt_ensure(stat != -1);
      }

      gt_ensure(stat == 0);
      gt_ensure(number == idx_k);
      gt_bittab_delete(code);
    }
    gt_golomb_bitwise_decoder_delete(gbwd);
    gt_golomb_delete(golomb);
  }
  return had_err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, 0x8(%rsp)
leaq 0x20(%rsp), %r14
movq $0x81, (%r14)
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
movl $0x1, %eax
movq %rax, 0x18(%rsp)
movq %rax, %rdi
callq 0x14c39c
movq %rax, 0x10(%rsp)
movq %rax, %rdi
callq 0x14c590
movq %rax, %rbp
xorl %r12d, %r12d
movq 0x10(%rsp), %rdi
movq %r12, %rsi
callq 0x14c449
movq %rax, %rbx
movq %rax, %rdi
callq 0xd6f10
testq %rax, %rax
je 0x14c778
xorl %r13d, %r13d
movq %rbx, %rdi
movq %r13, %rsi
callq 0xd6e4a
movzbl %al, %esi
movq %rbp, %rdi
movq %r14, %rdx
callq 0x14c5da
cmpl $-0x1, %eax
je 0x14c7b4
movl %eax, %r15d
incq %r13
movq %rbx, %rdi
callq 0xd6f10
cmpq %rax, %r13
jb 0x14c747
testl %r15d, %r15d
je 0x14c817
xorl %r13d, %r13d
movq 0x8(%rsp), %rdi
leaq 0x211cae(%rip), %rsi    # 0x35e43e
leaq 0x237f56(%rip), %rdx    # 0x3846ed
leaq 0x23576e(%rip), %rcx    # 0x381f0c
leaq 0x2356dc(%rip), %r8     # 0x381e81
movl $0xd7, %r9d
xorl %eax, %eax
callq 0xfcb67
jmp 0x14c7eb
xorl %r13d, %r13d
movq 0x8(%rsp), %rdi
leaq 0x211c7b(%rip), %rsi    # 0x35e43e
leaq 0x235737(%rip), %rdx    # 0x381f01
leaq 0x23573b(%rip), %rcx    # 0x381f0c
leaq 0x2356a9(%rip), %r8     # 0x381e81
movl $0xd4, %r9d
xorl %eax, %eax
callq 0xfcb67
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
movl $0xffffffff, 0x4(%rsp)  # imm = 0xFFFFFFFF
movq %rbx, %rdi
callq 0xd7151
testb %r13b, %r13b
je 0x14c86c
leaq 0x1(%r12), %rax
cmpq $0x80, %r12
movq %rax, %r12
jb 0x14c727
jmp 0x14c86c
cmpq %r12, 0x20(%rsp)
jne 0x14c82e
movb $0x1, %r13b
xorl %r15d, %r15d
movl $0x0, 0x4(%rsp)
jmp 0x14c7f3
xorl %r15d, %r15d
movq 0x8(%rsp), %rdi
leaq 0x211c01(%rip), %rsi    # 0x35e43e
leaq 0x2356dc(%rip), %rdx    # 0x381f20
leaq 0x2356c1(%rip), %rcx    # 0x381f0c
leaq 0x23562f(%rip), %r8     # 0x381e81
movl $0xd8, %r9d
xorl %eax, %eax
callq 0xfcb67
movl $0xffffffff, 0x4(%rsp)  # imm = 0xFFFFFFFF
xorl %r13d, %r13d
jmp 0x14c7f3
movq %rbp, %rdi
leaq 0x23560b(%rip), %rbx    # 0x381e81
movq %rbx, %rsi
movl $0xb9, %edx
callq 0x1045eb
movq 0x10(%rsp), %rdi
movq %rbx, %rsi
movl $0xb4, %edx
callq 0x1045eb
movq 0x18(%rsp), %rax
cmpq $0x100, %rax            # imm = 0x100
leaq 0x1(%rax), %rax
setb %cl
testb %cl, %r13b
jne 0x14c707
movl 0x4(%rsp), %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop