// File: /workspace/github_c_makefile_star2_O1/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, (%rsp)
leaq 0x10(%rsp), %rax
movq $0x81, (%rax)
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl $0x1, %eax
xorl %r12d, %r12d
movq %rax, 0x18(%rsp)
movq %rax, %rdi
callq 0x15397c
movq %rax, 0x8(%rsp)
movq %rax, %rdi
callq 0x153b6b
movq %rax, %r15
xorl %esi, %esi
movq 0x8(%rsp), %rdi
movq %rsi, 0x20(%rsp)
callq 0x153a29
movq %rax, %rbx
movq %rax, %rdi
callq 0xd9585
testq %rax, %rax
je 0x153d94
xorl %r14d, %r14d
movq %rbx, %rdi
movq %r14, %rsi
callq 0xd94c7
movzbl %al, %esi
movq %r15, %rdi
leaq 0x10(%rsp), %rdx
callq 0x153bb5
movl %eax, %ebp
xorl %r12d, %r12d
cmpl $-0x1, %eax
sete %r13b
jne 0x153d7d
movq (%rsp), %rdi
leaq 0x2137e5(%rip), %rsi    # 0x36753a
leaq 0x239d63(%rip), %rdx    # 0x38dabf
leaq 0x23755c(%rip), %rcx    # 0x38b2bf
leaq 0x2374d5(%rip), %r8     # 0x38b23f
movl $0xd4, %r9d
xorl %eax, %eax
callq 0x1019cf
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
cmpl $-0x1, %ebp
je 0x153d97
incq %r14
movq %rbx, %rdi
callq 0xd9585
cmpq %rax, %r14
jb 0x153d21
jmp 0x153d97
xorl %r13d, %r13d
testl %ebp, %ebp
sete %al
orb %r13b, %al
jne 0x153dd4
movq (%rsp), %rdi
leaq 0x21378e(%rip), %rsi    # 0x36753a
leaq 0x239cfa(%rip), %rdx    # 0x38daad
leaq 0x237505(%rip), %rcx    # 0x38b2bf
leaq 0x23747e(%rip), %r8     # 0x38b23f
movl $0xd7, %r9d
xorl %eax, %eax
callq 0x1019cf
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
movl %r12d, %eax
xorl %r12d, %r12d
testl %eax, %eax
movq 0x20(%rsp), %r13
je 0x153de8
xorl %r14d, %r14d
jmp 0x153e22
movb $0x1, %r14b
cmpq %r13, 0x10(%rsp)
je 0x153e28
xorl %r14d, %r14d
movq (%rsp), %rdi
leaq 0x21373a(%rip), %rsi    # 0x36753a
leaq 0x2374cc(%rip), %rdx    # 0x38b2d3
leaq 0x2374b1(%rip), %rcx    # 0x38b2bf
leaq 0x23742a(%rip), %r8     # 0x38b23f
movl $0xd8, %r9d
xorl %eax, %eax
callq 0x1019cf
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
movq %rbx, %rdi
callq 0xd97e0
testb %r14b, %r14b
je 0x153e46
leaq 0x1(%r13), %rsi
cmpq $0x80, %r13
jb 0x153cff
movq %r15, %rdi
leaq 0x2373ef(%rip), %rbx    # 0x38b23f
movq %rbx, %rsi
movl $0xb9, %edx
callq 0x109670
movq 0x8(%rsp), %rdi
movq %rbx, %rsi
movl $0xb4, %edx
callq 0x109670
movq 0x18(%rsp), %rax
cmpq $0x100, %rax            # imm = 0x100
leaq 0x1(%rax), %rax
setb %cl
testb %cl, %r14b
jne 0x153ce0
movl %r12d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq