// File: /workspace/github_cpp_makefile_star2_O1/BenLangmead[P]bowtie/./blockwise_sa.h
// Function: KarkkainenBlockwiseSA<S2bDnaString>::tieBreakingLcp(unsigned int, unsigned int, unsigned int&, bool&)
inline
bool KarkkainenBlockwiseSA<TStr>::tieBreakingLcp(TIndexOffU aOff,
						 TIndexOffU bOff,
						 TIndexOffU& lcp,
						 bool& lcpIsSoft)
{
	const TStr& t = this->text();
	TIndexOffU c = 0;
	TIndexOffU tlen = TIndexOffU(t.length());
	assert_leq(aOff, tlen);
	assert_leq(bOff, tlen);
	assert(_dc != NULL);
	uint32_t dcDist = _dc->tieBreakOff(aOff, bOff);
	lcpIsSoft = false; // hard until proven soft
	while(c < dcDist &&    // we haven't hit the tie breaker
	      c < tlen-aOff && // we haven't fallen off of LHS suffix
	      c < tlen-bOff && // we haven't fallen off of RHS suffix
	      t[aOff+c] == t[bOff+c]) // we haven't hit a mismatch
		c++;
	lcp = c;
	if(c == tlen-aOff) {
		// Fell off LHS (a), a is greater
		return false;
	} else if(c == tlen-bOff) {
		// Fell off RHS (b), b is greater
		return true;
	} else if(c == dcDist) {
		// Hit a tie-breaker element
		lcpIsSoft = true;
		assert_neq(dcDist, 0xffffffff);
		return _dc->breakTie(aOff+c, bOff+c) < 0;
	} else {
		assert_neq(t[aOff+c], t[bOff+c]);
		return t[aOff+c] < t[bOff+c];
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, %r13
movq %rcx, 0x10(%rsp)
movl %edx, %ebx
movl %esi, %r14d
movq %rdi, %r12
movq 0x8(%rdi), %rbp
movq 0x78(%rdi), %rdi
movl 0x18(%rbp), %r15d
callq 0x11c6e
movq %r13, 0x8(%rsp)
movb $0x0, (%r13)
movl %r15d, %esi
subl %r14d, %esi
cmpl %esi, %eax
movl %esi, %edi
cmovbl %eax, %edi
subl %ebx, %r15d
cmpl %edi, %r15d
cmovbl %r15d, %edi
testl %edi, %edi
je 0x2bad6
movq 0x8(%rbp), %r8
leal (%rbx,%rbx), %r9d
leal (%r14,%r14), %r10d
xorl %edx, %edx
leal (%r14,%rdx), %ecx
shrl $0x4, %ecx
movl (%r8,%rcx,4), %r11d
movl %r10d, %ecx
andb $0x1e, %cl
shrl %cl, %r11d
leal (%rbx,%rdx), %ecx
shrl $0x4, %ecx
movl (%r8,%rcx,4), %r13d
movl %r9d, %ecx
andb $0x1e, %cl
shrl %cl, %r13d
xorl %r11d, %r13d
testb $0x3, %r13b
jne 0x2bad8
incl %edx
addl $0x2, %r9d
addl $0x2, %r10d
cmpl %edx, %edi
jne 0x2ba94
movl %edi, %edx
jmp 0x2bad8
xorl %edx, %edx
movq 0x10(%rsp), %rcx
movl %edx, (%rcx)
cmpl %esi, %edx
jne 0x2baea
xorl %ecx, %ecx
jmp 0x2bb81
movb $0x1, %cl
cmpl %r15d, %edx
je 0x2bb81
cmpl %eax, %edx
jne 0x2bb4d
movq 0x8(%rsp), %rax
movb $0x1, (%rax)
movq 0x78(%r12), %rax
addl %edx, %r14d
addl %edx, %ebx
movl 0xbc(%rax), %edx
notl %edx
movl %r14d, %esi
andl %edx, %esi
andl %ebx, %edx
movq 0xa0(%rax), %rdi
movb 0xb8(%rax), %cl
shrl %cl, %r14d
shrl %cl, %ebx
movl (%rdi,%rsi,4), %ecx
movl (%rdi,%rdx,4), %edx
movq 0x60(%rax), %rsi
movq 0x80(%rax), %rax
addl (%rsi,%rcx,4), %r14d
addl (%rsi,%rdx,4), %ebx
movl (%rax,%r14,4), %ecx
cmpl (%rax,%rbx,4), %ecx
jmp 0x2bb7e
addl %edx, %r14d
movq 0x8(%rbp), %rax
movl %r14d, %ecx
shrl $0x4, %ecx
movl (%rax,%rcx,4), %esi
addl %r14d, %r14d
movl %r14d, %ecx
shrl %cl, %esi
addl %edx, %ebx
movl %ebx, %ecx
shrl $0x4, %ecx
movl (%rax,%rcx,4), %eax
addl %ebx, %ebx
movl %ebx, %ecx
shrl %cl, %eax
andb $0x3, %sil
andb $0x3, %al
cmpb %al, %sil
setb %cl
movl %ecx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop