// File: 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
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq $0x0, -0x30(%rbp)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpq 0x18(%rcx), %rax
jae 0x217f7e
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x1c(%rbp), %ecx
cmpl $-0x1, (%rax,%rcx,4)
jne 0x217eac
movq 0x1ac151(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x175a67(%rip), %rsi    # 0x38d900
leaq 0x175b51(%rip), %rdx    # 0x38d9f1
movb $0x0, %al
callq 0x22a0
jmp 0x217f70
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x1c(%rbp), %ecx
movl (%rax,%rcx,4), %eax
shrl %eax
movl %eax, -0x24(%rbp)
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x1c(%rbp), %ecx
movl (%rax,%rcx,4), %eax
andl $0x1, %eax
movl %eax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x40(%rcx), %rcx
movl -0x24(%rbp), %edx
imulq $0x38, %rdx, %rdx
addq %rdx, %rcx
movl -0x28(%rbp), %edx
movl (%rcx,%rdx,4), %ecx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movl -0x24(%rbp), %ecx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
movl -0x28(%rbp), %ecx
movl 0x8(%rax,%rcx,4), %eax
movl %eax, -0x34(%rbp)
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x34(%rbp), %eax
jae 0x217f47
movq -0x30(%rbp), %rax
movl -0x20(%rbp), %ecx
movl (%rax,%rcx,4), %eax
cmpl -0x1c(%rbp), %eax
jne 0x217f3a
jmp 0x217f47
jmp 0x217f3c
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x217f21
movl -0x20(%rbp), %eax
cmpl -0x34(%rbp), %eax
jb 0x217f6e
movq 0x1ac08a(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x1759c2(%rip), %rsi    # 0x38d922
leaq 0x175a8a(%rip), %rdx    # 0x38d9f1
movb $0x0, %al
callq 0x22a0
jmp 0x217f70
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x217e66
movq $0x0, -0x70(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x1, %esi
callq 0x2140
movq %rax, -0x70(%rbp)
movq $0x0, -0x78(%rbp)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpq 0x30(%rcx), %rax
jae 0x218330
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x40(%rcx), %rcx
movl -0x1c(%rbp), %edx
imulq $0x38, %rdx, %rdx
addq %rdx, %rcx
movl (%rcx), %ecx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movl -0x1c(%rbp), %ecx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movl %eax, -0x58(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x40(%rcx), %rcx
movl -0x1c(%rbp), %edx
imulq $0x38, %rdx, %rdx
addq %rdx, %rcx
movl 0x4(%rcx), %ecx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movl -0x1c(%rbp), %ecx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
movl %eax, -0x54(%rbp)
cmpl $0x1, -0x58(%rbp)
jne 0x21804c
cmpl $0x0, -0x54(%rbp)
jne 0x21804c
jmp 0x218322
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x58(%rbp), %eax
jae 0x218078
movq -0x70(%rbp), %rax
movq -0x50(%rbp), %rcx
movl -0x20(%rbp), %edx
movl (%rcx,%rdx,4), %ecx
movb $0x1, (%rax,%rcx)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x218053
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x54(%rbp), %eax
jae 0x2180a4
movq -0x70(%rbp), %rax
movq -0x48(%rbp), %rcx
movl -0x20(%rbp), %edx
movl (%rcx,%rdx,4), %ecx
movb $-0x1, (%rax,%rcx)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x21807f
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x58(%rbp), %eax
jae 0x2181b6
movq -0x50(%rbp), %rax
movl -0x20(%rbp), %ecx
movl (%rax,%rcx,4), %eax
movl %eax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x28(%rcx), %rcx
movl -0x38(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x78(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x38(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x5c(%rbp)
movl $0x0, -0x68(%rbp)
movl $0x0, -0x60(%rbp)
movl -0x60(%rbp), %eax
cmpl -0x5c(%rbp), %eax
jae 0x218181
movq -0x78(%rbp), %rax
movl -0x60(%rbp), %ecx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movl 0x14(%rax), %eax
movl %eax, -0x64(%rbp)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x64(%rbp), %ecx
movq (%rax,%rcx,8), %rax
cmpl $0x0, %eax
jne 0x21813c
jmp 0x218176
movq -0x70(%rbp), %rax
movl -0x64(%rbp), %ecx
movsbl (%rax,%rcx), %eax
cmpl $-0x1, %eax
je 0x21816d
movq 0x1abe8d(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x1757d4(%rip), %rsi    # 0x38d931
leaq 0x17588d(%rip), %rdx    # 0x38d9f1
movb $0x0, %al
callq 0x22a0
jmp 0x218174
movl $0x1, -0x68(%rbp)
jmp 0x218176
movl -0x60(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x60(%rbp)
jmp 0x21810a
cmpl $0x0, -0x68(%rbp)
jne 0x2181a6
movq 0x1abe52(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x175868(%rip), %rsi    # 0x38da00
leaq 0x175852(%rip), %rdx    # 0x38d9f1
movb $0x0, %al
callq 0x22a0
jmp 0x2181a8
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x2180ab
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x54(%rbp), %eax
jae 0x2182c8
movq -0x48(%rbp), %rax
movl -0x20(%rbp), %ecx
movl (%rax,%rcx,4), %eax
movl %eax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x28(%rcx), %rcx
movl -0x38(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x78(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x38(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x5c(%rbp)
movl $0x0, -0x68(%rbp)
movl $0x0, -0x60(%rbp)
movl -0x60(%rbp), %eax
cmpl -0x5c(%rbp), %eax
jae 0x218293
movq -0x78(%rbp), %rax
movl -0x60(%rbp), %ecx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movl 0x14(%rax), %eax
movl %eax, -0x64(%rbp)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x64(%rbp), %ecx
movq (%rax,%rcx,8), %rax
cmpl $0x0, %eax
jne 0x21824e
jmp 0x218288
movq -0x70(%rbp), %rax
movl -0x64(%rbp), %ecx
movsbl (%rax,%rcx), %eax
cmpl $0x1, %eax
je 0x21827f
movq 0x1abd7b(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x175756(%rip), %rsi    # 0x38d9c5
leaq 0x17577b(%rip), %rdx    # 0x38d9f1
movb $0x0, %al
callq 0x22a0
jmp 0x218286
movl $0x1, -0x68(%rbp)
jmp 0x218288
movl -0x60(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x60(%rbp)
jmp 0x21821c
cmpl $0x0, -0x68(%rbp)
jne 0x2182b8
movq 0x1abd40(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x175765(%rip), %rsi    # 0x38da0f
leaq 0x175740(%rip), %rdx    # 0x38d9f1
movb $0x0, %al
callq 0x22a0
jmp 0x2182ba
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x2181bd
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x58(%rbp), %eax
jae 0x2182f4
movq -0x70(%rbp), %rax
movq -0x50(%rbp), %rcx
movl -0x20(%rbp), %edx
movl (%rcx,%rdx,4), %ecx
movb $0x0, (%rax,%rcx)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x2182cf
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x54(%rbp), %eax
jae 0x218320
movq -0x70(%rbp), %rax
movq -0x48(%rbp), %rcx
movl -0x20(%rbp), %edx
movl (%rcx,%rdx,4), %ecx
movb $0x0, (%rax,%rcx)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x2182fb
jmp 0x218322
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x217fab
movq -0x70(%rbp), %rdi
callq 0x2210
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)