// File: /workspace/github_cpp_makefile_star2_O1/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, 0x38(%rsp)
movq %rdi, %rbx
leaq 0x8(%rsp), %r14
movl %esi, (%r14)
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
leaq 0x50(%rsp), %rcx
movq %rax, -0x8(%rcx)
xorl %r13d, %r13d
movq %r13, (%rcx)
movq $0x80, 0x8(%rcx)
movq %r13, 0x10(%rcx)
movl %edx, %r15d
subl %esi, %r15d
leaq 0x20(%rsp), %r8
movq %r13, (%r8)
movw %r13w, 0x8(%r8)
movb $0x1, %al
movb %al, 0xa(%r8)
movw $0xffff, %cx            # imm = 0xFFFF
movw %cx, 0xc(%r8)
movb $-0x1, %dil
movb %dil, 0xe(%r8)
leaq 0x10(%rsp), %r9
movq %r13, (%r9)
movw %r13w, 0x8(%r9)
movb %al, 0xa(%r9)
movw %cx, 0xc(%r9)
movb %dil, 0xe(%r9)
movq 0x58(%rbx), %rax
movq 0xb8(%rax), %rcx
addq $0xf8, %rax
movl %esi, %edi
movl %edx, %esi
movq %rax, %rdx
callq 0x2bf4e
movl (%r14), %eax
leaq 0x4(%rsp), %rcx
movl %eax, (%rcx)
leaq 0x8(%rbx), %rax
movq %rax, 0x30(%rsp)
leaq 0x10(%rbx), %r14
movq %r15, 0x40(%rsp)
movq 0x58(%rbx), %rdi
movq 0xb8(%rdi), %rax
movl 0x20(%rsp), %ecx
addq %rax, %rcx
movswq 0x2c(%rsp), %rdx
movzbl (%rdx,%rcx), %edx
movb 0x2e(%rsp), %cl
addb %cl, %cl
shrl %cl, %edx
movl 0x10(%rsp), %ecx
addq %rax, %rcx
movswq 0x1c(%rsp), %rax
movzbl (%rax,%rcx), %eax
movb 0x1e(%rsp), %cl
addb %cl, %cl
shrl %cl, %eax
andl $0x3, %edx
andl $0x3, %eax
cmpl %eax, %edx
jne 0x3294e
cmpb $0x1, 0x2a(%rsp)
jne 0x3278c
cmpb $0x0, 0x17d(%rdi)
je 0x32798
leaq 0x20(%rsp), %rsi
callq 0x1d6b6
jmp 0x327a2
leaq 0x20(%rsp), %rsi
callq 0x1d872
jmp 0x327a2
leaq 0x20(%rsp), %rsi
callq 0x1d4e6
movl %eax, 0x4(%rsp)
movq 0x58(%rbx), %rdi
movl 0x10(%rsp), %eax
addq 0xb8(%rdi), %rax
movswq 0x1c(%rsp), %rcx
movzbl (%rcx,%rax), %edx
movb 0x1e(%rsp), %cl
addb %cl, %cl
shrl %cl, %edx
andl $0x3, %edx
cmpb $0x1, 0x1a(%rsp)
jne 0x327e6
cmpb $0x0, 0x17d(%rdi)
je 0x327f2
leaq 0x10(%rsp), %rsi
callq 0x1d6b6
jmp 0x327fc
leaq 0x10(%rsp), %rsi
callq 0x1d872
jmp 0x327fc
leaq 0x10(%rsp), %rsi
callq 0x1d4e6
movl %eax, %r12d
movl 0x4(%rsp), %eax
movl %r12d, %ecx
subl %eax, %ecx
cmpl %r15d, %ecx
jne 0x3294e
movq 0x18(%rbx), %rdx
movq %r14, %rcx
testq %rdx, %rdx
je 0x32837
movq %r14, %rcx
xorl %esi, %esi
cmpl %eax, 0x20(%rdx)
setb %sil
cmovaeq %rdx, %rcx
movq 0x10(%rdx,%rsi,8), %rdx
testq %rdx, %rdx
jne 0x32820
movq %r14, %rbp
cmpq %r14, %rcx
je 0x32849
cmpl 0x20(%rcx), %eax
cmovbq %r14, %rcx
movq %rcx, %rbp
incl %r13d
cmpq %r14, %rbp
je 0x32909
movl 0x24(%rbp), %r12d
movq 0x40(%rbx), %rax
movl (%rax,%r12,4), %ecx
testl %ecx, %ecx
jns 0x32873
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
addl %ecx, %r13d
movl 0x4(%rax,%r12,4), %r12d
movl 0x3c(%rbx), %ecx
leal 0x2(%rcx), %edx
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
cmpl 0x38(%rbx), %edx
ja 0x328a5
movl $0x0, (%rax,%rcx,4)
movl 0x38(%rbx), %eax
movl 0x3c(%rbx), %edx
addl $0x2, %edx
movl %edx, 0x3c(%rbx)
subl %edx, %eax
cmpl $0x9, %eax
ja 0x328a2
movb $0x1, 0x48(%rbx)
movl %ecx, %r15d
cmpl $-0x1, %r15d
je 0x328d5
movq 0x40(%rbx), %rax
movl %r15d, %ecx
movl %r13d, %edx
orl $0x80000000, %edx       # imm = 0x80000000
movl %edx, (%rax,%rcx,4)
movl %r12d, 0x4(%rax,%rcx,4)
movq 0x30(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x32ad6
movl %r15d, (%rax)
movl 0x8(%rsp), %eax
movq 0x58(%rbx), %rcx
movq 0x38(%rsp), %rdx
movq %rcx, 0x18(%rdx)
movl %eax, (%rdx)
movl %r13d, 0x4(%rdx)
movq 0x40(%rbx), %rax
movl %r12d, %ecx
leaq 0x4(%rax,%rcx,4), %rax
movl -0x4(%rax), %ecx
movl %ecx, 0x8(%rdx)
movq %rax, 0x10(%rdx)
movq 0x40(%rsp), %r15
jmp 0x32940
leaq 0x48(%rsp), %rdi
leaq 0x4(%rsp), %rsi
callq 0x22e84
movl 0x4(%rsp), %edi
movq 0x58(%rbx), %rdx
movq 0xb8(%rdx), %rcx
addq $0xf8, %rdx
movl %r12d, %esi
leaq 0x20(%rsp), %r8
leaq 0x10(%rsp), %r9
callq 0x2bf4e
cmpq %r14, %rbp
je 0x32725
jmp 0x32a6a
movl %r15d, %ecx
incl %ecx
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
js 0x3298b
movl 0x3c(%rbx), %eax
leal (%rax,%r15), %edx
incl %edx
cmpl 0x38(%rbx), %edx
ja 0x3298b
movq 0x40(%rbx), %rdx
movl $0x0, (%rdx,%rax,4)
addl 0x3c(%rbx), %ecx
movl %ecx, 0x3c(%rbx)
movl 0x38(%rbx), %edx
subl %ecx, %edx
cmpl $0x9, %edx
ja 0x32988
movb $0x1, 0x48(%rbx)
movl %eax, %r14d
cmpl $-0x1, %r14d
setne %bpl
je 0x32a6d
movq 0x40(%rbx), %rax
movl %r14d, %r13d
movl %r15d, (%rax,%r13,4)
movl 0x8(%rsp), %eax
movl %eax, 0xc(%rsp)
movq 0x60(%rsp), %r12
testq %r12, %r12
je 0x329c6
movq 0x50(%rsp), %rax
movl -0x4(%rax,%r12,4), %eax
movl %eax, 0xc(%rsp)
jmp 0x329c9
xorl %r12d, %r12d
leaq 0xc(%rsp), %rsi
movq 0x30(%rsp), %rdi
callq 0x32ad6
movl %r14d, (%rax)
movl 0xc(%rsp), %eax
movq 0x58(%rbx), %rcx
movq 0x38(%rsp), %rdx
movq %rcx, 0x18(%rdx)
movl %eax, (%rdx)
movl %r12d, 0x4(%rdx)
movq 0x40(%rbx), %rax
leaq 0x4(%rax,%r13,4), %rax
movl -0x4(%rax), %ecx
movl %ecx, 0x8(%rdx)
movq %rax, 0x10(%rdx)
testl %r12d, %r12d
je 0x32a6a
movl 0x3c(%rbx), %eax
leal 0x2(%rax), %ecx
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl 0x38(%rbx), %ecx
ja 0x32a3e
movq 0x40(%rbx), %rcx
movl $0x0, (%rcx,%rax,4)
movl 0x38(%rbx), %ecx
movl 0x3c(%rbx), %edx
addl $0x2, %edx
movl %edx, 0x3c(%rbx)
subl %edx, %ecx
cmpl $0x9, %ecx
ja 0x32a3c
movb $0x1, 0x48(%rbx)
movl %eax, %ebp
cmpl $-0x1, %ebp
je 0x32a6a
movq 0x40(%rbx), %rax
movl %ebp, %ecx
orl $0x80000000, %r12d      # imm = 0x80000000
movl %r12d, (%rax,%rcx,4)
movl %r14d, 0x4(%rax,%rcx,4)
leaq 0x8(%rsp), %rsi
movq 0x30(%rsp), %rdi
callq 0x32ad6
movl %ebp, (%rax)
movb $0x1, %bpl
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x32a8f
callq 0x95e0
xorps %xmm0, %xmm0
leaq 0x50(%rsp), %rax
movups %xmm0, (%rax)
movq $0x0, 0x10(%rax)
movl %ebp, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x32aa8
jmp 0x32aa8
jmp 0x32aa8
jmp 0x32aa8
movq %rax, %rbx
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x32acd
callq 0x95e0
xorps %xmm0, %xmm0
leaq 0x50(%rsp), %rax
movups %xmm0, (%rax)
movq $0x0, 0x10(%rax)
movq %rbx, %rdi
callq 0x9930
nop