// File: /workspace/github_c_makefile_star2_O1/BernardTatin[P]s7sh/s7.c
// Function: stacktrace_walker
static char *stacktrace_walker(s7_scheme *sc, s7_pointer code, s7_pointer e, char *notes,
                        s7_int code_cols, s7_int total_cols, s7_int notes_start_col,
                        bool as_comment, int32_t depth)
                {
                    if (is_symbol(code))
                    {
                        if ((!symbol_is_in_list(sc, code)) &&
                                (!is_slot(global_slot(code))))
                        {
                            s7_pointer val;

                            add_symbol_to_list(sc, code);
                            val = s7_symbol_local_value(sc, code, e);
                            if ((val) &&
                                    (val != sc->undefined) &&
                                    (!is_any_macro(val)))
                            {
                                int32_t typ;

                                typ = type(val);
                                if (typ < T_CONTINUATION)
                                {
                                    char *objstr, *str;
                                    s7_pointer objp;
                                    const char *spaces;
                                    s7_int new_note_len, notes_max, spaces_len;
                                    bool new_notes_line = false, old_short_print;
                                    s7_int old_len, objlen;

                                    spaces = "                                                                                ";
                                    spaces_len = 80;

                                    if (notes_start_col < 0) notes_start_col = 50;
                                    if (notes_start_col > total_cols) notes_start_col = 0;
                                    notes_max = total_cols - notes_start_col;

                                    old_short_print = sc->short_print;
                                    sc->short_print = true;
                                    old_len = sc->print_length;
                                    if (sc->print_length > 4) sc->print_length = 4;
                                    objp = s7_object_to_string(sc, val, false);
                                    objstr = string_value(objp);
                                    objlen = string_length(objp);
                                    if ((objlen > notes_max) &&
                                            (notes_max > 5))
                                    {
                                        objstr[notes_max - 4] = '.';
                                        objstr[notes_max - 3] = '.';
                                        objstr[notes_max - 2] = '.';
                                        objstr[notes_max - 1] = '\0';
                                        objlen = notes_max;
                                    }
                                    sc->short_print = old_short_print;
                                    sc->print_length = old_len;

                                    new_note_len = symbol_name_length(code) + 3 + objlen;
                                    /* we want to append this much info to the notes, but does it need a new line? */
                                    if (notes_start_col < code_cols)
                                        new_notes_line = true;
                                    else
                                    {
                                        if (notes)
                                        {
                                            char *last_newline;
                                            s7_int cur_line_len;
                                            last_newline = strrchr(notes, (int)'\n'); /* returns ptr to end if none = nil if not found? */
                                            if (last_newline)
                                                cur_line_len = strlen(notes) - strlen(last_newline);
                                            else cur_line_len = strlen(notes);
                                            new_notes_line = ((cur_line_len + new_note_len) > notes_max);
                                        }
                                    }

                                    if (new_notes_line)
                                    {
                                        new_note_len += (4 + notes_start_col + ((notes) ? strlen(notes) : 0));
                                        str = (char *)malloc(new_note_len);
                                        /* str[0] = '\0'; */
                                        catstrs_direct(str,
                                                (notes) ? notes : "",
                                                "\n",
                                                (as_comment) ? "; " : "",
                                                (spaces_len >= notes_start_col) ? (char *)(spaces + spaces_len - notes_start_col) : "",
                                                (as_comment) ? "" : " ; ",
                                                symbol_name(code),
                                                ": ",
                                                objstr, NULL);
                                    }
                                    else
                                    {
                                        new_note_len += ((notes) ? strlen(notes) : 0) + 4;
                                        str = (char *)malloc(new_note_len);
                                        /* str[0] = '\0'; */
                                        catstrs_direct(str,
                                                (notes) ? notes : "",
                                                (notes) ? ", " : " ; ",
                                                symbol_name(code),
                                                ": ",
                                                objstr, NULL);
                                    }
                                    if (notes) free(notes);
                                    return(str);
                                }
                            }
                        }
                        return(notes);
                    }
                    if ((is_pair(code)) &&
                            (s7_list_length(sc, code) > 0) &&
                            (depth < 32))
                    {
                        notes = stacktrace_walker(sc, car(code), e, notes, code_cols, total_cols, notes_start_col, as_comment, depth + 1);
                        return(stacktrace_walker(sc, cdr(code), e, notes, code_cols, total_cols, notes_start_col, as_comment, depth + 2));
                    }
                    return(notes);
                }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r9, 0x10(%rsp)
movq %r8, 0x18(%rsp)
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %rbp
movl 0x70(%rsp), %r14d
movzbl 0x68(%rsp), %ebx
movzbl (%r13), %ecx
cmpl $0x1, %ecx
jne 0xa2758
movq %rbp, %rdi
movq %r13, %rsi
callq 0x3c299
cmpl $0x1f, %r14d
jg 0xa27e1
testq %rax, %rax
jle 0xa27e1
movq 0x8(%r13), %rsi
leal 0x1(%r14), %eax
subq $0x8, %rsp
movq %rbp, %rdi
movq %r12, %rdx
movq %r15, %rcx
movq 0x20(%rsp), %r8
movq 0x18(%rsp), %r9
pushq %rax
pushq %rbx
pushq 0x78(%rsp)
callq 0xa26c7
addq $0x20, %rsp
movq %rax, %r15
movq 0x10(%r13), %r13
addl $0x2, %r14d
jmp 0xa26f5
cmpl $0xa, %ecx
jne 0xa27e1
movl 0xa88(%rbp), %edx
cmpl %edx, 0x2c(%r13)
jne 0xa2780
movq 0x8(%r13), %rcx
movq 0x20(%rcx), %rcx
movl 0xc(%rcx), %ecx
cmpl 0xa8c(%rbp), %ecx
je 0xa27e1
movq 0x10(%r13), %rcx
cmpb $0x20, (%rcx)
je 0xa27e1
movq %r15, %rbx
movl %edx, 0x2c(%r13)
movl 0xa8c(%rbp), %eax
movq 0x8(%r13), %rcx
movq 0x20(%rcx), %rcx
movl %eax, 0xc(%rcx)
movq %rbp, %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0xcd2c
movb $0x1, %sil
testq %rax, %rax
je 0xa27d9
cmpq 0x128(%rbp), %rax
je 0xa27d9
movzbl (%rax), %ecx
leaq 0xb1ba6(%rip), %rdx     # 0x154370
cmpb $0x0, (%rcx,%rdx)
jne 0xa27d9
cmpb $0x25, %cl
setae %sil
jb 0xa27f3
testb %sil, %sil
je 0xa27e1
movq %rbx, %r15
movq %r15, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movb %sil, 0xf(%rsp)
movq 0x60(%rsp), %rdx
testq %rdx, %rdx
movl $0x32, %ecx
cmovnsq %rdx, %rcx
xorl %edx, %edx
movq 0x10(%rsp), %r12
cmpq %r12, %rcx
cmovleq %rcx, %rdx
movq %rdx, 0x20(%rsp)
subq %rdx, %r12
movb 0x248(%rbp), %r15b
movb $0x1, 0x248(%rbp)
movq 0x280(%rbp), %r14
cmpq $0x5, %r14
jl 0xa2845
movq $0x4, 0x280(%rbp)
movq %rbp, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x39f84
movq 0x8(%rax), %rcx
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
cmpq $0x6, %r12
jl 0xa2880
cmpq %r12, %rcx
movq %rbx, %rdi
jle 0xa2883
movq %r12, %rcx
movq 0x10(%rsp), %rax
movl $0x2e2e2e, -0x4(%rax,%r12) # imm = 0x2E2E2E
jmp 0xa2883
movq %rbx, %rdi
movb %r15b, 0x248(%rbp)
movq %r14, 0x280(%rbp)
movq 0x8(%r13), %r13
movq 0x8(%r13), %rax
leaq (%rcx,%rax), %rbp
addq $0x3, %rbp
movq 0x20(%rsp), %rax
cmpq 0x18(%rsp), %rax
jl 0xa28ff
testq %rdi, %rdi
je 0xa2992
movq %r13, 0x18(%rsp)
movl $0xa, %esi
movq %rdi, %r14
callq 0x9220
movq %rax, %r13
movq %r14, %rdi
callq 0x91a0
movq %rax, %r15
testq %r13, %r13
je 0xa28e6
movq %r13, %rdi
callq 0x91a0
subq %rax, %r15
movq 0x18(%rsp), %r13
movq 0x20(%rsp), %rax
addq %rbp, %r15
cmpq %r12, %r15
movq %rbx, %rdi
jle 0xa29a7
leaq 0x4(%rax), %r15
leaq 0x82ab4(%rip), %r12     # 0x1253be
testq %rdi, %rdi
je 0xa2919
movq %rdi, %r14
callq 0x91a0
jmp 0xa291e
xorl %eax, %eax
movq %r12, %r14
addq %rbp, %r15
addq %rax, %r15
movq %r15, %rdi
callq 0x9480
leaq 0x7db0d(%rip), %r8      # 0x120440
movq 0x20(%rsp), %rcx
subq %rcx, %r8
addq $0x50, %r8
cmpq $0x51, %rcx
cmovaeq %r12, %r8
leaq 0x7db44(%rip), %rcx     # 0x120492
cmpb $0x0, 0x68(%rsp)
cmoveq %r12, %rcx
movq %rax, %r15
leaq 0x7db30(%rip), %r9      # 0x120491
cmovneq %r12, %r9
leaq 0x706c5(%rip), %r10     # 0x113031
leaq 0x82a4a(%rip), %rdx     # 0x1253bd
movq %rax, %rdi
movq %r14, %rsi
xorl %eax, %eax
pushq $0x0
pushq 0x18(%rsp)
pushq %r10
pushq 0x10(%r13)
callq 0xd1cb
addq $0x20, %rsp
jmp 0xa29f2
movl $0x4, %edi
leaq 0x82a20(%rip), %r12     # 0x1253be
leaq 0x7daec(%rip), %r14     # 0x120491
jmp 0xa29bd
movq %rdi, %r12
callq 0x91a0
movq %rax, %rdi
addq $0x4, %rdi
leaq 0x7dad8(%rip), %r14     # 0x120495
addq %rbp, %rdi
callq 0x9480
movq %rax, %r15
movq 0x10(%r13), %rcx
subq $0x8, %rsp
leaq 0x7065a(%rip), %r8      # 0x113031
movq %rax, %rdi
movq %r12, %rsi
movq %r14, %rdx
movq 0x18(%rsp), %r9
xorl %eax, %eax
pushq $0x0
callq 0xd1cb
addq $0x10, %rsp
testq %rbx, %rbx
je 0xa29ff
movq %rbx, %rdi
callq 0x9050
movb 0xf(%rsp), %sil
jmp 0xa27d9