// File: /workspace/github_c_makefile_star2_O3/BernardTatin[P]s7sh/s7.c
// Function: slashify_string_to_port
static void slashify_string_to_port(s7_scheme *sc, s7_pointer port, const char *p, s7_int len, bool quoted)
    {
        uint8_t *pcur, *pend, *pstart = NULL;

        if (len == 0)
        {
            if (quoted)
                port_write_string(port)(sc, "\"\"", 2, port);
            return;
        }
        pend = (uint8_t *)(p + len);

        /* what about the trailing nulls? Guile writes them out (as does s7 currently)
         *    but that is not ideal.  I'd like to use ~S for error messages, so that
         *    strings are clearly identified via the double-quotes, but this way of
         *    writing them is ugly:
         *      (let ((str (make-string 8 #\null))) (set! (str 0) #\a) str) -> "a\x00\x00\x00\x00\x00\x00\x00"
         *    but it would be misleading to omit them because:
         *      (let ((str (make-string 8 #\null))) (set! (str 0) #\a) (string-append str "bc")) -> "a\x00\x00\x00\x00\x00\x00\x00bc"
         * also it is problematic to use sc->print_length here because
         *    it is normally (say) 8 which truncates just about every string.  In CL, *print-length*
         *    does not affect strings, symbols, or bit-vectors.  But if the string is enormous,
         *    this function can bring us to a complete halt, which is annoying if it is the error
         *    handler that is trying to write the string.  I think if port is sc->error_port, I'll
         *    truncate strings to some reasonable size -- (*s7* 'max-format-length) maybe.
         */
        if ((len > sc->max_format_length) &&
                (port == sc->error_port))
            len = sc->max_format_length;
        if (quoted) port_write_character(port)(sc, '"', port);
        for (pcur = (uint8_t *)p; pcur < pend; pcur++)
        {
            if (slashify_table[*pcur])
            {
                if (pstart) pstart++; else pstart = (uint8_t *)p;
                if (pstart != pcur)
                {
                    port_write_string(port)(sc, (char *)pstart, pcur - pstart, port);
                    pstart = pcur;
                }
                port_write_character(port)(sc, '\\', port);
                switch (*pcur)
                {
                    case '"':   port_write_character(port)(sc, '"', port);   break;
                    case '\\':  port_write_character(port)(sc, '\\', port);  break;
                    case '\'':  port_write_character(port)(sc, '\'', port);  break;
                    case '\t':  port_write_character(port)(sc, 't', port);   break;
                    case '\r':  port_write_character(port)(sc, 'r', port);   break;
                    case '\b':  port_write_character(port)(sc, 'b', port);   break;
                    case '\f':  port_write_character(port)(sc, 'f', port);   break;
                    case '\?':  port_write_character(port)(sc, '?', port);   break;
                    case 'x':   port_write_character(port)(sc, 'x', port);   break;
                    default:
                                {
                                    s7_int n;
                                    port_write_character(port)(sc, 'x', port);
                                    n = (s7_int)(*pcur);
                                    if (n < 16)
                                        port_write_character(port)(sc, '0', port);
                                    else port_write_character(port)(sc, dignum[(n / 16) % 16], port);
                                    port_write_character(port)(sc, dignum[n % 16], port);
                                    port_write_character(port)(sc, ';', port);
                                }
                                break;
                }
            }
        }
        if (!pstart)
            port_write_string(port)(sc, (char *)p, len, port);
        else
        {
            pstart++;
            if (pstart != pcur)
                port_write_string(port)(sc, (char *)pstart, pcur - pstart, port);
        }
        if (quoted) port_write_character(port)(sc, '"', port);
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %r8d, %r12d
movq %rdx, 0x8(%rsp)
movq %rsi, %rbx
movq %rdi, %r14
testq %rcx, %rcx
je 0xf4be7
movq 0x2c0(%r14), %rax
movq %rcx, %rdx
cmpq %rcx, %rax
jge 0xf496f
cmpq %rbx, 0x190(%r14)
cmovneq %rcx, %rax
movq %rax, %rdx
movq %rdx, 0x20(%rsp)
testb %r12b, %r12b
je 0xf4995
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
movq %r14, %rdi
movl $0x22, %esi
movq %rbx, %rdx
movq %rcx, %r15
callq *0x8(%rax)
movq %r15, %rcx
testq %rcx, %rcx
jle 0xf4ba0
movl %r12d, 0x14(%rsp)
movq 0x8(%rsp), %rbp
addq %rbp, %rcx
movl $0x1, %r13d
subq %rbp, %r13
xorl %r15d, %r15d
leaq 0x613a2(%rip), %rdx     # 0x155d60
movq %rbp, %r12
movq %r14, 0x18(%rsp)
movq %rcx, (%rsp)
movzbl (%rbp), %eax
cmpb $0x1, (%rax,%rdx)
jne 0xf4b62
testq %r15, %r15
leaq 0x1(%r15), %r15
cmoveq 0x8(%rsp), %r15
cmpq %r15, %rbp
je 0xf4a07
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
movq %r12, %rdx
subq %r15, %rdx
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rcx
callq *0x10(%rax)
movq %rbp, %r15
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
movq %r14, %rdi
movl $0x5c, %esi
movq %rbx, %rdx
callq *0x8(%rax)
movzbl (%rbp), %ecx
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
movq 0x8(%rax), %rax
cmpl $0x26, %ecx
jg 0xf4a57
leal -0x8(%rcx), %edx
cmpl $0x5, %edx
ja 0xf4a92
leaq 0x1430f(%rip), %rsi     # 0x108d50
movslq (%rsi,%rdx,4), %rcx
addq %rsi, %rcx
jmpq *%rcx
movq %r14, %rdi
movl $0x62, %esi
jmp 0xf4b52
cmpl $0x5b, %ecx
jg 0xf4a77
cmpl $0x27, %ecx
je 0xf4b40
cmpl $0x3f, %ecx
jne 0xf4aa4
movq %r14, %rdi
movl $0x3f, %esi
jmp 0xf4b52
cmpl $0x5c, %ecx
je 0xf4b4a
cmpl $0x78, %ecx
jne 0xf4aa4
movq %r14, %rdi
movl $0x78, %esi
jmp 0xf4b52
cmpl $0x22, %ecx
jne 0xf4aa4
movq %r14, %rdi
movl $0x22, %esi
jmp 0xf4b52
movq %r14, %rdi
movl $0x78, %esi
movq %rbx, %rdx
callq *%rax
movzbl (%rbp), %r14d
movb $0x30, %al
cmpq $0x10, %r14
jb 0xf4ace
movl %r14d, %eax
shrl $0x4, %eax
leaq 0x27775(%rip), %rcx     # 0x11c240
movb (%rax,%rcx), %al
movq 0x8(%rbx), %rcx
movq 0x48(%rcx), %rcx
movzbl %al, %esi
movq 0x18(%rsp), %rdi
movq %rbx, %rdx
callq *0x8(%rcx)
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
andl $0xf, %r14d
leaq 0x27749(%rip), %rcx     # 0x11c240
movzbl (%r14,%rcx), %esi
movq 0x18(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rdx
callq *0x8(%rax)
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
movq %r14, %rdi
movl $0x3b, %esi
movq %rbx, %rdx
callq *0x8(%rax)
jmp 0xf4b57
movq %r14, %rdi
movl $0x72, %esi
jmp 0xf4b52
movq %r14, %rdi
movl $0x74, %esi
jmp 0xf4b52
movq %r14, %rdi
movl $0x66, %esi
jmp 0xf4b52
movq %r14, %rdi
movl $0x27, %esi
jmp 0xf4b52
movq %r14, %rdi
movl $0x5c, %esi
movq %rbx, %rdx
callq *%rax
movq (%rsp), %rcx
leaq 0x611fe(%rip), %rdx     # 0x155d60
incq %rbp
decq %r13
incq %r12
cmpq %rcx, %rbp
jb 0xf49ca
testq %r15, %r15
movl 0x14(%rsp), %r12d
je 0xf4ba0
decq %rbp
cmpq %r15, %rbp
je 0xf4bbb
leaq 0x1(%r15), %rsi
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
addq %r15, %r13
negq %r13
movq %r14, %rdi
movq %r13, %rdx
jmp 0xf4bb5
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
movq %r14, %rdi
movq 0x8(%rsp), %rsi
movq 0x20(%rsp), %rdx
movq %rbx, %rcx
callq *0x10(%rax)
testb %r12b, %r12b
je 0xf4c1a
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
movq 0x8(%rax), %rax
movq %r14, %rdi
movl $0x22, %esi
movq %rbx, %rdx
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *%rax
testb %r12b, %r12b
je 0xf4c1a
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
leaq 0x25c0f(%rip), %rsi     # 0x11a80e
movl $0x2, %edx
movq %r14, %rdi
movq %rbx, %rcx
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *%rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq