// File: /workspace/github_c_makefile_star2_O2/lh3[P]fermi-lite/unitig.c
// Function: overlap_intv
static rldintv_t overlap_intv(const rld_t *e, int len, const uint8_t *seq, int min, int j, int at5, rldintv_v *p, int inc_sentinel)
{ // requirement: seq[j] matches the end of a read
	int c, depth, dir, end;
	rldintv_t ik, ok[6];
	p->n = 0;
	dir = at5? 1 : -1; // at5 is true iff we start from the 5'-end of a read
	end = at5? len : -1;
	c = seq[j];
	fm6_set_intv(e, c, ik);
	for (depth = 1, j += dir; j != end; j += dir, ++depth) {
		c = at5? fm6_comp(seq[j]) : seq[j];
		rld_extend(e, &ik, ok, !at5);
		if (!ok[c].x[2]) break; // cannot be extended
		if (depth >= min && ok[0].x[2]) {
			if (inc_sentinel) {
				ok[0].info = j - dir;
				kv_push(rldintv_t, *p, ok[0]);
			} else {
				ik.info = j - dir;
				kv_push(rldintv_t, *p, ik);
			}
		}
		ik = ok[c];
	}
	kv_reverse(rldintv_t, *p, 0); // reverse the array such that the smallest interval comes first
	return ik;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movl %r8d, 0xc(%rsp)
movq %rdi, %rbx
movq 0x158(%rsp), %rax
movl 0x150(%rsp), %edi
andq $0x0, (%rax)
xorl %r12d, %r12d
testl %edi, %edi
sete %r12b
movl %r12d, %r10d
negl %r10d
orl $0x1, %r10d
xorl %eax, %eax
cmpl $0x1, %edi
sbbl %eax, %eax
orl %edx, %eax
movslq %r9d, %rdx
movq %rcx, 0x28(%rsp)
movzbl (%rcx,%rdx), %ecx
movq %rsi, 0x20(%rsp)
movq 0x20(%rsi), %rdi
movq (%rdi,%rcx,8), %r8
movq %r8, (%rbx)
movq 0x8(%rdi,%rcx,8), %r9
subq %r8, %r9
movq %r9, 0x10(%rbx)
leal -0x1(%rcx), %r8d
pushq $0x5
popq %r9
subl %ecx, %r9d
cmpb $0x4, %r8b
cmovael %ecx, %r9d
movslq %r9d, %rsi
movq (%rdi,%rsi,8), %rsi
movq %rsi, 0x8(%rbx)
andq $0x0, 0x18(%rbx)
addl %r10d, %edx
movslq %edx, %rbp
movq %r12, 0x18(%rsp)
negq %r12
orq $0x1, %r12
movslq %eax, %r15
movq %r12, %rax
negq %rax
movq %rax, 0x10(%rsp)
pushq $0x1
popq %r14
cmpq %rbp, %r15
je 0x9a25
movq 0x28(%rsp), %rax
movzbl (%rax,%rbp), %eax
leal -0x1(%rax), %ecx
pushq $0x5
popq %rdx
movl %edx, %r13d
subl %eax, %r13d
cmpb $0x4, %cl
cmovaeq %rax, %r13
cmpl $0x0, 0x150(%rsp)
cmoveq %rax, %r13
movq 0x20(%rsp), %rdi
movq %rbx, %rsi
leaq 0x50(%rsp), %rdx
movq 0x18(%rsp), %rcx
callq 0x873b
movl %r13d, %r13d
shlq $0x5, %r13
cmpq $0x0, 0x60(%rsp,%r13)
je 0x9a25
cmpl 0xc(%rsp), %r14d
jl 0x9a04
cmpq $0x0, 0x60(%rsp)
je 0x9a04
movq 0x10(%rsp), %rax
addq %rbp, %rax
cmpl $0x0, 0x160(%rsp)
je 0x99a3
movq %rax, 0x68(%rsp)
movq 0x158(%rsp), %rdi
movq (%rdi), %rcx
movq 0x10(%rdi), %rax
cmpq 0x8(%rdi), %rcx
jne 0x998c
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
pushq $0x2
popq %rcx
cmoveq %rcx, %rsi
movq %rsi, 0x8(%rdi)
shlq $0x5, %rsi
movq %rax, %rdi
callq 0x21c0
movq 0x158(%rsp), %rdi
movq %rax, 0x10(%rdi)
movq (%rdi), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, (%rdi)
shlq $0x5, %rcx
movaps 0x50(%rsp), %xmm0
movaps 0x60(%rsp), %xmm1
jmp 0x99fb
movq %rax, 0x18(%rbx)
movq 0x158(%rsp), %rdi
movq (%rdi), %rcx
movq 0x10(%rdi), %rax
cmpq 0x8(%rdi), %rcx
jne 0x99e9
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
pushq $0x2
popq %rcx
cmoveq %rcx, %rsi
movq %rsi, 0x8(%rdi)
shlq $0x5, %rsi
movq %rax, %rdi
callq 0x21c0
movq 0x158(%rsp), %rdi
movq %rax, 0x10(%rdi)
movq (%rdi), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, (%rdi)
shlq $0x5, %rcx
movups (%rbx), %xmm0
movups 0x10(%rbx), %xmm1
movups %xmm1, 0x10(%rax,%rcx)
movups %xmm0, (%rax,%rcx)
leaq (%rsp,%r13), %rax
addq $0x50, %rax
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups %xmm1, 0x10(%rbx)
movups %xmm0, (%rbx)
addq %r12, %rbp
incl %r14d
jmp 0x98c1
movq 0x158(%rsp), %rax
cmpq $0x0, 0x8(%rax)
je 0x9a91
movq (%rax), %rdx
testq %rdx, %rdx
je 0x9a91
movq 0x10(%rax), %rax
movq %rdx, %rcx
shrq %rcx
shlq $0x5, %rdx
addq %rax, %rdx
addq $-0x20, %rdx
subq $0x1, %rcx
jb 0x9a91
movups (%rdx), %xmm0
movups 0x10(%rdx), %xmm1
movaps %xmm1, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups %xmm1, 0x10(%rdx)
movups %xmm0, (%rdx)
movaps 0x30(%rsp), %xmm0
movaps 0x40(%rsp), %xmm1
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
addq $-0x20, %rdx
addq $0x20, %rax
jmp 0x9a51
movq %rbx, %rax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq