// File: /workspace/github_cpp_makefile_star2_O3/BenLangmead[P]bowtie/./ebwt.h
// Function: Ebwt::sanityCheckUpToSide(long) const
void Ebwt::sanityCheckUpToSide(TIndexOff upToSide) const {
	assert(isInMemory());
	TIndexOffU occ[] = {0, 0, 0, 0};
	ASSERT_ONLY(TIndexOffU occ_save[] = {0, 0});
	TIndexOffU cur = 0; // byte pointer
	const EbwtParams& eh = this->_eh;
	bool fw = false;
	while(cur < (TIndexOffU)(upToSide * eh._sideSz)) {
		assert_leq(cur + eh._sideSz, eh._ebwtTotLen);
		for(uint32_t i = 0; i < eh._sideBwtSz; i++) {
			uint8_t by = this->_ebwt[cur + (fw ? i : eh._sideBwtSz-i-1)];
			for(int j = 0; j < 4; j++) {
				// Unpack from lowest to highest bit pair
				int twoBit = unpack_2b_from_8b(by, fw ? j : 3-j);
				occ[twoBit]++;
				//if(_verbose) cout << "ACGT"[twoBit];
			}
			assert_eq(0, (occ[0] + occ[1] + occ[2] + occ[3]) % 4);
		}
		assert_eq(0, (occ[0] + occ[1] + occ[2] + occ[3]) % eh._sideBwtLen);
		if(fw) {
			// Finished forward bucket; check saved [G] and [T]
			// against the two uint32_ts encoded here
			ASSERT_ONLY(TIndexOffU *u32ebwt = reinterpret_cast<TIndexOffU*>(&this->_ebwt[cur + eh._sideBwtSz]));
			ASSERT_ONLY(TIndexOffU gs = u32ebwt[0]);
			ASSERT_ONLY(TIndexOffU ts = u32ebwt[1]);
			assert_eq(gs, occ_save[0]);
			assert_eq(ts, occ_save[1]);
			fw = false;
		} else {
			// Finished backward bucket; check current [A] and [C]
			// against the two uint32_ts encoded here
			ASSERT_ONLY(TIndexOffU *u32ebwt = reinterpret_cast<TIndexOffU*>(&this->_ebwt[cur + eh._sideBwtSz]));
			ASSERT_ONLY(TIndexOffU as = u32ebwt[0]);
			ASSERT_ONLY(TIndexOffU cs = u32ebwt[1]);
			assert(as == occ[0] || as == occ[0]-1); // one 'a' is a skipped '$' and doesn't count toward occ[]
			assert_eq(cs, occ[1]);
			ASSERT_ONLY(occ_save[0] = occ[2]); // save gs
			ASSERT_ONLY(occ_save[1] = occ[3]); // save ts
			fw = true;
		}
		cur += eh._sideSz;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %r12
movq %rdi, %rbx
callq 0xf948
testb %al, %al
je 0x60f6
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movaps %xmm0, 0x20(%rsp)
movl 0x18c(%rbx), %eax
testq %rax, %rax
sete %cl
testq %r12, %r12
sete %dl
orb %cl, %dl
jne 0x5a1c
movq %rbx, %r11
xorl %ecx, %ecx
xorl %edi, %edi
xorl %r13d, %r13d
xorl %esi, %esi
movq $0x0, 0x8(%rsp)
movq $0x0, (%rsp)
xorl %r10d, %r10d
xorl %r14d, %r14d
movq %r12, 0x10(%rsp)
addq %r10, %rax
cmpq 0x1b0(%r11), %rax
ja 0x5b53
movl 0x190(%r11), %r8d
testl %r8d, %r8d
je 0x5976
xorl %ebp, %ebp
movq %r10, 0x18(%rsp)
movl %ebp, %eax
notl %eax
addl %r8d, %eax
testb $0x1, %r14b
cmovnel %ebp, %eax
movq %r11, %rbx
movq 0xc8(%r11), %rcx
addq %r10, %rcx
movb (%rax,%rcx), %r15b
movl $0x3, %r12d
xorl %r13d, %r13d
testb $0x1, %r14b
movl %r12d, %esi
cmovnel %r13d, %esi
movzbl %r15b, %edi
callq 0x53e3
movl %eax, %eax
incq 0x20(%rsp,%rax,8)
incl %r13d
decl %r12d
cmpl $0x4, %r13d
jne 0x5903
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %r13
movq 0x30(%rsp), %rdi
movq 0x38(%rsp), %rcx
leaq (%rdi,%rcx), %r15
addq %r13, %r15
addq %rsi, %r15
movq %r15, %r12
andq $0x3, %r12
jne 0x5a2b
incl %ebp
movq %rbx, %r11
movl 0x190(%rbx), %r8d
cmpl %r8d, %ebp
movq 0x18(%rsp), %r10
jb 0x58db
movq 0x10(%rsp), %r12
jmp 0x5983
leaq (%rdi,%rcx), %r15
addq %r13, %r15
addq %rsi, %r15
xorl %r8d, %r8d
movl 0x194(%r11), %r9d
movq %r15, %rax
xorl %edx, %edx
divq %r9
testq %rdx, %rdx
jne 0x5c09
movq 0xc8(%r11), %rax
addq %r10, %rax
movq (%r8,%rax), %r15
testb $0x1, %r14b
je 0x59ce
cmpq 0x8(%rsp), %r15
jne 0x5d50
movq 0x8(%rax,%r8), %r15
cmpq (%rsp), %r15
jne 0x5e9e
xorl %r14d, %r14d
jmp 0x5a02
cmpq %rsi, %r15
sete %dl
leaq -0x1(%rsi), %r9
cmpq %r9, %r15
sete %r9b
orb %dl, %r9b
je 0x5e7f
movq 0x8(%rax,%r8), %r15
movb $0x1, %r14b
movq %rcx, (%rsp)
movq %rdi, 0x8(%rsp)
cmpq %r13, %r15
jne 0x5fcc
movl 0x18c(%r11), %eax
addq %rax, %r10
movq %rax, %rdx
imulq %r12, %rdx
cmpq %rdx, %r10
jb 0x58b4
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x31586(%rip), %rbx     # 0x36fb8
leaq 0x2678d(%rip), %rsi     # 0x2c1c6
movq %rbx, %rdi
callq 0x4310
movq %rax, %rdi
xorl %esi, %esi
callq 0x4610
leaq 0x2678a(%rip), %r14     # 0x2c1dc
movq %rax, %rdi
movq %r14, %rsi
callq 0x4310
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x18(%rax,%rcx), %edx
andl $-0x4b, %edx
orl $0x8, %edx
movl %edx, 0x18(%rax,%rcx)
movq %rax, %rdi
xorl %esi, %esi
callq 0x4610
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x18(%rax,%rcx), %edx
andl $-0x4b, %edx
orl $0x2, %edx
movl %edx, 0x18(%rax,%rcx)
leaq 0x26749(%rip), %rsi     # 0x2c1e1
movq %rax, %rdi
callq 0x4310
movq %rax, %rdi
movq %r12, %rsi
callq 0x40c0
movq %rax, %rdi
movq %r14, %rsi
callq 0x4310
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x18(%rax,%rcx), %edx
andl $-0x4b, %edx
orl $0x8, %edx
movl %edx, 0x18(%rax,%rcx)
movq %rax, %rdi
movq %r12, %rsi
callq 0x40c0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x18(%rax,%rcx), %edx
andl $-0x4b, %edx
orl $0x2, %edx
movl %edx, 0x18(%rax,%rcx)
leaq 0x288b3(%rip), %rsi     # 0x2e3a5
movq %rax, %rdi
callq 0x4310
movq %rax, %rdi
callq 0x4150
leaq 0x26661(%rip), %r14     # 0x2c16a
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4310
leaq 0x27c8d(%rip), %rsi     # 0x2d7a8
movq %rax, %rdi
callq 0x4310
movq %rax, %rdi
movl $0x640, %esi            # imm = 0x640
callq 0x4610
movq %rax, %rdi
callq 0x4150
leaq 0x27b49(%rip), %rdi     # 0x2d688
leaq 0x266da(%rip), %rcx     # 0x2c220
movq %r14, %rsi
movl $0x640, %edx            # imm = 0x640
callq 0x41c0
movq 0x3145e(%rip), %r14     # 0x36fb8
leaq 0x266ef(%rip), %rsi     # 0x2c250
movq %r14, %rdi
movq %r10, %r15
movq %r11, %rbx
callq 0x4310
movl 0x18c(%rbx), %ecx
addq %rcx, %r15
movq %rax, %rdi
movq %r15, %rsi
callq 0x40c0
leaq 0x266dd(%rip), %rsi     # 0x2c267
movq %rax, %rdi
callq 0x4310
movq 0x1b0(%rbx), %rsi
movq %rax, %rdi
callq 0x40c0
leaq 0x287fd(%rip), %rsi     # 0x2e3a5
movq %rax, %rdi
callq 0x4310
movq %rax, %rdi
callq 0x4150
leaq 0x265ab(%rip), %rbx     # 0x2c16a
movq %r14, %rdi
movq %rbx, %rsi
callq 0x4310
leaq 0x27bd7(%rip), %rsi     # 0x2d7a8
movq %rax, %rdi
callq 0x4310
movq %rax, %rdi
movl $0x637, %esi            # imm = 0x637
callq 0x4610
movq %rax, %rdi
callq 0x4150
leaq 0x27a93(%rip), %rdi     # 0x2d688
leaq 0x26624(%rip), %rcx     # 0x2c220
movq %rbx, %rsi
movl $0x637, %edx            # imm = 0x637
callq 0x41c0
movq 0x313a8(%rip), %r14     # 0x36fb8
leaq 0x265af(%rip), %rsi     # 0x2c1c6
movq %r14, %rdi
movq %r11, %rbx
callq 0x4310
movq %rax, %rdi
xorl %esi, %esi
callq 0x4610
leaq 0x265a9(%rip), %r12     # 0x2c1dc
movq %rax, %rdi
movq %r12, %rsi
callq 0x4310
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x18(%rax,%rcx), %edx
andl $-0x4b, %edx
orl $0x8, %edx
movl %edx, 0x18(%rax,%rcx)
movq %rax, %rdi
xorl %esi, %esi
callq 0x4610
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x18(%rax,%rcx), %edx
andl $-0x4b, %edx
orl $0x2, %edx
movl %edx, 0x18(%rax,%rcx)
leaq 0x26568(%rip), %rsi     # 0x2c1e1
movq %rax, %rdi
callq 0x4310
movq %rax, %rdi
movl 0x194(%rbx), %ecx
movq %r15, %rax
xorl %edx, %edx
divq %rcx
movq %rdx, %rsi
callq 0x40c0
movq %rax, %rdi
movq %r12, %rsi
callq 0x4310
movq %rax, %rdi
movq (%rax), %rax
movq -0x18(%rax), %rax
movl 0x18(%rdi,%rax), %ecx
andl $-0x4b, %ecx
orl $0x8, %ecx
movl %ecx, 0x18(%rdi,%rax)
movl 0x194(%rbx), %ecx
movq %r15, %rax
xorl %edx, %edx
divq %rcx
movq %rdx, %rsi
callq 0x40c0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x18(%rax,%rcx), %edx
andl $-0x4b, %edx
orl $0x2, %edx
movl %edx, 0x18(%rax,%rcx)
leaq 0x286b6(%rip), %rsi     # 0x2e3a5
movq %rax, %rdi
callq 0x4310
movq %rax, %rdi
callq 0x4150
leaq 0x26464(%rip), %rbx     # 0x2c16a
movq %r14, %rdi
movq %rbx, %rsi
callq 0x4310
leaq 0x27a90(%rip), %rsi     # 0x2d7a8
movq %rax, %rdi
callq 0x4310
movq %rax, %rdi
movl $0x642, %esi            # imm = 0x642
callq 0x4610
movq %rax, %rdi
callq 0x4150
leaq 0x2794c(%rip), %rdi     # 0x2d688
leaq 0x264dd(%rip), %rcx     # 0x2c220
movq %rbx, %rsi
movl $0x642, %edx            # imm = 0x642
callq 0x41c0
movq 0x31261(%rip), %rbx     # 0x36fb8
leaq 0x26468(%rip), %rsi     # 0x2c1c6
movq %rbx, %rdi
callq 0x4310
movq %rax, %rdi
movq %r15, %rsi
callq 0x40c0
leaq 0x26464(%rip), %r12     # 0x2c1dc
movq %rax, %rdi
movq %r12, %rsi
callq 0x4310
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x18(%rax,%rcx), %edx
andl $-0x4b, %edx
orl $0x8, %edx
movl %edx, 0x18(%rax,%rcx)
movq %rax, %rdi
movq %r15, %rsi
callq 0x40c0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x18(%rax,%rcx), %edx
andl $-0x4b, %edx
orl $0x2, %edx
movl %edx, 0x18(%rax,%rcx)
leaq 0x26422(%rip), %rsi     # 0x2c1e1
movq %rax, %rdi
callq 0x4310
movq %rax, %rdi
movq 0x8(%rsp), %r14
movq %r14, %rsi
callq 0x40c0
movq %rax, %rdi
movq %r12, %rsi
callq 0x4310
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x18(%rax,%rcx), %edx
andl $-0x4b, %edx
orl $0x8, %edx
movl %edx, 0x18(%rax,%rcx)
movq %rax, %rdi
movq %r14, %rsi
callq 0x40c0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x18(%rax,%rcx), %edx
andl $-0x4b, %edx
orl $0x2, %edx
movl %edx, 0x18(%rax,%rcx)
leaq 0x28587(%rip), %rsi     # 0x2e3a5
movq %rax, %rdi
callq 0x4310
movq %rax, %rdi
callq 0x4150
leaq 0x26335(%rip), %r14     # 0x2c16a
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4310
leaq 0x27961(%rip), %rsi     # 0x2d7a8
movq %rax, %rdi
callq 0x4310
movq %rax, %rdi
movl $0x649, %esi            # imm = 0x649
callq 0x4610
movq %rax, %rdi
callq 0x4150
leaq 0x2781d(%rip), %rdi     # 0x2d688
leaq 0x263ae(%rip), %rcx     # 0x2c220
movq %r14, %rsi
movl $0x649, %edx            # imm = 0x649
callq 0x41c0
leaq 0x263e8(%rip), %rdi     # 0x2c26e
leaq 0x262dd(%rip), %rsi     # 0x2c16a
leaq 0x2638c(%rip), %rcx     # 0x2c220
movl $0x652, %edx            # imm = 0x652
callq 0x41c0
movq 0x31113(%rip), %rbx     # 0x36fb8
leaq 0x2631a(%rip), %rsi     # 0x2c1c6
movq %rbx, %rdi
callq 0x4310
movq %rax, %rdi
movq %r15, %rsi
callq 0x40c0
leaq 0x26316(%rip), %r14     # 0x2c1dc
movq %rax, %rdi
movq %r14, %rsi
callq 0x4310
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x18(%rax,%rcx), %edx
andl $-0x4b, %edx
orl $0x8, %edx
movl %edx, 0x18(%rax,%rcx)
movq %rax, %rdi
movq %r15, %rsi
callq 0x40c0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x18(%rax,%rcx), %edx
andl $-0x4b, %edx
orl $0x2, %edx
movl %edx, 0x18(%rax,%rcx)
leaq 0x262d4(%rip), %rsi     # 0x2c1e1
movq %rax, %rdi
callq 0x4310
movq %rax, %rdi
movq (%rsp), %r15
movq %r15, %rsi
callq 0x40c0
movq %rax, %rdi
movq %r14, %rsi
callq 0x4310
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x18(%rax,%rcx), %edx
andl $-0x4b, %edx
orl $0x8, %edx
movl %edx, 0x18(%rax,%rcx)
movq %rax, %rdi
movq %r15, %rsi
callq 0x40c0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x18(%rax,%rcx), %edx
andl $-0x4b, %edx
orl $0x2, %edx
movl %edx, 0x18(%rax,%rcx)
leaq 0x2843a(%rip), %rsi     # 0x2e3a5
movq %rax, %rdi
callq 0x4310
movq %rax, %rdi
callq 0x4150
leaq 0x261e8(%rip), %r14     # 0x2c16a
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4310
leaq 0x27814(%rip), %rsi     # 0x2d7a8
movq %rax, %rdi
callq 0x4310
movq %rax, %rdi
movl $0x64a, %esi            # imm = 0x64A
callq 0x4610
movq %rax, %rdi
callq 0x4150
leaq 0x276d0(%rip), %rdi     # 0x2d688
leaq 0x26261(%rip), %rcx     # 0x2c220
movq %r14, %rsi
movl $0x64a, %edx            # imm = 0x64A
callq 0x41c0
movq 0x30fe5(%rip), %rbx     # 0x36fb8
leaq 0x261ec(%rip), %rsi     # 0x2c1c6
movq %rbx, %rdi
callq 0x4310
movq %rax, %rdi
movq %r15, %rsi
callq 0x40c0
leaq 0x261e8(%rip), %r14     # 0x2c1dc
movq %rax, %rdi
movq %r14, %rsi
callq 0x4310
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x18(%rax,%rcx), %edx
andl $-0x4b, %edx
orl $0x8, %edx
movl %edx, 0x18(%rax,%rcx)
movq %rax, %rdi
movq %r15, %rsi
callq 0x40c0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x18(%rax,%rcx), %edx
andl $-0x4b, %edx
orl $0x2, %edx
movl %edx, 0x18(%rax,%rcx)
leaq 0x261a6(%rip), %rsi     # 0x2c1e1
movq %rax, %rdi
callq 0x4310
movq %rax, %rdi
movq %r13, %rsi
callq 0x40c0
movq %rax, %rdi
movq %r14, %rsi
callq 0x4310
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x18(%rax,%rcx), %edx
andl $-0x4b, %edx
orl $0x8, %edx
movl %edx, 0x18(%rax,%rcx)
movq %rax, %rdi
movq %r13, %rsi
callq 0x40c0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x18(%rax,%rcx), %edx
andl $-0x4b, %edx
orl $0x2, %edx
movl %edx, 0x18(%rax,%rcx)
leaq 0x28310(%rip), %rsi     # 0x2e3a5
movq %rax, %rdi
callq 0x4310
movq %rax, %rdi
callq 0x4150
leaq 0x260be(%rip), %r14     # 0x2c16a
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4310
leaq 0x276ea(%rip), %rsi     # 0x2d7a8
movq %rax, %rdi
callq 0x4310
movq %rax, %rdi
movl $0x653, %esi            # imm = 0x653
callq 0x4610
movq %rax, %rdi
callq 0x4150
leaq 0x275a6(%rip), %rdi     # 0x2d688
leaq 0x26137(%rip), %rcx     # 0x2c220
movq %r14, %rsi
movl $0x653, %edx            # imm = 0x653
callq 0x41c0
leaq 0x26060(%rip), %rdi     # 0x2c15d
leaq 0x26066(%rip), %rsi     # 0x2c16a
leaq 0x26115(%rip), %rcx     # 0x2c220
movl $0x630, %edx            # imm = 0x630
callq 0x41c0
nop