// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/textutils.c
// Function: hts_json_snext
HTSLIB_EXPORT
char hts_json_snext(char *str, size_t *state, hts_json_token *token)
{
    char *s = &str[*state >> 2];
    int hidden = *state & 3;

    if (hidden) {
        *state &= ~3;
        return token->type = "?}]?"[hidden];
    }

#define STATE(s,h)  (((s) - str) << 2 | (h))

    for (;;) switch (*s) {
    case ' ':
    case '\t':
    case '\r':
    case '\n':
    case ',':
    case ':':
        s++;
        continue;

    case '\0':
        return token->type = '\0';

    case '{':
    case '[':
    case '}':
    case ']':
        *state = STATE(s+1, 0);
        return token->type = *s;

    case '"':
        token->str = s+1;
        *state = STATE(sscan_string(s+1), 0);
        return token->type = 's';

    default:
        token->str = s;
        s += strcspn(s, " \t\r\n,]}");
        hidden = (*s == '}')? 1 : (*s == ']')? 2 : 0;
        if (*s != '\0') *s++ = '\0';
        *state = STATE(s, hidden);
        return token->type = token_type(token);
    }

#undef STATE
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq (%rsi), %rcx
movq %rcx, %rax
andq $0x3, %rax
je 0x2b185
andq $-0x4, %rcx
movq %rcx, (%r14)
leaq 0x4fbd3(%rip), %rcx     # 0x7ad50
movb (%rax,%rcx), %al
jmp 0x2b38c
movq %rdi, %r15
movq %rcx, %r12
shrq $0x2, %r12
addq %rdi, %r12
andq $-0x4, %rcx
addq $0x4, %rcx
movabsq $0x400100100002600, %rdx # imm = 0x400100100002600
movzbl (%r12), %eax
cmpq $0x3a, %rax
ja 0x2b2f9
btq %rax, %rdx
jae 0x2b1c2
incq %r12
addq $0x4, %rcx
jmp 0x2b1a4
testq %rax, %rax
je 0x2b38c
cmpq $0x22, %rax
jne 0x2b2f9
incq %r12
movq %r12, 0x8(%rbx)
movq %r12, %r13
movzbl (%r13), %eax
cmpl $0x5c, %eax
je 0x2b206
testl %eax, %eax
je 0x2b37b
cmpl $0x22, %eax
je 0x2b357
incq %r13
movb %al, (%r12)
incq %r12
jmp 0x2b1df
movb 0x1(%r13), %al
movzbl %al, %ecx
leal -0x6e(%rcx), %edx
cmpl $0x7, %edx
ja 0x2b22f
leaq 0x4faf4(%rip), %rsi     # 0x7ad10
movslq (%rsi,%rdx,4), %rcx
addq %rsi, %rcx
jmpq *%rcx
movb $0xa, (%r12)
jmp 0x2b2ed
cmpl $0x62, %ecx
je 0x2b2e1
cmpl $0x66, %ecx
je 0x2b2e8
testl %ecx, %ecx
je 0x2b378
movb %al, (%r12)
jmp 0x2b2ed
movb $0x9, (%r12)
jmp 0x2b2ed
movb $0xd, (%r12)
jmp 0x2b2ed
movsbl 0x2(%r13), %edi
callq 0x2affa
testl %eax, %eax
js 0x2b1df
movl %eax, %ebp
movsbl 0x3(%r13), %edi
callq 0x2affa
movl %eax, 0x4(%rsp)
testl %eax, %eax
js 0x2b1df
movsbl 0x4(%r13), %edi
callq 0x2affa
testl %eax, %eax
js 0x2b1df
movsbl 0x5(%r13), %edi
movl %eax, (%rsp)
callq 0x2affa
movl (%rsp), %esi
testl %eax, %eax
js 0x2b1df
shll $0xc, %ebp
movl 0x4(%rsp), %ecx
shll $0x8, %ecx
orl %ebp, %ecx
shll $0x4, %esi
orl %eax, %esi
orl %ecx, %esi
movq %r12, %rdi
callq 0x2ba67
movq %rax, %r12
addq $0x6, %r13
jmp 0x2b1df
movb $0x8, (%r12)
jmp 0x2b2ed
movb $0xc, (%r12)
incq %r12
addq $0x2, %r13
jmp 0x2b1df
addl $-0x5b, %eax
cmpl $0x22, %eax
ja 0x2b31a
movabsq $0x500000005, %rdx      # imm = 0x500000005
btq %rax, %rdx
jae 0x2b31a
movq %rcx, (%r14)
movb (%r12), %al
jmp 0x2b38c
movq %r12, 0x8(%rbx)
leaq 0x4fa30(%rip), %rsi     # 0x7ad55
movq %r12, %rdi
callq 0x4090
movb (%r12,%rax), %dl
xorl %esi, %esi
cmpb $0x5d, %dl
sete %sil
addl %esi, %esi
cmpb $0x7d, %dl
pushq $0x1
popq %rcx
cmovneq %rsi, %rcx
testb %dl, %dl
je 0x2b361
movb $0x0, (%r12,%rax)
addq %rax, %r12
incq %r12
jmp 0x2b364
movb $0x0, (%r12)
incq %r13
jmp 0x2b380
addq %rax, %r12
subq %r15, %r12
leaq (%rcx,%r12,4), %rax
movq %rax, (%r14)
movq %rbx, %rdi
callq 0x2b39d
jmp 0x2b38c
incq %r13
movb $0x0, (%r12)
subq %r15, %r13
shlq $0x2, %r13
movq %r13, (%r14)
movb $0x73, %al
movb %al, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq