// File: /workspace/github_c_makefile_star2_O1/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 $0x98, %rsp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
cmpl $0x2, %ecx
jne 0xf940b
movq (%r15), %rdx
movq 0x8(%r15), %r13
testl %edx, %edx
js 0xf9429
movzbl (%r13), %eax
leal -0x13(%rax), %ecx
cmpl $0x9, %ecx
ja 0xf954d
leaq 0x188c8(%rip), %rax     # 0x111cbc
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
jmp 0xf947e
movq 0x8(%r15), %rsi
cmpb $0x1b, (%rsi)
jne 0xf941a
testb $0x8, 0x3(%rsi)
jne 0xf948a
movq %rbx, %rdi
xorl %edx, %edx
callq 0xa2d68
movq %rax, %r15
jmp 0xf9491
movq %r8, %r12
testq %r8, %r8
je 0xf943e
movzwl 0x6(%r15), %eax
testb $0x20, %al
jne 0xf9514
movzbl (%r13), %eax
cmpl $0x1, %eax
je 0xf9606
cmpl $0x1c, %eax
je 0xf956f
cmpl $0x13, %eax
jne 0xf95de
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 0xf9737
leaq 0x2a118(%rip), %rsi     # 0x12359d
jmp 0xf9565
leaq 0x2a0dd(%rip), %r15     # 0x12356e
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
leaq 0x2a251(%rip), %rsi     # 0x1236f1
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 0xf94dd
cmpb $0x0, (%r15)
je 0xf94dd
movq $-0x1, %rcx
leaq 0x1(%rcx), %rdx
cmpb $0x0, 0x1(%r15,%rcx)
movq %rdx, %rcx
jne 0xf94cc
jmp 0xf94df
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 $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *%rax
xorl %ecx, %ecx
btl $0x11, %edx
jae 0xf99e8
movslq 0xc(%r12), %rdx
testq %rdx, %rdx
jle 0xf99e8
movq (%r12), %rsi
xorl %ecx, %ecx
cmpq %r15, (%rsi,%rcx,8)
je 0xf99e0
incq %rcx
cmpq %rcx, %rdx
jne 0xf9534
xorl %ecx, %ecx
jmp 0xf99e8
decl %eax
cmpl $0x2, %eax
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
leaq 0x2a025(%rip), %rsi     # 0x12358a
movl $0x12, %edx
jmp 0xf99c7
cmpq 0x150(%rbx), %r13
je 0xf95de
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
leaq 0x2a100(%rip), %rsi     # 0x123687
movl $0x1b, %edx
movq %rbx, %rdi
movq %r14, %rcx
callq *0x10(%rax)
testq %r12, %r12
je 0xf9862
movzbl (%r13), %eax
leaq 0x60d96(%rip), %rcx     # 0x15a340
cmpb $0x1, (%rax,%rcx)
jne 0xf9862
cmpb $0x15, %al
jne 0xf95c3
testb $0x1, 0x7(%r13)
jne 0xf9862
movq %rbx, %rdi
movq %r13, %rsi
movq %r14, %rdx
movl $0x2, %ecx
movq %r12, %r8
callq 0x9c033
jmp 0xf9883
cmpq $0x0, 0x18(%r15)
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
jle 0xf967f
leaq 0x2a08b(%rip), %rsi     # 0x123687
movl $0x1b, %edx
jmp 0xf968b
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
leaq 0x2a051(%rip), %rsi     # 0x123666
movl $0xf, %edx
movq %rbx, %rdi
movq %r14, %rcx
callq *0x10(%rax)
movq 0x10(%r15), %rsi
testq %r12, %r12
je 0xf965e
movzbl (%rsi), %eax
leaq 0x60d0a(%rip), %rcx     # 0x15a340
cmpb $0x1, (%rax,%rcx)
jne 0xf965e
cmpb $0x15, %al
jne 0xf9646
testb $0x1, 0x7(%rsi)
jne 0xf965e
movq %rbx, %rdi
movq %r14, %rdx
movl $0x2, %ecx
movq %r12, %r8
callq 0x9c033
jmp 0xf971e
movzbl (%rsi), %eax
leaq 0x60d18(%rip), %r9      # 0x15a380
movq %rbx, %rdi
movq %r14, %rdx
movl $0x2, %ecx
movq %r12, %r8
callq *(%r9,%rax,8)
jmp 0xf971e
leaq 0x29fe0(%rip), %rsi     # 0x123666
movl $0xf, %edx
movq %rbx, %rdi
movq %r14, %rcx
callq *%rax
testq %r12, %r12
je 0xf96cd
movzbl (%r13), %eax
leaq 0x60c9c(%rip), %rcx     # 0x15a340
cmpb $0x1, (%rax,%rcx)
jne 0xf96cd
cmpb $0x15, %al
jne 0xf96b5
testb $0x1, 0x7(%r13)
jne 0xf96cd
movq %rbx, %rdi
movq %r13, %rsi
movq %r14, %rdx
movl $0x2, %ecx
movq %r12, %r8
callq 0x9c033
jmp 0xf96ee
movzbl (%r13), %eax
leaq 0x60ca7(%rip), %r9      # 0x15a380
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 0xf971e
cmpq $0x1, %rsi
jne 0xf98f1
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
leaq 0x29f9c(%rip), %rsi     # 0x1236b0
movl $0x10, %edx
jmp 0xf99c7
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
movq 0x8(%rax), %rax
movq %rbx, %rdi
movl $0x29, %esi
jmp 0xf94fe
movq 0x10(%r13), %rcx
movq %rcx, 0x8(%rsp)
leaq (%rcx,%r12), %r13
leaq 0x29f2b(%rip), %rsi     # 0x123676
movl $0x10, %edx
movq %rbx, %rdi
movq %r14, %rcx
callq *%rax
testq %r15, %r15
setg %al
jle 0xf9795
movzbl (%r13), %edx
leaq 0x645f4(%rip), %rcx     # 0x15dd60
cmpb $0x0, (%rdx,%rcx)
jne 0xf9795
movq 0x8(%rsp), %rax
addq %rax, %rbp
leaq (%r12,%rax), %rdi
incq %rdi
cmpq %rbp, %rdi
setb %al
jae 0xf9795
movzbl (%rdi), %esi
incq %rdi
cmpb $0x1, (%rsi,%rcx)
jne 0xf9781
testb %al, %al
je 0xf998a
movq %rbx, %rdi
movq %r14, %rsi
movq %r13, %rdx
movq %r15, %rcx
xorl %r8d, %r8d
callq 0xfd6c4
jmp 0xf99a1
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
leaq 0x29e25(%rip), %rsi     # 0x1235ee
jmp 0xf9858
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
leaq 0x29df8(%rip), %rsi     # 0x1235d9
jmp 0xf9858
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
leaq 0x29dcf(%rip), %rsi     # 0x1235c5
movl $0x13, %edx
jmp 0xf99c7
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
leaq 0x29df0(%rip), %rsi     # 0x123603
movl $0x17, %edx
jmp 0xf99c7
testb $0x8, 0x3(%r13)
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
jne 0xf99bb
leaq 0x29e02(%rip), %rsi     # 0x12363d
movl $0x1c, %edx
jmp 0xf99c7
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
leaq 0x29d58(%rip), %rsi     # 0x1235b0
movl $0x14, %edx
jmp 0xf99c7
movzbl (%r13), %eax
leaq 0x60b12(%rip), %r9      # 0x15a380
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 0x29e11(%rip), %rsi     # 0x1236a3
movl $0x4, %edx
movq %rbx, %rdi
movq %r14, %rcx
callq *0x10(%rax)
movq 0x8(%r13), %r13
cmpq 0x18(%r15), %r13
je 0xf98d4
leaq 0x29df7(%rip), %r12     # 0x1236a8
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 0xf98b1
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
leaq 0x29dd4(%rip), %rsi     # 0x1236bb
movl $0x5, %edx
jmp 0xf99c7
leaq 0xb6f(%rbx), %r8
movb $0x0, 0xb6f(%rbx)
leaq 0x25b2a(%rip), %rcx     # 0x11f430
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 0xf9910
leaq 0x29d70(%rip), %rsi     # 0x1236c1
leaq 0x29d88(%rip), %rcx     # 0x1236e0
leaq 0x10(%rsp), %r15
movq %r15, %rdi
movq %r8, %rdx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0xd1cb
movq 0x8(%r14), %rcx
movq 0x48(%rcx), %r8
movslq %eax, %rdx
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rcx
callq *0x10(%r8)
jmp 0xf9b9b
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
movq %rbx, %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %r14, %rcx
callq *0x10(%rax)
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
leaq 0x2ba3d(%rip), %rsi     # 0x1253f1
movl $0x2, %edx
jmp 0xf99c7
leaq 0x29c59(%rip), %rsi     # 0x12361b
movl $0x21, %edx
movq %rbx, %rdi
movq %r14, %rcx
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *%rax
movq 0x20(%r12), %rdx
movl (%rdx,%rcx,4), %ecx
testb $0x40, %al
jne 0xf943e
testl %ecx, %ecx
je 0xf943e
movl %ecx, %ebp
negl %ebp
cmovsl %ecx, %ebp
movq 0x30(%r12), %rax
cmpq 0x120(%rbx), %rax
jne 0xf9a2a
movq %rbx, %rdi
callq 0x1055d
movq %rax, 0x30(%r12)
movq %rbx, %rdi
movq %rax, %rsi
callq 0x9b10
movq %rax, 0x40(%r12)
movq 0x8(%r14), %rax
movq 0x48(%rax), %rax
leaq 0x1b172(%rip), %rsi     # 0x114bab
movl $0x2, %edx
movq %rbx, %rdi
movq %r14, %rcx
callq *0x10(%rax)
movl %ebp, %esi
leaq 0xb6f(%rbx), %r8
movb $0x0, 0xb6f(%rbx)
leaq 0x259d2(%rip), %rcx     # 0x11f430
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 0xf9a68
leaq 0x29bbf(%rip), %rsi     # 0x12365a
leaq 0x29bc2(%rip), %rcx     # 0x123664
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %r8, %rdx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0xd1cb
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 0xf9af9
movq (%r12), %rdx
xorl %ecx, %ecx
cmpq %r13, (%rdx,%rcx,8)
je 0xf9af1
incq %rcx
cmpq %rcx, %rax
jne 0xf9ae1
jmp 0xf9af9
movq 0x20(%r12), %rax
negl (%rax,%rcx,4)
movzbl (%r13), %eax
leaq 0x6083b(%rip), %rcx     # 0x15a340
cmpb $0x1, (%rax,%rcx)
jne 0xf9b31
cmpl $0x15, %eax
jne 0xf9b17
testb $0x1, 0x7(%r13)
jne 0xf9b31
movq 0x30(%r12), %rdx
movq %rbx, %rdi
movq %r13, %rsi
movl $0x2, %ecx
movq %r12, %r8
callq 0x9c033
jmp 0xf9b4f
leaq 0x60848(%rip), %r9      # 0x15a380
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 0xf9b77
movq (%r12), %rdx
xorl %ecx, %ecx
cmpq %r13, (%rdx,%rcx,8)
je 0xf9b6f
incq %rcx
cmpq %rcx, %rax
jne 0xf9b5f
jmp 0xf9b77
movq 0x20(%r12), %rax
negl (%rax,%rcx,4)
movq 0x30(%r12), %rcx
movq 0x8(%rcx), %rax
movq 0x48(%rax), %rax
leaq 0x2993d(%rip), %rsi     # 0x1234c8
movl $0x3, %edx
movq %rbx, %rdi
callq *0x10(%rax)
orb $0x40, 0x6(%r15)
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq