// File: /workspace/github_c_makefile_star2_O2/BernardTatin[P]s7sh/s7.c
// Function: s7_vector_copy
s7_pointer s7_vector_copy(s7_scheme *sc, s7_pointer old_vect)
#endif
                    {
                        s7_int i, len;
                        s7_pointer new_vect;

                        len = vector_length(old_vect);
                        if (is_normal_vector(old_vect))
                        {
                            s7_pointer *src, *dst;
                            if ((is_typed_vector(old_vect)) && (len > 0)) /* preserve the type info as well */
                            {
                                if (vector_rank(old_vect) > 1)
                                    new_vect = g_make_vector(sc, set_plist_3(sc, g_vector_dimensions(sc, list_1(sc, old_vect)), vector_element(old_vect, 0), typed_vector_typer(old_vect)));
                                else new_vect = g_make_vector(sc, set_plist_3(sc, make_integer(sc, len), vector_element(old_vect, 0), typed_vector_typer(old_vect)));
                            }
                            else
                            {
                                if (vector_rank(old_vect) > 1)
                                    new_vect = g_make_vector(sc, set_plist_1(sc, g_vector_dimensions(sc, list_1(sc, old_vect))));
                                else new_vect = make_simple_vector(sc, len);
                            }
                            /* here and in vector-fill! we have a problem with bignums -- should new bignums be allocated? (copy_list also) */
                            src = (s7_pointer *)vector_elements(old_vect);
                            dst = (s7_pointer *)vector_elements(new_vect);
                            for (i = len; i > 0; i--) *dst++ = *src++;
                            return(new_vect);
                        }

                        if (is_float_vector(old_vect))
                        {
                            s7_double *src, *dst;
                            if (vector_rank(old_vect) > 1)
                                new_vect = g_make_vector_1(sc, set_plist_2(sc, g_vector_dimensions(sc, set_plist_1(sc, old_vect)), real_zero), sc->make_float_vector_symbol);
                            else new_vect = make_simple_float_vector(sc, len);
                            src = (s7_double *)float_vector_floats(old_vect);
                            dst = (s7_double *)float_vector_floats(new_vect);
                            for (i = len; i > 0; i--) *dst++ = *src++;  /* same speed as memcpy(dst, src, len * sizeof(s7_double)); */
                            return(new_vect);
                        }

                        if (is_int_vector(old_vect))
                        {
                            s7_int *src, *dst;
                            if (vector_rank(old_vect) > 1)
                                new_vect = g_make_vector_1(sc, set_plist_2(sc, g_vector_dimensions(sc, set_plist_1(sc, old_vect)), small_int(0)), sc->make_int_vector_symbol);
                            else new_vect = make_simple_int_vector(sc, len);
                            src = (s7_int *)int_vector_ints(old_vect);
                            dst = (s7_int *)int_vector_ints(new_vect);
                            for (i = len; i > 0; i--) *dst++ = *src++;
                            return(new_vect);
                        }

                        if (is_byte_vector(old_vect))
                        {
                            uint8_t *src, *dst;
                            if (vector_rank(old_vect) > 1)
                                new_vect = g_make_vector_1(sc, set_plist_2(sc, g_vector_dimensions(sc, set_plist_1(sc, old_vect)), small_int(0)), sc->make_byte_vector_symbol);
                            else new_vect = make_simple_byte_vector(sc, len);
                            src = (uint8_t *)byte_vector_bytes(old_vect);
                            dst = (uint8_t *)byte_vector_bytes(new_vect);
                            for (i = len; i > 0; i--) *dst++ = *src++;
                            return(new_vect);
                        }
                        return(NULL);
                    }

// Assembly:
movzbl (%rsi), %eax
addl $-0x15, %eax
cmpl $0x3, %eax
ja 0x2f4a5
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %r15
movq 0x8(%rsi), %rbx
leaq 0xa4043(%rip), %rcx     # 0xd3314
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movb 0x6(%r14), %al
shrb %al
testq %rbx, %rbx
setg %cl
andb %al, %cl
movq 0x18(%r14), %rax
movq 0x20(%rax), %rax
cmpb $0x1, %cl
jne 0x2f536
testq %rax, %rax
je 0x2f5a9
cmpq $0x2, 0x10(%rax)
jl 0x2f5a9
movq 0x90(%r15), %rax
movq 0x110(%r15), %r12
cmpq 0x98(%r15), %rax
ja 0x2f333
movq %r15, %rdi
callq 0x9c27
movq 0x90(%r15), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%r15)
movq -0x8(%rax), %rsi
movq $0x200001, (%rsi)       # imm = 0x200001
movq %r14, 0x8(%rsi)
movq %r12, 0x10(%rsi)
movq %r15, %rdi
callq 0x2f66b
jmp 0x2f605
movq 0x18(%r14), %rax
movq 0x20(%rax), %rax
testq %rax, %rax
je 0x2f4a8
cmpq $0x2, 0x10(%rax)
jl 0x2f4a8
movq 0x700(%r15), %rax
movq %r14, 0x8(%rax)
movq 0x700(%r15), %rsi
movq %r15, %rdi
callq 0x2f66b
movq 0xea8bd(%rip), %rcx     # 0x119c58
movq 0x708(%r15), %rdx
movq %rax, 0x8(%rdx)
movq 0x710(%r15), %rax
movq %rcx, 0x8(%rax)
movq 0x708(%r15), %rsi
movq 0x12d8(%r15), %rdx
movq %r15, %rdi
callq 0x2f867
jmp 0x2f4b3
movq 0x18(%r14), %rax
movq 0x20(%rax), %rax
testq %rax, %rax
je 0x2f4d9
cmpq $0x2, 0x10(%rax)
jl 0x2f4d9
movq 0x700(%r15), %rax
movq %r14, 0x8(%rax)
movq 0x700(%r15), %rsi
movq %r15, %rdi
callq 0x2f66b
movq 0xe6547(%rip), %rcx     # 0x115950
movq 0x708(%r15), %rdx
movq %rax, 0x8(%rdx)
movq 0x710(%r15), %rax
movq %rcx, 0x8(%rax)
movq 0x708(%r15), %rsi
movq 0x12d0(%r15), %rdx
movq %r15, %rdi
callq 0x2f867
jmp 0x2f4e4
movq 0x18(%r14), %rax
movq 0x20(%rax), %rax
testq %rax, %rax
je 0x2f507
cmpq $0x2, 0x10(%rax)
jl 0x2f507
movq 0x700(%r15), %rax
movq %r14, 0x8(%rax)
movq 0x700(%r15), %rsi
movq %r15, %rdi
callq 0x2f66b
movq 0xe64d9(%rip), %rcx     # 0x115950
movq 0x708(%r15), %rdx
movq %rax, 0x8(%rdx)
movq 0x710(%r15), %rax
movq %rcx, 0x8(%rax)
movq 0x708(%r15), %rsi
movq 0x12f0(%r15), %rdx
movq %r15, %rdi
callq 0x2f867
jmp 0x2f512
xorl %eax, %eax
retq
movq %r15, %rdi
movq %rbx, %rsi
callq 0x2fd63
movq 0x10(%r14), %rcx
movq 0x10(%rax), %rdx
xorl %esi, %esi
testq %rbx, %rbx
jle 0x2f653
movsd (%rcx,%rsi), %xmm0
movsd %xmm0, (%rdx,%rsi)
decq %rbx
addq $0x8, %rsi
jmp 0x2f4bd
movq %r15, %rdi
movq %rbx, %rsi
callq 0x2fe85
movq 0x10(%r14), %rcx
movq 0x10(%rax), %rdx
xorl %esi, %esi
testq %rbx, %rbx
jle 0x2f653
movb (%rcx,%rsi), %dil
movb %dil, (%rdx,%rsi)
decq %rbx
incq %rsi
jmp 0x2f4ee
movq %r15, %rdi
movq %rbx, %rsi
callq 0x2fdf4
movq 0x10(%r14), %rcx
movq 0x10(%rax), %rdx
xorl %esi, %esi
testq %rbx, %rbx
jle 0x2f653
movq (%rcx,%rsi), %rdi
movq %rdi, (%rdx,%rsi)
decq %rbx
addq $0x8, %rsi
jmp 0x2f51c
testq %rax, %rax
je 0x2f5bf
cmpq $0x2, 0x10(%rax)
jl 0x2f5bf
movq 0x90(%r15), %rax
movq 0x110(%r15), %r12
cmpq 0x98(%r15), %rax
ja 0x2f56c
movq %r15, %rdi
callq 0x9c27
movq 0x90(%r15), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%r15)
movq -0x8(%rax), %rsi
movq $0x200001, (%rsi)       # imm = 0x200001
movq %r14, 0x8(%rsi)
movq %r12, 0x10(%rsi)
movq %r15, %rdi
callq 0x2f66b
movq 0x700(%r15), %rcx
movq %rax, 0x8(%rcx)
movq 0x700(%r15), %rsi
jmp 0x2f62b
cmpq $0x7ff, %rbx            # imm = 0x7FF
ja 0x2f5cc
leaq 0xe6397(%rip), %rax     # 0x115950
movq (%rax,%rbx,8), %rax
jmp 0x2f605
movq %r15, %rdi
movq %rbx, %rsi
callq 0x2f202
jmp 0x2f633
movq 0x90(%r15), %rax
cmpq 0x98(%r15), %rax
ja 0x2f5eb
movq %r15, %rdi
callq 0x9c27
movq 0x90(%r15), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%r15)
movq -0x8(%rax), %rax
movq $0xb, (%rax)
movq %rbx, 0x8(%rax)
movq 0x10(%r14), %rcx
movq 0x28(%r14), %rdx
movq (%rcx), %rcx
movq 0x718(%r15), %rsi
movq %rax, 0x8(%rsi)
movq 0x10(%rsi), %rax
movq %rcx, 0x8(%rax)
movq 0x10(%rax), %rax
movq %rdx, 0x8(%rax)
movq %r15, %rdi
callq 0x2f65f
movq 0x10(%r14), %rcx
movq 0x10(%rax), %rdx
xorl %esi, %esi
testq %rbx, %rbx
jle 0x2f653
movq (%rcx,%rsi), %rdi
movq %rdi, (%rdx,%rsi)
decq %rbx
addq $0x8, %rsi
jmp 0x2f63d
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq