// File: /workspace/github_cpp_makefile_star2_O3/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 0x1dfd08
xorl %r10d, %r10d
jmp 0x1dfd11
movq (%rcx), %rsi
movl $0x1, %r10d
movq %rdx, (%rsp)
cmpq %r8, %r10
jae 0x1dfe42
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl $0x3fff, %ebx           # imm = 0x3FFF
movq 0x28(%rdi), %rax
movq (%rax,%rsi,8), %r14
movq %r14, %r12
andq %rdx, %r12
je 0x1dff97
movq (%rcx,%r10,8), %rax
movq 0x8(%rdi), %r15
shrq $0x20, %r14
shlq $0x3, %r12
leaq (%r12,%r12,2), %r13
leaq (%r14,%r14,2), %r12
leaq (%r15,%r12,8), %rbp
addq $0x10, %rbp
xorl %r14d, %r14d
cmpl $0x0, -0x4(%rbp,%r14)
js 0x1dfd71
movl -0x8(%rbp,%r14), %r11d
cmpq %r11, %rax
je 0x1dfd7f
addq $0x18, %r14
cmpq %r14, %r13
jne 0x1dfd5f
jmp 0x1dff97
leaq (%r15,%r12,8), %r11
movzwl 0x10(%r14,%r11), %r15d
movq %r15, %r12
andq %rbx, %r12
addq %r9, %r12
cmpq %rbx, %r12
cmovaeq %rbx, %r12
andl $0xc000, %r15d          # imm = 0xC000
orl %r12d, %r15d
movw %r15w, 0x10(%r14,%r11)
movq 0x28(%rdi), %r11
movq %rax, %r14
xorq $0x1, %r14
movq (%r11,%r14,8), %r14
movq %r14, %r12
andq %rdx, %r12
je 0x1dffb6
movq 0x8(%rdi), %r15
shrq $0x20, %r14
shlq $0x3, %r12
leaq (%r12,%r12,2), %r13
leaq (%r14,%r14,2), %r12
leaq (%r15,%r12,8), %rbp
addq $0x10, %rbp
xorl %r14d, %r14d
cmpl $0x0, -0x4(%rbp,%r14)
js 0x1dfdf9
movl -0x8(%rbp,%r14), %r11d
xorq %rsi, %r11
cmpq $0x1, %r11
je 0x1dfe07
addq $0x18, %r14
cmpq %r14, %r13
jne 0x1dfde3
jmp 0x1dffb6
leaq (%r15,%r12,8), %rsi
movzwl 0x10(%r14,%rsi), %r11d
movq %r11, %r15
andq %rbx, %r15
addq %r9, %r15
cmpq %rbx, %r15
cmovaeq %rbx, %r15
andl $0xc000, %r11d          # imm = 0xC000
orl %r15d, %r11d
movw %r11w, 0x10(%r14,%rsi)
incq %r10
movq %rax, %rsi
cmpq %r8, %r10
jne 0x1dfd28
jmp 0x1dfe45
movq %rsi, %rax
movq (%rsp), %rbx
cmpq $-0x1, %rbx
je 0x1dff88
movq 0x28(%rdi), %rcx
movq (%rcx,%rax,8), %rcx
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
andq %rcx, %r8
je 0x1dfe9f
movq 0x8(%rdi), %rsi
shrq $0x20, %rcx
shlq $0x3, %r8
leaq (%r8,%r8,2), %r10
leaq (%rcx,%rcx,2), %r8
leaq (%rsi,%r8,8), %r11
addq $0x10, %r11
xorl %ecx, %ecx
cmpl $0x0, -0x4(%r11,%rcx)
js 0x1dfe96
movl -0x8(%r11,%rcx), %edx
cmpq %rbx, %rdx
je 0x1dfebe
addq $0x18, %rcx
cmpq %rcx, %r10
jne 0x1dfe84
leaq 0x63ae7(%rip), %rdi     # 0x24398d
leaq 0x5fdae(%rip), %rsi     # 0x23fc5b
leaq 0x63e3c(%rip), %rcx     # 0x243cf0
movl $0x4b51, %edx           # imm = 0x4B51
callq 0x2110
leaq (%rsi,%r8,8), %rdx
movzwl 0x10(%rcx,%rdx), %esi
movl $0x3fff, %r8d           # imm = 0x3FFF
movq %rsi, %r10
andq %r8, %r10
addq %r9, %r10
cmpq %r8, %r10
cmovaeq %r8, %r10
andl $0xc000, %esi           # imm = 0xC000
orl %r10d, %esi
movw %si, 0x10(%rcx,%rdx)
movq 0x28(%rdi), %rcx
xorq $0x1, %rbx
movq (%rcx,%rbx,8), %rcx
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
andq %rcx, %rsi
je 0x1dff3e
movq 0x8(%rdi), %rdx
shrq $0x20, %rcx
shlq $0x3, %rsi
leaq (%rsi,%rsi,2), %rdi
leaq (%rcx,%rcx,2), %rsi
leaq (%rdx,%rsi,8), %r8
addq $0x10, %r8
xorl %ecx, %ecx
cmpl $0x0, -0x4(%r8,%rcx)
js 0x1dff35
movl -0x8(%r8,%rcx), %r10d
xorq %rax, %r10
cmpq $0x1, %r10
je 0x1dff5d
addq $0x18, %rcx
cmpq %rcx, %rdi
jne 0x1dff1f
leaq 0x63a48(%rip), %rdi     # 0x24398d
leaq 0x5fd0f(%rip), %rsi     # 0x23fc5b
leaq 0x63d9d(%rip), %rcx     # 0x243cf0
movl $0x4b5e, %edx           # imm = 0x4B5E
callq 0x2110
leaq (%rdx,%rsi,8), %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 0x639ef(%rip), %rdi     # 0x24398d
leaq 0x5fcb6(%rip), %rsi     # 0x23fc5b
leaq 0x63d44(%rip), %rcx     # 0x243cf0
movl $0x4b33, %edx           # imm = 0x4B33
callq 0x2110
leaq 0x639d0(%rip), %rdi     # 0x24398d
leaq 0x5fc97(%rip), %rsi     # 0x23fc5b
leaq 0x63d25(%rip), %rcx     # 0x243cf0
movl $0x4b3f, %edx           # imm = 0x4B3F
callq 0x2110