// File: /workspace/github_c_makefile_star2_O1/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, %ebp
movq %rsi, %rbx
movq %rdi, %r14
testq %rcx, %rcx
je 0xfd8fc
movq %rdx, %r13
movq 0x2c0(%r14), %rax
movq %rcx, %r15
cmpq %rcx, %rax
jge 0xfd704
cmpq %rbx, 0x190(%r14)
cmovneq %rcx, %rax
movq %rax, %r15
testb %bpl, %bpl
je 0xfd725
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
movq %r14, %rdi
movl $0x22, %esi
movq %rbx, %rdx
movq %rcx, %r12
callq *0x8(%rax)
movq %r12, %rcx
movq %r15, 0x18(%rsp)
movl %ebp, 0x14(%rsp)
testq %rcx, %rcx
jle 0xfd933
addq %r13, %rcx
xorl %ebp, %ebp
leaq 0x6061d(%rip), %rdx     # 0x15dd60
movq %r13, %r15
movq %r13, %r12
movq %r13, 0x20(%rsp)
movq %rcx, 0x8(%rsp)
movzbl (%r12), %eax
cmpb $0x1, (%rax,%rdx)
jne 0xfd8eb
testq %rbp, %rbp
leaq 0x1(%rbp), %rbp
cmoveq %r13, %rbp
cmpq %rbp, %r12
je 0xfd78f
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
movq %r15, %rdx
subq %rbp, %rdx
movq %r14, %rdi
movq %rbp, %rsi
movq %rbx, %rcx
callq *0x10(%rax)
movq %r12, %rbp
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
movq %r14, %rdi
movl $0x5c, %esi
movq %rbx, %rdx
callq *0x8(%rax)
movzbl (%r12), %ecx
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
movq 0x8(%rax), %rax
cmpl $0x26, %ecx
jg 0xfd7e0
leal -0x8(%rcx), %edx
cmpl $0x5, %edx
ja 0xfd81b
leaq 0x1451a(%rip), %rsi     # 0x111ce4
movslq (%rsi,%rdx,4), %rcx
addq %rsi, %rcx
jmpq *%rcx
movq %r14, %rdi
movl $0x62, %esi
jmp 0xfd8da
cmpl $0x5b, %ecx
jg 0xfd800
cmpl $0x27, %ecx
je 0xfd8c8
cmpl $0x3f, %ecx
jne 0xfd82d
movq %r14, %rdi
movl $0x3f, %esi
jmp 0xfd8da
cmpl $0x5c, %ecx
je 0xfd8d2
cmpl $0x78, %ecx
jne 0xfd82d
movq %r14, %rdi
movl $0x78, %esi
jmp 0xfd8da
cmpl $0x22, %ecx
jne 0xfd82d
movq %r14, %rdi
movl $0x22, %esi
jmp 0xfd8da
movq %r14, %rdi
movl $0x78, %esi
movq %rbx, %rdx
callq *%rax
movzbl (%r12), %r13d
movb $0x30, %al
cmpq $0x10, %r13
jb 0xfd857
movl %r13d, %eax
shrl $0x4, %eax
leaq 0x278dc(%rip), %rcx     # 0x125130
movb (%rax,%rcx), %al
movq 0x8(%rbx), %rcx
movq 0x48(%rcx), %rcx
movzbl %al, %esi
movq %r14, %rdi
movq %rbx, %rdx
callq *0x8(%rcx)
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
andl $0xf, %r13d
leaq 0x278b2(%rip), %rcx     # 0x125130
movzbl (%r13,%rcx), %esi
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)
movq 0x20(%rsp), %r13
jmp 0xfd8df
movq %r14, %rdi
movl $0x72, %esi
jmp 0xfd8da
movq %r14, %rdi
movl $0x74, %esi
jmp 0xfd8da
movq %r14, %rdi
movl $0x66, %esi
jmp 0xfd8da
movq %r14, %rdi
movl $0x27, %esi
jmp 0xfd8da
movq %r14, %rdi
movl $0x5c, %esi
movq %rbx, %rdx
callq *%rax
movq 0x8(%rsp), %rcx
leaq 0x60475(%rip), %rdx     # 0x15dd60
incq %r12
incq %r15
cmpq %rcx, %r12
jb 0xfd753
jmp 0xfd938
testb %bpl, %bpl
je 0xfd9a2
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
leaq 0x25de6(%rip), %rsi     # 0x1236fe
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
xorl %ebp, %ebp
movq %r13, %r12
testq %rbp, %rbp
je 0xfd95b
incq %rbp
cmpq %r12, %rbp
je 0xfd974
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
subq %rbp, %r12
movq %r14, %rdi
movq %rbp, %rsi
movq %r12, %rdx
jmp 0xfd96e
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
movq %r14, %rdi
movq %r13, %rsi
movq 0x18(%rsp), %rdx
movq %rbx, %rcx
callq *0x10(%rax)
cmpb $0x0, 0x14(%rsp)
je 0xfd9a2
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
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq