// File: /workspace/github_c_makefile_star2_O1/BernardTatin[P]s7sh/s7.c
// Function: iterator_equal_1
static bool iterator_equal_1(s7_scheme *sc, s7_pointer x, s7_pointer y, shared_info *ci, bool equivalent)
                {
                    s7_pointer x_seq, y_seq, xs, ys;

                    if (x == y) return(true);
                    if (!is_iterator(y)) return(false);

                    x_seq = iterator_sequence(x);
                    y_seq = iterator_sequence(y);

                    switch (type(x_seq))
                    {
                        case T_STRING:
                            return((is_string(y_seq)) &&
                                    (iterator_position(x) == iterator_position(y)) &&
                                    (iterator_length(x) == iterator_length(y)) &&
                                    (string_equal(sc, x_seq, y_seq, ci)));

                        case T_VECTOR: case T_INT_VECTOR: case T_BYTE_VECTOR: case T_FLOAT_VECTOR:
                            return((is_any_vector(y_seq)) &&
                                    (iterator_position(x) == iterator_position(y)) &&
                                    (iterator_length(x) == iterator_length(y)) &&
                                    ((equivalent) ? (vector_equivalent(sc, x_seq, y_seq, ci)) : (vector_equal(sc, x_seq, y_seq, ci))));

                            /* iterator_next is a function (pair_iterate, iterator_finished etc) */
                        case T_PAIR:
                            if (iterator_next(x) != iterator_next(y)) return(false);     /* even if seqs are equal, one might be at end */
                            if (equivalent)
                            {
                                if (!pair_equivalent(sc, x_seq, y_seq, ci))
                                    return(false);
                            }
                            else
                            {
                                if (!pair_equal(sc, x_seq, y_seq, ci))
                                    return(false);
                            }
                            for (xs = x_seq, ys = y_seq; is_pair(xs) && is_pair(ys); xs = cdr(xs), ys = cdr(ys))
                                if (xs == iterator_current(x))
                                    return(ys == iterator_current(y));
                            return(is_null(xs) && is_null(ys));

                        case T_NIL:                                                    /* (make-iterator #()) works, so () should too */
                            return(is_null(y_seq));   /* perhaps for equivalent case, check position in y as well as pair(seq(y))? */

                        case T_C_OBJECT:
                            if ((is_c_object(y_seq)) &&
                                    (iterator_position(x) == iterator_position(y)) &&
                                    (iterator_length(x) == iterator_length(y)))
                            {
                                if (equivalent)
                                    return(c_object_equivalent(sc, x_seq, y_seq, ci));
                                return(c_objects_are_equal(sc, x_seq, y_seq, ci));
                            }
                            return(false);

                        case T_LET:
                            if (!is_let(y_seq)) return(false);
                            if (iterator_next(x) != iterator_next(y)) return(false);
                            if (x_seq == sc->rootlet)
                                return(iterator_position(x) == iterator_position(y)); /* y_seq must also be sc->rootlet since nexts are the same (rootlet_iterate) */
                            if (equivalent)
                            {
                                if (!let_equivalent(sc, x_seq, y_seq, ci))
                                    return(false);
                            }
                            else
                            {
                                if (!let_equal(sc, x_seq, y_seq, ci))
                                    return(false);
                            }
                            for (xs = let_slots(x_seq), ys = let_slots(y_seq); tis_slot(xs) && tis_slot(ys); xs = next_slot(xs), ys = next_slot(ys))
                                if (xs == iterator_current_slot(x))
                                    return(ys == iterator_current_slot(y));
                            return(is_slot_end(xs) && is_slot_end(ys));

                        case T_HASH_TABLE:
                            if (!is_hash_table(y_seq)) return(false);
                            if (hash_table_entries(x_seq) != hash_table_entries(y_seq)) return(false);
                            if (hash_table_entries(x_seq) == 0) return(true);
                            if (iterator_position(x) != iterator_position(y)) return(false);
                            if (!equivalent)
                                return(hash_table_equal(sc, x_seq, y_seq, ci));
                            return(hash_table_equivalent(sc, x_seq, y_seq, ci));

                        case T_CLOSURE: case T_CLOSURE_STAR:
                            return(x_seq == y_seq); /* or closure_equal/equivalent? */

                        default:
                            break;
                    }
                    return(false);
                }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movb $0x1, %bpl
cmpq %rdx, %rsi
je 0x101242
movq %rdx, %r15
cmpb $0x1d, (%rdx)
jne 0x101240
movq %rsi, %r12
movq %rdi, %r13
movq 0x8(%rsi), %r14
movq 0x8(%r15), %rbx
movzbl (%r14), %eax
xorl %ebp, %ebp
leal -0x13(%rax), %edx
cmpl $0x16, %edx
ja 0x101089
leaq 0x10ceb(%rip), %rax     # 0x111d14
movslq (%rax,%rdx,4), %rdx
addq %rax, %rdx
jmpq *%rdx
movzbl (%rbx), %eax
leaq 0x51be4(%rip), %rdx     # 0x152c20
cmpb $0x1, (%rax,%rdx)
jne 0x101240
movq 0x18(%r12), %rax
cmpq 0x18(%r15), %rax
jne 0x101240
movq 0x20(%r12), %rax
cmpq 0x20(%r15), %rax
jne 0x101240
movq %r13, %rdi
movq %r14, %rsi
movq %rbx, %rdx
addq $0x8, %rsp
testb %r8b, %r8b
je 0x101208
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x100808
cmpl $0x1, %eax
je 0x1011e8
cmpl $0x2, %eax
jne 0x101242
cmpq 0x110(%r13), %rbx
jmp 0x1010a7
cmpq %rbx, %r14
sete %bpl
jmp 0x101242
cmpb $0x1b, (%rbx)
jne 0x101240
movq 0x28(%r14), %rax
movq 0x18(%rax), %rax
movq 0x28(%rbx), %rdx
cmpq 0x18(%rdx), %rax
jne 0x101240
movb $0x1, %bpl
testq %rax, %rax
je 0x101242
movq 0x18(%r12), %rax
cmpq 0x18(%r15), %rax
jne 0x101240
movq %r13, %rdi
movq %r14, %rsi
movq %rbx, %rdx
testb %r8b, %r8b
je 0x1012f7
movl $0x1, %r8d
jmp 0x1012fa
cmpb $0x13, (%rbx)
jne 0x101240
movq 0x18(%r12), %rax
cmpq 0x18(%r15), %rax
jne 0x101240
movq 0x20(%r12), %rax
cmpq 0x20(%r15), %rax
jne 0x101240
movq 0x8(%r14), %rdx
cmpq 0x8(%rbx), %rdx
jne 0x101240
movq 0x10(%r14), %rdi
movq 0x10(%rbx), %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x9253a
cmpb $0x1c, (%rbx)
jne 0x101240
movq 0x28(%r12), %rax
cmpq 0x28(%r15), %rax
jne 0x101240
cmpq 0x150(%r13), %r14
je 0x10126c
testb %r8b, %r8b
je 0x101289
movq %r13, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x100111
testb %al, %al
je 0x101240
jmp 0x1012a5
cmpb $0x14, (%rbx)
jne 0x101240
movq 0x18(%r12), %rax
cmpq 0x18(%r15), %rax
jne 0x101240
movq 0x20(%r12), %rax
cmpq 0x20(%r15), %rax
jne 0x101240
movq %r13, %rdi
movq %r14, %rsi
movq %rbx, %rdx
addq $0x8, %rsp
testb %r8b, %r8b
je 0x10127a
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xffdbc
movq 0x28(%r12), %rax
cmpq 0x28(%r15), %rax
jne 0x101240
movq %r13, %rdi
movq %r14, %rsi
movq %rbx, %rdx
testb %r8b, %r8b
je 0x101217
callq 0x100332
jmp 0x10121c
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xff7c7
callq 0xff40a
testb %al, %al
je 0x101240
cmpb $0x1, (%r14)
jne 0x101257
cmpb $0x1, (%rbx)
jne 0x101257
cmpq 0x10(%r12), %r14
je 0x10130a
movq 0x10(%r14), %r14
movq 0x10(%rbx), %rbx
jmp 0x101220
xorl %ebp, %ebp
andb $0x1, %bpl
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x110(%r13), %rax
xorq %rax, %r14
xorq %rax, %rbx
orq %r14, %rbx
jmp 0x1010a7
movq 0x18(%r12), %rax
cmpq 0x18(%r15), %rax
jmp 0x1010a7
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xff099
cmpq %rbx, %r14
je 0x1012a5
xorl %ebp, %ebp
movq %r13, %rdi
movq %r14, %rsi
movq %rbx, %rdx
xorl %r8d, %r8d
callq 0x101788
testb %al, %al
je 0x101242
movq 0x8(%rbx), %rax
movq 0x8(%r14), %rcx
testq %rcx, %rcx
setne %bpl
testq %rax, %rax
setne %dl
movl %ebp, %esi
andb %dl, %sil
cmpb $0x1, %sil
jne 0x1012eb
movq 0x18(%r12), %rsi
cmpq %rsi, %rcx
je 0x101271
movq 0x18(%rax), %rax
movq 0x18(%rcx), %rcx
testq %rax, %rax
setne %dl
testq %rcx, %rcx
setne %bpl
je 0x1012eb
testq %rax, %rax
jne 0x1012ca
orb %dl, %bpl
xorb $0x1, %bpl
jmp 0x101242
xorl %r8d, %r8d
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x101313
cmpq 0x10(%r15), %rbx
jmp 0x1010a7