// File: /workspace/github_c_makefile_star2_O1/BernardTatin[P]s7sh/s7.c
// Function: c_object_to_port
static void c_object_to_port(s7_scheme *sc, s7_pointer obj, s7_pointer port, use_write_t use_write, shared_info *ci)
    {
#if (!DISABLE_DEPRECATED)
        if (c_object_print(sc, obj))
        {
            char *str;
            str = ((*(c_object_print(sc, obj)))(sc, c_object_value(obj)));
            port_display(port)(sc, str, port);
            free(str);
            return;
        }
#endif
        if (c_object_to_string(sc, obj))
            port_display(port)(sc, s7_string((*(c_object_to_string(sc, obj)))(sc, set_plist_2(sc, obj, (use_write == P_READABLE) ? sc->key_readable_symbol : sc->T))), port);
        else
        {
            if ((use_write == P_READABLE) &&
                    (c_object_to_list(sc, obj)) &&  /* to_list and (implicit) set are needed to reconstruct a cyclic c-object, as well as the maker (via type name) */
                    (c_object_set(sc, obj)))
            {
                s7_pointer obj_list, old_w, p;
                int32_t href;

                obj_list = ((*(c_object_to_list(sc, obj)))(sc, set_plist_1(sc, obj)));
                old_w = sc->w;
                sc->w = obj_list;

                if ((ci) &&
                        (is_cyclic(obj)) &&
                        ((href = peek_shared_ref(ci, obj)) != 0))
                {
                    int32_t i;
                    if (href < 0) href = -href;
                    if ((ci->defined[href]) || (port == ci->cycle_port))
                    {
                        int32_t nlen;
                        char buf[128];
                        nlen = catstrs_direct(buf, "<", pos_int_to_str_direct(sc, href), ">", NULL);
                        port_write_string(port)(sc, buf, nlen, port);
                        return;
                    }

                    port_write_character(port)(sc, '(', port);
                    c_object_name_to_port(sc, obj, port);
                    for (i = 0, p = obj_list; is_pair(p); i++, p = cdr(p))
                    {
                        s7_pointer val;
                        val = car(p);
                        if (has_structure(val))
                        {
                            char buf[128];
                            int32_t symref, len;

                            port_write_string(port)(sc, " #f", 3, port);
                            len = catstrs_direct(buf, "  (set! (<", pos_int_to_str_direct(sc, href), "> ", pos_int_to_str_direct_1(sc, i), ") ", NULL);
                            port_write_string(ci->cycle_port)(sc, buf, len, ci->cycle_port);

                            symref = peek_shared_ref(ci, val);
                            if (symref != 0)
                            {
                                if (symref < 0) symref = -symref;
                                len = catstrs_direct(buf, "<", pos_int_to_str_direct(sc, symref), ">)\n", NULL);
                                port_write_string(ci->cycle_port)(sc, buf, len, ci->cycle_port);
                            }
                            else
                            {
                                object_to_port_with_circle_check(sc, val, ci->cycle_port, P_READABLE, ci);
                                port_write_string(ci->cycle_port)(sc, ")\n", 2, ci->cycle_port);
                            }
                        }
                        else
                        {
                            port_write_character(port)(sc, ' ', port);
                            object_to_port_with_circle_check(sc, val, port, P_READABLE, ci);
                        }
                    }
                }
                else
                {
                    port_write_character(port)(sc, '(', port);
                    c_object_name_to_port(sc, obj, port);
                    for (p = obj_list; is_pair(p); p = cdr(p))
                    {
                        s7_pointer val;
                        val = car(p);
                        port_write_character(port)(sc, ' ', port);
                        object_to_port_with_circle_check(sc, val, port, P_READABLE, ci);
                    }
                }
                port_write_character(port)(sc, ')', port);
                sc->w = old_w;
            }
            else
            {
                char buf[128];
                int32_t nlen;
                port_write_string(port)(sc, "#<", 2, port);
                c_object_name_to_port(sc, obj, port);
                nlen = snprintf(buf, 128, " %p>", obj);
                port_write_string(port)(sc, buf, nlen, port);
            }
        }
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rdx, %rbx
movq %rsi, %rbp
movq %rdi, %r14
movq 0x8d8(%rdi), %rax
movq 0x8(%rsi), %rdx
movq (%rax,%rdx,8), %rdx
movq 0x40(%rdx), %rax
testq %rax, %rax
je 0xfc291
movq 0x10(%rbp), %rsi
movq %r14, %rdi
callq *%rax
movq %rax, %r15
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq *0x40(%rax)
movq %r15, %rdi
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x9050
movq 0x80(%rdx), %rax
testq %rax, %rax
je 0xfc303
movq 0x8(%rbx), %rdx
movq 0x48(%rdx), %rdx
movq 0x40(%rdx), %r15
leaq 0x118(%r14), %rdx
leaq 0x18a0(%r14), %rsi
cmpl $0x2, %ecx
cmoveq %rsi, %rdx
movq (%rdx), %rcx
movq 0x708(%r14), %rdx
movq %rbp, 0x8(%rdx)
movq 0x710(%r14), %rdx
movq %rcx, 0x8(%rdx)
movq 0x708(%r14), %rsi
movq %r14, %rdi
callq *%rax
movq 0x10(%rax), %rsi
movq %r14, %rdi
movq %rbx, %rdx
movq %r15, %rax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *%rax
cmpl $0x2, %ecx
jne 0xfc391
movq 0x78(%rdx), %rax
testq %rax, %rax
je 0xfc391
cmpq $0x0, 0x50(%rdx)
je 0xfc391
movq %r8, %r15
movq 0x700(%r14), %rcx
movq %rbp, 0x8(%rcx)
movq 0x700(%r14), %rsi
movq %r14, %rdi
callq *%rax
movq %rax, %r12
movq 0x4d8(%r14), %rsi
movq %rax, 0x4d8(%r14)
testq %r15, %r15
je 0xfc7be
testb $0x20, 0x6(%rbp)
je 0xfc7be
xorl %eax, %eax
testb $0x2, 0x2(%rbp)
je 0xfc429
movslq 0xc(%r15), %rcx
testq %rcx, %rcx
jle 0xfc429
movq (%r15), %rdx
xorl %eax, %eax
cmpq %rbp, (%rdx,%rax,8)
je 0xfc422
incq %rax
cmpq %rax, %rcx
jne 0xfc378
xorl %eax, %eax
jmp 0xfc429
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
leaq 0x27761(%rip), %rsi     # 0x123b01
movl $0x2, %edx
movq %r14, %rdi
movq %rbx, %rcx
callq *0x10(%rax)
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
movq 0x8d8(%r14), %rcx
movq 0x8(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movq 0x10(%rcx), %rcx
movq 0x8(%rcx), %rdx
movq 0x10(%rcx), %rsi
movq %r14, %rdi
movq %rbx, %rcx
callq *0x10(%rax)
leaq 0x276c4(%rip), %rdx     # 0x123aa5
leaq 0x30(%rsp), %r15
movl $0x80, %esi
movq %r15, %rdi
movq %rbp, %rcx
xorl %eax, %eax
callq 0x9210
movq 0x8(%rbx), %rcx
movq 0x48(%rcx), %r8
movslq %eax, %rdx
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rcx
callq *0x10(%r8)
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x20(%r15), %rcx
movl (%rcx,%rax,4), %eax
testl %eax, %eax
je 0xfc7be
movl %eax, %r13d
negl %r13d
cmovsl %eax, %r13d
movq 0x48(%r15), %rax
cmpb $0x0, (%rax,%r13)
jne 0xfc8b9
cmpq %rbx, 0x28(%r15)
je 0xfc8b9
movq %rsi, 0x18(%rsp)
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
movq %r14, %rdi
movl $0x28, %esi
movq %rbx, %rdx
callq *0x8(%rax)
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
movq 0x8d8(%r14), %rcx
movq 0x8(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movq 0x10(%rcx), %rcx
movq 0x8(%rcx), %rdx
movq 0x10(%rcx), %rsi
movq %r14, %rdi
movq %rbx, %rcx
callq *0x10(%rax)
cmpb $0x1, (%r12)
jne 0xfc892
leaq 0xb6f(%r14), %rax
movq %rax, 0x8(%rsp)
leaq 0xb8f(%r14), %rax
movq %rax, 0x20(%rsp)
leaq 0x22f6b(%rip), %rbp     # 0x11f430
movq $0x0, 0x10(%rsp)
movq 0x8(%r12), %rdx
movzbl (%rdx), %eax
leaq 0x5de63(%rip), %rcx     # 0x15a340
cmpb $0x1, (%rax,%rcx)
jne 0xfc613
cmpb $0x15, %al
jne 0xfc4f5
testb $0x1, 0x7(%rdx)
jne 0xfc613
movq %rdx, 0x28(%rsp)
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
movl $0x3, %edx
movq %r14, %rdi
leaq 0x18699(%rip), %rsi     # 0x114baa
movq %rbx, %rcx
callq *0x10(%rax)
movb $0x0, 0xb6f(%r14)
movq 0x8(%rsp), %rcx
movq %r13, %rsi
movabsq $-0x3333333333333333, %r8 # imm = 0xCCCCCCCCCCCCCCCD
movq %rsi, %rax
mulq %r8
shrq $0x3, %rdx
leaq (%rdx,%rdx), %rax
leaq (%rax,%rax,4), %rax
movq %rsi, %rdi
subq %rax, %rdi
movb (%rbp,%rdi), %al
movb %al, -0x1(%rcx)
decq %rcx
cmpq $0x9, %rsi
movq %rdx, %rsi
ja 0xfc531
movq 0x20(%rsp), %r8
movb $0x0, (%r8)
movq 0x10(%rsp), %rsi
movabsq $0x6666666666666667, %r9 # imm = 0x6666666666666667
movq %rsi, %rax
imulq %r9
movq %rdx, %rax
shrq $0x3f, %rax
sarq $0x2, %rdx
addq %rax, %rdx
leaq (%rdx,%rdx), %rax
leaq (%rax,%rax,4), %rax
movq %rsi, %rdi
subq %rax, %rdi
movb (%rbp,%rdi), %al
movb %al, -0x1(%r8)
decq %r8
addq $0x9, %rsi
cmpq $0x12, %rsi
movq %rdx, %rsi
ja 0xfc574
movq $0x0, (%rsp)
leaq 0x30(%rsp), %rdi
leaq 0x26ed2(%rip), %rsi     # 0x123494
movq %rcx, %rdx
leaq 0x23463(%rip), %rcx     # 0x11fa2f
leaq 0x270d2(%rip), %r9      # 0x1236a5
xorl %eax, %eax
callq 0xd1cb
movq 0x28(%r15), %rcx
movq 0x8(%rcx), %rdx
movq 0x48(%rdx), %r8
movslq %eax, %rdx
movq %r14, %rdi
leaq 0x30(%rsp), %rsi
callq *0x10(%r8)
movq 0x28(%rsp), %rsi
testb $0x2, 0x2(%rsi)
jne 0xfc688
movabsq $-0x3333333333333333, %r8 # imm = 0xCCCCCCCCCCCCCCCD
jmp 0xfc6b2
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
movq %r14, %rdi
movq %rdx, %rbp
movl $0x20, %esi
movq %rbx, %rdx
callq *0x8(%rax)
movzbl (%rbp), %eax
leaq 0x5dd09(%rip), %rcx     # 0x15a340
cmpb $0x1, (%rax,%rcx)
jne 0xfc660
cmpl $0x15, %eax
jne 0xfc648
testb $0x1, 0x7(%rbp)
jne 0xfc660
movq %r14, %rdi
movq %rbp, %rsi
movq %rbx, %rdx
movl $0x2, %ecx
movq %r15, %r8
callq 0x9c033
jmp 0xfc67c
movq %r14, %rdi
movq %rbp, %rsi
movq %rbx, %rdx
movl $0x2, %ecx
movq %r15, %r8
leaq 0x5dd08(%rip), %r9      # 0x15a380
callq *(%r9,%rax,8)
leaq 0x22dad(%rip), %rbp     # 0x11f430
jmp 0xfc798
movslq 0xc(%r15), %rax
testq %rax, %rax
movabsq $-0x3333333333333333, %r8 # imm = 0xCCCCCCCCCCCCCCCD
jle 0xfc6b2
movq (%r15), %rdx
xorl %ecx, %ecx
cmpq %rsi, (%rdx,%rcx,8)
je 0xfc7b2
incq %rcx
cmpq %rcx, %rax
jne 0xfc6a0
xorl %eax, %eax
testl %eax, %eax
je 0xfc72f
movl %eax, %esi
negl %esi
cmovsl %eax, %esi
movq 0x8(%rsp), %rcx
movb $0x0, (%rcx)
movq %rsi, %rax
mulq %r8
shrq $0x3, %rdx
leaq (%rdx,%rdx), %rax
leaq (%rax,%rax,4), %rax
movq %rsi, %rdi
subq %rax, %rdi
movb (%rbp,%rdi), %al
movb %al, -0x1(%rcx)
decq %rcx
cmpq $0x9, %rsi
movq %rdx, %rsi
ja 0xfc6c7
leaq 0x30(%rsp), %rdi
leaq 0x2705d(%rip), %rsi     # 0x12375b
movq %rcx, %rdx
leaq 0x26da0(%rip), %rcx     # 0x1234a8
xorl %r8d, %r8d
xorl %eax, %eax
callq 0xd1cb
movq 0x28(%r15), %rcx
movq 0x8(%rcx), %rdx
movq 0x48(%rdx), %r8
movslq %eax, %rdx
movq %r14, %rdi
leaq 0x30(%rsp), %rsi
callq *0x10(%r8)
jmp 0xfc798
movzbl (%rsi), %eax
leaq 0x5dc07(%rip), %rcx     # 0x15a340
cmpb $0x1, (%rax,%rcx)
jne 0xfc760
cmpl $0x15, %eax
jne 0xfc74a
testb $0x1, 0x7(%rsi)
jne 0xfc760
movq 0x28(%r15), %rdx
movq %r14, %rdi
movl $0x2, %ecx
movq %r15, %r8
callq 0x9c033
jmp 0xfc77a
movq 0x28(%r15), %rdx
movq %r14, %rdi
movl $0x2, %ecx
movq %r15, %r8
leaq 0x5dc0a(%rip), %r9      # 0x15a380
callq *(%r9,%rax,8)
movq 0x28(%r15), %rcx
movq 0x8(%rcx), %rax
movq 0x48(%rax), %rax
movl $0x2, %edx
movq %r14, %rdi
leaq 0x26d34(%rip), %rsi     # 0x1234c9
callq *0x10(%rax)
incq 0x10(%rsp)
movq 0x10(%r12), %r12
cmpb $0x1, (%r12)
je 0xfc4ce
jmp 0xfc892
movq 0x20(%r15), %rax
movl (%rax,%rcx,4), %eax
jmp 0xfc6b4
movq %rsi, 0x18(%rsp)
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
movq %r14, %rdi
movl $0x28, %esi
movq %rbx, %rdx
callq *0x8(%rax)
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
movq 0x8d8(%r14), %rcx
movq 0x8(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movq 0x10(%rcx), %rcx
movq 0x8(%rcx), %rdx
movq 0x10(%rcx), %rsi
movq %r14, %rdi
movq %rbx, %rcx
callq *0x10(%rax)
cmpb $0x1, (%r12)
jne 0xfc892
leaq 0x5db69(%rip), %rbp     # 0x15a380
movq 0x8(%r12), %r13
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
movq %r14, %rdi
movl $0x20, %esi
movq %rbx, %rdx
callq *0x8(%rax)
testq %r15, %r15
je 0xfc86c
movzbl (%r13), %eax
leaq 0x5dafd(%rip), %rcx     # 0x15a340
cmpb $0x1, (%rax,%rcx)
jne 0xfc86c
cmpb $0x15, %al
jne 0xfc854
testb $0x1, 0x7(%r13)
jne 0xfc86c
movq %r14, %rdi
movq %r13, %rsi
movq %rbx, %rdx
movl $0x2, %ecx
movq %r15, %r8
callq 0x9c033
jmp 0xfc886
movzbl (%r13), %eax
movq %r14, %rdi
movq %r13, %rsi
movq %rbx, %rdx
movl $0x2, %ecx
movq %r15, %r8
callq *(%rbp,%rax,8)
movq 0x10(%r12), %r12
cmpb $0x1, (%r12)
je 0xfc817
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
movq %r14, %rdi
movl $0x29, %esi
movq %rbx, %rdx
callq *0x8(%rax)
movq 0x18(%rsp), %rax
movq %rax, 0x4d8(%r14)
jmp 0xfc410
leaq 0xb6f(%r14), %r8
movb $0x0, 0xb6f(%r14)
leaq 0x22b61(%rip), %rcx     # 0x11f430
movabsq $-0x3333333333333333, %rsi # imm = 0xCCCCCCCCCCCCCCCD
movq %r13, %rax
mulq %rsi
shrq $0x3, %rdx
leaq (%rdx,%rdx), %rax
leaq (%rax,%rax,4), %rax
movq %r13, %rdi
subq %rax, %rdi
movb (%rcx,%rdi), %al
movb %al, -0x1(%r8)
decq %r8
cmpq $0x9, %r13
movq %rdx, %r13
ja 0xfc8d9
leaq 0x26e50(%rip), %rsi     # 0x12375b
leaq 0x2711f(%rip), %rcx     # 0x123a31
leaq 0x30(%rsp), %r15
movq %r15, %rdi
movq %r8, %rdx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0xd1cb
movq 0x8(%rbx), %rcx
movq 0x48(%rcx), %r8
movslq %eax, %rdx
jmp 0xfc403