// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/extended/popcount_tab.c
// Function: gt_popcount_tab_unit_test
int gt_popcount_tab_unit_test(GtError *err)
{
  int had_err = 0;
  GtUword idx, jdx, popc_perm, init, offset,
                blockmask = gt_popcount_tab_perm_start(16U);
  unsigned int popcount_c, class_size;
  const unsigned int blocksize = 4U;
  const GtUword blocksize_four[] =
    {0, 1UL, 2UL, 4UL, 8UL, 3UL, 5UL, 6UL,
     9UL, 10UL, 12UL, 7UL, 11UL, 13UL, 14UL, 15UL};
  const unsigned int offsets_bits[] = {1U, 3U, 3U, 3U, 1U};
  GtPopcountTab *popcount_t = gt_popcount_tab_new((unsigned) blocksize);

  gt_error_check(err);

  for (idx = 0; !had_err && idx <= (GtUword) blocksize; idx++) {
    gt_ensure(
              gt_popcount_tab_offset_bits(popcount_t, (unsigned int) idx) ==
                offsets_bits[idx]);
  }

  for (idx = 0; !had_err && idx < (1UL << blocksize); idx++) {
    gt_ensure(blocksize_four[idx] ==
              gt_compact_ulong_store_get(popcount_t->blocks, idx));
  }
  for (popcount_c = 0, idx = 0;
       !had_err && popcount_c <= blocksize;
       idx += class_size,
       popcount_c++) {
    class_size = (unsigned int)
      gt_combinatorics_binomial_ln((GtUword) blocksize,
                                   (GtUword) popcount_c);
    for (jdx = 0;
         !had_err && jdx < (GtUword) class_size;
         jdx++) {
      gt_ensure(idx ==
                gt_compact_ulong_store_get(popcount_t->offsets,
                                           (GtUword) popcount_c));
      gt_ensure(
                blocksize_four[idx + jdx] ==
                          (GtUword) gt_popcount_tab_get(popcount_t,
                                                              popcount_c, jdx));
    }
  }
  gt_ensure(gt_popcount_tab_rank_1(popcount_t, 2U, 0UL, 1U) == 0U);
  gt_ensure(gt_popcount_tab_rank_0(popcount_t, 2U, 0UL, 1U) == 2U);
  gt_ensure(gt_popcount_tab_rank_1(popcount_t, 2U, 1UL, 0U) == 0U);
  gt_ensure(gt_popcount_tab_rank_0(popcount_t, 2U, 1UL, 0U) == 1U);
  gt_ensure(gt_popcount_tab_rank_1(popcount_t, 2U, 1UL, 1U) == 1U);
  gt_ensure(gt_popcount_tab_rank_0(popcount_t, 2U, 1UL, 1U) == 1U);
  gt_ensure(gt_popcount_tab_rank_1(popcount_t, 2U, 1UL, 2U) == 1U);
  gt_ensure(gt_popcount_tab_rank_0(popcount_t, 2U, 1UL, 2U) == 2U);
  gt_ensure(gt_popcount_tab_rank_1(popcount_t, 4U, 0UL, 1U) == 2U);

  for (idx = 0; !had_err && idx < (1UL << blocksize); idx++) {
    popcount_c = gt_popcount_tab_class(popcount_t, idx);
    offset = gt_popcount_tab_get_offset_for_block(popcount_t, idx);

    for (jdx = 0; !had_err && jdx < (GtUword) blocksize; jdx++) {
      gt_ensure(
                gt_popcount_tab_rank_1(popcount_t, popcount_c,
                                       offset, (unsigned int) jdx) +
                  gt_popcount_tab_rank_0(popcount_t, popcount_c,
                                         offset, (unsigned int) jdx) ==
                  (unsigned int) jdx + 1U);
    }
  }

  if (!had_err) {
    offset = gt_popcount_tab_get_offset_for_block(popcount_t, 4UL);
    gt_ensure(offset == 2UL);
    offset = gt_popcount_tab_get_offset_for_block(popcount_t, 15UL);
    gt_ensure(offset == 0);
  }
  gt_popcount_tab_delete(popcount_t);

  if (!had_err) {
    popcount_t = gt_popcount_tab_new(10U);
    for (idx = 0; !had_err && idx < 1UL<<10UL; idx++) {
      offset = gt_popcount_tab_get_offset_for_block(popcount_t, idx);
      popcount_c = gt_popcount_tab_popcount(idx);
      jdx = gt_popcount_tab_get(popcount_t, popcount_c, offset);
      gt_ensure(idx == jdx);
    }
    gt_popcount_tab_delete(popcount_t);
    popc_perm = init = gt_popcount_tab_perm_start(5U);
    while (!had_err && popc_perm >= init) {
      gt_ensure(gt_popcount_tab_popcount(popc_perm) == 5U);
      popc_perm = gt_popcount_tab_next_perm(popc_perm) & blockmask;
    }
  }
  return had_err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %r13
movl $0x4, %edi
callq 0x163ff0
movq %rax, %rbx
testq %r13, %r13
je 0x164698
movq %r13, %rdi
callq 0xfcc32
testb %al, %al
jne 0x164c1c
leaq 0x229a81(%rip), %r14    # 0x38e120
xorl %r15d, %r15d
movq %rbx, %rdi
movl %r15d, %esi
callq 0x1643ab
movl (%r14), %ecx
cmpl %ecx, %eax
jne 0x1647e0
jne 0x1646cb
leaq 0x1(%r15), %rax
addq $0x4, %r14
cmpq $0x4, %r15
movq %rax, %r15
jb 0x1646a2
leaq 0x2299ce(%rip), %r14    # 0x38e0a0
xorl %r15d, %r15d
movq (%r14), %r12
movq 0x8(%rbx), %rdi
movq %r15, %rsi
callq 0xe3c2c
cmpq %rax, %r12
jne 0x164807
jne 0x164700
leaq 0x1(%r15), %rax
addq $0x8, %r14
cmpq $0xf, %r15
movq %rax, %r15
jb 0x1646d5
movq %r13, 0x8(%rsp)
xorl %r15d, %r15d
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
xorl %r14d, %r14d
movl $0x4, %edi
movq %r15, %rsi
callq 0xe38eb
movq %rax, %r12
andq %r13, %r12
je 0x16477e
leaq (,%r14,8), %rax
movq %rax, 0x20(%rsp)
xorl %r13d, %r13d
movq 0x10(%rbx), %rdi
movq %r15, %rsi
callq 0xe3c2c
cmpq %rax, %r14
jne 0x16482e
movq 0x20(%rsp), %rax
leaq (%rax,%r13,8), %rax
movq %rbx, %rdi
leaq 0x229942(%rip), %rcx    # 0x38e0a0
movq (%rcx,%rax), %rbp
movl %r15d, %esi
movq %r13, %rdx
callq 0x164278
cmpq %rax, %rbp
jne 0x164857
incq %r13
cmpq %r12, %r13
jb 0x164736
addq %r12, %r14
leaq 0x1(%r15), %rax
cmpq $0x4, %r15
movq %rax, %r15
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
jb 0x164711
movq %rbx, %rdi
movl $0x2, %esi
xorl %edx, %edx
movl $0x1, %ecx
callq 0x164436
testl %eax, %eax
je 0x1648a1
leaq 0x1f9c83(%rip), %rsi    # 0x35e43e
leaq 0x2295fd(%rip), %rdx    # 0x38ddbf
leaq 0x22949b(%rip), %rcx    # 0x38dc64
leaq 0x22928c(%rip), %r8     # 0x38da5c
movq 0x8(%rsp), %rdi
movl $0x185, %r9d            # imm = 0x185
jmp 0x16487e
leaq 0x1f9c57(%rip), %rsi    # 0x35e43e
leaq 0x229490(%rip), %rdx    # 0x38dc7e
leaq 0x22946f(%rip), %rcx    # 0x38dc64
leaq 0x229260(%rip), %r8     # 0x38da5c
movq %r13, %rdi
movl $0x16b, %r9d            # imm = 0x16B
jmp 0x16487e
leaq 0x1f9c30(%rip), %rsi    # 0x35e43e
leaq 0x2294ba(%rip), %rdx    # 0x38dccf
leaq 0x229448(%rip), %rcx    # 0x38dc64
leaq 0x229239(%rip), %r8     # 0x38da5c
movq %r13, %rdi
movl $0x170, %r9d            # imm = 0x170
jmp 0x16487e
leaq 0x1f9c09(%rip), %rsi    # 0x35e43e
leaq 0x2294de(%rip), %rdx    # 0x38dd1a
leaq 0x229421(%rip), %rcx    # 0x38dc64
leaq 0x229212(%rip), %r8     # 0x38da5c
movq 0x8(%rsp), %rdi
movl $0x17e, %r9d            # imm = 0x17E
jmp 0x16487e
leaq 0x1f9be0(%rip), %rsi    # 0x35e43e
leaq 0x229502(%rip), %rdx    # 0x38dd67
leaq 0x2293f8(%rip), %rcx    # 0x38dc64
leaq 0x2291e9(%rip), %r8     # 0x38da5c
movq 0x8(%rsp), %rdi
movl $0x182, %r9d            # imm = 0x182
xorl %eax, %eax
callq 0xfcb67
movq %rbx, %rdi
callq 0x164222
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
movl $0x2, %esi
xorl %edx, %edx
movl $0x1, %ecx
callq 0x164436
testl %eax, %eax
movq 0x8(%rsp), %r14
je 0x1648e5
leaq 0x1f9b79(%rip), %rsi    # 0x35e43e
leaq 0x229529(%rip), %rdx    # 0x38ddf5
leaq 0x229391(%rip), %rcx    # 0x38dc64
leaq 0x229182(%rip), %r8     # 0x38da5c
movq %r14, %rdi
movl $0x186, %r9d            # imm = 0x186
jmp 0x16487e
movl $0x1, %edx
movq %rbx, %rdi
movl $0x2, %esi
xorl %ecx, %ecx
callq 0x164436
testl %eax, %eax
je 0x164927
leaq 0x1f9b3a(%rip), %rsi    # 0x35e43e
leaq 0x229520(%rip), %rdx    # 0x38de2b
leaq 0x229352(%rip), %rcx    # 0x38dc64
leaq 0x229143(%rip), %r8     # 0x38da5c
movq %r14, %rdi
movl $0x187, %r9d            # imm = 0x187
jmp 0x16487e
movl $0x1, %edx
movq %rbx, %rdi
movl $0x2, %esi
xorl %ecx, %ecx
callq 0x164436
testl %eax, %eax
je 0x164969
leaq 0x1f9af8(%rip), %rsi    # 0x35e43e
leaq 0x229514(%rip), %rdx    # 0x38de61
leaq 0x229310(%rip), %rcx    # 0x38dc64
leaq 0x229101(%rip), %r8     # 0x38da5c
movq %r14, %rdi
movl $0x188, %r9d            # imm = 0x188
jmp 0x16487e
movl $0x1, %edx
movq %rbx, %rdi
movl $0x2, %esi
movl $0x1, %ecx
callq 0x164436
cmpl $0x1, %eax
jne 0x164b12
movl $0x1, %edx
movq %rbx, %rdi
movl $0x2, %esi
movl $0x1, %ecx
callq 0x164436
cmpl $0x1, %eax
jne 0x164b3c
movl $0x1, %edx
movq %rbx, 0x10(%rsp)
movq %rbx, %rdi
movl $0x2, %esi
movl $0x2, %ecx
callq 0x164436
cmpl $0x1, %eax
jne 0x164b66
movl $0x1, %edx
movq 0x10(%rsp), %rdi
movl $0x2, %esi
movl $0x2, %ecx
callq 0x164436
cmpl $0x1, %eax
jne 0x164b8f
movq 0x10(%rsp), %rdi
movl $0x4, %esi
xorl %edx, %edx
movl $0x1, %ecx
callq 0x164436
cmpl $0x2, %eax
jne 0x164bb8
movq $0x0, 0x18(%rsp)
movq 0x10(%rsp), %rbx
movq %rbx, %rdi
movq 0x18(%rsp), %r14
movq %r14, %rsi
callq 0x164332
movl %eax, %ebp
movq %rbx, %rdi
movq %r14, %rsi
callq 0x164591
movq %rax, %r15
xorl %r13d, %r13d
movq %rax, 0x20(%rsp)
movq %rbx, %rdi
movl %ebp, %esi
movq %r15, %rdx
movl %r13d, %ecx
callq 0x164436
movq %r15, %rdx
movl %eax, %r15d
leaq 0x1(%r13), %r14
testl %ebp, %ebp
je 0x164a79
leal 0x1(%r13), %r12d
movq %rbx, %rdi
movl %ebp, %esi
movl %r13d, %ecx
callq 0x164436
subl %eax, %r12d
jmp 0x164a7c
movl %r14d, %r12d
addl %r15d, %r12d
cmpl %r12d, %r14d
jne 0x164bf0
movq 0x20(%rsp), %r15
jne 0x164a98
cmpq $0x3, %r13
movq %r14, %r13
jb 0x164a45
cmpl %r12d, %r14d
jne 0x164ab5
movq 0x18(%rsp), %rcx
leaq 0x1(%rcx), %rax
cmpq $0xf, %rcx
movq %rax, 0x18(%rsp)
jb 0x164a1d
movl $0x4, %esi
movq 0x10(%rsp), %rdi
callq 0x164591
cmpq $0x2, %rax
jne 0x164c21
movl $0xf, %esi
movq 0x10(%rsp), %rdi
callq 0x164591
testq %rax, %rax
je 0x164c66
leaq 0x1f9951(%rip), %rsi    # 0x35e43e
leaq 0x1fa59d(%rip), %rdx    # 0x35f091
leaq 0x229169(%rip), %rcx    # 0x38dc64
leaq 0x228f5a(%rip), %r8     # 0x38da5c
movq 0x8(%rsp), %rdi
movl $0x1a1, %r9d            # imm = 0x1A1
jmp 0x164bdf
leaq 0x1f9925(%rip), %rsi    # 0x35e43e
leaq 0x229377(%rip), %rdx    # 0x38de97
leaq 0x22913d(%rip), %rcx    # 0x38dc64
leaq 0x228f2e(%rip), %r8     # 0x38da5c
movq %r14, %rdi
movl $0x189, %r9d            # imm = 0x189
jmp 0x16487e
leaq 0x1f98fb(%rip), %rsi    # 0x35e43e
leaq 0x229383(%rip), %rdx    # 0x38decd
leaq 0x229113(%rip), %rcx    # 0x38dc64
leaq 0x228f04(%rip), %r8     # 0x38da5c
movq %r14, %rdi
movl $0x18a, %r9d            # imm = 0x18A
jmp 0x16487e
leaq 0x1f98d1(%rip), %rsi    # 0x35e43e
leaq 0x22938f(%rip), %rdx    # 0x38df03
leaq 0x2290e9(%rip), %rcx    # 0x38dc64
leaq 0x228eda(%rip), %r8     # 0x38da5c
movq 0x8(%rsp), %rdi
movl $0x18b, %r9d            # imm = 0x18B
jmp 0x164bdf
leaq 0x1f98a8(%rip), %rsi    # 0x35e43e
leaq 0x22939c(%rip), %rdx    # 0x38df39
leaq 0x2290c0(%rip), %rcx    # 0x38dc64
leaq 0x228eb1(%rip), %r8     # 0x38da5c
movq 0x8(%rsp), %rdi
movl $0x18c, %r9d            # imm = 0x18C
jmp 0x164bdf
leaq 0x1f987f(%rip), %rsi    # 0x35e43e
leaq 0x2293a9(%rip), %rdx    # 0x38df6f
leaq 0x229097(%rip), %rcx    # 0x38dc64
leaq 0x228e88(%rip), %r8     # 0x38da5c
movq 0x8(%rsp), %rdi
movl $0x18d, %r9d            # imm = 0x18D
xorl %eax, %eax
callq 0xfcb67
movq 0x10(%rsp), %rbx
jmp 0x164885
leaq 0x1f9847(%rip), %rsi    # 0x35e43e
leaq 0x2293a7(%rip), %rdx    # 0x38dfa5
leaq 0x22905f(%rip), %rcx    # 0x38dc64
leaq 0x228e50(%rip), %r8     # 0x38da5c
movq 0x8(%rsp), %rdi
movl $0x199, %r9d            # imm = 0x199
jmp 0x16487e
callq 0x4e940
leaq 0x1f9816(%rip), %rsi    # 0x35e43e
leaq 0x229429(%rip), %rdx    # 0x38e058
leaq 0x22902e(%rip), %rcx    # 0x38dc64
leaq 0x228e1f(%rip), %r8     # 0x38da5c
movq 0x8(%rsp), %rdi
movl $0x19f, %r9d            # imm = 0x19F
xorl %eax, %eax
callq 0xfcb67
movl $0xf, %esi
movq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0x164591
jmp 0x164885
movq 0x10(%rsp), %rdi
callq 0x164222
movl $0xa, %edi
callq 0x163ff0
movq %rax, %rbx
xorl %r15d, %r15d
movabsq $0x3333333333333333, %r12 # imm = 0x3333333333333333
movabsq $0xf0f0f0f0f0f0f0f, %r13 # imm = 0xF0F0F0F0F0F0F0F
movabsq $0x101010101010101, %rbp # imm = 0x101010101010101
movq %rbx, %rdi
movq %r15, %rsi
callq 0x164591
movq %r15, %rcx
shrq %rcx
movabsq $0x5555555555555555, %rdx # imm = 0x5555555555555555
andq %rdx, %rcx
movq %r15, %rdx
subq %rcx, %rdx
movq %rdx, %rcx
andq %r12, %rcx
shrq $0x2, %rdx
andq %r12, %rdx
addq %rcx, %rdx
movq %rdx, %rsi
shrq $0x4, %rsi
addq %rdx, %rsi
andq %r13, %rsi
imulq %rbp, %rsi
shrq $0x38, %rsi
movq %rbx, %rdi
movq %rax, %rdx
callq 0x164278
cmpq %rax, %r15
jne 0x164dea
jne 0x164d0d
leaq 0x1(%r15), %rax
cmpq $0x3ff, %r15            # imm = 0x3FF
movq %rax, %r15
jb 0x164c9e
movq %rbx, %rdi
callq 0x164222
movl $0x1f, %ebx
leaq 0x228d3b(%rip), %r15    # 0x38da5c
movq %rbx, %rax
shrq %rax
movabsq $0x5555555555555555, %rcx # imm = 0x5555555555555555
andq %rcx, %rax
movq %rbx, %rcx
subq %rax, %rcx
movq %rcx, %rax
andq %r12, %rax
shrq $0x2, %rcx
andq %r12, %rcx
addq %rax, %rcx
movq %rcx, %r14
shrq $0x4, %r14
addq %rcx, %r14
andq %r13, %r14
imulq %rbp, %r14
shrq $0x38, %r14
movl $0x0, %eax
cmpq $0x5, %r14
je 0x164d99
movq 0x8(%rsp), %rdi
leaq 0x1f96c8(%rip), %rsi    # 0x35e43e
leaq 0x2292f4(%rip), %rdx    # 0x38e071
leaq 0x228ee0(%rip), %rcx    # 0x38dc64
movq %r15, %r8
movl $0x1b0, %r9d            # imm = 0x1B0
xorl %eax, %eax
callq 0xfcb67
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
leaq -0x1(%rbx), %rsi
orq %rbx, %rsi
leaq 0x1(%rsi), %rdx
notq %rsi
andq %rdx, %rsi
shrq %rsi
addq $0xffff, %rsi           # imm = 0xFFFF
andq %rbx, %rsi
bsfq %rsi, %rcx
movq %rsi, %rbx
shrq %cl, %rbx
testq %rsi, %rsi
cmoveq %rsi, %rbx
cmpl $0x5, %r14d
jne 0x164892
andl $0xfffe, %edx           # imm = 0xFFFE
orq %rdx, %rbx
cmpq $0x1e, %rbx
ja 0x164d21
jmp 0x164892
leaq 0x1f964d(%rip), %rsi    # 0x35e43e
leaq 0x22926e(%rip), %rdx    # 0x38e066
leaq 0x228e65(%rip), %rcx    # 0x38dc64
leaq 0x228c56(%rip), %r8     # 0x38da5c
movq 0x8(%rsp), %rdi
movl $0x1ab, %r9d            # imm = 0x1AB
jmp 0x16487e
nop