// File: /workspace/github_c_makefile_star2_O3/BernardTatin[P]s7sh/s7.c
// Function: hash_table_copy
static s7_pointer hash_table_copy(s7_scheme *sc, s7_pointer old_hash, s7_pointer new_hash, s7_int start, s7_int end)
                {
                    s7_int i, old_len, new_mask, count = 0;
                    hash_entry_t **old_lists, **new_lists;
                    hash_entry_t *x, *p;

                    if ((is_typed_hash_table(new_hash)) &&
                            (sc->safety >= NO_SAFETY) &&
                            ((!is_typed_hash_table(old_hash)) ||
                             (hash_table_key_typer(old_hash) != hash_table_key_typer(new_hash)) ||
                             (hash_table_value_typer(old_hash) != hash_table_value_typer(new_hash))))
                        check_old_hash(sc, old_hash, new_hash, start, end);

                    old_len = hash_table_mask(old_hash) + 1;
                    new_mask = hash_table_mask(new_hash);
                    old_lists = hash_table_elements(old_hash);
                    new_lists = hash_table_elements(new_hash);

                    if (hash_table_entries(new_hash) == 0)
                    {
                        hash_table_checker(new_hash) = hash_table_checker(old_hash);
                        if (hash_chosen(old_hash)) hash_set_chosen(new_hash);
                        if ((start == 0) &&
                                (end >= hash_table_entries(old_hash)))
                        {
                            for (i = 0; i < old_len; i++)
                                for (x = old_lists[i]; x; x = hash_entry_next(x))
                                {
                                    s7_int loc;
                                    loc = hash_entry_raw_hash(x) & new_mask;
                                    p = make_hash_entry(sc, hash_entry_key(x), hash_entry_value(x), hash_entry_raw_hash(x));
                                    hash_entry_next(p) = new_lists[loc];
                                    new_lists[loc] = p;
                                }
                            hash_table_entries(new_hash) = hash_table_entries(old_hash);
                            return(new_hash);
                        }
                        for (i = 0; i < old_len; i++)
                            for (x = old_lists[i]; x; x = hash_entry_next(x))
                            {
                                if (count >= end)
                                {
                                    hash_table_entries(new_hash) = end - start;
                                    return(new_hash);
                                }
                                if (count >= start)
                                {
                                    s7_int loc;
                                    loc = hash_entry_raw_hash(x) & new_mask;
                                    p = make_hash_entry(sc, hash_entry_key(x), hash_entry_value(x), hash_entry_raw_hash(x));
                                    hash_entry_next(p) = new_lists[loc];
                                    new_lists[loc] = p;
                                }
                                count++;
                            }
                        hash_table_entries(new_hash) = count - start;
                        return(new_hash);
                    }

                    /* this can't be optimized much because we have to look for key matches (we're copying old_hash into the exisiting, non-empty new_hash) */
                    for (i = 0; i < old_len; i++)
                        for (x = old_lists[i]; x; x = hash_entry_next(x))
                        {
                            if (count >= end)
                                return(new_hash);
                            if (count >= start)
                            {
                                hash_entry_t *y;
                                y = (*hash_table_checker(new_hash))(sc, new_hash, hash_entry_key(x));
                                if (y != sc->unentry)
                                    hash_entry_set_value(y, hash_entry_value(x));
                                else
                                {
                                    s7_int loc;
                                    loc = hash_entry_raw_hash(x) & new_mask;
                                    p = make_hash_entry(sc, hash_entry_key(x), hash_entry_value(x), hash_entry_raw_hash(x));
                                    hash_entry_next(p) = new_lists[loc];
                                    new_lists[loc] = p;
                                    hash_table_entries(new_hash)++;
                                    if (!hash_chosen(new_hash))
                                        hash_table_set_checker(new_hash, type(hash_entry_key(x)));
                                }
                            }
                            count++;
                        }
                    return(new_hash);
                }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r8, 0x18(%rsp)
movq %rcx, %r15
movq %rdx, %rbx
movq %rsi, 0x8(%rsp)
movq %rdi, %r14
testb $0x2, 0x6(%rdx)
je 0x9b50a
cmpq $0x0, 0x6a0(%r14)
js 0x9b50a
movq 0x8(%rsp), %rax
testb $0x2, 0x6(%rax)
je 0x9b2c8
movq 0x8(%rsp), %rax
movq 0x28(%rax), %rax
movq 0x20(%rax), %rax
movq 0x18(%rax), %rdx
movq 0x28(%rbx), %rcx
movq 0x20(%rcx), %rcx
cmpq 0x18(%rcx), %rdx
jne 0x9b2c8
movq 0x20(%rax), %rax
cmpq 0x20(%rcx), %rax
je 0x9b50a
movq 0x8(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x28(%rsp)
testq %rax, %rax
js 0x9b50a
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0x20(%rsp)
movq $0x0, 0x10(%rsp)
movq 0x20(%rsp), %rax
movq 0x10(%rsp), %rcx
movq (%rax,%rcx,8), %r12
testq %r12, %r12
je 0x9b4f1
cmpq $0x0, 0x18(%rsp)
jg 0x9b4de
jmp 0x9b50a
movq (%r12), %r13
testb $0x4, 0x6(%rbx)
movq 0x20(%r12), %rbp
movq 0x28(%rbx), %rax
movq 0x20(%rax), %rax
movq 0x18(%rax), %rsi
jne 0x9b368
cmpq 0x118(%r14), %rsi
je 0x9b400
cmpb $0x30, (%rsi)
jb 0x9b388
movq 0x10(%rsi), %rax
movq 0x700(%r14), %rcx
movq %r13, 0x8(%rcx)
movq 0x700(%r14), %rsi
movq %r14, %rdi
callq *%rax
jmp 0x9b3a2
movq 0x8(%rsi), %rax
movq 0x58(%rax), %rcx
movq 0x8(%rcx), %rcx
movq 0x20(%rcx), %rcx
movb (%r13), %dl
cmpb 0x10(%rcx), %dl
je 0x9b400
cmpb $0x2f, (%rsi)
jbe 0x9b3c2
jmp 0x9b3d6
movq 0x700(%r14), %rax
movq %r13, 0x8(%rax)
movq 0x700(%r14), %rdx
movq %r14, %rdi
callq 0xaee6
cmpq 0x120(%r14), %rax
jne 0x9b400
movq 0x28(%rbx), %rax
movq 0x20(%rax), %rax
movq 0x18(%rax), %rsi
cmpb $0x30, (%rsi)
jb 0x9b3c2
movq 0x8(%rsi), %rax
jmp 0x9b3d6
movq 0x18(%rsi), %rdx
movq %r14, %rdi
callq 0x99caa
movq 0x8(%rax), %rax
addq $0x10, %rax
movq (%rax), %rsi
movq %r14, %rdi
movl $0x1, %edx
callq 0x99bbf
movl $0x2, %edx
movq %r14, %rdi
leaq 0x7be1e(%rip), %rsi     # 0x117213
movq %r13, %rcx
movq %rax, %r8
callq 0xd4e5
testb $0x1, 0x6(%rbx)
movq 0x28(%rbx), %rax
movq 0x20(%rax), %rax
movq 0x20(%rax), %rsi
jne 0x9b441
cmpq 0x118(%r14), %rsi
je 0x9b4e7
cmpb $0x30, (%rsi)
jb 0x9b464
movq 0x10(%rsi), %rax
movq 0x700(%r14), %rcx
movq %rbp, 0x8(%rcx)
movq 0x700(%r14), %rsi
movq %r14, %rdi
callq *%rax
jmp 0x9b47e
movq 0x8(%rsi), %rax
movq 0x58(%rax), %rcx
movq 0x8(%rcx), %rcx
movq 0x20(%rcx), %rcx
movb (%rbp), %dl
cmpb 0x10(%rcx), %dl
je 0x9b4e7
cmpb $0x2f, (%rsi)
jbe 0x9b49e
jmp 0x9b4b2
movq 0x700(%r14), %rax
movq %rbp, 0x8(%rax)
movq 0x700(%r14), %rdx
movq %r14, %rdi
callq 0xaee6
cmpq 0x120(%r14), %rax
jne 0x9b4e7
movq 0x28(%rbx), %rax
movq 0x20(%rax), %rax
movq 0x20(%rax), %rsi
cmpb $0x30, (%rsi)
jb 0x9b49e
movq 0x8(%rsi), %rax
jmp 0x9b4b2
movq 0x18(%rsi), %rdx
movq %r14, %rdi
callq 0x99caa
movq 0x8(%rax), %rax
addq $0x10, %rax
movq (%rax), %rsi
movq %r14, %rdi
movl $0x1, %edx
callq 0x99bbf
movl $0x3, %edx
movq %r14, %rdi
leaq 0x7bd56(%rip), %rsi     # 0x117227
movq %rbp, %rcx
movq %rax, %r8
callq 0xd4e5
jmp 0x9b4e7
testq %r15, %r15
jle 0x9b31e
movq 0x18(%r12), %r12
testq %r12, %r12
jne 0x9b4de
movq 0x10(%rsp), %rcx
leaq 0x1(%rcx), %rax
cmpq 0x28(%rsp), %rcx
movq %rax, 0x10(%rsp)
jne 0x9b2f6
movq 0x8(%rsp), %rdx
movq 0x8(%rdx), %rsi
movq 0x10(%rdx), %rax
movq %rax, 0x20(%rsp)
movq 0x8(%rbx), %rax
movq %rax, 0x10(%rsp)
movq 0x10(%rbx), %r13
movq 0x28(%rbx), %rax
cmpq $0x0, 0x18(%rax)
movq %r15, 0x28(%rsp)
movq %rsi, 0x30(%rsp)
je 0x9b650
testq %rsi, %rsi
js 0x9b710
movq $0x0, 0x8(%rsp)
xorl %r12d, %r12d
movq 0x20(%rsp), %rax
movq 0x8(%rsp), %rcx
movq (%rax,%rcx,8), %rbp
testq %rbp, %rbp
je 0x9b632
cmpq 0x18(%rsp), %r12
jge 0x9b710
cmpq %r15, %r12
jl 0x9b626
movq (%rbp), %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq *0x18(%rbx)
cmpq 0x490(%r14), %rax
je 0x9b5a5
movq 0x20(%rbp), %rcx
movq %rcx, 0x20(%rax)
jmp 0x9b626
movq (%rbp), %rsi
movq 0x10(%rbp), %rcx
movq %rcx, %r15
andq 0x10(%rsp), %r15
movq 0x20(%rbp), %rdx
movq %r14, %rdi
callq 0x9b91e
movq (%r13,%r15,8), %rcx
movq %rcx, 0x18(%rax)
movq %rax, (%r13,%r15,8)
movq 0x28(%rsp), %r15
movq 0x28(%rbx), %rax
incq 0x18(%rax)
movq (%rbx), %rax
btl $0x1d, %eax
jb 0x9b626
movq (%rbp), %rcx
movzbl (%rcx), %ecx
movq 0x18(%rbx), %rdx
leaq 0xb09f9(%rip), %rsi     # 0x14bff0
movq (%rsi,%rcx,8), %rcx
cmpq %rcx, %rdx
je 0x9b626
leaq -0x5e79a(%rip), %rsi    # 0x3ce6d
cmpq %rsi, %rdx
je 0x9b622
leaq -0x5e1e9(%rip), %rcx    # 0x3d42a
movq %rcx, 0x18(%rbx)
orq $0x20000000, %rax       # imm = 0x20000000
movq %rax, (%rbx)
jmp 0x9b626
movq %rcx, 0x18(%rbx)
incq %r12
movq 0x18(%rbp), %rbp
jmp 0x9b565
movq 0x8(%rsp), %rcx
leaq 0x1(%rcx), %rax
cmpq 0x30(%rsp), %rcx
movq %rax, 0x8(%rsp)
jne 0x9b557
jmp 0x9b710
movq 0x18(%rdx), %rcx
movq %rcx, 0x18(%rbx)
testb $0x20, 0x3(%rdx)
je 0x9b662
orb $0x20, 0x3(%rbx)
testq %r15, %r15
jne 0x9b67a
movq 0x28(%rdx), %rcx
movq 0x18(%rcx), %r12
cmpq 0x18(%rsp), %r12
jle 0x9b722
testq %rsi, %rsi
js 0x9b706
xorl %ecx, %ecx
xorl %r12d, %r12d
movq 0x20(%rsp), %rax
movq %rcx, 0x8(%rsp)
movq (%rax,%rcx,8), %rbp
testq %rbp, %rbp
je 0x9b6df
cmpq 0x18(%rsp), %r12
jge 0x9b6f8
cmpq %r15, %r12
jl 0x9b6d6
movq (%rbp), %rsi
movq 0x10(%rbp), %rcx
movq %rcx, %r15
andq 0x10(%rsp), %r15
movq 0x20(%rbp), %rdx
movq %r14, %rdi
callq 0x9b91e
movq (%r13,%r15,8), %rcx
movq %rcx, 0x18(%rax)
movq %rax, (%r13,%r15,8)
movq 0x28(%rsp), %r15
incq %r12
movq 0x18(%rbp), %rbp
jmp 0x9b696
movq 0x8(%rsp), %rcx
leaq 0x1(%rcx), %rax
cmpq 0x30(%rsp), %rcx
movq %rax, %rcx
jne 0x9b688
movq 0x28(%rbx), %rax
jmp 0x9b709
movq 0x18(%rsp), %r12
subq %r15, %r12
movq 0x28(%rbx), %rax
jmp 0x9b70c
xorl %r12d, %r12d
subq %r15, %r12
movq %r12, 0x18(%rax)
movq %rbx, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testq %rsi, %rsi
js 0x9b70c
xorl %ecx, %ecx
movq 0x10(%rsp), %r15
movq 0x20(%rsp), %rax
movq %rcx, 0x18(%rsp)
movq (%rax,%rcx,8), %r12
testq %r12, %r12
je 0x9b772
movq (%r12), %rsi
movq 0x10(%r12), %rcx
movq %rcx, %rbp
andq %r15, %rbp
movq 0x20(%r12), %rdx
movq %r14, %rdi
callq 0x9b91e
movq (%r13,%rbp,8), %rcx
movq %rcx, 0x18(%rax)
movq %rax, (%r13,%rbp,8)
movq 0x18(%r12), %r12
jmp 0x9b73c
movq 0x18(%rsp), %rcx
leaq 0x1(%rcx), %rax
cmpq 0x30(%rsp), %rcx
movq %rax, %rcx
jne 0x9b72e
movq 0x8(%rsp), %rax
movq 0x28(%rax), %rax
movq 0x18(%rax), %r12
jmp 0x9b700