// File: /workspace/github_c_makefile_star2_O3/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 0xf05f7
movq (%r15), %rcx
movq 0x8(%r15), %r13
testl %ecx, %ecx
js 0xf0615
movzbl (%r13), %eax
leal -0x13(%rax), %ecx
cmpl $0x9, %ecx
ja 0xf06ec
leaq 0x1874b(%rip), %rax     # 0x108d28
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
jmp 0xf090b
movq 0x8(%r15), %rsi
cmpb $0x1b, (%rsi)
jne 0xf0606
testb $0x8, 0x3(%rsi)
jne 0xf0667
movq %rbx, %rdi
xorl %edx, %edx
callq 0x9c349
movq %rax, %r15
jmp 0xf066e
movq %r8, %r12
testq %r8, %r8
je 0xf08cf
movq %rcx, %rax
shrq $0x30, %rax
testb $0x20, %al
sete %dl
btl $0x11, %ecx
setae %cl
orb %dl, %cl
jne 0xf08cf
movslq 0xc(%r12), %rdx
testq %rdx, %rdx
jle 0xf08cf
movq (%r12), %rsi
xorl %ecx, %ecx
cmpq %r15, (%rsi,%rcx,8)
je 0xf07b5
incq %rcx
cmpq %rcx, %rdx
jne 0xf0650
jmp 0xf08cf
leaq 0x2a010(%rip), %r15     # 0x11a67e
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
leaq 0x2a184(%rip), %rsi     # 0x11a801
movl $0xc, %edx
movq %rbx, %rdi
movq %r14, %rcx
callq *0x10(%rax)
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
testq %r15, %r15
je 0xf06b5
cmpb $0x0, (%r15)
je 0xf06b5
xorl %ecx, %ecx
leaq 0x1(%rcx), %rdx
cmpb $0x0, 0x1(%r15,%rcx)
movq %rdx, %rcx
jne 0xf06a4
jmp 0xf06b7
xorl %edx, %edx
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rcx
callq *%rax
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
movq 0x8(%rax), %rax
movq %rbx, %rdi
movl $0x3e, %esi
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 0x29f96(%rip), %rsi     # 0x11a69a
jmp 0xf0912
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
leaq 0x29fe2(%rip), %rsi     # 0x11a6fe
jmp 0xf07ab
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
leaq 0x29fb5(%rip), %rsi     # 0x11a6e9
jmp 0xf07ab
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
leaq 0x29f8c(%rip), %rsi     # 0x11a6d5
movl $0x13, %edx
jmp 0xf0ca7
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
leaq 0x29fad(%rip), %rsi     # 0x11a713
movl $0x17, %edx
jmp 0xf0ca7
testb $0x8, 0x3(%r13)
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
jne 0xf0c6d
leaq 0x29fbf(%rip), %rsi     # 0x11a74d
movl $0x1c, %edx
jmp 0xf0ca7
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
leaq 0x29f15(%rip), %rsi     # 0x11a6c0
movl $0x14, %edx
jmp 0xf0ca7
testb $0x40, %al
jne 0xf08cf
movq 0x20(%r12), %rax
movl (%rax,%rcx,4), %eax
testl %eax, %eax
je 0xf08cf
movl %eax, %ebp
negl %ebp
cmovsl %eax, %ebp
movq 0x30(%r12), %rax
cmpq 0x120(%rbx), %rax
jne 0xf07ff
movq %rbx, %rdi
callq 0xf75a
movq %rax, 0x30(%r12)
movq %rbx, %rdi
movq %rax, %rsi
callq 0x8b1e
movq %rax, 0x40(%r12)
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
leaq 0x1b4ad(%rip), %rsi     # 0x10bcbb
movl $0x2, %edx
movq %rbx, %rdi
movq %r14, %rcx
callq *0x10(%rax)
movl %ebp, %esi
leaq 0xb6f(%rbx), %r8
movb $0x0, 0xb6f(%rbx)
leaq 0x25d0d(%rip), %rcx     # 0x116540
movabsq $-0x3333333333333333, %rdi # imm = 0xCCCCCCCCCCCCCCCD
movq %rsi, %rax
mulq %rdi
shrq $0x3, %rdx
leaq (%rdx,%rdx), %rax
leaq (%rax,%rax,4), %rax
movq %rsi, %r9
subq %rax, %r9
movb (%rcx,%r9), %al
movb %al, -0x1(%r8)
decq %r8
cmpq $0x9, %rsi
movq %rdx, %rsi
ja 0xf083d
leaq 0x29efa(%rip), %rsi     # 0x11a76a
leaq 0x29efd(%rip), %rcx     # 0x11a774
movq %rsp, %r14
movq %r14, %rdi
movq %r8, %rdx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0xc442
movq 0x30(%r12), %rcx
movq 0x8(%rcx), %rdx
movq 0x48(%rdx), %r8
movslq %eax, %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq *0x10(%r8)
movslq 0xc(%r12), %rax
testq %rax, %rax
jle 0xf0cc8
movq (%r12), %rdx
xorl %ecx, %ecx
cmpq %r13, (%rdx,%rcx,8)
je 0xf0cc0
incq %rcx
cmpq %rcx, %rax
jne 0xf08b8
jmp 0xf0cc8
movzbl (%r13), %eax
cmpl $0x1, %eax
je 0xf09b9
cmpl $0x1c, %eax
je 0xf091c
cmpl $0x13, %eax
jne 0xf0991
movq 0x8(%r13), %rbp
movq 0x18(%r15), %r12
movq %rbp, %r15
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
subq %r12, %r15
jne 0xf0aee
leaq 0x29d9b(%rip), %rsi     # 0x11a6ad
movl $0x12, %edx
jmp 0xf0ca7
cmpq 0x150(%rbx), %r13
je 0xf0991
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
leaq 0x29e63(%rip), %rsi     # 0x11a797
movl $0x1b, %edx
movq %rbx, %rdi
movq %r14, %rcx
callq *0x10(%rax)
movzbl (%r13), %eax
testq %r12, %r12
je 0xf0b4c
leaq 0x619e9(%rip), %rcx     # 0x152340
cmpb $0x1, (%rax,%rcx)
jne 0xf0b4c
cmpl $0x15, %eax
jne 0xf0976
movl $0x15, %eax
testb $0x1, 0x7(%r13)
jne 0xf0b4c
movq %rbx, %rdi
movq %r13, %rsi
movq %r14, %rdx
movl $0x2, %ecx
movq %r12, %r8
callq 0x9596b
jmp 0xf0b68
cmpq $0x0, 0x18(%r15)
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
jle 0xf0a35
leaq 0x29de8(%rip), %rsi     # 0x11a797
movl $0x1b, %edx
jmp 0xf0a41
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
leaq 0x29dae(%rip), %rsi     # 0x11a776
movl $0xf, %edx
movq %rbx, %rdi
movq %r14, %rcx
callq *0x10(%rax)
movq 0x10(%r15), %rsi
movzbl (%rsi), %eax
testq %r12, %r12
je 0xf0a17
leaq 0x61957(%rip), %rcx     # 0x152340
cmpb $0x1, (%rax,%rcx)
jne 0xf0a17
cmpl $0x15, %eax
jne 0xf09ff
movl $0x15, %eax
testb $0x1, 0x7(%rsi)
jne 0xf0a17
movq %rbx, %rdi
movq %r14, %rdx
movl $0x2, %ecx
movq %r12, %r8
callq 0x9596b
jmp 0xf0ad5
leaq 0x61962(%rip), %r9      # 0x152380
movq %rbx, %rdi
movq %r14, %rdx
movl $0x2, %ecx
movq %r12, %r8
callq *(%r9,%rax,8)
jmp 0xf0ad5
leaq 0x29d3a(%rip), %rsi     # 0x11a776
movl $0xf, %edx
movq %rbx, %rdi
movq %r14, %rcx
callq *%rax
movzbl (%r13), %eax
testq %r12, %r12
je 0xf0a89
leaq 0x618e6(%rip), %rcx     # 0x152340
cmpb $0x1, (%rax,%rcx)
jne 0xf0a89
cmpl $0x15, %eax
jne 0xf0a71
movl $0x15, %eax
testb $0x1, 0x7(%r13)
jne 0xf0a89
movq %rbx, %rdi
movq %r13, %rsi
movq %r14, %rdx
movl $0x2, %ecx
movq %r12, %r8
callq 0x9596b
jmp 0xf0aa5
leaq 0x618f0(%rip), %r9      # 0x152380
movq %rbx, %rdi
movq %r13, %rsi
movq %r14, %rdx
movl $0x2, %ecx
movq %r12, %r8
callq *(%r9,%rax,8)
movq 0x18(%r15), %rsi
testq %rsi, %rsi
jle 0xf0ad5
cmpq $0x1, %rsi
jne 0xf0bd6
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
leaq 0x29cf5(%rip), %rsi     # 0x11a7c0
movl $0x10, %edx
jmp 0xf0ca7
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
movq 0x8(%rax), %rax
movq %rbx, %rdi
movl $0x29, %esi
jmp 0xf06d6
movq 0x10(%r13), %r13
addq %r13, %r12
leaq 0x29c8a(%rip), %rsi     # 0x11a786
movl $0x10, %edx
movq %rbx, %rdi
movq %r14, %rcx
callq *%rax
testq %r15, %r15
jle 0xf0b30
addq %rbp, %r13
leaq 0x65248(%rip), %rax     # 0x155d60
movq %r12, %rcx
movzbl (%rcx), %edx
cmpb $0x0, (%rdx,%rax)
jne 0xf0c7b
incq %rcx
cmpq %r13, %rcx
jb 0xf0b1b
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %r14, %rcx
callq *0x10(%rax)
jmp 0xf0c8f
leaq 0x6182d(%rip), %r9      # 0x152380
movq %rbx, %rdi
movq %r13, %rsi
movq %r14, %rdx
movl $0x2, %ecx
movq %r12, %r8
callq *(%r9,%rax,8)
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
leaq 0x29c3c(%rip), %rsi     # 0x11a7b3
movl $0x4, %edx
movq %rbx, %rdi
movq %r14, %rcx
callq *0x10(%rax)
movq 0x8(%r13), %r13
cmpq 0x18(%r15), %r13
je 0xf0bb9
leaq 0x29c22(%rip), %r12     # 0x11a7b8
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
movl $0x7, %edx
movq %rbx, %rdi
movq %r12, %rsi
movq %r14, %rcx
callq *0x10(%rax)
movq 0x18(%r13), %r13
cmpq 0x18(%r15), %r13
jne 0xf0b96
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
leaq 0x29bff(%rip), %rsi     # 0x11a7cb
movl $0x5, %edx
jmp 0xf0ca7
leaq 0xb6f(%rbx), %r8
movb $0x0, 0xb6f(%rbx)
leaq 0x25955(%rip), %rcx     # 0x116540
movabsq $0x6666666666666667, %rdi # imm = 0x6666666666666667
movq %rsi, %rax
imulq %rdi
movq %rdx, %rax
shrq $0x3f, %rax
sarq $0x2, %rdx
addq %rax, %rdx
leaq (%rdx,%rdx), %rax
leaq (%rax,%rax,4), %rax
movq %rsi, %r9
subq %rax, %r9
movb (%rcx,%r9), %al
movb %al, -0x1(%r8)
decq %r8
addq $0x9, %rsi
cmpq $0x12, %rsi
movq %rdx, %rsi
ja 0xf0bf5
leaq 0x29b9b(%rip), %rsi     # 0x11a7d1
leaq 0x29bb3(%rip), %rcx     # 0x11a7f0
movq %rsp, %r15
movq %r15, %rdi
movq %r8, %rdx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0xc442
movq 0x8(%r14), %rcx
movq 0x48(%rcx), %r8
movslq %eax, %rdx
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rcx
callq *0x10(%r8)
jmp 0xf0d6a
leaq 0x29ab7(%rip), %rsi     # 0x11a72b
movl $0x21, %edx
jmp 0xf0ca7
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rdx
movq %r15, %rcx
xorl %r8d, %r8d
callq 0xf492d
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
leaq 0x2b85f(%rip), %rsi     # 0x11c501
movl $0x2, %edx
movq %rbx, %rdi
movq %r14, %rcx
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *%rax
movq 0x20(%r12), %rax
negl (%rax,%rcx,4)
movzbl (%r13), %eax
leaq 0x6166c(%rip), %rcx     # 0x152340
cmpb $0x1, (%rax,%rcx)
jne 0xf0d00
cmpl $0x15, %eax
jne 0xf0ce6
testb $0x1, 0x7(%r13)
jne 0xf0d00
movq 0x30(%r12), %rdx
movq %rbx, %rdi
movq %r13, %rsi
movl $0x2, %ecx
movq %r12, %r8
callq 0x9596b
jmp 0xf0d1e
leaq 0x61679(%rip), %r9      # 0x152380
movq 0x30(%r12), %rdx
movq %rbx, %rdi
movq %r13, %rsi
movl $0x2, %ecx
movq %r12, %r8
callq *(%r9,%rax,8)
movslq 0xc(%r12), %rax
testq %rax, %rax
jle 0xf0d46
movq (%r12), %rdx
xorl %ecx, %ecx
cmpq %r13, (%rdx,%rcx,8)
je 0xf0d3e
incq %rcx
cmpq %rcx, %rax
jne 0xf0d2e
jmp 0xf0d46
movq 0x20(%r12), %rax
negl (%rax,%rcx,4)
movq 0x30(%r12), %rcx
movq 0x8(%rcx), %rax
movq 0x48(%rax), %rax
leaq 0x2987e(%rip), %rsi     # 0x11a5d8
movl $0x3, %edx
movq %rbx, %rdi
callq *0x10(%rax)
orb $0x40, 0x6(%r15)
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq