// File: /workspace/github_c_makefile_star2_O1/janet-lang[P]janet/src/core/parse.c
// Function: root
static int root(JanetParser *p, JanetParseState *state, uint8_t c) {
    switch (c) {
        default:
            if (is_whitespace(c)) return 1;
            if (!janet_is_symbol_char(c)) {
                p->error = "unexpected character";
                return 1;
            }
            pushstate(p, tokenchar, PFLAG_TOKEN);
            return 0;
        case '\'':
        case ',':
        case ';':
        case '~':
        case '|':
            pushstate(p, root, PFLAG_READERMAC | c);
            return 1;
        case '"':
            pushstate(p, stringchar, PFLAG_STRING);
            return 1;
        case '#':
            pushstate(p, comment, PFLAG_COMMENT);
            return 1;
        case '@':
            pushstate(p, atsign, PFLAG_ATSYM);
            return 1;
        case '`':
            pushstate(p, longstring, PFLAG_LONGSTRING);
            return 1;
        case ')':
        case ']':
        case '}': {
            Janet ds;
            if (p->statecount == 1) {
                delim_error(p, 0, c, "unexpected closing delimiter ");
                return 1;
            }
            if ((c == ')' && (state->flags & PFLAG_PARENS)) ||
                    (c == ']' && (state->flags & PFLAG_SQRBRACKETS))) {
                if (state->flags & PFLAG_ATSYM) {
                    ds = close_array(p, state);
                } else {
                    ds = close_tuple(p, state, c == ']' ? JANET_TUPLE_FLAG_BRACKETCTOR : 0);
                }
            } else if (c == '}' && (state->flags & PFLAG_CURLYBRACKETS)) {
                if (state->argn & 1) {
                    p->error = "struct and table literals expect even number of arguments";
                    return 1;
                }
                if (state->flags & PFLAG_ATSYM) {
                    ds = close_table(p, state);
                } else {
                    ds = close_struct(p, state);
                }
            } else {
                delim_error(p, p->statecount - 1, c, "mismatched delimiter ");
                return 1;
            }
            popstate(p, ds);
        }
        return 1;
        case '(':
            pushstate(p, root, PFLAG_CONTAINER | PFLAG_PARENS);
            return 1;
        case '[':
            pushstate(p, root, PFLAG_CONTAINER | PFLAG_SQRBRACKETS);
            return 1;
        case '{':
            pushstate(p, root, PFLAG_CONTAINER | PFLAG_CURLYBRACKETS);
            return 1;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %r14
movl $0x1, %ebx
cmpl $0x3a, %edx
jg 0x394ea
leal -0x20(%rdx), %eax
cmpl $0xc, %eax
ja 0x39516
leaq 0x2e1f3(%rip), %rcx     # 0x676c0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0xe76(%rip), %rsi       # 0x3a353
movq %r14, %rdi
movl $0x2000, %edx           # imm = 0x2000
jmp 0x39670
cmpl $0x5c, %edx
jg 0x3952f
cmpl $0x3b, %edx
je 0x39547
cmpl $0x40, %edx
je 0x3955f
cmpl $0x5b, %edx
jne 0x3960c
leaq -0x5f(%rip), %rsi       # 0x394aa
movq %r14, %rdi
movl $0x900, %edx            # imm = 0x900
jmp 0x39670
leal -0x9(%rdx), %eax
cmpl $0x5, %eax
jb 0x39675
testl %edx, %edx
je 0x39675
jmp 0x3960c
leal -0x7b(%rdx), %eax
cmpl $0x3, %eax
ja 0x39573
leaq 0x2e1b6(%rip), %rcx     # 0x676f4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movzbl %dl, %edx
orl $0x8000, %edx           # imm = 0x8000
leaq -0xad(%rip), %rsi       # 0x394aa
movq %r14, %rdi
jmp 0x39670
leaq 0xe55(%rip), %rsi       # 0x3a3bb
movq %r14, %rdi
movl $0x10000, %edx          # imm = 0x10000
jmp 0x39670
cmpl $0x5d, %edx
je 0x39595
cmpl $0x60, %edx
jne 0x3960c
leaq 0xee7(%rip), %rsi       # 0x3a46f
movq %r14, %rdi
movl $0x4000, %edx           # imm = 0x4000
jmp 0x39670
movq 0x30(%r14), %rax
cmpq $0x1, %rax
jne 0x395b0
movsbl %dl, %edx
leaq 0x2f064(%rip), %rcx     # 0x6860d
movq %r14, %rdi
xorl %esi, %esi
jmp 0x39605
cmpb $0x7d, %dl
je 0x395e5
movzbl %dl, %ecx
cmpl $0x5d, %ecx
je 0x395d6
cmpl $0x29, %ecx
jne 0x395f2
testb $0x4, 0x9(%rsi)
jne 0x39685
cmpb $0x7d, %dl
je 0x395e5
cmpl $0x5d, %ecx
jne 0x395f2
testb $0x8, 0x9(%rsi)
jne 0x39685
cmpb $0x7d, %dl
jne 0x395f2
movl 0x8(%rsi), %ecx
btl $0xc, %ecx
jb 0x396a2
decq %rax
movsbl %dl, %edx
leaq 0x2f066(%rip), %rcx     # 0x68665
movq %r14, %rdi
movq %rax, %rsi
callq 0x39199
jmp 0x39675
movzbl %dl, %eax
shrb $0x3, %dl
movzbl %dl, %ecx
andl $0x1c, %ecx
leaq 0x2ee01(%rip), %rdx     # 0x68420
movl (%rcx,%rdx), %ecx
btl %eax, %ecx
jae 0x3967c
leaq 0x5b2(%rip), %rsi       # 0x39be0
movq %r14, %rdi
movl $0x40000, %edx          # imm = 0x40000
callq 0x39412
xorl %ebx, %ebx
jmp 0x39675
leaq -0x19c(%rip), %rsi      # 0x394aa
movq %r14, %rdi
movl $0x500, %edx            # imm = 0x500
jmp 0x39670
leaq 0xd3e(%rip), %rsi       # 0x3a395
movq %r14, %rdi
movl $0x20000, %edx          # imm = 0x20000
jmp 0x39670
leaq -0x1be(%rip), %rsi      # 0x394aa
movq %r14, %rdi
movl $0x1100, %edx           # imm = 0x1100
callq 0x39412
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x2ef75(%rip), %rax     # 0x685f8
jmp 0x396c9
testb $0x1, 0xa(%rsi)
jne 0x396b8
xorl %eax, %eax
cmpb $0x5d, %dl
sete %al
shll $0x10, %eax
movq %r14, %rdi
movl %eax, %edx
callq 0x3a5c3
jmp 0x396d4
testb $0x1, 0x4(%rsi)
jne 0x396c2
movq %r14, %rdi
btl $0x10, %ecx
jb 0x396cf
callq 0x3a6a8
jmp 0x396d4
movq %r14, %rdi
callq 0x3a560
jmp 0x396d4
leaq 0x2ef62(%rip), %rax     # 0x6862b
movq %rax, 0x8(%r14)
jmp 0x39675
callq 0x3a634
movq %r14, %rdi
movq %rax, %rsi
callq 0x3a724
jmp 0x39675