// File: /workspace/github_c_makefile_star2_O0/c-zhou[P]oatk/path.c
// Function: gfa_parse_L
static int gfa_parse_L(asg_t *g, char *s)
{
    if (*s != 'L') return PARSE_L_ERR;

    int i, is_ok = 0;
    char *p, *q, *segv, *segw, *rest;
    uint64_t ov, ow, oriv, oriw;
    
    segv = segw = rest = 0;
    ov = ow = oriv = oriw = UINT64_MAX;
    for (i = 0, p = q = s + 2;; ++p) {
        if (*p == 0 || *p == '\t') {
            int c = *p;
            *p = 0;
            if (i == 0) {
                segv = q;
            } else if (i == 1) {
                if (*q != '+' && *q != '-') return PARSE_L_ERR;
                oriv = (*q != '+');
            } else if (i == 2) {
                segw = q;
            } else if (i == 3) {
                if (*q != '+' && *q != '-') return PARSE_L_ERR;
                oriw = (*q != '+');
            } else if (i == 4) {
                if (*q == '*') {
                    ov = ow = 0;
                } else if (*q == ':') {
                    ov = UINT64_MAX;
                    ow = isdigit(*(q+1))? strtoul(q+1, &q, 10) : UINT64_MAX;
                } else if (isdigit(*q)) {
                    char *r;
                    ov = strtol(q, &r, 10);
                    if (isupper(*r)) { // CIGAR
                        ov = ow = 0;
                        do {
                            long l;
                            l = strtol(q, &q, 10);
                            if (*q == 'M' || *q == 'D' || *q == 'N') ov += l;
                            if (*q == 'M' || *q == 'I' || *q == 'S') ow += l;
                            ++q;
                        } while (isdigit(*q));
                    } else if (*r == ':') { // overlap lengths
                        ow = isdigit(*(r+1))? strtoul(r+1, &r, 10) : UINT64_MAX;
                    } else break;
                } else break;
                is_ok = 1, rest = c? p + 1 : 0;
                break;
            }
            ++i, q = p + 1;
            if (c == 0) break;
        }
    }
    if (i == 4 && is_ok == 0) ov = ow = 0, is_ok = 1; // no overlap field
    if (is_ok) {
        uint64_t v, w;
        int l_aux, m_aux = 0;
        uint8_t *aux = 0;
        asmg_arc_t *arc;
        v = asg_add_seg(g, segv, 1) << 1 | oriv;
        w = asg_add_seg(g, segw, 1) << 1 | oriw;
        arc = asmg_arc_add(g->asmg, v, w, 0, ov, UINT64_MAX, 0, 0);
        l_aux = gfa_aux_parse(rest, &aux, &m_aux); // parse optional tags
        if (l_aux) {
            uint8_t *s_ARC_COV = 0;
            char tag[2];
            if (TAG_ARC_COV[0] != 0) {
                memcpy(tag, TAG_ARC_COV, 2);
                s_ARC_COV = gfa_aux_get(l_aux, aux, tag);
                if (s_ARC_COV && *s_ARC_COV == TAG_ARC_COV[3])
                    arc->cov = gfa_aux_decimal_value(s_ARC_COV);
                else
                    fprintf(stderr, "[W::%s] for arc '%s%c' -> '%s%c', %s tag is absent\n", __func__, segv, "+-"[oriv], segw, "+-"[oriw], tag);
            } else {
                // check EC
                s_ARC_COV = gfa_aux_get(l_aux, aux, "EC");
                if (s_ARC_COV && *s_ARC_COV == 'i')
                    arc->cov = *(int64_t*)(s_ARC_COV + 1);
            }
        }
        if (arc->cov == 0) {
            fprintf(stderr, "[W::%s] the coverage of arc '%s%c' -> '%s%c' is zero\n", __func__, segv, "+-"[oriv], segw, "+-"[oriw]);
            arc->cov = 1;
        }
        free(aux);
    } else return PARSE_L_ERR;
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x4c, %eax
je 0xcfeb
movl $0xfffffffc, -0x4(%rbp) # imm = 0xFFFFFFFC
jmp 0xd693
movl $0x0, -0x20(%rbp)
movq $0x0, -0x48(%rbp)
movq $0x0, -0x40(%rbp)
movq $0x0, -0x38(%rbp)
movq $-0x1, -0x68(%rbp)
movq $-0x1, -0x60(%rbp)
movq $-0x1, -0x58(%rbp)
movq $-0x1, -0x50(%rbp)
movl $0x0, -0x1c(%rbp)
movq -0x18(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x30(%rbp)
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0xd05d
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x9, %eax
jne 0xd3a9
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
movl %eax, -0x6c(%rbp)
movq -0x28(%rbp), %rax
movb $0x0, (%rax)
cmpl $0x0, -0x1c(%rbp)
jne 0xd081
movq -0x30(%rbp), %rax
movq %rax, -0x38(%rbp)
jmp 0xd38a
cmpl $0x1, -0x1c(%rbp)
jne 0xd0c8
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2b, %eax
je 0xd0ab
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
je 0xd0ab
movl $0xfffffffc, -0x4(%rbp) # imm = 0xFFFFFFFC
jmp 0xd693
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2b, %eax
setne %al
andb $0x1, %al
movzbl %al, %eax
cltq
movq %rax, -0x60(%rbp)
jmp 0xd388
cmpl $0x2, -0x1c(%rbp)
jne 0xd0db
movq -0x30(%rbp), %rax
movq %rax, -0x40(%rbp)
jmp 0xd386
cmpl $0x3, -0x1c(%rbp)
jne 0xd122
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2b, %eax
je 0xd105
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
je 0xd105
movl $0xfffffffc, -0x4(%rbp) # imm = 0xFFFFFFFC
jmp 0xd693
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2b, %eax
setne %al
andb $0x1, %al
movzbl %al, %eax
cltq
movq %rax, -0x68(%rbp)
jmp 0xd384
cmpl $0x4, -0x1c(%rbp)
jne 0xd382
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2a, %eax
jne 0xd14d
movq $0x0, -0x58(%rbp)
movq $0x0, -0x50(%rbp)
jmp 0xd34c
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x3a, %eax
jne 0xd1c1
movq $-0x1, -0x50(%rbp)
callq 0x24d0
movq (%rax), %rax
movq -0x30(%rbp), %rcx
movsbl 0x1(%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
je 0xd1a1
movq -0x30(%rbp), %rdi
addq $0x1, %rdi
leaq -0x30(%rbp), %rsi
movl $0xa, %edx
callq 0x23d0
movq %rax, -0xc0(%rbp)
jmp 0xd1b1
movq $-0x1, %rax
movq %rax, -0xc0(%rbp)
jmp 0xd1b1
movq -0xc0(%rbp), %rax
movq %rax, -0x58(%rbp)
jmp 0xd34a
callq 0x24d0
movq (%rax), %rax
movq -0x30(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
je 0xd346
movq -0x30(%rbp), %rdi
leaq -0x78(%rbp), %rsi
movl $0xa, %edx
callq 0x22b0
movq %rax, -0x50(%rbp)
callq 0x24d0
movq (%rax), %rax
movq -0x78(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
je 0xd2d7
movq $0x0, -0x58(%rbp)
movq $0x0, -0x50(%rbp)
movq -0x30(%rbp), %rdi
leaq -0x30(%rbp), %rsi
movl $0xa, %edx
callq 0x22b0
movq %rax, -0x80(%rbp)
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x4d, %eax
je 0xd269
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x44, %eax
je 0xd269
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x4e, %eax
jne 0xd275
movq -0x80(%rbp), %rax
addq -0x50(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x4d, %eax
je 0xd299
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x49, %eax
je 0xd299
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x53, %eax
jne 0xd2a5
movq -0x80(%rbp), %rax
addq -0x58(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
callq 0x24d0
movq (%rax), %rax
movq -0x30(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
jne 0xd22f
jmp 0xd344
movq -0x78(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x3a, %eax
jne 0xd340
callq 0x24d0
movq (%rax), %rax
movq -0x78(%rbp), %rcx
movsbl 0x1(%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
je 0xd323
movq -0x78(%rbp), %rdi
addq $0x1, %rdi
leaq -0x78(%rbp), %rsi
movl $0xa, %edx
callq 0x23d0
movq %rax, -0xc8(%rbp)
jmp 0xd333
movq $-0x1, %rax
movq %rax, -0xc8(%rbp)
jmp 0xd333
movq -0xc8(%rbp), %rax
movq %rax, -0x58(%rbp)
jmp 0xd342
jmp 0xd3bc
jmp 0xd344
jmp 0xd348
jmp 0xd3bc
jmp 0xd34a
jmp 0xd34c
movl $0x1, -0x20(%rbp)
cmpl $0x0, -0x6c(%rbp)
je 0xd36a
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xd0(%rbp)
jmp 0xd375
xorl %eax, %eax
movq %rax, -0xd0(%rbp)
jmp 0xd375
movq -0xd0(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0xd3bc
jmp 0xd384
jmp 0xd386
jmp 0xd388
jmp 0xd38a
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
cmpl $0x0, -0x6c(%rbp)
jne 0xd3a7
jmp 0xd3bc
jmp 0xd3a9
jmp 0xd3ab
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0xd041
cmpl $0x4, -0x1c(%rbp)
jne 0xd3df
cmpl $0x0, -0x20(%rbp)
jne 0xd3df
movq $0x0, -0x58(%rbp)
movq $0x0, -0x50(%rbp)
movl $0x1, -0x20(%rbp)
cmpl $0x0, -0x20(%rbp)
je 0xd683
movl $0x0, -0x98(%rbp)
movq $0x0, -0xa0(%rbp)
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
movl $0x1, %edx
callq 0xb300
shll %eax
movl %eax, %eax
orq -0x60(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x10(%rbp), %rdi
movq -0x40(%rbp), %rsi
movl $0x1, %edx
callq 0xb300
shll %eax
movl %eax, %eax
orq -0x68(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
movq -0x88(%rbp), %rsi
movq -0x90(%rbp), %rdx
movq -0x50(%rbp), %r8
xorl %eax, %eax
movl %eax, %ecx
movq $-0x1, %r9
xorl %eax, %eax
movl $0x0, (%rsp)
movl $0x0, 0x8(%rsp)
callq 0x14340
movq %rax, -0xa8(%rbp)
movq -0x48(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
leaq -0x98(%rbp), %rdx
callq 0x16c50
movl %eax, -0x94(%rbp)
cmpl $0x0, -0x94(%rbp)
je 0xd602
movq $0x0, -0xb0(%rbp)
movsbl 0x1ceca(%rip), %eax     # 0x2a388
cmpl $0x0, %eax
je 0xd59d
movw 0x1ceba(%rip), %ax      # 0x2a388
movw %ax, -0xb2(%rbp)
movl -0x94(%rbp), %edi
movq -0xa0(%rbp), %rsi
leaq -0xb2(%rbp), %rdx
callq 0x171c0
movq %rax, -0xb0(%rbp)
cmpq $0x0, -0xb0(%rbp)
je 0xd544
movq -0xb0(%rbp), %rax
movzbl (%rax), %eax
movsbl 0x1ce7b(%rip), %ecx     # 0x2a38b
cmpl %ecx, %eax
jne 0xd544
movq -0xb0(%rbp), %rdi
callq 0x172f0
cvttsd2si %xmm0, %rax
movl %eax, %edx
movq -0xa8(%rbp), %rax
movl 0x20(%rax), %ecx
andl $0x3fffffff, %edx       # imm = 0x3FFFFFFF
andl $0xc0000000, %ecx       # imm = 0xC0000000
orl %edx, %ecx
movl %ecx, 0x20(%rax)
jmp 0xd59b
movq 0x1caad(%rip), %rax     # 0x29ff8
movq (%rax), %rdi
movq -0x38(%rbp), %rcx
movq -0x60(%rbp), %rdx
leaq 0x1621f(%rip), %rax     # 0x2377c
movsbl (%rax,%rdx), %r8d
movq -0x40(%rbp), %r9
movq -0x68(%rbp), %rdx
leaq 0x1620b(%rip), %rax     # 0x2377c
movsbl (%rax,%rdx), %r10d
leaq -0xb2(%rbp), %rax
leaq 0x16e7a(%rip), %rsi     # 0x243fe
leaq 0x16ea7(%rip), %rdx     # 0x24432
movl %r10d, (%rsp)
movq %rax, 0x8(%rsp)
movb $0x0, %al
callq 0x2290
jmp 0xd600
movl -0x94(%rbp), %edi
movq -0xa0(%rbp), %rsi
leaq 0x16e8d(%rip), %rdx     # 0x2443e
callq 0x171c0
movq %rax, -0xb0(%rbp)
cmpq $0x0, -0xb0(%rbp)
je 0xd5fe
movq -0xb0(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x69, %eax
jne 0xd5fe
movq -0xb0(%rbp), %rax
movq 0x1(%rax), %rax
movl %eax, %edx
movq -0xa8(%rbp), %rax
movl 0x20(%rax), %ecx
andl $0x3fffffff, %edx       # imm = 0x3FFFFFFF
andl $0xc0000000, %ecx       # imm = 0xC0000000
orl %edx, %ecx
movl %ecx, 0x20(%rax)
jmp 0xd600
jmp 0xd602
movq -0xa8(%rbp), %rax
movl 0x20(%rax), %eax
andl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
cmpl $0x0, %eax
jne 0xd675
movq 0x1c9db(%rip), %rax     # 0x29ff8
movq (%rax), %rdi
movq -0x38(%rbp), %rcx
movq -0x60(%rbp), %rdx
leaq 0x1614d(%rip), %rax     # 0x2377c
movsbl (%rax,%rdx), %r8d
movq -0x40(%rbp), %r9
movq -0x68(%rbp), %rdx
leaq 0x16139(%rip), %rax     # 0x2377c
movsbl (%rax,%rdx), %eax
leaq 0x16df3(%rip), %rsi     # 0x24441
leaq 0x16ddd(%rip), %rdx     # 0x24432
movl %eax, (%rsp)
movb $0x0, %al
callq 0x2290
movq -0xa8(%rbp), %rax
movl 0x20(%rax), %ecx
andl $0xc0000000, %ecx       # imm = 0xC0000000
orl $0x1, %ecx
movl %ecx, 0x20(%rax)
movq -0xa0(%rbp), %rdi
callq 0x2060
jmp 0xd68c
movl $0xfffffffc, -0x4(%rbp) # imm = 0xFFFFFFFC
jmp 0xd693
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xe0, %rsp
popq %rbp
retq
nop