// File: /workspace/github_c_makefile_star2_O3/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 0x4fe7
movsd %xmm0, (%rsp)
cmpq $0x0, (%r14)
je 0x121c2
xorl %r15d, %r15d
imulq $0x68, %r15, %r12
movq 0x10(%r14), %rax
leaq (%rax,%r12), %rdi
addq $0x20, %rdi
testl %ebp, %ebp
je 0x12089
callq 0x10e1d
movq 0x10(%r14), %rax
leaq (%rax,%r12), %rdi
addq $0x38, %rdi
callq 0x10e1d
jmp 0x1214c
movq (%rdi), %rcx
testq %rcx, %rcx
je 0x120e6
xorl %eax, %eax
xorl %edx, %edx
xorl %esi, %esi
movq 0x10(%rdi), %r8
cmpq $-0x2, (%r8,%rax)
je 0x120d1
cmpq $0x0, 0x8(%r8,%rax)
je 0x120d1
movl %esi, %r10d
leal 0x1(%rsi), %r9d
cmpq %r10, %rdx
je 0x120ce
leaq (%r8,%rax), %rcx
movslq %esi, %rsi
shlq $0x4, %rsi
movupd (%rcx), %xmm0
movupd %xmm0, (%r8,%rsi)
movq (%rdi), %rcx
movl %r9d, %esi
incq %rdx
addq $0x10, %rax
cmpq %rdx, %rcx
ja 0x12097
movslq %esi, %rcx
movq 0x10(%r14), %rax
jmp 0x120e8
xorl %ecx, %ecx
movq %rcx, (%rdi)
addq %r12, %rax
addq $0x38, %rax
movq (%rax), %rdx
xorl %ecx, %ecx
testq %rdx, %rdx
je 0x12149
xorl %esi, %esi
xorl %edi, %edi
movq 0x10(%rax), %r8
cmpq $-0x2, (%r8,%rcx)
je 0x1213a
cmpq $0x0, 0x8(%r8,%rcx)
je 0x1213a
movl %edi, %r10d
leal 0x1(%rdi), %r9d
cmpq %r10, %rsi
je 0x12137
leaq (%r8,%rcx), %rdx
movslq %edi, %rdi
shlq $0x4, %rdi
movupd (%rdx), %xmm0
movupd %xmm0, (%r8,%rdi)
movq (%rax), %rdx
movl %r9d, %edi
incq %rsi
addq $0x10, %rcx
cmpq %rsi, %rdx
ja 0x12100
movslq %edi, %rcx
movq %rcx, (%rax)
incq %r15
movq (%r14), %rax
cmpq %r15, %rax
ja 0x1205a
testq %rax, %rax
je 0x121c2
xorl %r13d, %r13d
xorl %r15d, %r15d
movq 0x10(%r14), %r12
imulq $0x68, %r13, %rcx
cmpl $0x0, (%r12,%rcx)
js 0x121b8
addq %rcx, %r12
decq %r15
movq %r15, %rcx
movq %rcx, %r15
movq %r14, %rdi
movq %r12, %rsi
movl %ebx, %edx
callq 0x128e6
leaq 0x1(%r15), %rcx
testl %eax, %eax
je 0x1217e
movq %r14, %rdi
movq %r12, %rsi
callq 0x127ff
movq %r14, %rdi
movq %r12, %rsi
movl %ebx, %edx
callq 0x128e6
incq %r15
testl %eax, %eax
je 0x121a1
movq (%r14), %rax
incq %r13
cmpq %r13, %rax
ja 0x12166
jmp 0x121c5
xorl %r15d, %r15d
leaq 0x13094(%rip), %rax     # 0x25260
cmpl $0x3, (%rax)
jge 0x121e0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x12e11(%rip), %rax     # 0x24ff8
movq (%rax), %rbx
callq 0x4fe7
subsd (%rsp), %xmm0
leaq 0xc1c4(%rip), %rsi      # 0x1e3bf
leaq 0xc1fd(%rip), %rdx      # 0x1e3ff
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