// File: /workspace/github_c_makefile_star2_O2/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 $0x38, %rsp
movq %r9, %r12
movq %r8, 0x20(%rsp)
movq %rcx, %r8
movq %rdx, 0x28(%rsp)
movq %rsi, %r13
movq %rdi, %rbp
movl 0x80(%rsp), %r14d
movzbl 0x78(%rsp), %ebx
movzbl (%r13), %eax
cmpl $0x1, %eax
jne 0x7ca6b
movq %r12, %r15
movq %r8, %r12
movq %rbp, %rdi
movq %r13, %rsi
callq 0x2dada
cmpl $0x1f, %r14d
jg 0x7cb79
testq %rax, %rax
movq %r12, %r8
jle 0x7cd0d
movq 0x8(%r13), %rsi
leal 0x1(%r14), %eax
movl %eax, 0x10(%rsp)
movl %ebx, 0x8(%rsp)
movq 0x70(%rsp), %rax
movq %rax, (%rsp)
movq %rbp, %rdi
movq 0x28(%rsp), %rdx
movq %r8, %rcx
movq 0x20(%rsp), %r8
movq %r15, %r12
movq %r15, %r9
callq 0x7c9c8
movq %rax, %r8
movq 0x10(%r13), %r13
addl $0x2, %r14d
jmp 0x7c9f9
cmpl $0xa, %eax
jne 0x7cd0d
movl 0xa88(%rbp), %eax
cmpl %eax, 0x2c(%r13)
jne 0x7ca97
movq 0x8(%r13), %rcx
movq 0x20(%rcx), %rcx
movl 0xc(%rcx), %ecx
cmpl 0xa8c(%rbp), %ecx
je 0x7cd0d
movq 0x10(%r13), %rcx
cmpb $0x20, (%rcx)
je 0x7cd0d
movq %r8, %rbx
movl %eax, 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 0x28(%rsp), %rdx
callq 0xb072
testq %rax, %rax
je 0x7cb81
cmpq 0x128(%rbp), %rax
movq %rbx, %r8
je 0x7cd0d
movzbl (%rax), %ecx
cmpq $0x24, %rcx
ja 0x7cd0d
leaq 0x9e877(%rip), %rdx     # 0x11b370
cmpb $0x0, (%rcx,%rdx)
jne 0x7cd0d
movq 0x70(%rsp), %rdx
testq %rdx, %rdx
pushq $0x32
popq %rcx
cmovnsq %rdx, %rcx
xorl %r15d, %r15d
cmpq %r12, %rcx
cmovleq %rcx, %r15
subq %r15, %r12
movb 0x248(%rbp), %cl
movb %cl, 0x30(%rsp)
movb $0x1, 0x248(%rbp)
movq 0x280(%rbp), %r14
cmpq $0x5, %r14
jl 0x7cb48
movq $0x4, 0x280(%rbp)
movq %rbp, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x2b7ea
movq 0x8(%rax), %rcx
movq 0x10(%rax), %rdx
cmpq $0x6, %r12
jl 0x7cb89
cmpq %r12, %rcx
movq %rbx, %rdi
jle 0x7cb8c
movl $0x2e2e2e, -0x4(%rdx,%r12) # imm = 0x2E2E2E
movq %r12, %rcx
jmp 0x7cb8c
movq %r12, %r8
jmp 0x7cd0d
movq %rbx, %r8
jmp 0x7cd0d
movq %rbx, %rdi
movb 0x30(%rsp), %al
movb %al, 0x248(%rbp)
movq %r14, 0x280(%rbp)
movq 0x8(%r13), %rbp
movq 0x8(%rbp), %rax
leaq (%rcx,%rax), %r13
addq $0x3, %r13
cmpq 0x20(%rsp), %r15
movq %rdx, 0x28(%rsp)
jge 0x7cbcd
leaq 0x4(%r15), %r14
testq %rdi, %rdi
jne 0x7cc23
leaq 0x6b8a5(%rip), %r12     # 0xe846e
xorl %eax, %eax
jmp 0x7cc2b
movq %r13, 0x20(%rsp)
testq %rdi, %rdi
je 0x7cca7
movq %r12, 0x30(%rsp)
pushq $0xa
popq %rsi
movq %rdi, %r14
callq 0x8220
movq %rax, %r13
movq %r14, %rdi
callq 0x81a0
movq %rax, %r12
testq %r13, %r13
je 0x7cc09
movq %r13, %rdi
callq 0x81a0
subq %rax, %r12
movq 0x20(%rsp), %r13
addq %r13, %r12
cmpq 0x30(%rsp), %r12
movq %rbx, %rdi
jle 0x7ccba
leaq 0x4(%r15), %r14
movq %rdi, %r12
callq 0x81a0
addq %rax, %r14
addq %r13, %r14
movq %r14, %rdi
callq 0x8480
movq %rax, %r14
leaq 0x6b82b(%rip), %rax     # 0xe846e
leaq 0x668a6(%rip), %r8      # 0xe34f0
subq %r15, %r8
addq $0x50, %r8
cmpq $0x51, %r15
cmovaeq %rax, %r8
leaq 0x668e2(%rip), %rcx     # 0xe3542
cmpb $0x0, 0x78(%rsp)
cmoveq %rax, %rcx
leaq 0x668d1(%rip), %r9      # 0xe3541
cmovneq %rax, %r9
movq 0x10(%rbp), %rax
movq 0x28(%rsp), %rdx
movq %rdx, 0x10(%rsp)
leaq 0x59458(%rip), %rdx     # 0xd60e1
movq %rdx, 0x8(%rsp)
movq %rax, (%rsp)
andq $0x0, 0x18(%rsp)
leaq 0x6b7ce(%rip), %rdx     # 0xe846d
movq %r14, %rdi
movq %r12, %rsi
jmp 0x7ccfb
pushq $0x4
popq %rdi
leaq 0x6b7bd(%rip), %r13     # 0xe846e
leaq 0x66889(%rip), %r12     # 0xe3541
jmp 0x7ccd0
movq %rdi, %r13
callq 0x81a0
movq %rax, %rdi
addq $0x4, %rdi
leaq 0x66875(%rip), %r12     # 0xe3545
addq 0x20(%rsp), %rdi
callq 0x8480
movq %rax, %r14
movq 0x10(%rbp), %rcx
andq $0x0, (%rsp)
leaq 0x593f4(%rip), %r8      # 0xd60e1
movq %rax, %rdi
movq %r13, %rsi
movq %r12, %rdx
movq 0x28(%rsp), %r9
xorl %eax, %eax
callq 0xb3a5
movq %rbx, %rdi
callq 0x8050
movq %r14, %r8
movq %r8, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq