// File: /workspace/github_c_makefile_star2_O2/BernardTatin[P]s7sh/s7.c
// Function: g_vector_set
static s7_pointer g_vector_set(s7_scheme *sc, s7_pointer args)
                {
#define H_vector_set "(vector-set! v i ... value) sets the i-th element of vector v to value."
#define Q_vector_set s7_make_circular_signature(sc, 3, 4, sc->T, sc->is_vector_symbol, sc->is_integer_symbol, sc->is_integer_or_any_at_end_symbol)

                    s7_pointer vec, val;
                    s7_int index;

                    vec = car(args);
                    if (!is_any_vector(vec))
                        return(method_or_bust(sc, vec, sc->vector_set_symbol, args, T_VECTOR, 1));
                    if (is_immutable_vector(vec))
                        return(immutable_object_error(sc, set_elist_3(sc, immutable_error_string, sc->vector_set_symbol, vec)));

                    if (vector_length(vec) == 0)
                        return(out_of_range(sc, sc->vector_set_symbol, small_int(1), vec, its_too_large_string));

                    if (vector_rank(vec) > 1)
                    {
                        s7_int i;
                        s7_pointer x;
                        index = 0;
                        for (x = cdr(args), i = 0; (is_not_null(cdr(x))) && (i < vector_ndims(vec)); x = cdr(x), i++)
                        {
                            s7_int n;
                            s7_pointer p;
                            p = car(x);
                            if (!s7_is_integer(p))
                                return(method_or_bust(sc, p, sc->vector_set_symbol, args, T_INTEGER, i + 2));
                            n = s7_integer(p);
                            if ((n < 0) ||
                                    (n >= vector_dimension(vec, i)))
                                return(out_of_range(sc, sc->vector_set_symbol, wrap_integer1(sc, i + 2), p, (n < 0) ? its_negative_string : its_too_large_string));

                            index += n * vector_offset(vec, i);
                        }

                        if (is_not_null(cdr(x)))
                            return(s7_wrong_number_of_args_error(sc, "too many args for vector-set!: ~S", args));
                        if (i != vector_ndims(vec))
                            return(s7_wrong_number_of_args_error(sc, "not enough args for vector-set!: ~S", args));

                        val = car(x);
                    }
                    else
                    {
                        s7_pointer p;
                        p = cadr(args);
                        if (!s7_is_integer(p))
                            return(method_or_bust(sc, p, sc->vector_set_symbol, args, T_INTEGER, 2));
                        index = s7_integer(p);
                        if ((index < 0) ||
                                (index >= vector_length(vec)))
                            return(out_of_range(sc, sc->vector_set_symbol, small_int(2), p, (index < 0) ? its_negative_string : its_too_large_string));

                        if (is_not_null(cdddr(args)))
                        {
                            set_car(sc->temp_cell_2, vector_getter(vec)(sc, vec, index));
                            if (!is_any_vector(car(sc->temp_cell_2)))
                                return(s7_wrong_number_of_args_error(sc, "too many args for vector-set!: ~S", args));
                            set_cdr(sc->temp_cell_2, cddr(args));
                            return(g_vector_set(sc, sc->temp_cell_2));
                        }
                        val = caddr(args);
                    }

                    if (is_typed_vector(vec))
                    {
                        if ((sc->safety < NO_SAFETY) || /* or == NO_SAFETY?? */
                                (typed_vector_typer_call(sc, vec, set_plist_1(sc, val)) != sc->F))
                        {
                            vector_element(vec, index) = val;
                            return(val);
                        }
                        return(s7_wrong_type_arg_error(sc, "vector-set!", 3, val, make_type_name(sc, typed_vector_typer_name(sc, vec), INDEFINITE_ARTICLE)));
                    }

                    vector_setter(vec)(sc, vec, index, val);
                    return(val);
                }

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %r15
movq %rdi, %rbx
leaq 0xb7449(%rip), %r13     # 0x119c20
movq 0x8(%r15), %r14
movzbl (%r14), %eax
cmpb $0x0, (%rax,%r13)
je 0x628a4
movq (%r14), %rax
btl $0x18, %eax
jb 0x628bb
movq 0x8(%r14), %rdi
testq %rdi, %rdi
je 0x628fc
movq 0x18(%r14), %rcx
movq 0x20(%rcx), %rdx
testq %rdx, %rdx
je 0x6281f
movq 0x10(%rdx), %rsi
cmpq $0x2, %rsi
jge 0x62987
movq 0x10(%r15), %rdx
movq 0x8(%rdx), %rcx
cmpb $0xb, (%rcx)
jne 0x62920
movq 0x8(%rcx), %r12
testq %r12, %r12
js 0x62946
cmpq %rdi, %r12
jge 0x62946
movq 0x10(%rdx), %rcx
movq 0x10(%rcx), %rdx
cmpq 0x110(%rbx), %rdx
je 0x62960
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq *0x20(%r14)
movq 0x558(%rbx), %rcx
movq %rax, 0x8(%rcx)
movq 0x558(%rbx), %rax
movq 0x8(%rax), %rcx
movzbl (%rcx), %ecx
cmpb $0x0, (%rcx,%r13)
je 0x629e7
movq 0x10(%r15), %rcx
movq 0x10(%rcx), %rcx
movq %rcx, 0x10(%rax)
movq 0x558(%rbx), %r15
jmp 0x627d7
movq 0x1668(%rbx), %rdx
pushq $0x15
popq %r8
pushq $0x1
popq %r9
movq %rbx, %rdi
movq %r14, %rsi
jmp 0x62935
movq 0xb70a6(%rip), %rax     # 0x119968
movq 0x1668(%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), %rsi
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x972b
movq 0x1668(%rbx), %rax
movq 0x8(%rax), %rsi
movq 0xb304a(%rip), %rdx     # 0x115958
movq 0xb712b(%rip), %r8      # 0x119a40
movq %rbx, %rdi
movq %r14, %rcx
jmp 0x62a6e
movq 0x1668(%rbx), %rdx
pushq $0xb
popq %r8
pushq $0x2
popq %r9
movq %rbx, %rdi
movq %rcx, %rsi
movq %r15, %rcx
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0xcd70
testq %r12, %r12
movq 0x1668(%rbx), %rax
movq 0x8(%rax), %rsi
movq 0xb3005(%rip), %rdx     # 0x115960
jmp 0x62a56
addq $0x8, %rcx
movq (%rcx), %r15
btq $0x31, %rax
jb 0x62a02
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rdx
movq %r15, %rcx
callq *0x28(%r14)
jmp 0x62aa7
movq 0x110(%rbx), %rdi
movq 0x10(%r15), %r8
pushq $0x2
popq %r9
xorl %r12d, %r12d
movq %r8, %rcx
movq 0x10(%r8), %r8
addq $0x8, %rcx
cmpq %rdi, %r8
je 0x62ab4
leaq -0x2(%r9), %r10
cmpq %rsi, %r10
jge 0x629e7
movq (%rcx), %rcx
cmpb $0xb, (%rcx)
jne 0x62acd
movq 0x8(%rcx), %r10
testq %r10, %r10
js 0x62a36
movq (%rdx), %r11
cmpq -0x10(%r11,%r9,8), %r10
jge 0x62a36
movq 0x18(%rdx), %rcx
imulq -0x10(%rcx,%r9,8), %r10
addq %r10, %r12
incq %r9
jmp 0x62999
leaq 0x84fd0(%rip), %rsi     # 0xe79be
movq %rbx, %rdi
movq %r15, %rdx
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x2e40a
cmpq $0x0, 0x6a0(%rbx)
js 0x62a9f
movq 0x28(%r14), %rsi
cmpb $0x30, (%rsi)
jb 0x62a7c
movq 0x10(%rsi), %rax
movq 0x700(%rbx), %rcx
movq %r15, 0x8(%rcx)
movq 0x700(%rbx), %rsi
movq %rbx, %rdi
callq *%rax
jmp 0x62a96
testq %r10, %r10
movq 0x1668(%rbx), %rax
movq 0x8(%rax), %rsi
movq 0x1f00(%rbx), %rax
movq %r9, 0x8(%rax)
movq 0x1f00(%rbx), %rdx
leaq 0xb6feb(%rip), %rax     # 0x119a48
leaq 0xb6fdc(%rip), %rdi     # 0x119a40
cmovsq %rax, %rdi
movq (%rdi), %r8
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0xcb8f
movq 0x700(%rbx), %rax
movq %r15, 0x8(%rax)
movq 0x700(%rbx), %rdx
movq %rbx, %rdi
callq 0xa34c
cmpq 0x120(%rbx), %rax
je 0x62ae6
movq 0x10(%r14), %rax
movq %r15, (%rax,%r12,8)
movq %r15, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
subq %rsi, %r9
cmpq $0x2, %r9
je 0x62964
leaq 0x84f18(%rip), %rsi     # 0xe79e0
jmp 0x629ee
movq 0x1668(%rbx), %rdx
pushq $0xb
popq %r8
movq %rbx, %rdi
movq %rcx, %rsi
movq %r15, %rcx
jmp 0x62938
movq %rbx, %rdi
movq %r14, %rsi
callq 0x7b119
pushq $0x1
popq %rdx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x7b04d
leaq 0x7bff2(%rip), %rsi     # 0xdeaf8
pushq $0x3
popq %rdx
movq %rbx, %rdi
movq %r15, %rcx
movq %rax, %r8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0xc2b0