// File: /workspace/github_c_makefile_star2_O3/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, %r12
movl %ecx, %ebp
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
movq (%rsi), %rdx
btl $0x11, %edx
jae 0x959ac
movslq 0xc(%r12), %rcx
testq %rcx, %rcx
jle 0x959ac
movq (%r12), %rax
xorl %edi, %edi
cmpq %r15, (%rax,%rdi,8)
je 0x959d6
incq %rdi
cmpq %rdi, %rcx
jne 0x9599e
movzbl %dl, %eax
leaq 0xbc9ca(%rip), %rcx     # 0x152380
movq (%rcx,%rax,8), %rax
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
movl %ebp, %ecx
movq %r12, %r8
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmpq *%rax
movq 0x20(%r12), %rsi
movslq (%rsi,%rdi,4), %rcx
testq %rcx, %rcx
jle 0x95a2a
movl %ecx, %edx
negl %edx
movl %edx, (%rsi,%rdi,4)
cmpl $0x2, %ebp
jne 0x95a8e
movq 0x48(%r12), %rdx
cmpb $0x1, (%rdx,%rcx)
jne 0x95b18
movslq 0xc(%r12), %rdx
testq %rdx, %rdx
jle 0x95bb1
xorl %edi, %edi
cmpq %r15, (%rax,%rdi,8)
je 0x95bae
incq %rdi
cmpq %rdi, %rdx
jne 0x95a13
jmp 0x95bb1
testl %ecx, %ecx
je 0x959ac
negl %ecx
cmpl $0x2, %ebp
jne 0x95b3d
leaq 0xb6f(%r14), %r8
movb $0x0, 0xb6f(%r14)
leaq 0x80aed(%rip), %rsi     # 0x116540
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 0x95a5d
jmp 0x95bfd
leaq 0xb4d(%r14), %rsi
movw $0x3d, 0xb4e(%r14)
movl $0x2, %r8d
leaq 0x80a94(%rip), %rdi     # 0x116540
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 0x95ab6
movb $0x23, (%rsi)
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
movq %r14, %rdi
movq %r8, %rdx
movq %rbx, %rcx
callq *0x10(%rax)
movzbl (%r15), %eax
leaq 0xbc87b(%rip), %r9      # 0x152380
cmpl $0x1, %ebp
adcl $0x0, %ebp
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
movl %ebp, %ecx
jmp 0x95b31
movzbl (%r15), %eax
leaq 0xbc85d(%rip), %r9      # 0x152380
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
movl $0x2, %ecx
movq %r12, %r8
callq *(%r9,%rax,8)
jmp 0x95c36
leaq 0xb4d(%r14), %rsi
movw $0x23, 0xb4e(%r14)
movl $0x2, %r8d
leaq 0x809e5(%rip), %rdi     # 0x116540
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 0x95b65
movb $0x23, (%rsi)
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
movq %r14, %rdi
movq %r8, %rdx
movq %rbx, %rcx
callq *0x10(%rax)
jmp 0x95c36
negl (%rsi,%rdi,4)
leaq 0xb6f(%r14), %r8
movb $0x0, 0xb6f(%r14)
leaq 0x80979(%rip), %rsi     # 0x116540
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 0x95bd1
leaq 0x84c67(%rip), %rsi     # 0x11a86b
leaq 0x84f36(%rip), %rcx     # 0x11ab41
movq %rsp, %r15
movq %r15, %rdi
movq %r8, %rdx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0xc442
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