// File: /workspace/github_c_makefile_star2_O2/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 %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %r14
pushq $0x1
popq %rbx
leal -0x20(%rdx), %eax
cmpl $0xc, %eax
jbe 0x35fc4
leal -0x9(%rdx), %eax
cmpl $0x5, %eax
jb 0x3600d
leal -0x7b(%rdx), %eax
cmpl $0x3, %eax
jbe 0x35fe5
testl %edx, %edx
je 0x3600d
cmpl $0x3b, %edx
je 0x35ff5
cmpl $0x40, %edx
je 0x360cb
cmpl $0x5b, %edx
je 0x360f3
cmpl $0x5d, %edx
je 0x3601e
cmpl $0x60, %edx
jne 0x3606d
leaq 0xfc2(%rip), %rsi       # 0x36f7c
movq %r14, %rdi
movl $0x4000, %edx           # imm = 0x4000
jmp 0x36008
leaq 0x2c6f5(%rip), %rcx     # 0x626c0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0xe9c(%rip), %rsi       # 0x36e77
movq %r14, %rdi
movl $0x2000, %edx           # imm = 0x2000
jmp 0x36008
leaq 0x2c708(%rip), %rcx     # 0x626f4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movzbl %dl, %edx
orl $0x8000, %edx           # imm = 0x8000
leaq -0xae(%rip), %rsi       # 0x35f57
movq %r14, %rdi
callq 0x35ea3
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x30(%r14), %rsi
cmpq $0x1, %rsi
jne 0x3603c
movsbl %dl, %edx
leaq 0x2d5db(%rip), %rcx     # 0x6360d
movq %r14, %rdi
xorl %esi, %esi
jmp 0x36186
cmpb $0x7d, %dl
je 0x36168
movzbl %dl, %eax
cmpl $0x5d, %eax
je 0x36117
cmpl $0x29, %eax
jne 0x36176
movl 0x8(%r15), %eax
btl $0xa, %eax
jb 0x36121
jmp 0x36176
movzbl %dl, %eax
shrb $0x3, %dl
movzbl %dl, %ecx
andl $0x1c, %ecx
leaq 0x2d3a0(%rip), %rdx     # 0x63420
movl (%rcx,%rdx), %ecx
btl %eax, %ecx
jae 0x36107
leaq 0x710(%rip), %rsi       # 0x3679f
movq %r14, %rdi
movl $0x40000, %edx          # imm = 0x40000
callq 0x35ea3
xorl %ebx, %ebx
jmp 0x3600d
leaq 0xe06(%rip), %rsi       # 0x36eb0
movq %r14, %rdi
movl $0x20000, %edx          # imm = 0x20000
jmp 0x36008
leaq -0x167(%rip), %rsi      # 0x35f57
movq %r14, %rdi
movl $0x500, %edx            # imm = 0x500
jmp 0x36008
leaq 0xdff(%rip), %rsi       # 0x36ed1
movq %r14, %rdi
movl $0x10000, %edx          # imm = 0x10000
jmp 0x36008
leaq -0x18f(%rip), %rsi      # 0x35f57
movq %r14, %rdi
movl $0x1100, %edx           # imm = 0x1100
jmp 0x36008
leaq -0x1a3(%rip), %rsi      # 0x35f57
movq %r14, %rdi
movl $0x900, %edx            # imm = 0x900
jmp 0x36008
leaq 0x2d4ea(%rip), %rax     # 0x635f8
movq %rax, 0x8(%r14)
jmp 0x3600d
movl 0x8(%r15), %eax
btl $0xb, %eax
jae 0x36176
btl $0x10, %eax
jb 0x36190
xorl %r12d, %r12d
cmpb $0x5d, %dl
sete %r12b
shll $0x10, %r12d
movl 0x4(%r15), %edi
callq 0x44648
orl %r12d, -0x20(%rax)
movl 0x4(%r15), %ecx
testl %ecx, %ecx
jle 0x361c3
movq (%r14), %rdx
movq 0x20(%r14), %rsi
leaq -0x1(%rsi), %rdi
movq %rdi, 0x20(%r14)
movq -0x8(%rdx,%rsi,8), %rdx
movq %rdx, -0x8(%rax,%rcx,8)
decq %rcx
jmp 0x36146
movl 0x8(%r15), %eax
btl $0xc, %eax
jb 0x36208
decq %rsi
movsbl %dl, %edx
leaq 0x2d4e2(%rip), %rcx     # 0x63665
movq %r14, %rdi
callq 0x35c2b
jmp 0x3600d
movl 0x4(%r15), %edi
callq 0x12f68
movl 0x4(%r15), %ecx
testl %ecx, %ecx
jle 0x361df
movq 0x18(%rax), %rdx
movq (%r14), %rsi
movq 0x20(%r14), %rdi
leaq -0x1(%rdi), %r8
movq %r8, 0x20(%r14)
movq -0x8(%rsi,%rdi,8), %rsi
movq %rsi, -0x8(%rdx,%rcx,8)
decq %rcx
jmp 0x3619d
movq %rax, %rdi
callq 0x44674
movabsq $-0x4000000000000, %rsi # imm = 0xFFFC000000000000
movq %rax, %rdi
callq 0x4b366
jmp 0x361f8
movl 0x4(%r15), %ecx
movl %ecx, 0x10(%rax)
movabsq $-0x4800000000000, %rsi # imm = 0xFFFB800000000000
movq %rax, %rdi
callq 0x4b3ab
movq %r14, %rdi
movq %rax, %rsi
callq 0x37070
jmp 0x3600d
movl 0x4(%r15), %edi
testb $0x1, %dil
jne 0x36253
sarl %edi
btl $0x10, %eax
jb 0x3625f
callq 0x42cb8
movq %rax, %r12
movq 0x20(%r14), %rax
movslq 0x4(%r15), %rcx
movq %rax, %r13
subq %rcx, %r13
cmpq %rax, %r13
jae 0x36298
movq (%r14), %rax
movq (%rax,%r13,8), %rsi
movq 0x8(%rax,%r13,8), %rdx
movq %r12, %rdi
callq 0x4300f
addq $0x2, %r13
movq 0x20(%r14), %rax
jmp 0x36230
leaq 0x2d3d1(%rip), %rax     # 0x6362b
jmp 0x3610e
callq 0x43b8a
movq %rax, %r12
movq 0x20(%r14), %rax
movslq 0x4(%r15), %rcx
movq %rax, %r13
subq %rcx, %r13
cmpq %rax, %r13
jae 0x362ba
movq (%r14), %rax
movq (%rax,%r13,8), %rsi
movq 0x8(%rax,%r13,8), %rdx
movq %r12, %rdi
callq 0x43e19
addq $0x2, %r13
movq 0x20(%r14), %rax
jmp 0x36275
movslq 0x4(%r15), %rcx
subq %rcx, %rax
movq %rax, 0x20(%r14)
movq %r12, %rdi
callq 0x4301e
movabsq $-0x3000000000000, %rsi # imm = 0xFFFD000000000000
jmp 0x361d5
movslq 0x4(%r15), %rcx
subq %rcx, %rax
movq %rax, 0x20(%r14)
movabsq $-0x3800000000000, %rsi # imm = 0xFFFC800000000000
movq %r12, %rdi
jmp 0x361f3