// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movzbl (%rax), %eax
movl %eax, -0x1c(%rbp)
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movl (%rax,%rcx,4), %ecx
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
movq -0x10(%rbp), %rax
cmpl $0xb, (%rax)
je 0xc9fb6
jmp 0xc9fc8
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x8(%rax)
jmp 0xc9f8c
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
subq %rcx, %rax
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x10(%rbp), %rax
cmpl $0xc, (%rax)
jne 0xca005
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
leaq 0x81912(%rip), %rdx     # 0x14b90d
callq 0xca320
jmp 0xca1bf
movq -0x10(%rbp), %rax
cmpl $0xa, (%rax)
jne 0xca013
jmp 0xca1bf
movq -0x10(%rbp), %rax
cmpl $0xd, (%rax)
je 0xca031
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x8(%rax)
jmp 0xca1bf
cmpl $0x22, -0x1c(%rbp)
jne 0xca049
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0xca370
jmp 0xca1bf
cmpl $0x2d, -0x1c(%rbp)
je 0xca05f
movl $0x30, %eax
cmpl -0x1c(%rbp), %eax
jg 0xca0a9
cmpl $0x39, -0x1c(%rbp)
jg 0xca0a9
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
cmpl $0x0, 0x53c(%rax)
jne 0xca097
movq -0x8(%rbp), %rdi
callq 0xca510
cmpl $0x0, %eax
je 0xca097
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
leaq 0x8188e(%rip), %rdx     # 0x14b91b
callq 0xca320
jmp 0xca1bf
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0xca610
jmp 0xca1bf
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x76c41(%rip), %rsi     # 0x140cf9
movl $0x4, %edx
callq 0x26350
cmpl $0x0, %eax
jne 0xca0f1
movq -0x10(%rbp), %rax
movl $0x6, (%rax)
movq -0x10(%rbp), %rax
movl $0x1, 0x8(%rax)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rcx
addq $0x4, %rcx
movq %rcx, 0x8(%rax)
jmp 0xca1bf
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x7a5b5(%rip), %rsi     # 0x1446b5
movl $0x5, %edx
callq 0x26350
cmpl $0x0, %eax
jne 0xca139
movq -0x10(%rbp), %rax
movl $0x6, (%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x8(%rax)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rcx
addq $0x5, %rcx
movq %rcx, 0x8(%rax)
jmp 0xca1bf
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x6f60f(%rip), %rsi     # 0x139757
movl $0x4, %edx
callq 0x26350
cmpl $0x0, %eax
jne 0xca173
movq -0x10(%rbp), %rax
movl $0x7, (%rax)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rcx
addq $0x4, %rcx
movq %rcx, 0x8(%rax)
jmp 0xca1bf
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
cmpl $0x0, 0x53c(%rax)
je 0xca1a1
movq -0x8(%rbp), %rdi
callq 0xca510
cmpl $0x0, %eax
je 0xca1a1
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0xca610
jmp 0xca1bf
jmp 0xca1a3
jmp 0xca1a5
jmp 0xca1a7
jmp 0xca1a9
jmp 0xca1ab
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
leaq 0x81753(%rip), %rdx     # 0x14b90d
callq 0xca320
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)