// File: /workspace/github_c_makefile_star2_O3/WojciechMula[P]pyahocorasick/src/Automaton.c
// Function: automaton_iter
static PyObject*
automaton_iter(PyObject* self, PyObject* args, PyObject* keywds) {
#define automaton ((Automaton*)self)
    static char *kwlist[] = {"string", "start", "end", "ignore_white_space", NULL};

    PyObject* object;
    Py_ssize_t start, start_tmp = -1;
    Py_ssize_t end, end_tmp = -1;
    int ignore_white_space_tmp = -1;
    bool ignore_white_space = false;

    if (automaton->kind != AHOCORASICK) {
        PyErr_SetString(PyExc_AttributeError,"Not an Aho-Corasick automaton yet: "
            "call add_word to add some keys and call make_automaton to "
            "convert the trie to an automaton.");
        return NULL;
    }

    if (!F(PyArg_ParseTupleAndKeywords)(args, keywds, "O|iii", kwlist, &object, &start_tmp, &end_tmp, &ignore_white_space_tmp)) {
        return NULL;
    }

    if (ignore_white_space_tmp == 1) {
        ignore_white_space = true;
    }

    if (object) {
        if (automaton->key_type == KEY_STRING) {
#ifdef PY3K
    #ifdef AHOCORASICK_UNICODE
        if (F(PyUnicode_Check)(object)) {
            start   = 0;
            #if PY_MINOR_VERSION >= 3
                end = PyUnicode_GET_LENGTH(object);
            #else
                end = PyUnicode_GET_SIZE(object);
            #endif
        }
        else {
            PyErr_SetString(PyExc_TypeError, "string required");
            return NULL;
        }
    #else
        if (F(PyBytes_Check)(object)) {
            start   = 0;
            end     = PyBytes_GET_SIZE(object);
        }
        else {
            PyErr_SetString(PyExc_TypeError, "bytes required");
            return NULL;
        }
    #endif
#else
        if (F(PyString_Check)(object)) {
            start   = 0;
            end     = PyString_GET_SIZE(object);
        } else {
            PyErr_SetString(PyExc_TypeError, "string required");
            return NULL;
        }
#endif
        }
        else {
        if (F(PyTuple_Check)(object)) {
            start = 0;
            end = PyTuple_GET_SIZE(object);
        } else {
            PyErr_SetString(PyExc_TypeError, "tuple required");
            return NULL;
        }
        }
    }
    else
        return NULL;

    if (start_tmp != -1) {
        start = start_tmp;
    }

    if (end_tmp != -1) {
        end = end_tmp;
    }

    return automaton_search_iter_new(
        automaton,
        object,
        (int)start,
        (int)end,
        ignore_white_space
    );
#undef automaton
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq $-0x1, %rax
movq %rax, 0x18(%rsp)
movq %rax, 0x10(%rsp)
movl $0xffffffff, 0xc(%rsp)  # imm = 0xFFFFFFFF
cmpl $0x2, 0x10(%rdi)
jne 0x6b2e
movq %rdi, %r14
leaq 0xc(%rsp), %r10
leaq 0x10(%rsp), %r11
leaq 0x4e25(%rip), %rax      # 0xb8eb
leaq 0x9db3(%rip), %rcx      # 0x10880
xorl %ebx, %ebx
leaq 0x20(%rsp), %r8
leaq 0x18(%rsp), %r9
movq %rsi, %rdi
movq %rdx, %rsi
movq %rax, %rdx
xorl %eax, %eax
pushq %r10
pushq %r11
callq 0x3270
addq $0x10, %rsp
testl %eax, %eax
je 0x6b46
movq 0x20(%rsp), %r15
testq %r15, %r15
je 0x6b44
movl 0xc(%rsp), %ebp
cmpl $0x64, 0x18(%r14)
movq 0x8(%r15), %rax
movq 0xa8(%rax), %rax
jne 0x6b58
btl $0x1c, %eax
jb 0x6b71
movq 0x946e(%rip), %rax      # 0xff90
movq (%rax), %rdi
leaq 0x4e1d(%rip), %rsi      # 0xb949
jmp 0x6b3f
movq 0x94a3(%rip), %rax      # 0xffd8
movq (%rax), %rdi
leaq 0x4d2d(%rip), %rsi      # 0xb86c
callq 0x3120
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
btl $0x1a, %eax
jb 0x6b7c
movq 0x942b(%rip), %rax      # 0xff90
movq (%rax), %rdi
leaq 0x4dea(%rip), %rsi      # 0xb959
jmp 0x6b3f
testb $-0x80, 0x20(%r15)
je 0x6c1c
movq 0x10(%rsp), %r12
cmpq $-0x1, %r12
jne 0x6b8b
movq 0x10(%r15), %r12
movq 0x18(%rsp), %r13
leaq 0x9d11(%rip), %rdi      # 0x108a8
callq 0x32b0
testq %rax, %rax
je 0x6b44
movq %rax, %rbx
xorl %eax, %eax
cmpl $0x1, %ebp
movq %r14, 0x10(%rbx)
movl 0x30(%r14), %ecx
movl %ecx, 0x18(%rbx)
movq 0x28(%r14), %rcx
movq %rcx, 0x40(%rbx)
movq %rax, 0x48(%rbx)
movq %rax, 0x58(%rbx)
sete 0x68(%rbx)
movq %rbx, %rdx
addq $0x20, %rdx
xorps %xmm0, %xmm0
movups %xmm0, 0x28(%rbx)
incq (%r14)
movq %r14, %rdi
movq %r15, %rsi
callq 0x45cd
testb %al, %al
je 0x6c06
leal -0x1(%r13), %eax
cmpq $-0x1, %r13
cltq
cmoveq %r13, %rax
movq %rax, 0x50(%rbx)
movslq %r12d, %rax
movq %rax, 0x60(%rbx)
jmp 0x6b46
decq (%rbx)
jne 0x6b44
movq %rbx, %rdi
callq 0x30d0
jmp 0x6b44
leaq 0x4d0b(%rip), %rdi      # 0xb92e
leaq 0x4b08(%rip), %rsi      # 0xb732
leaq 0x4cc0(%rip), %rcx      # 0xb8f1
movl $0x38c, %edx            # imm = 0x38C
callq 0x3130