// File: /workspace/github_c_makefile_star2_O0/BernardTatin[P]s7sh/s7.c
// Function: g_setter
static s7_pointer g_setter(s7_scheme *sc, s7_pointer args)
                {
#define H_setter "(setter obj env) returns the setter associated with obj"
#define Q_setter s7_make_signature(sc, 3, s7_make_signature(sc, 2, sc->not_symbol, sc->is_procedure_symbol), sc->T, sc->is_let_symbol)
                    s7_pointer p, e;

                    p = car(args);
                    if (is_pair(cdr(args)))
                    {
                        e = cadr(args);
                        if (!((is_let(e)) || (e == sc->rootlet) || (e == sc->nil)))
                            return(wrong_type_argument(sc, sc->setter_symbol, 2, e, T_LET));
                    }
                    else e = sc->envir;

                    switch (type(p))
                    {
                        case T_MACRO:   case T_MACRO_STAR:
                        case T_BACRO:   case T_BACRO_STAR:
                        case T_CLOSURE: case T_CLOSURE_STAR:
                            if (is_any_procedure(closure_setter(p)))                /* setter already known */
                                return(closure_setter(p));
                            if (!closure_no_setter(p))
                            {
                                s7_pointer f;
                                f = funclet_entry(sc, p, sc->local_setter_symbol); /* look for +setter+, save value as closure_setter(p) */
                                if (f)
                                {
                                    if (f == sc->F)
                                    {
                                        closure_set_no_setter(p);
                                        return(sc->F);
                                    }
                                    if (!is_any_procedure(f))
                                        return(s7_wrong_type_arg_error(sc, "setter", 0, p, "a procedure or a reasonable facsimile thereof"));
                                    closure_set_setter(p, f);
                                    return(f);
                                }
                                /* we used to search for setter here, but that can find the built-in setter causing an infinite loop (maybe check for that??) */
                                closure_set_no_setter(p);
                            }
                            return(sc->F);

                        case T_C_FUNCTION:
                        case T_C_FUNCTION_STAR:
                        case T_C_ANY_ARGS_FUNCTION:
                        case T_C_OPT_ARGS_FUNCTION:
                        case T_C_RST_ARGS_FUNCTION:
                            return(c_function_setter(p));

                        case T_C_MACRO:
                            return(c_macro_setter(p));

                        case T_GOTO:
                        case T_CONTINUATION:
                            return(sc->F);

                        case T_C_OBJECT:
                            check_method(sc, p, sc->setter_symbol, args);
                            if  (c_object_set(sc, p) != fallback_set)
                                return(sc->c_object_set_function);      /* for example ((setter obj) obj 0 1.0) if s7test block */
                            /* this could wrap the setter as an s7_function giving p's class-name etc */
                            return(sc->F);

                        case T_LET:
                            check_method(sc, p, sc->setter_symbol, args);
                            return(slot_value(global_slot(sc->let_set_symbol)));

                        case T_ITERATOR:
                            if (is_any_closure(iterator_sequence(p)))
                                return(closure_setter(iterator_sequence(p)));
                            return(sc->F);                            /* (set! (iter) val) doesn't fit the other setters */

                        case T_PAIR:
                            return(slot_value(global_slot(sc->list_set_symbol)));

                        case T_HASH_TABLE:
                            return(slot_value(global_slot(sc->hash_table_set_symbol)));

                        case T_STRING:
                            return(slot_value(global_slot(sc->string_set_symbol)));

                        case T_BYTE_VECTOR:
                            return(slot_value(global_slot(sc->byte_vector_set_symbol)));

                        case T_VECTOR:
                            return(slot_value(global_slot(sc->vector_set_symbol)));

                        case T_INT_VECTOR:
                            return(slot_value(global_slot(sc->int_vector_set_symbol)));

                        case T_FLOAT_VECTOR:
                            return(slot_value(global_slot(sc->float_vector_set_symbol)));

                        case T_SLOT:
                            if (slot_has_setter(p))
                                return(slot_setter(p));
                            return(sc->F);

                        case T_SYMBOL:                             /* (setter symbol env) */
                            {
                                s7_pointer sym, slot;
                                sym = car(args);
                                if (is_keyword(sym))
                                    return(sc->F);

                                if ((e == sc->rootlet) || (e == sc->nil))
                                    slot = global_slot(sym);
                                else
                                {
                                    s7_pointer old_e;
                                    old_e = sc->envir;
                                    sc->envir = e;
                                    slot = symbol_to_slot(sc, sym);
                                    sc->envir = old_e;
                                }
                                if (!is_slot(slot))
                                    return(sc->F);

                                if (slot_has_setter(slot))
                                    return(slot_setter(slot));
                                return(sc->F);
                            }
                    }
                    return(s7_wrong_type_arg_error(sc, "setter", 0, p, "something that might have a setter"));
                }

// Assembly:
subq $0xc8, %rsp
movq %rdi, 0xb8(%rsp)
movq %rsi, 0xb0(%rsp)
movq 0xb0(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0xa8(%rsp)
movq 0xb0(%rsp), %rax
movq 0x10(%rax), %rax
movzbl (%rax), %eax
cmpl $0x1, %eax
jne 0x3d464
movq 0xb0(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, 0xa0(%rsp)
movq 0xa0(%rsp), %rax
movzbl (%rax), %eax
cmpl $0x1c, %eax
je 0x3d462
movq 0xa0(%rsp), %rax
movq 0xb8(%rsp), %rcx
cmpq 0x150(%rcx), %rax
je 0x3d462
movq 0xa0(%rsp), %rax
movq 0xb8(%rsp), %rcx
cmpq 0x110(%rcx), %rax
je 0x3d462
movq 0xb8(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0xb8(%rsp), %rax
movq 0x14a0(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, 0x48(%rsp)
movq $0x2, 0x98(%rsp)
movq 0x98(%rsp), %rax
andq $-0x800, %rax           # imm = 0xF800
cmpq $0x0, %rax
jne 0x3d37b
movq 0x98(%rsp), %rcx
leaq 0x1d9113(%rip), %rax    # 0x216480
movq (%rax,%rcx,8), %rax
movq %rax, 0x38(%rsp)
jmp 0x3d413
jmp 0x3d37d
movq 0xb8(%rsp), %rax
movq 0x90(%rax), %rax
movq 0xb8(%rsp), %rcx
cmpq 0x98(%rcx), %rax
ja 0x3d3aa
movq 0xb8(%rsp), %rdi
callq 0xc670
movq 0xb8(%rsp), %rcx
movq 0x90(%rcx), %rax
movq %rax, %rdx
addq $-0x8, %rdx
movq %rdx, 0x90(%rcx)
movq -0x8(%rax), %rax
movq %rax, 0x88(%rsp)
movq 0x88(%rsp), %rax
movq $0xb, (%rax)
movq 0x98(%rsp), %rcx
movq 0x88(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x88(%rsp), %rax
movq %rax, 0x80(%rsp)
movq 0x80(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0x48(%rsp), %rsi
movq 0x40(%rsp), %rdi
movq 0x38(%rsp), %rax
movq %rax, 0x90(%rsp)
movq 0x90(%rsp), %rdx
movq 0xa0(%rsp), %rcx
movq 0xb8(%rsp), %rax
movq 0x140(%rax), %r8
movq 0x1dd220(%rip), %r9     # 0x21a670
callq 0xc560
movq %rax, 0xc0(%rsp)
jmp 0x3db80
jmp 0x3d478
movq 0xb8(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0xa0(%rsp)
movq 0xa8(%rsp), %rax
movzbl (%rax), %eax
decl %eax
movl %eax, %ecx
movq %rcx, 0x30(%rsp)
subl $0x32, %eax
ja 0x3db51
movq 0x30(%rsp), %rax
leaq 0x1a114f(%rip), %rcx    # 0x1de5f0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0xa8(%rsp), %rax
movq 0x20(%rax), %rax
movzbl (%rax), %eax
cmpl $0x28, %eax
jl 0x3d4d7
movq 0xa8(%rsp), %rax
movq 0x20(%rax), %rax
movq %rax, 0xc0(%rsp)
jmp 0x3db80
movq 0xa8(%rsp), %rax
movq (%rax), %rax
andq $0x40000, %rax          # imm = 0x40000
cmpq $0x0, %rax
jne 0x3d5e7
movq 0xb8(%rsp), %rdi
movq 0xa8(%rsp), %rsi
movq 0xb8(%rsp), %rax
movq 0x16d0(%rax), %rdx
callq 0x3a500
movq %rax, 0x78(%rsp)
cmpq $0x0, 0x78(%rsp)
je 0x3d5d2
movq 0x78(%rsp), %rax
movq 0xb8(%rsp), %rcx
cmpq 0x120(%rcx), %rax
jne 0x3d56e
movq 0xa8(%rsp), %rax
movq (%rax), %rcx
orq $0x40000, %rcx          # imm = 0x40000
movq %rcx, (%rax)
movq 0xb8(%rsp), %rax
movq 0x120(%rax), %rax
movq %rax, 0xc0(%rsp)
jmp 0x3db80
movq 0x78(%rsp), %rax
movzbl (%rax), %eax
cmpl $0x28, %eax
jge 0x3d5af
movq 0xb8(%rsp), %rdi
movq 0xa8(%rsp), %rcx
leaq 0x1b181a(%rip), %rsi    # 0x1eedac
xorl %eax, %eax
movl %eax, %edx
leaq 0x1b17b9(%rip), %r8     # 0x1eed56
callq 0x12540
movq %rax, 0xc0(%rsp)
jmp 0x3db80
movq 0x78(%rsp), %rcx
movq 0xa8(%rsp), %rax
movq %rcx, 0x20(%rax)
movq 0x78(%rsp), %rax
movq %rax, 0xc0(%rsp)
jmp 0x3db80
movq 0xa8(%rsp), %rax
movq (%rax), %rcx
orq $0x40000, %rcx          # imm = 0x40000
movq %rcx, (%rax)
movq 0xb8(%rsp), %rax
movq 0x120(%rax), %rax
movq %rax, 0xc0(%rsp)
jmp 0x3db80
movq 0xa8(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x30(%rax), %rax
movq %rax, 0xc0(%rsp)
jmp 0x3db80
movq 0xa8(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x30(%rax), %rax
movq %rax, 0xc0(%rsp)
jmp 0x3db80
movq 0xb8(%rsp), %rax
movq 0x120(%rax), %rax
movq %rax, 0xc0(%rsp)
jmp 0x3db80
movq 0xa8(%rsp), %rax
movq (%rax), %rax
andq $0x40000000, %rax       # imm = 0x40000000
cmpq $0x0, %rax
je 0x3d728
movq 0xb8(%rsp), %rax
testb $0x1, 0x24c(%rax)
je 0x3d728
movq 0xb8(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0xb8(%rsp), %rdi
movq 0xa8(%rsp), %rsi
callq 0x9a10
movq 0x28(%rsp), %rdi
movq %rax, %rsi
movq 0xb8(%rsp), %rax
movq 0x14a0(%rax), %rdx
callq 0x98d0
movq %rax, 0x70(%rsp)
movq 0xb8(%rsp), %rcx
cmpq 0x128(%rcx), %rax
je 0x3d728
movq 0xb8(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x70(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0xb8(%rsp), %rdi
movq 0xb0(%rsp), %rsi
callq 0x44270
movq 0x18(%rsp), %rdi
movq 0x20(%rsp), %rsi
movq %rax, %rdx
callq 0xda50
movq %rax, 0xc0(%rsp)
jmp 0x3db80
movq 0xb8(%rsp), %rax
movq 0x8d8(%rax), %rax
movq 0xa8(%rsp), %rcx
movq 0x8(%rcx), %rcx
movq (%rax,%rcx,8), %rax
leaq -0x1f4e(%rip), %rcx     # 0x3b800
cmpq %rcx, 0x50(%rax)
je 0x3d770
movq 0xb8(%rsp), %rax
movq 0x1ed0(%rax), %rax
movq %rax, 0xc0(%rsp)
jmp 0x3db80
movq 0xb8(%rsp), %rax
movq 0x120(%rax), %rax
movq %rax, 0xc0(%rsp)
jmp 0x3db80
movq 0xa8(%rsp), %rax
movq (%rax), %rax
andq $0x40000000, %rax       # imm = 0x40000000
cmpq $0x0, %rax
je 0x3d859
movq 0xb8(%rsp), %rax
testb $0x1, 0x24c(%rax)
je 0x3d859
movq 0xb8(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0xb8(%rsp), %rdi
movq 0xa8(%rsp), %rsi
callq 0x9a10
movq 0x10(%rsp), %rdi
movq %rax, %rsi
movq 0xb8(%rsp), %rax
movq 0x14a0(%rax), %rdx
callq 0x98d0
movq %rax, 0x68(%rsp)
movq 0xb8(%rsp), %rcx
cmpq 0x128(%rcx), %rax
je 0x3d859
movq 0xb8(%rsp), %rax
movq %rax, (%rsp)
movq 0x68(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0xb8(%rsp), %rdi
movq 0xb0(%rsp), %rsi
callq 0x44270
movq (%rsp), %rdi
movq 0x8(%rsp), %rsi
movq %rax, %rdx
callq 0xda50
movq %rax, 0xc0(%rsp)
jmp 0x3db80
movq 0xb8(%rsp), %rax
movq 0x1240(%rax), %rax
movq 0x10(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, 0xc0(%rsp)
jmp 0x3db80
movq 0xa8(%rsp), %rax
movq 0x8(%rax), %rax
movzbl (%rax), %eax
movl %eax, %ecx
leaq 0x1e4e9b(%rip), %rax    # 0x222730
testb $0x1, (%rax,%rcx)
je 0x3d8b8
movq 0xa8(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x20(%rax), %rax
movq %rax, 0xc0(%rsp)
jmp 0x3db80
movq 0xb8(%rsp), %rax
movq 0x120(%rax), %rax
movq %rax, 0xc0(%rsp)
jmp 0x3db80
movq 0xb8(%rsp), %rax
movq 0x1260(%rax), %rax
movq 0x10(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, 0xc0(%rsp)
jmp 0x3db80
movq 0xb8(%rsp), %rax
movq 0xf70(%rax), %rax
movq 0x10(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, 0xc0(%rsp)
jmp 0x3db80
movq 0xb8(%rsp), %rax
movq 0x1550(%rax), %rax
movq 0x10(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, 0xc0(%rsp)
jmp 0x3db80
movq 0xb8(%rsp), %rax
movq 0xc38(%rax), %rax
movq 0x10(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, 0xc0(%rsp)
jmp 0x3db80
movq 0xb8(%rsp), %rax
movq 0x1668(%rax), %rax
movq 0x10(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, 0xc0(%rsp)
jmp 0x3db80
movq 0xb8(%rsp), %rax
movq 0xfb0(%rax), %rax
movq 0x10(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, 0xc0(%rsp)
jmp 0x3db80
movq 0xb8(%rsp), %rax
movq 0xef8(%rax), %rax
movq 0x10(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, 0xc0(%rsp)
jmp 0x3db80
movq 0xa8(%rsp), %rax
movq (%rax), %rax
andq $0x40000, %rax          # imm = 0x40000
cmpq $0x0, %rax
je 0x3da00
movq 0xa8(%rsp), %rax
movq 0x28(%rax), %rax
movq %rax, 0xc0(%rsp)
jmp 0x3db80
movq 0xb8(%rsp), %rax
movq 0x120(%rax), %rax
movq %rax, 0xc0(%rsp)
jmp 0x3db80
movq 0xb0(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x60(%rsp)
movq 0x60(%rsp), %rax
movzwl 0x6(%rax), %eax
andl $0x80, %eax
cmpl $0x0, %eax
je 0x3da5c
movq 0xb8(%rsp), %rax
movq 0x120(%rax), %rax
movq %rax, 0xc0(%rsp)
jmp 0x3db80
movq 0xa0(%rsp), %rax
movq 0xb8(%rsp), %rcx
cmpq 0x150(%rcx), %rax
je 0x3da8e
movq 0xa0(%rsp), %rax
movq 0xb8(%rsp), %rcx
cmpq 0x110(%rcx), %rax
jne 0x3da9e
movq 0x60(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0x58(%rsp)
jmp 0x3daeb
movq 0xb8(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x50(%rsp)
movq 0xa0(%rsp), %rcx
movq 0xb8(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0xb8(%rsp), %rdi
movq 0x60(%rsp), %rsi
callq 0xfc80
movq %rax, 0x58(%rsp)
movq 0x50(%rsp), %rcx
movq 0xb8(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x58(%rsp), %rax
movzbl (%rax), %eax
cmpl $0x20, %eax
je 0x3db11
movq 0xb8(%rsp), %rax
movq 0x120(%rax), %rax
movq %rax, 0xc0(%rsp)
jmp 0x3db80
movq 0x58(%rsp), %rax
movq (%rax), %rax
andq $0x40000, %rax          # imm = 0x40000
cmpq $0x0, %rax
je 0x3db38
movq 0x58(%rsp), %rax
movq 0x28(%rax), %rax
movq %rax, 0xc0(%rsp)
jmp 0x3db80
movq 0xb8(%rsp), %rax
movq 0x120(%rax), %rax
movq %rax, 0xc0(%rsp)
jmp 0x3db80
movq 0xb8(%rsp), %rdi
movq 0xa8(%rsp), %rcx
leaq 0x1b1244(%rip), %rsi    # 0x1eedac
xorl %eax, %eax
movl %eax, %edx
leaq 0x1b1211(%rip), %r8     # 0x1eed84
callq 0x12540
movq %rax, 0xc0(%rsp)
movq 0xc0(%rsp), %rax
addq $0xc8, %rsp
retq