// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/inter.cpp
// Function: debug_gchain(void*, asg_t const*, mg_lchain_t*, unsigned long, st_mt_t*, vec_sp_node_t*)
void debug_gchain(void *km, const asg_t *g, mg_lchain_t *a, uint64_t n, st_mt_t *dst_done, vec_sp_node_t *out)
{
	uint64_t k, i, v, w, nv; int64_t dd; asg_arc_t *av; mg_path_dst_t dst; uint64_t dst_group;
	for (k = 1; k < n; k++) {
		v = a[k].v^1; w = a[k-1].v^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-1].dist_pre;
            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-1].dist_pre != 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-1].dist_pre, dd);
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %r9, 0x20(%rsp)
movq %r8, 0x18(%rsp)
movq %rcx, 0x28(%rsp)
movq %rdx, %r12
movq %rdi, 0x10(%rsp)
pushq $0x1
popq %r15
movq %rsi, (%rsp)
movq %rdx, 0x8(%rsp)
cmpq 0x28(%rsp), %r15
jae 0x185017
imulq $0x28, %r15, %rax
leaq (%r12,%rax), %r13
movl -0x20(%r12,%rax), %ebp
movl 0x8(%r12,%rax), %ecx
movq %rcx, %r14
xorq $0x1, %r14
movq %rbp, %rbx
xorq $0x1, %rbx
movq 0x8(%rsi), %rax
movq 0x28(%rsi), %rdx
movq (%rdx,%r14,8), %rdi
movl %edi, %edx
shrq $0x20, %rdi
imulq $0x18, %rdi, %r10
leaq (%rax,%r10), %r8
addq $0x8, %r8
imulq $0x18, %rdx, %rdi
xorl %edx, %edx
cmpq %rdx, %rdi
je 0x184f3b
cmpl %ebx, (%r8,%rdx)
je 0x184faa
addq $0x18, %rdx
jmp 0x184f2a
leaq 0x48(%rsp), %rax
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
movups %xmm0, (%rax)
movl %ebx, 0x38(%rsp)
movq %rcx, %r12
movl -0x8(%r13), %r9d
movl %r9d, 0x3c(%rsp)
andq $0x0, 0x40(%rsp)
subq $0x8, %rsp
xorps %xmm0, %xmm0
movq 0x18(%rsp), %rdi
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
movq %r12, %rcx
movq 0x48(%rsp), %r12
movq 0x40(%rsp), %rsi
addq $0x40, %rsp
movslq 0x54(%rsp), %r10
jmp 0x184fb1
addq %r10, %rax
movl (%rdx,%rax), %r10d
movslq -0x8(%r13), %r11
cmpq %r11, %r10
jne 0x184fc2
incq %r15
jmp 0x184edb
movq 0xce017(%rip), %rax     # 0x252fe0
movq (%rax), %rdi
shrl %ecx
incl %ecx
andl $0x1, %r14d
leaq 0x5f248(%rip), %rax     # 0x1e4223
movsbl (%r14,%rax), %r8d
shrl %ebp
incl %ebp
andl $0x1, %ebx
movsbl (%rbx,%rax), %ebx
subq $0x8, %rsp
leaq 0x6df77(%rip), %rsi     # 0x1f2f6d
leaq 0x70021(%rip), %rdx     # 0x1f501e
movl %ebp, %r9d
xorl %eax, %eax
pushq %r10
pushq %r11
pushq %rbx
callq 0x22b0
movq 0x20(%rsp), %rsi
addq $0x20, %rsp
jmp 0x184fba
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq