// File: /workspace/github_c_makefile_star2_O2/BernardTatin[P]s7sh/s7.c
// Function: stacktrace_add_func
static block_t *stacktrace_add_func(s7_scheme *sc, s7_pointer f, s7_pointer code, char *errstr, char *notes, s7_int code_max, bool as_comment)
                {
                    s7_int newlen, errlen;
                    char *newstr, *str;
                    block_t *newp, *b;

                    errlen = strlen(errstr);
                    if ((is_symbol(f)) &&
                            (f != car(code)))
                    {
                        newlen = symbol_name_length(f) + errlen + 10;
                        newp = mallocate(sc, newlen);
                        newstr = (char *)block_data(newp);
                        /* newstr[0] = '\0'; */
                        errlen = catstrs_direct(newstr, symbol_name(f), ": ", errstr, NULL);
                    }
                    else
                    {
                        newlen = errlen + 8;
                        newp = mallocate(sc, newlen);
                        newstr = (char *)block_data(newp);
                        /* newstr[0] = '\0'; */
                        if ((errlen > 2) && (errstr[2] == '('))
                            errlen = catstrs_direct(newstr, "  ", errstr, NULL);
                        else
                        {
                            memcpy((void *)newstr, (void *)errstr, errlen);
                            newstr[errlen] = '\0';
                        }
                    }

                    newlen = code_max + 8 + ((notes) ? strlen(notes) : 0);
                    b = mallocate(sc, newlen);
                    str = (char *)block_data(b);
                    /* str[0] = '\0'; */

                    if (errlen >= code_max)
                    {
                        newstr[code_max - 4] = '.';
                        newstr[code_max - 3] = '.';
                        newstr[code_max - 2] = '.';
                        newstr[code_max - 1] = '\0';
                        catstrs_direct(str, (as_comment) ? "; " : "", newstr, (notes) ? notes : "", "\n", NULL);
                    }
                    else
                    {
                        /* send out newstr, pad with spaces to code_max, then notes */
                        s7_int len;
                        len = catstrs_direct(str, (as_comment) ? "; " : "", newstr, NULL);
                        if (notes)
                        {
                            s7_int i;
                            for (i = len; i < code_max - 1; i++)
                                str[i] = ' ';
                            str[i] = '\0';
                            catstrs(str, newlen, notes, "\n", NULL);
                        }
                        else catstrs(str, newlen, "\n", NULL);
                    }
                    liberate(sc, newp);
                    return(b);
                }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r9, %r12
movq %r8, %r14
movq %rcx, %rbx
movq %rdx, %r13
movq %rsi, %rbp
movq %rdi, (%rsp)
movq %rcx, %rdi
callq 0x81a0
movq %rax, %r15
cmpb $0xa, (%rbp)
jne 0x7cd99
cmpq %rbp, 0x8(%r13)
je 0x7cd99
movq 0x8(%rbp), %rax
movq 0x8(%rax), %rax
leaq (%r15,%rax), %rsi
addq $0xa, %rsi
movq (%rsp), %rdi
callq 0x9037
movq %rax, 0x8(%rsp)
movq (%rax), %r13
movq 0x8(%rbp), %rax
movq 0x10(%rax), %rsi
leaq 0x5935a(%rip), %rdx     # 0xd60e1
movq %r13, %rdi
movq %rbx, %rcx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0xb3a5
jmp 0x7cdd0
leaq 0x8(%r15), %rsi
movq (%rsp), %rdi
callq 0x9037
movq %rax, 0x8(%rsp)
movq (%rax), %r13
cmpq $0x3, %r15
jl 0x7cdd5
cmpb $0x28, 0x2(%rbx)
jne 0x7cdd5
leaq 0x6677d(%rip), %rsi     # 0xe353e
movq %r13, %rdi
movq %rbx, %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0xb3a5
movq %rax, %r15
jmp 0x7cde9
movq %r13, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x83e0
movb $0x0, (%r13,%r15)
leaq 0x8(%r12), %rbx
testq %r14, %r14
je 0x7cdfd
movq %r14, %rdi
callq 0x81a0
jmp 0x7cdff
xorl %eax, %eax
addq %rax, %rbx
movq (%rsp), %rdi
movq %rbx, %rsi
callq 0x9037
movq %rax, 0x10(%rsp)
movq (%rax), %rbp
cmpq %r12, %r15
jge 0x7ce58
leaq 0x66720(%rip), %rax     # 0xe3542
leaq 0x6b645(%rip), %rsi     # 0xe846e
cmpb $0x0, 0x50(%rsp)
cmovneq %rax, %rsi
movq %rbp, %rdi
movq %r13, %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0xb3a5
testq %r14, %r14
je 0x7cebc
decq %r12
cmpq %r12, %rax
jge 0x7ce9b
movb $0x20, (%rbp,%rax)
incq %rax
jmp 0x7ce49
leaq 0x666e3(%rip), %rsi     # 0xe3542
leaq 0x6b608(%rip), %rax     # 0xe846e
cmpb $0x0, 0x50(%rsp)
cmoveq %rax, %rsi
testq %r14, %r14
movl $0x2e2e2e, -0x4(%r12,%r13) # imm = 0x2E2E2E
cmoveq %rax, %r14
leaq 0x6b5e7(%rip), %r8      # 0xe846d
movq %rbp, %rdi
movq %r13, %rdx
movq %r14, %rcx
xorl %r9d, %r9d
xorl %eax, %eax
callq 0xb3a5
jmp 0x7ced2
movb $0x0, (%rbp,%rax)
leaq 0x6b5c6(%rip), %rcx     # 0xe846d
movq %rbp, %rdi
movq %rbx, %rsi
movq %r14, %rdx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x90f7
jmp 0x7ced2
leaq 0x6b5aa(%rip), %rdx     # 0xe846d
movq %rbp, %rdi
movq %rbx, %rsi
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x90f7
movq (%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0x9439
movq 0x10(%rsp), %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq