// File: /workspace/github_c_makefile_star2_O2/BernardTatin[P]s7sh/s7.c
// Function: iterator_to_port
static void iterator_to_port(s7_scheme *sc, s7_pointer obj, s7_pointer port, use_write_t use_write, shared_info *ci)
    {
        if (use_write == P_READABLE)
        {
            if (iterator_is_at_end(obj))
            {
                switch (type(iterator_sequence(obj)))
                {
                    case T_NIL:
                    case T_PAIR:         port_write_string(port)(sc, "(make-iterator ())", 18, port);	        break;
                    case T_STRING:       port_write_string(port)(sc, "(make-iterator \"\")", 18, port);	        break;
                    case T_BYTE_VECTOR:  port_write_string(port)(sc, "(make-iterator #u())", 20, port);	        break;
                    case T_VECTOR:       port_write_string(port)(sc, "(make-iterator #())", 19, port);	        break;
                    case T_INT_VECTOR:	 port_write_string(port)(sc, "(make-iterator #i())", 20, port);	        break;
                    case T_FLOAT_VECTOR: port_write_string(port)(sc, "(make-iterator #r())", 20, port);	        break;
                    case T_LET:	         port_write_string(port)(sc, "(make-iterator (inlet))", 23, port);      break;

                    case T_HASH_TABLE:
                                         if (is_weak_hash_table(iterator_sequence(obj)))
                                             port_write_string(port)(sc, "(make-iterator (weak-hash-table))", 33, port);
                                         else port_write_string(port)(sc, "(make-iterator (hash-table))", 28, port);
                                         break;

                    default:
                                         port_write_string(port)(sc, "(make-iterator ())", 18, port);	        break; /* c-object?? function? */
                }
            }
            else
            {
                s7_pointer seq;
                int32_t iter_ref;
                seq = iterator_sequence(obj);
                if ((ci) &&
                        (is_cyclic(obj)) &&
                        ((iter_ref = peek_shared_ref(ci, obj)) != 0))
                {
                    /* basically the same as c_pointer_to_port */
                    if (!is_cyclic_set(obj))
                    {
                        int32_t nlen;
                        char buf[128];
                        if (iter_ref < 0) iter_ref = -iter_ref;

                        if (ci->init_port == sc->F)
                        {
                            ci->init_port = s7_open_output_string(sc);
                            ci->init_loc = s7_gc_protect_1(sc, ci->init_port);
                        }
                        port_write_string(port)(sc, "#f", 2, port);
                        nlen = catstrs_direct(buf, "  (set! <", pos_int_to_str_direct(sc, iter_ref), "> (make-iterator ", NULL);
                        port_write_string(ci->init_port)(sc, buf, nlen, ci->init_port);

                        flip_ref(ci, seq);
                        object_to_port_with_circle_check(sc, seq, ci->init_port, use_write, ci);
                        flip_ref(ci, seq);

                        port_write_string(ci->init_port)(sc, "))\n", 3, ci->init_port);
                        set_cyclic_set(obj);
                        return;
                    }
                }

                if (is_string(seq))
                {
                    char *iter_str;
                    s7_int len;
                    iter_str = (char *)(string_value(seq) + iterator_position(obj));
                    len = string_length(seq) - iterator_position(obj);
                    if (len == 0)
                        port_write_string(port)(sc, "(make-iterator \"\")", 18, port);
                    else
                    {
                        port_write_string(port)(sc, "(make-iterator \"", 16, port);
                        if (!string_needs_slashification(iter_str, len))
                            port_write_string(port)(sc, iter_str, len, port);
                        else slashify_string_to_port(sc, port, iter_str, len, NOT_IN_QUOTES);
                        port_write_string(port)(sc, "\")", 2, port);
                    }
                }
                else
                {
                    if (is_pair(seq))
                    {
                        port_write_string(port)(sc, "(make-iterator ", 15, port);
                        object_to_port_with_circle_check(sc, iterator_current(obj), port, use_write, ci);
                        port_write_character(port)(sc, ')', port);
                    }
                    else
                    {
                        if ((is_let(seq)) && (seq != sc->rootlet))
                        {
                            s7_pointer slot;
                            port_write_string(port)(sc, "(let ((iter (make-iterator ", 27, port);
                            object_to_port_with_circle_check(sc, seq, port, use_write, ci);
                            port_write_string(port)(sc, "))) ", 4, port);
                            for (slot = let_slots(seq); slot != iterator_current_slot(obj); slot = next_slot(slot))
                                port_write_string(port)(sc, "(iter) ", 7, port);
                            port_write_string(port)(sc, "iter)", 5, port);
                        }
                        else
                        {
                            if (iterator_position(obj) > 0)
                                port_write_string(port)(sc, "(let ((iter (make-iterator ", 27, port);
                            else port_write_string(port)(sc, "(make-iterator ", 15, port);
                            object_to_port_with_circle_check(sc, seq, port, use_write, ci);
                            if (iterator_position(obj) > 0)
                            {
                                if (iterator_position(obj) == 1)
                                    port_write_string(port)(sc, "))) (iter) iter)", 16, port);
                                else
                                {
                                    int32_t nlen;
                                    char str[128];
                                    nlen = catstrs_direct(str, "))) (do ((i 0 (+ i 1))) ((= i ",
                                            pos_int_to_str_direct(sc, iterator_position(obj)),
                                            ") iter) (iter)))", NULL);
                                    port_write_string(port)(sc, str, nlen, port);
                                }
                            }
                            else port_write_character(port)(sc, ')', port);
                        }}}}
        }
        else
        {
            const char *str;
            if ((is_hash_table(iterator_sequence(obj))) && (is_weak_hash_table(iterator_sequence(obj))))
                str = "weak-hash-table";
            else str = type_name(sc, iterator_sequence(obj), NO_ARTICLE);
            port_write_string(port)(sc, "#<iterator: ", 12, port);
            port_write_string(port)(sc, str, safe_strlen(str), port);
            port_write_character(port)(sc, '>', port);
        }
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
cmpl $0x2, %ecx
jne 0xbf29d
movq (%r15), %rbp
movq 0x8(%r15), %r13
testl %ebp, %ebp
js 0xbf2c2
movzbl (%r13), %eax
leal -0x13(%rax), %ecx
cmpl $0x9, %ecx
ja 0xbf48f
leaq 0x15a99(%rip), %rax     # 0xd4d1c
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
jmp 0xbf416
movq 0x8(%r15), %rsi
cmpb $0x1b, (%rsi)
jne 0xbf2b0
testb $0x8, 0x3(%rsi)
jne 0xbf422
movq %rbx, %rdi
xorl %edx, %edx
callq 0x7d054
movq %rax, %r15
jmp 0xbf429
movq %r8, %r12
testq %r8, %r8
je 0xbf3d9
shrq $0x30, %rbp
testb $0x20, %bpl
je 0xbf3d9
movq %r12, %rdi
movq %r15, %rsi
callq 0x7855f
testl %eax, %eax
sete %cl
andl $0x40, %ebp
shrl $0x6, %ebp
orb %cl, %bpl
jne 0xbf3d9
movl %eax, %ebp
negl %ebp
cmovsl %eax, %ebp
movq 0x30(%r12), %rax
cmpq 0x120(%rbx), %rax
jne 0xbf32d
movq %rbx, %rdi
callq 0xdc08
movq %rax, 0x30(%r12)
movq %rbx, %rdi
movq %rax, %rsi
callq 0x89a9
movq %rax, 0x40(%r12)
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
leaq 0x1891f(%rip), %rsi     # 0xd7c5b
pushq $0x2
popq %rdx
movq %rbx, %rdi
movq %r14, %rcx
callq *0x10(%rax)
movl %ebp, %esi
movq %rbx, %rdi
callq 0x91f9
leaq 0x273b1(%rip), %rsi     # 0xe670a
leaq 0x273b4(%rip), %rcx     # 0xe6714
movq %rsp, %r14
movq %r14, %rdi
movq %rax, %rdx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0xb3a5
movq 0x30(%r12), %rcx
movq 0x8(%rcx), %rdx
movq 0x48(%rdx), %r8
movslq %eax, %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq *0x10(%r8)
movq %r12, %rdi
movq %r13, %rsi
callq 0x77c75
movzbl (%r13), %eax
leaq 0x61f9c(%rip), %rcx     # 0x121340
cmpb $0x1, (%rax,%rcx)
jne 0xbf6d5
cmpl $0x15, %eax
jne 0xbf3be
testb $0x1, 0x7(%r13)
jne 0xbf6d5
movq 0x30(%r12), %rdx
pushq $0x2
popq %rcx
movq %rbx, %rdi
movq %r13, %rsi
movq %r12, %r8
callq 0x77872
jmp 0xbf6f1
movzbl (%r13), %eax
cmpl $0x1, %eax
je 0xbf538
cmpl $0x1c, %eax
je 0xbf4ae
cmpl $0x13, %eax
jne 0xbf51a
movq 0x18(%r15), %r12
movq 0x8(%r13), %r15
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
subq %r12, %r15
jne 0xbf5f3
leaq 0x27230(%rip), %rsi     # 0xe664d
jmp 0xbf4a7
leaq 0x271f5(%rip), %r15     # 0xe661e
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
leaq 0x27369(%rip), %rsi     # 0xe67a1
pushq $0xc
popq %rdx
movq %rbx, %rdi
movq %r14, %rcx
callq *0x10(%rax)
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %r12
movq %r15, %rdi
callq 0x8d06
movq %rbx, %rdi
movq %r15, %rsi
movq %rax, %rdx
movq %r14, %rcx
callq *%r12
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
movq 0x8(%rax), %rax
pushq $0x3e
popq %rsi
movq %rbx, %rdi
movq %r14, %rdx
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *%rax
decl %eax
cmpl $0x2, %eax
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
leaq 0x27193(%rip), %rsi     # 0xe663a
pushq $0x12
jmp 0xbf8a5
cmpq 0x150(%rbx), %r13
je 0xbf51a
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
leaq 0x27271(%rip), %rsi     # 0xe6737
pushq $0x1b
popq %rdx
movq %rbx, %rdi
movq %r14, %rcx
callq *0x10(%rax)
movzbl (%r13), %eax
testq %r12, %r12
je 0xbf82f
leaq 0x61e59(%rip), %rcx     # 0x121340
cmpb $0x1, (%rax,%rcx)
jne 0xbf82f
cmpl $0x15, %eax
jne 0xbf501
testb $0x1, 0x7(%r13)
jne 0xbf82c
pushq $0x2
popq %rcx
movq %rbx, %rdi
movq %r13, %rsi
movq %r14, %rdx
movq %r12, %r8
callq 0x77872
jmp 0xbf849
cmpq $0x0, 0x18(%r15)
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
jle 0xbf599
leaq 0x27203(%rip), %rsi     # 0xe6737
pushq $0x1b
jmp 0xbf5a2
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
leaq 0x271cf(%rip), %rsi     # 0xe6716
pushq $0xf
popq %rdx
movq %rbx, %rdi
movq %r14, %rcx
callq *0x10(%rax)
movq 0x10(%r15), %rsi
movzbl (%rsi), %eax
testq %r12, %r12
je 0xbf802
leaq 0x61dd6(%rip), %rcx     # 0x121340
cmpb $0x1, (%rax,%rcx)
jne 0xbf802
cmpl $0x15, %eax
jne 0xbf583
testb $0x1, 0x7(%rsi)
jne 0xbf7ff
pushq $0x2
popq %rcx
movq %rbx, %rdi
movq %r14, %rdx
movq %r12, %r8
callq 0x77872
jmp 0xbf819
leaq 0x27176(%rip), %rsi     # 0xe6716
pushq $0xf
popq %rdx
movq %rbx, %rdi
movq %r14, %rcx
callq *%rax
movzbl (%r13), %eax
testq %r12, %r12
je 0xbf765
leaq 0x61d80(%rip), %rcx     # 0x121340
cmpb $0x1, (%rax,%rcx)
jne 0xbf765
cmpl $0x15, %eax
jne 0xbf5da
testb $0x1, 0x7(%r13)
jne 0xbf762
pushq $0x2
popq %rcx
movq %rbx, %rdi
movq %r13, %rsi
movq %r14, %rdx
movq %r12, %r8
callq 0x77872
jmp 0xbf77f
addq 0x10(%r13), %r12
leaq 0x27128(%rip), %rsi     # 0xe6726
pushq $0x10
popq %rdx
movq %rbx, %rdi
movq %r14, %rcx
callq *%rax
movq %r12, %rdi
movq %r15, %rsi
callq 0xc27f8
testb %al, %al
je 0xbf723
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rdx
movq %r15, %rcx
xorl %r8d, %r8d
callq 0xc281e
jmp 0xbf73a
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
leaq 0x27056(%rip), %rsi     # 0xe669e
jmp 0xbf6ce
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
leaq 0x27029(%rip), %rsi     # 0xe6689
jmp 0xbf6ce
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
leaq 0x27000(%rip), %rsi     # 0xe6675
pushq $0x13
jmp 0xbf8a5
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
leaq 0x27024(%rip), %rsi     # 0xe66b3
pushq $0x17
jmp 0xbf8a5
testb $0x8, 0x3(%r13)
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
jne 0xbf754
leaq 0x27039(%rip), %rsi     # 0xe66ed
pushq $0x1c
jmp 0xbf8a5
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
leaq 0x26f92(%rip), %rsi     # 0xe6660
pushq $0x14
jmp 0xbf8a5
leaq 0x61ca4(%rip), %r9      # 0x121380
movq 0x30(%r12), %rdx
pushq $0x2
popq %rcx
movq %rbx, %rdi
movq %r13, %rsi
movq %r12, %r8
callq *(%r9,%rax,8)
movq %r12, %rdi
movq %r13, %rsi
callq 0x77c75
movq 0x30(%r12), %rcx
movq 0x8(%rcx), %rax
movq 0x48(%rax), %rax
leaq 0x26e68(%rip), %rsi     # 0xe6578
pushq $0x3
popq %rdx
movq %rbx, %rdi
callq *0x10(%rax)
orb $0x40, 0x6(%r15)
jmp 0xbf7ed
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %r14, %rcx
callq *0x10(%rax)
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
leaq 0x28d54(%rip), %rsi     # 0xe84a1
pushq $0x2
jmp 0xbf8a5
leaq 0x26f70(%rip), %rsi     # 0xe66cb
pushq $0x21
jmp 0xbf8a5
pushq $0x15
popq %rax
leaq 0x61c14(%rip), %r9      # 0x121380
pushq $0x2
popq %rcx
movq %rbx, %rdi
movq %r13, %rsi
movq %r14, %rdx
movq %r12, %r8
callq *(%r9,%rax,8)
movq 0x18(%r15), %rsi
testq %rsi, %rsi
jle 0xbf819
cmpq $0x1, %rsi
jne 0xbf7ac
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
leaq 0x26fbb(%rip), %rsi     # 0xe6760
pushq $0x10
jmp 0xbf8a5
movq %rbx, %rdi
callq 0x91f9
leaq 0x26fb6(%rip), %rsi     # 0xe6771
leaq 0x26fce(%rip), %rcx     # 0xe6790
movq %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)
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x15
popq %rax
leaq 0x61b77(%rip), %r9      # 0x121380
pushq $0x2
popq %rcx
movq %rbx, %rdi
movq %r14, %rdx
movq %r12, %r8
callq *(%r9,%rax,8)
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
movq 0x8(%rax), %rax
pushq $0x29
jmp 0xbf475
pushq $0x15
popq %rax
leaq 0x61b4a(%rip), %r9      # 0x121380
pushq $0x2
popq %rcx
movq %rbx, %rdi
movq %r13, %rsi
movq %r14, %rdx
movq %r12, %r8
callq *(%r9,%rax,8)
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
leaq 0x26efb(%rip), %rsi     # 0xe6753
pushq $0x4
popq %rdx
movq %rbx, %rdi
movq %r14, %rcx
callq *0x10(%rax)
addq $0x8, %r13
leaq 0x26ee9(%rip), %r12     # 0xe6758
pushq $0x7
popq %rbp
movq (%r13), %r13
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
cmpq 0x18(%r15), %r13
je 0xbf89c
movq %rbx, %rdi
movq %r12, %rsi
movq %rbp, %rdx
movq %r14, %rcx
callq *%rax
addq $0x18, %r13
jmp 0xbf872
leaq 0x26ec8(%rip), %rsi     # 0xe676b
pushq $0x5
popq %rdx
movq %rbx, %rdi
movq %r14, %rcx
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *%rax