// File: /workspace/github_c_makefile_star2_O2/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 %r12
pushq %rbx
subq $0x408, %rsp            # imm = 0x408
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
cmpq %rsi, 0x1c8(%rdi)
je 0xc01b9
movq 0x8(%r15), %rax
cmpl $0x2, %ecx
jne 0xc01d6
cmpb $0x1, 0x2(%rax)
jne 0xc01f9
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
leaq 0x2669c(%rip), %rsi     # 0xe684e
pushq $0x2a
jmp 0xc025c
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 0xc025d
movl 0x4(%rax), %ecx
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
testl %ecx, %ecx
je 0xc0220
cmpl $0x1, %ecx
jne 0xc022b
leaq 0x2671f(%rip), %rsi     # 0xe6914
pushq $0x12
jmp 0xc0234
movl 0x4(%rax), %ecx
testl %ecx, %ecx
je 0xc027e
cmpl $0x2, %ecx
jne 0xc02d0
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
leaq 0x2665d(%rip), %rsi     # 0xe6879
pushq $0x16
jmp 0xc025c
leaq 0x26700(%rip), %rsi     # 0xe6927
pushq $0x10
jmp 0xc0234
leaq 0x26706(%rip), %rsi     # 0xe6938
pushq $0x14
popq %rdx
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 0xc0273
movq 0x10(%rax), %rax
leaq 0x266f3(%rip), %rsi     # 0xe694d
pushq $0xa
popq %rdx
movq %r14, %rdi
movq %rbx, %rcx
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r12
popq %r14
popq %r15
jmpq *%rax
movq 0x8(%rax), %rax
pushq $0x3e
jmp 0xc03be
movq %rsp, %r15
movb $0x0, (%r15)
movq 0x10(%rax), %rcx
leaq 0x2660c(%rip), %rdx     # 0xe689c
leaq 0x2820a(%rip), %r8      # 0xe84a1
movl $0x100, %esi            # imm = 0x100
movq %r15, %rdi
xorl %r9d, %r9d
xorl %eax, %eax
callq 0x90f7
movq 0x8(%rbx), %rcx
movq 0x48(%rcx), %r8
movslq %eax, %rdx
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rcx
callq *0x10(%r8)
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq 0x18(%r15), %rcx
movq 0x20(%r15), %rdx
subq %rdx, %rcx
cmpq $0x65, %rcx
jl 0xc0374
movb (%r15), %cl
andb $-0x2, %cl
cmpb $0x22, %cl
jne 0xc0374
movq 0x10(%rax), %rcx
testq %rcx, %rcx
je 0xc0374
movb $0x0, (%rsp)
testq %rdx, %rdx
jle 0xc03d5
leaq 0x2657f(%rip), %rdx     # 0xe6890
leaq 0x26597(%rip), %r8      # 0xe68af
movq %rsp, %r12
movl $0x400, %esi            # imm = 0x400
movq %r12, %rdi
xorl %r9d, %r9d
xorl %eax, %eax
callq 0x90f7
movq 0x8(%rbx), %rcx
movq 0x48(%rcx), %r8
movslq %eax, %rdx
movq %r14, %rdi
movq %r12, %rsi
movq %rbx, %rcx
callq *0x10(%r8)
movb $0x0, (%r12)
movq 0x20(%r15), %rsi
decq %rsi
movq %r14, %rdi
callq 0x91f9
leaq 0x26554(%rip), %rdx     # 0xe68b4
leaq 0x2658f(%rip), %r8      # 0xe68f6
movl $0x400, %esi            # imm = 0x400
movq %r12, %rdi
movq %rax, %rcx
jmp 0xc03eb
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
leaq 0x2657d(%rip), %rsi     # 0xe6900
pushq $0x13
popq %rdx
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
pushq $0x1
popq %r8
movq %r14, %rdi
movq %rbx, %rsi
callq 0xc281e
movq 0x8(%rbx), %rax
movq 0x48(%rax), %rax
movq 0x8(%rax), %rax
pushq $0x29
popq %rsi
movq %r14, %rdi
movq %rbx, %rdx
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r12
popq %r14
popq %r15
jmpq *%rax
leaq 0x264c0(%rip), %rdx     # 0xe689c
leaq 0x280be(%rip), %r8      # 0xe84a1
movq %rsp, %rdi
movl $0x400, %esi            # imm = 0x400
xorl %r9d, %r9d
xorl %eax, %eax
callq 0x90f7
movq 0x8(%rbx), %rcx
movq 0x48(%rcx), %r8
movslq %eax, %rdx
movq %rsp, %rsi
movq %r14, %rdi
jmp 0xc02ba