// File: /workspace/github_c_makefile_star2_O3/BernardTatin[P]s7sh/s7.c
// Function: g_cutlet
static s7_pointer g_cutlet(s7_scheme *sc, s7_pointer args)
    {
#define H_cutlet "(cutlet e symbol ...) removes symbols from the let e."
#define Q_cutlet s7_make_circular_signature(sc, 2, 3, sc->is_let_symbol, sc->is_let_symbol, sc->is_symbol_symbol)

        s7_pointer e, syms;
#define THE_UN_ID ++sc->let_number

        e = car(args);
        if (is_null(e))
            e = sc->rootlet;
        else
        {
            check_method(sc, e, sc->cutlet_symbol, args);
            if (!is_let(e))
                return(wrong_type_argument_with_type(sc, sc->cutlet_symbol, 1, e, a_let_string));
            if ((is_immutable(e)) || (e == sc->s7_let))
                return(immutable_object_error(sc, set_elist_3(sc, immutable_error_string, sc->cutlet_symbol, e)));
        }
        /* besides removing the slot we have to make sure the symbol_id does not match else
         *   let-ref and others will use the old slot!  What's the un-id?  Perhaps the next one?
         *   (let ((b 1)) (let ((b 2)) (cutlet (curlet) 'b)) b)
         */

        for (syms = cdr(args); is_pair(syms); syms = cdr(syms))
        {
            s7_pointer sym, slot;
            sym = car(syms);

            if (!is_symbol(sym))
                return(wrong_type_argument_with_type(sc, sc->cutlet_symbol, position_of(syms, args), sym, a_symbol_string));

            if (is_keyword(sym))
                sym = keyword_symbol(sym);

            if (e == sc->rootlet)
            {
                if (is_slot(global_slot(sym)))
                {
                    symbol_set_id(sym, THE_UN_ID);
                    slot_set_value(global_slot(sym), sc->undefined);
                }
            }
            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, "cutlet can't remove ~S", 22), sym)));

                slot = let_slots(e);
                if (tis_slot(slot))
                {
                    if (slot_symbol(slot) == sym)
                    {
                        let_set_slots(e, next_slot(let_slots(e)));
                        symbol_set_id(sym, THE_UN_ID);
                    }
                    else
                    {
                        s7_pointer last_slot;
                        last_slot = slot;
                        for (slot = next_slot(let_slots(e)); tis_slot(slot); last_slot = slot, slot = next_slot(slot))
                            if (slot_symbol(slot) == sym)
                            {
                                symbol_set_id(sym, THE_UN_ID);
                                slot_set_next(last_slot, next_slot(slot));
                                break;
                            }}}}}
        return(e);
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %rbx
movq 0x8(%rsi), %r14
movq 0x110(%rdi), %r13
cmpq %r13, %r14
je 0x60a89
movq (%r14), %rbp
btl $0x1e, %ebp
jae 0x60a34
cmpb $0x1, 0x24c(%rbx)
jne 0x60a34
movq %rbx, %rdi
movq %r14, %rsi
callq 0x8a63
movq 0xe60(%rbx), %rdx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x89ff
cmpq 0x128(%rbx), %rax
je 0x60a34
cmpb $0x1, (%r15)
jne 0x60c99
movq %rax, (%rsp)
movq %r15, 0x4c8(%rbx)
movq 0x8(%r15), %rbp
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0x6098b
movq %rbx, %rdi
callq 0xa550
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %r14
movq $0x200001, (%r14)       # imm = 0x200001
movq %rbp, 0x8(%r14)
movq %r13, 0x10(%r14)
movq %r14, 0x4e8(%rbx)
movq 0x10(%r15), %r15
cmpb $0x1, (%r15)
jne 0x60a16
movq %r14, %r13
movq 0x8(%r15), %rbp
movq 0x90(%rbx), %rax
movq 0x110(%rbx), %r12
cmpq 0x98(%rbx), %rax
ja 0x609e7
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 %r12, 0x10(%rax)
movq %rax, 0x10(%r13)
movq 0x10(%r15), %r15
cmpb $0x1, (%r15)
movq %rax, %r13
je 0x609bd
movq 0x110(%rbx), %rax
movq %rax, 0x4e8(%rbx)
movq %rax, 0x4c8(%rbx)
movq (%rsp), %rax
jmp 0x60c9c
cmpb $0x1c, %bpl
jne 0x60b89
btl $0x18, %ebp
jb 0x60a4d
cmpq 0x2150(%rbx), %r14
jne 0x60a90
movq 0xe9f14(%rip), %rax     # 0x14a968
movq 0xe60(%rbx), %rcx
movq 0x6e8(%rbx), %rdx
movq %rax, 0x8(%rdx)
movq 0x10(%rdx), %rax
movq %rcx, 0x8(%rax)
movq 0x10(%rax), %rax
movq %r14, 0x8(%rax)
movq 0x6e8(%rbx), %rdx
movq 0xea8(%rbx), %r14
jmp 0x60c7c
movq 0x150(%rbx), %r14
movq 0x10(%r15), %rax
cmpb $0x1, (%rax)
jne 0x60c87
movq 0x8(%rax), %r12
cmpb $0xa, (%r12)
jne 0x60bb4
testb $-0x80, 0x6(%r12)
je 0x60ac1
movq 0x8(%r12), %rcx
movq 0x20(%rcx), %rcx
movq 0x18(%rcx), %r12
cmpq 0x150(%rbx), %r14
je 0x60b30
testb $0xc, 0x3(%r14)
je 0x60aeb
cmpq 0x1228(%rbx), %r12
je 0x60c24
cmpq 0x1238(%rbx), %r12
je 0x60c24
movq 0x8(%r14), %rcx
testq %rcx, %rcx
je 0x60b80
cmpq %r12, 0x8(%rcx)
je 0x60b62
movq %rcx, %rdx
movq 0x18(%rcx), %rcx
testq %rcx, %rcx
je 0x60b80
cmpq %r12, 0x8(%rcx)
jne 0x60afe
movq 0x250(%rbx), %rsi
incq %rsi
movq %rsi, 0x250(%rbx)
movq %rsi, 0x20(%r12)
movq 0x18(%rcx), %rcx
movq %rcx, 0x18(%rdx)
jmp 0x60b80
movq 0x10(%r12), %rcx
cmpb $0x20, (%rcx)
jne 0x60b80
movq 0x250(%rbx), %rcx
incq %rcx
movq %rcx, 0x250(%rbx)
movq %rcx, 0x20(%r12)
movq 0x128(%rbx), %rcx
movq 0x10(%r12), %rdx
movq %rcx, 0x10(%rdx)
jmp 0x60b80
movq 0x18(%rcx), %rcx
movq %rcx, 0x8(%r14)
movq 0x250(%rbx), %rcx
incq %rcx
movq %rcx, 0x250(%rbx)
movq %rcx, 0x20(%r12)
movq 0x10(%rax), %rax
jmp 0x60a94
movq 0xe60(%rbx), %rax
movq 0x8(%rax), %rsi
movq 0xe5dbd(%rip), %rdx     # 0x146958
movq 0x140(%rbx), %r8
movq 0xe9daf(%rip), %r9      # 0x14a958
movq %rbx, %rdi
movq %r14, %rcx
jmp 0x60ce0
movq 0xe60(%rbx), %rcx
movq 0x8(%rcx), %r14
cmpq %r15, %rax
je 0x60cb8
xorl %ecx, %ecx
movq 0x10(%r15), %r15
incq %rcx
cmpq %rax, %r15
jne 0x60bca
leaq 0x1(%rcx), %r15
cmpl $0x7fe, %ecx            # imm = 0x7FE
jbe 0x60cbe
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0x60c05
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 %r15, 0x8(%rdx)
jmp 0x60cc9
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 0xba95b(%rip), %rcx     # 0x11b5aa
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 %r12, 0x8(%rax)
movq 0x6e0(%rbx), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x38dfa
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r13, %r14
movq %rbx, %rdi
movq %rax, %rsi
movq %r14, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xaee6
movl $0x1, %r15d
leaq 0xe5c8b(%rip), %rax     # 0x146950
movq (%rax,%r15,8), %rdx
movq 0x140(%rbx), %r8
movq 0xe9c89(%rip), %r9      # 0x14a960
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rcx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xa4e4