// File: /workspace/github_c_makefile_star2_O3/WojciechMula[P]pyahocorasick/src/Automaton.c
// Function: automaton_new
static PyObject*
automaton_new(PyTypeObject* self, PyObject* args, PyObject* kwargs) {
    Automaton* automaton;
    int key_type;
    int store;

    automaton = (Automaton*)automaton_create();
    if (UNLIKELY(automaton == NULL))
        return NULL;


    if (UNLIKELY(PyTuple_Size(args) == 7)) {

        int             word_count;
        int             longest_word;
        AutomatonKind   kind;
        KeysStore       store;
        KeyType         key_type;
        PyObject*       bytes_list = NULL;
        PyObject*       values = NULL;

        const char* fmt = "OiiiiiO";

        if (!F(PyArg_ParseTuple)(args, fmt, &bytes_list, &kind, &store, &key_type, &word_count, &longest_word, &values)) {
            PyErr_SetString(PyExc_ValueError, "Unable to load from pickle.");
            goto error;
        }

        if (!check_store(store) || !check_kind(kind) || !check_key_type(key_type)) {
            goto error;
        }

        if (!PyList_CheckExact(bytes_list)) {
            PyErr_SetString(PyExc_TypeError, "Expected list");
            goto error;
        }

        if (kind != EMPTY) {
            if (values == Py_None) {
                Py_XDECREF(values);
                values = NULL;
            }

            if (automaton_unpickle(automaton, bytes_list, values)) {
                automaton->kind     = kind;
                automaton->store    = store;
                automaton->key_type = key_type;
                automaton->count    = word_count;
                automaton->longest_word = longest_word;
            }
            else
                goto error;
        }
    }
    else {
        store    = STORE_ANY;
        key_type = KEY_STRING;

        // construct new object
        if (F(PyArg_ParseTuple)(args, "ii", &store, &key_type)) {
            if (not check_store(store)) {
                goto error;
            }

            if (not check_key_type(key_type)) {
                goto error;
            }
        }
        else if (F(PyArg_ParseTuple)(args, "i", &store)) {
            if (not check_store(store)) {
                goto error;
            }
        }

        PyErr_Clear();
        automaton->store    = store;
        automaton->key_type = key_type;
    }

//ok:
    return (PyObject*)automaton;

error:
    Py_XDECREF(automaton);
    return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x30, %rsp
movq %rsi, %r14
callq 0x34fe
testq %rax, %rax
je 0x377d
movq %rax, %rbx
movq %r14, %rdi
callq 0x32f0
cmpq $0x7, %rax
je 0x378c
leaq 0x8(%rsp), %rdx
movl $0x1e, (%rdx)
leaq 0x10(%rsp), %rcx
movl $0x64, (%rcx)
leaq 0x821a(%rip), %rsi      # 0xb8ee
movq %r14, %rdi
xorl %eax, %eax
callq 0x3240
testl %eax, %eax
je 0x3718
movl 0x8(%rsp), %eax
cmpl $0x1e, %eax
ja 0x375a
movl $0x40100400, %ecx       # imm = 0x40100400
btl %eax, %ecx
jae 0x375a
movl 0x10(%rsp), %eax
cmpl $0x64, %eax
je 0x3745
cmpl $0xc8, %eax
je 0x3745
movq 0xc87c(%rip), %rax      # 0xff88
movq (%rax), %rdi
leaq 0x5e54(%rip), %rsi      # 0x956a
jmp 0x376b
leaq 0x85f6(%rip), %rsi      # 0xbd15
leaq 0x8(%rsp), %rdx
movq %r14, %rdi
xorl %eax, %eax
callq 0x3240
testl %eax, %eax
je 0x3745
movl 0x8(%rsp), %eax
cmpl $0x1e, %eax
ja 0x375a
movl $0x40100400, %ecx       # imm = 0x40100400
btl %eax, %ecx
jae 0x375a
callq 0x3190
movl 0x8(%rsp), %eax
movl %eax, 0x14(%rbx)
movl 0x10(%rsp), %eax
movl %eax, 0x18(%rbx)
jmp 0x377f
movq 0xc827(%rip), %rax      # 0xff88
movq (%rax), %rdi
leaq 0x5d71(%rip), %rsi      # 0x94dc
callq 0x3120
decq (%rbx)
jne 0x377d
movq %rbx, %rdi
callq 0x30d0
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x30, %rsp
popq %rbx
popq %r14
popq %r15
retq
leaq 0x10(%rsp), %rdx
andq $0x0, (%rdx)
leaq 0x8(%rsp), %r10
andq $0x0, (%r10)
subq $0x8, %rsp
leaq 0x30(%rsp), %r11
leaq 0x34(%rsp), %r15
leaq 0x87e7(%rip), %rsi      # 0xbf9a
leaq 0x2c(%rsp), %rcx
leaq 0x28(%rsp), %r8
leaq 0x24(%rsp), %r9
movq %r14, %rdi
xorl %eax, %eax
pushq %r10
pushq %r11
pushq %r15
callq 0x3240
addq $0x20, %rsp
movq 0xc7ab(%rip), %rcx      # 0xff88
testl %eax, %eax
je 0x3837
leaq 0x5cf4(%rip), %rsi      # 0x94dc
movl 0x20(%rsp), %eax
cmpl $0x1e, %eax
ja 0x3850
movl $0x40100400, %edx       # imm = 0x40100400
btl %eax, %edx
jae 0x3850
movl 0x24(%rsp), %eax
cmpl $0x2, %eax
ja 0x3840
movl 0x1c(%rsp), %edx
cmpl $0xc8, %edx
je 0x3815
cmpl $0x64, %edx
jne 0x3849
movq 0x10(%rsp), %rsi
movq 0x8(%rsi), %rcx
cmpq 0xc7cb(%rip), %rcx      # 0xfff0
je 0x3858
leaq 0x8790(%rip), %rsi      # 0xbfbe
movq 0xc75b(%rip), %rcx      # 0xff90
jmp 0x3850
leaq 0x8764(%rip), %rsi      # 0xbfa2
jmp 0x3850
leaq 0x5ce2(%rip), %rsi      # 0x9529
jmp 0x3850
leaq 0x5d1a(%rip), %rsi      # 0x956a
movq (%rcx), %rdi
jmp 0x376b
testl %eax, %eax
je 0x377f
movq 0x8(%rsp), %rdx
cmpq 0xc754(%rip), %rdx      # 0xffc0
jne 0x3893
movq 0xc74b(%rip), %rax      # 0xffc0
decq (%rax)
jne 0x388b
movq 0xc73f(%rip), %rdi      # 0xffc0
callq 0x30d0
movq 0x10(%rsp), %rsi
andq $0x0, 0x8(%rsp)
xorl %edx, %edx
movq %rbx, %rdi
callq 0x80f4
testb %al, %al
je 0x3770
movl 0x24(%rsp), %eax
movl %eax, 0x10(%rbx)
movl 0x20(%rsp), %eax
movl %eax, 0x14(%rbx)
movl 0x1c(%rsp), %eax
movl %eax, 0x18(%rbx)
movl 0x2c(%rsp), %eax
movl %eax, 0x1c(%rbx)
movl 0x28(%rsp), %eax
movl %eax, 0x20(%rbx)
jmp 0x377f