LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/rcut.cpp
// Function: mc_edges_symm(mc_match_t*)
uint32_t mc_edges_symm(mc_match_t *ma)
{
	uint8_t *del = NULL;
	uint32_t i, k, n = 0;
	mc_edge_t *t = NULL, *m = NULL;
	CALLOC(del, ma->ma.n);

	for (i = 0; i < ma->ma.n; ++i) {
		m = &ma->ma.a[i];
		if (ma_x(*m) == ma_y(*m))
		{
			del[i] = 1, ++n;///self overlap
			continue;
		}
		t = get_mc_edge(ma, ma_y(*m), ma_x(*m));
		if(!t)
		{
			del[i] = 1, ++n;///self overlap
			continue;
		} 
		normalize_mc_edge(m, t);
	}

	if (n > 0) {
		for (i = k = 0; i < ma->ma.n; ++i)
			if (!del[i]) ma->ma.a[k++] = ma->ma.a[i];
		ma->ma.n = k;
		mc_edges_idx(ma);
	}

	free(del);
	return n;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %r14
movq 0x18(%rdi), %r15
movl $0x1, %esi
movq %r15, %rdi
callq 0x2120
movq %rax, %rbx
testq %r15, %r15
je 0x168a87
movq 0x28(%r14), %rax
xorl %ecx, %ecx
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
xorl %ebp, %ebp
movq %rcx, %rsi
shlq $0x4, %rsi
movq (%rax,%rsi), %rdi
movq %rdi, %r9
shrq $0x20, %r9
movl %edi, %r8d
cmpq %r8, %r9
je 0x1689d7
movq 0x10(%r14), %r10
movq (%r10,%r8,8), %r8
movq %r8, %r11
andq %rdx, %r11
je 0x1689d7
addq %rax, %rsi
shrq $0x1c, %r8
andq $-0x10, %r8
addq %rax, %r8
shlq $0x4, %r11
xorl %r10d, %r10d
movq (%r8,%r10), %r12
cmpl %r9d, %r12d
je 0x1689e9
addq $0x10, %r10
cmpq %r10, %r11
jne 0x1689c5
movb $0x1, (%rbx,%rcx)
incl %ebp
incq %rcx
movl %ecx, %esi
cmpq %rsi, %r15
ja 0x168986
jmp 0x168a38
movsd 0x8(%rsi), %xmm0
movsd 0x8(%r8,%r10), %xmm1
ucomisd %xmm1, %xmm0
jae 0x168a18
movq %r12, %rdi
shlq $0x20, %rdi
movq %rdi, (%rsi)
movq (%r8,%r10), %rdi
shrdq $0x20, %r12, %rdi
movq %rdi, (%rsi)
movsd %xmm1, 0x8(%rsi)
jmp 0x1689dd
movq %rdi, %r9
shlq $0x20, %r9
movq %r9, (%r8,%r10)
movq (%rsi), %rsi
shrdq $0x20, %rdi, %rsi
movq %rsi, (%r8,%r10)
movsd %xmm0, 0x8(%r8,%r10)
jmp 0x1689dd
testl %ebp, %ebp
je 0x168a87
xorl %eax, %eax
testq %r15, %r15
je 0x168a79
movl $0x1, %ecx
xorl %edx, %edx
cmpb $0x0, (%rbx,%rdx)
jne 0x168a6e
movq 0x28(%r14), %rsi
shlq $0x4, %rdx
movl %eax, %edi
incl %eax
shlq $0x4, %rdi
movupd (%rsi,%rdx), %xmm0
movupd %xmm0, (%rsi,%rdi)
movq 0x18(%r14), %r15
movl %ecx, %edx
incl %ecx
cmpq %rdx, %r15
ja 0x168a4a
movl %eax, %eax
movq %rax, 0x18(%r14)
movq %r14, %rdi
callq 0x168a9c
jmp 0x168a89
xorl %ebp, %ebp
movq %rbx, %rdi
callq 0x2220
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/rcut.cpp
// Function: get_w_scale(kv_u_trans_t*)
double get_w_scale(kv_u_trans_t *ta)
{
	uint32_t i, max_w_i, min_w_i;
	double max_w = 0, min_w = 0, w;
	max_w_i = min_w_i = (uint32_t)-1;
	for (i = 0; i < ta->n; ++i)
	{
		if(ta->a[i].del) continue;
		if(ta->a[i].nw == 0) continue;
		w = (ta->a[i].nw >= 0? ta->a[i].nw:-ta->a[i].nw);
		if(max_w_i == (uint32_t)-1 || max_w < w) max_w = w, max_w_i = i;
		if(min_w_i == (uint32_t)-1 || min_w > w) min_w = w, min_w_i = i;
	}

	if(max_w_i == (uint32_t)-1 || min_w_i == (uint32_t)-1) return 1;
	if(min_w > 1.1) return 1;
	double sc_max = (double)(1<<30), sc_min = 1.1;

	return MIN(sc_max/max_w, sc_min/min_w) + sc_min;
}

// Assembly:
movq (%rdi), %rax
movsd 0xc8778(%rip), %xmm0    # 0x231310
testq %rax, %rax
je 0x168c9c
movq 0x10(%rdi), %rcx
addq $0x28, %rcx
xorpd %xmm1, %xmm1
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl $0x1, %esi
xorpd %xmm2, %xmm2
movapd 0xd260d(%rip), %xmm3    # 0x23b1d0
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
cmpb $0x0, (%rcx)
js 0x168c3d
movsd -0x8(%rcx), %xmm5
ucomisd %xmm2, %xmm5
jne 0x168bda
jnp 0x168c3d
movapd %xmm5, %xmm6
xorpd %xmm3, %xmm6
cmpl $-0x1, %edx
sete %r9b
movapd %xmm6, %xmm4
cmpnlesd %xmm5, %xmm4
andpd %xmm4, %xmm6
andnpd %xmm5, %xmm4
orpd %xmm6, %xmm4
ucomisd %xmm1, %xmm4
seta %r10b
leal -0x1(%rsi), %r8d
orb %r9b, %r10b
movapd %xmm4, %xmm5
testb %r10b, %r10b
jne 0x168c1a
movapd %xmm1, %xmm5
cmovnel %r8d, %edx
shufpd $0x2, %xmm1, %xmm5      # xmm5 = xmm5[0],xmm1[1]
cmpl $-0x1, %edi
je 0x168c32
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
ucomisd %xmm4, %xmm1
jbe 0x168c39
unpcklpd %xmm4, %xmm5            # xmm5 = xmm5[0],xmm4[0]
movl %r8d, %edi
movapd %xmm5, %xmm1
movl %esi, %r8d
addq $0x30, %rcx
incl %esi
cmpq %r8, %rax
ja 0x168bc8
cmpl $-0x1, %edx
je 0x168c9c
cmpl $-0x1, %edi
je 0x168c9c
movapd %xmm1, %xmm2
unpckhpd %xmm1, %xmm2            # xmm2 = xmm2[1],xmm1[1]
ucomisd 0xcd0ff(%rip), %xmm2    # 0x235d68
ja 0x168c9c
movapd 0xd400d(%rip), %xmm2    # 0x23cc80
divpd %xmm1, %xmm2
movapd %xmm2, %xmm1
unpckhpd %xmm2, %xmm1            # xmm1 = xmm1[1],xmm2[1]
movapd %xmm2, %xmm0
cmplesd %xmm1, %xmm0
andpd %xmm0, %xmm2
andnpd %xmm1, %xmm0
orpd %xmm2, %xmm0
addsd 0xcd0cc(%rip), %xmm0    # 0x235d68
retq
// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/rcut.cpp
// Function: mc_svaux_init(mc_g_t const*, unsigned long)
mc_svaux_t *mc_svaux_init(const mc_g_t *mg, uint64_t x)
{
	uint32_t st, i, max_cc = 0;
	mc_match_t *ma = mg->e;
	mc_svaux_t *b;
	CALLOC(b, 1);
	b->x = x;
	for (st = 0, i = 1; i <= ma->n_seq; ++i)
		if (i == ma->n_seq || ma->cc[st]>>32 != ma->cc[i]>>32)
			max_cc = max_cc > i - st? max_cc : i - st, st = i;
	kv_init(b->cc_edge);
	MALLOC(b->cc_node, max_cc);
	///CALLOC(b->s, ma->n_seq);
	b->s = mg->s.a;
	CALLOC(b->s_opt, ma->n_seq);
	MALLOC(b->bfs, ma->n_seq);

	MALLOC(b->bfs_mark, ma->n_seq); 
	memset(b->bfs_mark, -1, ma->n_seq*sizeof(uint32_t));
	
	CALLOC(b->z, ma->n_seq);
	CALLOC(b->z_opt, ma->n_seq);
	CALLOC(b->f, ma->n_seq);
	return b;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %r15
movq 0x28(%rdi), %r12
movl $0x1, %r13d
movl $0x1, %edi
movl $0x68, %esi
callq 0x2120
movq %rax, %rbx
movq %r14, (%rax)
movl 0x38(%r12), %r14d
xorl %edi, %edi
testq %r14, %r14
je 0x1699ae
leal 0x1(%r14), %ecx
cmpl $0x3, %ecx
movl $0x2, %eax
cmovael %ecx, %eax
xorl %ecx, %ecx
cmpq %r13, %r14
je 0x169991
movq 0x30(%r12), %rdx
movl %edi, %esi
movq (%rdx,%r13,8), %r8
xorq (%rdx,%rsi,8), %r8
shrq $0x20, %r8
je 0x16999e
movl %r13d, %edx
subl %edi, %edx
cmpl %edx, %ecx
cmovbel %edx, %ecx
movl %r13d, %edi
incq %r13
cmpq %r13, %rax
jne 0x169977
movl %ecx, %edi
shlq $0x2, %rdi
jmp 0x1699b1
xorl %r14d, %r14d
callq 0x2280
movq %rax, 0x28(%rbx)
movq 0x10(%r15), %rax
movq %rax, 0x50(%rbx)
movl $0x1, %esi
movq %r14, %rdi
callq 0x2120
movq %rax, 0x58(%rbx)
leaq (,%r14,4), %r15
movq %r15, %rdi
callq 0x2280
movq %rax, 0x30(%rbx)
movq %r15, %rdi
callq 0x2280
movq %rax, 0x38(%rbx)
movq %rax, %rdi
movl $0xff, %esi
movq %r15, %rdx
callq 0x20e0
movl $0x10, %esi
movq %r14, %rdi
callq 0x2120
movq %rax, 0x40(%rbx)
movl $0x10, %esi
movq %r14, %rdi
callq 0x2120
movq %rax, 0x48(%rbx)
movl $0x1, %esi
movq %r14, %rdi
callq 0x2120
movq %rax, 0x60(%rbx)
movq %rbx, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/rcut.cpp
// Function: mb_svaux_init(mb_g_t const*, unsigned long)
mb_svaux_t *mb_svaux_init(const mb_g_t *mg, uint64_t x)
{
	uint32_t st, i, max_cc = 0;
	mb_match_t *ma = mg->e;
	mb_svaux_t *b;
	CALLOC(b, 1);
	b->x = x;
	for (st = 0, i = 1; i <= ma->n_seq; ++i)
		if (i == ma->n_seq || ma->cc[st]>>32 != ma->cc[i]>>32)
			max_cc = max_cc > i - st? max_cc : i - st, st = i;
	kv_init(b->cc_edge);
	MALLOC(b->cc_node, max_cc);

	b->u = mg->u->u.a;
	CALLOC(b->u_opt, ma->n_seq);

	MALLOC(b->bfs, ma->n_seq);
	MALLOC(b->bfs_mark, ma->n_seq); 
	memset(b->bfs_mark, -1, ma->n_seq*sizeof(uint32_t));
	
	CALLOC(b->f, ma->n_seq);
	return b;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %r15
movq 0x8(%rdi), %r12
movl $0x1, %r13d
movl $0x1, %edi
movl $0x58, %esi
callq 0x2120
movq %rax, %rbx
movq %r14, (%rax)
movl 0x38(%r12), %r14d
xorl %edi, %edi
testq %r14, %r14
je 0x169b2b
leal 0x1(%r14), %ecx
cmpl $0x3, %ecx
movl $0x2, %eax
cmovael %ecx, %eax
xorl %ecx, %ecx
cmpq %r13, %r14
je 0x169b0e
movq 0x30(%r12), %rdx
movl %edi, %esi
movq (%rdx,%r13,8), %r8
xorq (%rdx,%rsi,8), %r8
shrq $0x20, %r8
je 0x169b1b
movl %r13d, %edx
subl %edi, %edx
cmpl %edx, %ecx
cmovbel %edx, %ecx
movl %r13d, %edi
incq %r13
cmpq %r13, %rax
jne 0x169af4
movl %ecx, %edi
shlq $0x2, %rdi
jmp 0x169b2e
xorl %r14d, %r14d
callq 0x2280
movq %rax, 0x28(%rbx)
movq (%r15), %rax
movq 0x40(%rax), %rax
movq %rax, 0x40(%rbx)
movl $0x38, %esi
movq %r14, %rdi
callq 0x2120
movq %rax, 0x48(%rbx)
leaq (,%r14,4), %r15
movq %r15, %rdi
callq 0x2280
movq %rax, 0x30(%rbx)
movq %r15, %rdi
callq 0x2280
movq %rax, 0x38(%rbx)
movq %rax, %rdi
movl $0xff, %esi
movq %r15, %rdx
callq 0x20e0
movl $0x1, %esi
movq %r14, %rdi
callq 0x2120
movq %rax, 0x50(%rbx)
movq %rbx, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/rcut.cpp
// Function: init_mc_svaux_t_mul(mc_g_t const*, unsigned long)
mc_svaux_t_mul *init_mc_svaux_t_mul(const mc_g_t *mg, uint64_t n_threads)
{
	uint32_t st, i;
	mc_match_t *ma = mg->e;
	mc_svaux_t_mul *b; CALLOC(b, 1);
	for (st = 0, i = 1, b->n_t = 0; i <= ma->n_seq; ++i)
	{
		if (i == ma->n_seq || ma->cc[st]>>32 != ma->cc[i]>>32)
		{
			b->n_t++;
		}
	}
	b->n_g = b->n_t;
	if(n_threads < b->n_t) b->n_t = n_threads;
	
	kv_init(b->cc_edge);
	MALLOC(b->bfs_mark, ma->n_seq);
	memset(b->bfs_mark, -1, ma->n_seq*sizeof(uint32_t));
	CALLOC(b->s_opt, ma->n_seq);
	CALLOC(b->z, ma->n_seq);
	CALLOC(b->z_opt, ma->n_seq);
	b->s = mg->s.a;

	kv_init(b->bs); CALLOC(b->bs.a, b->n_t); 
	b->bs.n = b->bs.m = b->n_t;
	for (i = 0; i < b->bs.n; i++)
	{
		kv_init(b->bs.a[i].cc_node);
		kv_init(b->bs.a[i].bfs);
		b->bs.a[i].bfs_mark = b->bfs_mark;
		b->bs.a[i].z = b->z;
		b->bs.a[i].z_opt = b->z_opt;
		b->bs.a[i].s = b->s;
		b->bs.a[i].s_opt = b->s_opt;
	}
	return b;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r13
movq %rdi, 0x10(%rsp)
movq 0x28(%rdi), %r14
movl $0x1, %r12d
movl $0x1, %edi
movl $0x60, %esi
callq 0x2120
movl 0x38(%r14), %r15d
testq %r15, %r15
je 0x169c63
leal 0x1(%r15), %ecx
cmpl $0x3, %ecx
movl $0x2, %esi
cmovael %ecx, %esi
xorl %ebx, %ebx
cmpq %r12, %r15
je 0x169c54
movq 0x30(%r14), %rcx
movq (%rcx,%r12,8), %rdx
xorq (%rcx), %rdx
shrq $0x20, %rdx
je 0x169c59
incl %ebx
movl %ebx, 0x58(%rax)
incq %r12
cmpq %r12, %rsi
jne 0x169c3e
jmp 0x169c65
xorl %ebx, %ebx
movl %ebx, 0x5c(%rax)
movl %ebx, %r12d
cmpq %r13, %r12
jbe 0x169c7a
movl %r13d, 0x58(%rax)
movq %r13, %r12
movl %r13d, %ebx
movq %r15, %r14
shlq $0x2, %r14
movq %r14, %rdi
movq %rax, (%rsp)
callq 0x2280
movq %rax, %rdi
movq %rax, 0x8(%rsp)
movq (%rsp), %rax
movq %rdi, 0x30(%rax)
movl $0xff, %esi
movq %r14, %rdx
callq 0x20e0
movl $0x1, %esi
movq %r15, %rdi
callq 0x2120
movq %rax, %rbp
movq (%rsp), %rax
movq %rbp, 0x50(%rax)
movl $0x10, %esi
movq %r15, %rdi
callq 0x2120
movq %rax, %r14
movq (%rsp), %rax
movq %r14, 0x38(%rax)
movl $0x10, %esi
movq %r15, %rdi
callq 0x2120
movq %rax, %r15
movq (%rsp), %rax
movq %r15, 0x40(%rax)
movq 0x10(%rsp), %rax
movq 0x10(%rax), %r13
movq (%rsp), %rax
movq %r13, 0x48(%rax)
movl $0x68, %esi
movq %r12, %rdi
callq 0x2120
movq 0x8(%rsp), %rdx
movq (%rsp), %rcx
movq %rax, 0x10(%rcx)
movq %r12, 0x8(%rcx)
movq %r12, (%rcx)
testl %ebx, %ebx
je 0x169d48
addq $0x60, %rax
movq %rdx, -0x20(%rax)
movq %r14, -0x18(%rax)
movq %r15, -0x10(%rax)
movq %r13, -0x8(%rax)
movq %rbp, (%rax)
addq $0x68, %rax
decq %r12
jne 0x169d2c
movq %rcx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/rcut.cpp
// Function: destroy_mc_svaux_t_mul(mc_svaux_t_mul*)
void destroy_mc_svaux_t_mul(mc_svaux_t_mul *b)
{
	uint32_t i;
	kv_destroy(b->cc_edge);
	free(b->bfs_mark);
	free(b->s_opt);
	free(b->z);
	free(b->z_opt);
	b->s = NULL;
	for (i = 0; i < b->bs.n; i++)
	{
		kv_destroy(b->bs.a[i].cc_node);
		kv_destroy(b->bs.a[i].bfs);
	}
	kv_destroy(b->bs);
	free(b);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x28(%rdi), %rdi
callq 0x2220
movq 0x30(%rbx), %rdi
callq 0x2220
movq 0x50(%rbx), %rdi
callq 0x2220
movq 0x38(%rbx), %rdi
callq 0x2220
movq 0x40(%rbx), %rdi
callq 0x2220
movq $0x0, 0x48(%rbx)
cmpq $0x0, (%rbx)
je 0x169dcc
movl $0x1, %ebp
xorl %eax, %eax
movq 0x10(%rbx), %rcx
imulq $0x68, %rax, %r14
movq 0x20(%rcx,%r14), %rdi
callq 0x2220
movq 0x10(%rbx), %rax
movq 0x38(%rax,%r14), %rdi
callq 0x2220
movl %ebp, %eax
incl %ebp
cmpq %rax, (%rbx)
ja 0x169da3
movq 0x10(%rbx), %rdi
callq 0x2220
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x2220
// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/rcut.cpp
// Function: mc_best(mc_match_t const*, mc_svaux_t*)
uint32_t mc_best(const mc_match_t *ma, mc_svaux_t *b)
{
	uint32_t i, max_i = (uint32_t)-1;
	t_w_t w, max_w;
	for (i = 0, max_w = -1; i < b->cc_size; ++i) {
		uint32_t k = (uint32_t)ma->cc[b->cc_off + i];///uid
		if(b->f[k] || b->s[k] == 0) continue;
		///z += -((t_w_t)(b->s[k])) * (b->z[k].z[0] - b->z[k].z[1]);
		///-((t_w_t)(b->s[k])) * (b->z[k].z[0] - b->z[k].z[1]) current
		///((t_w_t)(b->s[k])) * (b->z[k].z[0] - b->z[k].z[1]) flipped
		w = ((t_w_t)(b->s[k])) * (b->z[k].z[0] - b->z[k].z[1]) * 2;
		if(w <= 0) continue;
		if(w > max_w)
		{
			w = max_w; max_i = k;
		}
	}

	return max_i;
}

// Assembly:
movl 0xc(%rsi), %ecx
testq %rcx, %rcx
je 0x169e65
movq 0x30(%rdi), %rdx
movl 0x8(%rsi), %edi
movq 0x60(%rsi), %r8
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
xorpd %xmm0, %xmm0
movsd 0xc7833(%rip), %xmm1    # 0x231638
movl %edi, %r9d
movq (%rdx,%r9,8), %r9
movl %r9d, %r10d
cmpb $0x0, (%r8,%r10)
je 0x169e1f
incl %edi
decq %rcx
jne 0x169e05
jmp 0x169e6a
movq 0x50(%rsi), %r11
movb (%r11,%r10), %r11b
testb %r11b, %r11b
je 0x169e16
movsbl %r11b, %r11d
xorps %xmm3, %xmm3
cvtsi2sd %r11d, %xmm3
movq 0x40(%rsi), %r11
shlq $0x4, %r10
movsd (%r11,%r10), %xmm2
subsd 0x8(%r11,%r10), %xmm2
mulsd %xmm3, %xmm2
addsd %xmm2, %xmm2
ucomisd %xmm2, %xmm0
jae 0x169e16
ucomisd %xmm1, %xmm2
cmoval %r9d, %eax
jmp 0x169e16
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
retq
// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/rcut.cpp
// Function: mc_score(mc_match_t const*, mc_svaux_t*)
t_w_t mc_score(const mc_match_t *ma, mc_svaux_t *b)
{
	uint32_t i;
	t_w_t z = 0;
	for (i = 0; i < b->cc_size; ++i) {
		uint32_t k = (uint32_t)ma->cc[b->cc_off + i];///uid
		z += -((t_w_t)(b->s[k])) * (b->z[k].z[0] - b->z[k].z[1]);
	}
	return z;
}

// Assembly:
movl 0xc(%rsi), %eax
testq %rax, %rax
je 0x169f32
movq 0x30(%rdi), %rcx
movl 0x8(%rsi), %edx
movq 0x50(%rsi), %rdi
movq 0x40(%rsi), %rsi
xorpd %xmm0, %xmm0
movl %edx, %r8d
movl (%rcx,%r8,8), %r8d
movsbl (%rdi,%r8), %r9d
xorps %xmm1, %xmm1
cvtsi2sd %r9d, %xmm1
shlq $0x4, %r8
movsd (%rsi,%r8), %xmm2
subsd 0x8(%rsi,%r8), %xmm2
mulsd %xmm1, %xmm2
subsd %xmm2, %xmm0
incl %edx
decq %rax
jne 0x169efd
retq
xorps %xmm0, %xmm0
retq
// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/rcut.cpp
// Function: mc_score_all(mc_match_t const*, mc_svaux_t*)
t_w_t mc_score_all(const mc_match_t *ma, mc_svaux_t *b)
{
	uint32_t k;
	t_w_t z = 0;
	for (k = 0; k < ma->n_seq; ++k) 
	{
		z += -((t_w_t)(b->s[k])) * (b->z[k].z[0] - b->z[k].z[1]);
	}
	return z;
}

// Assembly:
movl 0x38(%rdi), %eax
testq %rax, %rax
je 0x169f79
movq 0x40(%rsi), %rcx
movq 0x50(%rsi), %rdx
addq $0x8, %rcx
xorpd %xmm0, %xmm0
xorl %esi, %esi
movsbl (%rdx,%rsi), %edi
xorps %xmm1, %xmm1
cvtsi2sd %edi, %xmm1
movsd -0x8(%rcx), %xmm2
subsd (%rcx), %xmm2
mulsd %xmm1, %xmm2
subsd %xmm2, %xmm0
incq %rsi
addq $0x10, %rcx
cmpq %rsi, %rax
jne 0x169f50
retq
xorps %xmm0, %xmm0
retq
// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/rcut.cpp
// Function: mc_reset_z(mc_match_t const*, mc_svaux_t*)
void mc_reset_z(const mc_match_t *ma, mc_svaux_t *b)
{
	uint32_t i;
	for (i = 0; i < b->cc_size; ++i) {
		uint32_t k = (uint32_t)ma->cc[b->cc_off + i];///uid
		uint32_t o = ma->idx.a[k] >> 32;
		uint32_t j, n = (uint32_t)ma->idx.a[k];
		b->z[k].z[0] = b->z[k].z[1] = 0;
		for (j = 0; j < n; ++j) {
			const mc_edge_t *e = &ma->ma.a[o + j];
			uint32_t t = ma_y(*e);
			if (b->s[t] > 0) b->z[k].z[0] += e->w;
			else if (b->s[t] < 0) b->z[k].z[1] += e->w;
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, -0x8(%rsp)
movl 0xc(%rsi), %eax
testq %rax, %rax
je 0x16a038
movq -0x8(%rsp), %rcx
movq 0x10(%rcx), %rdi
movq 0x30(%rcx), %rdx
movl 0x8(%rsi), %r8d
movq 0x40(%rsi), %r9
xorl %r10d, %r10d
xorps %xmm0, %xmm0
leal (%r8,%r10), %r11d
movl (%rdx,%r11,8), %r11d
movq (%rdi,%r11,8), %r13
shlq $0x4, %r11
movups %xmm0, (%r9,%r11)
testl %r13d, %r13d
je 0x16a02c
movq %r13, %rbx
shrq $0x20, %rbx
leaq (%r9,%r11), %r14
addq $0x8, %r14
addq %r9, %r11
movq -0x8(%rsp), %rcx
movq 0x28(%rcx), %r15
movq 0x50(%rsi), %r12
movl %r13d, %r13d
xorpd %xmm1, %xmm1
xorpd %xmm2, %xmm2
movl %ebx, %ecx
shlq $0x4, %rcx
leaq (%r15,%rcx), %rbp
movl (%r15,%rcx), %ecx
cmpb $0x0, (%r12,%rcx)
jle 0x16a018
addsd 0x8(%rbp), %xmm1
movsd %xmm1, (%r11)
jmp 0x16a024
jns 0x16a024
addsd 0x8(%rbp), %xmm2
movsd %xmm2, (%r14)
incq %rbx
decq %r13
jne 0x169ff7
incq %r10
cmpq %rax, %r10
jne 0x169fb3
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/rcut.cpp
// Function: mc_reset_z_debug(mc_match_t const*, mc_svaux_t*)
void mc_reset_z_debug(const mc_match_t *ma, mc_svaux_t *b)
{
	uint32_t i;
	t_w_t z[2];
	for (i = 0; i < b->cc_size; ++i) {
		uint32_t k = (uint32_t)ma->cc[b->cc_off + i];///uid
		uint32_t o = ma->idx.a[k] >> 32;
		uint32_t j, n = (uint32_t)ma->idx.a[k];
		z[0] = b->z[k].z[0]; z[1] = b->z[k].z[1];
		b->z[k].z[0] = b->z[k].z[1] = 0;
		for (j = 0; j < n; ++j) {
			const mc_edge_t *e = &ma->ma.a[o + j];
			uint32_t t = ma_y(*e);
			if (b->s[t] > 0) b->z[k].z[0] += e->w;
			else if (b->s[t] < 0) b->z[k].z[1] += e->w;
		}
		if(z[0] != b->z[k].z[0]) fprintf(stderr, "ERROR1\n");
		if(z[1] != b->z[k].z[1]) fprintf(stderr, "ERROR2\n");
	}
}

// Assembly:
cmpl $0x0, 0xc(%rsi)
je 0x16a169
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
xorl %ebp, %ebp
xorps %xmm3, %xmm3
movq 0x12af76(%rip), %r12    # 0x294fe0
leaq 0xcc7bb(%rip), %r15     # 0x23682c
movq 0x10(%r14), %rax
movq 0x30(%r14), %rcx
movl 0x8(%rbx), %edx
addl %ebp, %edx
movl (%rcx,%rdx,8), %r13d
movq (%rax,%r13,8), %r9
movq 0x40(%rbx), %rax
shlq $0x4, %r13
movsd (%rax,%r13), %xmm0
movsd 0x8(%rax,%r13), %xmm4
movups %xmm3, (%rax,%r13)
testl %r9d, %r9d
je 0x16a104
movq %r9, %rcx
shrq $0x20, %rcx
leaq (%rax,%r13), %rdx
movq 0x28(%r14), %rsi
movq 0x50(%rbx), %rdi
leaq (%rax,%r13), %r8
addq $0x8, %r8
movl %r9d, %r9d
xorpd %xmm1, %xmm1
xorpd %xmm2, %xmm2
movl %ecx, %r11d
shlq $0x4, %r11
leaq (%rsi,%r11), %r10
movl (%rsi,%r11), %r11d
cmpb $0x0, (%rdi,%r11)
jle 0x16a0ed
addsd 0x8(%r10), %xmm1
movsd %xmm1, (%rdx)
jmp 0x16a0fa
jns 0x16a0fa
addsd 0x8(%r10), %xmm2
movsd %xmm2, (%r8)
incq %rcx
decq %r9
jne 0x16a0cb
jmp 0x16a108
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x16a128
jp 0x16a128
ucomisd 0x8(%rax,%r13), %xmm4
jne 0x16a151
jp 0x16a151
incl %ebp
cmpl 0xc(%rbx), %ebp
jb 0x16a071
jmp 0x16a15b
movq (%r12), %rcx
movl $0x7, %esi
movl $0x1, %edx
movq %r15, %rdi
movsd %xmm4, (%rsp)
callq 0x2410
movsd (%rsp), %xmm4
xorps %xmm3, %xmm3
movq 0x40(%rbx), %rax
jmp 0x16a110
callq 0x1f296
xorps %xmm3, %xmm3
jmp 0x16a11b
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/rcut.cpp
// Function: mc_best_flip(mc_match_t const*, mc_svaux_t*)
void mc_best_flip(const mc_match_t *ma, mc_svaux_t *b)
{
	uint32_t idx;
	for (idx = 0; idx < b->cc_size; ++idx) {
		b->f[(uint32_t)ma->cc[b->cc_off + idx]] = 0;
        ///uint32_t k = (uint32_t)ma->cc[b->cc_off + idx];///uid
	}
	while (1)
	{
		idx = mc_best(ma, b);
		if(idx == (uint32_t)-1) break;
		mc_set_spin(ma, b, idx, -b->s[idx]);
		b->f[idx] = 1;
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
cmpl $0x0, 0xc(%rsi)
je 0x16a6a9
xorl %eax, %eax
movq 0x60(%rbx), %rcx
movq 0x30(%r14), %rdx
movl 0x8(%rbx), %esi
addl %eax, %esi
movl (%rdx,%rsi,8), %edx
movb $0x0, (%rcx,%rdx)
incl %eax
cmpl 0xc(%rbx), %eax
jb 0x16a666
jmp 0x16a6a9
movq 0x50(%rbx), %rcx
movl %eax, %r15d
xorl %edx, %edx
subb (%rcx,%r15), %dl
movsbl %dl, %ecx
movq %r14, %rdi
movq %rbx, %rsi
movl %eax, %edx
callq 0x16a6bf
movq 0x60(%rbx), %rax
movb $0x1, (%rax,%r15)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x169de1
cmpl $-0x1, %eax
jne 0x16a683
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/rcut.cpp
// Function: mc_set_spin(mc_match_t const*, mc_svaux_t*, unsigned int, signed char)
static void mc_set_spin(const mc_match_t *ma, mc_svaux_t *b, uint32_t k, int8_t s)
{
	uint32_t o, j, n;
	int8_t s0 = b->s[k];
	if (s0 == s) return;
	o = ma->idx.a[k] >> 32;
	n = (uint32_t)ma->idx.a[k];
	for (j = 0; j < n; ++j) {
		const mc_edge_t *e = &ma->ma.a[o + j];
		uint32_t t = ma_y(*e);///1->z[0]; (-1)->z[1];
		if (s0 != 0) b->z[t].z[(s0 < 0)] -= e->w; 
		if (s  != 0) b->z[t].z[(s  < 0)] += e->w;
	}
	b->s[k] = s;
}

// Assembly:
movq 0x50(%rsi), %rax
movl %edx, %edx
movzbl (%rax,%rdx), %r8d
cmpb %cl, %r8b
je 0x16a766
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq 0x10(%rdi), %r9
movq (%r9,%rdx,8), %rbx
testl %ebx, %ebx
je 0x16a75c
movq %rbx, %r9
shrq $0x20, %r9
movq 0x28(%rdi), %rdi
movl %r8d, %r10d
shrl $0x7, %r10d
movl %ecx, %r11d
shrb $0x7, %r11b
movzbl %r11b, %r11d
movl %ebx, %ebx
movl %r9d, %r14d
shlq $0x4, %r14
leaq (%rdi,%r14), %r15
movl (%rdi,%r14), %r14d
testq %r8, %r8
je 0x16a736
movq %r14, %r12
shlq $0x4, %r12
addq 0x40(%rsi), %r12
movsd (%r12,%r10,8), %xmm0
subsd 0x8(%r15), %xmm0
movsd %xmm0, (%r12,%r10,8)
testb %cl, %cl
je 0x16a754
shlq $0x4, %r14
addq 0x40(%rsi), %r14
movsd 0x8(%r15), %xmm0
addsd (%r14,%r11,8), %xmm0
movsd %xmm0, (%r14,%r11,8)
incq %r9
decq %rbx
jne 0x16a705
movb %cl, (%rax,%rdx)
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/rcut.cpp
// Function: reset_mc_bp_iter(mc_bp_t*, mc_bp_iter*, unsigned long)
void reset_mc_bp_iter(mc_bp_t* bp, mc_bp_iter *x, uint64_t id)
{
	ma_utg_t *u = NULL;
	uint32_t i, n, occ;
	for (i = 0; i < bp->idx_n; i++)
	{
		if(id >= bp->idx[i]) break;
	}

	id -= bp->idx[i];
	x->chain_id = bp->b_b->chain_weight.a[i].id;
	u = &(bp->b_b->b_ug->u.a[x->chain_id]);
	for (i = occ = 0; i < u->n; i++)
	{
		get_bubbles(bp->b_b, u->a[i]>>33, NULL, NULL, NULL, &n, NULL);
		occ += n;
		if(id < occ)
		{
			x->bid = i;
			x->uid = id - (occ -n);
			break;
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %rbx
movq %rdi, %r15
movq 0x8(%rdi), %rax
movq 0x10(%rdi), %rdx
testq %rdx, %rdx
je 0x16a7bf
movl $0x1, %edi
xorl %ecx, %ecx
cmpq %rbx, (%rax,%rcx,8)
jbe 0x16a7c1
movl %edi, %ecx
incl %edi
cmpq %rcx, %rdx
ja 0x16a7ae
jmp 0x16a7c1
xorl %ecx, %ecx
movq (%r15), %rdx
movq 0xd8(%rdx), %rdi
subq (%rax,%rcx,8), %rbx
shlq $0x5, %rcx
movq 0x10(%rdi,%rcx), %rcx
movq %rsi, 0x10(%rsp)
movq %rcx, (%rsi)
movq 0xc0(%rdx), %rax
movq 0x10(%rax), %rax
leaq (%rcx,%rcx,4), %rcx
cmpl $0x0, 0x10(%rax,%rcx,8)
je 0x16a85a
leaq (%rax,%rcx,8), %rbp
xorl %r13d, %r13d
leaq 0xc(%rsp), %r12
xorl %r14d, %r14d
movq (%r15), %rdi
movq 0x18(%rbp), %rax
movq (%rax,%r13,8), %rsi
shrq $0x21, %rsi
movq $0x0, (%rsp)
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
movq %r12, %r9
callq 0x13df01
movl 0xc(%rsp), %eax
addl %r14d, %eax
cmpq %rax, %rbx
jb 0x16a847
incq %r13
movl 0x10(%rbp), %ecx
movl %eax, %r14d
cmpq %rcx, %r13
jb 0x16a805
jmp 0x16a85a
movq 0x10(%rsp), %rcx
movq %r13, 0x8(%rcx)
movl %r14d, %eax
subq %rax, %rbx
movq %rbx, 0x10(%rcx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/rcut.cpp
// Function: incre_weight(mc_svaux_t*, mc_match_t*, unsigned char*, unsigned int)
t_w_t incre_weight(mc_svaux_t *b_aux, mc_match_t *ma, uint8_t* vis, uint32_t uid)
{
	mc_edge_t *o = NULL;
	uint32_t n, i, t;
	t_w_t w = ((t_w_t)(b_aux->s[uid])) * (b_aux->z[uid].z[0] - b_aux->z[uid].z[1]) * 2;
	t_w_t w_off = 0;
	o = pt_a(*ma, uid);
	n = pt_n(*ma, uid);
	for (i = 0; i < n; ++i) 
	{
		t = ma_y(o[i]);
		if(vis[t] == 0) continue;
        if(t == uid) continue;
		w_off += (b_aux->s[uid]*b_aux->s[t]*o[i].w);
	}
	return w - (w_off*4);//2 for self; 4 for both directions
}

// Assembly:
pushq %rbx
movq 0x40(%rdi), %r9
movq 0x50(%rdi), %rdi
movl %ecx, %r10d
movsbl (%rdi,%r10), %eax
movq 0x10(%rsi), %r8
movq (%r8,%r10,8), %r8
shlq $0x4, %r10
movsd (%r9,%r10), %xmm1
movsd 0x8(%r9,%r10), %xmm2
testl %r8d, %r8d
je 0x16a8ff
movq 0x28(%rsi), %r9
movq %r8, %r10
shrq $0x20, %r10
movl %r8d, %esi
shlq $0x4, %r10
leaq (%r10,%r9), %r8
addq $0x8, %r8
shlq $0x4, %rsi
xorpd %xmm0, %xmm0
xorl %r9d, %r9d
movq -0x8(%r8,%r9), %r11
movl %r11d, %r10d
cmpb $0x0, (%rdx,%r10)
sete %bl
cmpl %ecx, %r11d
sete %r11b
orb %bl, %r11b
jne 0x16a8f4
movsbl (%rdi,%r10), %r10d
imull %eax, %r10d
xorps %xmm3, %xmm3
cvtsi2sd %r10d, %xmm3
mulsd (%r8,%r9), %xmm3
addsd %xmm3, %xmm0
addq $0x10, %r9
cmpq %r9, %rsi
jne 0x16a8bd
jmp 0x16a903
xorpd %xmm0, %xmm0
subsd %xmm2, %xmm1
xorps %xmm2, %xmm2
cvtsi2sd %eax, %xmm2
mulsd %xmm1, %xmm2
addsd %xmm2, %xmm2
mulsd 0xd233a(%rip), %xmm0    # 0x23cc58
addsd %xmm2, %xmm0
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/rcut.cpp
// Function: best_bp(mc_bp_t*, mc_bp_res*)
uint32_t best_bp(mc_bp_t *bp, mc_bp_res *res)
{
	uint32_t i;
	clean_mc_bp_res(res);
	for (i = 0; i < bp->n_thread; i++)
	{
		clean_mc_bp_res(&(bp->res[i]));
	} 
	kt_for(bp->n_thread, worker_for_min_bp, bp, bp->occ);
	
	for (i = 0; i < bp->n_thread; i++)
	{
		if(bp->res[i].chain_id == (uint32_t)-1) continue;
		if(bp->res[i].w <= 0) continue;
		if((bp->res[i].w > res->w) || (bp->res[i].w == res->w && bp->res[i].id < res->id))
		{
			(*res) = bp->res[i];
		}
	}
	if(res->chain_id != (uint32_t)-1) return 1;
	return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
pcmpeqd %xmm0, %xmm0
movdqu %xmm0, (%rsi)
movq $-0x1, 0x10(%rsi)
movabsq $-0x4010000000000000, %rax # imm = 0xBFF0000000000000
movq %rax, 0x18(%rsi)
cmpq $0x0, 0x20(%rdi)
je 0x16abd8
movl $0x1, %ecx
xorl %edx, %edx
movq 0x28(%r14), %rsi
shlq $0x5, %rdx
movdqu %xmm0, (%rsi,%rdx)
movq $-0x1, 0x10(%rsi,%rdx)
movq %rax, 0x18(%rsi,%rdx)
movl %ecx, %edx
movq 0x20(%r14), %rdi
incl %ecx
cmpq %rdx, %rdi
ja 0x16abae
jmp 0x16abda
xorl %edi, %edi
movq 0x18(%r14), %rcx
leaq 0x78(%rip), %rsi        # 0x16ac5d
movq %r14, %rdx
callq 0x108f2c
movq 0x20(%r14), %rcx
testq %rcx, %rcx
je 0x16ac4d
movl $0x1, %eax
xorl %edx, %edx
pxor %xmm0, %xmm0
movq 0x28(%r14), %rsi
shlq $0x5, %rdx
cmpl $-0x1, (%rsi,%rdx)
je 0x16ac44
addq %rdx, %rsi
movsd 0x18(%rsi), %xmm1
ucomisd %xmm1, %xmm0
jae 0x16ac44
ucomisd 0x18(%rbx), %xmm1
ja 0x16ac30
jne 0x16ac44
jp 0x16ac44
movl 0x14(%rsi), %edx
cmpl 0x14(%rbx), %edx
jae 0x16ac44
movupd (%rsi), %xmm1
movups 0x10(%rsi), %xmm2
movups %xmm2, 0x10(%rbx)
movupd %xmm1, (%rbx)
movq 0x20(%r14), %rcx
movl %eax, %edx
incl %eax
cmpq %rdx, %rcx
ja 0x16ac01
xorl %eax, %eax
cmpl $-0x1, (%rbx)
setne %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/rcut.cpp
// Function: mc_solve_bp_cc(mc_bp_t*)
t_w_t mc_solve_bp_cc(mc_bp_t *bp)
{
	mc_bp_res res;
	memset(bp->lock, 0, bp->b_b->ug->g->n_seq);
	while (best_bp(bp, &res))
	{
		mc_set_bp_spin(bp->b_b, bp->ma, bp->b_aux, bp, bp->lock, &(bp->vis[0]), &res);
	}

	return mc_score_all(bp->ma, bp->b_aux);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movq (%rdi), %rax
movq 0x30(%rdi), %rdi
movq 0x10(%rax), %rax
movq 0x18(%rax), %rax
movl 0x14(%rax), %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
xorl %esi, %esi
callq 0x20e0
leaq 0x8(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x16ab78
testl %eax, %eax
je 0x16af50
movq 0x40(%rbx), %rsi
movq 0x38(%rbx), %rdx
movq (%rbx), %rdi
movq 0x30(%rbx), %r8
movq 0x48(%rbx), %r9
movq %r14, (%rsp)
callq 0x16ac9b
jmp 0x16af23
movq 0x40(%rbx), %rax
movl 0x38(%rax), %eax
testq %rax, %rax
je 0x16af9c
movq 0x38(%rbx), %rdx
movq 0x40(%rdx), %rcx
movq 0x50(%rdx), %rdx
addq $0x8, %rcx
xorpd %xmm0, %xmm0
xorl %esi, %esi
movsbl (%rdx,%rsi), %edi
xorps %xmm1, %xmm1
cvtsi2sd %edi, %xmm1
movsd -0x8(%rcx), %xmm2
subsd (%rcx), %xmm2
mulsd %xmm1, %xmm2
subsd %xmm2, %xmm0
incq %rsi
addq $0x10, %rcx
cmpq %rsi, %rax
jne 0x16af72
jmp 0x16afa0
xorpd %xmm0, %xmm0
addq $0x28, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/rcut.cpp
// Function: mc_reset_z_all(mc_match_t const*, mc_svaux_t*)
void mc_reset_z_all(const mc_match_t *ma, mc_svaux_t *b)
{
	// t_w_t z[2];
	uint32_t k;
	for (k = 0; k < ma->n_seq; ++k) 
	{
		uint32_t o = ma->idx.a[k] >> 32;
        uint32_t j, n = (uint32_t)ma->idx.a[k];
		// z[0] = b->z[k].z[0]; z[1] = b->z[k].z[1];
        b->z[k].z[0] = b->z[k].z[1] = 0;
        for (j = 0; j < n; ++j) {
            const mc_edge_t *e = &ma->ma.a[o + j];
            uint32_t t = ma_y(*e);
            if (b->s[t] > 0) b->z[k].z[0] += e->w;
            else if (b->s[t] < 0) b->z[k].z[1] += e->w;
        }
		// if(z[0] != b->z[k].z[0]) fprintf(stderr, "ERROR1-all\n");
        // if(z[1] != b->z[k].z[1]) fprintf(stderr, "ERROR2-all\n");
	}
}

// Assembly:
movl 0x38(%rdi), %eax
testq %rax, %rax
je 0x16b050
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq 0x10(%rdi), %rcx
movq 0x40(%rsi), %rdx
xorl %r8d, %r8d
xorps %xmm0, %xmm0
movq (%rcx,%r8,8), %r15
movq %r8, %r9
shlq $0x4, %r9
movups %xmm0, (%rdx,%r9)
testl %r15d, %r15d
je 0x16b03f
movq %r15, %r10
shrq $0x20, %r10
leaq (%rdx,%r9), %r11
addq $0x8, %r11
addq %rdx, %r9
movq 0x28(%rdi), %rbx
movq 0x50(%rsi), %r14
movl %r15d, %r15d
xorpd %xmm1, %xmm1
xorpd %xmm2, %xmm2
movl %r10d, %r13d
shlq $0x4, %r13
leaq (%rbx,%r13), %r12
movl (%rbx,%r13), %r13d
cmpb $0x0, (%r14,%r13)
jle 0x16b029
addsd 0x8(%r12), %xmm1
movsd %xmm1, (%r9)
jmp 0x16b037
jns 0x16b037
addsd 0x8(%r12), %xmm2
movsd %xmm2, (%r11)
incq %r10
decq %r15
jne 0x16b005
incq %r8
cmpq %rax, %r8
jne 0x16afcb
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/rcut.cpp
// Function: mc_score_all_advance(mc_match_t const*, signed char*)
t_w_t mc_score_all_advance(const mc_match_t *ma, int8_t *s)
{
	uint32_t k;
	t_w_t z[2], zt = 0;
	for (k = 0; k < ma->n_seq; ++k) 
	{
		uint32_t o = ma->idx.a[k] >> 32;
        uint32_t j, n = (uint32_t)ma->idx.a[k];
		z[0] = z[1] = 0;
		for (j = 0; j < n; ++j) {
            const mc_edge_t *e = &ma->ma.a[o + j];
            uint32_t t = ma_y(*e);
            if (s[t] > 0) z[0] += e->w;
            else if (s[t] < 0) z[1] += e->w;
        }
		zt += -((t_w_t)(s[k])) * (z[0] - z[1]);
	}
	return zt;
}

// Assembly:
movl 0x38(%rdi), %eax
testq %rax, %rax
je 0x16b0d3
pushq %rbx
movq 0x10(%rdi), %rcx
xorpd %xmm0, %xmm0
xorl %edx, %edx
movq (%rcx,%rdx,8), %r10
xorpd %xmm1, %xmm1
testl %r10d, %r10d
je 0x16b0b4
movq %r10, %r8
shrq $0x20, %r8
movq 0x28(%rdi), %r9
movl %r10d, %r10d
xorpd %xmm2, %xmm2
movl %r8d, %ebx
shlq $0x4, %rbx
leaq (%r9,%rbx), %r11
movl (%r9,%rbx), %ebx
cmpb $0x0, (%rsi,%rbx)
jle 0x16b0a0
addsd 0x8(%r11), %xmm1
jmp 0x16b0a8
jns 0x16b0a8
addsd 0x8(%r11), %xmm2
incq %r8
decq %r10
jne 0x16b083
subsd %xmm2, %xmm1
movsbl (%rsi,%rdx), %r8d
xorps %xmm2, %xmm2
cvtsi2sd %r8d, %xmm2
mulsd %xmm1, %xmm2
subsd %xmm2, %xmm0
incq %rdx
cmpq %rax, %rdx
jne 0x16b064
popq %rbx
retq
xorps %xmm0, %xmm0
retq
// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/rcut.cpp
// Function: mb_score_all_advance(mc_match_t const*, mb_g_t*)
t_w_t mb_score_all_advance(const mc_match_t *ma, mb_g_t *mbg)
{
	uint32_t k;
	t_w_t z[2], zt = 0;
	for (k = 0; k < ma->n_seq; ++k) 
	{
		uint32_t o = ma->idx.a[k] >> 32;
        uint32_t j, n = (uint32_t)ma->idx.a[k];
		z[0] = z[1] = 0;
		for (j = 0; j < n; ++j) {
            const mc_edge_t *e = &ma->ma.a[o + j];
            uint32_t t = ma_y(*e);
            if (mbg->u->u.a[mbg->u->idx.a[t]>>1].s[mbg->u->idx.a[t]&1] > 0) z[0] += e->w;
            else if (mbg->u->u.a[mbg->u->idx.a[t]>>1].s[mbg->u->idx.a[t]&1] < 0) z[1] += e->w;
        }
		zt += -((t_w_t)(mbg->u->u.a[mbg->u->idx.a[k]>>1].s[mbg->u->idx.a[k]&1])) * (z[0] - z[1]);
	}
	return zt;
}

// Assembly:
movl 0x38(%rdi), %eax
testq %rax, %rax
je 0x16b1a0
pushq %r15
pushq %r14
pushq %rbx
movq 0x10(%rdi), %rcx
movq (%rsi), %rsi
movq 0x28(%rsi), %rdx
movq 0x40(%rsi), %rsi
xorpd %xmm0, %xmm0
xorl %r8d, %r8d
movq (%rcx,%r8,8), %r11
xorpd %xmm1, %xmm1
testl %r11d, %r11d
je 0x16b163
movq %r11, %r9
shrq $0x20, %r9
movq 0x28(%rdi), %r10
movl %r11d, %r11d
xorpd %xmm2, %xmm2
movl %r9d, %r14d
shlq $0x4, %r14
leaq (%r10,%r14), %rbx
movl (%r10,%r14), %r14d
movl (%rdx,%r14,4), %r14d
movl %r14d, %r15d
shrl %r15d
andl $0x1, %r14d
imulq $0x38, %r15, %r15
addq %rsi, %r15
cmpb $0x0, 0x10(%r14,%r15)
jle 0x16b150
addsd 0x8(%rbx), %xmm1
jmp 0x16b157
jns 0x16b157
addsd 0x8(%rbx), %xmm2
incq %r9
decq %r11
jne 0x16b11d
subsd %xmm2, %xmm1
movl (%rdx,%r8,4), %r9d
movl %r9d, %r10d
shrl %r10d
andl $0x1, %r9d
imulq $0x38, %r10, %r10
addq %rsi, %r10
movsbl 0x10(%r9,%r10), %r9d
xorps %xmm2, %xmm2
cvtsi2sd %r9d, %xmm2
mulsd %xmm1, %xmm2
subsd %xmm2, %xmm0
incq %r8
cmpq %rax, %r8
jne 0x16b0fe
popq %rbx
popq %r14
popq %r15
retq
xorps %xmm0, %xmm0
retq
// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/rcut.cpp
// Function: mc_optimize_local(mc_opt_t const*, mc_match_t const*, mc_svaux_t*, unsigned int*)
static t_w_t mc_optimize_local(const mc_opt_t *opt, const mc_match_t *ma, mc_svaux_t *b, uint32_t *n_iter)
{
	uint32_t i, n_flip = 0;
	int32_t n_iter_local = 0;
	while (n_iter_local < opt->max_iter) {
		++(*n_iter);
		ks_shuffle_uint32_t(b->cc_size, b->cc_node, &b->x);
		for (i = n_flip = 0; i < b->cc_size; ++i) {
			uint32_t k = b->cc_node[i];///uid
			int8_t s;
			if (b->z[k].z[0] == b->z[k].z[1]) continue;
			s = b->z[k].z[0] > b->z[k].z[1]? -1 : 1;
			if (b->s[k] != s) {
				// fprintf(stderr, "utg%.6dl, s[k]::%d, s::%d\n", (int32_t)(k)+1, b->s[k], s);
				mc_set_spin(ma, b, k, s);///no need to change the score of k itself
				++n_flip;
			}
		}
		++n_iter_local;
		if (n_flip == 0) break;
	}

	// if(n_flip != 0) mc_best_flip(ma, b);
	return mc_score(ma, b);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, (%rsp)
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r12
xorl %ebp, %ebp
cmpl (%r12), %ebp
jge 0x16b53e
movq (%rsp), %rax
incl (%rax)
movl 0xc(%rbx), %edi
movq 0x28(%rbx), %rsi
movq %rbx, %rdx
callq 0x17249e
movl 0xc(%rbx), %eax
testl %eax, %eax
je 0x16b53e
xorl %r13d, %r13d
xorl %r14d, %r14d
movq 0x28(%rbx), %rcx
movq 0x40(%rbx), %rsi
movl (%rcx,%r13,4), %edx
movq %rdx, %rcx
shlq $0x4, %rcx
movsd (%rsi,%rcx), %xmm0
ucomisd 0x8(%rsi,%rcx), %xmm0
jne 0x16b508
jnp 0x16b52d
seta %cl
negb %cl
orb $0x1, %cl
movq 0x50(%rbx), %rsi
cmpb %cl, (%rsi,%rdx)
je 0x16b52d
movsbl %cl, %ecx
movq %r15, %rdi
movq %rbx, %rsi
callq 0x16a6bf
incl %r14d
movl 0xc(%rbx), %eax
incq %r13
movl %eax, %ecx
cmpq %rcx, %r13
jb 0x16b4e6
incl %ebp
testl %r14d, %r14d
jne 0x16b4be
movq %r15, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x169ee2
// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/rcut.cpp
// Function: mc_perturb(mc_opt_t const*, mc_match_t const*, mc_svaux_t*)
static void mc_perturb(const mc_opt_t *opt, const mc_match_t *ma, mc_svaux_t *b)
{
	uint32_t i;
	for (i = 0; i < b->cc_size; ++i) {
		uint32_t k = (uint32_t)ma->cc[b->cc_off + i];///node id
		double y;
		y = kr_drand_r(&b->x);
		if (y < opt->f_perturb)
			mc_set_spin(ma, b, k, -b->s[k]);
	}
}

// Assembly:
movl 0xc(%rdx), %eax
testl %eax, %eax
je 0x16b656
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r12
movq %rdi, %r10
xorl %ebp, %ebp
movabsq $-0x61c8864680b583eb, %rdi # imm = 0x9E3779B97F4A7C15
movabsq $-0x40a7b892e31b1a47, %r13 # imm = 0xBF58476D1CE4E5B9
movabsq $-0x6b2fb644ecceee15, %r15 # imm = 0x94D049BB133111EB
movabsq $0x3ff0000000000000, %r14 # imm = 0x3FF0000000000000
movsd 0xc6090(%rip), %xmm2    # 0x231638
movq 0x30(%r12), %rcx
movl 0x8(%rbx), %edx
addl %ebp, %edx
movl (%rcx,%rdx,8), %edx
movq (%rbx), %rcx
addq %rdi, %rcx
movq %rcx, %rsi
shrq $0x1e, %rsi
xorq %rcx, %rsi
imulq %r13, %rsi
movq %rsi, %rcx
shrq $0x1b, %rcx
xorq %rsi, %rcx
imulq %r15, %rcx
movq %rcx, %rsi
shrq $0x1f, %rsi
xorq %rcx, %rsi
movq %rsi, (%rbx)
shrq $0xc, %rsi
orq %r14, %rsi
movq %rsi, %xmm0
addsd %xmm2, %xmm0
movsd 0x10(%r10), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x16b63e
movq 0x50(%rbx), %rax
movb (%rax,%rdx), %al
xorl %ecx, %ecx
subb %al, %cl
movsbl %cl, %ecx
movq %r12, %rdi
movq %rbx, %rsi
movq %r10, %r14
callq 0x16a6bf
movsd 0xc6014(%rip), %xmm2    # 0x231638
movq %r14, %r10
movabsq $0x3ff0000000000000, %r14 # imm = 0x3FF0000000000000
movabsq $-0x61c8864680b583eb, %rdi # imm = 0x9E3779B97F4A7C15
movl 0xc(%rbx), %eax
incl %ebp
cmpl %eax, %ebp
jb 0x16b5a8
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/rcut.cpp
// Function: mc_perturb_node(mc_opt_t const*, mc_match_t const*, mc_svaux_t*, int)
static void mc_perturb_node(const mc_opt_t *opt, const mc_match_t *ma, mc_svaux_t *b, int32_t bfs_round)
{
	uint32_t i, k, n_bfs = 0;
	k = (uint32_t)(kr_drand_r(&b->x) * b->cc_size + .499);
	if(k >= b->cc_size) k = b->cc_size - 1;
	k = (uint32_t)ma->cc[b->cc_off + k];///node id
	n_bfs = mc_bfs(ma, b, k, bfs_round, (int32_t)(b->cc_size * opt->f_perturb));
	for (i = 0; i < n_bfs; ++i)
		mc_set_spin(ma, b, b->bfs[i], -b->s[b->bfs[i]]);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movabsq $-0x61c8864680b583eb, %rax # imm = 0x9E3779B97F4A7C15
addq (%rsi), %rax
movq %rax, %rcx
shrq $0x1e, %rcx
xorq %rax, %rcx
movabsq $-0x40a7b892e31b1a47, %rax # imm = 0xBF58476D1CE4E5B9
imulq %rcx, %rax
movq %rax, %rcx
shrq $0x1b, %rcx
xorq %rax, %rcx
movabsq $-0x6b2fb644ecceee15, %rax # imm = 0x94D049BB133111EB
imulq %rcx, %rax
movq %rax, %rcx
shrq $0x1f, %rcx
xorq %rax, %rcx
movq %rcx, (%rsi)
shrq $0xc, %rcx
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
orq %rcx, %rax
movq %rax, %xmm1
addsd 0xc5f6b(%rip), %xmm1    # 0x231638
movl 0xc(%rsi), %eax
cvtsi2sd %rax, %xmm2
movq %rdi, %r14
mulsd %xmm2, %xmm1
addsd 0xc292c(%rip), %xmm1    # 0x22e010
cvttsd2si %xmm1, %rcx
leal -0x1(%rax), %edx
cmpl %ecx, %eax
cmoval %ecx, %edx
movq 0x30(%rdi), %rax
addl 0x8(%rsi), %edx
movq (%rax,%rdx,8), %rax
movl %eax, %ecx
mulsd %xmm2, %xmm0
cvttsd2si %xmm0, %edx
movl %edx, 0xc(%rsp)
movq 0x30(%rsi), %rdx
movq %rsi, 0x10(%rsp)
movq 0x38(%rsi), %rsi
movl %eax, (%rdx)
movl %eax, (%rsi,%rcx,4)
xorl %ebx, %ebx
movl $0x1, %r8d
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
xorl %r9d, %r9d
movl %r8d, 0x8(%rsp)
cmpl %r8d, %ebx
jae 0x16b789
movq 0x10(%r14), %r11
movl %ebx, %r15d
movl 0x8(%rsp), %r8d
movl %r8d, %r12d
movl (%rdx,%r15,4), %ecx
movq (%r11,%rcx,8), %r13
movq %r13, %rbp
andq %rdi, %rbp
je 0x16b781
shrq $0x20, %r13
movq 0x28(%r14), %rbx
movl %r13d, %ecx
shlq $0x4, %rcx
movl (%rbx,%rcx), %ecx
cmpl %eax, (%rsi,%rcx,4)
je 0x16b779
movl %r8d, %r10d
incl %r8d
movl %ecx, (%rdx,%r10,4)
movl %eax, (%rsi,%rcx,4)
incq %r13
decq %rbp
jne 0x16b75d
incq %r15
cmpq %r12, %r15
jne 0x16b745
movl 0xc(%rsp), %r10d
testl %r10d, %r10d
setne %cl
cmpl %r10d, %r8d
seta %r10b
testb %r10b, %cl
jne 0x16b7b1
incl %r9d
movl 0x8(%rsp), %ebx
cmpl $0x3, %r9d
jne 0x16b72c
testl %r8d, %r8d
movq 0x10(%rsp), %r12
je 0x16b7ea
movl %r8d, %ebx
xorl %r15d, %r15d
movq 0x30(%r12), %rax
movq 0x50(%r12), %rcx
movl (%rax,%r15,4), %edx
xorl %eax, %eax
subb (%rcx,%rdx), %al
movsbl %al, %ecx
movq %r14, %rdi
movq %r12, %rsi
callq 0x16a6bf
incq %r15
cmpq %r15, %rbx
jne 0x16b7c1
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/rcut.cpp
// Function: gen_best_clus(mc_clus_t*, unsigned int*, unsigned int*, double*)
uint32_t gen_best_clus(mc_clus_t *bc, uint32_t *off, uint32_t *occ, double *rw)
{
	uint32_t i; (*off) = (*occ) = (uint32_t)-1; (*rw) = -1;
	for (i = 0; i < bc->n_thread; i++) clean_clus_flip_aux(&(bc->aux[i]));
	
	kt_for(bc->n_thread, worker_cal_clus_sc, bc, bc->cc.nn.n);
	
	for (i = 0; i < bc->n_thread; i++) {
		if(bc->aux[i].off == (uint32_t)-1) continue;
		if(bc->aux[i].w < 0) continue;

		if((bc->aux[i].w > (*rw)) || (bc->aux[i].w == (*rw) && bc->aux[i].off < (*off))) {
			(*off) = bc->aux[i].off; (*occ) = bc->aux[i].occ; (*rw) = bc->aux[i].w;
		}
	}
	if((*off) != (uint32_t)-1) return 1;
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r12
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, (%rdx)
movl %eax, (%rsi)
movabsq $-0x4010000000000000, %r13 # imm = 0xBFF0000000000000
movq %r13, (%rcx)
cmpl $0x0, 0x58(%rdi)
je 0x16d148
movq %r15, (%rsp)
movl $0x24, %ebp
xorl %r15d, %r15d
movq 0x60(%r12), %rax
movq %r13, -0xc(%rax,%rbp)
movq $-0x1, -0x4(%rax,%rbp)
movq -0x24(%rax,%rbp), %rdx
movq -0x14(%rax,%rbp), %rdi
xorl %esi, %esi
callq 0x20e0
incq %r15
movl 0x58(%r12), %edi
addq $0x28, %rbp
cmpq %rdi, %r15
jb 0x16d10d
movq (%rsp), %r15
jmp 0x16d14a
xorl %edi, %edi
movq (%r12), %rcx
leaq 0x78(%rip), %rsi        # 0x16d1cd
movq %r12, %rdx
callq 0x108f2c
movl 0x58(%r12), %ecx
testl %ecx, %ecx
je 0x16d1b6
movq 0x60(%r12), %rax
addq $0x24, %rax
xorl %edx, %edx
xorpd %xmm0, %xmm0
movl -0x4(%rax), %esi
cmpl $-0x1, %esi
je 0x16d1a8
movsd -0xc(%rax), %xmm1
ucomisd %xmm1, %xmm0
ja 0x16d1a8
ucomisd (%r14), %xmm1
ja 0x16d197
jne 0x16d1a8
jp 0x16d1a8
cmpl (%rbx), %esi
jae 0x16d1a8
movl %esi, (%rbx)
movl (%rax), %ecx
movl %ecx, (%r15)
movsd %xmm1, (%r14)
movl 0x58(%r12), %ecx
incq %rdx
movl %ecx, %esi
addq $0x28, %rax
cmpq %rsi, %rdx
jb 0x16d175
xorl %eax, %eax
cmpl $-0x1, (%rbx)
setne %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/rcut.cpp
// Function: worker_cal_clus_sc(void*, long, int)
static void worker_cal_clus_sc(void *data, long i, int tid) // callback for kt_for()
{
	mc_clus_t *bc = (mc_clus_t *)data;
	uint32_t *a = bc->cc.nn.a, a_n = bc->cc.nn.n;
	if(a[i] == (uint32_t)-1) return;
	cal_clus_sc0(bc->mg->e, bc->baux, bc, bc->lock, bc->lock_max, a, a_n, i, &(bc->aux[tid]), tid);
}

// Assembly:
movq 0x10(%rdi), %r9
cmpl $-0x1, (%r9,%rsi,4)
je 0x16d218
pushq %rax
movq %rsi, %rax
movl (%rdi), %r11d
movq 0x40(%rdi), %rcx
movq 0x28(%rcx), %r10
movq 0x68(%rdi), %rsi
movq 0x48(%rdi), %rcx
movzbl 0x50(%rdi), %r8d
movslq %edx, %rdx
leaq (%rdx,%rdx,4), %rdx
shlq $0x3, %rdx
addq 0x60(%rdi), %rdx
subq $0x8, %rsp
movq %r10, %rdi
pushq %rdx
pushq %rax
pushq %r11
callq 0x16cefe
addq $0x20, %rsp
popq %rax
retq
// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/rcut.cpp
// Function: flip_chain(mc_match_t const*, mc_svaux_t*, unsigned int*, unsigned int, unsigned int, unsigned int, bits_p*, unsigned char*, unsigned char)
double flip_chain(const mc_match_t *ma, mc_svaux_t *b, uint32_t *a, uint32_t a_n, uint32_t off, uint32_t occ, 
bits_p *vis, uint8_t *lock, uint8_t lock_max)
{
	uint32_t k, kn = off + occ;
	for (k = off; k < kn; k++) {
		vis->a[a[k]>>3] = 0;
		// if(occ == 4 && a[off] == 11279) dbg = 1;
	}
	for (k = off; k < kn; k++) {
		if(lock[a[k]] >= lock_max) continue;
		if(is_set_bits_p((*vis), a[k])) continue;
		set_bits_p((*vis), a[k]); lock[a[k]]++;
		// if(dbg) fprintf(stderr, "[M::%s::] a[%u]::%u, s::%d\n", __func__, k, a[k], b->s[a[k]]);
		mc_set_spin(ma, b, a[k], -b->s[a[k]]);
	}
	return mc_score(ma, b);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, 0x10(%rsp)
movq %rdi, 0x8(%rsp)
leal (%r9,%r8), %eax
cmpl %r8d, %eax
jbe 0x16d2e4
movb 0x60(%rsp), %bpl
movq 0x58(%rsp), %r15
movq 0x50(%rsp), %r12
movl %r8d, %ecx
movl %eax, %esi
movq %rcx, %rdi
movq 0x10(%r12), %r10
movl (%rdx,%rdi,4), %r11d
shrl $0x3, %r11d
movb $0x0, (%r10,%r11)
incq %rdi
cmpq %rdi, %rsi
jne 0x16d255
cmpl %r8d, %eax
jbe 0x16d2e4
leaq (%rdx,%rcx,4), %r13
movl %r9d, %r14d
xorl %ebx, %ebx
movl (%r13,%rbx,4), %edx
cmpb %bpl, (%r15,%rdx)
jae 0x16d2dc
movq 0x10(%r12), %rax
movl %edx, %esi
movl %edx, %ecx
andb $0x7, %cl
movl $0x1, %edi
shll %cl, %edi
shrl $0x3, %esi
movzbl (%rax,%rsi), %ecx
andl $0x7, %edx
btl %edx, %ecx
jb 0x16d2dc
orb %cl, %dil
movb %dil, (%rax,%rsi)
movl (%r13,%rbx,4), %eax
incb (%r15,%rax)
movl (%r13,%rbx,4), %edx
movq 0x10(%rsp), %rsi
movq 0x50(%rsi), %rax
movb (%rax,%rdx), %al
xorl %ecx, %ecx
subb %al, %cl
movsbl %cl, %ecx
movq 0x8(%rsp), %rdi
callq 0x16a6bf
incq %rbx
cmpl %ebx, %r14d
jne 0x16d27d
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x169ee2
// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/rcut.cpp
// Function: mc_solve_clus(mc_clus_t*)
t_w_t mc_solve_clus(mc_clus_t *bc)
{
	uint32_t off, occ/**, r = 0**/; double rw, sc, sc_opt = mc_score(bc->mg->e, bc->baux);
	memset(bc->lock, 0, bc->n*sizeof(*(bc->lock)));
	while (gen_best_clus(bc, &off, &occ, &rw)) {
		sc = flip_chain(bc->mg->e, bc->baux, bc->cc.nn.a, bc->cc.nn.n, off, occ, &(bc->aux[0].vis), bc->lock, bc->lock_max);
		// if(r%10000) {
		// 	fprintf(stderr, "[M::%s::] rw::%f, sc_opt::%f, sc::%f, off::%u, occ::%u, r::%u\n", 
		// 	__func__, rw, sc_opt, sc, off, occ, r);
		// }
		if(sc < sc_opt) {
			fprintf(stderr, "\nwrong::[M::%s::] rw::%f, sc_opt::%f, sc::%f, off::%u, occ::%u\n", 
			__func__, rw, sc_opt, sc, off, occ);
			// if(occ == 2) {
			// uint32_t k;
			// 	for (k = off; k < off + occ; k++) {
			// 		fprintf(stderr, "[M::%s::] a[%u]::%u, s::%d\n", __func__, k, bc->cc.nn.a[k], bc->baux->s[bc->cc.nn.a[k]]);
			// 	}
			// 	test_flip_sc(bc->mg->e, bc->baux, bc->cc.nn.a+off, occ, &(bc->aux[0].vis));
			// }
		}
		sc_opt = sc; //r++;
	}
	return sc_opt;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movq 0x40(%rdi), %rax
movq 0x68(%rdi), %rsi
movq 0x28(%rax), %rdi
callq 0x169ee2
movsd %xmm0, 0x10(%rsp)
movq 0x48(%rbx), %rdi
movl 0x54(%rbx), %edx
xorl %esi, %esi
callq 0x20e0
leaq 0xc(%rsp), %rsi
leaq 0x8(%rsp), %rdx
leaq 0x20(%rsp), %rcx
movq %rbx, %rdi
callq 0x16d0ce
testl %eax, %eax
je 0x16d405
leaq 0xc(%rsp), %r12
leaq 0x8(%rsp), %r13
leaq 0x20(%rsp), %rbp
movq 0x10(%rbx), %rdx
movq 0x40(%rbx), %rax
movq 0x28(%rax), %rdi
movq 0x68(%rbx), %rsi
movl 0xc(%rsp), %r14d
movl 0x8(%rsp), %r15d
movzbl 0x50(%rbx), %eax
subq $0x8, %rsp
movl %r14d, %r8d
movl %r15d, %r9d
pushq %rax
pushq 0x48(%rbx)
pushq 0x60(%rbx)
callq 0x16d219
addq $0x20, %rsp
movsd 0x10(%rsp), %xmm1
movsd %xmm0, 0x18(%rsp)
ucomisd %xmm0, %xmm1
ja 0x16d3d2
movq %rbx, %rdi
movq %r12, %rsi
movq %r13, %rdx
movq %rbp, %rcx
callq 0x16d0ce
movsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
testl %eax, %eax
jne 0x16d365
jmp 0x16d40b
movq 0x127c07(%rip), %rax    # 0x294fe0
movq (%rax), %rdi
movsd 0x20(%rsp), %xmm0
leaq 0xcfe33(%rip), %rsi     # 0x23d21c
leaq 0xcfe6c(%rip), %rdx     # 0x23d25c
movsd 0x18(%rsp), %xmm2
movl %r14d, %ecx
movl %r15d, %r8d
movb $0x3, %al
callq 0x22b0
jmp 0x16d3af
movsd 0x10(%rsp), %xmm0
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/rcut.cpp
// Function: mc_clus_cc(mc_clus_t*)
t_w_t mc_clus_cc(mc_clus_t *bc)
{
	// fprintf(stderr, "+[M::%s::]\n", __func__);
	// double index_time = yak_realtime();
    // uint32_t r = 1;
    t_w_t sc_opt, sc;
	// fprintf(stderr, "-[M::%s::]\n", __func__);
	mc_reset_z(bc->mg->e, bc->baux);
	// fprintf(stderr, "*[M::%s::]\n", __func__);
	sc_opt = mc_score(bc->mg->e, bc->baux); 
	// fprintf(stderr, "[M::%s::] sc_opt: %f\n", __func__, sc_opt);
	while (1) {
        sc = mc_solve_clus(bc);
        // fprintf(stderr, "[M::%s::# round: %u] sc_opt: %f, sc: %f\n", __func__, r, sc_opt, sc);
        if(sc <= (sc_opt+0.0000001)) break;
        sc_opt = sc; //r++;
    }
    // fprintf(stderr, "[M::%s::%.3f] ==> round %u\n", __func__, yak_realtime()-index_time, r);
	return sc;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movq 0x40(%rdi), %rax
movq 0x68(%rdi), %rsi
movq 0x28(%rax), %rdi
callq 0x169f7d
movq 0x40(%rbx), %rax
movq 0x68(%rbx), %rsi
movq 0x28(%rax), %rdi
callq 0x169ee2
movsd %xmm0, 0x8(%rsp)
movq %rbx, %rdi
callq 0x16d301
movsd 0x8(%rsp), %xmm1
addsd 0xcf810(%rip), %xmm1    # 0x23cc70
ucomisd %xmm0, %xmm1
jb 0x16d444
addq $0x10, %rsp
popq %rbx
retq