// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/extended/popcount_tab.c
// Function: gt_popcount_tab_rank_1
unsigned int gt_popcount_tab_rank_1(GtPopcountTab *popcount_tab,
                                    unsigned int popcount_c,
                                    GtUword i,
                                    unsigned int pos)
{
  GtUword block;
  gt_assert(pos < popcount_tab->blocksize);
  gt_assert(popcount_c <= popcount_tab->blocksize);

  if (popcount_c == 0)
    return 0;
  if (popcount_c < popcount_tab->blocksize)
    gt_assert(i <
              gt_compact_ulong_store_get(popcount_tab->offsets,
                                         (GtUword) popcount_c + 1) -
              gt_compact_ulong_store_get(popcount_tab->offsets,
                                         (GtUword) popcount_c));
  else {
    gt_assert(i == 0);
    return pos+1;
  }
  block =
    gt_compact_ulong_store_get(
                    popcount_tab->blocks,
                    gt_compact_ulong_store_get(popcount_tab->offsets,
                                               (GtUword) popcount_c) + i);
  block >>= popcount_tab->blocksize - pos - 1;
  return gt_popcount_tab_popcount(block);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl 0x28(%rdi), %eax
cmpl %ecx, %eax
jbe 0x104995
cmpl %esi, %eax
jb 0x1049c6
testl %esi, %esi
je 0x10497a
movl %ecx, %ebx
movq %rdx, %r15
cmpl %esi, %eax
jbe 0x10497e
movq %rdi, %r14
movq 0x10(%rdi), %rdi
movl %esi, %r12d
leaq 0x1(%r12), %rsi
callq 0x6bb8d
movq %rax, %r13
movq 0x10(%r14), %rdi
movq %r12, %rsi
callq 0x6bb8d
subq %rax, %r13
cmpq %r15, %r13
jbe 0x1049f4
movq 0x8(%r14), %r13
movq 0x10(%r14), %rdi
movq %r12, %rsi
callq 0x6bb8d
addq %rax, %r15
movq %r13, %rdi
movq %r15, %rsi
callq 0x6bb8d
notl %ebx
addl 0x28(%r14), %ebx
movl %ebx, %ecx
shrq %cl, %rax
movq %rax, %rcx
shrq %rcx
movabsq $0x5555555555555555, %rdx # imm = 0x5555555555555555
andq %rcx, %rdx
subq %rdx, %rax
movabsq $0x3333333333333333, %rcx # imm = 0x3333333333333333
movq %rax, %rdx
andq %rcx, %rdx
shrq $0x2, %rax
andq %rcx, %rax
addq %rdx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
addq %rax, %rcx
movabsq $0xf0f0f0f0f0f0f0f, %rax # imm = 0xF0F0F0F0F0F0F0F
andq %rcx, %rax
movabsq $0x101010101010101, %rbx # imm = 0x101010101010101
imulq %rax, %rbx
shrq $0x38, %rbx
jmp 0x104989
xorl %ebx, %ebx
jmp 0x104989
testq %r15, %r15
jne 0x104a22
incl %ebx
movl %ebx, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq 0x3335cc(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1e066d(%rip), %rsi    # 0x2e5013
leaq 0x22964d(%rip), %rdx    # 0x32dffa
leaq 0x229664(%rip), %rcx    # 0x32e018
leaq 0x229491(%rip), %r8     # 0x32de4c
movl $0x106, %r9d            # imm = 0x106
jmp 0x104a4e
movq 0x33359b(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1e063c(%rip), %rsi    # 0x2e5013
leaq 0x2294b3(%rip), %rdx    # 0x32de91
leaq 0x229633(%rip), %rcx    # 0x32e018
leaq 0x229460(%rip), %r8     # 0x32de4c
movl $0x107, %r9d            # imm = 0x107
jmp 0x104a4e
movq 0x33356d(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1e060e(%rip), %rsi    # 0x2e5013
leaq 0x2294c6(%rip), %rdx    # 0x32ded2
leaq 0x229605(%rip), %rcx    # 0x32e018
leaq 0x229432(%rip), %r8     # 0x32de4c
movl $0x110, %r9d            # imm = 0x110
jmp 0x104a4e
movq 0x33353f(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1e05e0(%rip), %rsi    # 0x2e5013
leaq 0x229491(%rip), %rdx    # 0x32decb
leaq 0x2295d7(%rip), %rcx    # 0x32e018
leaq 0x229404(%rip), %r8     # 0x32de4c
movl $0x112, %r9d            # imm = 0x112
xorl %eax, %eax
callq 0x17a50
callq 0x17390