// File: /workspace/github_cpp_makefile_star2_O3/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 0x11b04
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 0x2b4da
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 0x2b4dc
incl %edx
addl $0x2, %r9d
addl $0x2, %r10d
cmpl %edx, %edi
jne 0x2b498
movl %edi, %edx
jmp 0x2b4dc
xorl %edx, %edx
movq 0x10(%rsp), %rcx
movl %edx, (%rcx)
cmpl %esi, %edx
jne 0x2b4ee
xorl %ecx, %ecx
jmp 0x2b585
movb $0x1, %cl
cmpl %r15d, %edx
je 0x2b585
cmpl %eax, %edx
jne 0x2b551
movq 0x8(%rsp), %rcx
movb $0x1, (%rcx)
movq 0x78(%r12), %rdx
addl %eax, %r14d
addl %eax, %ebx
movl 0xbc(%rdx), %eax
notl %eax
movl %r14d, %esi
andl %eax, %esi
andl %ebx, %eax
movq 0xa0(%rdx), %rdi
movb 0xb8(%rdx), %cl
shrl %cl, %r14d
shrl %cl, %ebx
movl (%rdi,%rsi,4), %ecx
movl (%rdi,%rax,4), %eax
movq 0x60(%rdx), %rsi
movq 0x80(%rdx), %rdx
addl (%rsi,%rcx,4), %r14d
addl (%rsi,%rax,4), %ebx
movl (%rdx,%r14,4), %eax
cmpl (%rdx,%rbx,4), %eax
jmp 0x2b582
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