// File: /workspace/github_c_makefile_star2_O2/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 %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r8, %r15
movl %ecx, %ebp
movq %rdx, %rbx
movq %rsi, %r12
movq %rdi, %r14
movq (%rsi), %rax
btl $0x11, %eax
jb 0x778c3
movzbl %al, %eax
leaq 0xa9adf(%rip), %rcx     # 0x121380
movq (%rcx,%rax,8), %rax
movq %r14, %rdi
movq %r12, %rsi
movq %rbx, %rdx
movl %ebp, %ecx
movq %r15, %r8
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *%rax
movq (%r15), %rcx
movl 0xc(%r15), %edx
xorl %esi, %esi
testl %edx, %edx
cmovlel %esi, %edx
cmpq %rsi, %rdx
je 0x77897
leaq 0x1(%rsi), %rdi
cmpq %r12, (%rcx,%rsi,8)
movq %rdi, %rsi
jne 0x778d1
movq 0x20(%r15), %rcx
movslq -0x4(%rcx,%rdi,4), %r13
testq %r13, %r13
jle 0x7791b
movl %r13d, %eax
negl %eax
movl %eax, -0x4(%rcx,%rdi,4)
cmpl $0x2, %ebp
jne 0x77978
movq 0x48(%r15), %rax
cmpb $0x1, (%rax,%r13)
jne 0x779ca
movq %r15, %rdi
movq %r12, %rsi
callq 0x77c75
jmp 0x77930
testl %r13d, %r13d
je 0x77897
negl %r13d
cmpl $0x2, %ebp
jne 0x779f8
movq %r14, %rdi
movq %r13, %rsi
callq 0x91f9
leaq 0x6eec9(%rip), %rsi     # 0xe680b
leaq 0x6f198(%rip), %rcx     # 0xe6ae1
leaq 0x10(%rsp), %r15
movq %r15, %rdi
movq %rax, %rdx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0xb3a5
movq 0x8(%rbx), %rcx
movq 0x48(%rcx), %r8
movslq %eax, %rdx
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rcx
callq *0x10(%r8)
jmp 0x779e9
leaq 0x8(%rsp), %rdx
pushq $0x3d
popq %rcx
movq %r14, %rdi
movq %r13, %rsi
movq %rdx, %r13
callq 0x77c9e
movb $0x23, -0x1(%rax)
leaq -0x1(%rax), %rsi
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
movq (%r13), %rdx
movq %r14, %rdi
movq %rbx, %rcx
callq *0x10(%rax)
movzbl (%r12), %eax
leaq 0xa99c9(%rip), %r9      # 0x121380
cmpl $0x1, %ebp
adcl $0x0, %ebp
movq %r14, %rdi
movq %r12, %rsi
movq %rbx, %rdx
movl %ebp, %ecx
jmp 0x779e2
movzbl (%r12), %eax
leaq 0xa99aa(%rip), %r9      # 0x121380
pushq $0x2
popq %rcx
movq %r14, %rdi
movq %r12, %rsi
movq %rbx, %rdx
movq %r15, %r8
callq *(%r9,%rax,8)
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x8(%rsp), %r15
pushq $0x23
popq %rcx
movq %r14, %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0x77c9e
movb $0x23, -0x1(%rax)
leaq -0x1(%rax), %rsi
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
movq (%r15), %rdx
movq %r14, %rdi
movq %rbx, %rcx
callq *0x10(%rax)
jmp 0x779e9