// File: /workspace/github_c_makefile_star2_O3/lh3[P]minigraph/gfa-base.c
// Function: gfa_fix_symm_add
uint32_t gfa_fix_symm_add(gfa_t *g)
{
	uint32_t n_err = 0, v, n_vtx = gfa_n_vtx(g);
	int i;
	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) {
			int j, nw;
			gfa_arc_t *aw, *avi = &av[i];
			if (avi->del || avi->comp) continue;
			nw = gfa_arc_n(g, avi->w^1);
			aw = gfa_arc_a(g, avi->w^1);
			for (j = 0; j < nw; ++j) {
				gfa_arc_t *awj = &aw[j];
				if (awj->del || awj->comp) continue;
				if (awj->w == (v^1) && awj->ov == avi->ow && awj->ow == avi->ov) { // complement found
					awj->comp = 1;
					awj->link_id = avi->link_id;
					break;
				}
			}
			if (j == nw) {
				gfa_arc_t *arc_old = g->arc, *arc_new;
				arc_new = gfa_add_arc1(g, avi->w^1, v^1, avi->ow, avi->ov, avi->link_id, 1);
				if (arc_old != g->arc) av = gfa_arc_a(g, v); // g->arc may be reallocated
				arc_new->rank = av[i].rank;
			}
		}
	}
	if (n_vtx < gfa_n_vtx(g)) {
		gfa_arc_sort(g);
		gfa_arc_index(g);
	}
	return n_err;
}

// Assembly:
movl 0x4(%rdi), %eax
addl %eax, %eax
je 0x5afb
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movabsq $0x4000000000000000, %r15 # imm = 0x4000000000000000
movl %eax, 0x8(%rsp)
movl %eax, %eax
movq %rax, 0x10(%rsp)
xorl %r14d, %r14d
movq 0x58(%rbx), %rax
movq (%rax,%r14,8), %r11
testl %r11d, %r11d
jle 0x5ab8
movq %r11, %r13
shrq $0x1b, %r13
andq $-0x20, %r13
addq 0x48(%rbx), %r13
movl %r14d, %eax
xorl $0x1, %eax
movl %eax, 0xc(%rsp)
andl $0x7fffffff, %r11d      # imm = 0x7FFFFFFF
xorl %ebp, %ebp
movq %r11, 0x18(%rsp)
movq %rbp, %r12
shlq $0x5, %r12
cmpq %r15, 0x18(%r13,%r12)
jae 0x5a79
leaq (%r12,%r13), %rax
movq 0x58(%rbx), %rcx
movl 0x8(%rax), %edx
xorq $0x1, %rdx
movq (%rcx,%rdx,8), %rcx
testl %ecx, %ecx
jle 0x5a0e
movq 0x48(%rbx), %rdx
movq %rcx, %rsi
shrq $0x20, %rsi
movl %ecx, %edi
andl $0x7fffffff, %edi       # imm = 0x7FFFFFFF
shlq $0x5, %rsi
addq %rdx, %rsi
addq $0x18, %rsi
xorl %edx, %edx
movq (%rsi), %r8
cmpq %r15, %r8
jae 0x59fe
movl -0x10(%rsi), %r9d
xorl %r14d, %r9d
cmpl $0x1, %r9d
jne 0x59fe
movl -0x8(%rsi), %r9d
cmpl 0x14(%rax), %r9d
jne 0x59fe
movl -0x4(%rsi), %r9d
cmpl 0x10(%rax), %r9d
je 0x5a87
incq %rdx
addq $0x20, %rsi
cmpq %rdx, %rdi
jne 0x59d1
movl %ecx, %edx
jmp 0x5a10
xorl %edx, %edx
cmpl %ecx, %edx
jne 0x5a79
movq 0x48(%rbx), %rcx
movq %rcx, 0x20(%rsp)
movl 0x8(%rax), %esi
movl 0x10(%rax), %r8d
xorl $0x1, %esi
movl 0x14(%rax), %ecx
movq 0x18(%rax), %r9
movabsq $0x1fffffffffffffff, %rax # imm = 0x1FFFFFFFFFFFFFFF
andq %rax, %r9
movl $0x1, (%rsp)
movq %rbx, %rdi
movl 0xc(%rsp), %edx
callq 0x52e2
movq 0x48(%rbx), %rcx
cmpq %rcx, 0x20(%rsp)
je 0x5a6c
movq 0x58(%rbx), %rdx
movl 0x4(%rdx,%r14,8), %edx
shlq $0x5, %rdx
addq %rdx, %rcx
movq %rcx, %r13
movl 0xc(%r13,%r12), %ecx
movl %ecx, 0xc(%rax)
movq 0x18(%rsp), %r11
incq %rbp
cmpq %r11, %rbp
jne 0x5988
jmp 0x5ab8
btsq $0x3f, %r8
movq %r8, (%rsi)
movq 0x18(%rax), %rdi
movabsq $0x1fffffffffffffff, %r9 # imm = 0x1FFFFFFFFFFFFFFF
andq %r9, %rdi
movabsq $-0x6000000000000000, %r9 # imm = 0xA000000000000000
andq %r9, %r8
orq %rdi, %r8
movq %r8, (%rsi)
jmp 0x5a10
incq %r14
cmpq 0x10(%rsp), %r14
jne 0x5950
movl 0x4(%rbx), %eax
addl %eax, %eax
cmpl %eax, 0x8(%rsp)
jae 0x5aed
movq 0x40(%rbx), %rsi
movq 0x48(%rbx), %rdi
shlq $0x5, %rsi
addq %rdi, %rsi
callq 0x4596
movq %rbx, %rdi
callq 0x54fe
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
xorl %eax, %eax
retq