// File: BenLangmead[P]bowtie/./range_source.h
// Function: Branch::init(AllocOnlyPool<RangeState>&, AllocOnlyPool<Edit>&, unsigned int, unsigned int, unsigned short, unsigned short, unsigned short, unsigned short, unsigned short, unsigned short, unsigned short, unsigned short, unsigned int, unsigned int, EbwtParams const&, unsigned char const*, EditList const*)
bool init(AllocOnlyPool<RangeState>& rsPool,
	          AllocOnlyPool<Edit>& epool,
	          uint32_t id,
	          uint32_t qlen,
	          uint16_t depth0,
	          uint16_t depth1,
	          uint16_t depth2,
	          uint16_t depth3,
	          uint16_t rdepth,
	          uint16_t len,
	          uint16_t cost,
	          uint16_t ham,
	          TIndexOffU itop,
	          TIndexOffU ibot,
	          const EbwtParams& ep,
	          const uint8_t* ebwt,
	          const EditList* edits = NULL)
	{
		id_ = id;
		delayedCost_ = 0;
		depth0_ = depth0;
		depth1_ = depth1;
		depth2_ = depth2;
		depth3_ = depth3;
		assert_gt(depth3_, 0);
		rdepth_ = rdepth;
		len_ = len;
		cost_ = cost;
		ham_ = ham;
		top_ = itop;
		bot_ = ibot;

		if(ibot > itop+1) {
			// Care about both top and bot
			SideLocus::initFromTopBot(itop, ibot, ep, ebwt, ltop_, lbot_);
		} else if(ibot > itop) {
			// Only care about top
			ltop_.initFromRow(itop, ep, ebwt);
			lbot_.invalidate();
		}
		if(qlen - rdepth_ > 0) {
			ranges_ = rsPool.allocC(qlen - rdepth_); // allocated from the RangeStatePool
			if(ranges_ == NULL) {
				return false; // RangeStatePool exhausted
			}
			rangesSz_ = qlen - rdepth_;
		} else {
			ranges_ = NULL;
			rangesSz_ = 0;
		}
#ifndef NDEBUG
		for(size_t i = 0; i < (qlen - rdepth_); i++) {
			for(int j = 0; j < 4; j++) {
				assert_eq(0, ranges_[i].tops[j]);
				assert_eq(0, ranges_[i].bots[j]);
			}
		}
#endif
		curtailed_ = false;
		exhausted_ = false;
		prepped_ = true;
		delayedIncrease_ = false;
		edits_.clear();
		if(edits != NULL) {
			const size_t numEdits = edits->size();
			for(size_t i = 0; i < numEdits; i++) {
				edits_.add(edits->get(i), epool, qlen);
			}
		}
		// If we're starting with a non-zero length, that means we're
		// jumping over a bunch of unrevisitable positions.
		for(size_t i = 0; i < len_; i++) {
			ranges_[i].eliminated_ = true;
			assert(eliminated((int)i));
		}
		assert(repOk(qlen));
		return true;
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movw %r9w, %ax
movq 0x68(%rbp), %r9
movq 0x60(%rbp), %r9
movq 0x58(%rbp), %r9
movl 0x50(%rbp), %r9d
movl 0x48(%rbp), %r9d
movw 0x40(%rbp), %r9w
movw 0x38(%rbp), %r9w
movw 0x30(%rbp), %r9w
movw 0x28(%rbp), %r9w
movw 0x20(%rbp), %r9w
movw 0x18(%rbp), %r9w
movw 0x10(%rbp), %r9w
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movl %r8d, -0x28(%rbp)
movw %ax, -0x2a(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x50(%rbp)
movl -0x24(%rbp), %ecx
movl %ecx, (%rax)
movw $0x0, 0x80(%rax)
movw -0x2a(%rbp), %cx
movw %cx, 0x4(%rax)
movw 0x10(%rbp), %cx
movw %cx, 0x6(%rax)
movw 0x18(%rbp), %cx
movw %cx, 0x8(%rax)
movw 0x20(%rbp), %cx
movw %cx, 0xa(%rax)
movw 0x28(%rbp), %cx
movw %cx, 0xc(%rax)
movw 0x30(%rbp), %cx
movw %cx, 0xe(%rax)
movw 0x38(%rbp), %cx
movw %cx, 0x10(%rax)
movw 0x40(%rbp), %cx
movw %cx, 0x12(%rax)
movl 0x48(%rbp), %ecx
movl %ecx, 0x24(%rax)
movl 0x50(%rbp), %ecx
movl %ecx, 0x28(%rax)
movl 0x50(%rbp), %eax
movl 0x48(%rbp), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
jbe 0x40d2d
movq -0x50(%rbp), %r9
movl 0x48(%rbp), %edi
movl 0x50(%rbp), %esi
movq 0x58(%rbp), %rdx
movq 0x60(%rbp), %rcx
movq %r9, %r8
addq $0x2c, %r8
addq $0x3c, %r9
callq 0x419e0
jmp 0x40d5c
movl 0x50(%rbp), %eax
cmpl 0x48(%rbp), %eax
jbe 0x40d5a
movq -0x50(%rbp), %rdi
addq $0x2c, %rdi
movl 0x48(%rbp), %esi
movq 0x58(%rbp), %rdx
movq 0x60(%rbp), %rcx
callq 0x24f80
movq -0x50(%rbp), %rdi
addq $0x3c, %rdi
callq 0x41b30
jmp 0x40d5c
movq -0x50(%rbp), %rcx
movl -0x28(%rbp), %eax
movzwl 0xc(%rcx), %ecx
subl %ecx, %eax
cmpl $0x0, %eax
jbe 0x40db2
movq -0x50(%rbp), %rax
movq -0x18(%rbp), %rdi
movl -0x28(%rbp), %esi
movzwl 0xc(%rax), %eax
subl %eax, %esi
callq 0x41b50
movq %rax, %rcx
movq -0x50(%rbp), %rax
movq %rcx, 0x18(%rax)
cmpq $0x0, 0x18(%rax)
jne 0x40d9f
movb $0x0, -0x1(%rbp)
jmp 0x40e90
movq -0x50(%rbp), %rax
movl -0x28(%rbp), %ecx
movzwl 0xc(%rax), %edx
subl %edx, %ecx
movw %cx, 0x20(%rax)
jmp 0x40dc4
movq -0x50(%rbp), %rax
movq $0x0, 0x18(%rax)
movw $0x0, 0x20(%rax)
movq -0x50(%rbp), %rdi
movb $0x0, 0x82(%rdi)
movb $0x0, 0x83(%rdi)
movb $0x1, 0x84(%rdi)
movb $0x0, 0x85(%rdi)
addq $0x50, %rdi
callq 0x41ba0
cmpq $0x0, 0x68(%rbp)
je 0x40e51
movq 0x68(%rbp), %rdi
callq 0x41bd0
movq %rax, -0x38(%rbp)
movq $0x0, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpq -0x38(%rbp), %rax
jae 0x40e4f
movq -0x50(%rbp), %rax
addq $0x50, %rax
movq %rax, -0x58(%rbp)
movq 0x68(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x41d50
movq -0x58(%rbp), %rdi
movq %rax, %rsi
movq -0x20(%rbp), %rdx
movl -0x28(%rbp), %eax
movl %eax, %ecx
callq 0x41bf0
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x40e09
jmp 0x40e51
movq $0x0, -0x48(%rbp)
movq -0x50(%rbp), %rcx
movq -0x48(%rbp), %rax
movzwl 0xe(%rcx), %ecx
cmpq %rcx, %rax
jae 0x40e8c
movq -0x50(%rbp), %rax
movq 0x18(%rax), %rax
imulq $0x30, -0x48(%rbp), %rcx
addq %rcx, %rax
movb $0x1, 0x28(%rax)
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x40e59
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax,%rax)