// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/inter.cpp
// Function: debug_ul_vec_t_chain(void*, asg_t const*, ul_vec_t*, st_mt_t*, vec_sp_node_t*)
void debug_ul_vec_t_chain(void *km, const asg_t *g, ul_vec_t *rch, st_mt_t *dst_done, vec_sp_node_t *out)
{
	if(rch->dd == 0) return;
	uint64_t k, i, v, w, nv; int64_t dd; asg_arc_t *av; 
	mg_path_dst_t dst; uint64_t dst_group; uc_block_t *a = rch->bb.a;
	for (k = 0; k < rch->bb.n; k++) {
		if(a[k].pidx != (uint32_t)-1) assert(a[a[k].pidx].aidx == k);
		if(a[k].aidx != (uint32_t)-1) assert(a[a[k].aidx].pidx == k);
		if(a[k].pidx == (uint32_t)-1) continue;

		v = (a[k].hid<<1)|a[k].rev; v ^= 1;
		w = (a[a[k].pidx].hid<<1)|a[a[k].pidx].rev; w ^= 1;
		
		nv = asg_arc_n(g, v); av = asg_arc_a(g, v);
		for (i = 0; i < nv; i++) {
			if(av[i].v == w) break;
		}
		// if(i >= nv) {
		// 	// fprintf(stderr, "[M::%s::]\n", __func__);
		// 	fprintf(stderr, "[M::%s::]\tutg%.6dl(%c)\t->\tutg%.6dl(%c)\n", __func__, (int32_t)(v>>1)+1, "+-"[v&1], (int32_t)(w>>1)+1, "+-"[w&1]);
		// }
		if(i < nv) {
			dd = (int64_t)((uint32_t)(av[i].ul));
		} else {
			memset(&dst, 0, sizeof(dst));
            dst.v = w; 
            dst.target_dist = a[k].pdis;
            dst.target_hash = 0; dst.check_hash = 0;
			hc_shortest_k(km, g, v, 1, &dst, dst.target_dist, MG_MAX_SHORT_K, dst_done, &dst_group, out, NULL, 1, 0, 0);
			dd = dst.dist;
		}
		if(a[k].pdis != dd) {
			fprintf(stderr, "[M::%s::]\tutg%.6dl(%c)\t->\tutg%.6dl(%c)\tdist_pre:%d\td:%ld\n", __func__, (int32_t)(v>>1)+1, "+-"[v&1], 
			(int32_t)(w>>1)+1, "+-"[w&1], a[k].pdis, dd);
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %r8, 0x20(%rsp)
movq %rcx, 0x18(%rsp)
movq %rsi, 0x8(%rsp)
movq %rdi, 0x10(%rsp)
cmpb $0x0, 0x50(%rdx)
je 0x168243
movq 0x30(%rdx), %r13
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
xorl %r15d, %r15d
movq %rdx, (%rsp)
cmpq 0x20(%rdx), %r15
jae 0x168243
imulq $0x24, %r15, %r12
movl 0x14(%r13,%r12), %eax
cmpq %r9, %rax
je 0x1680b4
imulq $0x24, %rax, %rcx
movl 0x1c(%r13,%rcx), %ecx
cmpq %rcx, %r15
jne 0x168252
addq %r13, %r12
movl 0x1c(%r12), %ecx
cmpq %r9, %rcx
je 0x1680d3
imulq $0x24, %rcx, %rcx
movl 0x14(%r13,%rcx), %ecx
cmpq %rcx, %r15
jne 0x168271
cmpl $-0x1, %eax
je 0x1681ce
movl (%r12), %esi
movl 0x20(%r12), %ecx
shrl $0x5, %ecx
andl $0x1, %ecx
movq %rsi, 0x28(%rsp)
leal (%rcx,%rsi,2), %r14d
xorl $0x1, %r14d
imulq $0x24, %rax, %rax
movl (%r13,%rax), %ebx
movl 0x20(%r13,%rax), %eax
shrl $0x5, %eax
andl $0x1, %eax
leal (%rax,%rbx,2), %ebp
xorl $0x1, %ebp
movq 0x8(%rsp), %rcx
movq 0x8(%rcx), %rax
movq 0x28(%rcx), %rcx
movq (%rcx,%r14,8), %rcx
movl %ecx, %edi
shrq $0x20, %rcx
imulq $0x18, %rcx, %rcx
leaq (%rax,%rcx), %rsi
addq $0x8, %rsi
imulq $0x18, %rdi, %rdi
xorl %r8d, %r8d
cmpq %r8, %rdi
je 0x16814d
cmpl %ebp, (%rsi,%r8)
je 0x1681bd
addq $0x18, %r8
jmp 0x16813c
leaq 0x48(%rsp), %rax
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
movups %xmm0, (%rax)
movl %ebp, 0x38(%rsp)
movl 0x18(%r12), %r9d
movl %r9d, 0x3c(%rsp)
andq $0x0, 0x40(%rsp)
subq $0x8, %rsp
xorps %xmm0, %xmm0
movq 0x18(%rsp), %rdi
movq 0x10(%rsp), %rsi
movl %r14d, %edx
pushq $0x1
popq %rcx
leaq 0x40(%rsp), %r8
pushq $0x0
pushq $0x1
pushq $0x0
pushq 0x40(%rsp)
leaq 0x58(%rsp), %rax
pushq %rax
pushq 0x48(%rsp)
pushq $0xf
callq 0x168290
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
movq 0x40(%rsp), %rdx
addq $0x40, %rsp
movslq 0x54(%rsp), %r10
jmp 0x1681c4
addq %rcx, %rax
movl (%r8,%rax), %r10d
movl 0x18(%r12), %r11d
cmpq %r11, %r10
jne 0x1681d6
incq %r15
jmp 0x16808a
movq 0xeae03(%rip), %rax     # 0x252fe0
movq (%rax), %rdi
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movq 0x28(%rsp), %r9
andl %eax, %r9d
incl %r9d
andl $0x1, %r14d
leaq 0x7c028(%rip), %rcx     # 0x1e4223
movsbl (%r14,%rcx), %r8d
andl %eax, %ebx
incl %ebx
andl $0x1, %ebp
movsbl (%rbp,%rcx), %r14d
subq $0x8, %rsp
leaq 0x8ad55(%rip), %rsi     # 0x1f2f6d
leaq 0x8ad88(%rip), %rdx     # 0x1f2fa7
movl %r9d, %ecx
movl %ebx, %r9d
xorl %eax, %eax
pushq %r10
pushq %r11
pushq %r14
callq 0x22b0
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
movq 0x20(%rsp), %rdx
addq $0x20, %rsp
jmp 0x1681ce
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x8ac8d(%rip), %rdi     # 0x1f2ee6
leaq 0x898c3(%rip), %rsi     # 0x1f1b23
leaq 0x8ac96(%rip), %rcx     # 0x1f2efd
movl $0x13e2, %edx           # imm = 0x13E2
callq 0x2110
leaq 0x8acde(%rip), %rdi     # 0x1f2f56
leaq 0x898a4(%rip), %rsi     # 0x1f1b23
leaq 0x8ac77(%rip), %rcx     # 0x1f2efd
movl $0x13e3, %edx           # imm = 0x13E3
callq 0x2110