// File: /workspace/github_c_makefile_star2_O1/BernardTatin[P]s7sh/s7.c
// Function: g_set_setter
static s7_pointer g_set_setter(s7_scheme *sc, s7_pointer args)
                {
                    s7_pointer p, setter;

                    p = car(args);
                    /* should we check that p != setter?
                     *   (set! (setter <) <) -> <
                     *   (set! (< 3 2) 3) -> #f
                     *   (set! (< 1) 2) -> #t
                     */

                    if (is_symbol(p))
                    {
                        s7_pointer sym, func, slot;
                        sym = p;
                        if (is_keyword(sym))
                            return(s7_wrong_type_arg_error(sc, "set! setter", 1, sym, "a normal symbol (a keyword can't be set)"));

                        if (is_pair(cddr(args)))
                        {
                            s7_pointer e, old_e;
                            e = cadr(args);
                            func = caddr(args);
                            if ((e == sc->rootlet) || (e == sc->nil))
                                slot = global_slot(sym);
                            else
                            {
                                if (!is_let(e))
                                    return(s7_wrong_type_arg_error(sc, "set! symbol-setter", 2, e, "a let"));
                                old_e = sc->envir;
                                sc->envir = e;
                                slot = symbol_to_slot(sc, sym);
                                sc->envir = old_e;
                            }
                        }
                        else
                        {
                            slot = symbol_to_slot(sc, sym);
                            func = cadr(args);
                        }
                        if ((!is_any_procedure(func)) && /* disallow continuation/goto here */
                                (func != sc->F))
                            return(s7_wrong_type_arg_error(sc, "set! setter", 3, func, "a function or #f"));

                        if (sym == sc->setter_symbol)
                            return(immutable_object_error(sc, set_elist_2(sc, wrap_string(sc, "can't set (setter setter) to ~S", 31), func)));

                        if (!is_slot(slot))
                            return(sc->F);

                        if (slot == global_slot(sym))
                        {
                            s7_set_setter(sc, sym, func); /* special GC protection for global vars */
                            return(func);
                        }

                        slot_set_setter(slot, func);
                        if (func != sc->F)
                        {
                            slot_set_has_setter(slot);
                            if (s7_is_aritable(sc, func, 3))
                                set_has_let_arg(func);
                            symbol_set_has_setter(sym);
                        }
                        return(func);
                    }

                    setter = cadr(args);
                    if ((setter != sc->F) &&
                            (!is_any_procedure(setter)))
                        return(s7_wrong_type_arg_error(sc, "set! setter", 2, setter, "a procedure or #f"));
                    if (p == sc->s7_let)
                        return(s7_wrong_type_arg_error(sc, "set! setter", 1, p, "something other than *s7*"));

                    switch (type(p))
                    {
                        case T_MACRO:   case T_MACRO_STAR:
                        case T_BACRO:   case T_BACRO_STAR:
                        case T_CLOSURE: case T_CLOSURE_STAR:
                            closure_set_setter(p, setter);
                            if (setter == sc->F)
                                closure_set_no_setter(p);
                            break;

                        case T_C_FUNCTION:
                        case T_C_ANY_ARGS_FUNCTION:
                        case T_C_OPT_ARGS_FUNCTION:
                        case T_C_RST_ARGS_FUNCTION:
                        case T_C_FUNCTION_STAR:
                            if (p == slot_value(global_slot(sc->setter_symbol)))
                                return(immutable_object_error(sc, set_elist_2(sc, wrap_string(sc, "can't set (setter setter) to ~S", 31), setter)));
                            c_function_set_setter(p, setter);
                            if ((is_any_closure(setter)) ||
                                    (is_any_macro(setter)))
                                add_setter(sc, p, setter);
                            break;

                        case T_C_MACRO:
                            c_macro_set_setter(p, setter);
                            if ((is_any_closure(setter)) ||
                                    (is_any_macro(setter)))
                                add_setter(sc, p, setter);
                            break;

                        case T_SLOT:
                            slot_set_setter(p, setter);
                            slot_set_has_setter(p);
                            break;
                    }
                    return(setter);
                }

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x8(%rsi), %r14
movzbl (%r14), %eax
cmpl $0xa, %eax
jne 0x428f1
testb $-0x80, 0x6(%r14)
jne 0x42944
movq 0x10(%rsi), %rcx
movq 0x10(%rcx), %rax
cmpb $0x1, (%rax)
jne 0x42998
movq 0x8(%rcx), %rcx
movq 0x8(%rax), %r15
cmpq 0x150(%rbx), %rcx
je 0x42a56
cmpq 0x110(%rbx), %rcx
je 0x42a56
cmpb $0x1c, (%rcx)
jne 0x42bbe
movq 0x8(%rbx), %rdx
movq %rcx, 0x8(%rbx)
movq 0x18(%rcx), %rdi
movq 0x20(%r14), %rax
movl $0x18, %esi
cmpq %rax, %rdi
je 0x428e4
jle 0x428a8
movq 0x10(%rcx), %rcx
movq 0x18(%rcx), %rdi
cmpq %rdi, %rax
jl 0x4289b
cmpq %rax, %rdi
je 0x428e4
movl $0x10, %esi
cmpb $0x1c, (%rcx)
jne 0x428e4
movq 0x8(%rcx), %rax
testq %rax, %rax
sete %r8b
je 0x428d0
cmpq %r14, 0x8(%rax)
je 0x428d3
movq 0x18(%rax), %rax
jmp 0x428bb
movq %rdi, %rax
testb %r8b, %r8b
je 0x428e8
movq 0x10(%rcx), %rcx
cmpb $0x1c, (%rcx)
movq %rax, %rdi
je 0x428b7
movq (%r14,%rsi), %rax
movq %rdx, 0x8(%rbx)
jmp 0x42a5a
movq 0x10(%rsi), %rcx
movq 0x8(%rcx), %r12
cmpq 0x120(%rbx), %r12
je 0x42909
cmpb $0x27, (%r12)
jbe 0x42954
cmpq 0x2150(%rbx), %r14
je 0x4296f
addl $-0x20, %eax
cmpl $0x13, %eax
ja 0x42c1d
leaq 0xcdd5f(%rip), %rcx     # 0x110684
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %r12, 0x20(%r14)
cmpq 0x120(%rbx), %r12
jne 0x42c1d
jmp 0x42c05
leaq 0xdd88c(%rip), %rsi     # 0x1201d7
leaq 0xdd891(%rip), %r8      # 0x1201e3
jmp 0x4297d
leaq 0xdd87c(%rip), %rsi     # 0x1201d7
leaq 0xdd8f4(%rip), %r8      # 0x120256
movl $0x2, %edx
movq %rbx, %rdi
movq %r12, %rcx
jmp 0x42988
leaq 0xdd861(%rip), %rsi     # 0x1201d7
leaq 0xdd8eb(%rip), %r8      # 0x120268
movl $0x1, %edx
movq %rbx, %rdi
movq %r14, %rcx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0xe25f
movq 0x8(%rbx), %rsi
movq 0x18(%rsi), %rdi
movq 0x20(%r14), %rax
movl $0x18, %edx
cmpq %rax, %rdi
je 0x429f9
jle 0x429bd
movq 0x10(%rsi), %rsi
movq 0x18(%rsi), %rdi
cmpq %rdi, %rax
jl 0x429b0
cmpq %rax, %rdi
je 0x429f9
movl $0x10, %edx
cmpb $0x1c, (%rsi)
jne 0x429f9
movq 0x8(%rsi), %rax
testq %rax, %rax
sete %r8b
je 0x429e5
cmpq %r14, 0x8(%rax)
je 0x429e8
movq 0x18(%rax), %rax
jmp 0x429d0
movq %rdi, %rax
testb %r8b, %r8b
je 0x429fd
movq 0x10(%rsi), %rsi
cmpb $0x1c, (%rsi)
movq %rax, %rdi
je 0x429cc
movq (%r14,%rdx), %rax
movq 0x8(%rcx), %r15
jmp 0x42a64
movq 0x14a0(%rbx), %rax
movq 0x10(%rax), %rax
cmpq 0x10(%rax), %r14
je 0x42b59
movq 0x8(%r14), %rax
movq %r12, 0x30(%rax)
movzbl (%r12), %eax
leaq 0x1181b4(%rip), %rcx    # 0x15abe0
cmpb $0x0, (%rax,%rcx)
jne 0x42a43
leaq 0x111937(%rip), %rcx    # 0x154370
cmpb $0x1, (%rax,%rcx)
jne 0x42c1d
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0xa0b50
jmp 0x42c1d
movq 0x10(%r14), %rax
movb $0x1, %cl
testb %cl, %cl
je 0x42c1d
movb (%r15), %cl
cmpb $0x27, %cl
ja 0x42a93
cmpq 0x120(%rbx), %r15
je 0x42a93
leaq 0xdd75b(%rip), %rsi     # 0x1201d7
leaq 0xdd7a2(%rip), %r8      # 0x120225
movl $0x3, %edx
movq %rbx, %rdi
movq %r15, %rcx
jmp 0x42988
cmpq 0x14a0(%rbx), %r14
je 0x42b01
cmpb $0x20, (%rax)
jne 0x42b4d
cmpq 0x10(%r14), %rax
je 0x42c0c
movq %r15, %rdx
cmpb $0x30, %cl
jne 0x42ac9
testb $0x2, 0x6(%r15)
movq %r15, %rdx
je 0x42ac9
movq 0x8(%r15), %rcx
movq 0x50(%rcx), %rdx
movq %rdx, 0x28(%rax)
cmpq 0x120(%rbx), %r15
je 0x42c1a
orb $0x4, 0x2(%rax)
movl $0x3, %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x41fac
testb %al, %al
je 0x42af7
orb $0x1, 0x6(%r15)
orb $0x4, 0x2(%r14)
jmp 0x42c1a
movq 0x820(%rbx), %rax
movslq 0x7dc(%rbx), %rcx
movq (%rax,%rcx,8), %rax
incl %ecx
andl $0x7, %ecx
movl %ecx, 0x7dc(%rbx)
leaq 0xdd711(%rip), %rcx     # 0x120236
movq %rcx, 0x10(%rax)
movq $0x1f, 0x8(%rax)
movq 0x6e0(%rbx), %rcx
movq %rax, 0x8(%rcx)
movq 0x6e0(%rbx), %rax
movq 0x10(%rax), %rax
movq %r15, 0x8(%rax)
jmp 0x42ba3
movq 0x120(%rbx), %r12
jmp 0x42c1d
movq 0x820(%rbx), %rax
movslq 0x7dc(%rbx), %rcx
movq (%rax,%rcx,8), %rax
incl %ecx
andl $0x7, %ecx
movl %ecx, 0x7dc(%rbx)
leaq 0xdd6b9(%rip), %rcx     # 0x120236
movq %rcx, 0x10(%rax)
movq $0x1f, 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 0xea8(%rbx), %r12
movq %rbx, %rdi
movq %r12, %rsi
callq 0x3b366
jmp 0x42c1d
leaq 0xdd647(%rip), %rsi     # 0x12020c
leaq 0xdd653(%rip), %r8      # 0x12021f
movl $0x2, %edx
movq %rbx, %rdi
callq 0xe25f
movq %rax, %r12
xorl %ecx, %ecx
jmp 0x42a5c
cmpb $0x30, (%r12)
movq %r12, %rax
jne 0x42c01
testb $0x2, 0x6(%r12)
movq %r12, %rax
je 0x42c01
movq 0x8(%r12), %rax
movq 0x50(%rax), %rax
movq %rax, 0x28(%r14)
orb $0x4, 0x2(%r14)
jmp 0x42c1d
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x42554
movq %r15, %r12
movq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq