// File: /workspace/github_c_makefile_star2_O3/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 0x18(%rdi), %r15
movq (%rdi), %r12
movl 0x8(%rdi), %ebp
movslq %ebp, %rcx
movzbl (%r12,%rcx), %eax
movl (%r15,%rax,4), %eax
movl %eax, (%rsi)
cmpl $0xb, %eax
jne 0x77a8e
addq %r12, %rcx
incq %rcx
incl %ebp
movl %ebp, 0x8(%r14)
movzbl (%rcx), %eax
movl (%r15,%rax,4), %eax
movl %eax, (%rbx)
incq %rcx
cmpl $0xb, %eax
je 0x77a77
movl %ebp, 0x4(%rbx)
cmpl $0xa, %eax
je 0x77cd6
cmpl $0xd, %eax
je 0x77ac1
cmpl $0xc, %eax
jne 0x77cd0
movl $0xc, (%rbx)
movl %ebp, 0x4(%rbx)
leaq 0x2a9da(%rip), %rax     # 0xa2492
movq %rax, 0x8(%rbx)
jmp 0x77cd6
movslq %ebp, %r13
movzbl (%r12,%r13), %eax
cmpl $0x2d, %eax
je 0x77ceb
cmpl $0x22, %eax
jne 0x77ce5
incl %ebp
movl %ebp, 0x8(%r14)
movq 0x10(%r14), %rax
movl $0x0, 0xc(%rax)
movslq %ebp, %rcx
movzbl (%r12,%rcx), %eax
cmpl $0x5c, %eax
je 0x77b0b
cmpl $0x22, %eax
je 0x77db0
testl %eax, %eax
jne 0x77b2e
jmp 0x77ddd
movzbl 0x1(%r12,%rcx), %eax
movzbl 0x400(%r15,%rax), %eax
cmpl $0x75, %eax
je 0x77b4e
testl %eax, %eax
je 0x77e09
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)
movl 0x8(%r14), %r13d
incl %r13d
jmp 0x77c9a
addq %rcx, %r12
leaq 0x2(%r12), %rdi
callq 0x781ec
testl %eax, %eax
js 0x77cbb
movl %eax, %ecx
andl $0xf800, %eax           # imm = 0xF800
cmpl $0xd800, %eax           # imm = 0xD800
jne 0x77c0f
btl $0xa, %ecx
jb 0x77cbb
cmpb $0x5c, 0x6(%r12)
jne 0x77cbb
cmpb $0x75, 0x7(%r12)
jne 0x77cbb
addq $0x8, %r12
movq %r12, %rdi
movq %rcx, %r12
callq 0x781ec
movl %eax, %ecx
andl $0x8000fc00, %ecx       # imm = 0x8000FC00
cmpl $0xdc00, %ecx           # imm = 0xDC00
jne 0x77cbb
movq %r12, %rcx
shll $0xa, %ecx
andl $0xffc00, %ecx          # imm = 0xFFC00
andl $0x3ff, %eax            # imm = 0x3FF
addl %eax, %ecx
addl $0x10000, %ecx          # imm = 0x10000
movl $0xc, %r13d
movl %ecx, %eax
shrl $0x12, %eax
orb $-0x10, %al
movb %al, 0x4(%rsp)
movl %ecx, %eax
shrl $0xc, %eax
andb $0x3f, %al
orb $-0x80, %al
movb %al, 0x5(%rsp)
movl %ecx, %eax
shrl $0x6, %eax
andb $0x3f, %al
orb $-0x80, %al
movb %al, 0x6(%rsp)
andb $0x3f, %cl
orb $-0x80, %cl
movb %cl, 0x7(%rsp)
movl $0x4, %ebp
jmp 0x77c78
cmpl $0x7f, %ecx
ja 0x77c1f
movb %cl, 0x4(%rsp)
movl $0x1, %ebp
jmp 0x77c72
cmpl $0x7ff, %ecx            # imm = 0x7FF
ja 0x77c43
movl %ecx, %eax
shrl $0x6, %eax
orb $-0x40, %al
movb %al, 0x4(%rsp)
andb $0x3f, %cl
orb $-0x80, %cl
movb %cl, 0x5(%rsp)
movl $0x2, %ebp
jmp 0x77c72
cmpl $0xffff, %ecx           # imm = 0xFFFF
ja 0x77ca9
movl %ecx, %eax
shrl $0xc, %eax
orb $-0x20, %al
movb %al, 0x4(%rsp)
movl %ecx, %eax
shrl $0x6, %eax
andb $0x3f, %al
orb $-0x80, %al
movb %al, 0x5(%rsp)
andb $0x3f, %cl
orb $-0x80, %cl
movb %cl, 0x6(%rsp)
movl $0x3, %ebp
movl $0x6, %r13d
movq 0x10(%r14), %r12
movslq 0xc(%r12), %rdi
addq (%r12), %rdi
movl %ebp, %edx
leaq 0x4(%rsp), %rsi
callq 0x1fbd0
addl %ebp, 0xc(%r12)
addl 0x8(%r14), %r13d
movl %r13d, 0x8(%r14)
movq (%r14), %r12
movl %r13d, %ebp
jmp 0x77aec
movl $0x6, %r13d
cmpl $0x1fffff, %ecx         # imm = 0x1FFFFF
jbe 0x77bd9
movl $0xc, (%rbx)
movl %ebp, 0x4(%rbx)
leaq 0x2a7fd(%rip), %rax     # 0xa24c8
jmp 0x77ab8
incl %ebp
movl %ebp, 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 0x77d20
cmpl $0x0, 0x540(%r15)
je 0x77d97
movq %r12, %rdi
movl %ebp, %esi
callq 0x780fc
testl %eax, %eax
je 0x77d97
movl $0xc, (%rbx)
movl %ebp, 0x4(%rbx)
leaq 0x2a785(%rip), %rax     # 0xa24a0
jmp 0x77ab8
addq %r12, %r13
leaq 0x236a8(%rip), %rsi     # 0x9b3d2
movl $0x4, %edx
movq %r13, %rdi
callq 0x1f340
testl %eax, %eax
je 0x77df2
leaq 0x29dc2(%rip), %rsi     # 0xa1b08
movl $0x5, %edx
movq %r13, %rdi
callq 0x1f340
testl %eax, %eax
je 0x77e1e
leaq 0x1e34d(%rip), %rsi     # 0x960af
movl $0x4, %edx
movq %r13, %rdi
callq 0x1f340
testl %eax, %eax
je 0x77e35
cmpl $0x0, 0x540(%r15)
jne 0x77aa8
movq %r12, %rdi
movl %ebp, %esi
callq 0x780fc
testl %eax, %eax
je 0x77aa8
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x78187
incl %ebp
movl %ebp, 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 0x77ab8
movl $0xc, (%rbx)
movl %ebp, 0x4(%rbx)
leaq 0x2a6c2(%rip), %rax     # 0xa24af
jmp 0x77ab8
movl $0x6, (%rbx)
movl $0x1, 0x8(%rbx)
addl $0x4, 0x8(%r14)
jmp 0x77cd6
movl $0xc, (%rbx)
movl %ebp, 0x4(%rbx)
leaq 0x2a6cb(%rip), %rax     # 0xa24e4
jmp 0x77ab8
movl $0x6, (%rbx)
movl $0x0, 0x8(%rbx)
addl $0x5, 0x8(%r14)
jmp 0x77cd6
movl $0x7, (%rbx)
addl $0x4, %ebp
jmp 0x77cd2