// File: /workspace/github_c_makefile_star2_O2/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, %rbx
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %r14
movq 0x18(%rsi), %rax
movq 0x20(%rax), %rax
testq %rax, %rax
je 0x2ef23
movq 0x10(%rax), %r13
jmp 0x2ef27
pushq $0x1
popq %r13
cmpq %r15, %r13
je 0x2ef49
movq %r14, %rdi
movq %r15, %rsi
callq 0xc049
leaq 0xb416d(%rip), %rsi     # 0xe30ab
movq %r14, %rdi
movq %rax, %rdx
callq 0x2e40a
cmpq $0x1, %r13
jne 0x2ef6c
movl (%rbx), %ecx
cmpq $0x28, %rcx
ja 0x2f01f
movq %rcx, %rax
addq 0x10(%rbx), %rax
addl $0x8, %ecx
movl %ecx, (%rbx)
jmp 0x2f02b
movq 0x18(%r12), %rax
movq 0x20(%rax), %rax
movq (%rax), %rdx
movq 0x18(%rax), %rsi
xorl %ecx, %ecx
testq %r15, %r15
cmovleq %rcx, %r15
xorl %eax, %eax
subq $0x1, %r15
jb 0x2f02e
movl (%rbx), %r8d
cmpq $0x28, %r8
ja 0x2efaa
movq %r8, %rdi
addq 0x10(%rbx), %rdi
addl $0x8, %r8d
movl %r8d, (%rbx)
jmp 0x2efb6
movq 0x8(%rbx), %rdi
leaq 0x8(%rdi), %r8
movq %r8, 0x8(%rbx)
movq (%rdi), %rdi
testq %rdi, %rdi
js 0x2efd2
cmpq (%rdx,%rcx), %rdi
jge 0x2efd2
imulq (%rsi,%rcx), %rdi
addq %rdi, %rax
addq $0x8, %rcx
jmp 0x2ef87
testq %rdi, %rdi
movq 0x1660(%r14), %rax
movq 0x8(%rax), %rsi
leaq 0xe6969(%rip), %rax     # 0x115950
movq (%rcx,%rax), %rdx
movq 0x1f00(%r14), %rax
movq %rdi, 0x8(%rax)
movq 0x1f00(%r14), %rcx
leaq 0xeaa44(%rip), %rax     # 0x119a48
leaq 0xeaa35(%rip), %rdi     # 0x119a40
cmovsq %rax, %rdi
movq (%rdi), %r8
movq %r14, %rdi
callq 0xcb8f
pushq $-0x1
popq %rax
jmp 0x2f02e
movq 0x8(%rbx), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x8(%rbx)
movq (%rax), %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq