// File: /workspace/github_c_makefile_star2_O3/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 0x99caa
cmpb $0xa, (%rax)
jne 0xf5498
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 0xf5578
leaq 0x138b9(%rip), %rcx     # 0x108d68
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
leaq 0x25622(%rip), %rsi     # 0x11aae9
jmp 0xf5546
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
leaq 0x25654(%rip), %rsi     # 0x11ab2c
movl $0x8, %edx
jmp 0xf554b
testb $0x40, 0x1(%r15)
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
jne 0xf5556
leaq 0x25612(%rip), %rsi     # 0x11ab0b
movl $0x8, %edx
jmp 0xf5570
testb $0x40, 0x1(%r15)
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
jne 0xf5564
leaq 0x25608(%rip), %rsi     # 0x11ab22
movl $0x9, %edx
jmp 0xf5570
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
leaq 0x255c3(%rip), %rsi     # 0x11aaf3
movl $0xa, %edx
jmp 0xf554b
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
leaq 0x255ef(%rip), %rsi     # 0x11ab35
movl $0x9, %edx
movq %r14, %rdi
movq %rbx, %rcx
callq *0x10(%rax)
jmp 0xf5578
leaq 0x255a1(%rip), %rsi     # 0x11aafe
movl $0xc, %edx
jmp 0xf5570
leaq 0x255a9(%rip), %rsi     # 0x11ab14
movl $0xd, %edx
movq %r14, %rdi
movq %rbx, %rcx
callq *%rax
movq 0x8(%r15), %r15
cmpq 0x110(%r14), %r15
je 0xf55cc
cmpb $0xa, (%r15)
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
jne 0xf55e9
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
movq %r14, %rdi
movl $0x3e, %esi
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 0x25560(%rip), %rsi     # 0x11ab3f
movl $0x3, %edx
jmp 0xf56f6
movq %r14, %rdi
movl $0x28, %esi
movq %rbx, %rdx
callq *0x8(%rax)
movq 0x8(%r15), %rax
cmpb $0x1, (%rax)
jne 0xf5604
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 0xf56de
leaq 0x10(%r15), %r12
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
movq %r14, %rdi
movl $0x20, %esi
movq %rbx, %rdx
callq *0x8(%rax)
movq (%r12), %rax
cmpb $0x1, (%rax)
jne 0xf566c
movq 0x8(%rax), %rax
cmpb $0x1, (%rax)
jne 0xf5709
addq $0x8, %rax
movq %rax, %r12
jmp 0xf5689
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
leaq 0x24fba(%rip), %rsi     # 0x11a635
movl $0x2, %edx
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 0xf56de
movq 0x10(%rax), %rax
cmpq 0x110(%r14), %rax
je 0xf56de
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
leaq 0x214d1(%rip), %rsi     # 0x116ba1
movl $0x4, %edx
movq %r14, %rdi
movq %rbx, %rcx
callq *0x10(%rax)
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
leaq 0x2544f(%rip), %rsi     # 0x11ab40
movl $0x2, %edx
movq %r14, %rdi
movq %rbx, %rcx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmpq *%rax
cmpq 0x1890(%r14), %rax
jne 0xf568d
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
leaq 0x2541e(%rip), %rsi     # 0x11ab43
movl $0x6, %edx
movq %r14, %rdi
movq %rbx, %rcx
callq *0x10(%rax)
movq (%r12), %r15
movq 0x10(%r15), %rax
movq 0x8(%rax), %rax
cmpb $0x1, (%rax)
je 0xf5663
jmp 0xf568d