// File: /workspace/github_c_makefile_star2_O2/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 0x9597
testb $0x1, 0x3(%rax)
jne 0x95b3
cmpq $0x0, 0x6a0(%rbx)
jne 0x955a
movzbl (%r12), %eax
leaq 0x10c3c7(%rip), %rcx    # 0x115910
cmpb $0x1, (%rax,%rcx)
jne 0x955a
movq %rbx, %rdi
movq %r12, %rsi
callq 0x973a
movq 0x10(%r14), %r15
cmpb $0x20, (%r15)
jne 0x961a
incl 0x28(%r14)
movq 0x200(%rbx), %rsi
movq %rbx, %rdi
callq 0x97c7
cmpb $0x1, (%rax)
jne 0x96c9
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x97da
jmp 0x96cd
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 0x9a09
movq 0x820(%rbx), %rax
movslq 0x7dc(%rbx), %rcx
movq (%rax,%rcx,8), %rax
incl %ecx
andl $0x7, %ecx
movl %ecx, 0x7dc(%rbx)
leaq 0xcc9d3(%rip), %rcx     # 0xd5faa
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), %rsi
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x972b
movq 0x150(%rbx), %r13
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x982d
movq %rax, %r15
movq 0x10(%r13), %rax
movq 0x160(%rbx), %rcx
leaq 0x1(%rcx), %rsi
movq %rsi, 0x160(%rbx)
movq %r15, (%rax,%rcx,8)
movq 0x8(%r13), %rdx
cmpq %rdx, %rsi
jge 0x96df
movq %r15, 0x10(%r14)
cmpq $0x0, 0x20(%r14)
movq (%r14), %rax
jne 0x96b2
btl $0x1d, %eax
jb 0x969f
movq 0x8(%r14), %rcx
movq 0x20(%rcx), %rcx
movq 0x20(%rcx), %rcx
cmpq 0x128(%rbx), %rcx
jne 0x969f
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x982d
movq 0x8(%r14), %rcx
movq 0x20(%rcx), %rcx
movq %rax, 0x20(%rcx)
movq (%r14), %rax
movq %r15, 0x18(%r14)
btl $0x14, %eax
jb 0x96b2
orq $0x10000, %rax          # imm = 0x10000
movq %rax, (%r14)
incl 0x28(%r14)
btl $0x1d, %eax
jae 0x96cd
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9897
jmp 0x96cd
movq %r12, 0x10(%r15)
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq (%rdx,%rdx), %rbp
movq %rbp, 0x8(%r13)
movq 0x18(%r13), %rsi
shlq $0x4, %rdx
movq %rbx, %rdi
callq 0x9859
andq $0x0, 0x20(%rax)
movq %rax, 0x18(%r13)
movq (%rax), %rax
movq %rax, 0x10(%r13)
movq 0x160(%rbx), %rax
cmpq %rbp, %rax
jge 0x9659
movq 0x110(%rbx), %rcx
movq 0x10(%r13), %rdx
movq %rcx, (%rdx,%rax,8)
incq %rax
jmp 0x970e