// File: /workspace/github_c_makefile_star2_O2/c-zhou[P]oatk/path.c
// Function: gfa_aux_parse
static 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') {
                    int64_t x;
                    x = strtoll(q, &q, 10);
                    kputc_(type, &str); kputsn_((char*)&x, 8, &str);
                } else if (type == 'f') {
                    double x;
                    x = strtod(q, &q);
                    kputc_('f', &str); kputsn_(&x, 8, &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) { int64_t  x = strtoll(q + 1, &q, 0); kputsn_(&x, 8, &str); }
                        else if (type == 'I') while (q + 1 < p) { uint64_t x = strtoll(q + 1, &q, 0); kputsn_(&x, 8, &str); }
                        else if (type == 'f') while (q + 1 < p) { double   x = strtod(q + 1, &q);     kputsn_(&x, 8, &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 0xf60e
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 %r14d, %r14d
cmpb $0x9, (%rdi)
sete %r14b
addq %rdi, %r14
leaq 0x8(%rsp), %rax
movq %r14, (%rax)
movq %r14, %rbp
movzbl (%rbp), %r13d
cmpl $0x9, %r13d
je 0xf2ad
testl %r13d, %r13d
jne 0xf413
movb $0x0, (%rbp)
movq %rbp, %rax
subq %r14, %rax
cmpq $0x5, %rax
jl 0xf401
cmpb $0x3a, 0x2(%r14)
jne 0xf401
cmpb $0x3a, 0x4(%r14)
jne 0xf401
movzbl 0x3(%r14), %r12d
leal -0x41(%r12), %eax
cmpl $0x28, %eax
ja 0xf401
movabsq $0x12002000003, %rcx    # imm = 0x12002000003
btq %rax, %rcx
jae 0xf401
movq %r14, %rdi
pushq $0x2
popq %rsi
movq %r15, %rdx
callq 0xf74a
leaq 0x5(%r14), %rbx
movq %rbx, 0x8(%rsp)
cmpl $0x69, %r12d
je 0xf3d1
cmpl $0x42, %r12d
je 0xf35a
cmpl $0x5a, %r12d
je 0xf3bb
cmpl $0x66, %r12d
je 0xf3a4
cmpl $0x41, %r12d
jne 0xf401
pushq $0x41
popq %rdi
movq %r15, %rsi
callq 0xf7cd
movsbl (%rbx), %edi
movq %r15, %rsi
callq 0xf7cd
jmp 0xf401
leaq 0x6(%r14), %rbx
movq %rbx, 0x8(%rsp)
movq %rbp, %rax
subq %rbx, %rax
cmpq $0x2, %rax
jl 0xf401
movb 0x5(%r14), %r14b
cmpb $0x66, %r14b
je 0xf401
andl $0x0, 0x1c(%rsp)
movsbl %r14b, %r12d
xorl %eax, %eax
movq %rbx, %rcx
movzbl (%rcx), %edx
cmpl $0x2c, %edx
je 0xf39d
testl %edx, %edx
jne 0xf39f
jmp 0xf41b
incl %eax
incq %rcx
jmp 0xf38f
movq %rbx, %rdi
leaq 0x8(%rsp), %rsi
callq 0x30d0
movsd %xmm0, 0x10(%rsp)
pushq $0x66
jmp 0xf3e8
pushq $0x5a
popq %rdi
movq %r15, %rsi
callq 0xf7cd
movl %ebp, %esi
subl %ebx, %esi
incl %esi
movq %rbx, %rdi
jmp 0xf3f9
movq %rbx, %rdi
leaq 0x8(%rsp), %rsi
pushq $0xa
popq %rdx
callq 0x3260
movq %rax, 0x10(%rsp)
pushq $0x69
popq %rdi
movq %r15, %rsi
callq 0xf7cd
leaq 0x10(%rsp), %rdi
pushq $0x8
popq %rsi
movq %r15, %rdx
callq 0xf74a
leaq 0x1(%rbp), %r14
movq %r14, 0x8(%rsp)
testb %r13b, %r13b
je 0xf5ae
incq %rbp
jmp 0xf299
movl %eax, 0x1c(%rsp)
pushq $0x42
popq %rdi
movq %r15, %rsi
callq 0xf7cd
movl %r12d, %edi
movq %r15, %rsi
callq 0xf7cd
leaq 0x1c(%rsp), %rdi
pushq $0x4
popq %rsi
movq %r15, %rdx
callq 0xf74a
cmpb $0x43, %r14b
je 0xf57e
movzbl %r14b, %eax
cmpl $0x73, %eax
je 0xf544
cmpl $0x53, %eax
leaq 0x8(%rsp), %r14
je 0xf4d9
cmpl $0x63, %eax
je 0xf537
cmpl $0x69, %eax
je 0xf50d
cmpl $0x49, %eax
jne 0xf401
incq %rbx
cmpq %rbp, %rbx
jae 0xf401
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x3260
movq %rax, 0x10(%rsp)
leaq 0x10(%rsp), %rdi
pushq $0x8
popq %rsi
movq %r15, %rdx
callq 0xf74a
movq 0x8(%rsp), %rbx
jmp 0xf47d
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x32b0
movw %ax, 0x10(%rsp)
leaq 0x10(%rsp), %rdi
pushq $0x2
popq %rsi
movq %r15, %rdx
callq 0xf74a
movq 0x8(%rsp), %rbx
incq %rbx
cmpq %rbp, %rbx
jb 0xf4b2
jmp 0xf401
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x3260
movq %rax, 0x10(%rsp)
leaq 0x10(%rsp), %rdi
pushq $0x8
popq %rsi
movq %r15, %rdx
callq 0xf74a
movq 0x8(%rsp), %rbx
incq %rbx
cmpq %rbp, %rbx
jb 0xf4e6
jmp 0xf401
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x32b0
movsbl %al, %edi
movq %r15, %rsi
callq 0xf7cd
movq 0x8(%rsp), %rbx
incq %rbx
cmpq %rbp, %rbx
jb 0xf51a
jmp 0xf401
leaq 0x8(%rsp), %r14
incq %rbx
cmpq %rbp, %rbx
jae 0xf401
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x32b0
movw %ax, 0x10(%rsp)
leaq 0x10(%rsp), %rdi
pushq $0x2
popq %rsi
movq %r15, %rdx
callq 0xf74a
movq 0x8(%rsp), %rbx
jmp 0xf549
leaq 0x8(%rsp), %r14
incq %rbx
cmpq %rbp, %rbx
jae 0xf401
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x32b0
movzbl %al, %edi
movq %r15, %rsi
callq 0xf7cd
movq 0x8(%rsp), %rbx
jmp 0xf583
movq 0x30(%rsp), %rbx
movq 0x38(%rsp), %r14
testq %rbx, %rbx
je 0xf612
cmpq %r14, %rbx
jne 0xf612
leaq 0x1(%rbx), %rax
cmpq %rax, %r14
jae 0xf612
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, %r14
shrq $0x10, %r14
orq %rcx, %r14
incq %r14
movq 0x40(%rsp), %rdi
movq %r14, %rsi
callq 0x3330
jmp 0xf617
xorl %ebx, %ebx
jmp 0xf630
movq 0x40(%rsp), %rax
movq 0x28(%rsp), %rcx
movq 0x20(%rsp), %rdx
testq %rax, %rax
je 0xf62a
movb $0x0, (%rax,%rbx)
movl %r14d, (%rdx)
movq %rax, (%rcx)
movl %ebx, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq