// File: /workspace/github_c_makefile_star2_O1/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r12
movq %rdi, %r15
movq 0x18(%rsi), %rax
movq 0x20(%rax), %rax
testq %rax, %rax
je 0x3de16
movq 0x10(%rax), %r13
jmp 0x3de1c
movl $0x1, %r13d
cmpq %r14, %r13
je 0x3de3e
movq %r15, %rdi
movq %r14, %rsi
callq 0xdff8
leaq 0xe21c8(%rip), %rsi     # 0x11fffb
movq %r15, %rdi
movq %rax, %rdx
callq 0x3cbe3
cmpq $0x1, %r13
jne 0x3de61
movl (%rbx), %ecx
cmpq $0x28, %rcx
ja 0x3df94
movq %rcx, %rax
addq 0x10(%rbx), %rax
addl $0x8, %ecx
movl %ecx, (%rbx)
jmp 0x3dfa0
testq %r14, %r14
setg %bpl
jle 0x3dfa5
movq 0x18(%r12), %rax
movq 0x20(%rax), %rax
movq (%rax), %rcx
movq %rcx, 0x18(%rsp)
movq 0x18(%rax), %rax
movq %rax, 0x10(%rsp)
movq %r14, %rax
negq %rax
movq %rax, 0x20(%rsp)
movl $0x1, %r12d
leaq 0x110ab0(%rip), %r13    # 0x14e950
movq $0x0, 0x8(%rsp)
movl (%rbx), %ecx
cmpq $0x28, %rcx
ja 0x3debf
movq %rcx, %rax
addq 0x10(%rbx), %rax
addl $0x8, %ecx
movl %ecx, (%rbx)
jmp 0x3decb
movq 0x8(%rbx), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x8(%rbx)
movq (%rax), %rax
testq %rax, %rax
js 0x3def3
movq 0x18(%rsp), %rcx
cmpq -0x8(%rcx,%r12,8), %rax
jge 0x3def3
movq 0x10(%rsp), %rcx
imulq -0x8(%rcx,%r12,8), %rax
addq %rax, 0x8(%rsp)
movb $0x1, %al
jmp 0x3df6b
testq %rax, %rax
movq 0x1660(%r15), %rcx
movq 0x8(%rcx), %rcx
movq (%r13), %rdx
movq 0x1f00(%r15), %rsi
movq %rax, 0x8(%rsi)
movq 0x1ee8(%r15), %rax
leaq 0x114b22(%rip), %rsi    # 0x152a40
leaq 0x114b23(%rip), %rdi    # 0x152a48
cmovsq %rdi, %rsi
movq 0x1f00(%r15), %rdi
movq (%rsi), %rsi
movq 0x10(%rax), %rax
movq %rcx, 0x8(%rax)
movq 0x10(%rax), %rax
movq %rdx, 0x8(%rax)
movq 0x10(%rax), %rax
movq %rdi, 0x8(%rax)
movq 0x10(%rax), %rax
movq %rsi, 0x8(%rax)
movq 0x1948(%r15), %rsi
movq 0x1ee8(%r15), %rdx
movq %r15, %rdi
callq 0x3b366
xorl %eax, %eax
testb %al, %al
je 0x3dfae
cmpq %r14, %r12
setl %bpl
movq 0x20(%rsp), %rax
addq %r12, %rax
incq %rax
incq %r12
addq $0x8, %r13
cmpq $0x1, %rax
jne 0x3dea9
jmp 0x3dfae
movq 0x8(%rbx), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x8(%rbx)
movq (%rax), %rcx
jmp 0x3dfc0
movq $0x0, 0x8(%rsp)
movq $-0x1, %rax
testb $0x1, %bpl
movq 0x8(%rsp), %rcx
jne 0x3dfc3
movq %rcx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq