// File: /workspace/github_c_makefile_star2_O1/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 0x361c1
andq $-0x4, %rcx
movq %rcx, (%r14)
leaq 0x65c27(%rip), %rcx     # 0x9bde0
movb (%rax,%rcx), %al
jmp 0x36443
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 0x363ae
btq %rax, %rdx
jae 0x361fe
incq %r12
addq $0x4, %rcx
jmp 0x361e0
testq %rax, %rax
je 0x36443
cmpq $0x22, %rax
jne 0x363ae
incq %r12
movq %r12, 0x8(%rbx)
leaq 0x65b81(%rip), %rbp     # 0x9bda0
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
movq %r12, %r13
movzbl (%r13), %eax
cmpl $0x5c, %eax
je 0x3624f
testl %eax, %eax
je 0x36432
cmpl $0x22, %eax
je 0x3640e
incq %r13
movb %al, (%r12)
incq %r12
jmp 0x36228
movb 0x1(%r13), %al
movzbl %al, %ecx
cmpl $0x6d, %ecx
jle 0x36274
addl $-0x6e, %ecx
cmpl $0x7, %ecx
ja 0x362b4
movslq (%rbp,%rcx,4), %rcx
addq %rbp, %rcx
jmpq *%rcx
movb $0xa, (%r12)
jmp 0x362b8
cmpl $0x62, %ecx
je 0x362a5
cmpl $0x66, %ecx
jne 0x362ac
movb $0xc, (%r12)
jmp 0x362b8
movb $0xd, (%r12)
jmp 0x362b8
movsbl 0x2(%r13), %eax
leal -0x61(%rax), %ecx
cmpb $0x5, %cl
ja 0x362c4
addl $-0x57, %eax
jmp 0x362de
movb $0x9, (%r12)
jmp 0x362b8
movb $0x8, (%r12)
jmp 0x362b8
testl %ecx, %ecx
je 0x3642f
movb %al, (%r12)
incq %r12
addq $0x2, %r13
jmp 0x36228
leal -0x41(%rax), %ecx
cmpb $0x5, %cl
ja 0x362d1
addl $-0x37, %eax
jmp 0x362de
leal -0x30(%rax), %ecx
addl $-0x30, %eax
cmpb $0xa, %cl
cmovael %r8d, %eax
testl %eax, %eax
js 0x36228
movsbl 0x3(%r13), %ecx
leal -0x61(%rcx), %edx
cmpb $0x5, %dl
ja 0x362f8
addl $-0x57, %ecx
jmp 0x36312
leal -0x41(%rcx), %edx
cmpb $0x5, %dl
ja 0x36305
addl $-0x37, %ecx
jmp 0x36312
leal -0x30(%rcx), %edx
addl $-0x30, %ecx
cmpb $0xa, %dl
cmovael %r8d, %ecx
testl %ecx, %ecx
js 0x36228
movsbl 0x4(%r13), %esi
leal -0x61(%rsi), %edx
cmpb $0x5, %dl
ja 0x3632c
addl $-0x57, %esi
jmp 0x36346
leal -0x41(%rsi), %edx
cmpb $0x5, %dl
ja 0x36339
addl $-0x37, %esi
jmp 0x36346
leal -0x30(%rsi), %edx
addl $-0x30, %esi
cmpb $0xa, %dl
cmovael %r8d, %esi
testl %esi, %esi
js 0x36228
movsbl 0x5(%r13), %edx
leal -0x61(%rdx), %edi
cmpb $0x5, %dil
ja 0x36361
addl $-0x57, %edx
jmp 0x3637d
leal -0x41(%rdx), %edi
cmpb $0x5, %dil
ja 0x3636f
addl $-0x37, %edx
jmp 0x3637d
leal -0x30(%rdx), %edi
addl $-0x30, %edx
cmpb $0xa, %dil
cmovael %r8d, %edx
testl %edx, %edx
js 0x36228
shll $0xc, %eax
shll $0x8, %ecx
orl %eax, %ecx
shll $0x4, %esi
orl %edx, %esi
orl %ecx, %esi
movq %r12, %rdi
callq 0x37067
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
movq %rax, %r12
addq $0x6, %r13
jmp 0x36228
addl $-0x5b, %eax
cmpl $0x22, %eax
ja 0x363cf
movabsq $0x500000005, %rdx      # imm = 0x500000005
btq %rax, %rdx
jae 0x363cf
movq %rcx, (%r14)
movb (%r12), %al
jmp 0x36443
movq %r12, 0x8(%rbx)
leaq 0x65a0b(%rip), %rsi     # 0x9bde5
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 0x36418
movb $0x0, (%r12,%rax)
addq %rax, %r12
incq %r12
jmp 0x3641b
movb $0x0, (%r12)
incq %r13
jmp 0x36437
addq %rax, %r12
subq %r15, %r12
leaq (%rcx,%r12,4), %rax
movq %rax, (%r14)
movq %rbx, %rdi
callq 0x36454
jmp 0x36443
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