// File: /workspace/github_c_makefile_star2_O3/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), %r10
movq 0x110(%rdi), %r13
cmpq %r13, %r10
je 0x6032c
movq (%r10), %r12
btl $0x1e, %r12d
jae 0x602e6
cmpb $0x1, 0x24c(%rbx)
jne 0x602e6
movq %rbx, %rdi
movq %r10, %rsi
movq %r10, %r15
callq 0x8a63
movq 0x1640(%rbx), %rdx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x89ff
movq %r15, %r10
cmpq 0x128(%rbx), %rax
je 0x602e6
cmpb $0x1, (%r14)
jne 0x60619
movq %rax, 0x8(%rsp)
movq %r14, 0x4c8(%rbx)
movq 0x8(%r14), %rbp
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0x60239
movq %rbx, %rdi
callq 0xa550
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %r12
movq $0x200001, (%r12)       # imm = 0x200001
movq %rbp, 0x8(%r12)
movq %r13, 0x10(%r12)
movq %r12, 0x4e8(%rbx)
movq 0x10(%r14), %r14
cmpb $0x1, (%r14)
jne 0x602c7
movq %r12, %r13
movq 0x8(%r14), %rbp
movq 0x90(%rbx), %rax
movq 0x110(%rbx), %r15
cmpq 0x98(%rbx), %rax
ja 0x60298
movq %rbx, %rdi
callq 0xa550
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %rax
movq $0x200001, (%rax)       # imm = 0x200001
movq %rbp, 0x8(%rax)
movq %r15, 0x10(%rax)
movq %rax, 0x10(%r13)
movq 0x10(%r14), %r14
cmpb $0x1, (%r14)
movq %rax, %r13
je 0x6026e
movq 0x110(%rbx), %rax
movq %rax, 0x4e8(%rbx)
movq %rax, 0x4c8(%rbx)
movq 0x8(%rsp), %rax
jmp 0x6061c
cmpb $0x1c, %r12b
jne 0x605ee
btl $0x18, %r12d
jb 0x60300
cmpq 0x2150(%rbx), %r10
jne 0x60333
leaq 0xac31e(%rip), %rsi     # 0x10c625
leaq 0xbb277(%rip), %r8      # 0x11b585
movl $0x1, %edx
movq %rbx, %rdi
movq %r10, %rcx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xd4e5
movq 0x150(%rbx), %r10
movq 0x10(%r14), %r15
cmpb $0x1, (%r15)
jne 0x6069e
movq %r10, 0x8(%rsp)
movq 0x8(%r15), %r12
movzbl (%r12), %eax
cmpl $0x1, %eax
je 0x60463
cmpl $0x1c, %eax
je 0x6043b
cmpl $0xa, %eax
jne 0x60743
testb $-0x80, 0x6(%r12)
movq %r12, %r13
je 0x60382
movq 0x8(%r12), %rax
movq 0x20(%rax), %rax
movq 0x18(%rax), %r13
movq 0x10(%r15), %rax
cmpb $0x1, (%rax)
je 0x603cf
movq 0xea8(%rbx), %rsi
movq 0xedb17(%rip), %rax     # 0x14deb0
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 %r12, 0x8(%rax)
movq 0x6e8(%rbx), %rdx
movq %rbx, %rdi
callq 0x38dfa
movq 0x8(%rsp), %r10
movq (%r13), %rax
btl $0x18, %eax
jb 0x606b0
movabsq $0x1000000000000, %rcx  # imm = 0x1000000000000
testq %rcx, %rax
je 0x6042e
movq 0x8(%rbx), %rcx
movq 0x18(%rcx), %rsi
movq 0x20(%r13), %rdx
movl $0x18, %eax
cmpq %rdx, %rsi
je 0x6041a
jle 0x60411
movq 0x10(%rcx), %rcx
movq 0x18(%rcx), %rsi
cmpq %rsi, %rdx
jl 0x60404
cmpq %rdx, %rsi
jne 0x60594
movq (%r13,%rax), %rdx
cmpb $0x20, (%rdx)
jne 0x6042e
testb $0x1, 0x3(%rdx)
jne 0x606b0
movq 0x10(%r15), %r15
leaq 0x8(%r15), %rax
jmp 0x604d7
movq 0x1640(%rbx), %rdx
movq %rbx, %rdi
movq %r12, %rsi
movq %r10, %r12
callq 0x8efdf
movq %rbx, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x8ed81
jmp 0x6057c
movq 0x8(%r12), %r13
cmpb $0xa, (%r13)
jne 0x6076a
movq (%r13), %rax
btl $0x18, %eax
jb 0x606d4
movabsq $0x1000000000000, %rcx  # imm = 0x1000000000000
testq %rcx, %rax
je 0x604d2
movq 0x8(%rbx), %rcx
movq 0x18(%rcx), %rsi
movq 0x20(%r13), %rdx
movl $0x18, %eax
cmpq %rdx, %rsi
je 0x604be
jle 0x604b5
movq 0x10(%rcx), %rcx
movq 0x18(%rcx), %rsi
cmpq %rsi, %rdx
jl 0x604a8
cmpq %rdx, %rsi
jne 0x605c1
movq (%r13,%rax), %rdx
cmpb $0x20, (%rdx)
jne 0x604d2
testb $0x1, 0x3(%rdx)
jne 0x606d4
leaq 0x10(%r12), %rax
movq (%rax), %rbp
cmpq 0x150(%rbx), %r10
je 0x60517
testb $0xc, 0x3(%r10)
je 0x60504
cmpq 0x1228(%rbx), %r13
je 0x60638
cmpq 0x1238(%rbx), %r13
je 0x60638
movq %rbx, %rdi
movq %r10, %rsi
movq %r13, %rdx
movq %rbp, %rcx
callq 0xa332
jmp 0x6057c
movq %r12, 0x10(%rsp)
movq 0x10(%r13), %r12
cmpb $0x20, (%r12)
jne 0x60564
movq 0x10(%r12), %rax
cmpb $0x9, (%rax)
je 0x6082d
movq 0x200(%rbx), %rax
movq 0x18e0(%rbx), %rsi
movq 0x18(%rax), %rdx
movq %rbx, %rdi
callq 0xbe9a
cmpb $0x1, (%rax)
jne 0x60577
movq %rbx, %rdi
movq %r12, %rsi
movq %rbp, %rdx
callq 0x9f83
jmp 0x6057c
movq %rbx, %rdi
movq %r10, %rsi
movq %r13, %rdx
movq %rbp, %rcx
callq 0x9c87
jmp 0x6057c
movq %rbp, 0x10(%r12)
movq 0x10(%r15), %r15
cmpb $0x1, (%r15)
movq 0x8(%rsp), %r10
je 0x60346
jmp 0x6069e
movl $0x10, %eax
cmpb $0x1c, (%rcx)
jne 0x6041a
movq 0x8(%rcx), %rdx
testq %rdx, %rdx
je 0x605bb
cmpq %r13, 0x8(%rdx)
je 0x6041f
movq 0x18(%rdx), %rdx
jmp 0x605a6
movq 0x10(%rcx), %rcx
jmp 0x60599
movl $0x10, %eax
cmpb $0x1c, (%rcx)
jne 0x604be
movq 0x8(%rcx), %rdx
testq %rdx, %rdx
je 0x605e8
cmpq %r13, 0x8(%rdx)
je 0x604c3
movq 0x18(%rdx), %rdx
jmp 0x605d3
movq 0x10(%rcx), %rcx
jmp 0x605c6
movq 0x1640(%rbx), %rax
movq 0x8(%rax), %rsi
movq 0xe6358(%rip), %rdx     # 0x146958
movq 0x140(%rbx), %r8
movq 0xea34a(%rip), %r9      # 0x14a958
movq %rbx, %rdi
movq %r10, %rcx
jmp 0x6081a
movq %r13, %r12
movq %rbx, %rdi
movq %rax, %rsi
movq %r12, %rdx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xaee6
movq 0xea8(%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 0xbaf30(%rip), %rcx     # 0x11b593
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 %r14, %rsi
callq 0x38dfa
movq %r14, %r10
movq %r10, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x1640(%rbx), %rax
movq 0x8(%rax), %r12
cmpq %r14, %r15
je 0x607d1
xorl %eax, %eax
movq 0x10(%r14), %r14
incq %rax
cmpq %r15, %r14
jne 0x606c6
jmp 0x606f6
movq 0x1640(%rbx), %rax
movq 0x8(%rax), %r12
cmpq %r14, %r15
je 0x607d1
xorl %eax, %eax
movq 0x10(%r14), %r14
incq %rax
cmpq %r15, %r14
jne 0x606ea
leaq 0x1(%rax), %r14
cmpl $0x7fe, %eax            # imm = 0x7FE
jbe 0x607d7
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0x60724
movq %rbx, %rdi
callq 0xa550
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %rdx
movq $0xb, (%rdx)
movq %r14, 0x8(%rdx)
jmp 0x607e2
movq %r12, %r13
movq 0x1640(%rbx), %rax
movq 0x8(%rax), %r12
cmpq %r14, %r15
je 0x607f2
xorl %eax, %eax
movq 0x10(%r14), %r14
incq %rax
cmpq %r15, %r14
jne 0x6075c
jmp 0x6078b
movq %r12, %r13
movq 0x1640(%rbx), %rax
movq 0x8(%rax), %r12
cmpq %r14, %r15
je 0x607f2
xorl %eax, %eax
movq 0x10(%r14), %r14
incq %rax
cmpq %r15, %r14
jne 0x6077f
leaq 0x1(%rax), %r14
cmpl $0x7fe, %eax            # imm = 0x7FE
jbe 0x607f8
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0x607b5
movq %rbx, %rdi
callq 0xa550
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %rdx
movq $0xb, (%rdx)
movq %r14, 0x8(%rdx)
jmp 0x60803
movl $0x1, %r14d
leaq 0xe6172(%rip), %rax     # 0x146950
movq (%rax,%r14,8), %rdx
movq 0x140(%rbx), %r8
movq 0xed6c8(%rip), %r9      # 0x14deb8
jmp 0x60811
movl $0x1, %r14d
leaq 0xe6151(%rip), %rax     # 0x146950
movq (%rax,%r14,8), %rdx
movq 0x140(%rbx), %r8
movq 0xea14f(%rip), %r9      # 0x14a960
movq %rbx, %rdi
movq %r12, %rsi
movq %r13, %rcx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xa4e4
movq 0x1640(%rbx), %rax
movq 0x8(%rax), %r12
cmpq %r14, %r15
je 0x60891
xorl %eax, %eax
movq 0x10(%r14), %r14
incq %rax
cmpq %r15, %r14
jne 0x6083f
leaq 0x1(%rax), %r14
cmpl $0x7fe, %eax            # imm = 0x7FE
jbe 0x60897
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0x60875
movq %rbx, %rdi
callq 0xa550
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %rdx
movq $0xb, (%rdx)
movq %r14, 0x8(%rdx)
jmp 0x608a2
movl $0x1, %r14d
leaq 0xe60b2(%rip), %rax     # 0x146950
movq (%rax,%r14,8), %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 0xb5d3f(%rip), %rax     # 0x11660d
movq %rax, 0x10(%r9)
movq $0x17, 0x8(%r9)
movq %rbx, %rdi
movq %r12, %rsi
movq 0x10(%rsp), %rcx
jmp 0x6081a