// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/rcut.cpp
// Function: debug_mb_z(mb_g_t*, unsigned int)
void debug_mb_z(mb_g_t *mbg, uint32_t k)
{
	t_w_t z[4];
	z[0] = z[1] = z[2] = z[3] = 0;
	mb_match_t *ma = mbg->e;
	uint32_t o = ma->idx.a[k] >> 32;
    uint32_t j, n = (uint32_t)ma->idx.a[k];

	for (j = 0; j < n; ++j) {
		const mb_edge_t *e = &ma->ma.a[o + j];
		uint32_t t = ma_y(*e);

		///a[0]->b[0]
		if(mbg->u->u.a[t].s[0] > 0) z[0] += e->w[0];
		else if(mbg->u->u.a[t].s[0] < 0) z[1] += e->w[0];

		///a[0]->b[1]
		if(mbg->u->u.a[t].s[1] > 0) z[0] += e->w[1];
		else if(mbg->u->u.a[t].s[1] < 0) z[1] += e->w[1];

		///a[1]->b[0]
		if(mbg->u->u.a[t].s[0] > 0) z[2] += e->w[2];
		else if(mbg->u->u.a[t].s[0] < 0) z[3] += e->w[2];

		///a[1]->b[1]
		if(mbg->u->u.a[t].s[1] > 0) z[2] += e->w[3];
		else if(mbg->u->u.a[t].s[1] < 0) z[3] += e->w[3];
	}

	if(mbg->u->u.a[k].z[0] != z[0]) fprintf(stderr, "ERROR-0-::%s, z[0]: %f, n-z[0]: %f\n", __func__, z[0], mbg->u->u.a[k].z[0]);
	if(mbg->u->u.a[k].z[1] != z[1]) fprintf(stderr, "ERROR-1-::%s, z[1]: %f, n-z[1]: %f\n", __func__, z[1], mbg->u->u.a[k].z[1]);
	if(mbg->u->u.a[k].z[2] != z[2]) fprintf(stderr, "ERROR-2-::%s, z[2]: %f, n-z[2]: %f\n", __func__, z[2], mbg->u->u.a[k].z[2]);
	if(mbg->u->u.a[k].z[3] != z[3]) fprintf(stderr, "ERROR-3-::%s, z[3]: %f, n-z[3]: %f\n", __func__, z[3], mbg->u->u.a[k].z[3]);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movq 0x8(%rdi), %rcx
movq 0x10(%rcx), %rdx
movl %esi, %eax
movq (%rdx,%rax,8), %rsi
movl %esi, %edx
shrq $0x20, %rsi
xorpd %xmm0, %xmm0
xorpd %xmm4, %xmm4
xorpd %xmm3, %xmm3
xorpd %xmm2, %xmm2
subq $0x1, %rdx
jb 0x125dfc
movq 0x28(%rcx), %r8
movl %esi, %edi
imulq $0x28, %rdi, %r9
leaq (%r8,%r9), %rdi
movl (%r8,%r9), %r8d
movq (%rbx), %r9
movq 0x40(%r9), %r9
imulq $0x38, %r8, %r10
movb 0x10(%r9,%r10), %r8b
testb %r8b, %r8b
jle 0x125db2
addsd 0x8(%rdi), %xmm0
jmp 0x125db9
jns 0x125db9
addsd 0x8(%rdi), %xmm4
movb 0x11(%r9,%r10), %r9b
testb %r9b, %r9b
jle 0x125dca
addsd 0x10(%rdi), %xmm0
jmp 0x125dd1
jns 0x125dd1
addsd 0x10(%rdi), %xmm4
testb %r8b, %r8b
jle 0x125ddd
addsd 0x18(%rdi), %xmm3
jmp 0x125de4
jns 0x125de4
addsd 0x18(%rdi), %xmm2
testb %r9b, %r9b
jle 0x125df0
addsd 0x20(%rdi), %xmm3
jmp 0x125df7
jns 0x125df7
addsd 0x20(%rdi), %xmm2
incq %rsi
jmp 0x125d7e
movq (%rbx), %rcx
movq 0x40(%rcx), %rcx
imulq $0x38, %rax, %r14
movsd 0x18(%rcx,%r14), %xmm1
ucomisd %xmm0, %xmm1
jne 0x125e63
jp 0x125e63
movsd 0x20(%rcx,%r14), %xmm1
ucomisd %xmm4, %xmm1
jne 0x125eb0
jp 0x125eb0
movsd 0x28(%rcx,%r14), %xmm1
ucomisd %xmm3, %xmm1
jne 0x125ef5
jp 0x125ef5
movsd 0x30(%rcx,%r14), %xmm1
ucomisd %xmm2, %xmm1
jne 0x125f2e
jp 0x125f2e
addq $0x18, %rsp
popq %rbx
popq %r14
retq
movq 0x12d176(%rip), %rax    # 0x252fe0
movq (%rax), %rdi
leaq 0xc8f2b(%rip), %rsi     # 0x1eed9f
leaq 0xc8f48(%rip), %rdx     # 0x1eedc3
movb $0x2, %al
movsd %xmm2, (%rsp)
movsd %xmm3, 0x8(%rsp)
movsd %xmm4, 0x10(%rsp)
callq 0x22b0
movsd 0x10(%rsp), %xmm4
movsd 0x8(%rsp), %xmm3
movsd (%rsp), %xmm2
movq (%rbx), %rax
movq 0x40(%rax), %rcx
jmp 0x125e16
movq 0x12d129(%rip), %rax    # 0x252fe0
movq (%rax), %rdi
leaq 0xc8f0d(%rip), %rsi     # 0x1eedce
leaq 0xc8efb(%rip), %rdx     # 0x1eedc3
movapd %xmm4, %xmm0
movb $0x2, %al
movsd %xmm2, (%rsp)
movsd %xmm3, 0x8(%rsp)
callq 0x22b0
movsd 0x8(%rsp), %xmm3
movsd (%rsp), %xmm2
movq (%rbx), %rax
movq 0x40(%rax), %rcx
jmp 0x125e2d
movq 0x12d0e4(%rip), %rax    # 0x252fe0
movq (%rax), %rdi
leaq 0xc8eec(%rip), %rsi     # 0x1eedf2
leaq 0xc8eb6(%rip), %rdx     # 0x1eedc3
movapd %xmm3, %xmm0
movb $0x2, %al
movsd %xmm2, (%rsp)
callq 0x22b0
movsd (%rsp), %xmm2
movq (%rbx), %rax
movq 0x40(%rax), %rcx
jmp 0x125e44
movq 0x12d0ab(%rip), %rax    # 0x252fe0
movq (%rax), %rdi
leaq 0xc8ed7(%rip), %rsi     # 0x1eee16
leaq 0xc8e7d(%rip), %rdx     # 0x1eedc3
movapd %xmm2, %xmm0
movb $0x2, %al
addq $0x18, %rsp
popq %rbx
popq %r14
jmp 0x22b0