// File: /workspace/github_c_makefile_star2_O3/janet-lang[P]janet/src/core/run.c
// Function: janet_dobytes
int janet_dobytes(JanetTable *env, const uint8_t *bytes, int32_t len, const char *sourcePath, Janet *out) {
    JanetParser *parser;
    int errflags = 0, done = 0;
    int32_t index = 0;
    Janet ret = janet_wrap_nil();
    JanetFiber *fiber = NULL;
    const uint8_t *where = sourcePath ? janet_cstring(sourcePath) : NULL;

    if (where) janet_gcroot(janet_wrap_string(where));
    if (NULL == sourcePath) sourcePath = "<unknown>";
    parser = janet_abstract(&janet_parser_type, sizeof(JanetParser));
    janet_parser_init(parser);
    janet_gcroot(janet_wrap_abstract(parser));

    /* While we haven't seen an error */
    while (!done) {

        /* Evaluate parsed values */
        while (janet_parser_has_more(parser)) {
            Janet form = janet_parser_produce(parser);
            JanetCompileResult cres = janet_compile(form, env, where);
            if (cres.status == JANET_COMPILE_OK) {
                JanetFunction *f = janet_thunk(cres.funcdef);
                fiber = janet_fiber(f, 64, 0, NULL);
                fiber->env = env;
                JanetSignal status = janet_continue(fiber, janet_wrap_nil(), &ret);
                if (status != JANET_SIGNAL_OK && status != JANET_SIGNAL_EVENT) {
                    janet_stacktrace_ext(fiber, ret, "");
                    errflags |= 0x01;
                    done = 1;
                }
            } else {
                ret = janet_wrap_string(cres.error);
                int32_t line = (int32_t) parser->line;
                int32_t col = (int32_t) parser->column;
                if ((cres.error_mapping.line > 0) &&
                        (cres.error_mapping.column > 0)) {
                    line = cres.error_mapping.line;
                    col = cres.error_mapping.column;
                }
                if (cres.macrofiber) {
                    janet_eprintf("%s:%d:%d: compile error", sourcePath,
                                  line, col);
                    janet_stacktrace_ext(cres.macrofiber, ret, "");
                } else {
                    janet_eprintf("%s:%d:%d: compile error: %s\n", sourcePath,
                                  line, col, (const char *)cres.error);
                }
                errflags |= 0x02;
                done = 1;
            }
        }

        if (done) break;

        /* Dispatch based on parse state */
        switch (janet_parser_status(parser)) {
            case JANET_PARSE_DEAD:
                done = 1;
                break;
            case JANET_PARSE_ERROR: {
                const char *e = janet_parser_error(parser);
                errflags |= 0x04;
                ret = janet_cstringv(e);
                int32_t line = (int32_t) parser->line;
                int32_t col = (int32_t) parser->column;
                janet_eprintf("%s:%d:%d: parse error: %s\n", sourcePath, line, col, e);
                done = 1;
                break;
            }
            case JANET_PARSE_ROOT:
            case JANET_PARSE_PENDING:
                if (index >= len) {
                    janet_parser_eof(parser);
                } else {
                    janet_parser_consume(parser, bytes[index++]);
                }
                break;
        }

    }

    /* Clean up and return errors */
    janet_gcunroot(janet_wrap_abstract(parser));
    if (where) janet_gcunroot(janet_wrap_string(where));
#ifdef JANET_EV
    /* Enter the event loop if we are not already in it */
    if (janet_vm.stackn == 0) {
        if (fiber) {
            janet_gcroot(janet_wrap_fiber(fiber));
        }
        janet_loop();
        if (fiber) {
            janet_gcunroot(janet_wrap_fiber(fiber));
            ret = fiber->last_value;
        }
    }
#endif
    if (out) *out = ret;
    return errflags;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %r8, %rbx
movq %rcx, %r15
movl %edx, -0x4c(%rbp)
movq %rsi, -0x58(%rbp)
movq %rdi, %r14
movabsq $-0x77fffffffffff, %rdi # imm = 0xFFF8800000000001
callq 0x4ece6
movq %rax, -0x30(%rbp)
testq %r15, %r15
movq %rbx, -0x60(%rbp)
je 0x40c29
movq %r15, %rdi
callq 0x4482c
testq %rax, %rax
movq %r15, -0x40(%rbp)
je 0x40c3b
movq %rax, -0x48(%rbp)
movq %rax, %rdi
movabsq $-0x6000000000000, %rsi # imm = 0xFFFA000000000000
callq 0x4ed39
movq %rax, %rdi
callq 0x2b13a
movl $0x0, -0x34(%rbp)
jmp 0x40c48
movb $0x1, %al
movl %eax, -0x34(%rbp)
leaq 0x26ab4(%rip), %rax     # 0x676e9
movq %rax, -0x40(%rbp)
jmp 0x40c40
movb $0x1, %al
movl %eax, -0x34(%rbp)
movq $0x0, -0x48(%rbp)
movabsq $-0x1000000000000, %rbx # imm = 0xFFFF000000000000
leaq 0x42647(%rip), %rdi     # 0x832a0
movl $0x70, %esi
callq 0x144c2
movq %rax, %r13
movq %rax, %rdi
callq 0x38eb4
movq %r13, %rdi
movq %rbx, %rsi
callq 0x4ed7e
movq %rax, %rdi
callq 0x2b13a
xorl %r12d, %r12d
movl $0x0, -0x38(%rbp)
xorl %ebx, %ebx
movq %r13, %rdi
callq 0x39306
testl %eax, %eax
je 0x40dea
xorl %r15d, %r15d
movq %r13, %rdi
callq 0x38de3
leaq -0x88(%rbp), %rdi
movq %rax, %rsi
movq %r14, %rdx
movq -0x48(%rbp), %rcx
callq 0x1e069
cmpl $0x0, -0x68(%rbp)
je 0x40d42
movq -0x80(%rbp), %rdi
movabsq $-0x6000000000000, %rsi # imm = 0xFFFA000000000000
callq 0x4ed39
movq %rax, -0x30(%rbp)
movl -0x70(%rbp), %r8d
movl -0x6c(%rbp), %r9d
testl %r8d, %r8d
setg %al
testl %r9d, %r9d
setg %cl
testb %cl, %al
jne 0x40cfb
movl 0x58(%r13), %r9d
movl 0x50(%r13), %r8d
cmpq $0x0, -0x78(%rbp)
movq 0x442e9(%rip), %rax     # 0x84ff0
movq (%rax), %rsi
je 0x40da6
leaq 0x19d07(%rip), %rdi     # 0x5aa1e
leaq 0x27a6e(%rip), %rdx     # 0x6878c
movq -0x40(%rbp), %rcx
xorl %eax, %eax
callq 0x2ed91
movq -0x78(%rbp), %rdi
movq -0x30(%rbp), %rsi
leaq 0x2b3a5(%rip), %rdx     # 0x6c0dd
callq 0x20821
jmp 0x40dc7
movq -0x88(%rbp), %rdi
callq 0x18f95
movq %rax, %rdi
movl $0x40, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x295e4
movq %rax, %rbx
movq %r14, 0x28(%rax)
movabsq $-0x77fffffffffff, %rdi # imm = 0xFFF8800000000001
callq 0x4ece6
movq %rbx, %rdi
movq %rax, %rsi
leaq -0x30(%rbp), %rdx
callq 0x4b6c1
testl %eax, %eax
je 0x40dd1
cmpl $0xd, %eax
je 0x40dd1
movq -0x30(%rbp), %rsi
movq %rbx, %rdi
leaq 0x2b342(%rip), %rdx     # 0x6c0dd
callq 0x20821
orl $0x1, %r12d
jmp 0x40dcb
movq -0x80(%rbp), %rax
movq %rax, (%rsp)
leaq 0x19c69(%rip), %rdi     # 0x5aa1e
leaq 0x279e8(%rip), %rdx     # 0x687a4
movq -0x40(%rbp), %rcx
xorl %eax, %eax
callq 0x2ed91
orl $0x2, %r12d
movl $0x1, %r15d
movq %r13, %rdi
callq 0x39306
testl %eax, %eax
jne 0x40ca0
testl %r15d, %r15d
jne 0x40e9d
movq %r13, %rdi
callq 0x38d71
cmpl $0x3, %eax
ja 0x40c8d
movl %eax, %eax
leaq 0x27978(%rip), %rcx     # 0x6877c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl -0x38(%rbp), %eax
cmpl -0x4c(%rbp), %eax
jl 0x40e22
movq %r13, %rdi
callq 0x38c18
jmp 0x40c8d
movl -0x38(%rbp), %ecx
movl %ecx, %eax
incl %ecx
movl %ecx, -0x38(%rbp)
movq -0x58(%rbp), %rcx
movzbl (%rcx,%rax), %esi
movq %r13, %rdi
callq 0x38b74
jmp 0x40c8d
movq %r13, %rdi
callq 0x38db6
movq %rax, %r14
orl $0x4, %r12d
movq %rax, %rdi
callq 0x4482c
movq %rax, %rdi
movabsq $-0x6000000000000, %rsi # imm = 0xFFFA000000000000
callq 0x4ed39
movq %rax, -0x30(%rbp)
movl 0x50(%r13), %r8d
movl 0x58(%r13), %r9d
movq 0x44173(%rip), %rax     # 0x84ff0
movq (%rax), %rsi
movq %r14, (%rsp)
leaq 0x19b93(%rip), %rdi     # 0x5aa1e
leaq 0x2792f(%rip), %rdx     # 0x687c1
movq -0x40(%rbp), %rcx
xorl %eax, %eax
callq 0x2ed91
movq %r13, %rdi
movabsq $-0x1000000000000, %rsi # imm = 0xFFFF000000000000
callq 0x4ed7e
movq %rax, %rdi
callq 0x2b88a
cmpb $0x0, -0x34(%rbp)
jne 0x40ed8
movq -0x48(%rbp), %rdi
movabsq $-0x6000000000000, %rsi # imm = 0xFFFA000000000000
callq 0x4ed39
movq %rax, %rdi
callq 0x2b88a
movq %fs:0x0, %rax
leaq -0x348(%rax), %rax
cmpl $0x0, 0x18(%rax)
jne 0x40f37
testq %rbx, %rbx
je 0x40f32
movabsq $-0x6800000000000, %r14 # imm = 0xFFF9800000000000
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4ed7e
movq %rax, %rdi
callq 0x2b13a
callq 0x24ef2
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4ed7e
movq %rax, %rdi
callq 0x2b88a
movq 0x40(%rbx), %rax
movq %rax, -0x30(%rbp)
jmp 0x40f37
callq 0x24ef2
movq -0x60(%rbp), %rcx
testq %rcx, %rcx
je 0x40f47
movq -0x30(%rbp), %rax
movq %rax, (%rcx)
movl %r12d, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq