// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/inter.cpp
// Function: append_path_connec(asg_t*, unsigned long, unsigned long, unsigned long*, unsigned long, unsigned long)
void append_path_connec(asg_t *g, uint64_t sn, uint64_t en, uint64_t *pa, uint64_t pn, uint64_t min_ou)
{
	uint64_t nv, k, v, w, i, ou; asg_arc_t *av;
    if(sn != (uint64_t)-1) {
        v = sn; i = 0;
    } else {
        v = pa[0]; i = 1; 
    }

    for (; i < pn; i++) {
        w = pa[i]; 

        nv = asg_arc_n(g, v); av = asg_arc_a(g, v);
        for (k = 0; k < nv; k++) {
            if(av[k].del) continue;
            if(av[k].v == w) {
				ou = av[k].ou; ou += min_ou; 
				if(ou > OU_MASK) ou = OU_MASK;
				av[k].ou = ou;
                break;
            }
        }
		assert(k < nv);

        nv = asg_arc_n(g, w^1); av = asg_arc_a(g, w^1);
        for (k = 0; k < nv; k++) {
            if(av[k].del) continue;
            if(av[k].v == (v^1)) {
                ou = av[k].ou; ou += min_ou; 
				if(ou > OU_MASK) ou = OU_MASK;
				av[k].ou = ou;
                break;
            }
        }
		assert(k < nv);

        v = w;
    }
    // fprintf(stderr, "-3-[M::%s::]\n", __func__); 
    if(en != (uint64_t)-1) {
        w = en;
        // fprintf(stderr, "-3a-[M::%s::]\n", __func__); 
        nv = asg_arc_n(g, v); av = asg_arc_a(g, v);
        for (k = 0; k < nv; k++) {
            if(av[k].del) continue;
            if(av[k].v == w) {
                ou = av[k].ou; ou += min_ou; 
				if(ou > OU_MASK) ou = OU_MASK;
				av[k].ou = ou;
                break;
            }
        }
		assert(k < nv);

        // fprintf(stderr, "-3b-[M::%s::]\n", __func__); 
        nv = asg_arc_n(g, w^1); av = asg_arc_a(g, w^1);
        for (k = 0; k < nv; k++) {
            if(av[k].del) continue;
            if(av[k].v == (v^1)) {
                ou = av[k].ou; ou += min_ou; 
				if(ou > OU_MASK) ou = OU_MASK;
				av[k].ou = ou;
                break;
            }
        }
		assert(k < nv);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
cmpq $-0x1, %rsi
je 0x1929de
xorl %eax, %eax
jmp 0x1929e4
movq (%rcx), %rsi
pushq $0x1
popq %rax
movl $0x3fff, %r10d          # imm = 0x3FFF
cmpq %r8, %rax
jae 0x192aec
movq (%rcx,%rax,8), %r11
movq 0x8(%rdi), %rbx
movq 0x28(%rdi), %r14
movq (%r14,%rsi,8), %r14
movl %r14d, %r15d
shrq $0x20, %r14
imulq $0x18, %r15, %r12
imulq $0x18, %r14, %r15
leaq (%rbx,%r15), %r13
addq $0x10, %r13
xorl %r14d, %r14d
cmpq %r14, %r12
je 0x192bef
cmpl $0x0, -0x4(%r13,%r14)
js 0x192a38
movl -0x8(%r13,%r14), %ebp
cmpq %rbp, %r11
je 0x192a3e
addq $0x18, %r14
jmp 0x192a1d
addq %r15, %rbx
movzwl 0x10(%r14,%rbx), %r15d
movq %r15, %r12
andq %r10, %r12
addq %r9, %r12
cmpq %r10, %r12
cmovaeq %r10, %r12
andl $0xc000, %r15d          # imm = 0xC000
orl %r12d, %r15d
movw %r15w, 0x10(%r14,%rbx)
movq 0x8(%rdi), %rbx
movq 0x28(%rdi), %r14
movq %r11, %r15
xorq $0x1, %r15
movq (%r14,%r15,8), %r14
movl %r14d, %r15d
shrq $0x20, %r14
imulq $0x18, %r15, %r12
imulq $0x18, %r14, %r15
leaq (%rbx,%r15), %r13
addq $0x10, %r13
xorl %r14d, %r14d
cmpq %r14, %r12
je 0x192c0e
cmpl $0x0, -0x4(%r13,%r14)
js 0x192ab3
movl -0x8(%r13,%r14), %ebp
xorq %rsi, %rbp
cmpq $0x1, %rbp
je 0x192ab9
addq $0x18, %r14
jmp 0x192a94
addq %r15, %rbx
movzwl 0x10(%r14,%rbx), %esi
movq %rsi, %r15
andq %r10, %r15
addq %r9, %r15
cmpq %r10, %r15
cmovaeq %r10, %r15
andl $0xc000, %esi           # imm = 0xC000
orl %r15d, %esi
movw %si, 0x10(%r14,%rbx)
incq %rax
movq %r11, %rsi
jmp 0x1929ea
cmpq $-0x1, %rdx
je 0x192be0
movq 0x8(%rdi), %r8
movq 0x28(%rdi), %rax
movq (%rax,%rsi,8), %rax
movl %eax, %ecx
shrq $0x20, %rax
imulq $0x18, %rcx, %r10
imulq $0x18, %rax, %rax
leaq (%rax,%r8), %r11
addq $0x10, %r11
xorl %ecx, %ecx
cmpq %rcx, %r10
je 0x192c2d
cmpl $0x0, -0x4(%r11,%rcx)
js 0x192b35
movl -0x8(%r11,%rcx), %ebx
cmpq %rdx, %rbx
je 0x192b3b
addq $0x18, %rcx
jmp 0x192b1a
addq %r8, %rax
movzwl 0x10(%rcx,%rax), %r8d
movl $0x3fff, %r10d          # imm = 0x3FFF
movq %r8, %r11
andq %r10, %r11
addq %r9, %r11
cmpq %r10, %r11
cmovaeq %r10, %r11
andl $0xc000, %r8d           # imm = 0xC000
orl %r11d, %r8d
movw %r8w, 0x10(%rcx,%rax)
movq 0x8(%rdi), %r8
movq 0x28(%rdi), %rax
xorq $0x1, %rdx
movq (%rax,%rdx,8), %rax
movl %eax, %ecx
shrq $0x20, %rax
imulq $0x18, %rcx, %rdx
imulq $0x18, %rax, %rax
leaq (%rax,%r8), %rdi
addq $0x10, %rdi
xorl %ecx, %ecx
cmpq %rcx, %rdx
je 0x192c4c
cmpl $0x0, -0x4(%rdi,%rcx)
js 0x192bb0
movl -0x8(%rdi,%rcx), %r10d
xorq %rsi, %r10
cmpq $0x1, %r10
je 0x192bb6
addq $0x18, %rcx
jmp 0x192b92
addq %r8, %rax
movzwl 0x10(%rcx,%rax), %edx
movl $0x3fff, %esi           # imm = 0x3FFF
movq %rdx, %rdi
andq %rsi, %rdi
addq %r9, %rdi
cmpq %rsi, %rdi
cmovaeq %rsi, %rdi
andl $0xc000, %edx           # imm = 0xC000
orl %edi, %edx
movw %dx, 0x10(%rcx,%rax)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x62c5f(%rip), %rdi     # 0x1f5855
leaq 0x5ef26(%rip), %rsi     # 0x1f1b23
leaq 0x62fb4(%rip), %rcx     # 0x1f5bb8
movl $0x4b33, %edx           # imm = 0x4B33
callq 0x2110
leaq 0x62c40(%rip), %rdi     # 0x1f5855
leaq 0x5ef07(%rip), %rsi     # 0x1f1b23
leaq 0x62f95(%rip), %rcx     # 0x1f5bb8
movl $0x4b3f, %edx           # imm = 0x4B3F
callq 0x2110
leaq 0x62c21(%rip), %rdi     # 0x1f5855
leaq 0x5eee8(%rip), %rsi     # 0x1f1b23
leaq 0x62f76(%rip), %rcx     # 0x1f5bb8
movl $0x4b51, %edx           # imm = 0x4B51
callq 0x2110
leaq 0x62c02(%rip), %rdi     # 0x1f5855
leaq 0x5eec9(%rip), %rsi     # 0x1f1b23
leaq 0x62f57(%rip), %rcx     # 0x1f5bb8
movl $0x4b5e, %edx           # imm = 0x4B5E
callq 0x2110