// File: BenLangmead[P]bowtie/./ebwt.h
// Function: Ebwt::printRangeBw(unsigned int, unsigned int) const
void Ebwt::printRangeBw(uint32_t begin, uint32_t end) const {
	assert(isInMemory());
	uint32_t occ[] = {0, 0, 0, 0};
	assert_gt(end, begin);
	for(uint32_t i = end-1; i >= begin; i--) {
		uint8_t by = this->_ebwt[i];
		for(int j = 3; j >= 0; j--) {
			// Unpack from lowest to highest bit pair
			int twoBit = unpack_2b_from_8b(by, j);
			occ[twoBit]++;
			cout << "ACGT"[twoBit];
		}
		assert_eq(0, (occ[0] + occ[1] + occ[2] + occ[3]) & 3);
		if(i == 0) break;
	}
	cout << ":{" << occ[0] << "," << occ[1] << "," << occ[2] << "," << occ[3] << "}" << endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x38(%rbp)
callq 0x18060
testb $0x1, %al
jne 0x6aa5
jmp 0x6aa7
jmp 0x6ac6
leaq 0x38602(%rip), %rdi     # 0x3f0b0
leaq 0x38608(%rip), %rsi     # 0x3f0bd
movl $0x619, %edx            # imm = 0x619
leaq 0x38680(%rip), %rcx     # 0x3f141
callq 0x51e0
leaq -0x20(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x5190
movl -0x10(%rbp), %eax
cmpl -0xc(%rbp), %eax
ja 0x6b95
movq 0x434d7(%rip), %rdi     # 0x49fc0
leaq 0x38608(%rip), %rsi     # 0x3f0f8
callq 0x5360
movq %rax, %rdi
movl -0x10(%rbp), %esi
callq 0x5530
movq %rax, %rdi
leaq 0x38604(%rip), %rsi     # 0x3f10e
callq 0x5360
movq %rax, %rdi
movl -0xc(%rbp), %esi
callq 0x5530
movq %rax, %rdi
leaq 0x3aa94(%rip), %rsi     # 0x415b8
callq 0x5360
movq %rax, %rdi
movq 0x4344d(%rip), %rsi     # 0x49f80
callq 0x53c0
movq 0x43481(%rip), %rdi     # 0x49fc0
leaq 0x38577(%rip), %rsi     # 0x3f0bd
callq 0x5360
movq %rax, %rdi
leaq 0x39c35(%rip), %rsi     # 0x4078a
callq 0x5360
movq %rax, %rdi
movl $0x61b, %esi            # imm = 0x61B
callq 0x5750
movq %rax, %rdi
movq 0x4340f(%rip), %rsi     # 0x49f80
callq 0x53c0
leaq 0x39aed(%rip), %rdi     # 0x4066a
leaq 0x38539(%rip), %rsi     # 0x3f0bd
movl $0x61b, %edx            # imm = 0x61B
leaq 0x385b1(%rip), %rcx     # 0x3f141
callq 0x51e0
movl -0x10(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0xc(%rbp), %eax
jb 0x6d7b
movq -0x38(%rbp), %rax
movq 0xc8(%rax), %rax
movl -0x24(%rbp), %ecx
movb (%rax,%rcx), %al
movb %al, -0x25(%rbp)
movl $0x3, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
jl 0x6c11
movb -0x25(%rbp), %al
movl -0x2c(%rbp), %esi
movzbl %al, %edi
callq 0x6990
movl %eax, -0x30(%rbp)
movslq -0x30(%rbp), %rax
movl -0x20(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x20(%rbp,%rax,4)
movslq -0x30(%rbp), %rcx
movq 0x433ca(%rip), %rdi     # 0x49fc0
leaq 0x38517(%rip), %rax     # 0x3f114
movsbl (%rax,%rcx), %esi
callq 0x54a0
movl -0x2c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x6bc5
movl -0x20(%rbp), %ecx
addl -0x1c(%rbp), %ecx
addl -0x18(%rbp), %ecx
addl -0x14(%rbp), %ecx
andl $0x3, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
je 0x6d63
movq 0x4338f(%rip), %rdi     # 0x49fc0
leaq 0x384e1(%rip), %rsi     # 0x3f119
callq 0x5360
movq %rax, %rdi
xorl %esi, %esi
callq 0x5750
movq %rax, %rdi
leaq 0x384de(%rip), %rsi     # 0x3f12f
callq 0x5360
movq %rax, %rdi
leaq 0x11b80(%rip), %rsi     # 0x187e0
callq 0x5120
movq %rax, %rdi
xorl %esi, %esi
callq 0x5750
movq %rax, %rdi
leaq 0x11b97(%rip), %rsi     # 0x18810
callq 0x5120
movq %rax, %rdi
leaq 0x384ac(%rip), %rsi     # 0x3f134
callq 0x5360
movq %rax, %rdi
movl -0x20(%rbp), %esi
addl -0x1c(%rbp), %esi
addl -0x18(%rbp), %esi
addl -0x14(%rbp), %esi
andl $0x3, %esi
callq 0x5530
movq %rax, %rdi
leaq 0x38481(%rip), %rsi     # 0x3f12f
callq 0x5360
movq %rax, %rdi
leaq 0x11b23(%rip), %rsi     # 0x187e0
callq 0x5120
movq %rax, %rdi
movl -0x20(%rbp), %esi
addl -0x1c(%rbp), %esi
addl -0x18(%rbp), %esi
addl -0x14(%rbp), %esi
andl $0x3, %esi
callq 0x5530
movq %rax, %rdi
leaq 0x11b2d(%rip), %rsi     # 0x18810
callq 0x5120
movq %rax, %rdi
leaq 0x3a8c6(%rip), %rsi     # 0x415b8
callq 0x5360
movq %rax, %rdi
movq 0x4327f(%rip), %rsi     # 0x49f80
callq 0x53c0
movq 0x432b3(%rip), %rdi     # 0x49fc0
leaq 0x383a9(%rip), %rsi     # 0x3f0bd
callq 0x5360
movq %rax, %rdi
leaq 0x39a67(%rip), %rsi     # 0x4078a
callq 0x5360
movq %rax, %rdi
movl $0x624, %esi            # imm = 0x624
callq 0x5750
movq %rax, %rdi
movq 0x43241(%rip), %rsi     # 0x49f80
callq 0x53c0
leaq 0x3991f(%rip), %rdi     # 0x4066a
leaq 0x3836b(%rip), %rsi     # 0x3f0bd
movl $0x624, %edx            # imm = 0x624
leaq 0x383e3(%rip), %rcx     # 0x3f141
callq 0x51e0
cmpl $0x0, -0x24(%rbp)
jne 0x6d6b
jmp 0x6d7b
jmp 0x6d6d
movl -0x24(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x6b9e
movq 0x4323e(%rip), %rdi     # 0x49fc0
leaq 0x383b3(%rip), %rsi     # 0x3f13c
callq 0x5360
movq %rax, %rdi
movl -0x20(%rbp), %esi
callq 0x5530
movq %rax, %rdi
leaq 0x38ac9(%rip), %rsi     # 0x3f86c
callq 0x5360
movq %rax, %rdi
movl -0x1c(%rbp), %esi
callq 0x5530
movq %rax, %rdi
leaq 0x38aaf(%rip), %rsi     # 0x3f86c
callq 0x5360
movq %rax, %rdi
movl -0x18(%rbp), %esi
callq 0x5530
movq %rax, %rdi
leaq 0x38a95(%rip), %rsi     # 0x3f86c
callq 0x5360
movq %rax, %rdi
movl -0x14(%rbp), %esi
callq 0x5530
movq %rax, %rdi
leaq 0x3834e(%rip), %rsi     # 0x3f13f
callq 0x5360
movq %rax, %rdi
movq 0x43180(%rip), %rsi     # 0x49f80
callq 0x53c0
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)