// File: /workspace/github_c_makefile_star2_O1/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 0x34e6
testq %rax, %rax
je 0x3760
movq %rax, %rbx
movq %r14, %rdi
callq 0x32f0
cmpq $0x7, %rax
je 0x376f
leaq 0x8(%rsp), %rdx
movl $0x1e, (%rdx)
leaq 0x18(%rsp), %rcx
movl $0x64, (%rcx)
leaq 0x8227(%rip), %rsi      # 0xb8de
movq %r14, %rdi
xorl %eax, %eax
callq 0x3240
testl %eax, %eax
je 0x36fb
movl 0x8(%rsp), %eax
cmpl $0x1e, %eax
ja 0x373d
movl $0x40100400, %ecx       # imm = 0x40100400
btl %eax, %ecx
jae 0x373d
movl 0x18(%rsp), %eax
cmpl $0x64, %eax
je 0x3728
cmpl $0xc8, %eax
je 0x3728
movq 0xc899(%rip), %rax      # 0xff88
movq (%rax), %rdi
leaq 0x5e61(%rip), %rsi      # 0x955a
jmp 0x374e
leaq 0x8603(%rip), %rsi      # 0xbd05
leaq 0x8(%rsp), %rdx
movq %r14, %rdi
xorl %eax, %eax
callq 0x3240
testl %eax, %eax
je 0x3728
movl 0x8(%rsp), %eax
cmpl $0x1e, %eax
ja 0x373d
movl $0x40100400, %ecx       # imm = 0x40100400
btl %eax, %ecx
jae 0x373d
callq 0x3190
movl 0x8(%rsp), %eax
movl %eax, 0x14(%rbx)
movl 0x18(%rsp), %eax
movl %eax, 0x18(%rbx)
jmp 0x3762
movq 0xc844(%rip), %rax      # 0xff88
movq (%rax), %rdi
leaq 0x5d7e(%rip), %rsi      # 0x94cc
callq 0x3120
decq (%rbx)
jne 0x3760
movq %rbx, %rdi
callq 0x30d0
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x30, %rsp
popq %rbx
popq %r14
popq %r15
retq
leaq 0x18(%rsp), %rdx
andq $0x0, (%rdx)
leaq 0x8(%rsp), %r10
andq $0x0, (%r10)
subq $0x8, %rsp
leaq 0x30(%rsp), %r11
leaq 0x34(%rsp), %r15
leaq 0x87f4(%rip), %rsi      # 0xbf8a
leaq 0x1c(%rsp), %rcx
leaq 0x2c(%rsp), %r8
leaq 0x28(%rsp), %r9
movq %r14, %rdi
xorl %eax, %eax
pushq %r10
pushq %r11
pushq %r15
callq 0x3240
addq $0x20, %rsp
movq 0xc7c8(%rip), %rcx      # 0xff88
testl %eax, %eax
je 0x3817
leaq 0x5d01(%rip), %rsi      # 0x94cc
movl 0x24(%rsp), %eax
cmpl $0x1e, %eax
ja 0x3830
movl $0x40100400, %edx       # imm = 0x40100400
btl %eax, %edx
jae 0x3830
cmpl $0x2, 0x14(%rsp)
ja 0x3820
movl 0x20(%rsp), %eax
cmpl $0xc8, %eax
je 0x37f5
cmpl $0x64, %eax
jne 0x3829
movq 0x18(%rsp), %rax
movq 0x8(%rax), %rax
cmpq 0xc7eb(%rip), %rax      # 0xfff0
je 0x3838
leaq 0x87a0(%rip), %rsi      # 0xbfae
movq 0xc77b(%rip), %rcx      # 0xff90
jmp 0x3830
leaq 0x8774(%rip), %rsi      # 0xbf92
jmp 0x3830
leaq 0x5cf2(%rip), %rsi      # 0x9519
jmp 0x3830
leaq 0x5d2a(%rip), %rsi      # 0x955a
movq (%rcx), %rdi
jmp 0x374e
cmpl $0x0, 0x14(%rsp)
je 0x3762
movq 0x8(%rsp), %rax
cmpq 0xc771(%rip), %rax      # 0xffc0
jne 0x386f
movq 0xc768(%rip), %rax      # 0xffc0
decq (%rax)
jne 0x3869
movq 0xc75c(%rip), %rdi      # 0xffc0
callq 0x30d0
andq $0x0, 0x8(%rsp)
movq 0x18(%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %rbx, %rdi
callq 0x81c1
testb %al, %al
je 0x3753
movl 0x14(%rsp), %eax
movl %eax, 0x10(%rbx)
movl 0x24(%rsp), %eax
movl %eax, 0x14(%rbx)
movl 0x20(%rsp), %eax
movl %eax, 0x18(%rbx)
movl 0x2c(%rsp), %eax
movl %eax, 0x1c(%rbx)
movl 0x28(%rsp), %eax
movl %eax, 0x20(%rbx)
jmp 0x3762