// File: /workspace/github_c_makefile_star2_O0/c-zhou[P]oatk/path.c
// Function: make_path_from_str
path_t make_path_from_str(asg_t *asg, char *path_str, char *sid)
{
    int circ;
    uint32_t v, cov;
    uint64_t len, len1;
    double wlen;
    kvec_t(uint32_t) vt;
    char *ptr, *s;

    kv_init(vt);

    while (isspace(*path_str) && *path_str != '\0')
        ++path_str;

    while (*path_str != '\0') {
        ptr = path_str;
        while (!isspace(*ptr) && *ptr != ',' && *ptr !='\0')
            ++ptr;

        if (*(ptr-1) == '+' || *(ptr-1) == '-') {
            s = strdup1(path_str, ptr - path_str - 1);
            v = asg_name2id(asg, s);
            if (v == UINT32_MAX) {
                fprintf(stderr, "[E::%s] sequence does not exist: %s\n", __func__, s);
                exit(EXIT_FAILURE);
            }
            v = (v<<1) | (*(ptr-1)=='-');
            kv_push(uint32_t, vt , v);
            free(s);
        } else {
            fprintf(stderr, "[E::%s] invalid path string: %s\n", __func__, path_str);
            exit(EXIT_FAILURE);
        }

        if (isspace(*ptr) || *ptr == '\0') break;
        path_str = ptr + 1;
    }
    
    if (vt.n == 0) {
        fprintf(stderr, "[E::%s] invalid path string: %s\n", __func__, path_str);
        exit(EXIT_FAILURE);
    }

    size_t i;
    asmg_t *g;
    asmg_arc_t *a;
    g = asg->asmg;
    a = asmg_arc1(g, vt.a[vt.n-1], vt.a[0]);
    circ = !!a;
    len = g->vtx[vt.a[0]>>1].len;
    cov = g->vtx[vt.a[0]>>1].cov;
    wlen = (double) cov * len;
    if (circ) len -= a->ls, wlen -= cov * a->ls;
    for (i = 1; i < vt.n; ++i) {
        len1 = g->vtx[vt.a[i]>>1].len;
        cov = g->vtx[vt.a[i]>>1].cov;
        len += len1;
        wlen += (double) cov * len1;
        a = asmg_arc1(g, vt.a[i-1], vt.a[i]);
        if (!a) {
            fprintf(stderr, "[W::%s] gap introduced as link does not exist: %s%c -> %s%c\n", __func__,
                    asg->seg[vt.a[i-1]>>1].name, "+-"[vt.a[i-1]&1],
                    asg->seg[vt.a[i]>>1].name, "+-"[vt.a[i]&1]);
        } else {
            len -= a->ls;
            wlen -= (double) cov * a->ls;
        }
    }

    path_t path = {sid? strdup1(sid, strlen(sid)) : 0, vt.n, circ, 0, vt.a, len, wlen, .0};
    
    return path;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x90(%rbp)
movq %rdi, -0x88(%rbp)
movq %rsi, -0x8(%rbp)
movq %rdx, -0x10(%rbp)
movq %rcx, -0x18(%rbp)
movq $0x0, -0x50(%rbp)
movq $0x0, -0x58(%rbp)
movq $0x0, -0x48(%rbp)
callq 0x24d0
movq (%rax), %rax
movq -0x10(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %ecx
andl $0x2000, %ecx           # imm = 0x2000
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x91(%rbp)
je 0x8549
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x91(%rbp)
movb -0x91(%rbp), %al
testb $0x1, %al
jne 0x8555
jmp 0x8563
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x850d
jmp 0x8565
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x8763
movq -0x10(%rbp), %rax
movq %rax, -0x60(%rbp)
callq 0x24d0
movq (%rax), %rax
movq -0x60(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %ecx
andl $0x2000, %ecx           # imm = 0x2000
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x92(%rbp)
jne 0x85cd
movq -0x60(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x2c, %ecx
movb %al, -0x92(%rbp)
je 0x85cd
movq -0x60(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x92(%rbp)
movb -0x92(%rbp), %al
testb $0x1, %al
jne 0x85d9
jmp 0x85e7
movq -0x60(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x60(%rbp)
jmp 0x857d
movq -0x60(%rbp), %rax
movsbl -0x1(%rax), %eax
cmpl $0x2b, %eax
je 0x8605
movq -0x60(%rbp), %rax
movsbl -0x1(%rax), %eax
cmpl $0x2d, %eax
jne 0x86f7
movq -0x10(%rbp), %rdi
movq -0x60(%rbp), %rax
movq -0x10(%rbp), %rcx
subq %rcx, %rax
subq $0x1, %rax
movl %eax, %esi
callq 0x8b80
movq %rax, -0x68(%rbp)
movq -0x8(%rbp), %rdi
movq -0x68(%rbp), %rsi
callq 0x8bd0
movl %eax, -0x20(%rbp)
cmpl $-0x1, -0x20(%rbp)
jne 0x8666
movq 0x219b8(%rip), %rax     # 0x29ff8
movq (%rax), %rdi
movq -0x68(%rbp), %rcx
leaq 0x1b098(%rip), %rsi     # 0x236e6
leaq 0x1b0b6(%rip), %rdx     # 0x2370b
movb $0x0, %al
callq 0x2290
movl $0x1, %edi
callq 0x2430
movl -0x20(%rbp), %eax
shll %eax
movq -0x60(%rbp), %rcx
movsbl -0x1(%rcx), %ecx
cmpl $0x2d, %ecx
sete %cl
andb $0x1, %cl
movzbl %cl, %ecx
orl %ecx, %eax
movl %eax, -0x20(%rbp)
movq -0x58(%rbp), %rax
cmpq -0x50(%rbp), %rax
jne 0x86d3
cmpq $0x0, -0x50(%rbp)
je 0x86a5
movq -0x50(%rbp), %rax
shlq %rax
movq %rax, -0xa0(%rbp)
jmp 0x86b3
movl $0x2, %eax
movq %rax, -0xa0(%rbp)
jmp 0x86b3
movq -0xa0(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x48(%rbp), %rdi
movq -0x50(%rbp), %rsi
shlq $0x2, %rsi
callq 0x2330
movq %rax, -0x48(%rbp)
movl -0x20(%rbp), %edx
movq -0x48(%rbp), %rax
movq -0x58(%rbp), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, -0x58(%rbp)
movl %edx, (%rax,%rcx,4)
movq -0x68(%rbp), %rdi
callq 0x2060
jmp 0x8724
movq 0x218fa(%rip), %rax     # 0x29ff8
movq (%rax), %rdi
movq -0x10(%rbp), %rcx
leaq 0x1b012(%rip), %rsi     # 0x2371e
leaq 0x1aff8(%rip), %rdx     # 0x2370b
movb $0x0, %al
callq 0x2290
movl $0x1, %edi
callq 0x2430
callq 0x24d0
movq (%rax), %rax
movq -0x60(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
jne 0x8750
movq -0x60(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
jne 0x8752
jmp 0x8763
movq -0x60(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x8565
cmpq $0x0, -0x58(%rbp)
jne 0x8797
movq 0x21887(%rip), %rax     # 0x29ff8
movq (%rax), %rdi
movq -0x10(%rbp), %rcx
leaq 0x1af9f(%rip), %rsi     # 0x2371e
leaq 0x1af85(%rip), %rdx     # 0x2370b
movb $0x0, %al
callq 0x2290
movl $0x1, %edi
callq 0x2430
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rdi
movq -0x58(%rbp), %rcx
movq -0x48(%rbp), %rax
movl -0x4(%rax,%rcx,4), %ecx
movl %ecx, %esi
movl (%rax), %eax
movl %eax, %edx
callq 0x8370
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rax
testq %rax, %rax
setne %al
movzbl %al, %eax
movl %eax, -0x1c(%rbp)
movq -0x78(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x48(%rbp), %rcx
movl (%rcx), %ecx
shrl %ecx
leaq (%rcx,%rcx,4), %rcx
movq 0x18(%rax,%rcx,8), %rax
movq %rax, -0x30(%rbp)
movq -0x78(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x48(%rbp), %rcx
movl (%rcx), %ecx
shrl %ecx
leaq (%rcx,%rcx,4), %rcx
movl 0x20(%rax,%rcx,8), %eax
andl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
cvtsi2sd %rax, %xmm0
movaps 0x1ad52(%rip), %xmm2    # 0x23570
movq -0x30(%rbp), %xmm1
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movapd 0x1ad51(%rip), %xmm2    # 0x23580
subpd %xmm2, %xmm1
movaps %xmm1, %xmm2
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, -0x40(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x88a4
movq -0x80(%rbp), %rax
movq 0x18(%rax), %rcx
movq -0x30(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x30(%rbp)
movl -0x24(%rbp), %eax
movq -0x80(%rbp), %rcx
movq 0x18(%rcx), %rcx
imulq %rcx, %rax
movq %rax, %xmm1
movaps 0x1acf5(%rip), %xmm0    # 0x23570
punpckldq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
movapd 0x1acf9(%rip), %xmm0    # 0x23580
subpd %xmm0, %xmm1
movaps %xmm1, %xmm0
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm0, %xmm1
movsd -0x40(%rbp), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, -0x40(%rbp)
movq $0x1, -0x70(%rbp)
movq -0x70(%rbp), %rax
cmpq -0x58(%rbp), %rax
jae 0x8ab2
movq -0x78(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x48(%rbp), %rcx
movq -0x70(%rbp), %rdx
movl (%rcx,%rdx,4), %ecx
shrl %ecx
leaq (%rcx,%rcx,4), %rcx
movq 0x18(%rax,%rcx,8), %rax
movq %rax, -0x38(%rbp)
movq -0x78(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x48(%rbp), %rcx
movq -0x70(%rbp), %rdx
movl (%rcx,%rdx,4), %ecx
shrl %ecx
leaq (%rcx,%rcx,4), %rcx
movl 0x20(%rax,%rcx,8), %eax
andl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
movl %eax, -0x24(%rbp)
movq -0x38(%rbp), %rcx
movq -0x30(%rbp), %rax
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movl -0x24(%rbp), %eax
cvtsi2sd %rax, %xmm0
movaps 0x1ac51(%rip), %xmm1    # 0x23570
movq -0x38(%rbp), %xmm2
punpckldq %xmm1, %xmm2    # xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1]
movapd 0x1ac50(%rip), %xmm1    # 0x23580
subpd %xmm1, %xmm2
movaps %xmm2, %xmm1
unpckhpd %xmm2, %xmm2            # xmm2 = xmm2[1,1]
addsd %xmm1, %xmm2
movsd -0x40(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x40(%rbp)
movq -0x78(%rbp), %rdi
movq -0x48(%rbp), %rax
movq -0x70(%rbp), %rcx
subq $0x1, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, %esi
movq -0x48(%rbp), %rax
movq -0x70(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, %edx
callq 0x8370
movq %rax, -0x80(%rbp)
cmpq $0x0, -0x80(%rbp)
jne 0x8a30
movq 0x2166a(%rip), %rax     # 0x29ff8
movq (%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x48(%rbp), %rcx
movq -0x70(%rbp), %rdx
subq $0x1, %rdx
movl (%rcx,%rdx,4), %ecx
shrl %ecx
movl %ecx, %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq -0x48(%rbp), %rax
movq -0x70(%rbp), %rdx
subq $0x1, %rdx
movl (%rax,%rdx,4), %eax
andl $0x1, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x1ada9(%rip), %rax     # 0x2377c
movsbl (%rax,%rdx), %r8d
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x48(%rbp), %rdx
movq -0x70(%rbp), %rsi
movl (%rdx,%rsi,4), %edx
shrl %edx
movl %edx, %edx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movq (%rax), %r9
movq -0x48(%rbp), %rax
movq -0x70(%rbp), %rdx
movl (%rax,%rdx,4), %eax
andl $0x1, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x1ad6a(%rip), %rax     # 0x2377c
movsbl (%rax,%rdx), %eax
leaq 0x1ad22(%rip), %rsi     # 0x2373f
leaq 0x1ace7(%rip), %rdx     # 0x2370b
movl %eax, (%rsp)
movb $0x0, %al
callq 0x2290
jmp 0x8a9f
movq -0x80(%rbp), %rax
movq 0x18(%rax), %rcx
movq -0x30(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x30(%rbp)
movl -0x24(%rbp), %eax
cvtsi2sd %rax, %xmm0
movq -0x80(%rbp), %rax
movq 0x18(%rax), %xmm2
movaps 0x1ab15(%rip), %xmm1    # 0x23570
punpckldq %xmm1, %xmm2    # xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1]
movapd 0x1ab19(%rip), %xmm1    # 0x23580
subpd %xmm1, %xmm2
movaps %xmm2, %xmm1
unpckhpd %xmm2, %xmm2            # xmm2 = xmm2[1,1]
addsd %xmm1, %xmm2
movsd -0x40(%rbp), %xmm1
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x40(%rbp)
jmp 0x8aa1
movq -0x70(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x70(%rbp)
jmp 0x88ac
cmpq $0x0, -0x18(%rbp)
je 0x8ae4
movq -0x18(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0x18(%rbp), %rdi
callq 0x2130
movq -0xb0(%rbp), %rdi
movl %eax, %esi
callq 0x8b80
movq %rax, -0xa8(%rbp)
jmp 0x8aef
xorl %eax, %eax
movq %rax, -0xa8(%rbp)
jmp 0x8aef
movq -0x88(%rbp), %rax
movq -0x90(%rbp), %rcx
movq -0xa8(%rbp), %rdx
movq %rdx, (%rcx)
movq -0x58(%rbp), %rdx
movl %edx, %esi
movl 0x8(%rcx), %edx
andl $0x3fffffff, %esi       # imm = 0x3FFFFFFF
andl $0xc0000000, %edx       # imm = 0xC0000000
orl %esi, %edx
movl %edx, 0x8(%rcx)
movl -0x1c(%rbp), %esi
movl 0x8(%rcx), %edx
andl $0x1, %esi
shll $0x1e, %esi
andl $0xbfffffff, %edx       # imm = 0xBFFFFFFF
orl %esi, %edx
movl %edx, 0x8(%rcx)
movl 0x8(%rcx), %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
orl $0x0, %edx
movl %edx, 0x8(%rcx)
movq -0x48(%rbp), %rdx
movq %rdx, 0x10(%rcx)
movq -0x30(%rbp), %rdx
movl %edx, 0x18(%rcx)
movsd -0x40(%rbp), %xmm0
movsd %xmm0, 0x20(%rcx)
xorps %xmm0, %xmm0
movsd %xmm0, 0x28(%rcx)
addq $0xc0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)