// File: /workspace/github_c_makefile_star2_O2/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, %rbx
leaq 0x20(%rsp), %r14
movq $0x81, (%r14)
pushq $0x1
popq %rdi
pushq $-0x1
popq %r13
xorl %ebp, %ebp
testl %ebp, %ebp
jne 0xe74db
cmpq $0x100, %rdi            # imm = 0x100
ja 0xe74db
movq %rdi, 0x18(%rsp)
callq 0xe6f70
movq %rax, 0x8(%rsp)
movq %rax, %rdi
callq 0xe71b7
movq %rax, %r12
xorl %esi, %esi
xorl %ebp, %ebp
testl %ebp, %ebp
jne 0xe74bc
cmpq $0x80, %rsi
ja 0xe74bc
movq 0x8(%rsp), %rdi
movq %rsi, 0x10(%rsp)
callq 0xe7079
movq %rax, %r15
xorl %ebp, %ebp
xorl %eax, %eax
testl %eax, %eax
jne 0xe74a4
movq %r15, %rdi
callq 0x5e96c
cmpq %rax, %rbp
jae 0xe7435
movq %r15, %rdi
movq %rbp, %rsi
callq 0x5e839
movzbl %al, %esi
movq %r12, %rdi
movq %r14, %rdx
callq 0xe7228
movl %eax, %r13d
xorl %eax, %eax
cmpl $-0x1, %r13d
jne 0xe7430
movq %rbx, %rdi
leaq 0x216fe7(%rip), %rsi    # 0x2fe3f2
leaq 0x23d6f5(%rip), %rdx    # 0x324b07
leaq 0x23af00(%rip), %rcx    # 0x322319
leaq 0x23ae79(%rip), %r8     # 0x322299
movl $0xd4, %r9d
xorl %eax, %eax
callq 0x89dbb
pushq $-0x1
popq %rax
incq %rbp
jmp 0xe73c8
testl %r13d, %r13d
je 0xe7461
movq %rbx, %rdi
leaq 0x216fae(%rip), %rsi    # 0x2fe3f2
leaq 0x23d6aa(%rip), %rdx    # 0x324af5
leaq 0x23aec7(%rip), %rcx    # 0x322319
leaq 0x23ae40(%rip), %r8     # 0x322299
movl $0xd7, %r9d
jmp 0xe749d
xorl %r13d, %r13d
movl $0x0, %ebp
movq 0x10(%rsp), %rax
cmpq %rax, 0x20(%rsp)
je 0xe74a7
xorl %r13d, %r13d
movq %rbx, %rdi
leaq 0x216f70(%rip), %rsi    # 0x2fe3f2
leaq 0x23aea4(%rip), %rdx    # 0x32232d
leaq 0x23ae89(%rip), %rcx    # 0x322319
leaq 0x23ae02(%rip), %r8     # 0x322299
movl $0xd8, %r9d
xorl %eax, %eax
callq 0x89dbb
pushq $-0x1
popq %rbp
movq %r15, %rdi
callq 0x5ecf6
movq 0x10(%rsp), %rsi
incq %rsi
jmp 0xe739d
movq %r12, %rdi
callq 0xe7333
movq 0x8(%rsp), %rdi
callq 0xe7322
movq 0x18(%rsp), %rdi
incq %rdi
jmp 0xe736a
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq