// File: /workspace/github_c_makefile_star2_O3/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 %r14
pushq %rbx
pushq %rax
movq 0x8(%rsi), %r14
movzbl (%r14), %eax
cmpl $0xa, %eax
jne 0x40108
testb $-0x80, 0x6(%r14)
jne 0x40159
movq 0x10(%rsi), %rcx
movq 0x10(%rcx), %rax
cmpb $0x1, (%rax)
jne 0x4019c
movq 0x8(%rcx), %rcx
movq 0x8(%rax), %rbx
cmpq 0x150(%rdi), %rcx
je 0x40222
cmpq 0x110(%rdi), %rcx
je 0x40222
cmpb $0x1c, (%rcx)
jne 0x40358
movq 0x8(%rdi), %rdx
movq %rcx, 0x8(%rdi)
movq 0x18(%rcx), %r8
movq 0x20(%r14), %rax
movl $0x18, %esi
cmpq %rax, %r8
je 0x400fb
jle 0x400f2
movq 0x10(%rcx), %rcx
movq 0x18(%rcx), %r8
cmpq %r8, %rax
jl 0x400e5
cmpq %rax, %r8
jne 0x403aa
movq (%r14,%rsi), %rax
movq %rdx, 0x8(%rdi)
jmp 0x40226
movq 0x10(%rsi), %rcx
movq 0x8(%rcx), %rbx
cmpq 0x120(%rdi), %rbx
je 0x4011e
cmpb $0x27, (%rbx)
jbe 0x40169
cmpq 0x2150(%rdi), %r14
je 0x40181
addl $-0x20, %eax
cmpl $0x13, %eax
ja 0x4039f
leaq 0xc74fa(%rip), %rcx     # 0x107634
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %rbx, 0x20(%r14)
cmpq 0x120(%rdi), %rbx
jne 0x4039f
jmp 0x4039a
leaq 0xd7187(%rip), %rsi     # 0x1172e7
leaq 0xd718c(%rip), %r8      # 0x1172f3
jmp 0x4018f
leaq 0xd7177(%rip), %rsi     # 0x1172e7
leaq 0xd71ef(%rip), %r8      # 0x117366
movl $0x2, %edx
jmp 0x40249
leaq 0xd715f(%rip), %rsi     # 0x1172e7
leaq 0xd71e9(%rip), %r8      # 0x117378
movl $0x1, %edx
movq %r14, %rcx
jmp 0x4024c
movq 0x8(%rdi), %rsi
movq 0x18(%rsi), %r8
movq 0x20(%r14), %rax
movl $0x18, %edx
cmpq %rax, %r8
je 0x401ca
jle 0x401c1
movq 0x10(%rsi), %rsi
movq 0x18(%rsi), %r8
cmpq %r8, %rax
jl 0x401b4
cmpq %rax, %r8
jne 0x4032b
movq (%r14,%rdx), %rax
movq 0x8(%rcx), %rbx
jmp 0x40226
movq 0x14a0(%rdi), %rax
movq 0x10(%rax), %rax
cmpq 0x10(%rax), %r14
je 0x402c0
movq 0x8(%r14), %rax
movq %rbx, 0x30(%rax)
movzbl (%rbx), %eax
leaq 0x1129e5(%rip), %rcx    # 0x152be0
cmpb $0x0, (%rax,%rcx)
jne 0x40212
leaq 0x10c168(%rip), %rcx    # 0x14c370
cmpb $0x1, (%rax,%rcx)
jne 0x4039f
movq %r14, %rsi
movq %rbx, %rdx
callq 0x9a23b
jmp 0x4039f
movq 0x10(%r14), %rax
movb (%rbx), %cl
cmpb $0x27, %cl
ja 0x40258
cmpq 0x120(%rdi), %rbx
je 0x40258
leaq 0xd70aa(%rip), %rsi     # 0x1172e7
leaq 0xd70f1(%rip), %r8      # 0x117335
movl $0x3, %edx
movq %rbx, %rcx
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xd4e5
cmpq 0x14a0(%rdi), %r14
je 0x402c0
cmpb $0x20, (%rax)
jne 0x40322
cmpq 0x10(%r14), %rax
je 0x40370
movq %rbx, %rdx
cmpb $0x30, %cl
jne 0x4028d
testb $0x2, 0x6(%rbx)
movq %rbx, %rdx
je 0x4028d
movq 0x8(%rbx), %rcx
movq 0x50(%rcx), %rdx
movq %rdx, 0x28(%rax)
cmpq 0x120(%rdi), %rbx
je 0x4039f
orb $0x4, 0x2(%rax)
movl $0x3, %edx
movq %rbx, %rsi
callq 0x3f86f
testb %al, %al
je 0x4039a
orb $0x1, 0x6(%rbx)
jmp 0x4039a
movq 0x820(%rdi), %rax
movslq 0x7dc(%rdi), %rcx
movq (%rax,%rcx,8), %rax
incl %ecx
andl $0x7, %ecx
movl %ecx, 0x7dc(%rdi)
leaq 0xd7062(%rip), %rcx     # 0x117346
movq %rcx, 0x10(%rax)
movq $0x1f, 0x8(%rax)
movq 0x6e0(%rdi), %rcx
movq %rax, 0x8(%rcx)
movq 0x6e0(%rdi), %rax
movq 0x10(%rax), %rax
movq %rbx, 0x8(%rax)
movq 0x6e0(%rdi), %rdx
movq 0xea8(%rdi), %rbx
movq %rbx, %rsi
callq 0x38dfa
jmp 0x4039f
movq 0x120(%rdi), %rbx
jmp 0x4039f
movl $0x10, %edx
cmpb $0x1c, (%rsi)
jne 0x401ca
movq 0x8(%rsi), %rax
testq %rax, %rax
je 0x40352
cmpq %r14, 0x8(%rax)
je 0x401ce
movq 0x18(%rax), %rax
jmp 0x4033d
movq 0x10(%rsi), %rsi
jmp 0x40330
leaq 0xd6fbd(%rip), %rsi     # 0x11731c
leaq 0xd6fc9(%rip), %r8      # 0x11732f
movl $0x2, %edx
jmp 0x4024c
movq %r14, %rsi
movq %rbx, %rdx
callq 0x3fddc
jmp 0x4039f
cmpb $0x30, (%rbx)
movq %rbx, %rax
jne 0x40396
testb $0x2, 0x6(%rbx)
movq %rbx, %rax
je 0x40396
movq 0x8(%rbx), %rax
movq 0x50(%rax), %rax
movq %rax, 0x28(%r14)
orb $0x4, 0x2(%r14)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movl $0x10, %esi
cmpb $0x1c, (%rcx)
jne 0x400fb
movq 0x8(%rcx), %rax
testq %rax, %rax
je 0x403d1
cmpq %r14, 0x8(%rax)
je 0x400ff
movq 0x18(%rax), %rax
jmp 0x403bc
movq 0x10(%rcx), %rcx
jmp 0x403af