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

    /* Eat whitespace. FIXME: UGLY */
    token->type = ch2token[(unsigned char)json->data[json->index]];
    while (token->type == T_WHITESPACE)
        token->type = ch2token[(unsigned char)json->data[++json->index]];

    token->index = json->index;

    /* 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->index++;
        return;
    }

    /* Process characters which triggered T_UNKNOWN */
    ch = json->data[json->index];

    /* 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_refuse_badnum && 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->data[json->index], "true", 4)) {
        token->type = T_BOOLEAN;
        token->value.boolean = 1;
        json->index += 4;
        return;
    } else if (!strncmp(&json->data[json->index], "false", 5)) {
        token->type = T_BOOLEAN;
        token->value.boolean = 0;
        json->index += 5;
        return;
    } else if (!strncmp(&json->data[json->index], "null", 4)) {
        token->type = T_NULL;
        json->index += 4;
        return;
    } else if (!json->cfg->decode_refuse_badnum &&
               json_is_invalid_number(json)) {
        /* When refuse_badnum is disabled, 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 (%rdi), %r15
movq 0x18(%rdi), %rbp
movslq 0x8(%rdi), %rax
movzbl (%r15,%rax), %eax
movl (%rbp,%rax,4), %eax
movl %eax, (%rsi)
cmpl $0xb, %eax
jne 0x7797c
movslq 0x8(%r14), %rax
leaq (%rax,%r15), %rcx
incq %rcx
leal 0x1(%rax), %edx
movl %edx, 0x8(%r14)
movzbl (%rcx), %eax
movl (%rbp,%rax,4), %eax
movl %eax, (%rbx)
incq %rcx
incl %edx
cmpl $0xb, %eax
je 0x77965
movl 0x8(%r14), %r12d
movl %r12d, 0x4(%rbx)
cmpl $0xa, %eax
je 0x77bc9
cmpl $0xd, %eax
je 0x779b5
cmpl $0xc, %eax
jne 0x77bc2
movl $0xc, (%rbx)
movl %r12d, 0x4(%rbx)
leaq 0x2aa36(%rip), %rax     # 0xa23e2
movq %rax, 0x8(%rbx)
jmp 0x77bc9
movslq %r12d, %rax
movzbl (%r15,%rax), %ecx
cmpl $0x2d, %ecx
je 0x77be0
cmpl $0x22, %ecx
jne 0x77bd8
incl %r12d
movl %r12d, 0x8(%r14)
movq 0x10(%r14), %rax
movl $0x0, 0xc(%rax)
movq (%r14), %r13
movl 0x8(%r14), %r15d
movslq %r15d, %rcx
movzbl (%r13,%rcx), %eax
cmpl $0x5c, %eax
je 0x77a08
cmpl $0x22, %eax
je 0x77ccc
testl %eax, %eax
jne 0x77a2a
jmp 0x77cb6
movzbl 0x1(%r13,%rcx), %eax
movzbl 0x400(%rbp,%rax), %eax
cmpl $0x75, %eax
je 0x77a44
testl %eax, %eax
je 0x77d28
incq %rcx
movl %ecx, 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)
incl 0x8(%r14)
jmp 0x779e1
addq %rcx, %r13
leaq 0x2(%r13), %rdi
callq 0x780ee
testl %eax, %eax
js 0x77ca0
movl %eax, %r12d
andl $0xf800, %eax           # imm = 0xF800
cmpl $0xd800, %eax           # imm = 0xD800
jne 0x77aca
btl $0xa, %r12d
jb 0x77ca0
cmpb $0x5c, 0x6(%r13)
jne 0x77ca0
cmpb $0x75, 0x7(%r13)
jne 0x77ca0
addq $0x8, %r13
movq %r13, %rdi
callq 0x780ee
movl %eax, %ecx
andl $0x8000fc00, %ecx       # imm = 0x8000FC00
cmpl $0xdc00, %ecx           # imm = 0xDC00
jne 0x77ca0
shll $0xa, %r12d
andl $0xffc00, %r12d         # imm = 0xFFC00
andl $0x3ff, %eax            # imm = 0x3FF
addl %eax, %r12d
addl $0x10000, %r12d         # imm = 0x10000
movl $0xc, %r13d
jmp 0x77ad0
movl $0x6, %r13d
cmpl $0x7f, %r12d
jg 0x77ae6
movb %r12b, 0x4(%rsp)
movl $0x1, %r12d
jmp 0x77b8c
cmpl $0x7ff, %r12d           # imm = 0x7FF
jg 0x77b10
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 0x77b8c
cmpl $0xffff, %r12d          # imm = 0xFFFF
jg 0x77b48
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 0x77b8c
cmpl $0x1fffff, %r12d        # imm = 0x1FFFFF
jg 0x77bbb
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 0x77ca0
movq 0x10(%r14), %r15
movslq 0xc(%r15), %rdi
addq (%r15), %rdi
movl %r12d, %edx
leaq 0x4(%rsp), %rsi
callq 0x1fbd0
addl %r12d, 0xc(%r15)
addl %r13d, 0x8(%r14)
jmp 0x779e1
xorl %r12d, %r12d
movb $0x1, %al
jmp 0x77b8e
incl %r12d
movl %r12d, 0x8(%r14)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
addb $-0x30, %cl
cmpb $0x9, %cl
ja 0x77c13
cmpl $0x0, 0x540(%rbp)
je 0x77c87
movq %r14, %rdi
callq 0x77ffe
testl %eax, %eax
je 0x77c87
movl $0xc, (%rbx)
movl %r12d, 0x4(%rbx)
leaq 0x2a7e2(%rip), %rax     # 0xa23f0
jmp 0x779ac
addq %rax, %r15
leaq 0x23775(%rip), %rsi     # 0x9b392
movl $0x4, %edx
movq %r15, %rdi
callq 0x1f340
testl %eax, %eax
je 0x77cfa
leaq 0x29e3f(%rip), %rsi     # 0xa1a78
movl $0x5, %edx
movq %r15, %rdi
callq 0x1f340
testl %eax, %eax
je 0x77d11
leaq 0x1e40a(%rip), %rsi     # 0x9605f
movl $0x4, %edx
movq %r15, %rdi
callq 0x1f340
testl %eax, %eax
je 0x77d3e
cmpl $0x0, 0x540(%rbp)
jne 0x7799b
movq %r14, %rdi
callq 0x77ffe
testl %eax, %eax
je 0x7799b
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x78089
movl $0xc, (%rbx)
movl %r15d, 0x4(%rbx)
leaq 0x2a767(%rip), %rax     # 0xa2418
jmp 0x779ac
movl $0xc, (%rbx)
movl %r15d, 0x4(%rbx)
leaq 0x2a738(%rip), %rax     # 0xa23ff
jmp 0x779ac
incl %r15d
movl %r15d, 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 0x779ac
movl $0x6, (%rbx)
movl $0x1, 0x8(%rbx)
addl $0x4, 0x8(%r14)
jmp 0x77bc9
movl $0x6, (%rbx)
movl $0x0, 0x8(%rbx)
addl $0x5, 0x8(%r14)
jmp 0x77bc9
movl $0xc, (%rbx)
movl %r15d, 0x4(%rbx)
leaq 0x2a6fb(%rip), %rax     # 0xa2434
jmp 0x779ac
movl $0x7, (%rbx)
addl $0x4, %r12d
jmp 0x77bc5