// File: /workspace/github_c_makefile_star2_O2/BernardTatin[P]s7sh/s7.c
// Function: g_load
static s7_pointer g_load(s7_scheme *sc, s7_pointer args)
    {
#define H_load "(load file (env (rootlet))) loads the scheme file 'file'. The 'env' argument \
        defaults to the rootlet.  To load into the current environment instead, pass (curlet)."
#define Q_load s7_make_signature(sc, 3, sc->values_symbol, sc->is_string_symbol, sc->is_let_symbol)

        FILE *fp = NULL;
        s7_pointer name;
        const char *fname;

        name = car(args);
        if (!is_string(name))
            return(method_or_bust(sc, name, sc->load_symbol, args, T_STRING, 1));

        if (is_pair(cdr(args)))
        {
            s7_pointer e;
            e = cadr(args);
            if (!is_let(e))
                return(wrong_type_argument_with_type(sc, sc->load_symbol, 2, e, a_let_string));
            if (e == sc->s7_let)
                return(s7_error(sc, sc->wrong_type_arg_symbol, set_elist_2(sc, wrap_string(sc, "can't load ~S into *s7*", 23), name)));
            if (e == sc->rootlet)
                sc->envir = sc->nil;
            else sc->envir = e;
        }
        else sc->envir = sc->nil;

        fname = string_value(name);
        if ((!fname) || (!(*fname)))                 /* fopen("", "r") returns a file pointer?? */
            return(s7_error(sc, sc->out_of_range_symbol, set_elist_2(sc, wrap_string(sc, "load's first argument, ~S, should be a filename", 47), name)));

        if (is_directory(fname))
            return(s7_error(sc, sc->wrong_type_arg_symbol, set_elist_2(sc, wrap_string(sc, "load argument, ~S, is a directory", 33), name)));

#if WITH_C_LOADER
        if (load_shared_object(sc, fname, (is_null(sc->envir)) ? sc->rootlet : sc->envir))
            return(sc->F);
#endif

        fp = fopen(fname, "r");
#if WITH_GCC
        if (!fp) fp = expand_cwd(sc, fname);
#endif
        if (fp)
        {
            if (hook_has_functions(sc->load_hook))
                s7_apply_function(sc, sc->load_hook, list_1(sc, sc->temp6 = s7_make_string(sc, fname)));
        }
        else
        {
            fp = open_file_with_load_path(sc, fname);
            if (!fp) return(file_error(sc, "load", "can't open", fname));
        }
        read_scheme_file(sc, fp, fname);

        push_stack_op_let(sc, OP_LOAD_CLOSE_AND_POP_IF_EOF);  /* was pushing args and code, but I don't think they're used later */
        push_stack_op_let(sc, OP_READ_INTERNAL);

        return(sc->unspecified);
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rcx
movq %rdi, %rbx
movq 0x8(%rsi), %r15
cmpb $0x13, (%r15)
jne 0x6424c
movq 0x10(%rcx), %rax
cmpb $0x1, (%rax)
jne 0x641e9
movq 0x8(%rax), %rcx
cmpb $0x1c, (%rcx)
jne 0x642e9
cmpq 0x2150(%rbx), %rcx
je 0x6434b
cmpq 0x150(%rbx), %rcx
jne 0x641f0
movq 0x110(%rbx), %rcx
movq %rcx, 0x8(%rbx)
movq 0x10(%r15), %r14
testq %r14, %r14
je 0x64274
cmpb $0x0, (%r14)
je 0x64274
movq %r14, %rdi
callq 0x2988e
testb %al, %al
je 0x6431f
movq 0x1940(%rbx), %r14
movq 0x820(%rbx), %rax
movslq 0x7dc(%rbx), %rcx
movq (%rax,%rcx,8), %rax
incl %ecx
andl $0x7, %ecx
movl %ecx, 0x7dc(%rbx)
leaq 0x83af1(%rip), %rcx     # 0xe7d2f
movq %rcx, 0x10(%rax)
movq $0x21, 0x8(%rax)
jmp 0x642ab
movq 0x1288(%rbx), %rdx
pushq $0x13
popq %r8
pushq $0x1
popq %r9
movq %rbx, %rdi
movq %r15, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xcd70
movq 0x1948(%rbx), %r14
movq 0x820(%rbx), %rax
movslq 0x7dc(%rbx), %rcx
movq (%rax,%rcx,8), %rax
incl %ecx
andl $0x7, %ecx
movl %ecx, 0x7dc(%rbx)
leaq 0x83a60(%rip), %rcx     # 0xe7cff
movq %rcx, 0x10(%rax)
movq $0x2f, 0x8(%rax)
movq 0x6e0(%rbx), %rcx
movq %rax, 0x8(%rcx)
movq 0x6e0(%rbx), %rax
movq 0x10(%rax), %rax
movq %r15, 0x8(%rax)
movq 0x6e0(%rbx), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2cdc0
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x1288(%rbx), %rax
movq 0x8(%rax), %rsi
movq 0xb1665(%rip), %rdx     # 0x115960
movq 0x140(%rbx), %r8
movq 0xb564f(%rip), %r9      # 0x119958
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x9bbb
movq 0x8(%rbx), %rdx
cmpq 0x110(%rbx), %rdx
jne 0x64333
movq 0x150(%rbx), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x296f6
testb %al, %al
je 0x64387
movq 0x120(%rbx), %r14
jmp 0x642d7
movq 0x1940(%rbx), %r14
movq 0x820(%rbx), %rax
movslq 0x7dc(%rbx), %rcx
movq (%rax,%rcx,8), %rax
incl %ecx
andl $0x7, %ecx
movl %ecx, 0x7dc(%rbx)
leaq 0x83971(%rip), %rcx     # 0xe7ce7
movq %rcx, 0x10(%rax)
movq $0x17, 0x8(%rax)
jmp 0x642ab
leaq 0x82159(%rip), %rsi     # 0xe64e7
movq %r14, %rdi
callq 0x85b0
testq %rax, %rax
jne 0x643af
movq %rbx, %rdi
movq %r14, %rsi
callq 0x298c1
testq %rax, %rax
je 0x64484
movq %rax, %r15
movq 0x1e8(%rbx), %r12
movq %rbx, %rdi
movq %r12, %rsi
callq 0x97c7
cmpb $0x1, (%rax)
jne 0x6442d
movq %rbx, %rdi
movq %r14, %rsi
callq 0xd1fd
movq %rax, %r13
movq %rax, 0x520(%rbx)
movq 0x90(%rbx), %rax
movq 0x110(%rbx), %rbp
cmpq 0x98(%rbx), %rax
ja 0x64404
movq %rbx, %rdi
callq 0x9c27
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %rdx
movq $0x200001, (%rdx)       # imm = 0x200001
movq %r13, 0x8(%rdx)
movq %rbp, 0x10(%rdx)
movq %rbx, %rdi
movq %r12, %rsi
callq 0xa34c
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x29a47
movq 0x8(%rbx), %rax
movq 0x50(%rbx), %rcx
movq %rax, 0x8(%rcx)
movq 0x50(%rbx), %rax
movq $0x1de, 0x18(%rax)      # imm = 0x1DE
movq 0x8(%rbx), %rax
movq 0x50(%rbx), %rcx
leaq 0x20(%rcx), %rdx
movq %rdx, 0x50(%rbx)
movq %rax, 0x28(%rcx)
movq 0x50(%rbx), %rax
movq $0x190, 0x18(%rax)      # imm = 0x190
addq $0x20, 0x50(%rbx)
movq 0x130(%rbx), %r14
jmp 0x642d7
movq %rbx, %rdi
movq %r14, %rsi
callq 0x29974
movq %rax, %r15
testq %rax, %rax
jne 0x6442d
leaq 0x7ad15(%rip), %rsi     # 0xdf1b3
leaq 0x838ac(%rip), %rdx     # 0xe7d51
movq %rbx, %rdi
movq %r14, %rcx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xd9a5