// File: /workspace/github_c_makefile_star2_O0/BernardTatin[P]s7sh/s7.c
// Function: write_closure_readably
static void write_closure_readably(s7_scheme *sc, s7_pointer obj, s7_pointer port, shared_info *ci)
    {
        s7_pointer body, arglist, pe, local_slots, setter = NULL;
        s7_int gc_loc;

        body = closure_body(obj);
        if (sc->safety > NO_SAFETY)
        {
            if (tree_is_cyclic(sc, body))
            {
                port_write_string(port)(sc, "#<write_closure: body is cyclic>", 32, port); /* not s7_error here! */
                return;
            }
            /* perhaps: if any sequence in the closure_body is cyclic, complain, but how to check without clobbering ci?
             *   perhaps pass ci, and use make_shared_info if ci=null else continue_shared_info?
             *   this can happen only if (apply lambda ... cyclic-seq ...) I think
             *   long-term we need to include closure_body(obj) in the top object_out make_shared_info
             */
        }

        arglist = closure_args(obj);
        if (is_symbol(arglist)) arglist = list_1(sc, arglist);
        pe = closure_let(obj);

        gc_loc = s7_gc_protect_1(sc, sc->nil);
        collect_locals(sc, body, pe, arglist, gc_loc);   /* collect locals used only here (and below) */
        collect_specials(sc, pe, arglist, gc_loc);

        if (s7_is_dilambda(obj))
        {
            setter = closure_setter(obj);
            if (has_closure_let(setter))                 /* collect args etc so need the arglist */
            {
                arglist = closure_args(setter);
                if (is_symbol(arglist)) arglist = list_1(sc, arglist);
                collect_locals(sc, closure_body(setter), pe, arglist, gc_loc);
            }
        }

        local_slots = T_Lst(gc_protected_at(sc, gc_loc)); /* possibly a list of slots */
        if (!is_null(local_slots))
        {
            s7_pointer x;
            port_write_string(port)(sc, "(let (", 6, port);
            for (x = local_slots; is_pair(x); x = cdr(x))
            {
                s7_pointer slot;
                slot = car(x);
                if ((!is_any_closure(slot_value(slot))) &&    /* mutually referencing closures? ./snd -l snd-test 24 hits this in the effects dialogs */
                        ((!has_structure(slot_value(slot))) ||    /* see s7test example, vector has closure that refers to vector */
                         (slot_symbol(slot) == sc->local_signature_symbol)))
                {
                    port_write_character(port)(sc, '(', port);
                    port_write_string(port)(sc, symbol_name(slot_symbol(slot)), symbol_name_length(slot_symbol(slot)), port);
                    port_write_character(port)(sc, ' ', port);
                    /* (object->string (list (let ((local 1)) (lambda (x) (+ x local)))) :readable) */
                    object_to_port(sc, slot_value(slot), port, P_READABLE, NULL);
                    if (is_null(cdr(x)))
                        port_write_character(port)(sc, ')', port);
                    else port_write_string(port)(sc, ") ", 2, port);
                }
            }
            port_write_string(port)(sc, ") ", 2, port);
        }

        if (setter)
            port_write_string(port)(sc, "(dilambda ", 10, port);

        write_closure_readably_1(sc, obj, closure_args(obj), body, port);

        if (setter)
        {
            port_write_character(port)(sc, ' ', port);
            if (has_closure_let(setter))
                write_closure_readably_1(sc, setter, closure_args(setter), closure_body(setter), port);
            else object_to_port_with_circle_check(sc, setter, port, P_READABLE, ci);
            port_write_character(port)(sc, ')', port);
        }

        if (!is_null(local_slots))
            port_write_character(port)(sc, ')', port);
        s7_gc_unprotect_at(sc, gc_loc);
    }

// Assembly:
subq $0xa8, %rsp
movq %rdi, 0xa0(%rsp)
movq %rsi, 0x98(%rsp)
movq %rdx, 0x90(%rsp)
movq %rcx, 0x88(%rsp)
movq $0x0, 0x60(%rsp)
movq 0x98(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0x80(%rsp)
movq 0xa0(%rsp), %rax
cmpq $0x0, 0x6a0(%rax)
jle 0x1b03ca
movq 0xa0(%rsp), %rdi
movq 0x80(%rsp), %rsi
callq 0x2f870
testb $0x1, %al
jne 0x1b0391
jmp 0x1b03c8
movq 0x90(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
movq 0xa0(%rsp), %rdi
movq 0x90(%rsp), %rcx
leaq 0x42614(%rip), %rsi     # 0x1f29d0
movl $0x20, %edx
callq *%rax
jmp 0x1b0b07
jmp 0x1b03ca
movq 0x98(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x78(%rsp)
movq 0x78(%rsp), %rax
movzbl (%rax), %eax
cmpl $0xa, %eax
jne 0x1b0499
movq 0x78(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0xa0(%rsp), %rax
movq 0x110(%rax), %rax
movq %rax, 0x40(%rsp)
movq 0xa0(%rsp), %rax
movq 0x90(%rax), %rax
movq 0xa0(%rsp), %rcx
cmpq 0x98(%rcx), %rax
ja 0x1b0437
movq 0xa0(%rsp), %rdi
callq 0xc670
movq 0xa0(%rsp), %rcx
movq 0x90(%rcx), %rax
movq %rax, %rdx
addq $-0x8, %rdx
movq %rdx, 0x90(%rcx)
movq -0x8(%rax), %rax
movq %rax, 0x50(%rsp)
movq 0x50(%rsp), %rax
movq $0x200001, (%rax)       # imm = 0x200001
movq 0x48(%rsp), %rcx
movq 0x50(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x40(%rsp), %rcx
movq 0x50(%rsp), %rax
movq %rcx, 0x10(%rax)
movq 0x50(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0x38(%rsp), %rax
movq %rax, 0x78(%rsp)
movq 0x98(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x70(%rsp)
movq 0xa0(%rsp), %rdi
movq 0xa0(%rsp), %rax
movq 0x110(%rax), %rsi
callq 0x9cb0
movq %rax, 0x58(%rsp)
movq 0xa0(%rsp), %rdi
movq 0x80(%rsp), %rsi
movq 0x70(%rsp), %rdx
movq 0x78(%rsp), %rcx
movq 0x58(%rsp), %r8
callq 0x1b1070
movq 0xa0(%rsp), %rdi
movq 0x70(%rsp), %rsi
movq 0x78(%rsp), %rdx
movq 0x58(%rsp), %rcx
callq 0x1b1110
movq 0x98(%rsp), %rdi
callq 0x3c0f0
testb $0x1, %al
jne 0x1b0521
jmp 0x1b0640
movq 0x98(%rsp), %rax
movq 0x20(%rax), %rax
movq %rax, 0x60(%rsp)
movq 0x60(%rsp), %rax
movzbl (%rax), %eax
movl %eax, %ecx
leaq 0x65efd(%rip), %rax     # 0x216440
testb $0x1, (%rax,%rcx)
je 0x1b063e
movq 0x60(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x78(%rsp)
movq 0x78(%rsp), %rax
movzbl (%rax), %eax
cmpl $0xa, %eax
jne 0x1b0619
movq 0x78(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0xa0(%rsp), %rax
movq 0x110(%rax), %rax
movq %rax, 0x20(%rsp)
movq 0xa0(%rsp), %rax
movq 0x90(%rax), %rax
movq 0xa0(%rsp), %rcx
cmpq 0x98(%rcx), %rax
ja 0x1b05b7
movq 0xa0(%rsp), %rdi
callq 0xc670
movq 0xa0(%rsp), %rcx
movq 0x90(%rcx), %rax
movq %rax, %rdx
addq $-0x8, %rdx
movq %rdx, 0x90(%rcx)
movq -0x8(%rax), %rax
movq %rax, 0x30(%rsp)
movq 0x30(%rsp), %rax
movq $0x200001, (%rax)       # imm = 0x200001
movq 0x28(%rsp), %rcx
movq 0x30(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x20(%rsp), %rcx
movq 0x30(%rsp), %rax
movq %rcx, 0x10(%rax)
movq 0x30(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rax
movq %rax, 0x78(%rsp)
movq 0xa0(%rsp), %rdi
movq 0x60(%rsp), %rax
movq 0x10(%rax), %rsi
movq 0x70(%rsp), %rdx
movq 0x78(%rsp), %rcx
movq 0x58(%rsp), %r8
callq 0x1b1070
jmp 0x1b0640
movq 0xa0(%rsp), %rax
movq 0xd0(%rax), %rax
movq 0x10(%rax), %rax
movq 0x58(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x68(%rsp)
movq 0x68(%rsp), %rax
movq 0xa0(%rsp), %rcx
cmpq 0x110(%rcx), %rax
je 0x1b08f2
movq 0x90(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
movq 0xa0(%rsp), %rdi
movq 0x90(%rsp), %rcx
leaq 0x3df48(%rip), %rsi     # 0x1ee5ee
movl $0x6, %edx
callq *%rax
movq 0x68(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rax
movzbl (%rax), %eax
cmpl $0x1, %eax
jne 0x1b08c0
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rax
movzbl (%rax), %eax
movl %eax, %ecx
leaq 0x72045(%rip), %rax     # 0x222730
testb $0x1, (%rax,%rcx)
jne 0x1b08ab
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rax
movzbl (%rax), %eax
movl %eax, %ecx
leaq 0x71786(%rip), %rax     # 0x221e90
testb $0x1, (%rax,%rcx)
je 0x1b0756
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rax
movzbl (%rax), %eax
cmpl $0x15, %eax
jne 0x1b0738
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rax
movzwl 0x6(%rax), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
jne 0x1b0756
movq 0x8(%rsp), %rax
movq 0x8(%rax), %rax
movq 0xa0(%rsp), %rcx
cmpq 0x16c8(%rcx), %rax
jne 0x1b08ab
movq 0x90(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x48(%rax), %rax
movq 0x8(%rax), %rax
movq 0xa0(%rsp), %rdi
movq 0x90(%rsp), %rdx
movl $0x28, %esi
callq *%rax
movq 0x90(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
movq 0xa0(%rsp), %rdi
movq 0x8(%rsp), %rcx
movq 0x8(%rcx), %rcx
movq 0x8(%rcx), %rcx
movq 0x10(%rcx), %rsi
movq 0x8(%rsp), %rcx
movq 0x8(%rcx), %rcx
movq 0x8(%rcx), %rcx
movq 0x8(%rcx), %rdx
movq 0x90(%rsp), %rcx
callq *%rax
movq 0x90(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x48(%rax), %rax
movq 0x8(%rax), %rax
movq 0xa0(%rsp), %rdi
movq 0x90(%rsp), %rdx
movl $0x20, %esi
callq *%rax
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rax
movzbl (%rax), %eax
movl %eax, %ecx
leaq 0x716c7(%rip), %rax     # 0x221ed0
movq (%rax,%rcx,8), %rax
movq 0xa0(%rsp), %rdi
movq 0x8(%rsp), %rcx
movq 0x10(%rcx), %rsi
movq 0x90(%rsp), %rdx
movl $0x2, %ecx
xorl %r8d, %r8d
callq *%rax
movq 0x10(%rsp), %rax
movq 0x10(%rax), %rax
movq 0xa0(%rsp), %rcx
cmpq 0x110(%rcx), %rax
jne 0x1b0877
movq 0x90(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x48(%rax), %rax
movq 0x8(%rax), %rax
movq 0xa0(%rsp), %rdi
movq 0x90(%rsp), %rdx
movl $0x29, %esi
callq *%rax
jmp 0x1b08a9
movq 0x90(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
movq 0xa0(%rsp), %rdi
movq 0x90(%rsp), %rcx
leaq 0x41e39(%rip), %rsi     # 0x1f26db
movl $0x2, %edx
callq *%rax
jmp 0x1b08ab
jmp 0x1b08ad
movq 0x10(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
jmp 0x1b06b7
movq 0x90(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
movq 0xa0(%rsp), %rdi
movq 0x90(%rsp), %rcx
leaq 0x41df0(%rip), %rsi     # 0x1f26db
movl $0x2, %edx
callq *%rax
cmpq $0x0, 0x60(%rsp)
je 0x1b092c
movq 0x90(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
movq 0xa0(%rsp), %rdi
movq 0x90(%rsp), %rcx
leaq 0x420cc(%rip), %rsi     # 0x1f29f1
movl $0xa, %edx
callq *%rax
movq 0xa0(%rsp), %rdi
movq 0x98(%rsp), %rsi
movq 0x98(%rsp), %rax
movq 0x8(%rax), %rdx
movq 0x80(%rsp), %rcx
movq 0x90(%rsp), %r8
callq 0x1b11d0
cmpq $0x0, 0x60(%rsp)
je 0x1b0ab4
movq 0x90(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x48(%rax), %rax
movq 0x8(%rax), %rax
movq 0xa0(%rsp), %rdi
movq 0x90(%rsp), %rdx
movl $0x20, %esi
callq *%rax
movq 0x60(%rsp), %rax
movzbl (%rax), %eax
movl %eax, %ecx
leaq 0x65a9b(%rip), %rax     # 0x216440
testb $0x1, (%rax,%rcx)
je 0x1b09dc
movq 0xa0(%rsp), %rdi
movq 0x60(%rsp), %rsi
movq 0x60(%rsp), %rax
movq 0x8(%rax), %rdx
movq 0x60(%rsp), %rax
movq 0x10(%rax), %rcx
movq 0x90(%rsp), %r8
callq 0x1b11d0
jmp 0x1b0a89
jmp 0x1b09de
movq 0x60(%rsp), %rax
movq %rax, (%rsp)
cmpq $0x0, 0x88(%rsp)
je 0x1b0a4e
movq (%rsp), %rax
movzbl (%rax), %eax
movl %eax, %ecx
leaq 0x7148e(%rip), %rax     # 0x221e90
testb $0x1, (%rax,%rcx)
je 0x1b0a4e
movq (%rsp), %rax
movzbl (%rax), %eax
cmpl $0x15, %eax
jne 0x1b0a26
movq (%rsp), %rax
movzwl 0x6(%rax), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
jne 0x1b0a4e
movq 0xa0(%rsp), %rdi
movq (%rsp), %rsi
movq 0x90(%rsp), %rdx
movq 0x88(%rsp), %r8
movl $0x2, %ecx
callq 0xd0220
jmp 0x1b0a85
movq (%rsp), %rax
movzbl (%rax), %eax
movl %eax, %ecx
leaq 0x71472(%rip), %rax     # 0x221ed0
movq (%rax,%rcx,8), %rax
movq 0xa0(%rsp), %rdi
movq (%rsp), %rsi
movq 0x90(%rsp), %rdx
movq 0x88(%rsp), %r8
movl $0x2, %ecx
callq *%rax
jmp 0x1b0a87
jmp 0x1b0a89
movq 0x90(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x48(%rax), %rax
movq 0x8(%rax), %rax
movq 0xa0(%rsp), %rdi
movq 0x90(%rsp), %rdx
movl $0x29, %esi
callq *%rax
movq 0x68(%rsp), %rax
movq 0xa0(%rsp), %rcx
cmpq 0x110(%rcx), %rax
je 0x1b0af5
movq 0x90(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x48(%rax), %rax
movq 0x8(%rax), %rax
movq 0xa0(%rsp), %rdi
movq 0x90(%rsp), %rdx
movl $0x29, %esi
callq *%rax
movq 0xa0(%rsp), %rdi
movq 0x58(%rsp), %rsi
callq 0x9f60
addq $0xa8, %rsp
retq
nop