// File: /workspace/github_c_makefile_star2_O3/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 0x34db0
andq $-0x4, %rcx
movq %rcx, (%r14)
leaq 0x64048(%rip), %rcx     # 0x98df0
movb (%rax,%rcx), %al
jmp 0x35032
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 0x34f99
btq %rax, %rdx
jae 0x34ded
incq %r12
addq $0x4, %rcx
jmp 0x34dcf
testq %rax, %rax
je 0x35032
cmpq $0x22, %rax
jne 0x34f99
incq %r12
movq %r12, 0x8(%rbx)
leaq 0x63fa2(%rip), %rbp     # 0x98db0
movq %r12, %r13
movzbl (%r13), %eax
cmpl $0x5c, %eax
je 0x34e38
testl %eax, %eax
je 0x35021
cmpl $0x22, %eax
je 0x34ffd
incq %r13
movb %al, (%r12)
incq %r12
jmp 0x34e11
movb 0x1(%r13), %al
movzbl %al, %ecx
cmpl $0x6d, %ecx
jle 0x34e5d
addl $-0x6e, %ecx
cmpl $0x7, %ecx
ja 0x34e9d
movslq (%rbp,%rcx,4), %rcx
addq %rbp, %rcx
jmpq *%rcx
movb $0xa, (%r12)
jmp 0x34ea1
cmpl $0x62, %ecx
je 0x34e8e
cmpl $0x66, %ecx
jne 0x34e95
movb $0xc, (%r12)
jmp 0x34ea1
movb $0xd, (%r12)
jmp 0x34ea1
movsbl 0x2(%r13), %eax
leal -0x61(%rax), %ecx
cmpb $0x5, %cl
ja 0x34ead
addl $-0x57, %eax
jmp 0x34ec9
movb $0x9, (%r12)
jmp 0x34ea1
movb $0x8, (%r12)
jmp 0x34ea1
testl %ecx, %ecx
je 0x3501e
movb %al, (%r12)
incq %r12
addq $0x2, %r13
jmp 0x34e11
leal -0x41(%rax), %ecx
cmpb $0x5, %cl
ja 0x34eba
addl $-0x37, %eax
jmp 0x34ec9
leal -0x30(%rax), %ecx
cmpb $0x9, %cl
ja 0x34e11
addl $-0x30, %eax
testl %eax, %eax
js 0x34e11
movsbl 0x3(%r13), %ecx
leal -0x61(%rcx), %edx
cmpb $0x5, %dl
ja 0x34ee3
addl $-0x57, %ecx
jmp 0x34eff
leal -0x41(%rcx), %edx
cmpb $0x5, %dl
ja 0x34ef0
addl $-0x37, %ecx
jmp 0x34eff
leal -0x30(%rcx), %edx
cmpb $0x9, %dl
ja 0x34e11
addl $-0x30, %ecx
testl %ecx, %ecx
js 0x34e11
movsbl 0x4(%r13), %esi
leal -0x61(%rsi), %edx
cmpb $0x5, %dl
ja 0x34f19
addl $-0x57, %esi
jmp 0x34f35
leal -0x41(%rsi), %edx
cmpb $0x5, %dl
ja 0x34f26
addl $-0x37, %esi
jmp 0x34f35
leal -0x30(%rsi), %edx
cmpb $0x9, %dl
ja 0x34e11
addl $-0x30, %esi
testl %esi, %esi
js 0x34e11
movsbl 0x5(%r13), %edx
leal -0x61(%rdx), %edi
cmpb $0x5, %dil
ja 0x34f50
addl $-0x57, %edx
jmp 0x34f6e
leal -0x41(%rdx), %edi
cmpb $0x5, %dil
ja 0x34f5e
addl $-0x37, %edx
jmp 0x34f6e
leal -0x30(%rdx), %edi
cmpb $0x9, %dil
ja 0x34e11
addl $-0x30, %edx
testl %edx, %edx
js 0x34e11
shll $0xc, %eax
shll $0x8, %ecx
orl %eax, %ecx
shll $0x4, %esi
orl %edx, %esi
orl %ecx, %esi
movq %r12, %rdi
callq 0x35c91
movq %rax, %r12
addq $0x6, %r13
jmp 0x34e11
addl $-0x5b, %eax
cmpl $0x22, %eax
ja 0x34fba
movabsq $0x500000005, %rdx      # imm = 0x500000005
btq %rax, %rdx
jae 0x34fba
movq %rcx, (%r14)
movb (%r12), %al
jmp 0x35032
movq %r12, 0x8(%rbx)
leaq 0x63e30(%rip), %rsi     # 0x98df5
movq %r12, %rdi
callq 0x4090
movb (%r12,%rax), %dl
xorl %esi, %esi
cmpb $0x5d, %dl
sete %sil
addl %esi, %esi
cmpb $0x7d, %dl
movl $0x1, %ecx
cmovneq %rsi, %rcx
testb %dl, %dl
je 0x35007
movb $0x0, (%r12,%rax)
addq %r12, %rax
incq %rax
movq 0x8(%rbx), %r12
jmp 0x3500a
movb $0x0, (%r12)
incq %r13
jmp 0x35026
addq %r12, %rax
subq %r15, %rax
leaq (%rcx,%rax,4), %rax
movq %rax, (%r14)
movq %r12, %rdi
callq 0x35043
jmp 0x35032
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