// File: /workspace/github_c_makefile_star2_O2/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
pushq $0x50
popq %rcx
pushq $0x32
popq %r8
cmpq %rsi, %r9
je 0x65e48
movq %rsi, %rax
movq 0x8(%rsi), %rsi
cmpb $0xb, (%rsi)
jne 0x65e59
movq 0x8(%rsi), %rsi
testq %rsi, %rsi
jle 0x65d76
xorl %edx, %edx
cmpb $0x0, 0xbe67d(%rip)     # 0x1243e4
movl $0x7fffffff, %r10d      # imm = 0x7FFFFFFF
cmoveq %rdx, %r10
cmpq %r10, %rsi
jbe 0x65d79
pushq $0x1e
popq %rsi
movq 0x10(%rax), %r10
cmpq %r9, %r10
je 0x65e4b
movq 0x8(%r10), %rax
cmpb $0xb, (%rax)
jne 0x65e70
movq 0x8(%rax), %rdx
leaq -0x401(%rdx), %rax
cmpq $-0x3f8, %rax           # imm = 0xFC08
cmovbq %r8, %rdx
movq 0x10(%r10), %rax
cmpq %r9, %rax
je 0x65e98
movq 0x8(%rax), %rcx
cmpb $0xb, (%rcx)
jne 0x65e9c
movq 0x8(%rcx), %rcx
cmpq %rdx, %rcx
jle 0x65de4
xorl %r10d, %r10d
cmpb $0x0, 0xbe60f(%rip)     # 0x1243e4
movl $0x7fffffff, %r11d      # imm = 0x7FFFFFFF
cmoveq %r10, %r11
cmpq %r11, %rcx
jle 0x65de7
pushq $0x50
popq %rcx
movq 0x10(%rax), %r10
cmpq %r9, %r10
je 0x65e98
movq 0x8(%r10), %rax
cmpb $0xb, (%rax)
jne 0x65ec1
movq 0x8(%rax), %r8
testq %r8, %r8
jle 0x65e22
xorl %eax, %eax
cmpb $0x0, 0xbe5d1(%rip)     # 0x1243e4
movl $0x7fffffff, %r11d      # imm = 0x7FFFFFFF
cmoveq %rax, %r11
cmpq %r11, %r8
jbe 0x65e26
pushq $0x32
popq %r8
movq 0x10(%r10), %rax
cmpq %r9, %rax
je 0x65e98
movq 0x8(%rax), %rax
cmpb $0x7, (%rax)
jne 0x65ed5
cmpq %rax, 0x120(%rdi)
setne %al
jmp 0x65e50
pushq $0x1e
popq %rsi
xorl %eax, %eax
movq %r8, %rdx
movzbl %al, %r9d
jmp 0x355a2
movq 0x14f8(%rdi), %rdx
pushq $0xb
popq %r8
pushq $0x1
popq %r9
movq %rax, %rcx
jmp 0xcd70
movq 0x14f8(%rdi), %rcx
movq 0x8(%rcx), %rsi
movq 0xafade(%rip), %rdx     # 0x115960
movq 0x140(%rdi), %r8
movq 0xb3c28(%rip), %r9      # 0x119ab8
movq %rax, %rcx
jmp 0x9bbb
xorl %eax, %eax
jmp 0x65e50
movq 0x14f8(%rdi), %rax
movq 0x8(%rax), %rsi
movq 0xafaba(%rip), %rdx     # 0x115968
movq 0x140(%rdi), %r8
movq 0xb3bfc(%rip), %r9      # 0x119ab8
jmp 0x9bbb
movq 0x14f8(%rdi), %rcx
movq 0x8(%rcx), %rsi
movq 0xafa9d(%rip), %rdx     # 0x115970
jmp 0x65e82
movq 0x14f8(%rdi), %rcx
movq 0x8(%rcx), %rsi
movq 0xafa91(%rip), %rdx     # 0x115978
movq 0x140(%rdi), %r8
movq 0xb3ba3(%rip), %r9      # 0x119a98
jmp 0x65e90