// File: /workspace/github_cpp_makefile_star2_O3/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, 0x18(%rsp)
movq %rcx, 0x10(%rsp)
movq %rdi, 0x8(%rsp)
cmpb $0x0, 0x50(%rdx)
je 0x1b0fbe
movq %rsi, 0x28(%rsp)
cmpq $0x0, 0x20(%rdx)
je 0x1b0fbe
movq 0x30(%rdx), %r13
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
xorl %r15d, %r15d
movq %rdx, (%rsp)
leaq (%r15,%r15,8), %rcx
movl 0x14(%r13,%rcx,4), %eax
cmpq %r8, %rax
je 0x1b0e1b
leaq (%rax,%rax,8), %rsi
movl 0x1c(%r13,%rsi,4), %esi
cmpq %rsi, %r15
jne 0x1b0fec
leaq (,%rcx,4), %r12
addq %r13, %r12
movl 0x1c(%r12), %ecx
cmpq %r8, %rcx
je 0x1b0e42
leaq (%rcx,%rcx,8), %rcx
movl 0x14(%r13,%rcx,4), %ecx
cmpq %rcx, %r15
jne 0x1b0fcd
cmpl $-0x1, %eax
je 0x1b0f42
movl (%r12), %esi
movl 0x20(%r12), %ecx
shrl $0x5, %ecx
andl $0x1, %ecx
movq %rsi, 0x20(%rsp)
leal (%rcx,%rsi,2), %r14d
xorl $0x1, %r14d
leaq (%rax,%rax,8), %rax
movl (%r13,%rax,4), %ebx
movl 0x20(%r13,%rax,4), %eax
shrl $0x5, %eax
andl $0x1, %eax
leal (%rax,%rbx,2), %ebp
xorl $0x1, %ebp
movq 0x28(%rsp), %rsi
movq 0x28(%rsi), %rax
movq (%rax,%r14,8), %rcx
movq %rcx, %rdi
andq %r8, %rdi
je 0x1b0ec4
movq 0x8(%rsi), %rax
shrq $0x20, %rcx
leaq (%rcx,%rcx,2), %rcx
leaq (%rax,%rcx,8), %r8
addq $0x8, %r8
shlq $0x3, %rdi
leaq (%rdi,%rdi,2), %rdi
xorl %r9d, %r9d
cmpl %ebp, (%r8,%r9)
je 0x1b0f2a
addq $0x18, %r9
cmpq %r9, %rdi
jne 0x1b0eb5
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)
xorl %eax, %eax
movq %rax, 0x40(%rsp)
subq $0x8, %rsp
xorps %xmm0, %xmm0
movq 0x10(%rsp), %rdi
movl %r14d, %edx
movl $0x1, %ecx
leaq 0x40(%rsp), %r8
pushq %rax
pushq $0x1
pushq %rax
pushq 0x38(%rsp)
leaq 0x58(%rsp), %rax
pushq %rax
pushq 0x40(%rsp)
pushq $0xf
callq 0x1b100b
movq 0x40(%rsp), %rdx
addq $0x40, %rsp
movslq 0x54(%rsp), %r10
jmp 0x1b0f32
leaq (%rax,%rcx,8), %rax
movl (%r9,%rax), %r10d
movl 0x18(%r12), %r11d
cmpq %r11, %r10
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
jne 0x1b0f51
incq %r15
cmpq 0x20(%rdx), %r15
jb 0x1b0dfb
jmp 0x1b0fbe
movq 0xe4088(%rip), %rax     # 0x294fe0
movq (%rax), %rdi
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movq 0x20(%rsp), %r9
andl %eax, %r9d
incl %r9d
andl $0x1, %r14d
leaq 0x8135d(%rip), %rcx     # 0x2322d3
movsbl (%r14,%rcx), %r8d
andl %eax, %ebx
incl %ebx
andl $0x1, %ebp
movsbl (%rbp,%rcx), %r14d
subq $0x8, %rsp
leaq 0x90112(%rip), %rsi     # 0x2410a5
leaq 0x90145(%rip), %rdx     # 0x2410df
movl %r9d, %ecx
movl %ebx, %r9d
xorl %eax, %eax
pushq %r10
pushq %r11
pushq %r14
callq 0x22b0
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
movq 0x20(%rsp), %rdx
addq $0x20, %rsp
jmp 0x1b0f42
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x900ba(%rip), %rdi     # 0x24108e
leaq 0x8ec80(%rip), %rsi     # 0x23fc5b
leaq 0x90053(%rip), %rcx     # 0x241035
movl $0x13e3, %edx           # imm = 0x13E3
callq 0x2110
leaq 0x9002b(%rip), %rdi     # 0x24101e
leaq 0x8ec61(%rip), %rsi     # 0x23fc5b
leaq 0x90034(%rip), %rcx     # 0x241035
movl $0x13e2, %edx           # imm = 0x13E2
callq 0x2110