// File: /workspace/github_c_makefile_star2_O1/janet-lang[P]janet/src/core/parse.c
// Function: tokenchar
static int tokenchar(JanetParser *p, JanetParseState *state, uint8_t c) {
    Janet ret;
    double numval;
    int32_t blen;
    if (janet_is_symbol_char(c)) {
        push_buf(p, (uint8_t) c);
        if (c > 127) state->argn = 1; /* Use to indicate non ascii */
        return 1;
    }
    /* Token finished */
    blen = (int32_t) p->bufcount;
    int start_dig = p->buf[0] >= '0' && p->buf[0] <= '9';
    int start_num = start_dig || p->buf[0] == '-' || p->buf[0] == '+' || p->buf[0] == '.';
    if (p->buf[0] == ':') {
        /* Don't do full utf-8 check unless we have seen non ascii characters. */
        int valid = (!state->argn) || janet_valid_utf8(p->buf + 1, blen - 1);
        if (!valid) {
            p->error = "invalid utf-8 in keyword";
            return 0;
        }
        ret = janet_keywordv(p->buf + 1, blen - 1);
#ifdef JANET_INT_TYPES
    } else if (start_num && !janet_scan_numeric(p->buf, blen, &ret)) {
        (void) numval;
#else
    } else if (start_num && !janet_scan_number(p->buf, blen, &numval)) {
        ret = janet_wrap_number(numval);
#endif
    } else if (!check_str_const("nil", p->buf, blen)) {
        ret = janet_wrap_nil();
    } else if (!check_str_const("false", p->buf, blen)) {
        ret = janet_wrap_false();
    } else if (!check_str_const("true", p->buf, blen)) {
        ret = janet_wrap_true();
    } else {
        if (start_dig) {
            p->error = "symbol literal cannot start with a digit";
            return 0;
        } else {
            /* Don't do full utf-8 check unless we have seen non ascii characters. */
            int valid = (!state->argn) || janet_valid_utf8(p->buf, blen);
            if (!valid) {
                p->error = "invalid utf-8 in symbol";
                return 0;
            }
            ret = janet_symbolv(p->buf, blen);
        }
    }
    p->bufcount = 0;
    popstate(p, ret);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %rbx
movl %edx, %eax
shrl $0x5, %eax
leaq 0x2e820(%rip), %rcx     # 0x68420
movl (%rcx,%rax,4), %eax
btl %edx, %eax
jae 0x39c32
movzbl %dl, %r14d
movq %rbx, %rdi
movl %r14d, %esi
callq 0x3ac00
movl $0x1, %eax
testb %r14b, %r14b
jns 0x39d8f
movl $0x1, 0x4(%r15)
jmp 0x39d8f
movq 0x18(%rbx), %r12
movb (%r12), %cl
leal -0x30(%rcx), %r13d
movb $0x1, %al
cmpb $0xa, %r13b
jb 0x39c5c
cmpb $0x2e, %cl
ja 0x39c5a
movabsq $0x680000000000, %rax   # imm = 0x680000000000
shrq %cl, %rax
jmp 0x39c5c
xorl %eax, %eax
movl 0x40(%rbx), %r14d
cmpb $0x3a, %cl
jne 0x39c89
cmpl $0x0, 0x4(%r15)
je 0x39d08
leaq 0x1(%r12), %rdi
leal -0x1(%r14), %esi
callq 0x38f96
testl %eax, %eax
setne %r15b
jmp 0x39d0b
testb $0x1, %al
je 0x39ca4
leaq -0x30(%rbp), %rdx
movq %r12, %rdi
movl %r14d, %esi
callq 0x46ce4
testl %eax, %eax
je 0x39d79
movq 0x18(%rbx), %r12
leaq 0x25a17(%rip), %rdi     # 0x5f6c6
movq %r12, %rsi
movl %r14d, %edx
callq 0x3adef
testl %eax, %eax
je 0x39d4b
leaq 0x2fea3(%rip), %rdi     # 0x69b6c
movq %r12, %rsi
movl %r14d, %edx
callq 0x3adef
testl %eax, %eax
je 0x39d57
leaq 0x2fe85(%rip), %rdi     # 0x69b64
movq %r12, %rsi
movl %r14d, %edx
callq 0x3adef
testl %eax, %eax
je 0x39d63
cmpb $0x9, %r13b
ja 0x39d9e
leaq 0x2ea2d(%rip), %rax     # 0x6872c
movq %rax, 0x8(%rbx)
jmp 0x39d8d
movb $0x1, %r15b
testb %r15b, %r15b
je 0x39d39
incq %r12
decl %r14d
movq %r12, %rdi
movl %r14d, %esi
callq 0x47b16
movabsq $-0x5000000000000, %rsi # imm = 0xFFFB000000000000
movq %rax, %rdi
callq 0x4f9ad
movq %rax, -0x30(%rbp)
jmp 0x39d44
leaq 0x2e9d3(%rip), %rax     # 0x68713
movq %rax, 0x8(%rbx)
testb %r15b, %r15b
jne 0x39d79
jmp 0x39d8d
movabsq $-0x77fffffffffff, %rdi # imm = 0xFFF8800000000001
jmp 0x39d70
movabsq $-0x7000000000000, %rdi # imm = 0xFFF9000000000000
jmp 0x39d70
movabsq $-0x7000000000000, %rdi # imm = 0xFFF9000000000000
incq %rdi
callq 0x4f95a
movq %rax, -0x30(%rbp)
movq $0x0, 0x40(%rbx)
movq -0x30(%rbp), %rsi
movq %rbx, %rdi
callq 0x3a724
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x0, 0x4(%r15)
je 0x39db8
movq %r12, %rdi
movl %r14d, %esi
callq 0x38f96
testl %eax, %eax
setne %r15b
jmp 0x39dbb
movb $0x1, %r15b
testb %r15b, %r15b
je 0x39dda
movq %r12, %rdi
movl %r14d, %esi
callq 0x47b16
movabsq $-0x5800000000000, %rsi # imm = 0xFFFA800000000000
jmp 0x39d2b
leaq 0x2e974(%rip), %rax     # 0x68755
jmp 0x39d40