// File: /workspace/github_c_makefile_star2_O1/BernardTatin[P]s7sh/s7.c
// Function: g_varlet
static s7_pointer g_varlet(s7_scheme *sc, s7_pointer args)
    {
#define H_varlet "(varlet env ...) adds its arguments (a let, a cons: symbol . value, or two arguments, the symbol and its value) \
        to the let env, and returns env.  (varlet (curlet) 'a 1) adds 'a to the current environment with the value 1."
#define Q_varlet s7_make_circular_signature(sc, 2, 4, sc->is_let_symbol, \
        s7_make_signature(sc, 2, sc->is_let_symbol, sc->is_null_symbol), \
        s7_make_signature(sc, 3, sc->is_pair_symbol, sc->is_symbol_symbol, sc->is_let_symbol), \
        sc->T)
        /* varlet = with-let + define */
        s7_pointer x, e, sym, val, p;

        e = car(args);
        if (is_null(e))
            e = sc->rootlet;
        else
        {
            check_method(sc, e, sc->varlet_symbol, args);
            if (!is_let(e))
                return(wrong_type_argument_with_type(sc, sc->varlet_symbol, 1, e, a_let_string));
            if ((is_immutable(e)) || (e == sc->s7_let))
                return(s7_wrong_type_arg_error(sc, "varlet", 1, e, "a mutable let"));
        }
        for (x = cdr(args); is_pair(x); x = cdr(x))
        {
            p = car(x);
            switch (type(p))
            {
                case T_SYMBOL:
                    if (is_keyword(p))
                        sym = keyword_symbol(p);
                    else sym = p;
                    if (!is_pair(cdr(x)))
                        s7_error(sc, sc->error_symbol, set_elist_3(sc, value_is_missing_string, sc->varlet_symbol, car(x)));
                    if (is_constant_symbol(sc, sym))
                        return(wrong_type_argument_with_type(sc, sc->varlet_symbol, position_of(x, args), sym, a_non_constant_symbol_string));
                    x = cdr(x);
                    val = car(x);
                    break;

                case T_PAIR:
                    sym = car(p);
                    if (!is_symbol(sym))
                        return(wrong_type_argument_with_type(sc, sc->varlet_symbol, position_of(x, args), p, a_symbol_string));
                    if (is_constant_symbol(sc, sym))
                        return(wrong_type_argument_with_type(sc, sc->varlet_symbol, position_of(x, args), sym, a_non_constant_symbol_string));
                    val = cdr(p);
                    break;

                case T_LET:
                    append_let(sc, e, check_c_obj_env(sc, p, sc->varlet_symbol));
                    continue;

                default:
                    return(wrong_type_argument_with_type(sc, sc->varlet_symbol, position_of(x, args), p, a_symbol_string));
            }

            if (e == sc->rootlet)
            {
                if (is_slot(global_slot(sym)))
                {
                    if (is_syntax(slot_value(global_slot(sym))))
                        return(wrong_type_argument_with_type(sc, sc->varlet_symbol, position_of(x, args), p, wrap_string(sc, "a non-syntactic keyword", 23)));
                    /*  without this check we can end up turning our code into gibberish:
                     *    (set! quote 1) -> ;can't set! quote
                     *    (varlet (rootlet) '(quote . 1)), :quote -> 1
                     * or worse set quote to a function of one arg that tries to quote something -- infinite loop
                     */
                    slot_set_value_with_hook(global_slot(sym), val);
                }
                else s7_make_slot(sc, e, sym, val);
            }
            else
            {
                if ((has_let_fallback(e)) &&
                        ((sym == sc->let_ref_fallback_symbol) || (sym == sc->let_set_fallback_symbol)))
                    return(s7_error(sc, sc->error_symbol, set_elist_2(sc, wrap_string(sc, "varlet can't shadow ~S", 22), sym)));

                make_slot_1(sc, e, sym, val);
            }
            /* this used to check for sym already defined, and set its value, but that greatly slows down
             *   the most common use (adding a slot), and makes it hard to shadow explicitly.  Don't use
             *   varlet as a substitute for set!/let-set!.
             */
        }
        return(e);
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq 0x8(%rsi), %rax
movq 0x110(%rdi), %r15
cmpq %r15, %rax
je 0x652a2
movb $0x1, %bpl
movq %rax, (%rsp)
testb $0x40, 0x3(%rax)
je 0x6524f
cmpb $0x1, 0x24c(%rbx)
jne 0x6524f
movq %rbx, %rdi
movq (%rsp), %rsi
callq 0x9a55
movq 0x1640(%rbx), %rdx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x99ef
cmpq 0x128(%rbx), %rax
je 0x6524f
cmpb $0x1, (%r14)
jne 0x6558d
movq %rax, 0x10(%rsp)
movq %r14, 0x4c8(%rbx)
movq 0x8(%r14), %r12
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0x65192
movq %rbx, %rdi
callq 0xb389
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %rax
movq $0x200001, (%rax)       # imm = 0x200001
movq %r12, 0x8(%rax)
movq %r15, 0x10(%rax)
movq %rax, 0x8(%rsp)
movq %rax, 0x4e8(%rbx)
movq 0x10(%r14), %r15
cmpb $0x1, (%r15)
jne 0x6522b
movq 0x8(%rsp), %rbp
movq 0x8(%r15), %r12
movq 0x90(%rbx), %rax
movq 0x110(%rbx), %r13
cmpq 0x98(%rbx), %rax
ja 0x651f5
movq %rbx, %rdi
callq 0xb389
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %rax
movq $0x200001, (%rax)       # imm = 0x200001
movq %r12, 0x8(%rax)
movq %r13, 0x10(%rax)
movq %rax, 0x10(%rbp)
movq 0x10(%r15), %r15
cmpb $0x1, (%r15)
movq %rax, %rbp
je 0x651d2
movq 0x110(%rbx), %rax
movq %rax, 0x4e8(%rbx)
movq %rax, 0x4c8(%rbx)
movq 0x10(%rsp), %rax
movq 0x8(%rsp), %rdx
jmp 0x65590
movq (%rsp), %r15
testb %bpl, %bpl
je 0x65550
cmpb $0x1c, (%r15)
jne 0x65562
testb $0x1, 0x3(%r15)
jne 0x65276
cmpq 0x2150(%rbx), %r15
jne 0x652a9
leaq 0xb0298(%rip), %rsi     # 0x115515
leaq 0xbf1f1(%rip), %r8      # 0x124475
movl $0x1, %edx
movq %rbx, %rdi
movq %r15, %rcx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xe25f
movq 0x150(%rbx), %r15
movq 0x10(%r14), %r12
cmpb $0x1, (%r12)
jne 0x6554d
movq %r15, (%rsp)
movq 0x8(%r12), %r10
movzbl (%r10), %eax
cmpl $0x1, %eax
je 0x653ff
cmpl $0x1c, %eax
je 0x653da
cmpl $0xa, %eax
jne 0x656b9
testb $-0x80, 0x6(%r10)
movq %r10, %r13
je 0x652f6
movq 0x8(%r10), %rax
movq 0x20(%rax), %rax
movq 0x18(%rax), %r13
movq 0x10(%r12), %rax
cmpb $0x1, (%rax)
je 0x65345
movq 0xea8(%rbx), %rsi
movq 0xf0ba2(%rip), %rax     # 0x155eb0
movq 0x1640(%rbx), %rcx
movq 0x6e8(%rbx), %rdx
movq %rax, 0x8(%rdx)
movq 0x10(%rdx), %rax
movq %rcx, 0x8(%rax)
movq 0x10(%rax), %rax
movq %r10, 0x8(%rax)
movq 0x6e8(%rbx), %rdx
movq %rbx, %rdi
movq %r10, %rbp
callq 0x3b366
movq %rbp, %r10
testb $0x1, 0x3(%r13)
jne 0x6560d
testb $0x1, 0x6(%r13)
je 0x653cb
movq 0x8(%rbx), %rcx
movq 0x18(%rcx), %rsi
movq 0x20(%r13), %rdx
movl $0x18, %eax
cmpq %rdx, %rsi
je 0x653b7
jle 0x6537c
movq 0x10(%rcx), %rcx
movq 0x18(%rcx), %rsi
cmpq %rsi, %rdx
jl 0x6536f
cmpq %rdx, %rsi
je 0x653b7
movl $0x10, %eax
cmpb $0x1c, (%rcx)
jne 0x653b7
movq 0x8(%rcx), %rsi
testq %rsi, %rsi
sete %dil
je 0x653a9
cmpq %r13, 0x8(%rsi)
je 0x653a4
movq 0x18(%rsi), %rsi
jmp 0x6538f
xorl %edi, %edi
movq %rsi, %rdx
testb %dil, %dil
je 0x653bc
movq 0x10(%rcx), %rcx
cmpb $0x1c, (%rcx)
je 0x6538b
movq (%r13,%rax), %rdx
cmpb $0x20, (%rdx)
jne 0x653cb
testb $0x1, 0x3(%rdx)
jne 0x6560d
movq 0x10(%r12), %r12
leaq 0x8(%r12), %rax
jmp 0x65498
movq 0x1640(%rbx), %rdx
movq %rbx, %rdi
movq %r10, %rsi
callq 0x95352
movq %rbx, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x950f5
jmp 0x6553d
movq 0x8(%r10), %r13
cmpb $0xa, (%r13)
jne 0x656d7
testb $0x1, 0x3(%r13)
jne 0x6562b
testb $0x1, 0x6(%r13)
je 0x65494
movq 0x8(%rbx), %rcx
movq 0x18(%rcx), %rsi
movq 0x20(%r13), %rdx
movl $0x18, %eax
cmpq %rdx, %rsi
je 0x65480
jle 0x65445
movq 0x10(%rcx), %rcx
movq 0x18(%rcx), %rsi
cmpq %rsi, %rdx
jl 0x65438
cmpq %rdx, %rsi
je 0x65480
movl $0x10, %eax
cmpb $0x1c, (%rcx)
jne 0x65480
movq 0x8(%rcx), %rsi
testq %rsi, %rsi
sete %dil
je 0x65472
cmpq %r13, 0x8(%rsi)
je 0x6546d
movq 0x18(%rsi), %rsi
jmp 0x65458
xorl %edi, %edi
movq %rsi, %rdx
testb %dil, %dil
je 0x65485
movq 0x10(%rcx), %rcx
cmpb $0x1c, (%rcx)
je 0x65454
movq (%r13,%rax), %rdx
cmpb $0x20, (%rdx)
jne 0x65494
testb $0x1, 0x3(%rdx)
jne 0x6562b
leaq 0x10(%r10), %rax
movq (%rax), %rbp
cmpq 0x150(%rbx), %r15
je 0x654d8
testb $0xc, 0x3(%r15)
je 0x654c5
cmpq 0x1228(%rbx), %r13
je 0x655a5
cmpq 0x1238(%rbx), %r13
je 0x655a5
movq %rbx, %rdi
movq %r15, %rsi
movq %r13, %rdx
movq %rbp, %rcx
callq 0xb169
jmp 0x6553d
movq 0x10(%r13), %r15
cmpb $0x20, (%r15)
jne 0x6551e
movq 0x10(%r15), %rax
cmpb $0x9, (%rax)
je 0x65779
movq 0x200(%rbx), %rax
movq 0x18e0(%rbx), %rsi
movq 0x18(%rax), %rdx
movq %rbx, %rdi
callq 0xcd2c
cmpb $0x1, (%rax)
jne 0x65535
movq %rbx, %rdi
movq %r15, %rsi
movq %rbp, %rdx
callq 0xadbc
jmp 0x65539
movq %rbx, %rdi
movq (%rsp), %r15
movq %r15, %rsi
movq %r13, %rdx
movq %rbp, %rcx
callq 0xaaca
jmp 0x6553d
movq %rbp, 0x10(%r15)
movq (%rsp), %r15
movq 0x10(%r12), %r12
cmpb $0x1, (%r12)
je 0x652bc
movq %r15, %r12
movq %r12, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x1640(%rbx), %rax
movq 0x8(%rax), %rsi
movq 0xe93e4(%rip), %rdx     # 0x14e958
movq 0x140(%rbx), %r8
movq 0xed3d6(%rip), %r9      # 0x152958
movq %rbx, %rdi
movq %r15, %rcx
jmp 0x65766
movq %r15, %rdx
movq %rbx, %rdi
movq %rax, %rsi
callq 0xbd41
movq %rax, %r12
xorl %ebp, %ebp
jmp 0x6524f
movq 0xea8(%rbx), %r12
movq 0x820(%rbx), %rax
movslq 0x7dc(%rbx), %rcx
movq (%rax,%rcx,8), %rax
incl %ecx
andl $0x7, %ecx
movl %ecx, 0x7dc(%rbx)
leaq 0xbeeb3(%rip), %rcx     # 0x124483
movq %rcx, 0x10(%rax)
movq $0x16, 0x8(%rax)
movq 0x6e0(%rbx), %rcx
movq %rax, 0x8(%rcx)
movq 0x6e0(%rbx), %rax
movq 0x10(%rax), %rax
movq %r13, 0x8(%rax)
movq 0x6e0(%rbx), %rdx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x3b366
jmp 0x65550
movq 0x1640(%rbx), %rax
movl $0x1, %ecx
cmpq %r14, %r12
je 0x65647
incl %ecx
movq 0x10(%r14), %r14
cmpq %r12, %r14
jne 0x6561e
jmp 0x65647
movq 0x1640(%rbx), %rax
movl $0x1, %ecx
cmpq %r14, %r12
je 0x65647
incl %ecx
movq 0x10(%r14), %r14
cmpq %r12, %r14
jne 0x6563c
movq 0x8(%rax), %r14
movslq %ecx, %r15
cmpl $0x7ff, %r15d           # imm = 0x7FF
ja 0x65664
leaq 0xe92f2(%rip), %rax     # 0x14e950
movq (%rax,%r15,8), %rdx
jmp 0x6569d
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0x6567c
movq %rbx, %rdi
callq 0xb389
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %rdx
movq $0xb, (%rdx)
movq %r15, 0x8(%rdx)
movq 0x140(%rbx), %r8
movq 0xf080d(%rip), %r9      # 0x155eb8
movq %rbx, %rdi
movq %r14, %rsi
movq %r13, %rcx
jmp 0x65766
movq 0x1640(%rbx), %rax
movl $0x1, %ecx
cmpq %r14, %r12
je 0x656f3
incl %ecx
movq 0x10(%r14), %r14
cmpq %r12, %r14
jne 0x656ca
jmp 0x656f3
movq 0x1640(%rbx), %rax
movl $0x1, %ecx
cmpq %r14, %r12
je 0x656f3
incl %ecx
movq 0x10(%r14), %r14
cmpq %r12, %r14
jne 0x656e8
movq 0x8(%rax), %r14
movslq %ecx, %r15
cmpl $0x7ff, %r15d           # imm = 0x7FF
ja 0x65710
leaq 0xe9246(%rip), %rax     # 0x14e950
movq (%rax,%r15,8), %rdx
jmp 0x6574f
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0x6572e
movq %rbx, %rdi
movq %r10, %r12
callq 0xb389
movq %r12, %r10
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %rdx
movq $0xb, (%rdx)
movq %r15, 0x8(%rdx)
movq 0x140(%rbx), %r8
movq 0xed203(%rip), %r9      # 0x152960
movq %rbx, %rdi
movq %r14, %rsi
movq %r10, %rcx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xb31d
movq 0x1640(%rbx), %rax
movl $0x1, %ecx
cmpq %r14, %r12
je 0x65795
incl %ecx
movq 0x10(%r14), %r14
cmpq %r12, %r14
jne 0x6578a
movq 0x8(%rax), %r14
movslq %ecx, %r15
cmpl $0x7ff, %r15d           # imm = 0x7FF
ja 0x657b2
leaq 0xe91a4(%rip), %rax     # 0x14e950
movq (%rax,%r15,8), %rdx
jmp 0x657f1
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0x657d0
movq %rbx, %rdi
movq %r10, %r12
callq 0xb389
movq %r12, %r10
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %rdx
movq $0xb, (%rdx)
movq %r15, 0x8(%rdx)
movq 0x140(%rbx), %r8
movq 0x820(%rbx), %rax
movslq 0x7dc(%rbx), %rcx
movq (%rax,%rcx,8), %r9
leal 0x1(%rcx), %eax
andl $0x7, %eax
movl %eax, 0x7dc(%rbx)
leaq 0xb9ce0(%rip), %rax     # 0x11f4fd
movq %rax, 0x10(%r9)
movq $0x17, 0x8(%r9)
jmp 0x6575d