// File: /workspace/github_c_makefile_star2_O3/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 $0xa8, %rsp
movq %rcx, %r15
movq %rdx, %r13
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x18(%rsp), %rsi
movq %rbx, %rdi
callq 0x83d0
testl %eax, %eax
js 0xf01c
movl $0xf000, %eax           # imm = 0xF000
andl 0x30(%rsp), %eax
cmpl $0x4000, %eax           # imm = 0x4000
jne 0xf01c
leaq 0x107813(%rip), %rdx    # 0x116810
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rcx
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xf406
callq 0x8090
movq %rax, %r12
movl $0x0, (%rax)
movq %rbx, %rdi
movq %r13, %rsi
callq 0x85b0
testq %rax, %rax
je 0xf065
leaq 0x10cd76(%rip), %r8     # 0x11bdb7
movl $0x4c4b40, %ecx         # imm = 0x4C4B40
movq %r14, %rdi
movq %rax, %rsi
movq %rbx, %rdx
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x9060c
movl (%r12), %ebp
cmpl $0x16, %ebp
jne 0xf080
leaq 0xfb051(%rip), %rdx     # 0x10a0c6
movq %r14, %rdi
movq %r15, %rsi
movq %r13, %rcx
jmp 0xf006
cmpb $0x7e, (%rbx)
jne 0xf151
cmpb $0x2f, 0x1(%rbx)
jne 0xf151
leaq 0x10778b(%rip), %rdi    # 0x116825
callq 0x8030
testq %rax, %rax
je 0xf151
movq %rax, %r13
leaq 0x1(%rbx), %rax
movq %rax, 0x10(%rsp)
movl $0x1, %eax
cmpb $0x0, (%rbx,%rax)
leaq 0x1(%rax), %rax
jne 0xf0b9
cmpb $0x0, (%r13)
je 0xf0dd
xorl %ecx, %ecx
leaq 0x1(%rcx), %rbp
cmpb $0x0, 0x1(%r13,%rcx)
movq %rbp, %rcx
jne 0xf0cc
jmp 0xf0df
xorl %ebp, %ebp
addq %rax, %rbp
movq %r14, %rdi
movq %rbp, %rsi
callq 0x9357
movq %rax, 0x8(%rsp)
movq (%rax), %rdi
movq %rdi, (%rsp)
movb $0x0, (%rdi)
movq %rbp, %rsi
movq %r13, %rdx
movq 0x10(%rsp), %rcx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x9517
leaq 0x10b42f(%rip), %rsi    # 0x11a547
movq (%rsp), %rdi
callq 0x85b0
movq %rax, %r13
movq %r14, %rdi
movq 0x8(%rsp), %rsi
callq 0x9a12
testq %r13, %r13
je 0xf14d
leaq 0x10cc7a(%rip), %r8     # 0x11bdb7
movl $0x4c4b40, %ecx         # imm = 0x4C4B40
movq %r14, %rdi
movq %r13, %rsi
jmp 0xf04c
movl (%r12), %ebp
movl %ebp, %edi
callq 0x86b0
movq %r14, %rdi
movq %r15, %rsi
movq %rax, %rdx
jmp 0xf003