// File: /workspace/github_c_makefile_star2_O1/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 0xa05a7
cmpb $0xa, (%rax)
jne 0xfe217
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 0xfe2f7
leaq 0x13ace(%rip), %rcx     # 0x111cfc
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
leaq 0x25793(%rip), %rsi     # 0x1239d9
jmp 0xfe2c5
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
leaq 0x257c5(%rip), %rsi     # 0x123a1c
movl $0x8, %edx
jmp 0xfe2ca
testb $0x40, 0x1(%r15)
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
jne 0xfe2d5
leaq 0x25783(%rip), %rsi     # 0x1239fb
movl $0x8, %edx
jmp 0xfe2ef
testb $0x40, 0x1(%r15)
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
jne 0xfe2e3
leaq 0x25779(%rip), %rsi     # 0x123a12
movl $0x9, %edx
jmp 0xfe2ef
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
leaq 0x25734(%rip), %rsi     # 0x1239e3
movl $0xa, %edx
jmp 0xfe2ca
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
leaq 0x25760(%rip), %rsi     # 0x123a25
movl $0x9, %edx
movq %r14, %rdi
movq %rbx, %rcx
callq *0x10(%rax)
jmp 0xfe2f7
leaq 0x25712(%rip), %rsi     # 0x1239ee
movl $0xc, %edx
jmp 0xfe2ef
leaq 0x2571a(%rip), %rsi     # 0x123a04
movl $0xd, %edx
movq %r14, %rdi
movq %rbx, %rcx
callq *%rax
movq 0x8(%r15), %r15
cmpq 0x110(%r14), %r15
je 0xfe34b
cmpb $0xa, (%r15)
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
jne 0xfe368
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 0x256d1(%rip), %rsi     # 0x123a2f
movl $0x3, %edx
jmp 0xfe475
movq %r14, %rdi
movl $0x28, %esi
movq %rbx, %rdx
callq *0x8(%rax)
movq 0x8(%r15), %rax
cmpb $0x1, (%rax)
jne 0xfe383
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 0xfe45d
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 0xfe3eb
movq 0x8(%rax), %rax
cmpb $0x1, (%rax)
jne 0xfe488
addq $0x8, %rax
movq %rax, %r12
jmp 0xfe408
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
leaq 0x2512b(%rip), %rsi     # 0x123525
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 0xfe45d
movq 0x10(%rax), %rax
cmpq 0x110(%r14), %rax
je 0xfe45d
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
leaq 0x21642(%rip), %rsi     # 0x11fa91
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 0x255c0(%rip), %rsi     # 0x123a30
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 0xfe40c
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
leaq 0x2558f(%rip), %rsi     # 0x123a33
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 0xfe3e2
jmp 0xfe40c