// File: /workspace/github_c_makefile_star2_O2/lh3[P]fermi-lite/unitig.c
// Function: unitig_unidir
static int unitig_unidir(aux_t *a, kstring_t *s, kstring_t *cov, int beg0, uint64_t k0, uint64_t *end, int *is_loop)
{
	int i, beg = beg0, rbeg, ori_l = s->l, n_reads = 0;
	*is_loop = 0;
	while ((rbeg = try_right(a, beg, s)) >= 0) { // loop if there is at least one overlap
		uint64_t k;
		if (a->nei.n > 1) { // forward bifurcation
			set_bit(a->bend, *end);
			break;
		}
		if ((k = a->nei.a[0].x[0]) == *end) break; // a loop like b>>c>>a><a; keep the link but stop extension
		if (((a->bend[k>>6]>>(k&0x3f)&1) || check_left(a, beg, rbeg, s) < 0)) { // backward bifurcation
			set_bit(a->bend, k);
			break;
		}
		if (k == k0) { // a loop like a>>b>>c>>a
			*is_loop = 1;
			break;
		}
		if (a->nei.a[0].x[1] == *end) { // a loop like b>>c>>a>>a; cut the last link
			a->nei.n = 0;
			break;
		}
		if ((int)a->nei.a[0].info < a->min_merge_len) break; // the overlap is not long enough
		*end = a->nei.a[0].x[1];
		set_bits(a->used, &a->nei.a[0]); // successful extension
		++n_reads;
		if (cov->m < s->m) ks_resize(cov, s->m);
		cov->l = s->l; cov->s[cov->l] = 0;
		for (i = rbeg; i < ori_l; ++i) // update the coverage string
			if (cov->s[i] != '~') ++cov->s[i];
		for (i = ori_l; i < s->l; ++i) cov->s[i] = '"';
		beg = rbeg; ori_l = s->l; a->a[0].n = a->a[1].n = 0; // prepare for the next round of loop
	}
	cov->l = s->l = ori_l; s->s[ori_l] = cov->s[ori_l] = 0;
	return n_reads;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x198, %rsp            # imm = 0x198
movq %r9, 0x10(%rsp)
movq %r8, 0x70(%rsp)
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %rbp
movq 0x1d0(%rsp), %rax
movq (%rsi), %r12
andl $0x0, (%rax)
leaq 0x10(%rdi), %rax
movq %rax, 0x50(%rsp)
leaq 0x28(%rdi), %rax
movq %rax, 0x48(%rsp)
leaq 0x80(%rdi), %rax
movq %rax, 0x40(%rsp)
xorl %r13d, %r13d
movq %rsi, 0x8(%rsp)
movq %rdx, 0x20(%rsp)
movq %rdi, 0x18(%rsp)
movq %rbp, %rdi
movl %ecx, %r15d
movl %ecx, %esi
movq %rbx, %rdx
callq 0xaf7c
movl %eax, 0x4(%rsp)
testl %eax, %eax
movq 0x10(%rsp), %rdx
js 0xae89
movq 0x40(%rbp), %rax
cmpq $0x2, %rax
jae 0xae44
movq 0x50(%rbp), %rcx
movq (%rcx), %rdi
cmpq (%rdx), %rdi
je 0xae89
movq 0x78(%rbp), %rdx
movq %rdi, %rcx
shrq $0x6, %rcx
movq %rcx, 0x68(%rsp)
movq (%rdx,%rcx,8), %rsi
pushq $0x1
popq %r8
movl %edi, %ecx
shlq %cl, %r8
movq %r8, 0x60(%rsp)
movq %rdi, 0x38(%rsp)
btq %rdi, %rsi
jb 0xae7a
movq %r12, 0x28(%rsp)
movq %r13, 0x30(%rsp)
cmpq $0x1, %rax
jne 0xaeb7
movq (%rbp), %rsi
movl (%rbx), %edx
movq 0x10(%rbx), %rcx
movl 0x8(%rbp), %r8d
subq $0x8, %rsp
leaq 0x180(%rsp), %rdi
movl 0xc(%rsp), %r14d
movl %r14d, %r9d
pushq $0x1
popq %rax
pushq %rax
movq 0x60(%rsp), %rbx
pushq %rbx
pushq %rax
callq 0x980a
addq $0x20, %rsp
movl %r14d, %eax
movq %rax, 0x58(%rsp)
movslq %r15d, %rcx
movq %rax, %rdx
movq 0x48(%rsp), %rax
movq %rbx, %rsi
movq %rdx, %rbx
leaq 0xb0(%rsp), %r13
movq %rcx, 0x78(%rsp)
cmpq %rcx, %rbx
jle 0xae21
movq %rax, %r14
andq $0x0, (%rax)
decq %rbx
xorl %r15d, %r15d
xorl %eax, %eax
movq %rsi, 0x80(%rsp)
cmpq %rax, (%rsi)
jbe 0xac4e
movq %rax, 0x88(%rsp)
movq %rbx, %rbp
movq 0x10(%rsi), %r12
leaq (%r12,%r15), %rsi
movq 0x18(%rsp), %rbx
movq (%rbx), %rdi
movq %r13, %rdx
pushq $0x1
popq %rcx
callq 0x873b
cmpq $0x0, 0xc0(%rsp)
je 0xab98
movq 0x70(%rbx), %rdi
movq %r13, %rsi
callq 0xa1ad
movq 0xc0(%rsp), %rax
jmp 0xab9a
xorl %eax, %eax
movq 0x8(%rsp), %rcx
movq 0x10(%rcx), %rcx
movsbq (%rcx,%rbp), %rdx
shlq $0x5, %rdx
addq 0xc0(%rsp,%rdx), %rax
cmpq 0x10(%r12,%r15), %rax
jne 0xac63
movq %rbp, %rbx
movq (%r14), %rdx
movq 0x10(%r14), %rax
cmpq 0x8(%r14), %rdx
jne 0xabfd
leaq (%rdx,%rdx), %rsi
testq %rdx, %rdx
pushq $0x2
popq %rcx
cmoveq %rcx, %rsi
movq %rsi, 0x8(%r14)
shlq $0x5, %rsi
movq %rax, %rdi
callq 0x21c0
movq %rax, 0x10(%r14)
movq (%r14), %rdx
movq 0x8(%rsp), %rcx
movq 0x10(%rcx), %rcx
leaq 0x1(%rdx), %rsi
movq %rsi, (%r14)
shlq $0x5, %rdx
movsbq (%rcx,%rbx), %rcx
shlq $0x5, %rcx
movups 0xb0(%rsp,%rcx), %xmm0
movups 0xc0(%rsp,%rcx), %xmm1
movups %xmm1, 0x10(%rax,%rdx)
movups %xmm0, (%rax,%rdx)
movq 0x88(%rsp), %rax
incq %rax
addq $0x20, %r15
leaq 0xb0(%rsp), %r13
movq 0x80(%rsp), %rsi
jmp 0xab48
movq %rsi, %rax
movq %r14, %rsi
movq 0x18(%rsp), %rbp
movq 0x78(%rsp), %rcx
jmp 0xab28
movq 0x18(%rsp), %rbp
movq 0x50(%rbp), %rax
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movaps %xmm1, 0xa0(%rsp)
movaps %xmm0, 0x90(%rsp)
andq $0x0, 0x40(%rbp)
andq $0x0, 0x28(%rbp)
andq $0x0, 0x10(%rbp)
movq 0x8(%rsp), %rbx
movq (%rbx), %rax
movq 0x58(%rsp), %rcx
negq %rcx
leaq (%rax,%rcx), %rsi
incq %rsi
movq 0x40(%rsp), %rdi
callq 0xa992
movl (%rbx), %eax
andq $0x0, 0x80(%rbp)
decl %eax
movq 0x20(%rsp), %r14
movq 0x30(%rsp), %r13
movq 0x28(%rsp), %r12
movq 0x10(%rsp), %r8
cmpl 0x4(%rsp), %eax
jl 0xad14
movq 0x10(%rbx), %rcx
movl %eax, %edx
movzbl (%rcx,%rdx), %ecx
movb $0x5, %dl
subb %cl, %dl
leal -0x1(%rcx), %esi
cmpb $0x4, %sil
movzbl %dl, %edx
cmovael %ecx, %edx
movq 0x80(%rbp), %rcx
movq 0x90(%rbp), %rsi
leaq 0x1(%rcx), %rdi
movq %rdi, 0x80(%rbp)
movb %dl, (%rsi,%rcx)
decl %eax
jmp 0xacd3
movq %r8, %r15
movq 0x80(%rbp), %rax
movq 0x90(%rbp), %rcx
movb $0x0, (%rcx,%rax)
movq %rbp, %rdi
xorl %esi, %esi
movq 0x40(%rsp), %rdx
callq 0xaf7c
movq 0x40(%rbp), %rax
testq %rax, %rax
je 0xaed6
movq $0x1, 0x40(%rbp)
movq 0x50(%rbp), %rcx
movaps 0x90(%rsp), %xmm0
movaps 0xa0(%rsp), %xmm1
movups %xmm1, 0x10(%rcx)
movups %xmm0, (%rcx)
cmpq $0x1, %rax
movq 0x38(%rsp), %rax
jne 0xae76
cmpq 0x70(%rsp), %rax
je 0xae5f
movq 0x50(%rbp), %rsi
movq 0x8(%rsi), %rax
cmpq (%r15), %rax
je 0xae6f
movl 0xc(%rbp), %ecx
cmpl 0x18(%rsi), %ecx
jg 0xae89
movq %rax, (%r15)
movq 0x70(%rbp), %rdi
callq 0xa1ad
movq 0x8(%rbx), %rsi
cmpq %rsi, 0x8(%r14)
jae 0xadbd
movq %r14, %rdi
callq 0xa992
incl %r13d
movq (%rbx), %rax
movq %rax, (%r14)
movq 0x10(%r14), %rcx
movb $0x0, (%rcx,%rax)
movq 0x58(%rsp), %rdx
cmpl %r12d, %edx
jge 0xadee
movq 0x10(%r14), %rax
movb (%rax,%rdx), %cl
cmpb $0x7e, %cl
je 0xade9
incb %cl
movb %cl, (%rax,%rdx)
incq %rdx
jmp 0xadd3
movslq %r12d, %rax
movq (%rbx), %r12
cmpq %rax, %r12
jbe 0xae06
movq 0x10(%r14), %rcx
movb $0x22, (%rcx,%rax)
incq %rax
jmp 0xadf1
movq 0x48(%rsp), %rax
andq $0x0, (%rax)
movq 0x50(%rsp), %rax
andq $0x0, (%rax)
movl 0x4(%rsp), %ecx
jmp 0xaa48
movq 0x8(%rsp), %rbx
movq 0x20(%rsp), %r14
movq 0x30(%rsp), %r13
movq 0x28(%rsp), %r12
movq 0x10(%rsp), %r15
movq 0x38(%rsp), %rax
jmp 0xad77
movq 0x78(%rbp), %rax
movq (%rdx), %rcx
movq %rcx, %rdx
pushq $0x1
popq %rsi
shlq %cl, %rsi
shrq $0x6, %rdx
lock
orq %rsi, (%rax,%rdx,8)
jmp 0xae89
movq 0x1d0(%rsp), %rax
movl $0x1, (%rax)
jmp 0xae89
andq $0x0, 0x40(%rbp)
jmp 0xae89
movq 0x78(%rbp), %rdx
movq 0x68(%rsp), %rax
movq 0x60(%rsp), %rcx
lock
orq %rcx, (%rdx,%rax,8)
movslq %r12d, %rax
movq %rax, (%rbx)
movq %rax, (%r14)
movq 0x10(%r14), %rcx
xorl %edx, %edx
movb %dl, (%rcx,%rax)
movq 0x10(%rbx), %rcx
movb %dl, (%rcx,%rax)
movl %r13d, %eax
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x9b44(%rip), %rdi      # 0x14a02
leaq 0x99dc(%rip), %rsi      # 0x148a1
leaq 0x9b44(%rip), %rcx      # 0x14a10
movl $0x101, %edx            # imm = 0x101
callq 0x20e0
leaq 0x9b68(%rip), %rdi      # 0x14a45
leaq 0x99bd(%rip), %rsi      # 0x148a1
leaq 0x9b25(%rip), %rcx      # 0x14a10
movl $0x10c, %edx            # imm = 0x10C
callq 0x20e0