// File: chhylp123[P]hifiasm/rcut.cpp
// Function: mc_solve_core_adv(mc_opt_t const*, mc_g_t*, bubble_type*, kv_u_trans_t*)
void mc_solve_core_adv(const mc_opt_t *opt, mc_g_t *mg, bubble_type* bub, kv_u_trans_t *ref)
{
	double index_time = yak_realtime();
	uint32_t st, i;
	mc_svaux_t *b; mc_clus_t *bc; 
	// mc_bp_t *bp = NULL;
	mc_g_cc(mg->e);
	b = mc_svaux_init(mg, opt->seed);
	bc = init_mc_clus_t(opt, mg, bub, asm_opt.thread_num, b, 16); 
	if(ref && bc) bc->asn = gen_ref_bub(bc, ref);
	// bc = gen_mc_clus_t(mg->e, b, bub, ref, asm_opt.thread_num);
	// if(bub) bp = mc_bp_t_init(mg->e, b, bub, asm_opt.thread_num);
	/*******************************for debug************************************/
	// if(bp) mc_init_spin_all(opt, mg, NULL, b);
	// if(bp) mc_solve_bp(bp);
	/*******************************for debug************************************/
	if(VERBOSE_CUT)
	{
		fprintf(stderr, "\n\n\n\n\n*************beg-[M::%s::score->%f] ==> Partition\n", __func__, mc_score_all_advance(mg->e, mg->s.a));
	}
	
	for (st = 0, i = 1; i <= mg->e->n_seq; ++i) {
		if (i == mg->e->n_seq || mg->e->cc[st]>>32 != mg->e->cc[i]>>32) {
			mc_solve_cc_adv(opt, mg, b, st, i - st, bc);
			st = i;
		}
	}

	if(VERBOSE_CUT)
	{
		fprintf(stderr, "##############end-[---M::%s::score->%f] ==> Partition\n", __func__, mc_score_all(mg->e, b));
		mc_status_all(mg->e, mg->s.a);
	}
	

	// if(bp) mc_solve_bp(bp);	
	///mc_write_info(g, b);
	mc_svaux_destroy(b); des_mc_clus_t(bc); 
	// if(bp) destroy_mc_bp_t(&bp);
	fprintf(stderr, "[M::%s::%.3f] ==> Partition\n", __func__, yak_realtime()-index_time);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
callq 0x1b7ca0
movsd %xmm0, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x21b680
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rsi
callq 0x21ba30
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
leaq 0x19e1b1(%rip), %rax    # 0x3c47f8
movl 0x7c(%rax), %ecx
movq -0x38(%rbp), %r8
movl $0x10, %r9d
callq 0x225740
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x226683
cmpq $0x0, -0x40(%rbp)
je 0x226683
movq -0x40(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x225b80
movq %rax, %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x70(%rax)
movl $0x0, -0x2c(%rbp)
movl $0x1, -0x30(%rbp)
movl -0x30(%rbp), %eax
movq -0x10(%rbp), %rcx
movq 0x28(%rcx), %rcx
cmpl 0x38(%rcx), %eax
ja 0x22671a
movl -0x30(%rbp), %eax
movq -0x10(%rbp), %rcx
movq 0x28(%rcx), %rcx
cmpl 0x38(%rcx), %eax
je 0x2266e4
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x30(%rax), %rax
movl -0x2c(%rbp), %ecx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
movq -0x10(%rbp), %rcx
movq 0x28(%rcx), %rcx
movq 0x30(%rcx), %rcx
movl -0x30(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
cmpq %rcx, %rax
je 0x22670a
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x38(%rbp), %rdx
movl -0x2c(%rbp), %ecx
movl -0x30(%rbp), %r8d
subl -0x2c(%rbp), %r8d
movq -0x40(%rbp), %r9
callq 0x222bb0
movl -0x30(%rbp), %eax
movl %eax, -0x2c(%rbp)
jmp 0x22670c
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x226691
movq -0x38(%rbp), %rdi
callq 0x21bc30
movq -0x40(%rbp), %rdi
callq 0x225ab0
movq 0x19d8ad(%rip), %rax    # 0x3c3fe0
movq (%rax), %rax
movq %rax, -0x48(%rbp)
callq 0x1b7ca0
movq -0x48(%rbp), %rdi
subsd -0x28(%rbp), %xmm0
leaq 0x16779d(%rip), %rsi    # 0x38deec
leaq 0x167821(%rip), %rdx    # 0x38df77
movb $0x1, %al
callq 0x22a0
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)