// File: /workspace/github_c_makefile_star2_O3/lh3[P]fermi2/mag.c
// Function: mag_g_clean
void mag_g_clean(mag_t *g, const magopt_t *opt)
{
	double t;
	int j;

	if ((opt->flag & MAG_F_CLEAN) == 0) return;
	if (g->min_ovlp < opt->min_ovlp) g->min_ovlp = opt->min_ovlp;
	for (j = 2; j <= opt->min_ensr; ++j)
		mag_g_rm_vext(g, opt->min_elen, j);
	mag_g_merge(g, 0, opt->min_merge_len);
	mag_g_rm_edge(g, g->min_ovlp, opt->min_dratio1, opt->min_elen, opt->min_ensr);
	mag_g_merge(g, 1, opt->min_merge_len);
	for (j = 2; j <= opt->min_ensr; ++j)
		mag_g_rm_vext(g, opt->min_elen, j);
	mag_g_merge(g, 0, opt->min_merge_len);
	if (opt->flag & MAG_F_AGGRESSIVE) {
		t = cputime();
		mag_g_pop_open(g, opt->min_elen);
		if (fm_verbose >= 3)
			fprintf(stderr, "[M::%s] popped open bubbles in %.3f sec.\n", __func__, cputime() - t);
	}
	if (!(opt->flag & MAG_F_NO_SIMPL)) {
		t = cputime();
		mag_g_simplify_bubble(g, opt->max_bvtx, opt->max_bdist);
		if (fm_verbose >= 3)
			fprintf(stderr, "[M::%s] simplified complex bubbles in %.3f sec.\n", __func__, cputime() - t);
	}
	mag_g_pop_simple(g, opt->max_bcov, opt->max_bfrac, opt->min_merge_len, opt->flag & MAG_F_AGGRESSIVE);
	mag_g_rm_vint(g, opt->min_elen, opt->min_insr, g->min_ovlp);
	mag_g_rm_edge(g, g->min_ovlp, opt->min_dratio1, opt->min_elen, opt->min_ensr);
	mag_g_merge(g, 1, opt->min_merge_len);
	mag_g_rm_vext(g, opt->min_elen, opt->min_ensr);
	mag_g_merge(g, 0, opt->min_merge_len);
	if (opt->flag & MAG_F_AGGRESSIVE) mag_g_pop_open(g, opt->min_elen);
	mag_g_rm_vext(g, opt->min_elen, opt->min_ensr);
	mag_g_merge(g, 0, opt->min_merge_len);
}

// Assembly:
testb $0x10, (%rsi)
jne 0x1459d
retq
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movl 0x8(%rsi), %eax
cmpl %eax, 0x1c(%rdi)
jge 0x145b6
movl %eax, 0x1c(%rbx)
cmpl $0x2, 0x10(%r14)
jl 0x145d8
movl $0x1, %ebp
incl %ebp
movl 0xc(%r14), %esi
movq %rbx, %rdi
movl %ebp, %edx
callq 0x13f30
cmpl 0x10(%r14), %ebp
jl 0x145c2
movl 0x20(%r14), %edx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x12031
movl 0x1c(%rbx), %esi
cvtss2sd 0x30(%r14), %xmm0
movl 0xc(%r14), %edx
movl 0x10(%r14), %ecx
movq %rbx, %rdi
callq 0x141ea
movl 0x20(%r14), %edx
movl $0x1, %ebp
movq %rbx, %rdi
movl $0x1, %esi
callq 0x12031
cmpl $0x2, 0x10(%r14)
jl 0x14632
incl %ebp
movl 0xc(%r14), %esi
movq %rbx, %rdi
movl %ebp, %edx
callq 0x13f30
cmpl 0x10(%r14), %ebp
jl 0x1461c
movl 0x20(%r14), %edx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x12031
testb $0x20, (%r14)
je 0x1466d
callq 0x4fe7
movsd %xmm0, 0x8(%rsp)
movl 0xc(%r14), %esi
movq %rbx, %rdi
callq 0x18b8f
leaq 0x10bfc(%rip), %rax     # 0x25260
cmpl $0x3, (%rax)
jge 0x14752
testb $-0x80, (%r14)
jne 0x1469e
callq 0x4fe7
movsd %xmm0, 0x8(%rsp)
movl 0x18(%r14), %edx
movl 0x1c(%r14), %esi
movq %rbx, %rdi
callq 0x18080
leaq 0x10bcb(%rip), %rax     # 0x25260
cmpl $0x3, (%rax)
jge 0x14762
movss 0x34(%r14), %xmm0
movss 0x38(%r14), %xmm1
movl (%r14), %edx
movl 0x20(%r14), %esi
andl $0x20, %edx
movq %rbx, %rdi
callq 0x185e2
movl 0xc(%r14), %esi
movl 0x14(%r14), %edx
movl 0x1c(%rbx), %ecx
movq %rbx, %rdi
callq 0x1408d
movl 0x1c(%rbx), %esi
xorps %xmm0, %xmm0
cvtss2sd 0x30(%r14), %xmm0
movl 0xc(%r14), %edx
movl 0x10(%r14), %ecx
movq %rbx, %rdi
callq 0x141ea
movl 0x20(%r14), %edx
movq %rbx, %rdi
movl $0x1, %esi
callq 0x12031
movl 0xc(%r14), %esi
movl 0x10(%r14), %edx
movq %rbx, %rdi
callq 0x13f30
movl 0x20(%r14), %edx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x12031
testb $0x20, (%r14)
je 0x1472c
movl 0xc(%r14), %esi
movq %rbx, %rdi
callq 0x18b8f
movl 0xc(%r14), %esi
movl 0x10(%r14), %edx
movq %rbx, %rdi
callq 0x13f30
movl 0x20(%r14), %edx
movq %rbx, %rdi
xorl %esi, %esi
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x12031
movsd 0x8(%rsp), %xmm0
callq 0x2e14
jmp 0x1466d
movsd 0x8(%rsp), %xmm0
callq 0x2e51
jmp 0x1469e