// File: /workspace/github_c_makefile_star2_O2/BernardTatin[P]s7sh/s7.c
// Function: hash_table_to_port
static void hash_table_to_port(s7_scheme *sc, s7_pointer hash, s7_pointer port, use_write_t use_write, shared_info *ci)
    {
        s7_int i, len, gc_iter;
        bool too_long = false;
        s7_pointer iterator, p;
        int32_t href;

        /* if hash is a member of ci, just print its number
         * (let ((ht (hash-table '(a . 1)))) (hash-table-set! ht 'b ht))
         *
         * since equal? does not care about the hash-table lengths, we can ignore that complication in the :readable case
         * there's no way to make a truly :readable version of a weak hash-table (or a normal hash-table that uses eq? with pairs, for example)
         */
        len = hash_table_entries(hash);
        if (len == 0)
        {
            if (is_weak_hash_table(hash))
                port_write_string(port)(sc, "(weak-hash-table)", 17, port);
            else port_write_string(port)(sc, "(hash-table)", 12, port);
            return;
        }

        if (use_write != P_READABLE)
        {
            s7_int plen;
            plen = sc->print_length;
            if (plen <= 0)
            {
                port_write_string(port)(sc, "(hash-table ...)", 16, port);
                return;
            }
            if (len > plen)
            {
                too_long = true;
                len = plen;
            }
        }

        if ((use_write == P_READABLE) &&
                (ci))
        {
            href = peek_shared_ref(ci, hash);
            if (href != 0)
            {
                if (href < 0) href = -href;
                if ((ci->defined[href]) || (port == ci->cycle_port))
                {
                    char buf[128];
                    int32_t plen;
                    plen = catstrs_direct(buf, "<", pos_int_to_str_direct(sc, href), ">", NULL);
                    port_write_string(port)(sc, buf, plen, port);
                    return;
                }
            }
        }

        iterator = s7_make_iterator(sc, hash);
        gc_iter = s7_gc_protect_1(sc, iterator);
        p = cons(sc, sc->F, sc->F);
        iterator_current(iterator) = p;
        set_mark_seq(iterator);

        if ((use_write == P_READABLE) &&
                (is_immutable(hash)))
            port_write_string(port)(sc, "(immutable! ", 12, port);

        if ((use_write == P_READABLE) &&
                (ci) &&
                (is_cyclic(hash)) &&
                ((href = peek_shared_ref(ci, hash)) != 0))
        {
            if (href < 0) href = -href;

            if (is_weak_hash_table(hash))
                port_write_string(port)(sc, "(weak-hash-table", 16, port);
            else port_write_string(port)(sc, "(hash-table", 11, port); /* top level let */
            for (i = 0; i < len; i++)
            {
                s7_pointer key_val, key, val;

                key_val = hash_table_iterate(sc, iterator);
                key = car(key_val);
                val = cdr(key_val);
                if ((has_structure(val)) ||
                        (has_structure(key)))
                {
                    char buf[128];
                    int32_t eref, kref, plen;
                    eref = peek_shared_ref(ci, val);
                    kref = peek_shared_ref(ci, key);
                    plen = catstrs_direct(buf, "  (set! (<", pos_int_to_str_direct(sc, href), "> ", NULL);
                    port_write_string(ci->cycle_port)(sc, buf, plen, ci->cycle_port);

                    if (kref != 0)
                    {
                        if (kref < 0) kref = -kref;
                        plen = catstrs_direct(buf, "<", pos_int_to_str_direct(sc, kref), ">", NULL);
                        port_write_string(ci->cycle_port)(sc, buf, plen, ci->cycle_port);
                    }
                    else object_to_port(sc, key, ci->cycle_port, P_READABLE, ci);

                    if (eref != 0)
                    {
                        if (eref < 0) eref = -eref;
                        plen = catstrs_direct(buf, ") <", pos_int_to_str_direct(sc, eref), ">)\n", NULL);
                        port_write_string(ci->cycle_port)(sc, buf, plen, ci->cycle_port);
                    }
                    else
                    {
                        port_write_string(ci->cycle_port)(sc, ") ", 2, ci->cycle_port);
                        object_to_port_with_circle_check(sc, val, ci->cycle_port, P_READABLE, ci);
                        port_write_string(ci->cycle_port)(sc, ")\n", 2, ci->cycle_port);
                    }
                }
                else
                {
                    port_write_character(port)(sc, ' ', port);
                    object_to_port_with_circle_check(sc, key, port, P_READABLE, ci);
                    port_write_character(port)(sc, ' ', port);
                    object_to_port_with_circle_check(sc, val, port, P_READABLE, ci);
                }
            }
            port_write_character(port)(sc, ')', port);
        }
        else
        {
            if (is_weak_hash_table(hash))
                port_write_string(port)(sc, "(weak-hash-table", 16, port);
            else port_write_string(port)(sc, "(hash-table", 11, port);
            for (i = 0; i < len; i++)
            {
                s7_pointer key_val;
                port_write_character(port)(sc, ' ', port);
                key_val = hash_table_iterate(sc, iterator);
#if S7_DEBUGGING
                if (!is_pair(key_val))
                {
                    fprintf(stderr, "hash entries clobbered\n");
                    hash_table_entries(hash) = i;
                    break;
                }
#endif
                if (use_write != P_READABLE)
                {
                    if (is_normal_symbol(car(key_val)))
                        port_write_character(port)(sc, '\'', port);
                }
                object_to_port_with_circle_check(sc, car(key_val), port, NOT_P_DISPLAY(use_write), ci);
                port_write_character(port)(sc, ' ', port);
                object_to_port_with_circle_check(sc, cdr(key_val), port, NOT_P_DISPLAY(use_write), ci);
            }
            if (too_long)
                port_write_string(port)(sc, " ...)", 5, port);
            else port_write_character(port)(sc, ')', port);
        }

        if ((use_write == P_READABLE) &&
                (is_immutable(hash)))
            port_write_character(port)(sc, ')', port);

        s7_gc_unprotect_at(sc, gc_iter);
        iterator_current(iterator) = sc->nil;
        free_cell(sc, p);
        /* free_cell(sc, iterator); */ /* 18-Dec-18 removed */
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %rdx, %r14
movq %rdi, %rbx
movq 0x28(%rsi), %rax
movq 0x18(%rax), %rax
movq %rax, 0x18(%rsp)
testq %rax, %rax
je 0xbeb36
movq %r8, %r12
movl %ecx, %r15d
cmpl $0x2, %ecx
movq %rsi, 0x10(%rsp)
movq %r8, 0x8(%rsp)
jne 0xbeb56
testq %r12, %r12
je 0xbeb99
movq %r12, %rdi
callq 0x7855f
movb $0x1, %bpl
testl %eax, %eax
je 0xbeb22
movl %eax, %esi
negl %esi
cmovsl %eax, %esi
movq 0x48(%r12), %rax
cmpb $0x0, (%rax,%rsi)
jne 0xbee59
cmpq %r14, 0x28(%r12)
je 0xbee59
movl %r15d, %r13d
movl $0x0, (%rsp)
movb $0x1, %r12b
movq 0x10(%rsp), %rsi
jmp 0xbeba8
testb $0x8, 0x3(%rsi)
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
jne 0xbeb8b
leaq 0x27ab0(%rip), %rsi     # 0xe65ff
pushq $0xc
jmp 0xbee3f
movq 0x280(%rbx), %rax
testq %rax, %rax
jle 0xbee2a
movl %r15d, %r13d
movq 0x18(%rsp), %rcx
cmpq %rax, %rcx
cmovgeq %rax, %rcx
movq %rcx, 0x18(%rsp)
setg %al
movl %eax, (%rsp)
testq %r12, %r12
setne %r12b
xorl %ebp, %ebp
jmp 0xbeba8
leaq 0x27a5b(%rip), %rsi     # 0xe65ed
pushq $0x11
jmp 0xbee3f
movl %r15d, %r13d
xorl %ebp, %ebp
xorl %r12d, %r12d
movl $0x0, (%rsp)
movq %rbx, %rdi
callq 0xa3c7
movq %rbx, %rdi
movq %rax, 0x20(%rsp)
movq %rax, %rsi
callq 0x89a9
movq %rax, 0x30(%rsp)
movq 0x90(%rbx), %rax
movq 0x120(%rbx), %r15
cmpq 0x98(%rbx), %rax
ja 0xbebeb
movq %rbx, %rdi
callq 0x9c27
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %rcx
movq $0x200001, (%rcx)       # imm = 0x200001
movq %r15, 0x8(%rcx)
movq %r15, 0x10(%rcx)
movq 0x20(%rsp), %rax
orb $0x4, 0x3(%rax)
movq %rcx, 0x28(%rsp)
movq %rcx, 0x10(%rax)
movl %r13d, %r15d
cmpl $0x2, %r13d
movq 0x10(%rsp), %rcx
jne 0xbec4f
testb $0x1, 0x3(%rcx)
je 0xbec4f
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
leaq 0x23ea6(%rip), %rsi     # 0xe2ae4
pushq $0xc
popq %rdx
movq %rbx, %rdi
movq %r14, %rcx
callq *0x10(%rax)
movq 0x10(%rsp), %rcx
testb %bpl, %bpl
movq 0x8(%rsp), %r13
movl %r15d, 0x4(%rsp)
je 0xbeca5
testb $0x20, 0x6(%rcx)
je 0xbeca5
movq %r13, %rdi
movq 0x10(%rsp), %rsi
callq 0x7855f
movq 0x10(%rsp), %rcx
testl %eax, %eax
je 0xbeca5
movl %eax, %ebp
negl %ebp
cmovsl %eax, %ebp
testb $0x8, 0x3(%rcx)
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
jne 0xbeea1
leaq 0x27990(%rip), %rsi     # 0xe662e
pushq $0xb
jmp 0xbeeaa
testb $0x8, 0x3(%rcx)
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
jne 0xbecc2
leaq 0x27970(%rip), %rsi     # 0xe662e
pushq $0xb
jmp 0xbeccb
leaq 0x27954(%rip), %rsi     # 0xe661d
pushq $0x10
popq %rdx
movq %rbx, %rdi
movq %r14, %rcx
callq *%rax
cmpl $0x1, %r15d
adcl $0x0, %r15d
xorl %ebp, %ebp
movq 0x18(%rsp), %rax
testq %rax, %rax
cmovgq %rax, %rbp
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
subq $0x1, %rbp
jb 0xbee08
movq %rbx, %rdi
pushq $0x20
popq %rsi
movq %r14, %rdx
callq *0x8(%rax)
movq %rbx, %rdi
movq 0x20(%rsp), %rsi
callq 0x2b18f
movq %rax, %r13
cmpl $0x2, 0x4(%rsp)
je 0xbed42
movq 0x8(%r13), %rax
cmpb $0xa, (%rax)
jne 0xbed42
testb $-0x80, 0x6(%rax)
jne 0xbed42
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
movq %rbx, %rdi
pushq $0x27
popq %rsi
movq %r14, %rdx
callq *0x8(%rax)
movq 0x8(%r13), %rsi
movzbl (%rsi), %eax
testb %r12b, %r12b
je 0xbed7e
leaq 0x625eb(%rip), %rcx     # 0x121340
cmpb $0x1, (%rax,%rcx)
jne 0xbed7e
cmpl $0x15, %eax
jne 0xbed69
testb $0x1, 0x7(%rsi)
pushq $0x15
popq %rax
jne 0xbed7e
movq %rbx, %rdi
movq %r14, %rdx
movl %r15d, %ecx
movq 0x8(%rsp), %r8
callq 0x77872
jmp 0xbed97
movq %rbx, %rdi
movq %r14, %rdx
movl %r15d, %ecx
movq 0x8(%rsp), %r8
leaq 0x625ed(%rip), %r9      # 0x121380
callq *(%r9,%rax,8)
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
movq %rbx, %rdi
pushq $0x20
popq %rsi
movq %r14, %rdx
callq *0x8(%rax)
movq 0x10(%r13), %rsi
movzbl (%rsi), %eax
testb %r12b, %r12b
je 0xbedea
leaq 0x62582(%rip), %rcx     # 0x121340
cmpb $0x1, (%rax,%rcx)
movq 0x8(%rsp), %r8
jne 0xbedef
cmpl $0x15, %eax
jne 0xbedd7
testb $0x1, 0x7(%rsi)
pushq $0x15
popq %rax
jne 0xbedef
movq %rbx, %rdi
movq %r14, %rdx
movl %r15d, %ecx
callq 0x77872
jmp 0xbecea
movq 0x8(%rsp), %r8
movq %rbx, %rdi
movq %r14, %rdx
movl %r15d, %ecx
leaq 0x62581(%rip), %r9      # 0x121380
callq *(%r9,%rax,8)
jmp 0xbecea
cmpb $0x0, (%rsp)
je 0xbf1be
leaq 0x25877(%rip), %rsi     # 0xe4690
pushq $0x5
popq %rdx
movq %rbx, %rdi
movq %r14, %rcx
callq *0x10(%rax)
jmp 0xbf1ca
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
leaq 0x277cf(%rip), %rsi     # 0xe660c
pushq $0x10
popq %rdx
movq %rbx, %rdi
movq %r14, %rcx
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *%rax
movq %rbx, %rdi
callq 0x91f9
leaq 0x279a3(%rip), %rsi     # 0xe680b
leaq 0x27c72(%rip), %rcx     # 0xe6ae1
leaq 0x40(%rsp), %r15
movq %r15, %rdi
movq %rax, %rdx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0xb3a5
movq 0x8(%r14), %rcx
movq 0x48(%rcx), %r8
movslq %eax, %rdx
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rcx
callq *0x10(%r8)
jmp 0xbf22f
leaq 0x27775(%rip), %rsi     # 0xe661d
pushq $0x10
popq %rdx
movq %rbx, %rdi
movq %r14, %rcx
callq *%rax
movq 0x18(%rsp), %r12
movl %ebp, %eax
movq %rax, 0x38(%rsp)
xorl %eax, %eax
testq %r12, %r12
cmovleq %rax, %r12
leaq 0x40(%rsp), %rbp
jmp 0xbf1ac
movq %rbx, %rdi
movq 0x20(%rsp), %rsi
callq 0x2b18f
movq 0x8(%rax), %r15
movq 0x10(%rax), %rsi
movzbl (%rsi), %eax
leaq 0x6244f(%rip), %rcx     # 0x121340
cmpb $0x1, (%rax,%rcx)
movq %rsi, 0x8(%rsp)
jne 0xbef06
cmpb $0x15, %al
jne 0xbef2a
testb $0x1, 0x7(%rsi)
je 0xbef2a
movzbl (%r15), %eax
leaq 0x6242f(%rip), %rcx     # 0x121340
cmpb $0x1, (%rax,%rcx)
jne 0xbefe7
cmpb $0x15, %al
jne 0xbef2a
testb $0x1, 0x7(%r15)
jne 0xbefe7
movq %r12, 0x18(%rsp)
movq %r13, %rdi
callq 0x7855f
movl %eax, (%rsp)
movq %r13, %rdi
movq %r15, %rsi
callq 0x7855f
movq %r13, %r12
movl %eax, %r13d
movq %rbx, %rdi
movq 0x38(%rsp), %rsi
callq 0x91f9
movq %rbp, %rdi
leaq 0x275e2(%rip), %rsi     # 0xe6544
movq %rax, %rdx
leaq 0x23b73(%rip), %rcx     # 0xe2adf
xorl %r8d, %r8d
xorl %eax, %eax
callq 0xb3a5
movq 0x28(%r12), %rcx
movq 0x8(%rcx), %rdx
movq 0x48(%rdx), %r8
movslq %eax, %rdx
movq %rbx, %rdi
movq %rbp, %rsi
callq *0x10(%r8)
testl %r13d, %r13d
je 0xbf0ae
movl %r13d, %esi
negl %esi
cmovsl %r13d, %esi
movq %rbx, %rdi
callq 0x91f9
movq %rbp, %rdi
leaq 0x27857(%rip), %rsi     # 0xe680b
movq %rax, %rdx
leaq 0x27b23(%rip), %rcx     # 0xe6ae1
xorl %r8d, %r8d
xorl %eax, %eax
callq 0xb3a5
movq 0x28(%r12), %rcx
movq 0x8(%rcx), %rdx
movq 0x48(%rdx), %r8
movslq %eax, %rdx
movq %rbx, %rdi
movq %rbp, %rsi
callq *0x10(%r8)
jmp 0xbf0ce
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
movq %rbx, %rdi
pushq $0x20
popq %rsi
movq %r14, %rdx
callq *0x8(%rax)
movzbl (%r15), %eax
leaq 0x6233a(%rip), %rcx     # 0x121340
cmpb $0x1, (%rax,%rcx)
jne 0xbf02e
cmpl $0x15, %eax
jne 0xbf018
testb $0x1, 0x7(%r15)
jne 0xbf02e
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
pushq $0x2
popq %rcx
movq %r13, %r8
callq 0x77872
jmp 0xbf048
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
pushq $0x2
popq %rcx
movq %r13, %r8
leaq 0x6233c(%rip), %r9      # 0x121380
callq *(%r9,%rax,8)
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
movq %rbx, %rdi
pushq $0x20
popq %rsi
movq %r14, %rdx
callq *0x8(%rax)
movq 0x8(%rsp), %rsi
movzbl (%rsi), %eax
leaq 0x622d5(%rip), %rcx     # 0x121340
cmpb $0x1, (%rax,%rcx)
jne 0xbf092
cmpl $0x15, %eax
jne 0xbf07c
testb $0x1, 0x7(%rsi)
jne 0xbf092
movq %rbx, %rdi
movq %r14, %rdx
pushq $0x2
popq %rcx
movq %r13, %r8
callq 0x77872
jmp 0xbf1ac
movq %rbx, %rdi
movq %r14, %rdx
pushq $0x2
popq %rcx
movq %r13, %r8
leaq 0x622db(%rip), %r9      # 0x121380
callq *(%r9,%rax,8)
jmp 0xbf1ac
movzbl (%r15), %eax
movq 0x28(%r12), %rdx
movq %rbx, %rdi
movq %r15, %rsi
pushq $0x2
popq %rcx
movq %r12, %r8
leaq 0x622b6(%rip), %r9      # 0x121380
callq *(%r9,%rax,8)
movq %r12, %r13
movl (%rsp), %eax
testl %eax, %eax
movq 0x18(%rsp), %r12
je 0xbf128
movl %eax, %esi
negl %esi
cmovsl %eax, %esi
movq %rbx, %rdi
callq 0x91f9
movq %rbp, %rdi
leaq 0x27459(%rip), %rsi     # 0xe654f
movq %rax, %rdx
leaq 0x27458(%rip), %rcx     # 0xe6558
xorl %r8d, %r8d
xorl %eax, %eax
callq 0xb3a5
movq 0x28(%r13), %rcx
movq 0x8(%rcx), %rdx
movq 0x48(%rdx), %r8
movslq %eax, %rdx
movq %rbx, %rdi
movq %rbp, %rsi
callq *0x10(%r8)
jmp 0xbf1ac
movq 0x28(%r13), %rcx
movq 0x8(%rcx), %rax
movq 0x48(%rax), %rax
movq %rbx, %rdi
leaq 0x27617(%rip), %rsi     # 0xe6755
pushq $0x2
popq %rdx
callq *0x10(%rax)
movq 0x8(%rsp), %rsi
movzbl (%rsi), %eax
leaq 0x621ed(%rip), %rcx     # 0x121340
cmpb $0x1, (%rax,%rcx)
jne 0xbf178
cmpl $0x15, %eax
jne 0xbf164
testb $0x1, 0x7(%rsi)
jne 0xbf178
movq 0x28(%r13), %rdx
movq %rbx, %rdi
pushq $0x2
popq %rcx
movq %r13, %r8
callq 0x77872
jmp 0xbf190
movq 0x28(%r13), %rdx
movq %rbx, %rdi
pushq $0x2
popq %rcx
movq %r13, %r8
leaq 0x621f4(%rip), %r9      # 0x121380
callq *(%r9,%rax,8)
movq 0x28(%r13), %rcx
movq 0x8(%rcx), %rax
movq 0x48(%rax), %rax
movq %rbx, %rdi
leaq 0x273d3(%rip), %rsi     # 0xe6579
pushq $0x2
popq %rdx
callq *0x10(%rax)
subq $0x1, %r12
jae 0xbeed2
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
pushq $0x29
popq %rsi
movq %rbx, %rdi
movq %r14, %rdx
callq *0x8(%rax)
movl 0x4(%rsp), %r12d
cmpl $0x2, %r12d
movq 0x10(%rsp), %rax
jne 0xbf1f4
testb $0x1, 0x3(%rax)
je 0xbf1f4
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
pushq $0x29
popq %rsi
movq %rbx, %rdi
movq %r14, %rdx
callq *0x8(%rax)
movq %rbx, %rdi
movq 0x30(%rsp), %rsi
callq 0x8b00
movq 0x110(%rbx), %rax
movq 0x20(%rsp), %rcx
movq %rax, 0x10(%rcx)
movq 0x28(%rsp), %rdx
andq $0x0, (%rdx)
movq 0x90(%rbx), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq %rdx, (%rax)
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq