// File: /workspace/github_c_makefile_star2_O0/janet-lang[P]janet/src/core/debug.c
// Function: janet_stacktrace_ext
void janet_stacktrace_ext(JanetFiber *fiber, Janet err, const char *prefix) {

    int32_t fi;
    const char *errstr = (const char *)janet_to_string(err);
    JanetFiber **fibers = NULL;
    int wrote_error = !prefix;

    int print_color = janet_truthy(janet_dyn("err-color"));
    if (print_color) janet_eprintf("\x1b[31m");

    while (fiber) {
        janet_v_push(fibers, fiber);
        fiber = fiber->child;
    }

    for (fi = janet_v_count(fibers) - 1; fi >= 0; fi--) {
        fiber = fibers[fi];
        int32_t i = fiber->frame;
        while (i > 0) {
            JanetCFunRegistry *reg = NULL;
            JanetStackFrame *frame = (JanetStackFrame *)(fiber->data + i - JANET_FRAME_SIZE);
            JanetFuncDef *def = NULL;
            i = frame->prevframe;

            /* Print prelude to stack frame */
            if (!wrote_error) {
                JanetFiberStatus status = janet_fiber_status(fiber);
                janet_eprintf("%s%s: %s\n",
                              prefix ? prefix : "",
                              janet_status_names[status],
                              errstr ? errstr : janet_status_names[status]);
                wrote_error = 1;
            }

            janet_eprintf("  in");

            if (frame->func) {
                def = frame->func->def;
                janet_eprintf(" %s", def->name ? (const char *)def->name : "<anonymous>");
                if (def->source) {
                    janet_eprintf(" [%s]", (const char *)def->source);
                }
            } else {
                JanetCFunction cfun = (JanetCFunction)(frame->pc);
                if (cfun) {
                    reg = janet_registry_get(cfun);
                    if (NULL != reg && NULL != reg->name) {
                        if (reg->name_prefix) {
                            janet_eprintf(" %s/%s", reg->name_prefix, reg->name);
                        } else {
                            janet_eprintf(" %s", reg->name);
                        }
                        if (NULL != reg->source_file) {
                            janet_eprintf(" [%s]", reg->source_file);
                        }
                    } else {
                        janet_eprintf(" <cfunction>");
                    }
                }
            }
            if (frame->flags & JANET_STACKFRAME_TAILCALL)
                janet_eprintf(" (tail call)");
            if (frame->func && frame->pc) {
                int32_t off = (int32_t)(frame->pc - def->bytecode);
                if (def->sourcemap) {
                    JanetSourceMapping mapping = def->sourcemap[off];
                    janet_eprintf(" on line %d, column %d", mapping.line, mapping.column);
                } else {
                    janet_eprintf(" pc=%d", off);
                }
            } else if (NULL != reg) {
                /* C Function */
                if (reg->source_line > 0) {
                    janet_eprintf(" on line %d", (long) reg->source_line);
                }
            }
            janet_eprintf("\n");
            /* Print fiber points optionally. Clutters traces but provides info
            if (i <= 0 && fi > 0) {
                janet_eprintf("  in parent fiber\n");
            }
            */
        }
    }

    if (print_color) janet_eprintf("\x1b[0m");

    janet_v_free(fibers);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
movq %rsi, -0x8(%rbp)
movq %rdi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
callq 0x5abf0
movq %rax, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
cmpq $0x0, -0x18(%rbp)
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x34(%rbp)
xorl %eax, %eax
testb $0x1, %al
jne 0x27d46
jmp 0x27da4
leaq 0x5d659(%rip), %rdi     # 0x853a6
callq 0x1ce50
movq %rax, -0x40(%rbp)
movsd -0x40(%rbp), %xmm0
ucomisd %xmm0, %xmm0
setp %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0xad(%rbp)
jne 0x27d74
jmp 0x27e99
leaq 0x5d62b(%rip), %rdi     # 0x853a6
callq 0x1ce50
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rcx
shrq $0x2f, %rcx
andq $0xf, %rcx
xorl %eax, %eax
cmpq $0x0, %rcx
movb %al, -0xad(%rbp)
je 0x27e99
jmp 0x27ddd
leaq 0x5d5fb(%rip), %rdi     # 0x853a6
callq 0x1ce50
movq %rax, -0x50(%rbp)
movabsq $-0x800000000000, %rcx  # imm = 0xFFFF800000000000
andq -0x50(%rbp), %rcx
xorl %eax, %eax
movabsq $-0x7800000000000, %rdx # imm = 0xFFF8800000000000
cmpq %rdx, %rcx
movb %al, -0xad(%rbp)
je 0x27e99
xorl %eax, %eax
testb $0x1, %al
jne 0x27de5
jmp 0x27e33
leaq 0x5d5ba(%rip), %rdi     # 0x853a6
callq 0x1ce50
movq %rax, -0x58(%rbp)
movsd -0x58(%rbp), %xmm0
ucomisd %xmm0, %xmm0
setp %al
testb $0x1, %al
jne 0x27e07
jmp 0x27e68
leaq 0x5d598(%rip), %rdi     # 0x853a6
callq 0x1ce50
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rcx
shrq $0x2f, %rcx
andq $0xf, %rcx
movb $0x1, %al
cmpq $0x0, %rcx
movb %al, -0xae(%rbp)
je 0x27e68
jmp 0x27e8d
leaq 0x5d56c(%rip), %rdi     # 0x853a6
callq 0x1ce50
movq %rax, -0x68(%rbp)
movabsq $-0x800000000000, %rcx  # imm = 0xFFFF800000000000
andq -0x68(%rbp), %rcx
movb $0x1, %al
movabsq $-0x7000000000000, %rdx # imm = 0xFFF9000000000000
cmpq %rdx, %rcx
movb %al, -0xae(%rbp)
jne 0x27e8d
leaq 0x5d537(%rip), %rdi     # 0x853a6
callq 0x1ce50
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
andq $0x1, %rax
cmpq $0x0, %rax
setne %al
movb %al, -0xae(%rbp)
movb -0xae(%rbp), %al
movb %al, -0xad(%rbp)
movb -0xad(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x38(%rbp)
cmpl $0x0, -0x38(%rbp)
je 0x27ecc
movq 0x8813c(%rip), %rax     # 0xafff0
movq (%rax), %rsi
leaq 0x5fb70(%rip), %rdi     # 0x87a2e
leaq 0x5d4eb(%rip), %rdx     # 0x853b0
movb $0x0, %al
callq 0x3fa20
jmp 0x27ece
cmpq $0x0, -0x10(%rbp)
je 0x27f36
cmpq $0x0, -0x30(%rbp)
je 0x27eef
movq -0x30(%rbp), %rax
movl -0x4(%rax), %eax
addl $0x1, %eax
movq -0x30(%rbp), %rcx
cmpl -0x8(%rcx), %eax
jl 0x27f08
movq -0x30(%rbp), %rdi
movl $0x1, %esi
movl $0x8, %edx
callq 0x70760
movq %rax, -0x30(%rbp)
jmp 0x27f0a
jmp 0x27f0a
movq -0x10(%rbp), %rdx
movq -0x30(%rbp), %rax
movq -0x30(%rbp), %rsi
movl -0x4(%rsi), %ecx
movl %ecx, %edi
addl $0x1, %edi
movl %edi, -0x4(%rsi)
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x10(%rbp)
jmp 0x27ece
cmpq $0x0, -0x30(%rbp)
je 0x27f4c
movq -0x30(%rbp), %rax
movl -0x4(%rax), %eax
movl %eax, -0xb4(%rbp)
jmp 0x27f56
xorl %eax, %eax
movl %eax, -0xb4(%rbp)
jmp 0x27f56
movl -0xb4(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jl 0x28401
movq -0x30(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl 0x14(%rax), %eax
movl %eax, -0x74(%rbp)
cmpl $0x0, -0x74(%rbp)
jle 0x283f1
movq $0x0, -0x80(%rbp)
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
movslq -0x74(%rbp), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
addq $-0x20, %rax
movq %rax, -0x88(%rbp)
movq $0x0, -0x90(%rbp)
movq -0x88(%rbp), %rax
movl 0x18(%rax), %eax
movl %eax, -0x74(%rbp)
cmpl $0x0, -0x34(%rbp)
jne 0x280aa
movq -0x10(%rbp), %rdi
callq 0x36a40
movl %eax, -0x94(%rbp)
movq 0x88002(%rip), %rax     # 0xafff0
movq (%rax), %rax
movq %rax, -0xc0(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x2800c
movq -0x18(%rbp), %rax
movq %rax, -0xc8(%rbp)
jmp 0x2801c
leaq 0x71472(%rip), %rax     # 0x99485
movq %rax, -0xc8(%rbp)
jmp 0x2801c
movq -0xc8(%rbp), %rax
movq %rax, -0xd8(%rbp)
movl -0x94(%rbp), %eax
movl %eax, %ecx
leaq 0x87ce7(%rip), %rax     # 0xafd20
movq (%rax,%rcx,8), %rax
movq %rax, -0xd0(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x28058
movq -0x28(%rbp), %rax
movq %rax, -0xe0(%rbp)
jmp 0x28072
movl -0x94(%rbp), %eax
movl %eax, %ecx
leaq 0x87cb9(%rip), %rax     # 0xafd20
movq (%rax,%rcx,8), %rax
movq %rax, -0xe0(%rbp)
movq -0xd0(%rbp), %r8
movq -0xd8(%rbp), %rcx
movq -0xc0(%rbp), %rsi
movq -0xe0(%rbp), %r9
leaq 0x5f999(%rip), %rdi     # 0x87a2e
leaq 0x5d31a(%rip), %rdx     # 0x853b6
movb $0x0, %al
callq 0x3fa20
movl $0x1, -0x34(%rbp)
movq 0x87f3f(%rip), %rax     # 0xafff0
movq (%rax), %rsi
leaq 0x5f973(%rip), %rdi     # 0x87a2e
leaq 0x5d2fe(%rip), %rdx     # 0x853c0
movb $0x0, %al
callq 0x3fa20
movq -0x88(%rbp), %rax
cmpq $0x0, (%rax)
je 0x28192
movq -0x88(%rbp), %rax
movq (%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0x90(%rbp)
movq 0x87efa(%rip), %rax     # 0xafff0
movq (%rax), %rax
movq %rax, -0xe8(%rbp)
movq -0x90(%rbp), %rax
cmpq $0x0, 0x48(%rax)
je 0x28122
movq -0x90(%rbp), %rax
movq 0x48(%rax), %rax
movq %rax, -0xf0(%rbp)
jmp 0x28132
leaq 0x5d29c(%rip), %rax     # 0x853c5
movq %rax, -0xf0(%rbp)
jmp 0x28132
movq -0xe8(%rbp), %rsi
movq -0xf0(%rbp), %rcx
leaq 0x5f8e7(%rip), %rdi     # 0x87a2e
leaq 0x6d213(%rip), %rdx     # 0x95361
movb $0x0, %al
callq 0x3fa20
movq -0x90(%rbp), %rax
cmpq $0x0, 0x40(%rax)
je 0x2818d
movq 0x87e86(%rip), %rax     # 0xafff0
movq (%rax), %rsi
movq -0x90(%rbp), %rax
movq 0x40(%rax), %rcx
leaq 0x5f8af(%rip), %rdi     # 0x87a2e
leaq 0x5d24b(%rip), %rdx     # 0x853d1
movb $0x0, %al
callq 0x3fa20
jmp 0x28299
movq -0x88(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0xa0(%rbp)
cmpq $0x0, -0xa0(%rbp)
je 0x28297
movq -0xa0(%rbp), %rdi
callq 0x6b9c0
movq %rax, -0x80(%rbp)
xorl %eax, %eax
cmpq -0x80(%rbp), %rax
je 0x28276
movq -0x80(%rbp), %rcx
xorl %eax, %eax
cmpq 0x8(%rcx), %rax
je 0x28276
movq -0x80(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x2821a
movq 0x87e00(%rip), %rax     # 0xafff0
movq (%rax), %rsi
movq -0x80(%rbp), %rax
movq 0x10(%rax), %rcx
movq -0x80(%rbp), %rax
movq 0x8(%rax), %r8
leaq 0x5f824(%rip), %rdi     # 0x87a2e
leaq 0x5d1c6(%rip), %rdx     # 0x853d7
movb $0x0, %al
callq 0x3fa20
jmp 0x28241
movq 0x87dcf(%rip), %rax     # 0xafff0
movq (%rax), %rsi
movq -0x80(%rbp), %rax
movq 0x8(%rax), %rcx
leaq 0x5f7fb(%rip), %rdi     # 0x87a2e
leaq 0x6d127(%rip), %rdx     # 0x95361
movb $0x0, %al
callq 0x3fa20
movq -0x80(%rbp), %rcx
xorl %eax, %eax
cmpq 0x18(%rcx), %rax
je 0x28274
movq 0x87d9c(%rip), %rax     # 0xafff0
movq (%rax), %rsi
movq -0x80(%rbp), %rax
movq 0x18(%rax), %rcx
leaq 0x5f7c8(%rip), %rdi     # 0x87a2e
leaq 0x5d164(%rip), %rdx     # 0x853d1
movb $0x0, %al
callq 0x3fa20
jmp 0x28295
movq 0x87d73(%rip), %rax     # 0xafff0
movq (%rax), %rsi
leaq 0x5f7a7(%rip), %rdi     # 0x87a2e
leaq 0x5d150(%rip), %rdx     # 0x853de
movb $0x0, %al
callq 0x3fa20
jmp 0x28297
jmp 0x28299
movq -0x88(%rbp), %rax
movl 0x1c(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x282ca
movq 0x87d3e(%rip), %rax     # 0xafff0
movq (%rax), %rsi
leaq 0x5f772(%rip), %rdi     # 0x87a2e
leaq 0x5d128(%rip), %rdx     # 0x853eb
movb $0x0, %al
callq 0x3fa20
movq -0x88(%rbp), %rax
cmpq $0x0, (%rax)
je 0x28390
movq -0x88(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x28390
movq -0x88(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x90(%rbp), %rcx
movq 0x28(%rcx), %rcx
subq %rcx, %rax
sarq $0x2, %rax
movl %eax, -0xa4(%rbp)
movq -0x90(%rbp), %rax
cmpq $0x0, 0x38(%rax)
je 0x28369
movq -0x90(%rbp), %rax
movq 0x38(%rax), %rax
movslq -0xa4(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xac(%rbp)
movq 0x87cae(%rip), %rax     # 0xafff0
movq (%rax), %rsi
movl -0xac(%rbp), %ecx
movl -0xa8(%rbp), %r8d
leaq 0x5f6d5(%rip), %rdi     # 0x87a2e
leaq 0x5d098(%rip), %rdx     # 0x853f8
movb $0x0, %al
callq 0x3fa20
jmp 0x2838e
movq 0x87c80(%rip), %rax     # 0xafff0
movq (%rax), %rsi
movl -0xa4(%rbp), %ecx
leaq 0x5f6ae(%rip), %rdi     # 0x87a2e
leaq 0x5d088(%rip), %rdx     # 0x8540f
movb $0x0, %al
callq 0x3fa20
jmp 0x283cd
xorl %eax, %eax
cmpq -0x80(%rbp), %rax
je 0x283cb
movq -0x80(%rbp), %rax
cmpl $0x0, 0x20(%rax)
jle 0x283c9
movq 0x87c47(%rip), %rax     # 0xafff0
movq (%rax), %rsi
movq -0x80(%rbp), %rax
movslq 0x20(%rax), %rcx
leaq 0x5f673(%rip), %rdi     # 0x87a2e
leaq 0x5d054(%rip), %rdx     # 0x85416
movb $0x0, %al
callq 0x3fa20
jmp 0x283cb
jmp 0x283cd
movq 0x87c1c(%rip), %rax     # 0xafff0
movq (%rax), %rsi
leaq 0x5f650(%rip), %rdi     # 0x87a2e
leaq 0x7109f(%rip), %rdx     # 0x99484
movb $0x0, %al
callq 0x3fa20
jmp 0x27f86
jmp 0x283f3
movl -0x1c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x27f62
cmpl $0x0, -0x38(%rbp)
je 0x28426
movq 0x87be2(%rip), %rax     # 0xafff0
movq (%rax), %rsi
leaq 0x5f616(%rip), %rdi     # 0x87a2e
leaq 0x5d003(%rip), %rdx     # 0x85422
movb $0x0, %al
callq 0x3fa20
cmpq $0x0, -0x30(%rbp)
je 0x2843c
movq -0x30(%rbp), %rdi
addq $-0x8, %rdi
callq 0x3acb0
jmp 0x2843e
jmp 0x2843e
addq $0xf0, %rsp
popq %rbp
retq
nopw (%rax,%rax)