// File: /workspace/github_c_makefile_star2_O3/BernardTatin[P]s7sh/s7.c
// Function: s7_make_slot
s7_pointer s7_make_slot(s7_scheme *sc, s7_pointer env, s7_pointer symbol, s7_pointer value)
    {
        if ((!is_let(env)) ||
                (env == sc->rootlet))
        {
            s7_pointer ge, slot;
            if (is_immutable(sc->rootlet))
                return(immutable_object_error(sc, set_elist_2(sc, wrap_string(sc, "can't define '~S; rootlet is immutable", 38), symbol)));
            if ((sc->safety == NO_SAFETY) &&
                    (has_closure_let(value)))
                remove_function_from_heap(sc, value);

            /* first look for existing slot -- this is not always checked before calling s7_make_slot */
            if (is_slot(global_slot(symbol)))
            {
                slot = global_slot(symbol);
                symbol_increment_ctr(symbol);
                slot_set_value_with_hook(slot, value);
                return(slot);
            }

            ge = sc->rootlet;
            slot = make_permanent_slot(sc, symbol, value);
            rootlet_element(ge, sc->rootlet_entries++) = slot;
            if (sc->rootlet_entries >= vector_length(ge))
            {
                s7_int i, len;
                block_t *ob, *nb;
                vector_length(ge) *= 2;
                len = vector_length(ge);
                ob = rootlet_block(ge);
                nb = reallocate(sc, ob, len * sizeof(s7_pointer));
                block_info(nb) = NULL;
                rootlet_block(ge) = nb;
                rootlet_elements(ge) = (s7_pointer *)block_data(nb);
                for (i = sc->rootlet_entries; i < len; i++)
                    rootlet_element(ge, i) = sc->nil;
            }
            set_global_slot(symbol, slot);

            if (symbol_id(symbol) == 0)    /* never defined locally? */
            {
                if (!is_gensym(symbol))
                {
                    if (initial_slot(symbol) == sc->undefined)
                        set_initial_slot(symbol, make_permanent_slot(sc, symbol, value));
                }
                set_local_slot(symbol, slot);
                set_global(symbol);
            }
            symbol_increment_ctr(symbol);
            if (is_gensym(symbol))
                s7_remove_from_heap(sc, symbol);
            return(slot);
        }

        return(make_slot_1(sc, env, symbol, value));
        /* there are about the same number of frames as local variables -- this strikes me as surprising, but it holds up across a lot of code. */
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r12
movq %rdx, %r14
movq %rdi, %rbx
cmpb $0x1c, (%rsi)
setne %cl
movq 0x150(%rdi), %rax
cmpq %rsi, %rax
sete %dl
orb %cl, %dl
cmpb $0x1, %dl
jne 0x9d2b
testb $0x1, 0x3(%rax)
jne 0x9d47
cmpq $0x0, 0x6a0(%rbx)
jne 0x9ce6
movzbl (%r12), %eax
leaq 0x13cc3b(%rip), %rcx    # 0x146910
cmpb $0x1, (%rax,%rcx)
jne 0x9ce6
movq %rbx, %rdi
movq %r12, %rsi
callq 0x9ee3
movq 0x10(%r14), %r15
cmpb $0x20, (%r15)
jne 0x9dbc
incl 0x28(%r14)
movq 0x200(%rbx), %rax
movq 0x18e0(%rbx), %rsi
movq 0x18(%rax), %rdx
movq %rbx, %rdi
callq 0xbe9a
cmpb $0x1, (%rax)
jne 0x9eda
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x9f83
jmp 0x9daa
movq %rbx, %rdi
movq %r14, %rdx
movq %r12, %rcx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xa332
movq 0x820(%rbx), %rax
movslq 0x7dc(%rbx), %rcx
movq (%rax,%rcx,8), %rax
incl %ecx
andl $0x7, %ecx
movl %ecx, 0x7dc(%rbx)
leaq 0x10029f(%rip), %rcx    # 0x10a00a
movq %rcx, 0x10(%rax)
movq $0x26, 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 0xea8(%rbx), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x38dfa
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movabsq $0x4000000000000020, %r13 # imm = 0x4000000000000020
movq 0x150(%rbx), %rbp
movq %rbx, %rdi
callq 0xec9f
movq %rax, %r15
movq %r13, (%rax)
movq %r14, 0x8(%rax)
movq %r12, 0x10(%rax)
movq 0x10(%rbp), %rax
movq 0x160(%rbx), %rcx
leaq 0x1(%rcx), %rsi
movq %rsi, 0x160(%rbx)
movq %r15, (%rax,%rcx,8)
movq 0x8(%rbp), %rdx
cmpq %rdx, %rsi
jl 0x9e54
leaq (%rdx,%rdx), %r13
movq %r13, 0x8(%rbp)
movq 0x18(%rbp), %rsi
shlq $0x4, %rdx
movq %rbx, %rdi
callq 0x9fd6
movq $0x0, 0x20(%rax)
movq %rax, 0x18(%rbp)
movq (%rax), %rax
movq %rax, 0x10(%rbp)
movq 0x160(%rbx), %rax
cmpq %r13, %rax
jge 0x9e54
movq 0x110(%rbx), %rcx
movq 0x10(%rbp), %rdx
movq %rcx, (%rdx,%rax,8)
incq %rax
cmpq %rax, %r13
jne 0x9e44
movq %r15, 0x10(%r14)
cmpq $0x0, 0x20(%r14)
movq (%r14), %rax
jne 0x9ebc
btl $0x1d, %eax
jb 0x9ea9
movq 0x8(%r14), %rcx
movq 0x20(%rcx), %rcx
movq 0x20(%rcx), %rcx
cmpq 0x128(%rbx), %rcx
jne 0x9ea9
movq %rbx, %rdi
callq 0xec9f
movabsq $0x4000000000000020, %rcx # imm = 0x4000000000000020
movq %rcx, (%rax)
movq %r14, 0x8(%rax)
movq %r12, 0x10(%rax)
movq 0x8(%r14), %rcx
movq 0x20(%rcx), %rcx
movq %rax, 0x20(%rcx)
movq (%r14), %rax
movq %r15, 0x18(%r14)
btl $0x14, %eax
jb 0x9ebc
orq $0x10000, %rax          # imm = 0x10000
movq %rax, (%r14)
incl 0x28(%r14)
btl $0x1d, %eax
jae 0x9daa
movq %rbx, %rdi
movq %r14, %rsi
callq 0xa04c
jmp 0x9daa
movq %r12, 0x10(%r15)
jmp 0x9daa