// File: /workspace/github_c_makefile_star2_O0/lh3[P]fermi-lite/unitig.c
// Function: unitig1
static int unitig1(aux_t *a, int64_t seed, kstring_t *s, kstring_t *cov, uint64_t end[2], ku128_v nei[2], int *n_reads)
{
	rldintv_t intv0;
	int seed_len, ret, is_loop, contained;
	int64_t k;
	size_t i;

	*n_reads = nei[0].n = nei[1].n = 0;
	if (a->used[seed>>6]>>(seed&0x3f)&1) return -2; // used
	// retrieve the sequence pointed by seed
	k = fm6_retrieve(a->e, seed, s, &intv0, &contained);
	seq_reverse(s->l, (uint8_t*)s->s);
	seed_len = s->l;
	// check contained status
	if (intv0.x[2] > 1 && k != intv0.x[0]) return -3; // duplicated, but not the first
	set_bits(a->used, &intv0);
	if (contained) return -3; // contained
	// check length, containment and if used before
	if (s->l <= a->min_match) return -1; // too short
	ret = fm6_is_contained(a->e, a->min_match, s, &intv0, &a->a[0]);
	*n_reads = 1;
	// initialize the coverage string
	if (cov->m < s->m) ks_resize(cov, s->m);
	cov->l = s->l; cov->s[cov->l] = 0;
	for (i = 0; i < cov->l; ++i) cov->s[i] = '"';
	// left-wards extension
	end[0] = intv0.x[1]; end[1] = intv0.x[0];
	if (a->a[0].n) { // no need to extend to the right if there is no overlap
		*n_reads += unitig_unidir(a, s, cov, 0, intv0.x[0], &end[0], &is_loop);
		copy_nei(&nei[0], &a->nei);
		if (is_loop) {
			ku128_t z;
			z.x = end[0]; z.y = a->nei.a[0].info;
			kv_push(ku128_t, nei[1], z);
			return 0;
		}
	}
	// right-wards extension
	a->a[0].n = a->a[1].n = a->nei.n = 0;
	seq_revcomp6(s->l, (uint8_t*)s->s); // reverse complement for extension in the other direction
	seq_reverse(cov->l, (uint8_t*)cov->s); // reverse the coverage
	*n_reads += unitig_unidir(a, s, cov, s->l - seed_len, intv0.x[1], &end[1], &is_loop);
	copy_nei(&nei[1], &a->nei);
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq 0x10(%rbp), %rax
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq $0x0, 0x18(%rax)
movq -0x38(%rbp), %rax
movq $0x0, (%rax)
movq 0x10(%rbp), %rax
movl $0x0, (%rax)
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rax
movq -0x18(%rbp), %rcx
sarq $0x6, %rcx
movq (%rax,%rcx,8), %rax
movq -0x18(%rbp), %rcx
andq $0x3f, %rcx
shrq %cl, %rax
andq $0x1, %rax
cmpq $0x0, %rax
je 0x116ed
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0x11a1f
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
leaq -0x58(%rbp), %rcx
leaq -0x68(%rbp), %r8
callq 0xdaa0
movq %rax, -0x70(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movl %eax, %edi
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x4620
movq -0x20(%rbp), %rax
movq (%rax), %rax
movl %eax, -0x5c(%rbp)
cmpq $0x1, -0x48(%rbp)
jbe 0x1174a
movq -0x70(%rbp), %rax
cmpq -0x58(%rbp), %rax
je 0x1174a
movl $0xfffffffd, -0x4(%rbp) # imm = 0xFFFFFFFD
jmp 0x11a1f
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rdi
leaq -0x58(%rbp), %rsi
callq 0x10c40
cmpl $0x0, -0x68(%rbp)
je 0x1176d
movl $0xfffffffd, -0x4(%rbp) # imm = 0xFFFFFFFD
jmp 0x11a1f
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq -0x10(%rbp), %rcx
movslq 0x8(%rcx), %rcx
cmpq %rcx, %rax
ja 0x1178d
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x11a1f
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movl 0x8(%rax), %esi
movq -0x20(%rbp), %rdx
movq -0x10(%rbp), %r8
addq $0x10, %r8
leaq -0x58(%rbp), %rcx
callq 0xf7f0
movl %eax, -0x60(%rbp)
movq 0x10(%rbp), %rax
movl $0x1, (%rax)
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x20(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jae 0x117e0
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x11a30
movq -0x20(%rbp), %rax
movq (%rax), %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x28(%rbp), %rcx
movq (%rcx), %rcx
movb $0x0, (%rax,%rcx)
movq $0x0, -0x78(%rbp)
movq -0x78(%rbp), %rax
movq -0x28(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x11834
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x78(%rbp), %rcx
movb $0x22, (%rax,%rcx)
movq -0x78(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x78(%rbp)
jmp 0x11809
movq -0x50(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
movq -0x58(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x11974
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
movq -0x58(%rbp), %r8
movq -0x30(%rbp), %r9
xorl %ecx, %ecx
leaq -0x64(%rbp), %rax
movq %rax, (%rsp)
callq 0x11b20
movl %eax, %ecx
movq 0x10(%rbp), %rax
addl (%rax), %ecx
movl %ecx, (%rax)
movq -0x38(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x40, %rsi
callq 0x11dd0
cmpl $0x0, -0x64(%rbp)
je 0x11972
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x88(%rbp)
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
movq 0x18(%rax), %rax
movq %rax, -0x80(%rbp)
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x38(%rbp), %rcx
cmpq 0x20(%rcx), %rax
jne 0x11932
movq -0x38(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0x118f1
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rax
shlq %rax
movq %rax, -0x90(%rbp)
jmp 0x118ff
movl $0x2, %eax
movq %rax, -0x90(%rbp)
jmp 0x118ff
movq -0x90(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x38(%rbp), %rax
movq 0x28(%rax), %rdi
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rsi
shlq $0x4, %rsi
callq 0x21e0
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x38(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x38(%rbp), %rdx
movq 0x18(%rdx), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, 0x18(%rdx)
shlq $0x4, %rcx
addq %rcx, %rax
movq -0x88(%rbp), %rcx
movq %rcx, (%rax)
movq -0x80(%rbp), %rcx
movq %rcx, 0x8(%rax)
movl $0x0, -0x4(%rbp)
jmp 0x11a1f
jmp 0x11974
movq -0x10(%rbp), %rax
movq $0x0, 0x40(%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0x28(%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0x10(%rax)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movl %eax, %edi
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x4690
movq -0x28(%rbp), %rax
movq (%rax), %rax
movl %eax, %edi
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x4620
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
movq -0x20(%rbp), %rax
movq (%rax), %rax
movslq -0x5c(%rbp), %rcx
subq %rcx, %rax
movl %eax, %ecx
movq -0x50(%rbp), %r8
movq -0x30(%rbp), %r9
addq $0x8, %r9
leaq -0x64(%rbp), %rax
movq %rax, (%rsp)
callq 0x11b20
movl %eax, %ecx
movq 0x10(%rbp), %rax
addl (%rax), %ecx
movl %ecx, (%rax)
movq -0x38(%rbp), %rdi
addq $0x18, %rdi
movq -0x10(%rbp), %rsi
addq $0x40, %rsi
callq 0x11dd0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xa0, %rsp
popq %rbp
retq
nopl (%rax,%rax)