// File: /workspace/github_c_makefile_star2_O3/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 %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
movq 0x8(%rsi), %rdx
testq %rdx, %rdx
je 0xd58ab
movq 0x18(%r14), %rax
movq 0x20(%rax), %rsi
testq %rsi, %rsi
je 0xd584a
movq 0x10(%rsi), %rax
cmpq $0x2, %rax
jl 0xd584a
movq 0x110(%rbx), %rdi
cmpq %r15, %rdi
je 0xd59a2
movq %rax, %r8
negq %r8
movl $0x2, %r12d
xorl %ecx, %ecx
movq %r15, %rdx
leaq (%r8,%r12), %r9
cmpq $0x2, %r9
je 0xd5883
movq 0x8(%rdx), %r13
cmpb $0xb, (%r13)
jne 0xd5aae
movq 0x8(%r13), %r9
testq %r9, %r9
js 0xd59e5
movq (%rsi), %r10
cmpq -0x10(%r10,%r12,8), %r9
jge 0xd59e5
movq 0x18(%rsi), %r10
imulq -0x10(%r10,%r12,8), %r9
addq %r9, %rcx
movq 0x10(%rdx), %rdx
incq %r12
cmpq %rdi, %rdx
jne 0xd57f0
addq $-0x2, %r12
jmp 0xd59a7
movq 0x8(%r15), %r12
cmpb $0xb, (%r12)
jne 0xd58e8
movq 0x8(%r12), %rcx
testq %rcx, %rcx
setns %al
cmpq %rdx, %rcx
setl %dl
testb %dl, %al
je 0xd5954
movq 0x10(%r15), %rdx
cmpq 0x110(%rbx), %rdx
je 0xd59c8
cmpb $0x15, (%r14)
jne 0xd5a43
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 0xd5b09
movq 0x1660(%rbx), %rax
movq 0x8(%rax), %rax
movq 0x7109b(%rip), %rcx     # 0x146958
movq 0x7517c(%rip), %rdx     # 0x14aa40
movq 0x1ee8(%rbx), %rsi
movq 0x10(%rsi), %rsi
movq %rax, 0x8(%rsi)
movq 0x10(%rsi), %rax
movq %rcx, 0x8(%rax)
movq 0x10(%rax), %rax
movq %r14, 0x8(%rax)
jmp 0xd5a7b
movq 0x1660(%rbx), %r13
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0xd590e
movq %rbx, %rdi
callq 0xa550
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)
movq %rbx, %rdi
movq %r12, %rsi
movq %r13, %rdx
movl $0xb, %r8d
movl $0x2, %r9d
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xe42d
testq %rcx, %rcx
movq 0x1660(%rbx), %rax
movq 0x8(%rax), %rax
movq 0x70ff7(%rip), %rcx     # 0x146960
leaq 0x750d8(%rip), %rdx     # 0x14aa48
leaq 0x750c9(%rip), %rsi     # 0x14aa40
cmovsq %rdx, %rsi
movq (%rsi), %rdx
movq 0x1ee8(%rbx), %rsi
movq 0x10(%rsi), %rsi
movq %rax, 0x8(%rsi)
movq 0x10(%rsi), %rax
movq %rcx, 0x8(%rax)
movq 0x10(%rax), %rax
movq %r12, 0x8(%rax)
jmp 0xd5a7b
xorl %r12d, %r12d
xorl %ecx, %ecx
cmpq %rax, %r12
jge 0xd59c8
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xd5edf
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
testq %r9, %r9
movq 0x1660(%rbx), %rax
movq 0x8(%rax), %rax
movq 0x1f00(%rbx), %rcx
movq %r12, 0x8(%rcx)
movq 0x1ee8(%rbx), %rcx
leaq 0x7503c(%rip), %rdx     # 0x14aa48
leaq 0x7502d(%rip), %rsi     # 0x14aa40
cmovsq %rdx, %rsi
movq 0x1f00(%rbx), %rdx
movq (%rsi), %rsi
movq 0x10(%rcx), %rcx
movq %rax, 0x8(%rcx)
movq 0x10(%rcx), %rax
movq %rdx, 0x8(%rax)
movq 0x10(%rax), %rax
movq %r13, 0x8(%rax)
movq 0x10(%rax), %rax
movq %rsi, 0x8(%rax)
jmp 0xd5a83
movq 0x1660(%rbx), %rax
movq 0x8(%rax), %rax
movq 0x70f0b(%rip), %rcx     # 0x146960
movq 0x7f994(%rip), %rdx     # 0x1553f0
movq 0x1ee8(%rbx), %rsi
movq 0x10(%rsi), %rsi
movq %rax, 0x8(%rsi)
movq 0x10(%rsi), %rax
movq %rcx, 0x8(%rax)
movq 0x10(%rax), %rax
movq %r15, 0x8(%rax)
movq 0x10(%rax), %rax
movq %rdx, 0x8(%rax)
movq 0x1948(%rbx), %r14
movq 0x1ee8(%rbx), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x38dfa
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x1660(%rbx), %rbp
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0xd5ad4
movq %rbx, %rdi
callq 0xa550
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)
movq %rbx, %rdi
movq %r13, %rsi
movq %rbp, %rdx
movl $0xb, %r8d
movl %r12d, %r9d
jmp 0xd5941