// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/rcut.cpp
// Function: debug_mb_nodes(mb_nodes_t*, kv_u_trans_t*, mc_match_t*)
void debug_mb_nodes(mb_nodes_t *x, kv_u_trans_t *ref, mc_match_t* ma)
{
	uint32_t i, k, bid, ori, *a = NULL, a_n, v;
	for (i = 0; i < x->idx.n; i++)
	{
		if(x->idx.a[i] == (uint32_t)-1)
		{
			fprintf(stderr, "ERROR-0-::%s\n", __func__);
			continue;
		}
		bid = x->idx.a[i]>>1; ori = x->idx.a[i] & 1;
		a = x->bid.a + x->u.a[bid].a[ori];
		a_n = x->u.a[bid].occ[ori];
		for (k = 0; k < a_n; k++)
		{
			if(a[k] == i) break;
		}
		if(k >= a_n) fprintf(stderr, "ERROR-1-::%s\n", __func__);
	}
	
	uint32_t *tt[2], t_n[2], o_n, m, t, found;
	int8_t *vis = NULL; CALLOC(vis, x->idx.n);
	u_trans_t *o = NULL;
	for (i = 0; i < x->u.n; i++)///each block
	{
		tt[0] = x->bid.a + x->u.a[i].a[0];
		t_n[0] = x->u.a[i].occ[0];
		tt[1] = x->bid.a + x->u.a[i].a[1];
		t_n[1] = x->u.a[i].occ[1];

		if(t_n[0] == 1 && t_n[1] == 0) continue;

		for (k = 0; k < t_n[0]; k++)
		{
			vis[tt[0][k]] = 1;
		}
		for (k = 0; k < t_n[1]; k++)
		{
			vis[tt[1][k]] = -1;
		}





		for (k = 0; k < t_n[0]; k++)
		{
			v = tt[0][k];
			o = u_trans_a(*ref, v); 
        	o_n = u_trans_n(*ref, v);
			found = 0;
			for (m = 0; m < o_n; m++)
			{
				t = o[m].tn;
				if (pt_n(*ma, t) == 0) continue;
				if (vis[t] != -1) fprintf(stderr, "ERROR-2-::%s\n", __func__);
				else found = 1;
			}
			if(found == 0) fprintf(stderr, "ERROR-2-*::%s\n", __func__);
		}

		for (k = 0; k < t_n[1]; k++)
		{
			v = tt[1][k];
			o = u_trans_a(*ref, v); 
        	o_n = u_trans_n(*ref, v);
			found = 0;
			for (m = 0; m < o_n; m++)
			{
				t = o[m].tn;
				if (pt_n(*ma, t) == 0) continue;
				if (vis[t] != 1) fprintf(stderr, "ERROR-3-::%s\n", __func__);
				else found = 1;
			}
			if(found == 0) fprintf(stderr, "ERROR-3-*::%s\n", __func__);
		}


		for (k = 0; k < t_n[0]; k++)
		{
			vis[tt[0][k]] = 0;
		}
		for (k = 0; k < t_n[1]; k++)
		{
			vis[tt[1][k]] = 0;
		}
	}

	free(vis);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdx, %rbx
movq %rsi, 0x38(%rsp)
movq %rdi, %rax
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
leaq 0xcb87c(%rip), %r12     # 0x1eeba0
leaq 0xcb966(%rip), %r15     # 0x1eec91
leaq 0xcb890(%rip), %r13     # 0x1eebc2
xorl %ebp, %ebp
movq %rdi, 0x8(%rsp)
movl %ebp, %ebp
movq 0x18(%rax), %rdi
cmpq %rbp, %rdi
jbe 0x1233a9
movq %rax, %rdi
movq 0x28(%rax), %rax
movl (%rax,%rbp,4), %ecx
movq %r12, %rsi
cmpq %r14, %rcx
je 0x123393
movl %ecx, %eax
shrl %eax
andl $0x1, %ecx
imulq $0x38, %rax, %rdx
addq 0x40(%rdi), %rdx
movl (%rdx,%rcx,4), %eax
movl 0x8(%rdx,%rcx,4), %ecx
shlq $0x2, %rax
addq 0x10(%rdi), %rax
xorl %edx, %edx
cmpq %rdx, %rcx
je 0x123390
leaq 0x1(%rdx), %rsi
cmpl %ebp, (%rax,%rdx,4)
movq %rsi, %rdx
jne 0x123376
incl %ebp
movq 0x8(%rsp), %rax
jmp 0x123339
movq %r13, %rsi
movq 0x12fc46(%rip), %rax    # 0x252fe0
movq (%rax), %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x22b0
jmp 0x123387
pushq $0x1
popq %rsi
callq 0x2120
movq %rax, %r12
pushq $0x1
popq %r8
xorl %ecx, %ecx
movl %ecx, %ecx
movq 0x8(%rsp), %rax
cmpq %rcx, 0x30(%rax)
jbe 0x123624
movq 0x40(%rax), %rax
movq %rcx, 0x40(%rsp)
imulq $0x38, %rcx, %rdx
movl 0x8(%rax,%rdx), %esi
movl 0xc(%rax,%rdx), %ecx
movq %rsi, 0x30(%rsp)
xorl $0x1, %esi
orl %ecx, %esi
jne 0x1233f5
movq 0x40(%rsp), %rcx
incl %ecx
jmp 0x1233ba
movq 0x8(%rsp), %rsi
movq 0x10(%rsi), %rsi
movl (%rax,%rdx), %edi
movl 0x4(%rax,%rdx), %eax
leaq (%rsi,%rdi,4), %rdx
movq %rdx, 0x18(%rsp)
leaq (%rsi,%rax,4), %rax
movq %rax, 0x20(%rsp)
movl %ecx, %eax
movq %rax, 0x28(%rsp)
xorl %eax, %eax
cmpq %rax, 0x30(%rsp)
je 0x123439
movq 0x18(%rsp), %rcx
movl (%rcx,%rax,4), %ecx
movb $0x1, (%r12,%rcx)
incq %rax
jmp 0x123420
xorl %eax, %eax
cmpq %rax, 0x28(%rsp)
je 0x123454
movq 0x20(%rsp), %rcx
movl (%rcx,%rax,4), %ecx
movb $-0x1, (%r12,%rcx)
incq %rax
jmp 0x12343b
xorl %ecx, %ecx
cmpq 0x30(%rsp), %rcx
je 0x12351f
movq 0x18(%rsp), %rax
movq %rcx, 0x10(%rsp)
movl (%rax,%rcx,4), %eax
movq 0x38(%rsp), %rdx
movq 0x10(%rdx), %rcx
movq 0x28(%rdx), %rdx
movq (%rdx,%rax,8), %rax
movl %eax, %edx
shrq $0x20, %rax
imulq $0x30, %rdx, %rbp
imulq $0x30, %rax, %rax
leaq (%rcx,%rax), %r13
addq $0x14, %r13
xorl %r14d, %r14d
xorl %r15d, %r15d
cmpq %r14, %rbp
je 0x1234e8
movl (%r13,%r14), %eax
movq 0x10(%rbx), %rcx
cmpl $0x0, (%rcx,%rax,8)
je 0x1234dc
cmpb $-0x1, (%r12,%rax)
movl %r8d, %eax
je 0x1234df
movq 0x12fb20(%rip), %rax    # 0x252fe0
movq (%rax), %rdi
leaq 0xcb707(%rip), %rsi     # 0x1eebd1
leaq 0xcb7c0(%rip), %rdx     # 0x1eec91
xorl %eax, %eax
callq 0x22b0
pushq $0x1
popq %r8
movl %r15d, %eax
addq $0x30, %r14
movl %eax, %r15d
jmp 0x12349b
testl %r15d, %r15d
je 0x1234fa
movq 0x10(%rsp), %rcx
incq %rcx
jmp 0x123456
movq 0x12fadf(%rip), %rax    # 0x252fe0
movq (%rax), %rdi
leaq 0xcb795(%rip), %rsi     # 0x1eeca0
leaq 0xcb77f(%rip), %rdx     # 0x1eec91
xorl %eax, %eax
callq 0x22b0
pushq $0x1
popq %r8
jmp 0x1234ed
xorl %ecx, %ecx
cmpq 0x28(%rsp), %rcx
je 0x1235ea
movq 0x20(%rsp), %rax
movq %rcx, 0x10(%rsp)
movl (%rax,%rcx,4), %eax
movq 0x38(%rsp), %rdx
movq 0x10(%rdx), %rcx
movq 0x28(%rdx), %rdx
movq (%rdx,%rax,8), %rax
movl %eax, %edx
shrq $0x20, %rax
imulq $0x30, %rdx, %rbp
imulq $0x30, %rax, %rax
leaq (%rcx,%rax), %r13
addq $0x14, %r13
xorl %r14d, %r14d
xorl %r15d, %r15d
cmpq %r14, %rbp
je 0x1235b3
movl (%r13,%r14), %eax
movq 0x10(%rbx), %rcx
cmpl $0x0, (%rcx,%rax,8)
je 0x1235a7
cmpb $0x1, (%r12,%rax)
movl %r8d, %eax
je 0x1235aa
movq 0x12fa55(%rip), %rax    # 0x252fe0
movq (%rax), %rdi
leaq 0xcb6d0(%rip), %rsi     # 0x1eec65
leaq 0xcb6f5(%rip), %rdx     # 0x1eec91
xorl %eax, %eax
callq 0x22b0
pushq $0x1
popq %r8
movl %r15d, %eax
addq $0x30, %r14
movl %eax, %r15d
jmp 0x123566
testl %r15d, %r15d
je 0x1235c5
movq 0x10(%rsp), %rcx
incq %rcx
jmp 0x123521
movq 0x12fa14(%rip), %rax    # 0x252fe0
movq (%rax), %rdi
leaq 0xcb6d9(%rip), %rsi     # 0x1eecaf
leaq 0xcb6b4(%rip), %rdx     # 0x1eec91
xorl %eax, %eax
callq 0x22b0
pushq $0x1
popq %r8
jmp 0x1235b8
xorl %eax, %eax
cmpq %rax, 0x30(%rsp)
je 0x123605
movq 0x18(%rsp), %rcx
movl (%rcx,%rax,4), %ecx
movb $0x0, (%r12,%rcx)
incq %rax
jmp 0x1235ec
xorl %eax, %eax
cmpq %rax, 0x28(%rsp)
je 0x1233ec
movq 0x20(%rsp), %rcx
movl (%rcx,%rax,4), %ecx
movb $0x0, (%r12,%rcx)
incq %rax
jmp 0x123607
movq %r12, %rdi
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2220