// File: /workspace/github_c_makefile_star2_O3/BernardTatin[P]s7sh/s7.c
// Function: flatten_multivector_indices
static s7_int flatten_multivector_indices(s7_scheme *sc, s7_pointer vector, s7_int indices, va_list ap)
                {
                    s7_int rank, index;

                    rank = vector_rank(vector);
                    if (rank != indices)
                        s7_wrong_number_of_args_error(sc, "s7_vector_ref_n: wrong number of indices: ~A", s7_make_integer(sc, indices));

                    if (rank == 1)
                        index = va_arg(ap, s7_int);
                    else
                    {
                        s7_int i;
                        s7_int *offsets, *dimensions;
                        dimensions = vector_dimensions(vector);
                        offsets = vector_offsets(vector);
                        for (i = 0, index = 0; i < indices; i++)
                        {
                            s7_int ind;
                            ind = va_arg(ap, s7_int);
                            if ((ind < 0) ||
                                    (ind >= dimensions[i]))
                            {
                                va_end(ap);
                                out_of_range(sc, sc->vector_ref_symbol, small_int(i), wrap_integer1(sc, ind), (ind < 0) ? its_negative_string : its_too_large_string);
                                return(-1);
                            }
                            index += (ind * offsets[i]);
                        }
                    }
                    va_end(ap);
                    return(index);
                }

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %rbx
movq 0x18(%rsi), %rax
movq 0x20(%rax), %rax
testq %rax, %rax
je 0x3b876
movq 0x10(%rax), %r13
jmp 0x3b87c
movl $0x1, %r13d
cmpq %r15, %r13
je 0x3b89e
movq %rbx, %rdi
movq %r15, %rsi
callq 0xd27e
leaq 0xdb878(%rip), %rsi     # 0x11710b
movq %rbx, %rdi
movq %rax, %rdx
callq 0x3a657
cmpq $0x1, %r13
jne 0x3b8bc
movl (%r14), %ecx
cmpq $0x28, %rcx
ja 0x3b920
movq %rcx, %rax
addq 0x10(%r14), %rax
addl $0x8, %ecx
movl %ecx, (%r14)
jmp 0x3b92c
testq %r15, %r15
jle 0x3b9ba
movq 0x18(%r12), %rax
movq 0x20(%rax), %rax
movq (%rax), %rdx
movq 0x18(%rax), %rsi
movl (%r14), %edi
xorl %ecx, %ecx
xorl %eax, %eax
cmpl $0x28, %edi
ja 0x3b8f0
movl %edi, %r8d
addq 0x10(%r14), %r8
addl $0x8, %edi
movl %edi, (%r14)
jmp 0x3b8fc
movq 0x8(%r14), %r8
leaq 0x8(%r8), %r9
movq %r9, 0x8(%r14)
movq (%r8), %r8
testq %r8, %r8
js 0x3b934
cmpq (%rdx,%rcx), %r8
jge 0x3b934
imulq (%rsi,%rcx), %r8
addq %r8, %rax
addq $0x8, %rcx
decq %r15
jne 0x3b8dc
jmp 0x3b9bc
movq 0x8(%r14), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x8(%r14)
movq (%rax), %rax
jmp 0x3b9bc
testq %r8, %r8
movq 0x1660(%rbx), %rax
movq 0x8(%rax), %rax
leaq 0x10b007(%rip), %rdx    # 0x146950
movq (%rcx,%rdx), %rcx
movq 0x1f00(%rbx), %rdx
movq %r8, 0x8(%rdx)
movq 0x1ee8(%rbx), %rdx
leaq 0x10f0e2(%rip), %rsi    # 0x14aa48
leaq 0x10f0d3(%rip), %rdi    # 0x14aa40
cmovsq %rsi, %rdi
movq 0x1f00(%rbx), %rsi
movq (%rdi), %rdi
movq 0x10(%rdx), %rdx
movq %rax, 0x8(%rdx)
movq 0x10(%rdx), %rax
movq %rcx, 0x8(%rax)
movq 0x10(%rax), %rax
movq %rsi, 0x8(%rax)
movq 0x10(%rax), %rax
movq %rdi, 0x8(%rax)
movq 0x1948(%rbx), %rsi
movq 0x1ee8(%rbx), %rdx
movq %rbx, %rdi
callq 0x38dfa
movq $-0x1, %rax
jmp 0x3b9bc
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq