// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/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), %r13
movzbl (%r15), %eax
movl (%r13,%rax,4), %ecx
movl %ecx, (%rsi)
cmpl $0xb, %ecx
jne 0x9b249
incq %r15
movq %r15, 0x8(%r14)
movzbl (%r15), %eax
movl (%r13,%rax,4), %ecx
movl %ecx, (%rbx)
incq %r15
cmpl $0xb, %ecx
je 0x9b22f
decq %r15
movl (%r14), %edx
movl %r15d, %ebp
subl %edx, %ebp
movl %ebp, 0x4(%rbx)
cmpl $0xa, %ecx
je 0x9b48c
cmpl $0xd, %ecx
je 0x9b284
cmpl $0xc, %ecx
jne 0x9b485
movl $0xc, (%rbx)
movl %ebp, 0x4(%rbx)
leaq 0x3960f(%rip), %rax     # 0xd488a
movq %rax, 0x8(%rbx)
jmp 0x9b48c
cmpb $0x2d, %al
je 0x9b4a1
movzbl %al, %ecx
cmpl $0x22, %ecx
jne 0x9b49b
cmpb $0x22, (%r15)
jne 0x9b60f
incq %r15
movq %r15, 0x8(%r14)
movq 0x10(%r14), %rax
movl $0x0, 0xc(%rax)
movq 0x8(%r14), %rbp
movzbl (%rbp), %eax
cmpl $0x5c, %eax
je 0x9b2d3
cmpl $0x22, %eax
je 0x9b58c
testl %eax, %eax
jne 0x9b2f4
jmp 0x9b574
movzbl 0x1(%rbp), %eax
movzbl 0x400(%r13,%rax), %eax
cmpl $0x75, %eax
je 0x9b30e
testl %eax, %eax
je 0x9b5e8
incq %rbp
movq %rbp, 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)
incq 0x8(%r14)
jmp 0x9b2b4
leaq 0x2(%rbp), %rdi
callq 0x9b9c1
testl %eax, %eax
js 0x9b55c
movl %eax, %r12d
andl $0xf800, %eax           # imm = 0xF800
cmpl $0xd800, %eax           # imm = 0xD800
jne 0x9b38c
btl $0xa, %r12d
jb 0x9b55c
cmpb $0x5c, 0x6(%rbp)
jne 0x9b55c
cmpb $0x75, 0x7(%rbp)
jne 0x9b55c
leaq 0x8(%rbp), %rdi
callq 0x9b9c1
movl %eax, %ecx
andl $0x8000fc00, %ecx       # imm = 0x8000FC00
cmpl $0xdc00, %ecx           # imm = 0xDC00
jne 0x9b55c
shll $0xa, %r12d
andl $0xffc00, %r12d         # imm = 0xFFC00
andl $0x3ff, %eax            # imm = 0x3FF
addl %eax, %r12d
addl $0x10000, %r12d         # imm = 0x10000
movl $0xc, %r15d
jmp 0x9b392
movl $0x6, %r15d
cmpl $0x7f, %r12d
jg 0x9b3a8
movb %r12b, 0x4(%rsp)
movl $0x1, %r12d
jmp 0x9b44e
cmpl $0x7ff, %r12d           # imm = 0x7FF
jg 0x9b3d2
movl %r12d, %eax
shrl $0x6, %eax
orb $-0x40, %al
movb %al, 0x4(%rsp)
andb $0x3f, %r12b
orb $-0x80, %r12b
movb %r12b, 0x5(%rsp)
movl $0x2, %r12d
jmp 0x9b44e
cmpl $0xffff, %r12d          # imm = 0xFFFF
jg 0x9b40a
movl %r12d, %eax
shrl $0xc, %eax
orb $-0x20, %al
movb %al, 0x4(%rsp)
movl %r12d, %eax
shrl $0x6, %eax
andb $0x3f, %al
orb $-0x80, %al
movb %al, 0x5(%rsp)
andb $0x3f, %r12b
orb $-0x80, %r12b
movb %r12b, 0x6(%rsp)
movl $0x3, %r12d
jmp 0x9b44e
cmpl $0x1fffff, %r12d        # imm = 0x1FFFFF
jg 0x9b47e
movl %r12d, %eax
shrl $0x12, %eax
orb $-0x10, %al
movb %al, 0x4(%rsp)
movl %r12d, %eax
shrl $0xc, %eax
andb $0x3f, %al
orb $-0x80, %al
movb %al, 0x5(%rsp)
movl %r12d, %eax
shrl $0x6, %eax
andb $0x3f, %al
orb $-0x80, %al
movb %al, 0x6(%rsp)
andb $0x3f, %r12b
orb $-0x80, %r12b
movb %r12b, 0x7(%rsp)
movl $0x4, %r12d
xorl %eax, %eax
testb %al, %al
jne 0x9b55c
movq 0x10(%r14), %rbp
movslq 0xc(%rbp), %rdi
addq (%rbp), %rdi
movl %r12d, %edx
leaq 0x4(%rsp), %rsi
callq 0x26c60
addl %r12d, 0xc(%rbp)
addq %r15, 0x8(%r14)
jmp 0x9b2b4
xorl %r12d, %r12d
movb $0x1, %al
jmp 0x9b450
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 0x9b4e5
cmpl $0x0, 0x53c(%r13)
je 0x9b4c4
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x9b963
movq %r14, %rdi
callq 0x9b8e3
testl %eax, %eax
je 0x9b4ab
movl $0xc, (%rbx)
movl %ebp, 0x4(%rbx)
leaq 0x393b8(%rip), %rax     # 0xd4898
jmp 0x9b27b
leaq 0x2e489(%rip), %rsi     # 0xc9975
movl $0x4, %edx
movq %r15, %rdi
callq 0x26360
testl %eax, %eax
je 0x9b5ba
leaq 0x321f5(%rip), %rsi     # 0xcd6fd
movl $0x5, %edx
movq %r15, %rdi
callq 0x26360
testl %eax, %eax
je 0x9b5d1
leaq 0x26251(%rip), %rsi     # 0xc1775
movl $0x4, %edx
movq %r15, %rdi
callq 0x26360
testl %eax, %eax
je 0x9b600
cmpl $0x0, 0x53c(%r13)
je 0x9b26b
movq %r14, %rdi
callq 0x9b8e3
testl %eax, %eax
jne 0x9b4ab
jmp 0x9b26b
movl $0xc, (%rbx)
subl (%r14), %ebp
movl %ebp, 0x4(%rbx)
leaq 0x393ab(%rip), %rax     # 0xd491a
jmp 0x9b27b
movl $0xc, (%rbx)
subl (%r14), %ebp
movl %ebp, 0x4(%rbx)
leaq 0x3937a(%rip), %rax     # 0xd4901
jmp 0x9b27b
incq %rbp
movq %rbp, 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 0x9b27b
movl $0x6, (%rbx)
movl $0x1, 0x8(%rbx)
addq $0x4, 0x8(%r14)
jmp 0x9b48c
movl $0x6, (%rbx)
movl $0x0, 0x8(%rbx)
addq $0x5, 0x8(%r14)
jmp 0x9b48c
movl $0xc, (%rbx)
subl (%r14), %ebp
movl %ebp, 0x4(%rbx)
leaq 0x3933b(%rip), %rax     # 0xd4936
jmp 0x9b27b
movl $0x7, (%rbx)
addq $0x4, %r15
jmp 0x9b488
leaq 0x39291(%rip), %rdi     # 0xd48a7
leaq 0x3929c(%rip), %rsi     # 0xd48b9
leaq 0x392a1(%rip), %rcx     # 0xd48c5
movl $0x37b, %edx            # imm = 0x37B
callq 0x262e0