// File: /workspace/github_c_makefile_star2_O2/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 $0x18, %rsp
movq %rdi, %r14
pushq $0x4
popq %rdi
callq 0x1042e4
movq %rax, (%rsp)
testq %r14, %r14
je 0x104bcc
movq %r14, %rdi
callq 0x89eb7
testb %al, %al
jne 0x105312
leaq 0x22993d(%rip), %rbx    # 0x32e510
leaq 0x22947a(%rip), %r12    # 0x32e054
leaq 0x22926b(%rip), %r13    # 0x32de4c
pushq $-0x1
popq %r15
xorl %ebp, %ebp
xorl %ecx, %ecx
testl %ecx, %ecx
jne 0x104c34
cmpq $0x5, %rbp
jae 0x104c34
movq (%rsp), %rdi
movl %ebp, %esi
callq 0x1047ab
xorl %ecx, %ecx
cmpl (%rbx), %eax
je 0x104c2b
movq %r14, %rdi
leaq 0x1f97e4(%rip), %rsi    # 0x2fe3f2
leaq 0x229459(%rip), %rdx    # 0x32e06e
movq %r12, %rcx
movq %r13, %r8
movl $0x16b, %r9d            # imm = 0x16B
xorl %eax, %eax
callq 0x89dbb
movl %r15d, %ecx
incq %rbp
addq $0x4, %rbx
jmp 0x104be9
leaq 0x229855(%rip), %rbx    # 0x32e490
leaq 0x22920a(%rip), %r13    # 0x32de4c
pushq $-0x1
popq %r15
xorl %ebp, %ebp
testl %ecx, %ecx
jne 0x104ca0
cmpq $0x10, %rbp
jae 0x104ca0
movq (%rbx), %r12
movq (%rsp), %rax
movq 0x8(%rax), %rdi
movq %rbp, %rsi
callq 0x6bb8d
xorl %ecx, %ecx
cmpq %rax, %r12
je 0x104c97
movq %r14, %rdi
leaq 0x1f977c(%rip), %rsi    # 0x2fe3f2
leaq 0x229442(%rip), %rdx    # 0x32e0bf
leaq 0x2293d0(%rip), %rcx    # 0x32e054
movq %r13, %r8
movl $0x170, %r9d            # imm = 0x170
xorl %eax, %eax
callq 0x89dbb
movl %r15d, %ecx
incq %rbp
addq $0x8, %rbx
jmp 0x104c48
xorl %ebx, %ebx
xorl %ebp, %ebp
movq %r14, 0x8(%rsp)
movq (%rsp), %r12
testl %ecx, %ecx
jne 0x104d98
cmpq $0x4, %rbx
ja 0x104d98
pushq $0x4
popq %rdi
movq %rbx, %rsi
callq 0x6b73d
movl %eax, %r15d
leaq (,%rbp,8), %rax
movq %rax, 0x10(%rsp)
xorl %r13d, %r13d
xorl %ecx, %ecx
testl %ecx, %ecx
jne 0x104d8d
cmpq %r15, %r13
jae 0x104d8d
movq 0x10(%r12), %rdi
movq %rbx, %rsi
callq 0x6bb8d
cmpq %rax, %rbp
jne 0x104d56
movq 0x10(%rsp), %rax
leaq (%rax,%r13,8), %rax
leaq 0x22977e(%rip), %rcx    # 0x32e490
movq (%rcx,%rax), %r14
movq %r12, %rdi
movl %ebx, %esi
movq %r13, %rdx
callq 0x104561
xorl %ecx, %ecx
cmpq %rax, %r14
movq 0x8(%rsp), %r14
je 0x104d85
movq %r14, %rdi
leaq 0x1f96b9(%rip), %rsi    # 0x2fe3f2
leaq 0x229417(%rip), %rdx    # 0x32e157
leaq 0x22930d(%rip), %rcx    # 0x32e054
leaq 0x2290fe(%rip), %r8     # 0x32de4c
movl $0x182, %r9d            # imm = 0x182
jmp 0x104d7b
movq %r14, %rdi
leaq 0x1f9692(%rip), %rsi    # 0x2fe3f2
leaq 0x2293a3(%rip), %rdx    # 0x32e10a
leaq 0x2292e6(%rip), %rcx    # 0x32e054
leaq 0x2290d7(%rip), %r8     # 0x32de4c
movl $0x17e, %r9d            # imm = 0x17E
xorl %eax, %eax
callq 0x89dbb
pushq $-0x1
popq %rcx
incq %r13
jmp 0x104cdf
addq %r15, %rbp
incq %rbx
jmp 0x104cad
pushq $-0x1
popq %rax
movl %eax, %r12d
testl %ecx, %ecx
jne 0x104e6b
pushq $0x2
popq %rsi
pushq $0x1
popq %rcx
movq (%rsp), %rbx
movq %rbx, %rdi
xorl %edx, %edx
callq 0x104896
testl %eax, %eax
je 0x104de5
leaq 0x1f962d(%rip), %rsi    # 0x2fe3f2
leaq 0x2293e3(%rip), %rdx    # 0x32e1af
leaq 0x229281(%rip), %rcx    # 0x32e054
leaq 0x229072(%rip), %r8     # 0x32de4c
movq %r14, %rdi
movl $0x185, %r9d            # imm = 0x185
jmp 0x104e5e
pushq $0x2
popq %rsi
pushq $0x1
popq %rcx
movq %rbx, %rdi
xorl %edx, %edx
callq 0x104a5a
cmpl $0x2, %eax
jne 0x104e39
pushq $0x2
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x104896
testl %eax, %eax
je 0x10517b
leaq 0x1f95d9(%rip), %rsi    # 0x2fe3f2
leaq 0x2293fb(%rip), %rdx    # 0x32e21b
leaq 0x22922d(%rip), %rcx    # 0x32e054
leaq 0x22901e(%rip), %r8     # 0x32de4c
movq %r14, %rdi
movl $0x187, %r9d            # imm = 0x187
jmp 0x104e5e
leaq 0x1f95b2(%rip), %rsi    # 0x2fe3f2
leaq 0x22939e(%rip), %rdx    # 0x32e1e5
leaq 0x229206(%rip), %rcx    # 0x32e054
leaq 0x228ff7(%rip), %r8     # 0x32de4c
movq %r14, %rdi
movl $0x186, %r9d            # imm = 0x186
xorl %eax, %eax
callq 0x89dbb
pushq $-0x1
popq %rax
movl %eax, %r12d
xorl %r15d, %r15d
movq (%rsp), %r13
testl %r12d, %r12d
jne 0x104f2f
cmpq $0xf, %r15
ja 0x104f2f
movq (%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1046d2
movl %eax, %ebp
movq %rbx, %rdi
movq %r15, 0x10(%rsp)
movq %r15, %rsi
callq 0x104a9d
movq %rax, %rbx
xorl %r15d, %r15d
xorl %r12d, %r12d
testl %r12d, %r12d
jne 0x104f22
cmpq $0x3, %r15
ja 0x104f22
movq %r13, %rdi
movl %ebp, %esi
movq %rbx, %rdx
movl %r15d, %ecx
callq 0x104896
movl %eax, %r12d
movq %r13, %rdi
movl %ebp, %esi
movq %rbx, %rdx
movl %r15d, %ecx
callq 0x104a5a
addl %r12d, %eax
leal 0x1(%r15), %ecx
xorl %r12d, %r12d
cmpl %eax, %ecx
je 0x104f1d
movq %r14, %rdi
leaq 0x1f94fd(%rip), %rsi    # 0x2fe3f2
leaq 0x229499(%rip), %rdx    # 0x32e395
leaq 0x229151(%rip), %rcx    # 0x32e054
leaq 0x228f42(%rip), %r8     # 0x32de4c
movl $0x199, %r9d            # imm = 0x199
xorl %eax, %eax
callq 0x89dbb
pushq $-0x1
popq %rax
movl %eax, %r12d
incq %r15
jmp 0x104eaf
movq 0x10(%rsp), %r15
incq %r15
jmp 0x104e72
pushq $-0x1
popq %rbp
movl %ebp, %r15d
testl %r12d, %r12d
movq (%rsp), %r12
jne 0x104fce
pushq $0x4
popq %rsi
movq %r12, %rdi
callq 0x104a9d
movq %rax, %rbx
xorl %r15d, %r15d
cmpq $0x2, %rax
je 0x104f89
leaq 0x1f9492(%rip), %rsi    # 0x2fe3f2
leaq 0x2294e1(%rip), %rdx    # 0x32e448
leaq 0x2290e6(%rip), %rcx    # 0x32e054
leaq 0x228ed7(%rip), %r8     # 0x32de4c
movq %r14, %rdi
movl $0x19f, %r9d            # imm = 0x19F
xorl %eax, %eax
callq 0x89dbb
pushq $-0x1
popq %r15
pushq $0xf
popq %rsi
movq %r12, %rdi
callq 0x104a9d
cmpq $0x2, %rbx
jne 0x104fce
testq %rax, %rax
je 0x104fce
leaq 0x1f944c(%rip), %rsi    # 0x2fe3f2
leaq 0x1fa068(%rip), %rdx    # 0x2ff015
leaq 0x2290a0(%rip), %rcx    # 0x32e054
leaq 0x228e91(%rip), %r8     # 0x32de4c
movq %r14, %rdi
movl $0x1a1, %r9d            # imm = 0x1A1
xorl %eax, %eax
callq 0x89dbb
movl %ebp, %r15d
movq %r12, %rdi
callq 0x10450b
testl %r15d, %r15d
je 0x104fec
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0xa
popq %rdi
callq 0x1042e4
movq %rax, %rbx
movabsq $0x3333333333333333, %r12 # imm = 0x3333333333333333
movabsq $0x101010101010101, %r15 # imm = 0x101010101010101
pushq $-0x1
popq %r13
xorl %r14d, %r14d
xorl %ebp, %ebp
testl %ebp, %ebp
jne 0x1050c7
cmpq $0x3ff, %r14            # imm = 0x3FF
ja 0x1050c7
movq %rbx, %rdi
movq %r14, %rsi
callq 0x104a9d
movq %r14, %rcx
shrq %rcx
movabsq $0x5555555555555555, %rdx # imm = 0x5555555555555555
andq %rdx, %rcx
movq %r14, %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
movabsq $0xf0f0f0f0f0f0f0f, %rcx # imm = 0xF0F0F0F0F0F0F0F
andq %rcx, %rsi
imulq %r15, %rsi
shrq $0x38, %rsi
movq %rbx, %rdi
movq %rax, %rdx
callq 0x104561
xorl %ebp, %ebp
cmpq %rax, %r14
je 0x1050bf
movq 0x8(%rsp), %rdi
leaq 0x1f9358(%rip), %rsi    # 0x2fe3f2
leaq 0x2293b5(%rip), %rdx    # 0x32e456
leaq 0x228fac(%rip), %rcx    # 0x32e054
leaq 0x228d9d(%rip), %r8     # 0x32de4c
movl $0x1ab, %r9d            # imm = 0x1AB
xorl %eax, %eax
callq 0x89dbb
movl %r13d, %ebp
incq %r14
jmp 0x105014
movq %rbx, %rdi
callq 0x10450b
pushq $0x1f
popq %r13
leaq 0x228d72(%rip), %r14    # 0x32de4c
pushq $-0x1
popq %rbx
testl %ebp, %ebp
jne 0x104fdb
cmpq $0x1f, %r13
jb 0x104fdb
movq %r13, %rax
shrq %rax
movabsq $0x5555555555555555, %rcx # imm = 0x5555555555555555
andq %rcx, %rax
movq %r13, %rcx
subq %rax, %rcx
movq %rcx, %rax
andq %r12, %rax
shrq $0x2, %rcx
andq %r12, %rcx
addq %rax, %rcx
movq %rcx, %rax
shrq $0x4, %rax
addq %rcx, %rax
movabsq $0xf0f0f0f0f0f0f0f, %rcx # imm = 0xF0F0F0F0F0F0F0F
andq %rcx, %rax
imulq %r15, %rax
shrq $0x38, %rax
xorl %ebp, %ebp
cmpl $0x5, %eax
je 0x10516a
movq 0x8(%rsp), %rdi
leaq 0x1f92a8(%rip), %rsi    # 0x2fe3f2
leaq 0x229310(%rip), %rdx    # 0x32e461
leaq 0x228efc(%rip), %rcx    # 0x32e054
movq %r14, %r8
movl $0x1b0, %r9d            # imm = 0x1B0
xorl %eax, %eax
callq 0x89dbb
movl %ebx, %ebp
movq %r13, %rdi
callq 0x10534a
movzwl %ax, %r13d
jmp 0x1050dd
pushq $0x2
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x104a5a
cmpl $0x1, %eax
jne 0x105240
pushq $0x2
popq %rsi
pushq $0x1
popq %rdx
pushq $0x1
popq %rcx
movq %rbx, %rdi
callq 0x104896
cmpl $0x1, %eax
jne 0x10526a
pushq $0x2
popq %rsi
pushq $0x1
popq %rdx
pushq $0x1
popq %rcx
movq %rbx, %rdi
callq 0x104a5a
cmpl $0x1, %eax
jne 0x105294
pushq $0x1
popq %rdx
pushq $0x2
popq %rcx
movq %rbx, %rdi
movl %ecx, %esi
callq 0x104896
cmpl $0x1, %eax
jne 0x1052be
pushq $0x1
popq %rdx
pushq $0x2
popq %rcx
movq %rbx, %rdi
movl %ecx, %esi
callq 0x104a5a
cmpl $0x2, %eax
jne 0x1052e8
xorl %r12d, %r12d
pushq $0x4
popq %rsi
pushq $0x1
popq %rcx
movq %rbx, %rdi
xorl %edx, %edx
callq 0x104896
cmpl $0x2, %eax
je 0x104e6b
leaq 0x1f91d5(%rip), %rsi    # 0x2fe3f2
leaq 0x22913b(%rip), %rdx    # 0x32e35f
leaq 0x228e29(%rip), %rcx    # 0x32e054
leaq 0x228c1a(%rip), %r8     # 0x32de4c
movq %r14, %rdi
movl $0x18d, %r9d            # imm = 0x18D
jmp 0x104e5e
leaq 0x1f91ab(%rip), %rsi    # 0x2fe3f2
leaq 0x229003(%rip), %rdx    # 0x32e251
leaq 0x228dff(%rip), %rcx    # 0x32e054
leaq 0x228bf0(%rip), %r8     # 0x32de4c
movq %r14, %rdi
movl $0x188, %r9d            # imm = 0x188
jmp 0x104e5e
leaq 0x1f9181(%rip), %rsi    # 0x2fe3f2
leaq 0x22900f(%rip), %rdx    # 0x32e287
leaq 0x228dd5(%rip), %rcx    # 0x32e054
leaq 0x228bc6(%rip), %r8     # 0x32de4c
movq %r14, %rdi
movl $0x189, %r9d            # imm = 0x189
jmp 0x104e5e
leaq 0x1f9157(%rip), %rsi    # 0x2fe3f2
leaq 0x22901b(%rip), %rdx    # 0x32e2bd
leaq 0x228dab(%rip), %rcx    # 0x32e054
leaq 0x228b9c(%rip), %r8     # 0x32de4c
movq %r14, %rdi
movl $0x18a, %r9d            # imm = 0x18A
jmp 0x104e5e
leaq 0x1f912d(%rip), %rsi    # 0x2fe3f2
leaq 0x229027(%rip), %rdx    # 0x32e2f3
leaq 0x228d81(%rip), %rcx    # 0x32e054
leaq 0x228b72(%rip), %r8     # 0x32de4c
movq %r14, %rdi
movl $0x18b, %r9d            # imm = 0x18B
jmp 0x104e5e
leaq 0x1f9103(%rip), %rsi    # 0x2fe3f2
leaq 0x229033(%rip), %rdx    # 0x32e329
leaq 0x228d57(%rip), %rcx    # 0x32e054
leaq 0x228b48(%rip), %r8     # 0x32de4c
movq %r14, %rdi
movl $0x18c, %r9d            # imm = 0x18C
jmp 0x104e5e
movq 0x332c4f(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1dfcf0(%rip), %rsi    # 0x2e5013
leaq 0x1dfe95(%rip), %rdx    # 0x2e51bf
leaq 0x228d23(%rip), %rcx    # 0x32e054
leaq 0x228b14(%rip), %r8     # 0x32de4c
movl $0x166, %r9d            # imm = 0x166
xorl %eax, %eax
callq 0x17a50
callq 0x17390