// File: /workspace/github_c_makefile_star2_O1/BernardTatin[P]s7sh/s7.c
// Function: g_multivector
static s7_pointer g_multivector(s7_scheme *sc, s7_int dims, s7_pointer data)
                {
                    /* get the dimension bounds from data, make the new vector, fill it from data
                     * dims needs to be s7_int so we can at least give correct error messages.
                     */
                    s7_pointer vec, x;
                    s7_int i, err, vec_loc;
                    s7_int *sizes;

                    /* (#2d((1 2 3) (4 5 6)) 0 0) -> 1
                     * (#2d((1 2 3) (4 5 6)) 1 1) -> 5
                     * (#3d(((1 2) (3 4)) ((5 6) (7 8))) 1 1 0) -> 7
                     * #3d(((1 2) (3 4)) ((5 6) (7))) -> error, #3d(((1 2) (3 4)) ((5 6) (7 8 9))), #3d(((1 2) (3 4)) (5 (7 8 9))) etc
                     * but a special case: #nd() is an n-dimensional empty vector
                     */

                    if (dims <= 0)      /* #0d(...) #2147483649D() [if dims is int32_t this is negative] */
                        return(s7_out_of_range_error(sc, "#nD(...) dimensions", 1, wrap_integer1(sc, dims), "must be 1 or more"));
                    if (dims > sc->max_vector_dimensions)
                        return(s7_out_of_range_error(sc, "#nD(...) dimensions", 1, wrap_integer1(sc, dims), "must be < 512")); /* sc->max_vector_dimensions=512 currently */

                    sc->w = sc->nil;
                    if (is_null(data))  /* dims are already 0 (calloc above) */
                        return(g_make_vector(sc, set_plist_1(sc, protected_make_list(sc, dims, small_int(0)))));

                    sizes = (s7_int *)calloc(dims, sizeof(s7_int));
                    for (x = data, i = 0; i < dims; i++)
                    {
                        sizes[i] = safe_list_length(x);
                        sc->w = cons(sc, make_integer(sc, sizes[i]), sc->w);
                        x = car(x);
                        if ((i < (dims - 1)) &&
                                (!is_pair(x)))
                        {
                            free(sizes);
                            return(s7_multivector_error(sc, "we need a list that fully specifies the vector's elements", data));
                        }
                    }

                    vec = g_make_vector(sc, set_plist_1(sc, sc->w = safe_reverse_in_place(sc, sc->w)));
                    vec_loc = s7_gc_protect_1(sc, vec);
                    sc->w = sc->nil;

                    /* now fill the vector checking that all the lists match */
                    err = traverse_vector_data(sc, vec, 0, 0, dims, sizes, data);

                    free(sizes);
                    s7_gc_unprotect_at(sc, vec_loc);
                    if (err < 0)
                        return(s7_multivector_error(sc, (err == MULTIVECTOR_TOO_MANY_ELEMENTS) ? "found too many elements" : "not enough elements found", data));

                    return(vec);
                }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rcx
movq %rdi, %rbx
testq %rsi, %rsi
jle 0xf1d61
cmpq %rcx, 0x2b8(%rbx)
jge 0xf1d9c
movq 0x1f00(%rbx), %rax
movq %rcx, 0x8(%rax)
movq 0x1f00(%rbx), %rcx
leaq 0x30937(%rip), %rsi     # 0x12268f
leaq 0x30956(%rip), %r8      # 0x1226b5
jmp 0xf1d81
movq 0x1f00(%rbx), %rax
movq %rcx, 0x8(%rax)
movq 0x1f00(%rbx), %rcx
leaq 0x30915(%rip), %rsi     # 0x12268f
leaq 0x30922(%rip), %r8      # 0x1226a3
movl $0x1, %edx
movq %rbx, %rdi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x46263
movq %rdx, %r14
movq 0x110(%rbx), %rax
movq %rax, 0x4d8(%rbx)
cmpq %rdx, %rax
je 0xf2090
movl $0x8, %esi
movq %rcx, %rdi
movq %rcx, 0x10(%rsp)
callq 0x9360
movq 0x10(%rsp), %rdx
movq %rax, 0x20(%rsp)
leaq -0x1(%rdx), %r13
xorl %ebp, %ebp
movq %r14, 0x18(%rsp)
cmpb $0x1, (%r14)
jne 0xf1df7
movq %r14, %rax
xorl %r12d, %r12d
incq %r12
movq 0x10(%rax), %rax
cmpb $0x1, (%rax)
je 0xf1de9
jmp 0xf1dfa
xorl %r12d, %r12d
movq 0x20(%rsp), %rax
movq %r12, (%rax,%rbp,8)
cmpq $0x7ff, %r12            # imm = 0x7FF
ja 0xf1e19
leaq 0x5cb3d(%rip), %rax     # 0x14e950
movq (%rax,%r12,8), %r15
jmp 0xf1e57
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0xf1e36
movq %rbx, %rdi
callq 0xb389
movq 0x10(%rsp), %rdx
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %r15
movq $0xb, (%r15)
movq %r12, 0x8(%r15)
movq 0x4d8(%rbx), %r12
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0xf1e7b
movq %rbx, %rdi
callq 0xb389
movq 0x10(%rsp), %rdx
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %rax
movq $0x200001, (%rax)       # imm = 0x200001
movq %r15, 0x8(%rax)
movq %r12, 0x10(%rax)
movq %rax, 0x4d8(%rbx)
movq 0x8(%r14), %r14
cmpq %r13, %rbp
jge 0xf1eba
cmpb $0x1, (%r14)
jne 0xf20d7
incq %rbp
cmpq %rdx, %rbp
jne 0xf1ddd
movq 0x4d8(%rbx), %rdx
movq 0x110(%rbx), %rsi
movq %rbx, %rdi
callq 0xa000b
movq %rax, 0x4d8(%rbx)
movq 0x700(%rbx), %rcx
movq %rax, 0x8(%rcx)
movq 0x700(%rbx), %rsi
movq 0x1318(%rbx), %rdx
movq %rbx, %rdi
callq 0x3ed20
movq %rax, %r13
cmpq $0x0, 0x108(%rbx)
jns 0xf1fca
movq 0xd0(%rbx), %rax
movq 0xf0(%rbx), %r14
leaq (%r14,%r14), %r15
movq 0x18(%rax), %rsi
movq %r14, %rbp
shlq $0x4, %rbp
movq %rbx, %rdi
movq %rbp, %rdx
callq 0xae0f
movq $0x0, 0x20(%rax)
movq 0xd0(%rbx), %rcx
movq %rax, 0x18(%rcx)
movq (%rax), %rax
movq 0xd0(%rbx), %rcx
movq %rax, 0x10(%rcx)
movq 0xd0(%rbx), %rax
movq %r15, 0x8(%rax)
movq %r15, 0xf0(%rbx)
movq 0xe8(%rbx), %rdi
movq %rbp, %rsi
callq 0x9510
movq %rax, 0xe8(%rbx)
cmpq %r15, %r14
jge 0xf1fca
movq %r14, %rax
movq 0xd0(%rbx), %rcx
movq 0x140(%rbx), %rdx
movq 0x10(%rcx), %rcx
movq %rdx, (%rcx,%rax,8)
movq 0xe8(%rbx), %rcx
movq 0x108(%rbx), %rdx
leaq 0x1(%rdx), %rsi
movq %rsi, 0x108(%rbx)
movq %rax, 0x8(%rcx,%rdx,8)
incq %rax
decq %r14
jne 0xf1f8e
movq 0xd0(%rbx), %rax
movq 0xe8(%rbx), %rcx
movq 0x108(%rbx), %rdx
leaq -0x1(%rdx), %rsi
movq %rsi, 0x108(%rbx)
movq (%rcx,%rdx,8), %r14
movq 0x10(%rax), %rax
movq %r13, (%rax,%r14,8)
movq 0x110(%rbx), %rax
movq %rax, 0x4d8(%rbx)
movq 0x18(%rsp), %rax
movq %rax, (%rsp)
movq %rbx, %rdi
movq %r13, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
movq 0x10(%rsp), %r8
movq 0x20(%rsp), %r15
movq %r15, %r9
callq 0xf21c8
movl %eax, %ebp
movq %r15, %rdi
callq 0x9050
cmpq %r14, 0xf0(%rbx)
jle 0xf207a
movq 0xd0(%rbx), %rax
movq 0x140(%rbx), %rcx
movq 0x10(%rax), %rdx
cmpq %rcx, (%rdx,%r14,8)
je 0xf2072
movq 0xe8(%rbx), %rdx
movq 0x108(%rbx), %rsi
leaq 0x1(%rsi), %rdi
movq %rdi, 0x108(%rbx)
movq %r14, 0x8(%rdx,%rsi,8)
movq 0x10(%rax), %rax
movq %rcx, (%rax,%r14,8)
testl %ebp, %ebp
js 0xf20ea
movq %r13, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x5c8b9(%rip), %rdx     # 0x14e950
movq %rbx, %rdi
movl %ecx, %esi
callq 0x3c5b5
movq %rax, 0x520(%rbx)
movq 0x700(%rbx), %rcx
movq %rax, 0x8(%rcx)
movq 0x700(%rbx), %rsi
movq 0x1318(%rbx), %rdx
movq %rbx, %rdi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3ed20
movq 0x20(%rsp), %rdi
callq 0x9050
leaq 0x305db(%rip), %rsi     # 0x1226c3
jmp 0xf20ff
cmpl $-0x1, %ebp
leaq 0x30609(%rip), %rax     # 0x1226fd
leaq 0x3061a(%rip), %rsi     # 0x122715
cmoveq %rax, %rsi
movq %rbx, %rdi
movq 0x18(%rsp), %rdx
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xf2117