// File: /workspace/github_c_makefile_star2_O2/lh3[P]minigraph/gfa-io.c
// Function: gfa_aux_parse
int gfa_aux_parse(char *s, uint8_t **data, int *max)
{
	char *q, *p;
	kstring_t str;
	if (s == 0) return 0;
	str.l = 0, str.m = *max, str.s = (char*)*data;
	if (*s == '\t') ++s;
	for (p = q = s;; ++p) {
		if (*p == 0 || *p == '\t') {
			int c = *p;
			*p = 0;
			if (p - q >= 5 && q[2] == ':' && q[4] == ':' && (q[3] == 'A' || q[3] == 'i' || q[3] == 'f' || q[3] == 'Z' || q[3] == 'B')) {
				int type = q[3];
				kputsn_(q, 2, &str);
				q += 5;
				if (type == 'A') {
					kputc_('A', &str);
					kputc_(*q, &str);
				} else if (type == 'i') {
					int32_t x;
					x = strtol(q, &q, 10);
					kputc_(type, &str); kputsn_((char*)&x, 4, &str);
				} else if (type == 'f') {
					float x;
					x = strtod(q, &q);
					kputc_('f', &str); kputsn_(&x, 4, &str);
				} else if (type == 'Z') {
					kputc_('Z', &str); kputsn_(q, p - q + 1, &str); // note that this include the trailing NULL
				} else if (type == 'B') {
					type = *q++; // q points to the first ',' following the typing byte
					if (p - q >= 2 && (type == 'c' || type == 'C' || type == 's' || type == 'S' || type == 'i' || type == 'I' || type != 'f')) {
						int32_t n;
						char *r;
						for (r = q, n = 0; *r; ++r)
							if (*r == ',') ++n;
						kputc_('B', &str); kputc_(type, &str); kputsn_(&n, 4, &str);
						// TODO: to evaluate which is faster: a) aligned array and then memmove(); b) unaligned array; c) kputsn_()
						if (type == 'c')      while (q + 1 < p) { int8_t   x = strtol(q + 1, &q, 0); kputc_(x, &str); }
						else if (type == 'C') while (q + 1 < p) { uint8_t  x = strtol(q + 1, &q, 0); kputc_(x, &str); }
						else if (type == 's') while (q + 1 < p) { int16_t  x = strtol(q + 1, &q, 0); kputsn_(&x, 2, &str); }
						else if (type == 'S') while (q + 1 < p) { uint16_t x = strtol(q + 1, &q, 0); kputsn_(&x, 2, &str); }
						else if (type == 'i') while (q + 1 < p) { int32_t  x = strtol(q + 1, &q, 0); kputsn_(&x, 4, &str); }
						else if (type == 'I') while (q + 1 < p) { uint32_t x = strtol(q + 1, &q, 0); kputsn_(&x, 4, &str); }
						else if (type == 'f') while (q + 1 < p) { float    x = strtod(q + 1, &q);    kputsn_(&x, 4, &str); }
					}
				} // should not be here, as we have tested all types
			}
			q = p + 1;
			if (c == 0) break;
		}
	}
	if (str.l > 0 && str.l == str.m) ks_resize(&str, str.l + 1);
	if (str.s) str.s[str.l] = 0;
	*max = str.m, *data = (uint8_t*)str.s;
	return str.l;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
testq %rdi, %rdi
je 0x5b42
leaq 0x30(%rsp), %r15
andq $0x0, (%r15)
movq %rdx, 0x20(%rsp)
movslq (%rdx), %rax
movq %rax, 0x8(%r15)
movq %rsi, 0x28(%rsp)
movq (%rsi), %rax
movq %rax, 0x10(%r15)
xorl %ebx, %ebx
cmpb $0x9, (%rdi)
sete %bl
addq %rdi, %rbx
leaq 0x10(%rsp), %rax
movq %rbx, (%rax)
movq %rbx, %r14
movzbl (%r14), %ebp
cmpl $0x9, %ebp
je 0x57df
testl %ebp, %ebp
jne 0x594b
movb $0x0, (%r14)
movq %r14, %rax
subq %rbx, %rax
cmpq $0x5, %rax
jl 0x5939
cmpb $0x3a, 0x2(%rbx)
jne 0x5939
cmpb $0x3a, 0x4(%rbx)
jne 0x5939
movzbl 0x3(%rbx), %r12d
leal -0x41(%r12), %eax
cmpl $0x28, %eax
ja 0x5939
movabsq $0x12002000003, %rcx    # imm = 0x12002000003
btq %rax, %rcx
jae 0x5939
movq %rbx, %rdi
pushq $0x2
popq %rsi
movq %r15, %rdx
callq 0x5b75
leaq 0x5(%rbx), %r13
movq %r13, 0x10(%rsp)
cmpl $0x69, %r12d
je 0x590a
cmpl $0x42, %r12d
je 0x588c
cmpl $0x5a, %r12d
je 0x58f2
cmpl $0x66, %r12d
je 0x58d7
cmpl $0x41, %r12d
jne 0x5939
pushq $0x41
popq %rdi
movq %r15, %rsi
callq 0x5bf8
movsbl (%r13), %edi
movq %r15, %rsi
callq 0x5bf8
jmp 0x5939
leaq 0x6(%rbx), %r13
movq %r13, 0x10(%rsp)
movq %r14, %rax
subq %r13, %rax
cmpq $0x2, %rax
jl 0x5939
movb 0x5(%rbx), %bl
cmpb $0x66, %bl
je 0x5939
andl $0x0, 0x1c(%rsp)
movsbl %bl, %r12d
xorl %eax, %eax
movq %r13, %rcx
movzbl (%rcx), %edx
cmpl $0x2c, %edx
je 0x58d0
testl %edx, %edx
jne 0x58d2
jmp 0x5953
incl %eax
incq %rcx
jmp 0x58bf
movq %r13, %rdi
leaq 0x10(%rsp), %rsi
callq 0x20c0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x1c(%rsp)
pushq $0x66
jmp 0x5920
pushq $0x5a
popq %rdi
movq %r15, %rsi
callq 0x5bf8
movl %r14d, %esi
subl %r13d, %esi
incl %esi
movq %r13, %rdi
jmp 0x5931
movq %r13, %rdi
leaq 0x10(%rsp), %rsi
pushq $0xa
popq %rdx
callq 0x2220
movl %eax, 0x1c(%rsp)
pushq $0x69
popq %rdi
movq %r15, %rsi
callq 0x5bf8
leaq 0x1c(%rsp), %rdi
pushq $0x4
popq %rsi
movq %r15, %rdx
callq 0x5b75
leaq 0x1(%r14), %rbx
movq %rbx, 0x10(%rsp)
testb %bpl, %bpl
je 0x5ae2
incq %r14
jmp 0x57ce
movl %eax, 0x1c(%rsp)
pushq $0x42
popq %rdi
movq %r15, %rsi
callq 0x5bf8
movl %r12d, %edi
movq %r15, %rsi
callq 0x5bf8
leaq 0x1c(%rsp), %rdi
pushq $0x4
popq %rsi
movq %r15, %rdx
callq 0x5b75
cmpb $0x43, %bl
je 0x5ab2
movzbl %bl, %eax
cmpl $0x73, %eax
je 0x5a78
cmpl $0x53, %eax
leaq 0x10(%rsp), %rbx
je 0x5a0e
cmpl $0x63, %eax
je 0x5a6b
cmpl $0x69, %eax
je 0x5a41
cmpl $0x49, %eax
jne 0x5939
incq %r13
cmpq %r14, %r13
jae 0x5939
movq %r13, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x2220
movl %eax, 0xc(%rsp)
leaq 0xc(%rsp), %rdi
pushq $0x4
popq %rsi
movq %r15, %rdx
callq 0x5b75
movq 0x10(%rsp), %r13
jmp 0x59b3
movq %r13, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x2220
movw %ax, 0xc(%rsp)
leaq 0xc(%rsp), %rdi
pushq $0x2
popq %rsi
movq %r15, %rdx
callq 0x5b75
movq 0x10(%rsp), %r13
incq %r13
cmpq %r14, %r13
jb 0x59e7
jmp 0x5939
movq %r13, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x2220
movl %eax, 0xc(%rsp)
leaq 0xc(%rsp), %rdi
pushq $0x4
popq %rsi
movq %r15, %rdx
callq 0x5b75
movq 0x10(%rsp), %r13
incq %r13
cmpq %r14, %r13
jb 0x5a1b
jmp 0x5939
movq %r13, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x2220
movsbl %al, %edi
movq %r15, %rsi
callq 0x5bf8
movq 0x10(%rsp), %r13
incq %r13
cmpq %r14, %r13
jb 0x5a4e
jmp 0x5939
leaq 0x10(%rsp), %rbx
incq %r13
cmpq %r14, %r13
jae 0x5939
movq %r13, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x2220
movw %ax, 0xc(%rsp)
leaq 0xc(%rsp), %rdi
pushq $0x2
popq %rsi
movq %r15, %rdx
callq 0x5b75
movq 0x10(%rsp), %r13
jmp 0x5a7d
leaq 0x10(%rsp), %rbx
incq %r13
cmpq %r14, %r13
jae 0x5939
movq %r13, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x2220
movzbl %al, %edi
movq %r15, %rsi
callq 0x5bf8
movq 0x10(%rsp), %r13
jmp 0x5ab7
movq 0x30(%rsp), %rbx
movq 0x38(%rsp), %r15
testq %rbx, %rbx
je 0x5b46
cmpq %r15, %rbx
jne 0x5b46
leaq 0x1(%rbx), %rax
cmpq %rax, %r15
jae 0x5b46
movq %rbx, %rax
shrq %rax
orq %rbx, %rax
movq %rax, %rcx
shrq $0x2, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x4, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x8, %rcx
orq %rax, %rcx
movq %rcx, %r15
shrq $0x10, %r15
orq %rcx, %r15
incq %r15
movq 0x40(%rsp), %rdi
movq %r15, %rsi
callq 0x22b0
jmp 0x5b4b
xorl %ebx, %ebx
jmp 0x5b64
movq 0x40(%rsp), %rax
movq 0x28(%rsp), %rcx
movq 0x20(%rsp), %rdx
testq %rax, %rax
je 0x5b5e
movb $0x0, (%rax,%rbx)
movl %r15d, (%rdx)
movq %rax, (%rcx)
movl %ebx, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq