// File: /workspace/github_c_makefile_star2_O3/BernardTatin[P]s7sh/s7.c
// Function: string_to_port
static void string_to_port(s7_scheme *sc, s7_pointer obj, s7_pointer port, use_write_t use_write, shared_info *ignored)
    {
        if ((use_write == P_READABLE) &&
                (is_immutable_string(obj)))
            port_write_string(port)(sc, "(immutable! ", 12, port);

        if (string_length(obj) > 0)
        {
            /* since string_length is a scheme length, not C, this write can embed nulls from C's point of view */
            if (string_length(obj) > 1000) /* was 10000 28-Feb-18 */
            {
                size_t size;
                char buf[128];
                buf[0] = string_value(obj)[0];
                buf[1] = '\0';
                size = strspn((const char *)(string_value(obj) + 1), buf); /* if all #\null, this won't work */
                if (size == (size_t)(string_length(obj) - 1))
                {
                    int32_t nlen;
                    s7_pointer c;
                    c = chars[(int32_t)((uint8_t)(buf[0]))];
                    nlen = catstrs_direct(buf, "(make-string ", pos_int_to_str_direct(sc, string_length(obj)), " ", NULL);
                    port_write_string(port)(sc, buf, nlen, port);
                    port_write_string(port)(sc, character_name(c), character_name_length(c), port);
                    port_write_character(port)(sc, ')', port);
                    if ((use_write == P_READABLE) &&
                            (is_immutable_string(obj)))
                        port_write_character(port)(sc, ')', port);
                    return;
                }
            }
            if (use_write == P_DISPLAY)
                port_write_string(port)(sc, string_value(obj), string_length(obj), port);
            else
            {
                if (!string_needs_slashification(string_value(obj), string_length(obj)))
                {
                    port_write_character(port)(sc, '"', port);
                    port_write_string(port)(sc, string_value(obj), string_length(obj), port);
                    port_write_character(port)(sc, '"', port);
                }
                else slashify_string_to_port(sc, port, string_value(obj), string_length(obj), IN_QUOTES);
            }
        }
        else
        {
            if (use_write != P_DISPLAY)
                port_write_string(port)(sc, "\"\"", 2, port);
        }
        if ((use_write == P_READABLE) &&
                (is_immutable_string(obj)))
            port_write_character(port)(sc, ')', port);
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movl %ecx, %ebp
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
cmpl $0x2, %ecx
jne 0xf2283
testb $0x1, 0x3(%r15)
je 0xf2283
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
leaq 0x248cf(%rip), %rsi     # 0x116b44
movl $0xc, %edx
movq %r14, %rdi
movq %rbx, %rcx
callq *0x10(%rax)
movq 0x8(%r15), %r12
testq %r12, %r12
jle 0xf2439
cmpq $0x3e9, %r12            # imm = 0x3E9
jb 0xf23c3
movq 0x10(%r15), %rdi
movzbl (%rdi), %r13d
movq %rsp, %rsi
movb %r13b, (%rsi)
movb $0x0, 0x1(%rsi)
incq %rdi
callq 0x82d0
leaq -0x1(%r12), %rcx
cmpq %rcx, %rax
jne 0xf23c3
movq 0x5878c(%rip), %rax     # 0x14aa58
movq (%rax,%r13,8), %r13
leaq 0xb6f(%r14), %r8
movb $0x0, 0xb6f(%r14)
leaq 0x2425a(%rip), %rcx     # 0x116540
movabsq $0x6666666666666667, %rsi # imm = 0x6666666666666667
movq %r12, %rax
imulq %rsi
movq %rdx, %rax
shrq $0x3f, %rax
sarq $0x2, %rdx
addq %rax, %rdx
leaq (%rdx,%rdx), %rax
leaq (%rax,%rax,4), %rax
movq %r12, %rdi
subq %rax, %rdi
movb (%rcx,%rdi), %al
movb %al, -0x1(%r8)
decq %r8
addq $0x9, %r12
cmpq $0x12, %r12
movq %rdx, %r12
ja 0xf22f0
leaq 0x2876c(%rip), %rsi     # 0x11aa9c
leaq 0x2827f(%rip), %rcx     # 0x11a5b6
movq %rsp, %r12
movq %r12, %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 %r12, %rsi
movq %rbx, %rcx
callq *0x10(%r8)
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
movslq 0xc(%r13), %rdx
addq $0x15, %r13
movq %r14, %rdi
movq %r13, %rsi
movq %rbx, %rcx
callq *0x10(%rax)
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
movq %r14, %rdi
movl $0x29, %esi
movq %rbx, %rdx
callq *0x8(%rax)
cmpl $0x2, %ebp
jne 0xf24a8
testb $0x1, 0x3(%r15)
je 0xf24a8
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
movq %r14, %rdi
movl $0x29, %esi
movq %rbx, %rdx
callq *0x8(%rax)
jmp 0xf24a8
testl %ebp, %ebp
je 0xf245c
movq 0x10(%r15), %rdx
leaq (%rdx,%r12), %rax
leaq 0x63986(%rip), %rcx     # 0x155d60
movq %rdx, %rsi
movzbl (%rsi), %edi
cmpb $0x0, (%rdi,%rcx)
jne 0xf2488
incq %rsi
cmpq %rax, %rsi
jb 0xf23dd
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
movq %r14, %rdi
movl $0x22, %esi
movq %rbx, %rdx
callq *0x8(%rax)
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
movq 0x8(%r15), %rdx
movq 0x10(%r15), %rsi
movq %r14, %rdi
movq %rbx, %rcx
callq *0x10(%rax)
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
movq %r14, %rdi
movl $0x22, %esi
movq %rbx, %rdx
callq *0x8(%rax)
jmp 0xf249c
testl %ebp, %ebp
je 0xf24a8
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
leaq 0x283c2(%rip), %rsi     # 0x11a80e
movl $0x2, %edx
movq %r14, %rdi
movq %rbx, %rcx
callq *0x10(%rax)
jmp 0xf249c
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
movq 0x10(%r15), %rsi
movq %r14, %rdi
movq %r12, %rdx
movq %rbx, %rcx
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *%rax
movq %r14, %rdi
movq %rbx, %rsi
movq %r12, %rcx
movl $0x1, %r8d
callq 0xf492d
cmpl $0x2, %ebp
jne 0xf24a8
testb $0x1, 0x3(%r15)
jne 0xf24ba
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
movq 0x8(%rax), %rax
movq %r14, %rdi
movl $0x29, %esi
movq %rbx, %rdx
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *%rax