// File: /workspace/github_cpp_makefile_star2_O3/BenLangmead[P]bowtie/./range_cache.h
// Function: RangeCache::tunnel(unsigned int, unsigned int, RangeCacheEntry&)
bool tunnel(TIndexOffU top, TIndexOffU bot, RangeCacheEntry& ent) {
		assert_gt(bot, top);
		TUVec tops;
		const TIndexOffU spread = bot - top;
		SideLocus tloc, bloc;
		SideLocus::initFromTopBot(top, bot, ebwt_->_eh, ebwt_->_ebwt, tloc, bloc);
		TIndexOffU newtop = top, newbot = bot;
		TIndexOffU jumps = 0;
		// Walk left through the tunnel
		while(true) {
			if(ebwt_->rowL(tloc) != ebwt_->rowL(bloc)) {
				// Different characters at top and bot positions of
				// BWT; this means that the calls to mapLF below are
				// guaranteed to yield rows in two different character-
				// sections of the BWT.
				break;
			}
			// Advance top and bot
			newtop = ebwt_->mapLF(tloc);
			newbot = ebwt_->mapLF(bloc);
			assert_geq(newbot, newtop);
			assert_leq(newbot - newtop, spread);
			// If the new spread is the same as the old spread, we can
			// be confident that the new range includes all of the same
			// suffixes as the last range (though longer by 1 char)
			if((newbot - newtop) == spread) {
				// Check if newtop is already cached
				TMapItr itr = map_.find(newtop);
				jumps++;
				if(itr != map_.end()) {
					// This range, which is further to the left in the
					// same tunnel as the query range, has a cache
					// entry already, so use that
					TIndexOffU idx = itr->second;
					TIndexOffU *ents = pool_.get(idx);
					if((ents[0] & CACHE_WRAPPER_BIT) != 0) {
						// The cache entry we found was a wrapper; make
						// a new wrapper that points to that wrapper's
						// target, with the appropriate number of jumps
						jumps += (ents[0] & ~CACHE_WRAPPER_BIT);
						idx = ents[1];
					}
					// Allocate a new wrapper
					TIndexOffU newentIdx = pool_.alloc(2);
					if(newentIdx != RANGE_CACHE_BAD_ALLOC) {
						// We successfully made a new wrapper entry;
						// now populate it and install it in map_
						TIndexOffU *newent = pool_.get(newentIdx); // get ptr to it
						assert_eq(0, newent[0]);
						newent[0] = CACHE_WRAPPER_BIT | jumps; // set jumps
						newent[1] = idx;                // set target
						assert(map_.find(top) == map_.end());
						map_[top] = newentIdx;
						if(sanity_) assert(repOk());
					}
					// Initialize the entry
					ent.init(pool_, top, jumps, idx, ebwt_);
					return true;
				}
				// Save this range
				tops.push_back(newtop);
				SideLocus::initFromTopBot(newtop, newbot, ebwt_->_eh, ebwt_->_ebwt, tloc, bloc);
			} else {
				// Not all the suffixes were preserved, so we can't
				// link the source range's cached result to this
				// range's cached results
				break;
			}
			assert_eq(jumps, tops.size());
		}
		assert_eq(jumps, tops.size());
		// Try to create a new cache entry for the leftmost range in
		// the tunnel (which might be the query range)
		TIndexOffU newentIdx = pool_.alloc(spread + 1);
		if(newentIdx != RANGE_CACHE_BAD_ALLOC) {
			// Successfully allocated new range cache entry; install it
			TIndexOffU *newent = pool_.get(newentIdx);
			assert_eq(0, newent[0]);
			// Store cache-range length in first word
			newent[0] = spread;
			assert_lt(newent[0], CACHE_WRAPPER_BIT);
			assert_eq(spread, newent[0]);
			TIndexOffU entTop = top;
			TIndexOffU jumps = 0;
			if(tops.size() > 0) {
				entTop = tops.back();
				jumps = (TIndexOff)tops.size();
			}
			// Cache the entry for the end of the tunnel
			assert(map_.find(entTop) == map_.end());
			map_[entTop] = newentIdx;
			if(sanity_) assert(repOk());
			ent.init(pool_, entTop, jumps, newentIdx, ebwt_);
			assert_eq(spread, newent[0]);
			if(jumps > 0) {
				assert_neq(entTop, top);
				// Cache a wrapper entry for the query range (if possible)
				TIndexOffU wrapentIdx = pool_.alloc(2);
				if(wrapentIdx != RANGE_CACHE_BAD_ALLOC) {
					TIndexOffU *wrapent = pool_.get(wrapentIdx);
					assert_eq(0, wrapent[0]);
					wrapent[0] = CACHE_WRAPPER_BIT | jumps;
					wrapent[1] = newentIdx;
					assert(map_.find(top) == map_.end());
					map_[top] = wrapentIdx;
					if(sanity_) assert(repOk());
				}
			}
			return true;
		} else {
			// Could not allocate new range cache entry
			return false;
		}
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rcx, 0x28(%rsp)
movl %esi, %r14d
movq %rdi, %rbx
movl %esi, 0x10(%rsp)
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
leaq 0x48(%rsp), %rcx
movq %rax, (%rcx)
xorl %ebp, %ebp
movq %rbp, 0x8(%rcx)
movq $0x80, 0x10(%rcx)
movq %rbp, 0x18(%rcx)
movl %edx, %eax
subl %esi, %eax
movq %rax, 0x30(%rsp)
leaq 0x38(%rsp), %r12
movq %rbp, (%r12)
movw %bp, 0x8(%r12)
movb $0x1, %al
movb %al, 0xa(%r12)
movw $0xffff, %cx            # imm = 0xFFFF
movw %cx, 0xc(%r12)
movb $-0x1, %sil
movb %sil, 0xe(%r12)
leaq 0x18(%rsp), %r13
movq %rbp, (%r13)
movw %bp, 0x8(%r13)
movb %al, 0xa(%r13)
movw %cx, 0xc(%r13)
movb %sil, 0xe(%r13)
movq 0x58(%rdi), %rax
movq 0xb8(%rax), %rcx
addq $0xf8, %rax
movl %r14d, %edi
movl %edx, %esi
movq %rax, %rdx
movq %r12, %r8
movq %r13, %r9
callq 0x2bb86
leaq 0xc(%rsp), %rax
movl %r14d, (%rax)
leaq 0x10(%rbx), %r15
movq 0x58(%rbx), %rdi
movq 0xb8(%rdi), %rax
movl 0x38(%rsp), %ecx
addq %rax, %rcx
movswq 0x44(%rsp), %rdx
movzbl (%rdx,%rcx), %edx
movb 0x46(%rsp), %cl
addb %cl, %cl
shrl %cl, %edx
movl 0x18(%rsp), %ecx
addq %rax, %rcx
movswq 0x24(%rsp), %rax
movzbl (%rax,%rcx), %eax
movb 0x26(%rsp), %cl
addb %cl, %cl
shrl %cl, %eax
andl $0x3, %edx
andl $0x3, %eax
cmpl %eax, %edx
jne 0x32390
cmpb $0x1, 0x42(%rsp)
jne 0x322aa
cmpb $0x0, 0x17d(%rdi)
je 0x322b4
movq %r12, %rsi
callq 0x1d45a
jmp 0x322bc
movq %r12, %rsi
callq 0x1d61a
jmp 0x322bc
movq %r12, %rsi
callq 0x1d276
movl %eax, 0xc(%rsp)
movq 0x58(%rbx), %rdi
movl 0x18(%rsp), %eax
addq 0xb8(%rdi), %rax
movswq 0x24(%rsp), %rcx
movzbl (%rcx,%rax), %edx
movb 0x26(%rsp), %cl
addb %cl, %cl
shrl %cl, %edx
andl $0x3, %edx
cmpb $0x1, 0x22(%rsp)
jne 0x322fe
cmpb $0x0, 0x17d(%rdi)
je 0x32308
movq %r13, %rsi
callq 0x1d45a
jmp 0x32310
movq %r13, %rsi
callq 0x1d61a
jmp 0x32310
movq %r13, %rsi
callq 0x1d276
movl %eax, %r14d
movl 0xc(%rsp), %eax
movl %r14d, %ecx
subl %eax, %ecx
cmpl 0x30(%rsp), %ecx
jne 0x32390
movq 0x18(%rbx), %rdx
testq %rdx, %rdx
je 0x32356
movq %r15, %rcx
xorl %esi, %esi
cmpl %eax, 0x20(%rdx)
setb %sil
cmovaeq %rdx, %rcx
movq 0x10(%rdx,%rsi,8), %rdx
testq %rdx, %rdx
jne 0x3232e
cmpq %r15, %rcx
je 0x32356
incl %ebp
cmpl 0x20(%rcx), %eax
jb 0x32358
jmp 0x324b5
incl %ebp
leaq 0x48(%rsp), %rdi
leaq 0xc(%rsp), %rsi
callq 0x22bde
movl 0xc(%rsp), %edi
movq 0x58(%rbx), %rdx
movq 0xb8(%rdx), %rcx
addq $0xf8, %rdx
movl %r14d, %esi
movq %r12, %r8
movq %r13, %r9
callq 0x2bb86
jmp 0x32245
xorl %ebp, %ebp
movq 0x30(%rsp), %rdx
movl %edx, %eax
incl %eax
js 0x3255c
movl 0x3c(%rbx), %r15d
leal (%r15,%rdx), %ecx
incl %ecx
cmpl 0x38(%rbx), %ecx
ja 0x3255c
movq 0x40(%rbx), %rcx
movl $0x0, (%rcx,%r15,4)
addl 0x3c(%rbx), %eax
movl %eax, 0x3c(%rbx)
movl 0x38(%rbx), %ecx
subl %eax, %ecx
cmpl $0x9, %ecx
ja 0x323d4
movb $0x1, 0x48(%rbx)
xorl %ebp, %ebp
cmpl $-0x1, %r15d
je 0x3255c
movq 0x40(%rbx), %rax
movl %edx, (%rax,%r15,4)
movl 0x10(%rsp), %eax
movl %eax, 0x14(%rsp)
movq 0x60(%rsp), %rax
testq %rax, %rax
je 0x32409
movq 0x50(%rsp), %rcx
movl -0x4(%rcx,%rax,4), %ecx
movl %ecx, 0x14(%rsp)
movl %eax, %ebp
leaq 0x8(%rbx), %r14
leaq 0x14(%rsp), %rsi
movq %r14, %rdi
callq 0x3259e
movl %r15d, (%rax)
movl 0x14(%rsp), %eax
movq 0x58(%rbx), %rcx
movq 0x28(%rsp), %rdx
movq %rcx, 0x18(%rdx)
movl %eax, (%rdx)
movl %ebp, 0x4(%rdx)
movq 0x40(%rbx), %rax
leaq 0x4(%rax,%r15,4), %rax
movl -0x4(%rax), %ecx
movl %ecx, 0x8(%rdx)
movq %rax, 0x10(%rdx)
testl %ebp, %ebp
je 0x32559
movl 0x3c(%rbx), %r12d
leal 0x2(%r12), %eax
cmpl 0x38(%rbx), %eax
ja 0x32559
movq 0x40(%rbx), %rax
movl $0x0, (%rax,%r12,4)
movl 0x38(%rbx), %eax
movl 0x3c(%rbx), %ecx
addl $0x2, %ecx
movl %ecx, 0x3c(%rbx)
subl %ecx, %eax
cmpl $0x9, %eax
ja 0x32483
movb $0x1, 0x48(%rbx)
cmpl $-0x1, %r12d
je 0x32559
movq 0x40(%rbx), %rax
orl $0x80000000, %ebp       # imm = 0x80000000
movl %ebp, (%rax,%r12,4)
movl %r15d, 0x4(%rax,%r12,4)
leaq 0x10(%rsp), %rsi
movq %r14, %rdi
callq 0x3259e
movl %r12d, (%rax)
jmp 0x32559
movl 0x24(%rcx), %r14d
movq 0x40(%rbx), %rax
movl (%rax,%r14,4), %ecx
testl %ecx, %ecx
jns 0x324d2
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
addl %ecx, %ebp
movl 0x4(%rax,%r14,4), %r14d
movl 0x3c(%rbx), %r15d
leal 0x2(%r15), %ecx
cmpl 0x38(%rbx), %ecx
ja 0x3252a
movl $0x0, (%rax,%r15,4)
movl 0x38(%rbx), %eax
movl 0x3c(%rbx), %ecx
addl $0x2, %ecx
movl %ecx, 0x3c(%rbx)
subl %ecx, %eax
cmpl $0x9, %eax
ja 0x324fe
movb $0x1, 0x48(%rbx)
cmpl $-0x1, %r15d
je 0x3252a
leaq 0x8(%rbx), %rdi
movq 0x40(%rbx), %rax
movl %ebp, %ecx
orl $0x80000000, %ecx       # imm = 0x80000000
movl %ecx, (%rax,%r15,4)
movl %r14d, 0x4(%rax,%r15,4)
leaq 0x10(%rsp), %rsi
callq 0x3259e
movl %r15d, (%rax)
movl 0x10(%rsp), %eax
movq 0x58(%rbx), %rcx
movq 0x28(%rsp), %rdx
movq %rcx, 0x18(%rdx)
movl %eax, (%rdx)
movl %ebp, 0x4(%rdx)
movq 0x40(%rbx), %rax
movl %r14d, %ecx
leaq (%rax,%rcx,4), %rax
addq $0x4, %rax
movl -0x4(%rax), %ecx
movl %ecx, 0x8(%rdx)
movq %rax, 0x10(%rdx)
movb $0x1, %bpl
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x3256b
callq 0x95e0
movl %ebp, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x32584
jmp 0x32584
jmp 0x32584
jmp 0x32584
movq %rax, %rbx
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x32596
callq 0x95e0
movq %rbx, %rdi
callq 0x9930