// File: /workspace/github_c_makefile_star2_O2/BernardTatin[P]s7sh/s7.c
// Function: write_closure_name
static void write_closure_name(s7_scheme *sc, s7_pointer closure, s7_pointer port)
    {
        s7_pointer x;
        x = find_closure(sc, closure, closure_let(closure));
        /* this can be confusing!
         * (let ((a (lambda () 1))) a)
         * #<lambda ()>
         * (letrec ((a (lambda () 1))) a)
         * a
         * (let () (define (a) 1) a)
         * a
         * (let () (define a (lambda () 1)))
         * a
         * (let () (define a (lambda () 1)))
         * a
         * (let () (define (a) (lambda () 1)) (a))
         * #<lambda ()>
         */
        if (is_symbol(x)) /* after find_closure */
        {
            port_write_string(port)(sc, symbol_name(x), symbol_name_length(x), port);
            return;
        }

        /* names like #<closure> and #<macro> are useless -- try to be a bit more informative */
        switch (type(closure))
        {
            case T_CLOSURE:
                port_write_string(port)(sc, "#<lambda ", 9, port);
                break;

            case T_CLOSURE_STAR:
                port_write_string(port)(sc, "#<lambda* ", 10, port);
                break;

            case T_MACRO:
                if (is_expansion(closure))
                    port_write_string(port)(sc, "#<expansion ", 12, port);
                else port_write_string(port)(sc, "#<macro ", 8, port);
                break;

            case T_MACRO_STAR:
                if (is_expansion(closure))
                    port_write_string(port)(sc, "#<expansion* ", 13, port);
                else port_write_string(port)(sc, "#<macro* ", 9, port);
                break;

            case T_BACRO:
                port_write_string(port)(sc, "#<bacro ", 8, port);
                break;

            case T_BACRO_STAR:
                port_write_string(port)(sc, "#<bacro* ", 9, port);
                break;
        }

        if (is_null(closure_args(closure)))
            port_write_string(port)(sc, "()>", 3, port);
        else
        {
            s7_pointer args;
            args = closure_args(closure);
            if (is_symbol(args))
            {
                port_write_string(port)(sc, symbol_name(args), symbol_name_length(args), port);
                port_write_character(port)(sc, '>', port);    /* (lambda a a) -> #<lambda a> */
            }
            else
            {
                port_write_character(port)(sc, '(', port);
                x = car(args);
                if (is_pair(x)) x = car(x);
                port_write_string(port)(sc, symbol_name(x), symbol_name_length(x), port);
                if (!is_null(cdr(args)))
                {
                    s7_pointer y;
                    port_write_character(port)(sc, ' ', port);
                    if (is_pair(cdr(args)))
                    {
                        y = cadr(args);
                        if (is_pair(y))
                            y = car(y);
                        else
                        {
                            if (y == sc->key_rest_symbol)
                            {
                                port_write_string(port)(sc, ":rest ", 6, port);
                                args = cdr(args);
                                y = cadr(args);
                                if (is_pair(y)) y = car(y);
                            }
                        }
                    }
                    else
                    {
                        port_write_string(port)(sc, ". ", 2, port);
                        y = cdr(args);
                    }
                    port_write_string(port)(sc, symbol_name(y), symbol_name_length(y), port);
                    if ((is_pair(cdr(args))) &&
                            (!is_null(cddr(args))))
                        port_write_string(port)(sc, " ...", 4, port);
                }
                port_write_string(port)(sc, ")>", 2, port);
            }
        }
    }

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
movq 0x18(%rsi), %rdx
callq 0x7b153
cmpb $0xa, (%rax)
jne 0xc31bf
movq 0x8(%rbx), %rcx
movq 0x48(%rcx), %rcx
movq 0x10(%rcx), %r8
movq 0x8(%rax), %rax
movq 0x8(%rax), %rdx
movq 0x10(%rax), %rsi
movq %r14, %rdi
movq %rbx, %rcx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmpq *%r8
movzbl (%r15), %eax
addl $-0x28, %eax
cmpl $0x5, %eax
ja 0xc328c
leaq 0x11b86(%rip), %rcx     # 0xd4d5c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
leaq 0x2389b(%rip), %rsi     # 0xe6a89
jmp 0xc3261
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
leaq 0x238cd(%rip), %rsi     # 0xe6acc
pushq $0x8
jmp 0xc3263
testb $0x40, 0x1(%r15)
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
jne 0xc326f
leaq 0x2388e(%rip), %rsi     # 0xe6aab
pushq $0x8
jmp 0xc3283
testb $0x40, 0x1(%r15)
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
jne 0xc327a
leaq 0x23887(%rip), %rsi     # 0xe6ac2
pushq $0x9
jmp 0xc3283
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
leaq 0x23845(%rip), %rsi     # 0xe6a93
pushq $0xa
jmp 0xc3263
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
leaq 0x23874(%rip), %rsi     # 0xe6ad5
pushq $0x9
popq %rdx
movq %r14, %rdi
movq %rbx, %rcx
callq *0x10(%rax)
jmp 0xc328c
leaq 0x23828(%rip), %rsi     # 0xe6a9e
pushq $0xc
jmp 0xc3283
leaq 0x23833(%rip), %rsi     # 0xe6ab4
pushq $0xd
popq %rdx
movq %r14, %rdi
movq %rbx, %rcx
callq *%rax
movq 0x8(%r15), %r15
cmpq 0x110(%r14), %r15
je 0xc32de
cmpb $0xa, (%r15)
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
jne 0xc32f8
movq 0x8(%r15), %rcx
movq 0x8(%rcx), %rdx
movq 0x10(%rcx), %rsi
movq %r14, %rdi
movq %rbx, %rcx
callq *0x10(%rax)
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
movq 0x8(%rax), %rax
pushq $0x3e
popq %rsi
movq %r14, %rdi
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmpq *%rax
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
leaq 0x237ee(%rip), %rsi     # 0xe6adf
pushq $0x3
jmp 0xc33fa
pushq $0x28
popq %rsi
movq %r14, %rdi
movq %rbx, %rdx
callq *0x8(%rax)
movq 0x8(%r15), %rax
cmpb $0x1, (%rax)
jne 0xc3311
movq 0x8(%rax), %rax
movq 0x8(%rbx), %rcx
movq 0x48(%rcx), %r8
movq 0x8(%rax), %rax
movq 0x8(%rax), %rdx
movq 0x10(%rax), %rsi
movq %r14, %rdi
movq %rbx, %rcx
callq *0x10(%r8)
movq 0x10(%r15), %rax
cmpq 0x110(%r14), %rax
je 0xc33e5
leaq 0x10(%r15), %r12
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
pushq $0x20
popq %rsi
movq %r14, %rdi
movq %rbx, %rdx
callq *0x8(%rax)
movq (%r12), %rax
cmpb $0x1, (%rax)
jne 0xc3377
movq 0x8(%rax), %rax
cmpb $0x1, (%rax)
jne 0xc340e
addq $0x8, %rax
movq %rax, %r12
jmp 0xc3392
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
leaq 0x2324f(%rip), %rsi     # 0xe65d5
pushq $0x2
popq %rdx
movq %r14, %rdi
movq %rbx, %rcx
callq *0x10(%rax)
movq (%r12), %rax
movq 0x8(%rbx), %rcx
movq 0x48(%rcx), %r8
movq 0x8(%rax), %rax
movq 0x8(%rax), %rdx
movq 0x10(%rax), %rsi
movq %r14, %rdi
movq %rbx, %rcx
callq *0x10(%r8)
movq 0x10(%r15), %rax
cmpb $0x1, (%rax)
jne 0xc33e5
movq 0x10(%rax), %rax
cmpq 0x110(%r14), %rax
je 0xc33e5
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
leaq 0x1f768(%rip), %rsi     # 0xe2b41
pushq $0x4
popq %rdx
movq %r14, %rdi
movq %rbx, %rcx
callq *0x10(%rax)
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
leaq 0x236e8(%rip), %rsi     # 0xe6ae0
pushq $0x2
popq %rdx
movq %r14, %rdi
movq %rbx, %rcx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmpq *%rax
cmpq 0x1890(%r14), %rax
jne 0xc3396
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
leaq 0x236b9(%rip), %rsi     # 0xe6ae3
pushq $0x6
popq %rdx
movq %r14, %rdi
movq %rbx, %rcx
callq *0x10(%rax)
movq (%r12), %r15
movq 0x10(%r15), %rax
movq 0x8(%rax), %rax
cmpb $0x1, (%rax)
je 0xc336e
jmp 0xc3396