// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
callq 0x5380
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
sete %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x6682
movq $0x0, -0x8(%rbp)
jmp 0x689b
movq -0x18(%rbp), %rdi
callq 0x32f0
cmpq $0x7, %rax
sete %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x67ef
movq $0x0, -0x50(%rbp)
movq $0x0, -0x58(%rbp)
leaq 0x89d0(%rip), %rax      # 0xf08a
movq %rax, -0x60(%rbp)
movq -0x18(%rbp), %rdi
movq -0x60(%rbp), %rsi
leaq -0x50(%rbp), %rdx
leaq -0x3c(%rbp), %rcx
leaq -0x40(%rbp), %r8
leaq -0x44(%rbp), %r9
leaq -0x34(%rbp), %r11
leaq -0x38(%rbp), %r10
leaq -0x58(%rbp), %rax
movq %r11, (%rsp)
movq %r10, 0x8(%rsp)
movq %rax, 0x10(%rsp)
movb $0x0, %al
callq 0x3240
cmpl $0x0, %eax
jne 0x6717
movq 0xb885(%rip), %rax      # 0x11f88
movq (%rax), %rdi
leaq 0x8985(%rip), %rsi      # 0xf092
callq 0x3120
jmp 0x688a
movl -0x40(%rbp), %edi
callq 0x4100
testb $0x1, %al
jne 0x6725
jmp 0x673f
movl -0x3c(%rbp), %edi
callq 0x4160
testb $0x1, %al
jne 0x6733
jmp 0x673f
movl -0x44(%rbp), %edi
callq 0x41a0
testb $0x1, %al
jne 0x6744
jmp 0x688a
movq -0x50(%rbp), %rdi
movq 0xb8a1(%rip), %rsi      # 0x11ff0
callq 0x5e50
cmpl $0x0, %eax
jne 0x6774
movq 0xb830(%rip), %rax      # 0x11f90
movq (%rax), %rdi
leaq 0x8944(%rip), %rsi      # 0xf0ae
callq 0x3120
jmp 0x688a
cmpl $0x0, -0x3c(%rbp)
je 0x67ea
movq 0xb83f(%rip), %rax      # 0x11fc0
cmpq %rax, -0x58(%rbp)
jne 0x6798
movq -0x58(%rbp), %rdi
callq 0xa260
movq $0x0, -0x58(%rbp)
movq -0x28(%rbp), %rdi
movq -0x50(%rbp), %rsi
movq -0x58(%rbp), %rdx
callq 0xb270
testb $0x1, %al
jne 0x67af
jmp 0x67e3
movl -0x3c(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x10(%rax)
movl -0x40(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x14(%rax)
movl -0x44(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x18(%rax)
movl -0x34(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x1c(%rax)
movl -0x38(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x20(%rax)
jmp 0x67e8
jmp 0x688a
jmp 0x67ea
jmp 0x6880
movl $0x1e, -0x30(%rbp)
movl $0x64, -0x2c(%rbp)
movq -0x18(%rbp), %rdi
leaq 0x814c(%rip), %rsi      # 0xe954
leaq -0x30(%rbp), %rdx
leaq -0x2c(%rbp), %rcx
movb $0x0, %al
callq 0x3240
cmpl $0x0, %eax
je 0x683a
movl -0x30(%rbp), %edi
callq 0x4100
testb $0x1, %al
jne 0x682a
jmp 0x688a
movl -0x2c(%rbp), %edi
callq 0x41a0
testb $0x1, %al
jne 0x6838
jmp 0x688a
jmp 0x6867
movq -0x18(%rbp), %rdi
leaq 0x8564(%rip), %rsi      # 0xeda9
leaq -0x30(%rbp), %rdx
movb $0x0, %al
callq 0x3240
cmpl $0x0, %eax
je 0x6865
movl -0x30(%rbp), %edi
callq 0x4100
testb $0x1, %al
jne 0x6863
jmp 0x688a
jmp 0x6865
jmp 0x6867
callq 0x3190
movl -0x30(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x14(%rax)
movl -0x2c(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x18(%rax)
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x689b
movq -0x28(%rbp), %rdi
callq 0xa260
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x80, %rsp
popq %rbp
retq
nopl (%rax,%rax)