// File: /workspace/github_c_makefile_star2_O3/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, %r13
movq %r8, 0x78(%rsp)
movl %ecx, %r12d
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r15
movq 0x1d0(%rsp), %rcx
movq (%rsi), %rax
movq %rax, 0x48(%rsp)
movl $0x0, (%rcx)
leaq 0x40(%rdi), %r8
leaq 0x10(%rdi), %r9
leaq 0x28(%rdi), %rax
leaq 0x58(%rdi), %r10
movq (%rdi), %rdi
movl 0x8(%r15), %esi
subq $0x8, %rsp
movl %r12d, %edx
movq %rbx, %rcx
movq %r8, 0x20(%rsp)
movq %r9, 0x28(%rsp)
pushq 0x70(%r15)
movq %r10, 0x60(%rsp)
pushq %r10
movq %rax, 0x58(%rsp)
pushq %rax
callq 0xb598
addq $0x20, %rsp
testl %eax, %eax
js 0xcc3d
movq %r15, 0x8(%rsp)
leaq 0x80(%r15), %rcx
movq %rcx, 0x58(%rsp)
xorl %r15d, %r15d
movq 0x18(%rsp), %rbp
movq %rbx, 0x28(%rsp)
movq %r14, 0x38(%rsp)
movq %r13, 0x30(%rsp)
movl %eax, %r9d
movq (%rbp), %rax
cmpq $0x2, %rax
jae 0xcc42
movq 0x8(%rsp), %rdi
movq 0x50(%rdi), %rcx
movq (%rcx), %rcx
cmpq (%r13), %rcx
je 0xcc96
movq 0x78(%rdi), %rdx
movq %rcx, %r8
shrq $0x6, %r8
movq (%rdx,%r8,8), %rsi
movl $0x1, %r10d
shlq %cl, %r10
btq %rcx, %rsi
jb 0xcc91
movq %r10, 0x68(%rsp)
movq %r8, 0x70(%rsp)
movq %rcx, 0x88(%rsp)
movl %r15d, 0x14(%rsp)
cmpq $0x1, %rax
jne 0xccc6
movq (%rdi), %rsi
movl (%rbx), %edx
movq 0x10(%rbx), %rcx
movl 0x8(%rdi), %r8d
subq $0x8, %rsp
leaq 0x180(%rsp), %rdi
movl $0x1, %eax
pushq %rax
pushq 0x30(%rsp)
pushq %rax
movl %r9d, %ebx
callq 0xb2fe
movq 0x28(%rsp), %r10
addq $0x20, %rsp
movl %ebx, 0x4(%rsp)
cmpl %r12d, %ebx
jle 0xc91c
movl 0x4(%rsp), %r15d
movslq %r12d, %rax
movq %rax, 0x80(%rsp)
movq %r15, 0x60(%rsp)
movq 0x20(%rsp), %rax
movq 0x40(%rsp), %rbx
movq %rbx, %r14
movq %rax, %rbx
decq %r15
movq $0x0, (%r14)
cmpq $0x0, (%rax)
je 0xc90b
xorl %r13d, %r13d
movq %r13, %r12
shlq $0x5, %r12
addq 0x10(%rbx), %r12
movq (%r10), %rdi
movq %r12, %rsi
leaq 0xb0(%rsp), %rdx
movl $0x1, %ecx
movq %r10, %rbp
callq 0xa1c6
cmpq $0x0, 0xc0(%rsp)
je 0xc866
movq 0x70(%rbp), %rax
xorl %edx, %edx
movq %rbp, %r10
movq 0xb0(%rsp), %rcx
addq %rdx, %rcx
movq %rcx, %rsi
movl $0x1, %edi
shlq %cl, %rdi
shrq $0x6, %rsi
lock
orq %rdi, (%rax,%rsi,8)
movq 0xb8(%rsp), %rcx
addq %rdx, %rcx
movq %rcx, %rsi
movl $0x1, %edi
shlq %cl, %rdi
shrq $0x6, %rsi
lock
orq %rdi, (%rax,%rsi,8)
incq %rdx
movq 0xc0(%rsp), %rsi
cmpq %rsi, %rdx
jb 0xc816
jmp 0xc86b
xorl %esi, %esi
movq %rbp, %r10
movq 0x28(%rsp), %rax
movq 0x10(%rax), %rcx
movsbq (%rcx,%r15), %rax
shlq $0x5, %rax
addq 0xc0(%rsp,%rax), %rsi
cmpq 0x10(%r12), %rsi
jne 0xc935
movq (%r14), %rdx
movq 0x10(%r14), %rax
cmpq 0x8(%r14), %rdx
jne 0xc8d2
leaq (%rdx,%rdx), %rsi
testq %rdx, %rdx
movl $0x2, %ecx
cmoveq %rcx, %rsi
movq %rsi, 0x8(%r14)
shlq $0x5, %rsi
movq %rax, %rdi
callq 0x21c0
movq 0x8(%rsp), %r10
movq %rax, 0x10(%r14)
movq (%r14), %rdx
movq 0x28(%rsp), %rcx
movq 0x10(%rcx), %rcx
leaq 0x1(%rdx), %rsi
movq %rsi, (%r14)
shlq $0x5, %rdx
movsbq (%rcx,%r15), %rcx
shlq $0x5, %rcx
movups 0xb0(%rsp,%rcx), %xmm0
movups 0xc0(%rsp,%rcx), %xmm1
movups %xmm1, 0x10(%rax,%rdx)
movups %xmm0, (%rax,%rdx)
incq %r13
cmpq %r13, (%rbx)
ja 0xc7dc
movq %r14, %rax
cmpq 0x80(%rsp), %r15
jg 0xc7bf
movq 0x28(%rsp), %rbx
movq 0x38(%rsp), %r14
movl 0x14(%rsp), %r15d
movq 0x30(%rsp), %r13
jmp 0xcac1
movq 0x50(%r10), %rax
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movaps %xmm1, 0xa0(%rsp)
movaps %xmm0, 0x90(%rsp)
xorl %eax, %eax
movq %rax, 0x40(%r10)
movq %rax, 0x28(%r10)
movq %rax, 0x10(%r10)
movq 0x28(%rsp), %rbx
movq (%rbx), %rax
movq 0x60(%rsp), %rdx
movq %rdx, %rcx
negq %rcx
addq %rax, %rcx
incq %rcx
cmpq %rcx, 0x88(%r10)
movq 0x58(%rsp), %r12
jae 0xc9de
subq %rdx, %rax
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rsi
shrq $0x10, %rsi
orq %rax, %rsi
incq %rsi
movq %rsi, 0x88(%r10)
movq 0x90(%r10), %rdi
callq 0x21c0
movq 0x8(%rsp), %r10
movq %rax, 0x90(%r10)
movq (%rbx), %rax
movq 0x38(%rsp), %r14
movl 0x14(%rsp), %r15d
movq 0x30(%rsp), %r13
movq $0x0, (%r12)
decl %eax
cmpl 0x4(%rsp), %eax
jge 0xca01
xorl %eax, %eax
jmp 0xca48
movl 0x4(%rsp), %r8d
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(%r10), %rcx
movq 0x90(%r10), %rsi
leaq 0x1(%rcx), %rdi
movq %rdi, 0x80(%r10)
movb %dl, (%rsi,%rcx)
decl %eax
cmpl %r8d, %eax
jge 0xca06
movq (%r12), %rax
movq 0x90(%r10), %rcx
movb $0x0, (%rcx,%rax)
movq (%r10), %rdi
movl 0x8(%r10), %esi
subq $0x8, %rsp
xorl %edx, %edx
movq %r12, %rcx
movq 0x20(%rsp), %r8
movq 0x28(%rsp), %r9
pushq 0x70(%r10)
pushq 0x60(%rsp)
pushq 0x58(%rsp)
callq 0xb598
movq 0x28(%rsp), %r10
addq $0x20, %rsp
movq 0x40(%r10), %rax
testq %rax, %rax
je 0xcce5
movq $0x1, 0x40(%r10)
movq 0x50(%r10), %rcx
movaps 0x90(%rsp), %xmm0
movaps 0xa0(%rsp), %xmm1
movups %xmm1, 0x10(%rcx)
movups %xmm0, (%rcx)
cmpq $0x1, %rax
jne 0xcc83
movq 0x88(%rsp), %rax
cmpq 0x78(%rsp), %rax
je 0xcc65
movq 0x50(%r10), %rax
movq 0x8(%rax), %rcx
cmpq (%r13), %rcx
je 0xcc75
movl 0xc(%r10), %edx
cmpl 0x18(%rax), %edx
jg 0xcc96
movq %rcx, (%r13)
cmpq $0x0, 0x10(%rax)
je 0xcb44
movq 0x70(%r10), %rdx
xorl %esi, %esi
movq (%rax), %rcx
addq %rsi, %rcx
movq %rcx, %rdi
movl $0x1, %r8d
shlq %cl, %r8
shrq $0x6, %rdi
lock
orq %r8, (%rdx,%rdi,8)
movq 0x8(%rax), %rcx
addq %rsi, %rcx
movq %rcx, %rdi
movl $0x1, %r8d
shlq %cl, %r8
shrq $0x6, %rdi
lock
orq %r8, (%rdx,%rdi,8)
incq %rsi
cmpq 0x10(%rax), %rsi
jb 0xcb04
movq 0x8(%rbx), %rcx
movq 0x10(%r14), %rax
cmpq %rcx, 0x8(%r14)
movq 0x48(%rsp), %r12
jae 0xcba3
decq %rcx
movq %rcx, %rdx
shrq %rdx
orq %rcx, %rdx
movq %rdx, %rcx
shrq $0x2, %rcx
orq %rdx, %rcx
movq %rcx, %rdx
shrq $0x4, %rdx
orq %rcx, %rdx
movq %rdx, %rcx
shrq $0x8, %rcx
orq %rdx, %rcx
movq %rcx, %rsi
shrq $0x10, %rsi
orq %rcx, %rsi
incq %rsi
movq %rsi, 0x8(%r14)
movq %rax, %rdi
callq 0x21c0
movq 0x8(%rsp), %r10
movq %rax, 0x10(%r14)
movq (%rbx), %rcx
movq %rcx, (%r14)
movb $0x0, (%rax,%rcx)
cmpl %r12d, 0x4(%rsp)
jge 0xcbd1
movl 0x4(%rsp), %eax
movq 0x10(%r14), %rcx
movb (%rcx,%rax), %dl
cmpb $0x7e, %dl
je 0xcbc9
incb %dl
movb %dl, (%rcx,%rax)
incq %rax
cmpl %r12d, %eax
jl 0xcbb8
movslq %r12d, %rax
movq (%rbx), %rcx
cmpq %rax, %rcx
jbe 0xcbe9
movq 0x10(%r14), %rcx
movb $0x22, (%rcx,%rax)
incq %rax
jmp 0xcbd4
movq %rcx, 0x48(%rsp)
incl %r15d
xorl %eax, %eax
movq %rax, 0x28(%r10)
movq %rax, 0x10(%r10)
movq (%r10), %rdi
movl 0x8(%r10), %esi
subq $0x8, %rsp
movl 0xc(%rsp), %r12d
movl %r12d, %edx
movq %rbx, %rcx
movq 0x20(%rsp), %rbp
movq %rbp, %r8
movq 0x28(%rsp), %r9
pushq 0x70(%r10)
pushq 0x60(%rsp)
pushq 0x58(%rsp)
callq 0xb598
addq $0x20, %rsp
testl %eax, %eax
jns 0xc6f4
jmp 0xcc96
xorl %r15d, %r15d
jmp 0xcc96
movq 0x8(%rsp), %rax
movq 0x78(%rax), %rax
movq (%r13), %rcx
movq %rcx, %rdx
movl $0x1, %esi
shlq %cl, %rsi
shrq $0x6, %rdx
lock
orq %rsi, (%rax,%rdx,8)
jmp 0xcc96
movq 0x1d0(%rsp), %rax
movl $0x1, (%rax)
jmp 0xcc96
movq 0x18(%rsp), %rax
movq $0x0, (%rax)
jmp 0xcc96
movq 0x78(%r10), %rdx
movq 0x70(%rsp), %r8
movq 0x68(%rsp), %r10
lock
orq %r10, (%rdx,%r8,8)
movslq 0x48(%rsp), %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 %r15d, %eax
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xad85(%rip), %rdi      # 0x17a52
leaq 0xac1d(%rip), %rsi      # 0x178f1
leaq 0xad85(%rip), %rcx      # 0x17a60
movl $0x101, %edx            # imm = 0x101
callq 0x20e0
leaq 0xada9(%rip), %rdi      # 0x17a95
leaq 0xabfe(%rip), %rsi      # 0x178f1
leaq 0xad66(%rip), %rcx      # 0x17a60
movl $0x10c, %edx            # imm = 0x10C
callq 0x20e0