// File: /workspace/github_c_makefile_star2_O1/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, %rbx
movq %r8, 0x70(%rsp)
movl %ecx, 0xc(%rsp)
movq %rdx, 0x10(%rsp)
movq %rsi, %r15
movq %rdi, %r14
movq 0x1d0(%rsp), %rax
movl (%rsi), %r12d
movl $0x0, (%rax)
leaq 0x40(%rdi), %r13
leaq 0x10(%rdi), %rbp
leaq 0x28(%rdi), %rax
movq %rax, 0x20(%rsp)
leaq 0x58(%rdi), %rax
movq %rax, 0x60(%rsp)
leaq 0x80(%rdi), %rax
movq %rax, 0x30(%rsp)
movl $0x0, 0x1c(%rsp)
movq %r9, 0x40(%rsp)
movq %rdi, 0x28(%rsp)
movq %r13, 0x38(%rsp)
movq (%r14), %rdi
movl 0x8(%r14), %esi
subq $0x8, %rsp
movl 0x14(%rsp), %edx
movq %r15, %rcx
movq %r13, %r8
movq %rbp, %r9
pushq 0x70(%r14)
pushq 0x70(%rsp)
pushq 0x38(%rsp)
callq 0xb0c5
addq $0x20, %rsp
testl %eax, %eax
js 0xc756
movq (%r13), %rsi
cmpq $0x2, %rsi
jb 0xc223
movq 0x78(%r14), %rax
movq (%rbx), %rcx
movq %rcx, %rdx
shrq $0x6, %rdx
movl $0x1, %esi
shlq %cl, %rsi
lock
orq %rsi, (%rax,%rdx,8)
jmp 0xc25a
movl %eax, 0x8(%rsp)
movq 0x50(%r14), %rcx
movq (%rcx), %rcx
cmpq (%rbx), %rcx
je 0xc25a
movq 0x78(%r14), %rax
movq %rcx, %rdi
shrq $0x6, %rdi
movq (%rax,%rdi,8), %rdx
movl $0x1, %r8d
shlq %cl, %r8
btq %rcx, %rdx
jae 0xc269
movq 0x78(%r14), %rax
lock
orq %r8, (%rax,%rdi,8)
xorl %eax, %eax
testb %al, %al
jne 0xc1c7
jmp 0xc756
movq %r8, 0x78(%rsp)
movq %rdi, 0x80(%rsp)
movq %rcx, 0x50(%rsp)
movq %r12, 0x58(%rsp)
cmpq $0x1, %rsi
jne 0xc78a
movq (%r14), %rsi
movl (%r15), %edx
movq 0x10(%r15), %rcx
movl 0x8(%r14), %r8d
subq $0x8, %rsp
leaq 0x180(%rsp), %rdi
movl 0x10(%rsp), %ebx
movl %ebx, %r9d
movl $0x1, %eax
pushq %rax
pushq %rbp
pushq %rax
callq 0xae17
addq $0x20, %rsp
cmpl 0xc(%rsp), %ebx
jle 0xc449
movl 0x8(%rsp), %r12d
movslq 0xc(%rsp), %rax
movq %rax, 0x88(%rsp)
movq %r12, 0x68(%rsp)
movq %rbp, %rax
movq 0x20(%rsp), %rbx
movq %rbp, 0x48(%rsp)
movq %rbx, %rbp
movq %rax, %rbx
decq %r12
movq $0x0, (%rbp)
cmpq $0x0, (%rax)
je 0xc433
xorl %r14d, %r14d
movq %r15, %r13
movq %r14, %r15
shlq $0x5, %r15
addq 0x10(%rbx), %r15
movq 0x28(%rsp), %rax
movq (%rax), %rdi
movq %r15, %rsi
leaq 0xb0(%rsp), %rdx
movl $0x1, %ecx
callq 0x9d23
cmpq $0x0, 0xc0(%rsp)
je 0xc394
movq 0x28(%rsp), %rax
movq 0x70(%rax), %rax
xorl %edx, %edx
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
cmpq 0xc0(%rsp), %rdx
jb 0xc349
movq 0x10(%r13), %rax
movsbq (%rax,%r12), %rax
shlq $0x5, %rax
movq 0xc0(%rsp,%rax), %rax
addq 0xc0(%rsp), %rax
cmpq 0x10(%r15), %rax
jne 0xc467
movq 0x8(%rbp), %rax
cmpq %rax, (%rbp)
jne 0xc3ea
leaq (%rax,%rax), %rsi
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x8(%rbp)
movq 0x10(%rbp), %rdi
shlq $0x5, %rsi
callq 0x21d0
movq %rax, 0x10(%rbp)
movq (%rbp), %rax
movq 0x10(%rbp), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, (%rbp)
shlq $0x5, %rax
movq %r13, %r15
movq 0x10(%r13), %rdx
movsbq (%rdx,%r12), %rdx
shlq $0x5, %rdx
movups 0xb0(%rsp,%rdx), %xmm0
movups 0xc0(%rsp,%rdx), %xmm1
movups %xmm1, 0x10(%rcx,%rax)
movups %xmm0, (%rcx,%rax)
incq %r14
cmpq %r14, (%rbx)
ja 0xc308
movq %rbp, %rax
cmpq 0x88(%rsp), %r12
movq 0x48(%rsp), %rbp
jg 0xc2ea
movq 0x40(%rsp), %rbx
movq 0x28(%rsp), %r14
movq 0x58(%rsp), %r12
movq 0x38(%rsp), %r13
movq 0x50(%rsp), %rax
jmp 0xc5f4
movq 0x28(%rsp), %r14
movq 0x50(%r14), %rax
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movaps %xmm1, 0xa0(%rsp)
movaps %xmm0, 0x90(%rsp)
xorl %eax, %eax
movq %rax, 0x40(%r14)
movq %rax, 0x28(%r14)
movq %rax, 0x10(%r14)
movq %r13, %r15
movq (%r13), %rax
subq 0x68(%rsp), %rax
leaq 0x1(%rax), %rcx
cmpq %rcx, 0x88(%r14)
jae 0xc4fc
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(%r14)
movq 0x90(%r14), %rdi
callq 0x21d0
movq %rax, 0x90(%r14)
movl (%r15), %eax
movq 0x30(%rsp), %rcx
movq $0x0, (%rcx)
decl %eax
movl 0x8(%rsp), %r8d
cmpl %r8d, %eax
movq 0x40(%rsp), %rbx
movq 0x58(%rsp), %r12
movq 0x38(%rsp), %r13
movq 0x48(%rsp), %rbp
jl 0xc569
movq 0x10(%r15), %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(%r14), %rcx
movq 0x90(%r14), %rsi
leaq 0x1(%rcx), %rdi
movq %rdi, 0x80(%r14)
movb %dl, (%rsi,%rcx)
decl %eax
cmpl %r8d, %eax
jge 0xc52b
movq 0x80(%r14), %rax
movq 0x90(%r14), %rcx
movb $0x0, (%rcx,%rax)
movq (%r14), %rdi
movl 0x8(%r14), %esi
subq $0x8, %rsp
xorl %edx, %edx
movq 0x38(%rsp), %rcx
movq %r13, %r8
movq %rbp, %r9
pushq 0x70(%r14)
pushq 0x70(%rsp)
pushq 0x38(%rsp)
callq 0xb0c5
addq $0x20, %rsp
movq 0x40(%r14), %rax
testq %rax, %rax
je 0xc7a9
movq $0x1, 0x40(%r14)
movq 0x50(%r14), %rcx
movaps 0x90(%rsp), %xmm0
movaps 0xa0(%rsp), %xmm1
movups %xmm1, 0x10(%rcx)
movups %xmm0, (%rcx)
cmpq $0x1, %rax
movq 0x50(%rsp), %rax
movq 0x80(%rsp), %rdi
movq 0x78(%rsp), %r8
jne 0xc251
cmpq 0x70(%rsp), %rax
jne 0xc60e
movq 0x1d0(%rsp), %rax
movl $0x1, (%rax)
jmp 0xc25a
movq 0x50(%r14), %rax
movq 0x8(%rax), %rcx
cmpq (%rbx), %rcx
jne 0xc628
movq $0x0, (%r13)
jmp 0xc25a
movl 0xc(%r14), %edx
cmpl 0x18(%rax), %edx
jg 0xc25a
movq %rcx, (%rbx)
cmpq $0x0, 0x10(%rax)
je 0xc685
movq 0x70(%r14), %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 0xc645
movq 0x8(%r15), %rax
movq 0x10(%rsp), %rsi
cmpq %rax, 0x8(%rsi)
jae 0xc6eb
decq %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 0x10(%rsp), %rax
movq %rsi, 0x8(%rax)
movq 0x10(%rsp), %rax
movq 0x10(%rax), %rdi
callq 0x21d0
movq 0x10(%rsp), %rsi
movq %rax, 0x10(%rsi)
movq (%r15), %rax
movq %rax, (%rsi)
movq 0x10(%rsi), %rcx
movb $0x0, (%rcx,%rax)
cmpl %r12d, 0x8(%rsp)
jge 0xc71d
movl 0x8(%rsp), %eax
movq 0x10(%rsi), %rcx
movb (%rcx,%rax), %dl
cmpb $0x7e, %dl
je 0xc715
incb %dl
movb %dl, (%rcx,%rax)
incq %rax
cmpl %eax, %r12d
jg 0xc704
movslq %r12d, %rax
movq (%r15), %r12
cmpq %rax, %r12
jbe 0xc735
movq 0x10(%rsi), %rcx
movb $0x22, (%rcx,%rax)
incq %rax
jmp 0xc720
incl 0x1c(%rsp)
movq 0x20(%rsp), %rax
xorl %ecx, %ecx
movq %rcx, (%rax)
movq %rcx, (%rbp)
movb $0x1, %al
movl 0x8(%rsp), %ecx
movl %ecx, 0xc(%rsp)
jmp 0xc25c
movslq %r12d, %rax
movq %rax, (%r15)
movq 0x10(%rsp), %rcx
movq %rax, (%rcx)
movq 0x10(%rcx), %rcx
xorl %edx, %edx
movb %dl, (%rcx,%rax)
movq 0x10(%r15), %rcx
movb %dl, (%rcx,%rax)
movl 0x1c(%rsp), %eax
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xb251(%rip), %rdi      # 0x179e2
leaq 0xb0e9(%rip), %rsi      # 0x17881
leaq 0xb251(%rip), %rcx      # 0x179f0
movl $0x101, %edx            # imm = 0x101
callq 0x20e0
leaq 0xb275(%rip), %rdi      # 0x17a25
leaq 0xb0ca(%rip), %rsi      # 0x17881
leaq 0xb232(%rip), %rcx      # 0x179f0
movl $0x10c, %edx            # imm = 0x10C
callq 0x20e0