// File: /workspace/github_c_makefile_star2_O2/BernardTatin[P]s7sh/s7.c
// Function: vector_ref_1
static s7_pointer vector_ref_1(s7_scheme *sc, s7_pointer vect, s7_pointer indices)
                {
                    s7_int index = 0;
                    if (vector_length(vect) == 0)
                        return(out_of_range(sc, sc->vector_ref_symbol, small_int(1), vect, its_too_large_string));

                    if (vector_rank(vect) > 1)
                    {
                        s7_int i;
                        s7_pointer x;
                        for (x = indices, i = 0; (is_not_null(x)) && (i < vector_ndims(vect)); 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_ref_symbol, cons(sc, vect, indices), T_INTEGER, i + 2));
                            n = s7_integer(p);
                            if ((n < 0) ||
                                    (n >= vector_dimension(vect, i)))
                                return(out_of_range(sc, sc->vector_ref_symbol, wrap_integer1(sc, i + 2), p, (n < 0) ? its_negative_string : its_too_large_string));

                            index += n * vector_offset(vect, i);
                        }
                        if (is_not_null(x))
                        {
                            s7_pointer nv;
                            if (!is_normal_vector(vect))
                                return(out_of_range(sc, sc->vector_ref_symbol, small_int(2), indices, too_many_indices_string));
                            nv = vector_element(vect, index);
                            return(implicit_index(sc, nv, x));
                        }

                        /* if not enough indices, return a subvector covering whatever is left */
                        if (i < vector_ndims(vect))
                            return(subvector(sc, vect, i, index));
                    }
                    else
                    {
                        s7_pointer p;
                        /* (let ((hi (make-vector 3 0.0)) (sum 0.0)) (do ((i 0 (+ i 1))) ((= i 3)) (set! sum (+ sum (hi i)))) sum) */
                        p = car(indices);

                        if (!s7_is_integer(p))
                            return(method_or_bust(sc, p, sc->vector_ref_symbol, cons(sc, vect, indices), T_INTEGER, 2));
                        index = s7_integer(p);

                        if ((index < 0) ||
                                (index >= vector_length(vect)))
                            return(out_of_range(sc, sc->vector_ref_symbol, small_int(2), p, (index < 0) ? its_negative_string : its_too_large_string));

                        if (is_not_null(cdr(indices)))                /* (let ((L #(#(1 2 3) #(4 5 6)))) (vector-ref L 1 2)) */
                        {
                            s7_pointer nv;
                            if (!is_normal_vector(vect))
                                return(out_of_range(sc, sc->vector_ref_symbol, small_int(2), indices, too_many_indices_string));
                            nv = vector_element(vect, index);
                            return(implicit_index(sc, nv, cdr(indices)));
                        }
                    }
                    return((vector_getter(vect))(sc, vect, index));
                }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0x8(%rsi), %rax
testq %rax, %rax
je 0xa8e09
movq %rdx, %r15
movq 0x18(%r14), %rcx
movq 0x20(%rcx), %rsi
testq %rsi, %rsi
je 0xa8dac
movq 0x10(%rsi), %rdi
cmpq $0x2, %rdi
jl 0xa8dac
movq 0x110(%rbx), %r8
pushq $0x2
popq %r12
xorl %ecx, %ecx
movq %r15, %rdx
leaq -0x2(%r12), %rax
cmpq %r8, %rdx
je 0xa8f36
cmpq %rdi, %rax
jge 0xa8de1
movq 0x8(%rdx), %r13
cmpb $0xb, (%r13)
jne 0xa8f74
movq 0x8(%r13), %rax
testq %rax, %rax
js 0xa8ec7
movq (%rsi), %r9
cmpq -0x10(%r9,%r12,8), %rax
jge 0xa8ec7
movq 0x18(%rsi), %r9
imulq -0x10(%r9,%r12,8), %rax
addq %rax, %rcx
movq 0x10(%rdx), %rdx
incq %r12
jmp 0xa8d59
movq 0x8(%r15), %r12
cmpb $0xb, (%r12)
jne 0xa8e2d
movq 0x8(%r12), %rcx
testq %rcx, %rcx
setns %dl
cmpq %rax, %rcx
setl %al
testb %al, %dl
je 0xa8e95
movq 0x10(%r15), %rdx
cmpq 0x110(%rbx), %rdx
je 0xa8f57
cmpb $0x15, (%r14)
jne 0xa8f04
movq 0x10(%r14), %rax
movq (%rax,%rcx,8), %rsi
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xa8fcd
movq 0x1660(%rbx), %rax
movq 0x8(%rax), %rsi
movq 0x6cb3d(%rip), %rdx     # 0x115958
movq 0x70c1e(%rip), %r8      # 0x119a40
movq %rbx, %rdi
movq %r14, %rcx
jmp 0xa8f23
movq 0x1660(%rbx), %r13
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0xa8e53
movq %rbx, %rdi
callq 0x9c27
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %rcx
movq $0x200001, (%rcx)       # imm = 0x200001
movq %r14, 0x8(%rcx)
movq %r15, 0x10(%rcx)
pushq $0xb
popq %r8
pushq $0x2
popq %r9
movq %rbx, %rdi
movq %r12, %rsi
movq %r13, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xcd70
testq %rcx, %rcx
movq 0x1660(%rbx), %rax
movq 0x8(%rax), %rsi
movq 0x6cab6(%rip), %rdx     # 0x115960
leaq 0x70b97(%rip), %rax     # 0x119a48
leaq 0x70b88(%rip), %rcx     # 0x119a40
cmovsq %rax, %rcx
movq (%rcx), %r8
movq %rbx, %rdi
movq %r12, %rcx
jmp 0xa8f23
testq %rax, %rax
movq 0x1660(%rbx), %rax
movq 0x8(%rax), %rsi
movq 0x1f00(%rbx), %rax
movq %r12, 0x8(%rax)
movq 0x1f00(%rbx), %rdx
leaq 0x70b5a(%rip), %rax     # 0x119a48
leaq 0x70b4b(%rip), %rcx     # 0x119a40
cmovsq %rax, %rcx
movq (%rcx), %r8
movq %rbx, %rdi
movq %r13, %rcx
jmp 0xa8f23
movq 0x1660(%rbx), %rax
movq 0x8(%rax), %rsi
movq 0x6ca4a(%rip), %rdx     # 0x115960
movq 0x7b4d3(%rip), %r8      # 0x1243f0
movq %rbx, %rdi
movq %r15, %rcx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xcb8f
cmpq %rdi, %rax
jge 0xa8f57
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xa9292
movq 0x20(%r14), %rax
movq %rbx, %rdi
movq %r14, %rsi
movq %rcx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *%rax
movq 0x1660(%rbx), %rbp
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0xa8f9a
movq %rbx, %rdi
callq 0x9c27
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %rcx
movq $0x200001, (%rcx)       # imm = 0x200001
movq %r14, 0x8(%rcx)
movq %r15, 0x10(%rcx)
pushq $0xb
popq %r8
movq %rbx, %rdi
movq %r13, %rsi
movq %rbp, %rdx
movl %r12d, %r9d
jmp 0xa8e82