// File: /workspace/github_cpp_makefile_star2_O1/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), %rdx
movq 0x10(%rdx), %rcx
movl %esi, %eax
movq (%rcx,%rax,8), %rdi
testl %edi, %edi
je 0x163b4d
movq %rdi, %rcx
shrq $0x20, %rcx
movq 0x28(%rdx), %rdx
movq (%rbx), %rsi
movq 0x40(%rsi), %rsi
movl %edi, %edi
xorpd %xmm2, %xmm2
xorpd %xmm3, %xmm3
xorpd %xmm4, %xmm4
xorpd %xmm0, %xmm0
movl %ecx, %r8d
leaq (%r8,%r8,4), %r8
leaq (%rdx,%r8,8), %r8
movl (%r8), %r9d
imulq $0x38, %r9, %r10
movb 0x10(%rsi,%r10), %r9b
testb %r9b, %r9b
jle 0x163af7
addsd 0x8(%r8), %xmm0
jmp 0x163aff
jns 0x163aff
addsd 0x8(%r8), %xmm4
movb 0x11(%rsi,%r10), %r10b
testb %r10b, %r10b
jle 0x163b11
addsd 0x10(%r8), %xmm0
jmp 0x163b19
jns 0x163b19
addsd 0x10(%r8), %xmm4
testb %r9b, %r9b
jle 0x163b26
addsd 0x18(%r8), %xmm3
jmp 0x163b2e
jns 0x163b2e
addsd 0x18(%r8), %xmm2
testb %r10b, %r10b
jle 0x163b3b
addsd 0x20(%r8), %xmm3
jmp 0x163b43
jns 0x163b43
addsd 0x20(%r8), %xmm2
incq %rcx
decq %rdi
jne 0x163ad3
jmp 0x163b5d
xorpd %xmm0, %xmm0
xorpd %xmm4, %xmm4
xorpd %xmm3, %xmm3
xorpd %xmm2, %xmm2
movq (%rbx), %rcx
movq 0x40(%rcx), %rcx
imulq $0x38, %rax, %r14
movsd 0x18(%rcx,%r14), %xmm1
ucomisd %xmm0, %xmm1
jne 0x163bd9
jp 0x163bd9
movq (%rbx), %rax
movq 0x40(%rax), %rax
movsd 0x20(%rax,%r14), %xmm1
ucomisd %xmm4, %xmm1
jne 0x163c1f
jp 0x163c1f
movq (%rbx), %rax
movq 0x40(%rax), %rax
movsd 0x28(%rax,%r14), %xmm1
ucomisd %xmm3, %xmm1
jne 0x163c5d
jp 0x163c5d
movq (%rbx), %rax
movq 0x40(%rax), %rax
movsd 0x30(%rax,%r14), %xmm1
ucomisd %xmm2, %xmm1
jne 0x163c8f
jp 0x163c8f
addq $0x18, %rsp
popq %rbx
popq %r14
retq
movq 0x126400(%rip), %rax    # 0x289fe0
movq (%rax), %rdi
leaq 0xcd0a5(%rip), %rsi     # 0x230c8f
leaq 0xcd0c2(%rip), %rdx     # 0x230cb3
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
jmp 0x163b77
movq 0x1263ba(%rip), %rax    # 0x289fe0
movq (%rax), %rdi
leaq 0xcd08e(%rip), %rsi     # 0x230cbe
leaq 0xcd07c(%rip), %rdx     # 0x230cb3
movapd %xmm4, %xmm0
movb $0x2, %al
movsd %xmm2, (%rsp)
movsd %xmm3, 0x8(%rsp)
callq 0x22b0
movsd 0x8(%rsp), %xmm3
movsd (%rsp), %xmm2
jmp 0x163b95
movq 0x12637c(%rip), %rax    # 0x289fe0
movq (%rax), %rdi
leaq 0xcd074(%rip), %rsi     # 0x230ce2
leaq 0xcd03e(%rip), %rdx     # 0x230cb3
movapd %xmm3, %xmm0
movb $0x2, %al
movsd %xmm2, (%rsp)
callq 0x22b0
movsd (%rsp), %xmm2
jmp 0x163bb3
movq 0x12634a(%rip), %rax    # 0x289fe0
movq (%rax), %rdi
leaq 0xcd066(%rip), %rsi     # 0x230d06
leaq 0xcd00c(%rip), %rdx     # 0x230cb3
movapd %xmm2, %xmm0
movb $0x2, %al
addq $0x18, %rsp
popq %rbx
popq %r14
jmp 0x22b0