// File: /workspace/github_c_makefile_star2_O0/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:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movl $0x0, -0xc(%rbp)
movq -0x8(%rbp), %rax
movl 0x4(%rax), %eax
shll %eax
movl %eax, -0x14(%rbp)
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
cmpl -0x14(%rbp), %eax
jae 0x6782
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movl -0x10(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x58(%rcx), %rcx
movl -0x10(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0x6772
movq -0x28(%rbp), %rax
movslq -0x18(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rax
shrq $0x3e, %rax
andq $0x1, %rax
cmpq $0x0, %rax
jne 0x6762
movq -0x28(%rbp), %rax
movslq -0x18(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
cmpl $0x7fffffff, 0x14(%rax) # imm = 0x7FFFFFFF
je 0x6486
movq -0x28(%rbp), %rax
movslq -0x18(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
cmpl $0x7fffffff, 0x10(%rax) # imm = 0x7FFFFFFF
jne 0x6762
movq -0x28(%rbp), %rax
movslq -0x18(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
xorl $0x1, %eax
movl %eax, -0x2c(%rbp)
movl $0x0, -0x30(%rbp)
movl $0xffffffff, -0x38(%rbp) # imm = 0xFFFFFFFF
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movl -0x2c(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x3c(%rbp)
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x58(%rcx), %rcx
movl -0x2c(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movl $0x0, -0x1c(%rbp)
movl $0x0, -0x34(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x3c(%rbp), %eax
jge 0x6553
movq -0x48(%rbp), %rax
movslq -0x1c(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rax
shrq $0x3e, %rax
andq $0x1, %rax
cmpq $0x0, %rax
jne 0x6546
movq -0x48(%rbp), %rax
movslq -0x1c(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movl -0x10(%rbp), %ecx
xorl $0x1, %ecx
cmpl %ecx, %eax
jne 0x6546
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, -0x38(%rbp)
jmp 0x6548
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x64f2
cmpl $0x1, -0x34(%rbp)
jne 0x6619
movq -0x28(%rbp), %rax
movslq -0x18(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
cmpl $0x7fffffff, 0x10(%rax) # imm = 0x7FFFFFFF
je 0x65ba
movq -0x48(%rbp), %rax
movslq -0x38(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
cmpl $0x7fffffff, 0x14(%rax) # imm = 0x7FFFFFFF
je 0x65ba
movq -0x28(%rbp), %rax
movslq -0x18(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
movq -0x48(%rbp), %rcx
movslq -0x38(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rcx
cmpl 0x14(%rcx), %eax
je 0x65ba
movl $0x1, -0x30(%rbp)
movq -0x28(%rbp), %rax
movslq -0x18(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
cmpl $0x7fffffff, 0x14(%rax) # imm = 0x7FFFFFFF
je 0x6617
movq -0x48(%rbp), %rax
movslq -0x38(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
cmpl $0x7fffffff, 0x10(%rax) # imm = 0x7FFFFFFF
je 0x6617
movq -0x28(%rbp), %rax
movslq -0x18(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x14(%rax), %eax
movq -0x48(%rbp), %rcx
movslq -0x38(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rcx
cmpl 0x10(%rcx), %eax
je 0x6617
movl $0x1, -0x30(%rbp)
jmp 0x6619
cmpl $0x1, -0x34(%rbp)
jne 0x66a6
cmpl $0x0, -0x30(%rbp)
jne 0x66a6
movq -0x48(%rbp), %rax
movslq -0x38(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
cmpl $0x7fffffff, 0x10(%rax) # imm = 0x7FFFFFFF
je 0x6665
movq -0x48(%rbp), %rax
movslq -0x38(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x10(%rax), %ecx
movq -0x28(%rbp), %rax
movslq -0x18(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rax
movl %ecx, 0x14(%rax)
movq -0x48(%rbp), %rax
movslq -0x38(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
cmpl $0x7fffffff, 0x14(%rax) # imm = 0x7FFFFFFF
je 0x66a1
movq -0x48(%rbp), %rax
movslq -0x38(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x14(%rax), %ecx
movq -0x28(%rbp), %rax
movslq -0x18(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rax
movl %ecx, 0x10(%rax)
jmp 0x6760
cmpl $0x2, 0x3eb33(%rip)     # 0x451e0
jl 0x6729
movq 0x3e942(%rip), %rax     # 0x44ff8
movq (%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x10(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
shlq $0x6, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rdx
movl -0x10(%rbp), %eax
andl $0x1, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x35c7b(%rip), %rax     # 0x3c35f
movsbl (%rax,%rcx), %ecx
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x2c(%rbp), %esi
shrl %esi
movl %esi, %esi
shlq $0x6, %rsi
addq %rsi, %rax
movq 0x18(%rax), %r8
movl -0x2c(%rbp), %eax
xorl $0x1, %eax
andl $0x1, %eax
movl %eax, %eax
movl %eax, %esi
leaq 0x35c49(%rip), %rax     # 0x3c35f
movsbl (%rax,%rsi), %r9d
leaq 0x35c0c(%rip), %rsi     # 0x3c32e
movb $0x0, %al
callq 0x2210
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
movq -0x28(%rbp), %rax
movslq -0x18(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movabsq $-0x4000000000000001, %rcx # imm = 0xBFFFFFFFFFFFFFFF
andq 0x18(%rax), %rcx
movabsq $0x4000000000000000, %rdx # imm = 0x4000000000000000
orq %rdx, %rcx
movq %rcx, 0x18(%rax)
jmp 0x6762
jmp 0x6764
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x6421
jmp 0x6774
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x63d6
movl -0xc(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax,%rax)