// File: /workspace/github_cpp_makefile_star2_O1/BenLangmead[P]bowtie/./ebwt.h
// Function: Ebwt::countUpToEx(SideLocus const&, unsigned long*) const
inline void Ebwt::countUpToEx(const SideLocus& l, TIndexOffU* arrs) const {
	int i = 0;
	// Count occurrences of c in each 64-bit (using bit trickery);
	// note: this seems does not seem to lend a significant boost to
	// performance.  If you comment out this whole loop (which won't
	// affect correctness - it will just cause the following loop to
	// take up the slack) then runtime does not change noticeably.
	// Someday the countInU64() and pop() functions should be
	// vectorized/SSE-ized in case that helps.
	const uint8_t *side = l.side(this->_ebwt);

#ifdef POPCNT_CAPABILITY
    if (_usePOPCNTinstruction) {
        for(; i+7 < l._by; i += 8) {
            countInU64Ex<USE_POPCNT_INSTRUCTION>(*(uint64_t*)&side[i], arrs);
        }
    }
    else {
        for(; i+7 < l._by; i += 8) {
            countInU64Ex<USE_POPCNT_GENERIC>(*(uint64_t*)&side[i], arrs);
        }
    }
#else
	for(; i+7 < l._by; i += 8) {
		countInU64Ex(*(uint64_t*)&side[i], arrs);
	}
#endif

#ifdef SIXTY4_FORMAT
	// Calculate number of bit pairs to shift off the end
	const int bpShiftoff = 32 - (((l._by & 7) << 2) + l._bp);
	assert_leq(bpShiftoff, 32);
	if(bpShiftoff < 32) {
		const uint64_t sw = (*(uint64_t*)&l.side(this->_ebwt)[i]) << (bpShiftoff << 1);

#ifdef POPCNT_CAPABILITY
        if (_usePOPCNTinstruction) {
            countInU64Ex<USE_POPCNT_INSTRUCTION>(sw, arrs);
        }
        else{
            countInU64Ex<USE_POPCNT_GENERIC>(sw, arrs);
        }
#else
		countInU64Ex(sw, arrs);
#endif

		arrs[0] -= bpShiftoff;
	}
#else
	// Count occurences of c in the rest of the side (using LUT)
	for(; i < l._by; i++) {
		arrs[0] += cCntLUT_4[0][0][side[i]];
		arrs[1] += cCntLUT_4[0][1][side[i]];
		arrs[2] += cCntLUT_4[0][2][side[i]];
		arrs[3] += cCntLUT_4[0][3][side[i]];
	}
	// Count occurences of c in the rest of the byte
	if(l._bp > 0) {
		arrs[0] += cCntLUT_4[(int)l._bp][0][side[i]];
		arrs[1] += cCntLUT_4[(int)l._bp][1][side[i]];
		arrs[2] += cCntLUT_4[(int)l._bp][2][side[i]];
		arrs[3] += cCntLUT_4[(int)l._bp][3][side[i]];
	}
#endif
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq 0xc8(%rdi), %rax
movzwl 0x14(%rsi), %ecx
addq (%rsi), %rax
cmpb $0x0, (%rdi)
je 0x1e41b
cmpw $0x8, %cx
jl 0x1e593
movabsq $0x5555555555555555, %rcx # imm = 0x5555555555555555
xorl %r10d, %r10d
movq %r10, %rdi
movq (%rax,%r10), %r8
movq %r8, %r9
notq %r9
movq %r9, %r10
shrq %r10
movq %r9, %r11
andq %rcx, %r11
andq %r10, %r11
popcntq %r11, %r10
movl %r10d, %r10d
addq %r10, (%rdx)
movq %r8, %r10
shrq %r10
andq %rcx, %r10
movq %r10, %r11
xorq %rcx, %r11
andq %r8, %r11
popcntq %r11, %rbx
movl %ebx, %r11d
addq %r11, 0x8(%rdx)
andq %r10, %r9
popcntq %r9, %r11
movl %r11d, %r9d
addq %r9, 0x10(%rdx)
andq %r8, %r10
popcntq %r10, %r8
movl %r8d, %r8d
addq %r8, 0x18(%rdx)
leaq 0x8(%rdi), %r10
movswq 0x14(%rsi), %r8
addq $0xf, %rdi
cmpq %r8, %rdi
jl 0x1e3a1
jmp 0x1e596
cmpw $0x8, %cx
jl 0x1e593
movabsq $0x5555555555555555, %rcx # imm = 0x5555555555555555
movabsq $0x1111111111111111, %rdi # imm = 0x1111111111111111
movabsq $0x707070707070707, %r8 # imm = 0x707070707070707
xorl %r10d, %r10d
movq %r10, %r9
movq (%rax,%r10), %r10
movq %r10, %r11
notq %r11
movq %r11, %rbx
shrq %rbx
andq %r11, %rbx
movq %rbx, %r14
andq %rdi, %r14
shrq $0x2, %rbx
andq %rdi, %rbx
addq %r14, %rbx
movq %rbx, %r14
shrq $0x4, %r14
addq %rbx, %r14
andq %r8, %r14
movq %r14, %rbx
shrq $0x8, %rbx
addq %r14, %rbx
movq %rbx, %r14
shrq $0x10, %r14
addq %rbx, %r14
movq %r14, %rbx
shrq $0x20, %rbx
addl %r14d, %ebx
andl $0x3f, %ebx
addq %rbx, (%rdx)
movq %r10, %rbx
shrq %rbx
movq %rbx, %r14
xorq %rcx, %r14
andq %r10, %r14
movq %r14, %r15
andq %rdi, %r15
shrq $0x2, %r14
andq %rdi, %r14
addq %r15, %r14
movq %r14, %r15
shrq $0x4, %r15
addq %r14, %r15
andq %r8, %r15
movq %r15, %r14
shrq $0x8, %r14
addq %r15, %r14
movq %r14, %r15
shrq $0x10, %r15
addq %r14, %r15
movq %r15, %r14
shrq $0x20, %r14
addl %r15d, %r14d
andl $0x3f, %r14d
addq %r14, 0x8(%rdx)
andq %rbx, %r11
movq %r11, %r14
andq %rdi, %r14
shrq $0x2, %r11
andq %rdi, %r11
addq %r14, %r11
movq %r11, %r14
shrq $0x4, %r14
addq %r11, %r14
andq %r8, %r14
movq %r14, %r11
shrq $0x8, %r11
addq %r14, %r11
movq %r11, %r14
shrq $0x10, %r14
addq %r11, %r14
movq %r14, %r11
shrq $0x20, %r11
addl %r14d, %r11d
andl $0x3f, %r11d
addq %r11, 0x10(%rdx)
andq %r10, %rbx
movq %rbx, %r10
andq %rdi, %r10
shrq $0x2, %rbx
andq %rdi, %rbx
addq %r10, %rbx
movq %rbx, %r10
shrq $0x4, %r10
addq %rbx, %r10
andq %r8, %r10
movq %r10, %r11
shrq $0x8, %r11
addq %r10, %r11
movq %r11, %r10
shrq $0x10, %r10
addq %r11, %r10
movq %r10, %r11
shrq $0x20, %r11
addl %r10d, %r11d
andl $0x3f, %r11d
addq %r11, 0x18(%rdx)
leaq 0x8(%r9), %r10
movswq 0x14(%rsi), %r11
addq $0xf, %r9
cmpq %r11, %r9
jl 0x1e446
jmp 0x1e596
xorl %r10d, %r10d
movswl 0x14(%rsi), %ecx
cmpl %ecx, %r10d
jge 0x1e5f5
movl %r10d, %r10d
leaq 0x18f87(%rip), %rcx     # 0x37530
movzbl (%rax,%r10), %edi
movzbl (%rcx,%rdi), %edi
addq %rdi, (%rdx)
movzbl (%rax,%r10), %edi
movzbl 0x100(%rcx,%rdi), %edi
addq %rdi, 0x8(%rdx)
movzbl (%rax,%r10), %edi
movzbl 0x200(%rcx,%rdi), %edi
addq %rdi, 0x10(%rdx)
movzbl (%rax,%r10), %edi
movzbl 0x300(%rcx,%rdi), %edi
addq %rdi, 0x18(%rdx)
incq %r10
movswq 0x14(%rsi), %rdi
cmpq %rdi, %r10
jl 0x1e5a9
movsbq 0x16(%rsi), %rdi
testq %rdi, %rdi
jle 0x1e676
shlq $0xa, %rdi
leaq 0x18f26(%rip), %rcx     # 0x37530
addq %rcx, %rdi
movl %r10d, %r8d
movzbl (%rax,%r8), %r9d
movzbl (%r9,%rdi), %edi
addq %rdi, (%rdx)
movsbq 0x16(%rsi), %rdi
movzbl (%rax,%r8), %r9d
shlq $0xa, %rdi
addq %rcx, %rdi
movzbl 0x100(%r9,%rdi), %edi
addq %rdi, 0x8(%rdx)
movsbq 0x16(%rsi), %rdi
movzbl (%rax,%r8), %r9d
shlq $0xa, %rdi
addq %rcx, %rdi
movzbl 0x200(%r9,%rdi), %edi
addq %rdi, 0x10(%rdx)
movsbq 0x16(%rsi), %rsi
movzbl (%rax,%r8), %eax
shlq $0xa, %rsi
addq %rcx, %rsi
movzbl 0x300(%rax,%rsi), %eax
addq %rax, 0x18(%rdx)
popq %rbx
popq %r14
popq %r15
retq