// File: /workspace/github_c_makefile_star2_O3/BernardTatin[P]s7sh/s7.c
// Function: input_port_to_port
static void input_port_to_port(s7_scheme *sc, s7_pointer obj, s7_pointer port, use_write_t use_write, shared_info *ci)
    {
        if (obj == sc->standard_input)
            port_write_string(port)(sc, port_filename(obj), port_filename_length(obj), port);
        else
        {
            if (use_write == P_READABLE)
            {
                if (port_is_closed(obj))
                    port_write_string(port)(sc, "(call-with-input-string \"\" (lambda (p) p))", 42, port);
                else
                {
                    if (is_function_port(obj))
                        port_write_string(port)(sc, "#<input-function-port>", 22, port);
                    else
                    {
                        if (is_file_port(obj))
                        {
                            char str[256];
                            int32_t nlen;
                            str[0] = '\0';
                            nlen = catstrs(str, 256, "(open-input-file \"", port_filename(obj), "\")", NULL);
                            port_write_string(port)(sc, str, nlen, port);
                        }
                        else
                        {
                            s7_int data_len;
                            data_len = port_data_size(obj) - port_position(obj);
                            if (data_len > 100)
                            {
                                const char *filename;
                                filename = (const char *)s7_port_filename(sc, obj);
                                if (filename)
                                {
#define DO_STR_LEN 1024
                                    char do_str[DO_STR_LEN];
                                    int32_t len;
                                    do_str[0] = '\0';
                                    if (port_position(obj) > 0)
                                    {
                                        len = catstrs(do_str, DO_STR_LEN, "(let ((port (open-input-file \"", filename, "\")))", NULL);
                                        port_write_string(port)(sc, do_str, len, port);
                                        do_str[0] = '\0';
                                        len = catstrs(do_str, DO_STR_LEN, " (do ((i 0 (+ i 1)) (c (read-char port) (read-char port))) ((= i ",
                                                pos_int_to_str_direct(sc, port_position(obj) - 1),
                                                ") port)))", NULL);
                                    }
                                    else len = catstrs(do_str, DO_STR_LEN, "(open-input-file \"", filename, "\")", NULL);
                                    port_write_string(port)(sc, do_str, len, port);
                                    return;
                                }
                            }
                            port_write_string(port)(sc, "(open-input-string ", 19, port);
                            /* not port_write_string here because there might be embedded double-quotes */
                            slashify_string_to_port(sc, port, (const char *)(port_data(obj) + port_position(obj)), port_data_size(obj) - port_position(obj), IN_QUOTES);
                            port_write_character(port)(sc, ')', port);
                        }
                    }
                }
            }
            else
            {
                if (is_string_port(obj))
                    port_write_string(port)(sc, "<input-string-port", 18, port);
                else
                {
                    if (is_file_port(obj))
                        port_write_string(port)(sc, "<input-file-port", 16, port);
                    else port_write_string(port)(sc, "<input-function-port", 20, port);
                }
                if (port_is_closed(obj))
                    port_write_string(port)(sc, " (closed)>", 10, port);
                else port_write_character(port)(sc, '>', port);
            }
        }
    }

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x400, %rsp            # imm = 0x400
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
cmpq %rsi, 0x1c8(%rdi)
je 0xf1803
movq 0x8(%r15), %rax
cmpl $0x2, %ecx
jne 0xf1820
cmpb $0x1, 0x2(%rax)
jne 0xf1846
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
leaq 0x290b5(%rip), %rsi     # 0x11a8ae
movl $0x2a, %edx
jmp 0xf18b8
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
movq 0x8(%r15), %rcx
movq 0x10(%rcx), %rsi
movq 0x30(%rcx), %rdx
jmp 0xf18b8
movl 0x4(%rax), %ecx
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
testl %ecx, %ecx
je 0xf1874
cmpl $0x1, %ecx
jne 0xf1882
leaq 0x29135(%rip), %rsi     # 0x11a974
movl $0x12, %edx
jmp 0xf188e
movl 0x4(%rax), %ecx
testl %ecx, %ecx
je 0xf18e1
cmpl $0x2, %ecx
jne 0xf1935
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
leaq 0x2906c(%rip), %rsi     # 0x11a8d9
movl $0x16, %edx
jmp 0xf18b8
leaq 0x2910c(%rip), %rsi     # 0x11a987
movl $0x10, %edx
jmp 0xf188e
leaq 0x2910f(%rip), %rsi     # 0x11a998
movl $0x14, %edx
movq %r14, %rdi
movq %rbx, %rcx
callq *%rax
movq 0x8(%r15), %rcx
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
cmpb $0x1, 0x2(%rcx)
jne 0xf18d0
movq 0x10(%rax), %rax
leaq 0x290fa(%rip), %rsi     # 0x11a9ad
movl $0xa, %edx
movq %r14, %rdi
movq %rbx, %rcx
addq $0x400, %rsp            # imm = 0x400
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmpq *%rax
movq 0x8(%rax), %rax
movq %r14, %rdi
movl $0x3e, %esi
jmp 0xf1a78
movq %rsp, %r15
movb $0x0, (%r15)
movq 0x10(%rax), %rcx
leaq 0x29009(%rip), %rdx     # 0x11a8fc
leaq 0x2ac07(%rip), %r8      # 0x11c501
movl $0x100, %esi            # imm = 0x100
movq %r15, %rdi
xorl %r9d, %r9d
xorl %eax, %eax
callq 0x9517
movq 0x8(%rbx), %rcx
movq 0x48(%rcx), %r8
movslq %eax, %rdx
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rcx
callq *0x10(%r8)
addq $0x400, %rsp            # imm = 0x400
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq 0x18(%r15), %rcx
movq 0x20(%r15), %rdx
subq %rdx, %rcx
cmpq $0x65, %rcx
jl 0xf1a24
movb (%r15), %cl
andb $-0x2, %cl
cmpb $0x22, %cl
jne 0xf1a24
movq 0x10(%rax), %rcx
testq %rcx, %rcx
je 0xf1a24
movb $0x0, (%rsp)
testq %rdx, %rdx
jle 0xf1a8d
leaq 0x28f76(%rip), %rdx     # 0x11a8f0
leaq 0x28f8e(%rip), %r8      # 0x11a90f
xorl %r13d, %r13d
movq %rsp, %r12
movl $0x400, %esi            # imm = 0x400
movq %r12, %rdi
xorl %r9d, %r9d
xorl %eax, %eax
callq 0x9517
movq 0x8(%rbx), %rcx
movq 0x48(%rcx), %r8
movslq %eax, %rdx
movq %r14, %rdi
movq %r12, %rsi
movq %rbx, %rcx
callq *0x10(%r8)
movb %r13b, (%r12)
movq 0x20(%r15), %rsi
decq %rsi
leaq 0xb6f(%r14), %rcx
movb %r13b, 0xb6f(%r14)
leaq 0x24b6f(%rip), %rdi     # 0x116540
movabsq $0x6666666666666667, %r8 # imm = 0x6666666666666667
movq %rsi, %rax
imulq %r8
movq %rdx, %rax
shrq $0x3f, %rax
sarq $0x2, %rdx
addq %rax, %rdx
leaq (%rdx,%rdx), %rax
leaq (%rax,%rax,4), %rax
movq %rsi, %r9
subq %rax, %r9
movb (%rdi,%r9), %al
movb %al, -0x1(%rcx)
decq %rcx
addq $0x9, %rsi
cmpq $0x12, %rsi
movq %rdx, %rsi
ja 0xf19db
leaq 0x28ef9(%rip), %rdx     # 0x11a914
leaq 0x28f34(%rip), %r8      # 0x11a956
jmp 0xf1a9b
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
leaq 0x28f2d(%rip), %rsi     # 0x11a960
movl $0x13, %edx
movq %r14, %rdi
movq %rbx, %rcx
callq *0x10(%rax)
movq 0x18(%r15), %rcx
movq 0x20(%r15), %rax
movq 0x10(%r15), %rdx
addq %rax, %rdx
subq %rax, %rcx
movq %r14, %rdi
movq %rbx, %rsi
movl $0x1, %r8d
callq 0xf492d
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
movq 0x8(%rax), %rax
movq %r14, %rdi
movl $0x29, %esi
movq %rbx, %rdx
addq $0x400, %rsp            # imm = 0x400
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmpq *%rax
leaq 0x28e68(%rip), %rdx     # 0x11a8fc
leaq 0x2aa66(%rip), %r8      # 0x11c501
movq %rsp, %rdi
movl $0x400, %esi            # imm = 0x400
xorl %r9d, %r9d
xorl %eax, %eax
callq 0x9517
movq 0x8(%rbx), %rcx
movq 0x48(%rcx), %r8
movslq %eax, %rdx
movq %rsp, %rsi
movq %r14, %rdi
jmp 0xf191d