// File: /workspace/github_c_makefile_star2_O1/lh3[P]fermi2/mag.c
// Function: mag_g_merge
void mag_g_merge(mag_t *g, int rmdup, int min_merge_len)
{
	int i;
	uint64_t n = 0;
	double t;
	t = cputime();
	for (i = 0; i < g->v.n; ++i) { // remove multiedges; FIXME: should we do that?
		if (rmdup) {
			v128_rmdup(&g->v.a[i].nei[0]);
			v128_rmdup(&g->v.a[i].nei[1]);
		} else {
			v128_clean(&g->v.a[i].nei[0]);
			v128_clean(&g->v.a[i].nei[1]);
		}
	}
	for (i = 0; i < g->v.n; ++i) {
		magv_t *p = &g->v.a[i];
		if (p->len < 0) continue;
		while (mag_vh_merge_try(g, p, min_merge_len) == 0) ++n;
		mag_v_flip(g, p);
		while (mag_vh_merge_try(g, p, min_merge_len) == 0) ++n;
	}
	if (fm_verbose >= 3)
		fprintf(stderr, "[M::%s] unambiguously merged %ld pairs of vertices in %.3f sec\n", __func__, (long)n, cputime() - t);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebx
movl %esi, %ebp
movq %rdi, %r14
callq 0x5117
movsd %xmm0, (%rsp)
cmpq $0x0, (%r14)
je 0x11aef
xorl %r15d, %r15d
testl %ebp, %ebp
je 0x11a16
movq 0x10(%r14), %rax
imulq $0x68, %r15, %r12
leaq (%rax,%r12), %rdi
addq $0x20, %rdi
callq 0x107ea
movq 0x10(%r14), %rax
leaq (%rax,%r12), %rdi
addq $0x38, %rdi
callq 0x107ea
jmp 0x11ae3
movq 0x10(%r14), %rcx
imulq $0x68, %r15, %rax
addq %rax, %rcx
addq $0x20, %rcx
cmpq $0x0, (%rcx)
je 0x11a7a
xorl %edx, %edx
xorl %esi, %esi
xorl %edi, %edi
movq 0x10(%rcx), %r8
cmpq $-0x2, (%r8,%rdx)
je 0x11a69
cmpq $0x0, 0x8(%r8,%rdx)
je 0x11a69
movl %edi, %r10d
leal 0x1(%rdi), %r9d
cmpq %r10, %rsi
je 0x11a66
leaq (%r8,%rdx), %r10
movslq %edi, %rdi
shlq $0x4, %rdi
movupd (%r10), %xmm0
movupd %xmm0, (%r8,%rdi)
movl %r9d, %edi
incq %rsi
addq $0x10, %rdx
cmpq %rsi, (%rcx)
ja 0x11a31
movslq %edi, %rdx
jmp 0x11a7c
xorl %edx, %edx
movq %rdx, (%rcx)
movq 0x10(%r14), %rcx
addq %rcx, %rax
addq $0x38, %rax
cmpq $0x0, (%rax)
je 0x11ade
xorl %ecx, %ecx
xorl %edx, %edx
xorl %esi, %esi
movq 0x10(%rax), %rdi
cmpq $-0x2, (%rdi,%rcx)
je 0x11acd
cmpq $0x0, 0x8(%rdi,%rcx)
je 0x11acd
movl %esi, %r9d
leal 0x1(%rsi), %r8d
cmpq %r9, %rdx
je 0x11aca
leaq (%rdi,%rcx), %r9
movslq %esi, %rsi
shlq $0x4, %rsi
movupd (%r9), %xmm0
movupd %xmm0, (%rdi,%rsi)
movl %r8d, %esi
incq %rdx
addq $0x10, %rcx
cmpq %rdx, (%rax)
ja 0x11a96
movslq %esi, %rcx
jmp 0x11ae0
xorl %ecx, %ecx
movq %rcx, (%rax)
incq %r15
cmpq %r15, (%r14)
ja 0x119e7
cmpq $0x0, (%r14)
je 0x11b54
xorl %r13d, %r13d
xorl %r15d, %r15d
movq 0x10(%r14), %r12
imulq $0x68, %r13, %rax
cmpl $0x0, (%r12,%rax)
js 0x11b4a
addq %rax, %r12
decq %r15
movq %r15, %rcx
movq %rcx, %r15
movq %r14, %rdi
movq %r12, %rsi
movl %ebx, %edx
callq 0x1223d
leaq 0x1(%r15), %rcx
testl %eax, %eax
je 0x11b13
movq %r14, %rdi
movq %r12, %rsi
callq 0x12156
movq %r14, %rdi
movq %r12, %rsi
movl %ebx, %edx
callq 0x1223d
incq %r15
testl %eax, %eax
je 0x11b36
incq %r13
cmpq %r13, (%r14)
ja 0x11afb
jmp 0x11b57
xorl %r15d, %r15d
leaq 0x12702(%rip), %rax     # 0x24260
cmpl $0x3, (%rax)
jge 0x11b72
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x1247f(%rip), %rax     # 0x23ff8
movq (%rax), %rbx
callq 0x5117
subsd (%rsp), %xmm0
leaq 0xb662(%rip), %rsi      # 0x1d1ef
leaq 0xb69b(%rip), %rdx      # 0x1d22f
movq %rbx, %rdi
movq %r15, %rcx
movb $0x1, %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x21c0