// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x68, %rsp
movq %rdi, 0x58(%rsp)
movq %rsi, 0x50(%rsp)
movq %rdx, 0x48(%rsp)
movq %rcx, 0x40(%rsp)
movq 0x50(%rsp), %rdi
callq 0x27dd0
testb $0x1, %al
jne 0x15068
jmp 0x1508d
movq 0x58(%rsp), %rdi
movq 0x40(%rsp), %rsi
movq 0x50(%rsp), %rcx
leaq 0x1d9267(%rip), %rdx    # 0x1ee2e5
callq 0x154a0
movq %rax, 0x60(%rsp)
jmp 0x15242
callq 0x9090
movl $0x0, (%rax)
movq 0x50(%rsp), %rdi
movq 0x48(%rsp), %rsi
callq 0x95b0
movq %rax, 0x38(%rsp)
cmpq $0x0, 0x38(%rsp)
jne 0x15229
callq 0x9090
cmpl $0x16, (%rax)
jne 0x150e7
movq 0x58(%rsp), %rdi
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rcx
leaq 0x1ccad6(%rip), %rdx    # 0x1e1bae
callq 0x154a0
movq %rax, 0x60(%rsp)
jmp 0x15242
movq 0x50(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x7e, %eax
jne 0x151ed
movq 0x50(%rsp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x2f, %eax
jne 0x151ed
leaq 0x1d91e9(%rip), %rdi    # 0x1ee2fa
callq 0x9030
movq %rax, 0x30(%rsp)
cmpq $0x0, 0x30(%rsp)
je 0x151eb
movq 0x50(%rsp), %rdi
callq 0xa430
movq %rax, 0x10(%rsp)
movq 0x30(%rsp), %rdi
callq 0xa430
movq %rax, %rcx
movq 0x10(%rsp), %rax
addq %rcx, %rax
addq $0x1, %rax
movq %rax, 0x18(%rsp)
movq 0x58(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0xaa80
movq %rax, 0x28(%rsp)
movq 0x28(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rax
movb $0x0, (%rax)
movq 0x20(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq 0x50(%rsp), %rcx
addq $0x1, %rcx
xorl %eax, %eax
movl %eax, %r8d
movb $0x0, %al
callq 0xabd0
movq 0x20(%rsp), %rdi
leaq 0x1dd2c0(%rip), %rsi    # 0x1f246d
callq 0x95b0
movq %rax, 0x38(%rsp)
movq 0x58(%rsp), %rdi
movq 0x28(%rsp), %rsi
callq 0xb230
cmpq $0x0, 0x38(%rsp)
je 0x151e9
movq 0x58(%rsp), %rdi
movq 0x50(%rsp), %rsi
movq 0x38(%rsp), %rdx
callq 0xc86e0
movq %rax, 0x60(%rsp)
jmp 0x15242
jmp 0x151eb
jmp 0x151ed
movq 0x58(%rsp), %rax
movq %rax, (%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x8(%rsp)
callq 0x9090
movl (%rax), %edi
callq 0x96b0
movq (%rsp), %rdi
movq 0x8(%rsp), %rsi
movq %rax, %rdx
movq 0x50(%rsp), %rcx
callq 0x154a0
movq %rax, 0x60(%rsp)
jmp 0x15242
movq 0x58(%rsp), %rdi
movq 0x50(%rsp), %rsi
movq 0x38(%rsp), %rdx
callq 0xc86e0
movq %rax, 0x60(%rsp)
movq 0x60(%rsp), %rax
addq $0x68, %rsp
retq
nopl (%rax)