// File: /workspace/github_c_makefile_star2_O0/WojciechMula[P]pyahocorasick/src/AutomatonSearchIterLong.c
// Function: automaton_search_iter_long_set
static PyObject*
automaton_search_iter_long_set(PyObject* self, PyObject* args) {
    PyObject* object;
    PyObject* flag;
    bool reset;
    struct Input new_input;

    // first argument - required string or buffer
    object = PyTuple_GetItem(args, 0);
    if (object) {
        init_input(&new_input);
        if (!prepare_input((PyObject*)iter->automaton, object, &new_input)) {
            return NULL;
        }
    }
    else
        return NULL;

    // second argument - optional bool
    flag = PyTuple_GetItem(args, 1);
    if (flag) {
        switch (PyObject_IsTrue(flag)) {
            case 0:
                reset = false;
                break;
            case 1:
                reset = true;
                break;
            default:
                return NULL;
        }
    }
    else {
        PyErr_Clear();
        reset = false;
    }

    // update internal state
    Py_XDECREF(iter->object);
    Py_INCREF(object);
    iter->object    = object;

    destroy_input(&iter->input);
    assign_input(&iter->input, &new_input);

    if (!reset)
        iter->shift += (iter->index >= 0) ? iter->index : 0;

    iter->index     = -1;
    iter->end       = new_input.wordlen;

    if (reset) {
        iter->state  = iter->automaton->root;
        iter->shift  = 0;

        iter->last_node  = NULL;
        iter->last_index = -1;
    }

    Py_RETURN_NONE;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x18(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x3140
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0xa3a9
leaq -0x50(%rbp), %rdi
callq 0x3500
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x20(%rbp), %rsi
leaq -0x50(%rbp), %rdx
callq 0x3530
testb $0x1, %al
jne 0xa3a7
movq $0x0, -0x8(%rbp)
jmp 0xa4e5
jmp 0xa3b6
movq $0x0, -0x8(%rbp)
jmp 0xa4e5
movq -0x18(%rbp), %rdi
movl $0x1, %esi
callq 0x3140
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0xa408
movq -0x28(%rbp), %rdi
callq 0x3250
movl %eax, %ecx
movl %ecx, -0x54(%rbp)
testl %eax, %eax
je 0xa3ed
jmp 0xa3e3
movl -0x54(%rbp), %eax
subl $0x1, %eax
je 0xa3f3
jmp 0xa3f9
movb $0x0, -0x29(%rbp)
jmp 0xa406
movb $0x1, -0x29(%rbp)
jmp 0xa406
movq $0x0, -0x8(%rbp)
jmp 0xa4e5
jmp 0xa411
callq 0x3190
movb $0x0, -0x29(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0xa260
movq -0x20(%rbp), %rdi
callq 0x5820
movq -0x20(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x10(%rbp), %rdi
addq $0x28, %rdi
callq 0x3a40
movq -0x10(%rbp), %rdi
addq $0x28, %rdi
leaq -0x50(%rbp), %rsi
callq 0x3ad0
testb $0x1, -0x29(%rbp)
jne 0xa481
movq -0x10(%rbp), %rax
cmpl $0x0, 0x5c(%rax)
jl 0xa46d
movq -0x10(%rbp), %rax
movl 0x5c(%rax), %eax
movl %eax, -0x58(%rbp)
jmp 0xa474
xorl %eax, %eax
movl %eax, -0x58(%rbp)
jmp 0xa474
movl -0x58(%rbp), %ecx
movq -0x10(%rbp), %rax
addl 0x60(%rax), %ecx
movl %ecx, 0x60(%rax)
movq -0x10(%rbp), %rax
movl $0xffffffff, 0x5c(%rax) # imm = 0xFFFFFFFF
movq -0x50(%rbp), %rax
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x64(%rax)
testb $0x1, -0x29(%rbp)
je 0xa4d5
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x28(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x48(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x60(%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0x50(%rax)
movq -0x10(%rbp), %rax
movl $0xffffffff, 0x58(%rax) # imm = 0xFFFFFFFF
movq 0x7ae4(%rip), %rdi      # 0x11fc0
callq 0x4a30
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nop