// File: /workspace/github_c_makefile_star2_O1/BernardTatin[P]s7sh/s7.c
// Function: g_stacktrace
static s7_pointer g_stacktrace(s7_scheme *sc, s7_pointer args)
                {
#define H_stacktrace "(stacktrace (max-frames 30) (code-cols 50) (total-cols 80) (note-col 50) as-comment) returns \
                    a stacktrace as a string.  Each line has two portions, the code being evaluated and a note giving \
                    the value of local variables in that code.  The first argument sets how many lines are displayed. \
                    The next three arguments set the length and layout of those lines.  'as-comment' if #t causes each \
                    line to be preceded by a semicolon."
#define Q_stacktrace s7_make_signature(sc, 6, sc->is_string_symbol, sc->is_integer_symbol, sc->is_integer_symbol, sc->is_integer_symbol, sc->is_integer_symbol, sc->is_boolean_symbol)

                    s7_int max_frames = 30, code_cols = 50, total_cols = 80, notes_start_col = 50;
                    bool as_comment = false;

                    if (!is_null(args))
                    {
                        if (!s7_is_integer(car(args)))
                            return(method_or_bust(sc, car(args), sc->stacktrace_symbol, args, T_INTEGER, 1));
                        max_frames = s7_integer(car(args));
                        if ((max_frames <= 0) || (max_frames > s7_int32_max))
                            max_frames = 30;
                        args = cdr(args);
                        if (!is_null(args))
                        {
                            if (!s7_is_integer(car(args)))
                                return(wrong_type_argument(sc, sc->stacktrace_symbol, 2, car(args), T_INTEGER));
                            code_cols = s7_integer(car(args));
                            if ((code_cols <= 8) || (code_cols > 1024))
                                code_cols = 50;
                            args = cdr(args);
                            if (!is_null(args))
                            {
                                if (!s7_is_integer(car(args)))
                                    return(wrong_type_argument(sc, sc->stacktrace_symbol, 3, car(args), T_INTEGER));
                                total_cols = s7_integer(car(args));
                                if ((total_cols <= code_cols) || (total_cols > s7_int32_max))
                                    total_cols = 80;
                                args = cdr(args);
                                if (!is_null(args))
                                {
                                    if (!s7_is_integer(car(args)))
                                        return(wrong_type_argument(sc, sc->stacktrace_symbol, 4, car(args), T_INTEGER));
                                    notes_start_col = s7_integer(car(args));
                                    if ((notes_start_col <= 0) || (notes_start_col > s7_int32_max))
                                        notes_start_col = 50;
                                    args = cdr(args);
                                    if (!is_null(args))
                                    {
                                        if (!s7_is_boolean(car(args)))
                                            return(wrong_type_argument(sc, sc->stacktrace_symbol, 5, car(args), T_BOOLEAN));
                                        as_comment = s7_boolean(sc, car(args));
                                    }
                                }
                            }
                        }
                    }
                    return(stacktrace_1(sc, max_frames, code_cols, total_cols, notes_start_col, as_comment));
                }

// Assembly:
movq 0x110(%rdi), %r9
movl $0x50, %ecx
movl $0x32, %r8d
cmpq %rsi, %r9
je 0x84e12
movq %rsi, %rax
movq 0x8(%rsi), %rsi
cmpb $0xb, (%rsi)
jne 0x84e27
movq 0x8(%rsi), %rsi
testq %rsi, %rsi
jle 0x84d3a
xorl %edx, %edx
cmpb $0x0, 0xd86b9(%rip)     # 0x15d3e4
movl $0x7fffffff, %r10d      # imm = 0x7FFFFFFF
cmoveq %rdx, %r10
cmpq %r10, %rsi
jle 0x84d3f
movl $0x1e, %esi
movq 0x10(%rax), %r10
cmpq %r9, %r10
je 0x84e17
movq 0x8(%r10), %rax
cmpb $0xb, (%rax)
jne 0x84e42
movq 0x8(%rax), %rdx
leaq -0x401(%rdx), %rax
cmpq $-0x3f8, %rax           # imm = 0xFC08
cmovbq %r8, %rdx
movq 0x10(%r10), %rax
cmpq %r9, %rax
je 0x84e6a
movq 0x8(%rax), %rcx
cmpb $0xb, (%rcx)
jne 0x84e6e
movq 0x8(%rcx), %rcx
cmpq %rdx, %rcx
jle 0x84daa
xorl %r10d, %r10d
cmpb $0x0, 0xd8649(%rip)     # 0x15d3e4
movl $0x7fffffff, %r11d      # imm = 0x7FFFFFFF
cmoveq %r10, %r11
cmpq %r11, %rcx
jle 0x84daf
movl $0x50, %ecx
movq 0x10(%rax), %r10
cmpq %r9, %r10
je 0x84e6a
movq 0x8(%r10), %rax
cmpb $0xb, (%rax)
jne 0x84e93
movq 0x8(%rax), %r8
testq %r8, %r8
jle 0x84dea
xorl %eax, %eax
cmpb $0x0, 0xd8609(%rip)     # 0x15d3e4
movl $0x7fffffff, %r11d      # imm = 0x7FFFFFFF
cmoveq %rax, %r11
cmpq %r11, %r8
jle 0x84df0
movl $0x32, %r8d
movq 0x10(%r10), %rax
cmpq %r9, %rax
je 0x84e6a
movq 0x8(%rax), %rax
cmpb $0x7, (%rax)
jne 0x84ea7
cmpq %rax, 0x120(%rdi)
setne %al
jmp 0x84e1e
movl $0x1e, %esi
xorl %eax, %eax
movl $0x32, %edx
movzbl %al, %r9d
jmp 0x45bae
movq 0x14f8(%rdi), %rdx
movq %rax, %rcx
movl $0xb, %r8d
movl $0x1, %r9d
jmp 0xf1ae
movq 0x14f8(%rdi), %rcx
movq 0x8(%rcx), %rsi
movq 0xc9b0c(%rip), %rdx     # 0x14e960
movq 0x140(%rdi), %r8
movq 0xcdc56(%rip), %r9      # 0x152ab8
movq %rax, %rcx
jmp 0xb31d
xorl %eax, %eax
jmp 0x84e1e
movq 0x14f8(%rdi), %rax
movq 0x8(%rax), %rsi
movq 0xc9ae8(%rip), %rdx     # 0x14e968
movq 0x140(%rdi), %r8
movq 0xcdc2a(%rip), %r9      # 0x152ab8
jmp 0xb31d
movq 0x14f8(%rdi), %rcx
movq 0x8(%rcx), %rsi
movq 0xc9acb(%rip), %rdx     # 0x14e970
jmp 0x84e54
movq 0x14f8(%rdi), %rcx
movq 0x8(%rcx), %rsi
movq 0xc9abf(%rip), %rdx     # 0x14e978
movq 0x140(%rdi), %r8
movq 0xcdbd1(%rip), %r9      # 0x152a98
jmp 0x84e62