// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/deps/lua/src/lua_cjson.c
// Function: json_next_token
static void json_next_token(json_parse_t *json, json_token_t *token)
{
    const json_token_type_t *ch2token = json->cfg->ch2token;
    int ch;

    /* Eat whitespace. */
    while (1) {
        ch = (unsigned char)*(json->ptr);
        token->type = ch2token[ch];
        if (token->type != T_WHITESPACE)
            break;
        json->ptr++;
    }

    /* Store location of new token. Required when throwing errors
     * for unexpected tokens (syntax errors). */
    token->index = json->ptr - json->data;

    /* Don't advance the pointer for an error or the end */
    if (token->type == T_ERROR) {
        json_set_token_error(token, json, "invalid token");
        return;
    }

    if (token->type == T_END) {
        return;
    }

    /* Found a known single character token, advance index and return */
    if (token->type != T_UNKNOWN) {
        json->ptr++;
        return;
    }

    /* Process characters which triggered T_UNKNOWN
     *
     * Must use strncmp() to match the front of the JSON string.
     * JSON identifier must be lowercase.
     * When strict_numbers if disabled, either case is allowed for
     * Infinity/NaN (since we are no longer following the spec..) */
    if (ch == '"') {
        json_next_string_token(json, token);
        return;
    } else if (ch == '-' || ('0' <= ch && ch <= '9')) {
        if (!json->cfg->decode_invalid_numbers && json_is_invalid_number(json)) {
            json_set_token_error(token, json, "invalid number");
            return;
        }
        json_next_number_token(json, token);
        return;
    } else if (!strncmp(json->ptr, "true", 4)) {
        token->type = T_BOOLEAN;
        token->value.boolean = 1;
        json->ptr += 4;
        return;
    } else if (!strncmp(json->ptr, "false", 5)) {
        token->type = T_BOOLEAN;
        token->value.boolean = 0;
        json->ptr += 5;
        return;
    } else if (!strncmp(json->ptr, "null", 4)) {
        token->type = T_NULL;
        json->ptr += 4;
        return;
    } else if (json->cfg->decode_invalid_numbers &&
               json_is_invalid_number(json)) {
        /* When decode_invalid_numbers is enabled, only attempt to process
         * numbers we know are invalid JSON (Inf, NaN, hex)
         * This is required to generate an appropriate token error,
         * otherwise all bad tokens will register as "invalid number"
         */
        json_next_number_token(json, token);
        return;
    }

    /* Token starts with t/f/n but isn't recognised above. */
    json_set_token_error(token, json, "invalid token");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq 0x8(%rdi), %r15
movq 0x18(%rdi), %rbp
movzbl (%r15), %eax
movl (%rbp,%rax,4), %ecx
movl %ecx, (%rsi)
cmpl $0xb, %ecx
jne 0x97cda
incq %r15
movq %r15, 0x8(%r14)
movzbl (%r15), %eax
movl (%rbp,%rax,4), %ecx
movl %ecx, (%rbx)
incq %r15
cmpl $0xb, %ecx
je 0x97cc1
decq %r15
movl (%r14), %edx
movl %r15d, %r12d
subl %edx, %r12d
movl %r12d, 0x4(%rbx)
cmpl $0xa, %ecx
je 0x97f42
cmpl $0xd, %ecx
je 0x97d18
cmpl $0xc, %ecx
jne 0x97f3b
movl $0xc, (%rbx)
movl %r12d, 0x4(%rbx)
leaq 0x39cdb(%rip), %rax     # 0xd19ea
movq %rax, 0x8(%rbx)
jmp 0x97f42
cmpb $0x2d, %al
je 0x97f57
movzbl %al, %ecx
cmpl $0x22, %ecx
jne 0x97f51
cmpb $0x22, (%r15)
jne 0x980ae
incq %r15
movq %r15, 0x8(%r14)
movq 0x10(%r14), %rax
movl $0x0, 0xc(%rax)
movzbl (%r15), %eax
cmpl $0x5c, %eax
je 0x97d63
cmpl $0x22, %eax
je 0x98011
testl %eax, %eax
jne 0x97d84
jmp 0x9803f
movzbl 0x1(%r15), %eax
movzbl 0x400(%rbp,%rax), %eax
cmpl $0x75, %eax
je 0x97da5
testl %eax, %eax
je 0x9806f
incq %r15
movq %r15, 0x8(%r14)
movq 0x10(%r14), %rcx
movq (%rcx), %rdx
movslq 0xc(%rcx), %rsi
leal 0x1(%rsi), %edi
movl %edi, 0xc(%rcx)
movb %al, (%rdx,%rsi)
movq 0x8(%r14), %r15
incq %r15
movq %r15, 0x8(%r14)
jmp 0x97d48
leaq 0x2(%r15), %rdi
callq 0x98468
testl %eax, %eax
js 0x97f22
movl %eax, %r13d
andl $0xf800, %eax           # imm = 0xF800
cmpl $0xd800, %eax           # imm = 0xD800
jne 0x97e6b
btl $0xa, %r13d
jb 0x97f22
cmpb $0x5c, 0x6(%r15)
jne 0x97f22
cmpb $0x75, 0x7(%r15)
jne 0x97f22
leaq 0x8(%r15), %rdi
callq 0x98468
movl %eax, %ecx
andl $0x8000fc00, %ecx       # imm = 0x8000FC00
cmpl $0xdc00, %ecx           # imm = 0xDC00
jne 0x97f22
shll $0xa, %r13d
andl $0xffc00, %r13d         # imm = 0xFFC00
andl $0x3ff, %eax            # imm = 0x3FF
addl %eax, %r13d
addl $0x10000, %r13d         # imm = 0x10000
movl $0xc, %eax
movl %r13d, %ecx
shrl $0x12, %ecx
orb $-0x10, %cl
movb %cl, 0x4(%rsp)
movl %r13d, %ecx
shrl $0xc, %ecx
andb $0x3f, %cl
orb $-0x80, %cl
movb %cl, 0x5(%rsp)
movl %r13d, %ecx
shrl $0x6, %ecx
andb $0x3f, %cl
orb $-0x80, %cl
movb %cl, 0x6(%rsp)
andb $0x3f, %r13b
orb $-0x80, %r13b
movb %r13b, 0x7(%rsp)
movl $0x4, %r13d
movq %rax, %r15
jmp 0x97ee4
cmpl $0x7f, %r13d
ja 0x97e7e
movb %r13b, 0x4(%rsp)
movl $0x1, %r13d
jmp 0x97ede
cmpl $0x7ff, %r13d           # imm = 0x7FF
ja 0x97ea8
movl %r13d, %eax
shrl $0x6, %eax
orb $-0x40, %al
movb %al, 0x4(%rsp)
andb $0x3f, %r13b
orb $-0x80, %r13b
movb %r13b, 0x5(%rsp)
movl $0x2, %r13d
jmp 0x97ede
cmpl $0xffff, %r13d          # imm = 0xFFFF
ja 0x97f10
movl %r13d, %eax
shrl $0xc, %eax
orb $-0x20, %al
movb %al, 0x4(%rsp)
movl %r13d, %eax
shrl $0x6, %eax
andb $0x3f, %al
orb $-0x80, %al
movb %al, 0x5(%rsp)
andb $0x3f, %r13b
orb $-0x80, %r13b
movb %r13b, 0x6(%rsp)
movl $0x3, %r13d
movl $0x6, %r15d
movq 0x10(%r14), %r12
movslq 0xc(%r12), %rdi
addq (%r12), %rdi
movl %r13d, %edx
leaq 0x4(%rsp), %rsi
callq 0x26c50
addl %r13d, 0xc(%r12)
addq 0x8(%r14), %r15
movq %r15, 0x8(%r14)
jmp 0x97d48
movl $0x6, %eax
cmpl $0x1fffff, %r13d        # imm = 0x1FFFFF
jbe 0x97e26
subl (%r14), %r15d
movl $0xc, (%rbx)
movl %r15d, 0x4(%rbx)
leaq 0x39b44(%rip), %rax     # 0xd1a7a
jmp 0x97d0f
incq %r15
movq %r15, 0x8(%r14)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
addb $-0x30, %al
cmpb $0x9, %al
ja 0x97f9b
cmpl $0x0, 0x53c(%rbp)
je 0x97f79
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x9840a
movq %r15, %rdi
callq 0x9838a
testl %eax, %eax
je 0x97f60
movl $0xc, (%rbx)
movl %r12d, 0x4(%rbx)
leaq 0x39a62(%rip), %rax     # 0xd19f8
jmp 0x97d0f
leaq 0x2ea2f(%rip), %rsi     # 0xc69d1
movl $0x4, %edx
movq %r15, %rdi
callq 0x26350
testl %eax, %eax
je 0x98058
leaq 0x327d7(%rip), %rsi     # 0xca795
movl $0x5, %edx
movq %r15, %rdi
callq 0x26350
testl %eax, %eax
je 0x98088
leaq 0x2680d(%rip), %rsi     # 0xbe7e7
movl $0x4, %edx
movq %r15, %rdi
callq 0x26350
testl %eax, %eax
je 0x9809f
cmpl $0x0, 0x53c(%rbp)
je 0x97cfe
movq %r15, %rdi
callq 0x9838a
testl %eax, %eax
jne 0x97f60
jmp 0x97cfe
incq %r15
movq %r15, 0x8(%r14)
movq 0x10(%r14), %rax
movq (%rax), %rcx
movslq 0xc(%rax), %rax
movb $0x0, (%rcx,%rax)
movl $0x4, (%rbx)
movq 0x10(%r14), %rax
movl 0xc(%rax), %ecx
movl %ecx, 0x10(%rbx)
movq (%rax), %rax
jmp 0x97d0f
subl (%r14), %r15d
movl $0xc, (%rbx)
movl %r15d, 0x4(%rbx)
leaq 0x39a0e(%rip), %rax     # 0xd1a61
jmp 0x97d0f
movl $0x6, (%rbx)
movl $0x1, 0x8(%rbx)
addq $0x4, 0x8(%r14)
jmp 0x97f42
subl (%r14), %r15d
movl $0xc, (%rbx)
movl %r15d, 0x4(%rbx)
leaq 0x39a13(%rip), %rax     # 0xd1a96
jmp 0x97d0f
movl $0x6, (%rbx)
movl $0x0, 0x8(%rbx)
addq $0x5, 0x8(%r14)
jmp 0x97f42
movl $0x7, (%rbx)
addq $0x4, %r15
jmp 0x97f3e
leaq 0x39952(%rip), %rdi     # 0xd1a07
leaq 0x3995d(%rip), %rsi     # 0xd1a19
leaq 0x39962(%rip), %rcx     # 0xd1a25
movl $0x37b, %edx            # imm = 0x37B
callq 0x262d0