// File: /workspace/github_c_makefile_star2_O1/BernardTatin[P]s7sh/s7.c
// Function: object_to_port_with_circle_check_1
static void object_to_port_with_circle_check_1(s7_scheme *sc, s7_pointer vr, s7_pointer port, use_write_t use_write, shared_info *ci)
    {
        int32_t ref;

#if CYCLE_DEBUGGING
        char x;
        if (!base) base = &x;
        else
        {
            if (&x > base) base = &x;
            else
            {
                if ((!min_char) || (&x < min_char))
                {
                    min_char = &x;
                    if ((base - min_char) > 1000000)
                    {
                        fprintf(stderr, "infinite recursion?\n");
                        if (port_data(port))
                        {
                            fprintf(stderr, "   port contents (%ld bytes): \n", port_position(port));
                            if (port_position(port) > 10000)
                                port_data(port)[10000] = '\0';
                            else port_data(port)[port_position(port)] = '\0';
                            fprintf(stderr, "%s\n", port_data(port));
                        }
                        abort();
                    }
                }
            }
        }
#endif

        ref = (is_collected(vr)) ? shared_ref(ci, vr) : 0;
        if (ref != 0)
        {
            char buf[32];
            int32_t nlen;
            char *p;
            s7_int len;

            if (ref > 0)
            {
                if (use_write == P_READABLE)
                {
                    if (ci->defined[ref])
                    {
                        flip_ref(ci, vr);
                        nlen = catstrs_direct(buf, "<", pos_int_to_str_direct(sc, ref), ">", NULL);
                        port_write_string(port)(sc, buf, nlen, port);
                        return;
                    }
                    object_to_port(sc, vr, port, P_READABLE, ci);
                }
                else
                {
                    /* "normal" printout involving #n= and #n# */
                    p = pos_int_to_str(sc, (s7_int)ref, &len, '=');
                    *--p = '#';
                    port_write_string(port)(sc, p, len, port);
                    object_to_port(sc, vr, port, NOT_P_DISPLAY(use_write), ci);
                }
            }
            else
            {
                if (use_write == P_READABLE)
                {
                    nlen = catstrs_direct(buf, "<", pos_int_to_str_direct(sc, -ref), ">", NULL);
                    port_write_string(port)(sc, buf, nlen, port);
                }
                else
                {
                    p = pos_int_to_str(sc, (s7_int)(-ref), &len, '#');
                    *--p = '#';
                    port_write_string(port)(sc, p, len, port);
                }
            }
        }
        else object_to_port(sc, vr, port, use_write, ci);
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %r8, %r15
movl %ecx, %ebp
movq %rdx, %rbx
movq %rsi, %r12
movq %rdi, %r14
xorl %ecx, %ecx
testb $0x2, 0x2(%rsi)
je 0x9c087
movslq 0xc(%r15), %rdx
testq %rdx, %rdx
jle 0x9c087
movq (%r15), %rcx
xorl %eax, %eax
cmpq %r12, (%rcx,%rax,8)
je 0x9c075
incq %rax
cmpq %rax, %rdx
jne 0x9c063
xorl %ecx, %ecx
jmp 0x9c087
movq 0x20(%r15), %rdx
movl (%rdx,%rax,4), %ecx
testl %ecx, %ecx
jle 0x9c087
movl %ecx, %esi
negl %esi
movl %esi, (%rdx,%rax,4)
testl %ecx, %ecx
je 0x9c0cf
jle 0x9c0fb
cmpl $0x2, %ebp
jne 0x9c157
movq 0x48(%r15), %rax
movl %ecx, %ecx
cmpb $0x1, (%rax,%rcx)
jne 0x9c257
movslq 0xc(%r15), %rax
testq %rax, %rax
jle 0x9c284
movq (%r15), %rsi
xorl %edx, %edx
cmpq %r12, (%rsi,%rdx,8)
je 0x9c27d
incq %rdx
cmpq %rdx, %rax
jne 0x9c0b8
jmp 0x9c284
movzbl (%r12), %eax
leaq 0xbe2a5(%rip), %rcx     # 0x15a380
movq (%rcx,%rax,8), %rax
movq %r14, %rdi
movq %r12, %rsi
movq %rbx, %rdx
movl %ebp, %ecx
movq %r15, %r8
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmpq *%rax
negl %ecx
cmpl $0x2, %ebp
jne 0x9c1e6
leaq 0xb6f(%r14), %r8
movb $0x0, 0xb6f(%r14)
leaq 0x83314(%rip), %rsi     # 0x11f430
movabsq $-0x3333333333333333, %rdi # imm = 0xCCCCCCCCCCCCCCCD
movq %rcx, %rax
mulq %rdi
shrq $0x3, %rdx
leaq (%rdx,%rdx), %rax
leaq (%rax,%rax,4), %rax
movq %rcx, %r9
subq %rax, %r9
movb (%rsi,%r9), %al
movb %al, -0x1(%r8)
decq %r8
cmpq $0x9, %rcx
movq %rdx, %rcx
ja 0x9c126
jmp 0x9c2d0
movl %ecx, %edi
leaq 0xb4d(%r14), %rsi
movw $0x3d, 0xb4e(%r14)
movl $0x2, %ecx
leaq 0x832ba(%rip), %r8      # 0x11f430
movabsq $-0x3333333333333333, %r9 # imm = 0xCCCCCCCCCCCCCCCD
movq %rdi, %rax
mulq %r9
shrq $0x3, %rdx
leaq (%rdx,%rdx), %rax
leaq (%rax,%rax,4), %rax
movq %rdi, %r10
subq %rax, %r10
movb (%r8,%r10), %al
movb %al, (%rsi)
decq %rsi
incq %rcx
cmpq $0x9, %rdi
movq %rdx, %rdi
ja 0x9c180
movb $0x23, (%rsi)
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
movq %r14, %rdi
movq %rcx, %rdx
movq %rbx, %rcx
callq *0x10(%rax)
movzbl (%r12), %eax
leaq 0xbe1b0(%rip), %r9      # 0x15a380
cmpl $0x1, %ebp
adcl $0x0, %ebp
movq %r14, %rdi
movq %r12, %rsi
movq %rbx, %rdx
movl %ebp, %ecx
jmp 0x9c271
leaq 0xb4d(%r14), %rsi
movw $0x23, 0xb4e(%r14)
movl $0x2, %r8d
leaq 0x8322c(%rip), %rdi     # 0x11f430
movabsq $-0x3333333333333333, %r9 # imm = 0xCCCCCCCCCCCCCCCD
movq %rcx, %rax
mulq %r9
shrq $0x3, %rdx
leaq (%rdx,%rdx), %rax
leaq (%rax,%rax,4), %rax
movq %rcx, %r10
subq %rax, %r10
movb (%rdi,%r10), %al
movb %al, (%rsi)
decq %rsi
incq %r8
cmpq $0x9, %rcx
movq %rdx, %rcx
ja 0x9c20e
movb $0x23, (%rsi)
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
movq %r14, %rdi
movq %r8, %rdx
movq %rbx, %rcx
callq *0x10(%rax)
jmp 0x9c309
movzbl (%r12), %eax
leaq 0xbe11d(%rip), %r9      # 0x15a380
movq %r14, %rdi
movq %r12, %rsi
movq %rbx, %rdx
movl $0x2, %ecx
movq %r15, %r8
callq *(%r9,%rax,8)
jmp 0x9c309
movq 0x20(%r15), %rax
negl (%rax,%rdx,4)
leaq 0xb6f(%r14), %r8
movb $0x0, 0xb6f(%r14)
leaq 0x83196(%rip), %rsi     # 0x11f430
movabsq $-0x3333333333333333, %rdi # imm = 0xCCCCCCCCCCCCCCCD
movq %rcx, %rax
mulq %rdi
shrq $0x3, %rdx
leaq (%rdx,%rdx), %rax
leaq (%rax,%rax,4), %rax
movq %rcx, %r9
subq %rax, %r9
movb (%rsi,%r9), %al
movb %al, -0x1(%r8)
decq %r8
cmpq $0x9, %rcx
movq %rdx, %rcx
ja 0x9c2a4
leaq 0x87484(%rip), %rsi     # 0x12375b
leaq 0x87753(%rip), %rcx     # 0x123a31
movq %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
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rcx
callq *0x10(%r8)
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq