// File: /workspace/github_c_makefile_star2_O2/BernardTatin[P]s7sh/s7.c
// Function: open_input_file_1
static s7_pointer open_input_file_1(s7_scheme *sc, const char *name, const char *mode, const char *caller)
    {
        FILE *fp;
        /* see if we can open this file before allocating a port */

        if (is_directory(name))
            return(file_error(sc, caller, "file is a directory:", name));

        errno = 0;
        fp = fopen(name, mode);
        if (!fp)
        {
#if (!MS_WINDOWS)
            if (errno == EINVAL)
                return(file_error(sc, caller, "invalid mode", mode));
#if WITH_GCC
            /* catch one special case, "~/..." */
            if ((name[0] == '~') &&
                    (name[1] == '/'))
            {
                char *home;
                home = getenv("HOME");
                if (home)
                {
                    block_t *b;
                    char *filename;
                    s7_int len;
                    len = safe_strlen(name) + safe_strlen(home) + 1;
                    b = mallocate(sc, len);
                    filename = (char *)block_data(b);
                    filename[0] = '\0';
                    catstrs(filename, len, home, (char *)(name + 1), NULL);
                    fp = fopen(filename, "r");
                    liberate(sc, b);
                    if (fp)
                        return(make_input_file(sc, name, fp));
                }
            }
#endif
#endif
            return(file_error(sc, caller, strerror(errno), name));
        }
        return(make_input_file(sc, name, fp));
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, %r14
movq %rdx, %r13
movq %rsi, %rbx
movq %rdi, %r15
movq %rsi, %rdi
callq 0x2988e
testb %al, %al
je 0xd726
leaq 0xd50a6(%rip), %rdx     # 0xe27b0
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rcx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xd9a5
callq 0x8090
movq %rax, %r12
andl $0x0, (%rax)
movq %rbx, %rdi
movq %r13, %rsi
callq 0x85b0
testq %rax, %rax
je 0xd75d
movq %r15, %rdi
movq %rbx, %rsi
movq %rax, %rdx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x73e94
movl (%r12), %ebp
cmpl $0x16, %ebp
jne 0xd778
leaq 0xc88f9(%rip), %rdx     # 0xd6066
movq %r15, %rdi
movq %r14, %rsi
movq %r13, %rcx
jmp 0xd713
cmpb $0x7e, (%rbx)
jne 0xd82d
cmpb $0x2f, 0x1(%rbx)
jne 0xd82d
leaq 0xd5033(%rip), %rdi     # 0xe27c5
callq 0x8030
testq %rax, %rax
je 0xd82d
movq %rax, %r13
leaq 0x1(%rbx), %rax
movq %rax, 0x10(%rsp)
movq %rbx, %rdi
callq 0x8d06
movq %rax, %rbp
movq %r13, %rdi
callq 0x8d06
leaq (%rax,%rbp), %rsi
incq %rsi
movq %rsi, (%rsp)
movq %r15, %rdi
callq 0x9037
movq %rax, 0x8(%rsp)
movq (%rax), %rbp
movb $0x0, (%rbp)
movq %rbp, %rdi
movq (%rsp), %rsi
movq %r13, %rdx
movq 0x10(%rsp), %rcx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x90f7
leaq 0xd8ce9(%rip), %rsi     # 0xe64e7
movq %rbp, %rdi
callq 0x85b0
movq %rax, %r13
movq %r15, %rdi
movq 0x8(%rsp), %rsi
callq 0x9439
testq %r13, %r13
je 0xd829
movq %r15, %rdi
movq %rbx, %rsi
movq %r13, %rdx
jmp 0xd74a
movl (%r12), %ebp
movl %ebp, %edi
callq 0x86b0
movq %r15, %rdi
movq %r14, %rsi
movq %rax, %rdx
jmp 0xd710