// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/extended/compressed_bitsequence.c
// Function: gt_compressed_bitsequence_calc_block_info
static inline void
gt_compressed_bitsequence_calc_block_info(GtCompressedBitsequence *cbs,
                                          GtUword position)
{
  GtUword idx;
  GtCompressedBitsequenceBlockInfo *bi = cbs->cbs_bi;

  idx = position / cbs->blocksize;

  if (cbs->cbs_bi == NULL) {
    cbs->cbs_bi = gt_malloc(sizeof (*cbs->cbs_bi));
    bi = cbs->cbs_bi;
    bi->idx = idx + 1;
  }

  if (idx != bi->idx) {
    unsigned int offset_bits;
    GtUword jdx, sample, offsets_bitpos;

    bi->idx = idx;
    bi->block_len = cbs->blocksize;
    if (idx == cbs->num_of_blocks -1)
      bi->block_len = cbs->last_block_len;

    sample = idx / cbs->superblocksize;
    if (sample==0) {
      offsets_bitpos = 0;
      bi->rank_sum = 0;
    }
    else {
      offsets_bitpos = (GtUword)
        gt_compressed_bitsequence_get_variable_field(
                                     cbs->superblockoffsets,
                                     (sample - 1) * cbs->superblockoffsets_bits,
                                     cbs->superblockoffsets_bits);
      bi->rank_sum = (GtUword)
        gt_compressed_bitsequence_get_variable_field(
                                       cbs->superblockranks,
                                       (sample - 1) * cbs->superblockranks_bits,
                                       cbs->superblockranks_bits);
    }
    for (jdx = sample * cbs->superblocksize; jdx < idx; jdx++) {
      bi->class = gt_compressed_bitsequence_get_class(cbs, jdx);
      bi->rank_sum += bi->class;
      offsets_bitpos += gt_popcount_tab_offset_bits(cbs->popcount_tab,
                                                    bi->class);
    }
    bi->class = gt_compressed_bitsequence_get_class(cbs, idx);
    offset_bits = gt_popcount_tab_offset_bits(cbs->popcount_tab, bi->class);
    bi->block_offset = (GtUword)
      gt_compressed_bitsequence_get_variable_field(cbs->c_offsets,
                                                   offsets_bitpos,
                                                   offset_bits);
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %rax
movq %rdi, %r14
movq 0x90(%rdi), %rbx
movl 0xd8(%rdi), %ecx
xorl %edx, %edx
divq %rcx
movq %rax, %r15
testq %rbx, %rbx
je 0x129dbf
cmpq 0x8(%rbx), %r15
jne 0x129de7
jmp 0x129f79
leaq 0x24e770(%rip), %rsi    # 0x378536
movl $0x20, %edi
movl $0x1cf, %edx            # imm = 0x1CF
callq 0x104226
movq %rax, %rbx
movq %rax, 0x90(%r14)
leaq 0x1(%r15), %rax
movq %rax, 0x8(%rbx)
movq %r15, 0x8(%rbx)
movl 0xd8(%r14), %eax
movl %eax, 0x1c(%rbx)
movq 0xb8(%r14), %rax
decq %rax
cmpq %rax, %r15
jne 0x129e0e
movl 0xe0(%r14), %eax
movl %eax, 0x1c(%rbx)
movl 0xec(%r14), %esi
xorl %edi, %edi
movq %r15, %rax
xorl %edx, %edx
divq %rsi
movq %rax, %r13
movl $0x0, %r12d
cmpq %rsi, %r15
jb 0x129ee3
movl 0xe4(%r14), %edx
cmpq $0x41, %rdx
jae 0x129f88
leaq -0x1(%r13), %rax
testq %rdx, %rdx
je 0x129e8a
movq 0x80(%r14), %rdi
movq %rax, %rcx
imulq %rdx, %rcx
movq %rcx, %r8
shrq $0x6, %r8
movq (%rdi,%r8,8), %r12
shlq %cl, %r12
andl $0x3f, %ecx
leal (%rcx,%rdx), %r9d
cmpl $0x41, %r9d
jb 0x129e81
movq 0x8(%rdi,%r8,8), %rdi
negb %cl
shrq %cl, %rdi
orq %rdi, %r12
negb %dl
movl %edx, %ecx
shrq %cl, %r12
jmp 0x129e8d
xorl %r12d, %r12d
movl 0xe8(%r14), %edx
cmpq $0x41, %rdx
jae 0x129f8d
testq %rdx, %rdx
je 0x129ee1
movq 0x88(%r14), %r8
imulq %rdx, %rax
movq %rax, %r9
shrq $0x6, %r9
movq (%r8,%r9,8), %rdi
movl %eax, %ecx
shlq %cl, %rdi
movl %eax, %ecx
andl $0x3f, %ecx
leal (%rcx,%rdx), %eax
cmpl $0x41, %eax
jb 0x129ed8
movq 0x8(%r8,%r9,8), %rax
negb %cl
shrq %cl, %rax
orq %rax, %rdi
negb %dl
movl %edx, %ecx
shrq %cl, %rdi
jmp 0x129ee3
xorl %edi, %edi
movq %rdi, 0x10(%rbx)
imulq %rsi, %r13
movq %r14, %rdi
cmpq %r15, %r13
jae 0x129f19
movq %r13, %rsi
callq 0x12a4cc
movl %eax, 0x18(%rbx)
movl %eax, %ecx
addq %rcx, 0x10(%rbx)
movq 0x68(%r14), %rdi
movl %eax, %esi
callq 0x1643ab
movl %eax, %eax
addq %rax, %r12
incq %r13
jmp 0x129eeb
movq %r15, %rsi
callq 0x12a4cc
movl %eax, 0x18(%rbx)
movq 0x68(%r14), %rdi
movl %eax, %esi
callq 0x1643ab
cmpl $0x41, %eax
jae 0x129f83
testl %eax, %eax
je 0x129f74
movq 0x70(%r14), %rdi
movl %r12d, %edx
movq %r12, %r8
shrq $0x6, %r8
movq (%rdi,%r8,8), %rsi
movl %r12d, %ecx
shlq %cl, %rsi
andl $0x3f, %edx
movl %eax, %ecx
addl %edx, %ecx
cmpl $0x41, %ecx
jb 0x129f6b
movq 0x8(%rdi,%r8,8), %rdi
negb %dl
movl %edx, %ecx
shrq %cl, %rdi
orq %rdi, %rsi
negb %al
movl %eax, %ecx
shrq %cl, %rsi
jmp 0x129f76
xorl %esi, %esi
movq %rsi, (%rbx)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
callq 0x3c651
callq 0x3c5df
callq 0x3c618