// File: /workspace/github_c_makefile_star2_O3/lh3[P]minigraph/gfa-base.c
// Function: gfa_fix_semi_arc
uint32_t gfa_fix_semi_arc(gfa_t *g)
{
	uint32_t n_err = 0, v, n_vtx = gfa_n_vtx(g);
	int i, j;
	for (v = 0; v < n_vtx; ++v) {
		int nv = gfa_arc_n(g, v);
		gfa_arc_t *av = gfa_arc_a(g, v);
		for (i = 0; i < nv; ++i) {
			if (!av[i].del && (av[i].ow == INT32_MAX || av[i].ov == INT32_MAX)) { // overlap length is missing
				uint32_t w = av[i].w^1;
				int is_multi = 0, c, jv = -1, nw = gfa_arc_n(g, w);
				gfa_arc_t *aw = gfa_arc_a(g, w);
				for (j = 0, c = 0; j < nw; ++j)
					if (!aw[j].del && aw[j].w == (v^1)) ++c, jv = j;
				if (c == 1) {
					if (av[i].ov != INT32_MAX && aw[jv].ow != INT32_MAX && av[i].ov != aw[jv].ow) is_multi = 1;
					if (av[i].ow != INT32_MAX && aw[jv].ov != INT32_MAX && av[i].ow != aw[jv].ov) is_multi = 1;
				}
				if (c == 1 && !is_multi) {
					if (aw[jv].ov != INT32_MAX) av[i].ow = aw[jv].ov;
					if (aw[jv].ow != INT32_MAX) av[i].ov = aw[jv].ow;
				} else {
					if (gfa_verbose >= 2)
						fprintf(stderr, "[W] can't infer overlap length for %s%c -> %s%c\n",
								g->seg[v>>1].name, "+-"[v&1], g->seg[w>>1].name, "+-"[(w^1)&1]);
					++n_err;
					av[i].del = 1;
				}
			}
		}
	}
	return n_err;
}

// Assembly:
movl 0x4(%rdi), %eax
addl %eax, %eax
je 0x5915
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %r11
movabsq $0x4000000000000000, %r15 # imm = 0x4000000000000000
movl %eax, %eax
movq %rax, 0x30(%rsp)
xorl %r14d, %r14d
xorl %r10d, %r10d
movq %rdi, 0x18(%rsp)
movq 0x58(%r11), %rax
movq (%rax,%r14,8), %r9
testl %r9d, %r9d
jle 0x58f7
movq %r9, %r13
shrq $0x1b, %r13
andq $-0x20, %r13
addq 0x48(%r11), %r13
movl %r14d, %eax
shrl %eax
movl %r14d, %ecx
andl $0x1, %ecx
movq %rcx, 0x20(%rsp)
andl $0x7fffffff, %r9d       # imm = 0x7FFFFFFF
shlq $0x6, %rax
movq %rax, 0x28(%rsp)
xorl %ebp, %ebp
movq %r9, 0x8(%rsp)
movq %rbp, %rbx
shlq $0x5, %rbx
movq 0x18(%r13,%rbx), %rax
testq %r15, %rax
jne 0x5885
addq %r13, %rbx
movl 0x14(%rbx), %ecx
cmpl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
je 0x573b
cmpl $0x7fffffff, 0x10(%rbx) # imm = 0x7FFFFFFF
jne 0x5885
movl 0x8(%rbx), %esi
movq %rsi, %rdx
xorq $0x1, %rdx
movq 0x58(%r11), %rdi
movq (%rdi,%rdx,8), %rdi
testl %edi, %edi
jle 0x5872
movl %r10d, 0x4(%rsp)
movq 0x48(%r11), %r8
movq %rdi, %r9
shrq $0x20, %r9
shlq $0x5, %r9
leaq (%r8,%r9), %rdx
movq %rdx, 0x10(%rsp)
andl $0x7fffffff, %edi       # imm = 0x7FFFFFFF
addq %r8, %r9
addq $0x18, %r9
xorl %r10d, %r10d
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
xorl %r11d, %r11d
testq %r15, (%r9)
jne 0x57a8
movl -0x10(%r9), %edx
xorl %r14d, %edx
xorl %r12d, %r12d
cmpl $0x1, %edx
sete %r12b
cmovel %r10d, %r8d
addl %r12d, %r11d
incq %r10
addq $0x20, %r9
cmpq %r10, %rdi
jne 0x578b
cmpl $0x1, %r11d
movq 0x18(%rsp), %r11
movl 0x4(%rsp), %r10d
movq 0x8(%rsp), %r9
jne 0x5872
movslq %r8d, %rdi
movl 0x10(%rbx), %r9d
movb $0x1, %r8b
cmpl $0x7fffffff, %r9d       # imm = 0x7FFFFFFF
je 0x580a
movq %rdi, %rdx
shlq $0x5, %rdx
movq 0x10(%rsp), %r8
movl 0x14(%r8,%rdx), %edx
cmpl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
sete %r10b
cmpl %edx, %r9d
sete %r8b
orb %r10b, %r8b
movl 0x4(%rsp), %r10d
cmpl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
jne 0x5817
testb %r8b, %r8b
jmp 0x583d
movq %rdi, %rdx
shlq $0x5, %rdx
movq 0x10(%rsp), %r9
movl 0x10(%r9,%rdx), %edx
cmpl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
sete %r9b
cmpl %edx, %ecx
sete %cl
orb %r9b, %cl
testb %r8b, %cl
movq 0x8(%rsp), %r9
je 0x5872
shlq $0x5, %rdi
movq 0x10(%rsp), %rax
movl 0x10(%rax,%rdi), %eax
cmpl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
je 0x585b
movl %eax, 0x14(%rbx)
movq 0x10(%rsp), %rax
addq %rdi, %rax
movl 0x14(%rax), %eax
cmpl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
je 0x5885
movl %eax, 0x10(%rbx)
jmp 0x5885
cmpl $0x2, 0x2c977(%rip)     # 0x321f0
jge 0x5893
incl %r10d
orq %r15, %rax
movq %rax, 0x18(%rbx)
incq %rbp
cmpq %r9, %rbp
jne 0x570b
jmp 0x58f7
movq 0x2c75e(%rip), %rax     # 0x31ff8
movq (%rax), %rdi
movq 0x10(%r11), %rax
movq 0x28(%rsp), %rcx
movq 0x18(%rax,%rcx), %rdx
leaq 0x22abd(%rip), %r9      # 0x2836f
movq 0x20(%rsp), %rcx
movsbl (%rcx,%r9), %ecx
movl %esi, %r8d
shrl %r8d
shlq $0x6, %r8
movq 0x18(%rax,%r8), %r8
andl $0x1, %esi
movsbl (%rsi,%r9), %r9d
leaq 0x22a64(%rip), %rsi     # 0x2833e
xorl %eax, %eax
movl %r10d, %r12d
callq 0x2210
movq 0x8(%rsp), %r9
movl %r12d, %r10d
movq 0x18(%rsp), %r11
movq 0x18(%rbx), %rax
jmp 0x587b
incq %r14
cmpq 0x30(%rsp), %r14
jne 0x56c4
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x5918
xorl %r10d, %r10d
movl %r10d, %eax
retq