// File: /workspace/github_c_makefile_star2_O0/lh3[P]minigraph/gfa-io.c
// Function: gfa_parse_L
int gfa_parse_L(gfa_t *g, char *s)
{
	int i, oriv = -1, oriw = -1, is_ok = 0;
	char *p, *q, *segv = 0, *segw = 0, *rest = 0;
	int32_t ov = INT32_MAX, ow = INT32_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 -2;
				oriv = (*q != '+');
			} else if (i == 2) {
				segw = q;
			} else if (i == 3) {
				if (*q != '+' && *q != '-') return -2;
				oriw = (*q != '+');
			} else if (i == 4) {
				if (*q == '*') {
					ov = ow = 0;
				} else if (*q == ':') {
					ov = INT32_MAX;
					ow = isdigit(*(q+1))? strtol(q+1, &q, 10) : INT32_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))? strtol(r+1, &r, 10) : INT32_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) {
		uint32_t v, w;
		int l_aux, m_aux = 0;
		uint8_t *aux = 0;
		gfa_arc_t *arc;
		v = gfa_add_seg(g, segv) << 1 | oriv;
		w = gfa_add_seg(g, segw) << 1 | oriw;
		arc = gfa_add_arc1(g, v, w, ov, ow, -1, 0);
		l_aux = gfa_aux_parse(rest, &aux, &m_aux); // parse optional tags
		if (l_aux) {
			gfa_aux_t *a = &g->link_aux[arc->link_id];
			uint8_t *s_L1, *s_L2, *s_SR;
			a->l_aux = l_aux, a->m_aux = m_aux, a->aux = aux;
			s_SR = gfa_aux_get(a->l_aux, a->aux, "SR");
			if (s_SR && s_SR[0] == 'i') {
				arc->rank = *(int32_t*)(s_SR+1);
				a->l_aux = gfa_aux_del(a->l_aux, a->aux, s_SR);
			}
			s_L1 = gfa_aux_get(a->l_aux, a->aux, "L1");
			if (s_L1) {
				if (ov != INT32_MAX && s_L1[0] == 'i')
					g->seg[v>>1].len = g->seg[v>>1].len > ov + *(int32_t*)(s_L1+1)? g->seg[v>>1].len : ov + *(int32_t*)(s_L1+1);
				a->l_aux = gfa_aux_del(a->l_aux, a->aux, s_L1);
			}
			s_L2 = gfa_aux_get(a->l_aux, a->aux, "L2");
			if (s_L2) {
				if (ow != INT32_MAX && s_L2[0] == 'i')
					g->seg[w>>1].len = g->seg[w>>1].len > ow + *(int32_t*)(s_L2+1)? g->seg[w>>1].len : ow + *(int32_t*)(s_L2+1);
				a->l_aux = gfa_aux_del(a->l_aux, a->aux, s_L2);
			}
			if (a->l_aux == 0) {
				free(a->aux);
				a->aux = 0, a->m_aux = 0;
			}
		}
	} else return -1;
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0xffffffff, -0x20(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x24(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x28(%rbp)
movq $0x0, -0x40(%rbp)
movq $0x0, -0x48(%rbp)
movq $0x0, -0x50(%rbp)
movl $0x7fffffff, -0x54(%rbp) # imm = 0x7FFFFFFF
movl $0x7fffffff, -0x58(%rbp) # imm = 0x7FFFFFFF
movl $0x0, -0x1c(%rbp)
movq -0x18(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x38(%rbp)
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x9ee1
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x9, %eax
jne 0xa21f
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
movl %eax, -0x5c(%rbp)
movq -0x30(%rbp), %rax
movb $0x0, (%rax)
cmpl $0x0, -0x1c(%rbp)
jne 0x9f05
movq -0x38(%rbp), %rax
movq %rax, -0x40(%rbp)
jmp 0xa200
cmpl $0x1, -0x1c(%rbp)
jne 0x9f49
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2b, %eax
je 0x9f2f
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
je 0x9f2f
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0xa5fe
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2b, %eax
setne %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x20(%rbp)
jmp 0xa1fe
cmpl $0x2, -0x1c(%rbp)
jne 0x9f5c
movq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0xa1fc
cmpl $0x3, -0x1c(%rbp)
jne 0x9fa0
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2b, %eax
je 0x9f86
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
je 0x9f86
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0xa5fe
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2b, %eax
setne %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x24(%rbp)
jmp 0xa1fa
cmpl $0x4, -0x1c(%rbp)
jne 0xa1f8
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2a, %eax
jne 0x9fc9
movl $0x0, -0x58(%rbp)
movl $0x0, -0x54(%rbp)
jmp 0xa1c2
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x3a, %eax
jne 0xa039
movl $0x7fffffff, -0x54(%rbp) # imm = 0x7FFFFFFF
callq 0x2390
movq (%rax), %rax
movq -0x38(%rbp), %rcx
movsbl 0x1(%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
je 0xa01c
movq -0x38(%rbp), %rdi
addq $0x1, %rdi
leaq -0x38(%rbp), %rsi
movl $0xa, %edx
callq 0x2220
movq %rax, -0xb8(%rbp)
jmp 0xa02a
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movq %rax, -0xb8(%rbp)
jmp 0xa02a
movq -0xb8(%rbp), %rax
movl %eax, -0x58(%rbp)
jmp 0xa1c0
callq 0x2390
movq (%rax), %rax
movq -0x38(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
je 0xa1bc
movq -0x38(%rbp), %rdi
leaq -0x68(%rbp), %rsi
movl $0xa, %edx
callq 0x2220
movl %eax, -0x54(%rbp)
callq 0x2390
movq (%rax), %rax
movq -0x68(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
je 0xa150
movl $0x0, -0x58(%rbp)
movl $0x0, -0x54(%rbp)
movq -0x38(%rbp), %rdi
leaq -0x38(%rbp), %rsi
movl $0xa, %edx
callq 0x2220
movq %rax, -0x70(%rbp)
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x4d, %eax
je 0xa0de
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x44, %eax
je 0xa0de
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x4e, %eax
jne 0xa0ec
movq -0x70(%rbp), %rcx
movslq -0x54(%rbp), %rax
addq %rcx, %rax
movl %eax, -0x54(%rbp)
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x4d, %eax
je 0xa110
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x49, %eax
je 0xa110
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x53, %eax
jne 0xa11e
movq -0x70(%rbp), %rcx
movslq -0x58(%rbp), %rax
addq %rcx, %rax
movl %eax, -0x58(%rbp)
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
callq 0x2390
movq (%rax), %rax
movq -0x38(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
jne 0xa0a4
jmp 0xa1ba
movq -0x68(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x3a, %eax
jne 0xa1b6
callq 0x2390
movq (%rax), %rax
movq -0x68(%rbp), %rcx
movsbl 0x1(%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
je 0xa19c
movq -0x68(%rbp), %rdi
addq $0x1, %rdi
leaq -0x68(%rbp), %rsi
movl $0xa, %edx
callq 0x2220
movq %rax, -0xc0(%rbp)
jmp 0xa1aa
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movq %rax, -0xc0(%rbp)
jmp 0xa1aa
movq -0xc0(%rbp), %rax
movl %eax, -0x58(%rbp)
jmp 0xa1b8
jmp 0xa232
jmp 0xa1ba
jmp 0xa1be
jmp 0xa232
jmp 0xa1c0
jmp 0xa1c2
movl $0x1, -0x28(%rbp)
cmpl $0x0, -0x5c(%rbp)
je 0xa1e0
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xc8(%rbp)
jmp 0xa1eb
xorl %eax, %eax
movq %rax, -0xc8(%rbp)
jmp 0xa1eb
movq -0xc8(%rbp), %rax
movq %rax, -0x50(%rbp)
jmp 0xa232
jmp 0xa1fa
jmp 0xa1fc
jmp 0xa1fe
jmp 0xa200
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
cmpl $0x0, -0x5c(%rbp)
jne 0xa21d
jmp 0xa232
jmp 0xa21f
jmp 0xa221
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x9ec5
cmpl $0x4, -0x1c(%rbp)
jne 0xa253
cmpl $0x0, -0x28(%rbp)
jne 0xa253
movl $0x0, -0x58(%rbp)
movl $0x0, -0x54(%rbp)
movl $0x1, -0x28(%rbp)
cmpl $0x0, -0x28(%rbp)
je 0xa5ee
movl $0x0, -0x80(%rbp)
movq $0x0, -0x88(%rbp)
movq -0x10(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x57a0
shll %eax
orl -0x20(%rbp), %eax
movl %eax, -0x74(%rbp)
movq -0x10(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x57a0
shll %eax
orl -0x24(%rbp), %eax
movl %eax, -0x78(%rbp)
movq -0x10(%rbp), %rdi
movl -0x74(%rbp), %esi
movl -0x78(%rbp), %edx
movl -0x54(%rbp), %ecx
movl -0x58(%rbp), %r8d
movq $-0x1, %r9
xorl %eax, %eax
movl $0x0, (%rsp)
callq 0x5d40
movq %rax, -0x90(%rbp)
movq -0x50(%rbp), %rdi
leaq -0x88(%rbp), %rsi
leaq -0x80(%rbp), %rdx
callq 0x8540
movl %eax, -0x7c(%rbp)
cmpl $0x0, -0x7c(%rbp)
je 0xa5ec
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
movq -0x90(%rbp), %rdx
movabsq $0x1fffffffffffffff, %rcx # imm = 0x1FFFFFFFFFFFFFFF
andq 0x18(%rdx), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x98(%rbp)
movl -0x7c(%rbp), %ecx
movq -0x98(%rbp), %rax
movl %ecx, 0x4(%rax)
movl -0x80(%rbp), %ecx
movq -0x98(%rbp), %rax
movl %ecx, (%rax)
movq -0x88(%rbp), %rcx
movq -0x98(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x98(%rbp), %rax
movl 0x4(%rax), %edi
movq -0x98(%rbp), %rax
movq 0x8(%rax), %rsi
leaq 0x3211b(%rip), %rdx     # 0x3c474
callq 0x7450
movq %rax, -0xb0(%rbp)
cmpq $0x0, -0xb0(%rbp)
je 0xa3bf
movq -0xb0(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x69, %eax
jne 0xa3bf
movq -0xb0(%rbp), %rax
movl 0x1(%rax), %ecx
movq -0x90(%rbp), %rax
movl %ecx, 0xc(%rax)
movq -0x98(%rbp), %rax
movl 0x4(%rax), %edi
movq -0x98(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0xb0(%rbp), %rdx
callq 0x75e0
movl %eax, %ecx
movq -0x98(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x98(%rbp), %rax
movl 0x4(%rax), %edi
movq -0x98(%rbp), %rax
movq 0x8(%rax), %rsi
leaq 0x3209c(%rip), %rdx     # 0x3c477
callq 0x7450
movq %rax, -0xa0(%rbp)
cmpq $0x0, -0xa0(%rbp)
je 0xa4b8
cmpl $0x7fffffff, -0x54(%rbp) # imm = 0x7FFFFFFF
je 0xa48b
movq -0xa0(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x69, %eax
jne 0xa48b
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x74(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
shlq $0x6, %rcx
addq %rcx, %rax
movl (%rax), %eax
movl -0x54(%rbp), %ecx
movq -0xa0(%rbp), %rdx
addl 0x1(%rdx), %ecx
cmpl %ecx, %eax
jle 0xa45a
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x74(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
shlq $0x6, %rcx
addq %rcx, %rax
movl (%rax), %eax
movl %eax, -0xcc(%rbp)
jmp 0xa46d
movl -0x54(%rbp), %eax
movq -0xa0(%rbp), %rcx
addl 0x1(%rcx), %eax
movl %eax, -0xcc(%rbp)
movl -0xcc(%rbp), %ecx
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x74(%rbp), %edx
shrl %edx
movl %edx, %edx
shlq $0x6, %rdx
addq %rdx, %rax
movl %ecx, (%rax)
movq -0x98(%rbp), %rax
movl 0x4(%rax), %edi
movq -0x98(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0xa0(%rbp), %rdx
callq 0x75e0
movl %eax, %ecx
movq -0x98(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x98(%rbp), %rax
movl 0x4(%rax), %edi
movq -0x98(%rbp), %rax
movq 0x8(%rax), %rsi
leaq 0x31fa6(%rip), %rdx     # 0x3c47a
callq 0x7450
movq %rax, -0xa8(%rbp)
cmpq $0x0, -0xa8(%rbp)
je 0xa5b1
cmpl $0x7fffffff, -0x58(%rbp) # imm = 0x7FFFFFFF
je 0xa584
movq -0xa8(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x69, %eax
jne 0xa584
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x78(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
shlq $0x6, %rcx
addq %rcx, %rax
movl (%rax), %eax
movl -0x58(%rbp), %ecx
movq -0xa8(%rbp), %rdx
addl 0x1(%rdx), %ecx
cmpl %ecx, %eax
jle 0xa553
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x78(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
shlq $0x6, %rcx
addq %rcx, %rax
movl (%rax), %eax
movl %eax, -0xd0(%rbp)
jmp 0xa566
movl -0x58(%rbp), %eax
movq -0xa8(%rbp), %rcx
addl 0x1(%rcx), %eax
movl %eax, -0xd0(%rbp)
movl -0xd0(%rbp), %ecx
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x78(%rbp), %edx
shrl %edx
movl %edx, %edx
shlq $0x6, %rdx
addq %rdx, %rax
movl %ecx, (%rax)
movq -0x98(%rbp), %rax
movl 0x4(%rax), %edi
movq -0x98(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0xa8(%rbp), %rdx
callq 0x75e0
movl %eax, %ecx
movq -0x98(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x98(%rbp), %rax
cmpl $0x0, 0x4(%rax)
jne 0xa5ea
movq -0x98(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x2040
movq -0x98(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x98(%rbp), %rax
movl $0x0, (%rax)
jmp 0xa5ec
jmp 0xa5f7
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xa5fe
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xe0, %rsp
popq %rbp
retq
nopw (%rax,%rax)