// File: /workspace/github_c_makefile_star2_O3/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 0x38fc9
leal -0x20(%rdx), %eax
cmpl $0xc, %eax
ja 0x38ff5
leaq 0x2d704(%rip), %rcx     # 0x666b0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0xeac(%rip), %rsi       # 0x39e68
movq %r14, %rdi
movl $0x2000, %edx           # imm = 0x2000
jmp 0x39122
cmpl $0x5c, %edx
jg 0x3900e
cmpl $0x3b, %edx
je 0x39026
cmpl $0x40, %edx
je 0x3903e
cmpl $0x5b, %edx
jne 0x390be
leaq -0x5f(%rip), %rsi       # 0x38f89
movq %r14, %rdi
movl $0x900, %edx            # imm = 0x900
jmp 0x39122
leal -0x9(%rdx), %eax
cmpl $0x5, %eax
jb 0x39127
testl %edx, %edx
je 0x39127
jmp 0x390be
leal -0x7b(%rdx), %eax
cmpl $0x3, %eax
ja 0x39052
leaq 0x2d6c7(%rip), %rcx     # 0x666e4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movzbl %dl, %edx
orl $0x8000, %edx           # imm = 0x8000
leaq -0xad(%rip), %rsi       # 0x38f89
movq %r14, %rdi
jmp 0x39122
leaq 0xe8b(%rip), %rsi       # 0x39ed0
movq %r14, %rdi
movl $0x10000, %edx          # imm = 0x10000
jmp 0x39122
cmpl $0x5d, %edx
je 0x39070
cmpl $0x60, %edx
jne 0x390be
leaq 0xf21(%rip), %rsi       # 0x39f84
movq %r14, %rdi
movl $0x4000, %edx           # imm = 0x4000
jmp 0x39122
movq 0x30(%r14), %rax
cmpq $0x1, %rax
jne 0x3908e
movsbl %dl, %edx
leaq 0x2e569(%rip), %rcx     # 0x675ed
movq %r14, %rdi
xorl %esi, %esi
jmp 0x3917d
cmpb $0x7d, %dl
je 0x39161
movzbl %dl, %ecx
cmpl $0x5d, %ecx
je 0x3913b
cmpl $0x29, %ecx
jne 0x3916a
movl 0x8(%rsi), %ecx
btl $0xa, %ecx
jb 0x39144
jmp 0x3916a
movzbl %dl, %eax
shrb $0x3, %dl
movzbl %dl, %ecx
andl $0x1c, %ecx
leaq 0x2e32f(%rip), %rdx     # 0x67400
movl (%rcx,%rdx), %ecx
btl %eax, %ecx
jae 0x3912e
leaq 0x5d1(%rip), %rsi       # 0x396b1
movq %r14, %rdi
movl $0x40000, %edx          # imm = 0x40000
callq 0x38ef2
xorl %ebx, %ebx
jmp 0x39127
leaq -0x16f(%rip), %rsi      # 0x38f89
movq %r14, %rdi
movl $0x500, %edx            # imm = 0x500
jmp 0x39122
leaq 0xda1(%rip), %rsi       # 0x39eaa
movq %r14, %rdi
movl $0x20000, %edx          # imm = 0x20000
jmp 0x39122
leaq -0x191(%rip), %rsi      # 0x38f89
movq %r14, %rdi
movl $0x1100, %edx           # imm = 0x1100
callq 0x38ef2
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x2e4a3(%rip), %rax     # 0x675d8
movq %rax, 0x8(%r14)
jmp 0x39127
movl 0x8(%rsi), %ecx
btl $0xb, %ecx
jae 0x3916a
btl $0x10, %ecx
jb 0x39184
xorl %eax, %eax
cmpb $0x5d, %dl
sete %al
shll $0x10, %eax
movq %r14, %rdi
movl %eax, %edx
callq 0x3a0d7
jmp 0x3918c
movl 0x8(%rsi), %ecx
btl $0xc, %ecx
jb 0x39199
decq %rax
movsbl %dl, %edx
leaq 0x2e4ce(%rip), %rcx     # 0x67645
movq %r14, %rdi
movq %rax, %rsi
callq 0x38c74
jmp 0x39127
movq %r14, %rdi
callq 0x3a074
movq %r14, %rdi
movq %rax, %rsi
callq 0x3a244
jmp 0x39127
testb $0x1, 0x4(%rsi)
jne 0x391af
movq %r14, %rdi
btl $0x10, %ecx
jb 0x391bb
callq 0x3a1c2
jmp 0x3918c
leaq 0x2e455(%rip), %rax     # 0x6760b
jmp 0x39135
callq 0x3a148
jmp 0x3918c