// File: /workspace/github_c_makefile_star2_O1/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
subq $0x98, %rsp
movq %rsi, %rcx
movq %rdi, %rbx
movq 0x8(%rsi), %r14
cmpb $0x13, (%r14)
jne 0x82974
movq 0x10(%rcx), %rax
cmpb $0x1, (%rax)
jne 0x829a3
movq 0x8(%rax), %rcx
cmpb $0x1c, (%rcx)
jne 0x829b3
cmpq 0x2150(%rbx), %rcx
je 0x829e0
cmpq 0x150(%rbx), %rcx
je 0x82a47
movq %rcx, 0x8(%rbx)
jmp 0x82a52
movq 0x1288(%rbx), %rdx
movq %rbx, %rdi
movq %r14, %rsi
movl $0x13, %r8d
movl $0x1, %r9d
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xf1ae
movq 0x110(%rbx), %rax
movq %rax, 0x8(%rbx)
jmp 0x82a5c
movq 0x1288(%rbx), %rax
movq 0x8(%rax), %rsi
movq 0xcbf9b(%rip), %rdx     # 0x14e960
movq 0x140(%rbx), %r8
movq 0xcff85(%rip), %r9      # 0x152958
movq %rbx, %rdi
callq 0xb31d
movq %rax, %r15
jmp 0x82a43
movq 0x1940(%rbx), %r15
movq 0x820(%rbx), %rax
movslq 0x7dc(%rbx), %rcx
movq (%rax,%rcx,8), %rax
incl %ecx
andl $0x7, %ecx
movl %ecx, 0x7dc(%rbx)
leaq 0xa222c(%rip), %rcx     # 0x124c37
movq %rcx, 0x10(%rax)
movq $0x17, 0x8(%rax)
movq 0x6e0(%rbx), %rcx
movq %rax, 0x8(%rcx)
movq 0x6e0(%rbx), %rax
movq 0x10(%rax), %rax
movq %r14, 0x8(%rax)
movq 0x6e0(%rbx), %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3b366
xorl %eax, %eax
jmp 0x82a54
movq 0x110(%rbx), %rax
movq %rax, 0x8(%rbx)
movb $0x1, %al
testb %al, %al
je 0x82b30
movq 0x10(%r14), %r15
testq %r15, %r15
je 0x82acd
cmpb $0x0, (%r15)
je 0x82acd
leaq 0x8(%rsp), %rsi
movq %r15, %rdi
callq 0x93d0
testl %eax, %eax
js 0x82b45
movl $0xf000, %eax           # imm = 0xF000
andl 0x20(%rsp), %eax
cmpl $0x4000, %eax           # imm = 0x4000
jne 0x82b45
movq 0x1940(%rbx), %r15
movq 0x820(%rbx), %rax
movslq 0x7dc(%rbx), %rcx
movq (%rax,%rcx,8), %rax
incl %ecx
andl $0x7, %ecx
movl %ecx, 0x7dc(%rbx)
leaq 0xa21c0(%rip), %rcx     # 0x124c7f
movq %rcx, 0x10(%rax)
movq $0x21, 0x8(%rax)
jmp 0x82b04
movq 0x1948(%rbx), %r15
movq 0x820(%rbx), %rax
movslq 0x7dc(%rbx), %rcx
movq (%rax,%rcx,8), %rax
incl %ecx
andl $0x7, %ecx
movl %ecx, 0x7dc(%rbx)
leaq 0xa2157(%rip), %rcx     # 0x124c4f
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 %r14, 0x8(%rax)
movq 0x6e0(%rbx), %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3b366
movq %r15, %rax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x8(%rbx), %rdx
cmpq 0x110(%rbx), %rdx
jne 0x82b59
movq 0x150(%rbx), %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3785f
testb %al, %al
je 0x82b71
movq 0x120(%rbx), %r15
jmp 0x82b30
leaq 0xa08bf(%rip), %rsi     # 0x123437
movq %r15, %rdi
callq 0x95b0
movq %rax, %r14
testq %rax, %rax
jne 0x82b96
movq %rbx, %rdi
movq %r15, %rsi
callq 0x37b6a
movq %rax, %r14
testq %r14, %r14
je 0x82c25
movq 0x1e8(%rbx), %r12
movq 0x18e0(%rbx), %rsi
movq 0x18(%r12), %rdx
movq %rbx, %rdi
callq 0xcd2c
cmpb $0x1, (%rax)
jne 0x82c38
movq %rbx, %rdi
movq %r15, %rsi
callq 0xf735
movq %rax, %r13
movq %rax, 0x520(%rbx)
movq 0x90(%rbx), %rax
movq 0x110(%rbx), %rbp
cmpq 0x98(%rbx), %rax
ja 0x82bf3
movq %rbx, %rdi
callq 0xb389
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 0xbd41
jmp 0x82c38
movq %rbx, %rdi
movq %r15, %rsi
callq 0x37c7d
movq %rax, %r14
testq %rax, %rax
je 0x82c8f
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x37d96
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), %r15
jmp 0x82b30
leaq 0x9946d(%rip), %rsi     # 0x11c103
leaq 0xa2004(%rip), %rdx     # 0x124ca1
movq %rbx, %rdi
movq %r15, %rcx
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x101e1