// File: /workspace/github_c_makefile_star2_O0/BernardTatin[P]s7sh/s7.c
// Function: g_make_iterator
static s7_pointer g_make_iterator(s7_scheme *sc, s7_pointer args)
    {
#define H_make_iterator "(make-iterator sequence carrier) returns an iterator object that returns the next value \
        in the sequence each time it is called.  When it reaches the end, it returns " ITERATOR_END_NAME "."
#define Q_make_iterator s7_make_signature(sc, 3, sc->is_iterator_symbol, sc->is_sequence_symbol, sc->is_pair_symbol)

        s7_pointer iter, seq, carrier;
        /* we need to call s7_make_iterator before fixing up the optional second arg in case let->method */

        seq = car(args);
        carrier = (is_pair(cdr(args))) ? cadr(args) : NULL;
        iter = s7_make_iterator(sc, seq);

        if (carrier)
        {
            if (!is_pair(carrier))
                return(simple_wrong_type_argument(sc, sc->make_iterator_symbol, carrier, T_PAIR));
            if (is_immutable_pair(carrier))
                return(immutable_object_error(sc, set_elist_3(sc, immutable_error_string, sc->make_iterator_symbol, carrier)));

            if (is_hash_table(iterator_sequence(iter)))
            {
                iterator_current(iter) = carrier;
                set_mark_seq(iter);
            }
            else
            {
                if ((is_let(iterator_sequence(iter))) &&
                        (iterator_sequence(iter) != sc->rootlet))
                {
                    iterator_let_cons(iter) = carrier;
                    set_mark_seq(iter);
                }
                else         /* (let-temporarily (((*s7* 'safety) 1)) (make-iterator "asdf" (cons 1 2))) */
                {
                    if (sc->safety > MORE_SAFETY_WARNINGS)
                        s7_warn(sc, 256, "(make-iterator %s %s) does not need the second argument\n", DISPLAY_80(seq), DISPLAY_80(carrier));
                }
            }
        }
        return(iter);
    }

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x48(%rsp)
movq %rsi, 0x40(%rsp)
movq 0x40(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x30(%rsp)
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rax
movzbl (%rax), %eax
cmpl $0x1, %eax
jne 0x69a81
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, 0x20(%rsp)
jmp 0x69a8a
xorl %eax, %eax
movq %rax, 0x20(%rsp)
jmp 0x69a8a
movq 0x20(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x48(%rsp), %rdi
movq 0x30(%rsp), %rsi
callq 0xdb80
movq %rax, 0x38(%rsp)
cmpq $0x0, 0x28(%rsp)
je 0x69c45
movq 0x28(%rsp), %rax
movzbl (%rax), %eax
cmpl $0x1, %eax
je 0x69afd
movq 0x48(%rsp), %rdi
movq 0x48(%rsp), %rax
movq 0x12f8(%rax), %rax
movq 0x8(%rax), %rsi
movq 0x28(%rsp), %rdx
movq 0x48(%rsp), %rax
movq 0x140(%rax), %rcx
movq 0x1b0aaa(%rip), %r8     # 0x21a598
callq 0x14a60
movq %rax, 0x50(%rsp)
jmp 0x69c4f
movq 0x28(%rsp), %rax
movq (%rax), %rax
andq $0x1000000, %rax        # imm = 0x1000000
cmpq $0x0, %rax
je 0x69b54
movq 0x48(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x48(%rsp), %rdi
movq 0x1b0971(%rip), %rsi    # 0x21a498
movq 0x48(%rsp), %rax
movq 0x12f8(%rax), %rdx
movq 0x28(%rsp), %rcx
callq 0xf240
movq 0x18(%rsp), %rdi
movq %rax, %rsi
callq 0xb800
movq %rax, 0x50(%rsp)
jmp 0x69c4f
movq 0x38(%rsp), %rax
movq 0x8(%rax), %rax
movzbl (%rax), %eax
cmpl $0x1b, %eax
jne 0x69b8a
movq 0x28(%rsp), %rcx
movq 0x38(%rsp), %rax
movq %rcx, 0x10(%rax)
movq 0x38(%rsp), %rax
movq (%rax), %rcx
orq $0x4000000, %rcx        # imm = 0x4000000
movq %rcx, (%rax)
jmp 0x69c43
movq 0x38(%rsp), %rax
movq 0x8(%rax), %rax
movzbl (%rax), %eax
cmpl $0x1c, %eax
jne 0x69bd4
movq 0x38(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x48(%rsp), %rcx
cmpq 0x150(%rcx), %rax
je 0x69bd4
movq 0x28(%rsp), %rcx
movq 0x38(%rsp), %rax
movq %rcx, 0x10(%rax)
movq 0x38(%rsp), %rax
movq (%rax), %rcx
orq $0x4000000, %rcx        # imm = 0x4000000
movq %rcx, (%rax)
jmp 0x69c41
movq 0x48(%rsp), %rax
cmpq $0x2, 0x6a0(%rax)
jle 0x69c3f
movq 0x48(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x48(%rsp), %rdi
movq 0x30(%rsp), %rsi
movl $0x50, %edx
callq 0x45d90
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
movq 0x48(%rsp), %rdi
movq 0x28(%rsp), %rsi
movl $0x50, %edx
callq 0x45d90
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rcx
movq 0x10(%rax), %r8
movl $0x100, %esi            # imm = 0x100
leaq 0x18990c(%rip), %rdx    # 0x1f3544
movb $0x0, %al
callq 0x14df0
jmp 0x69c41
jmp 0x69c43
jmp 0x69c45
movq 0x38(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0x50(%rsp), %rax
addq $0x58, %rsp
retq
nopl (%rax)