/* Generated by Cython 0.20.1 on Wed Feb 12 08:23:34 2014 */

#define PY_SSIZE_T_CLEAN
#ifndef CYTHON_USE_PYLONG_INTERNALS
#ifdef PYLONG_BITS_IN_DIGIT
#define CYTHON_USE_PYLONG_INTERNALS 0
#else
#include "pyconfig.h"
#ifdef PYLONG_BITS_IN_DIGIT
#define CYTHON_USE_PYLONG_INTERNALS 1
#else
#define CYTHON_USE_PYLONG_INTERNALS 0
#endif
#endif
#endif
#include "Python.h"
#ifndef Py_PYTHON_H
    #error Python headers needed to compile C extensions, please install development version of Python.
#elif PY_VERSION_HEX < 0x02040000
    #error Cython requires Python 2.4+.
#else
#define CYTHON_ABI "0_20_1"
#include <stddef.h> /* For offsetof */
#ifndef offsetof
#define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif
#if !defined(WIN32) && !defined(MS_WINDOWS)
  #ifndef __stdcall
    #define __stdcall
  #endif
  #ifndef __cdecl
    #define __cdecl
  #endif
  #ifndef __fastcall
    #define __fastcall
  #endif
#endif
#ifndef DL_IMPORT
  #define DL_IMPORT(t) t
#endif
#ifndef DL_EXPORT
  #define DL_EXPORT(t) t
#endif
#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif
#ifndef Py_HUGE_VAL
  #define Py_HUGE_VAL HUGE_VAL
#endif
#ifdef PYPY_VERSION
#define CYTHON_COMPILING_IN_PYPY 1
#define CYTHON_COMPILING_IN_CPYTHON 0
#else
#define CYTHON_COMPILING_IN_PYPY 0
#define CYTHON_COMPILING_IN_CPYTHON 1
#endif
#if CYTHON_COMPILING_IN_PYPY
#define Py_OptimizeFlag 0
#endif
#if PY_VERSION_HEX < 0x02050000
  typedef int Py_ssize_t;
  #define PY_SSIZE_T_MAX INT_MAX
  #define PY_SSIZE_T_MIN INT_MIN
  #define PY_FORMAT_SIZE_T ""
  #define CYTHON_FORMAT_SSIZE_T ""
  #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
  #define PyInt_AsSsize_t(o)   __Pyx_PyInt_As_int(o)
  #define PyNumber_Index(o)    ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \
                                (PyErr_Format(PyExc_TypeError, \
                                              "expected index value, got %.200s", Py_TYPE(o)->tp_name), \
                                 (PyObject*)0))
  #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \
                                  !PyComplex_Check(o))
  #define PyIndex_Check __Pyx_PyIndex_Check
  #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
  #define __PYX_BUILD_PY_SSIZE_T "i"
#else
  #define __PYX_BUILD_PY_SSIZE_T "n"
  #define CYTHON_FORMAT_SSIZE_T "z"
  #define __Pyx_PyIndex_Check PyIndex_Check
#endif
#if PY_VERSION_HEX < 0x02060000
  #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
  #define Py_TYPE(ob)   (((PyObject*)(ob))->ob_type)
  #define Py_SIZE(ob)   (((PyVarObject*)(ob))->ob_size)
  #define PyVarObject_HEAD_INIT(type, size) \
          PyObject_HEAD_INIT(type) size,
  #define PyType_Modified(t)
  typedef struct {
     void *buf;
     PyObject *obj;
     Py_ssize_t len;
     Py_ssize_t itemsize;
     int readonly;
     int ndim;
     char *format;
     Py_ssize_t *shape;
     Py_ssize_t *strides;
     Py_ssize_t *suboffsets;
     void *internal;
  } Py_buffer;
  #define PyBUF_SIMPLE 0
  #define PyBUF_WRITABLE 0x0001
  #define PyBUF_FORMAT 0x0004
  #define PyBUF_ND 0x0008
  #define PyBUF_STRIDES (0x0010 | PyBUF_ND)
  #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
  #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
  #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
  #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)
  #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE)
  #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE)
  typedef int (*getbufferproc)(PyObject *, Py_buffer *, int);
  typedef void (*releasebufferproc)(PyObject *, Py_buffer *);
#endif
#if PY_MAJOR_VERSION < 3
  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
          PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  #define __Pyx_DefaultClassType PyClass_Type
#else
  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
          PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  #define __Pyx_DefaultClassType PyType_Type
#endif
#if PY_VERSION_HEX < 0x02060000
  #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict")
#endif
#if PY_MAJOR_VERSION >= 3
  #define Py_TPFLAGS_CHECKTYPES 0
  #define Py_TPFLAGS_HAVE_INDEX 0
#endif
#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
#if PY_VERSION_HEX < 0x02060000
  #define Py_TPFLAGS_HAVE_VERSION_TAG 0
#endif
#if PY_VERSION_HEX < 0x02060000 && !defined(Py_TPFLAGS_IS_ABSTRACT)
  #define Py_TPFLAGS_IS_ABSTRACT 0
#endif
#if PY_VERSION_HEX < 0x030400a1 && !defined(Py_TPFLAGS_HAVE_FINALIZE)
  #define Py_TPFLAGS_HAVE_FINALIZE 0
#endif
#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
  #define CYTHON_PEP393_ENABLED 1
  #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ? \
                                              0 : _PyUnicode_Ready((PyObject *)(op)))
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
  #define __Pyx_PyUnicode_KIND(u)         PyUnicode_KIND(u)
  #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
  #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
#else
  #define CYTHON_PEP393_ENABLED 0
  #define __Pyx_PyUnicode_READY(op)       (0)
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
  #define __Pyx_PyUnicode_KIND(u)         (sizeof(Py_UNICODE))
  #define __Pyx_PyUnicode_DATA(u)         ((void*)PyUnicode_AS_UNICODE(u))
  #define __Pyx_PyUnicode_READ(k, d, i)   ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
#endif
#if CYTHON_COMPILING_IN_PYPY
  #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
#else
  #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ? \
      PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
#endif
#define __Pyx_PyString_FormatSafe(a, b)  ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
#define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyString_Format(a, b)  PyUnicode_Format(a, b)
#else
  #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBaseString_Type            PyUnicode_Type
  #define PyStringObject               PyUnicodeObject
  #define PyString_Type                PyUnicode_Type
  #define PyString_Check               PyUnicode_Check
  #define PyString_CheckExact          PyUnicode_CheckExact
#endif
#if PY_VERSION_HEX < 0x02060000
  #define PyBytesObject                PyStringObject
  #define PyBytes_Type                 PyString_Type
  #define PyBytes_Check                PyString_Check
  #define PyBytes_CheckExact           PyString_CheckExact
  #define PyBytes_FromString           PyString_FromString
  #define PyBytes_FromStringAndSize    PyString_FromStringAndSize
  #define PyBytes_FromFormat           PyString_FromFormat
  #define PyBytes_DecodeEscape         PyString_DecodeEscape
  #define PyBytes_AsString             PyString_AsString
  #define PyBytes_AsStringAndSize      PyString_AsStringAndSize
  #define PyBytes_Size                 PyString_Size
  #define PyBytes_AS_STRING            PyString_AS_STRING
  #define PyBytes_GET_SIZE             PyString_GET_SIZE
  #define PyBytes_Repr                 PyString_Repr
  #define PyBytes_Concat               PyString_Concat
  #define PyBytes_ConcatAndDel         PyString_ConcatAndDel
#endif
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
#else
  #define __Pyx_PyBaseString_Check(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj) || \
                                         PyString_Check(obj) || PyUnicode_Check(obj))
  #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
#endif
#if PY_VERSION_HEX < 0x02060000
  #define PySet_Check(obj)             PyObject_TypeCheck(obj, &PySet_Type)
  #define PyFrozenSet_Check(obj)       PyObject_TypeCheck(obj, &PyFrozenSet_Type)
#endif
#ifndef PySet_CheckExact
  #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
#endif
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
#if PY_MAJOR_VERSION >= 3
  #define PyIntObject                  PyLongObject
  #define PyInt_Type                   PyLong_Type
  #define PyInt_Check(op)              PyLong_Check(op)
  #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
  #define PyInt_FromString             PyLong_FromString
  #define PyInt_FromUnicode            PyLong_FromUnicode
  #define PyInt_FromLong               PyLong_FromLong
  #define PyInt_FromSize_t             PyLong_FromSize_t
  #define PyInt_FromSsize_t            PyLong_FromSsize_t
  #define PyInt_AsLong                 PyLong_AsLong
  #define PyInt_AS_LONG                PyLong_AS_LONG
  #define PyInt_AsSsize_t              PyLong_AsSsize_t
  #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
  #define PyNumber_Int                 PyNumber_Long
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBoolObject                 PyLongObject
#endif
#if PY_VERSION_HEX < 0x030200A4
  typedef long Py_hash_t;
  #define __Pyx_PyInt_FromHash_t PyInt_FromLong
  #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
#else
  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
  #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
#endif
#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300)
  #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b)
  #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value)
  #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b)
#else
  #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \
        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \
        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \
            (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0)))
  #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \
        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \
            (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1)))
  #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \
        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \
            (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1)))
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
#endif
#if PY_VERSION_HEX < 0x02050000
  #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),((char *)(n)))
  #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
  #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),((char *)(n)))
#else
  #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),(n))
  #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
  #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),(n))
#endif
#if PY_VERSION_HEX < 0x02050000
  #define __Pyx_NAMESTR(n) ((char *)(n))
  #define __Pyx_DOCSTR(n)  ((char *)(n))
#else
  #define __Pyx_NAMESTR(n) (n)
  #define __Pyx_DOCSTR(n)  (n)
#endif
#ifndef CYTHON_INLINE
  #if defined(__GNUC__)
    #define CYTHON_INLINE __inline__
  #elif defined(_MSC_VER)
    #define CYTHON_INLINE __inline
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_INLINE inline
  #else
    #define CYTHON_INLINE
  #endif
#endif
#ifndef CYTHON_RESTRICT
  #if defined(__GNUC__)
    #define CYTHON_RESTRICT __restrict__
  #elif defined(_MSC_VER) && _MSC_VER >= 1400
    #define CYTHON_RESTRICT __restrict
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_RESTRICT restrict
  #else
    #define CYTHON_RESTRICT
  #endif
#endif
#ifdef NAN
#define __PYX_NAN() ((float) NAN)
#else
static CYTHON_INLINE float __PYX_NAN() {
  /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and
   a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is
   a quiet NaN. */
  float value;
  memset(&value, 0xFF, sizeof(value));
  return value;
}
#endif


#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
#else
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
#endif

#ifndef __PYX_EXTERN_C
  #ifdef __cplusplus
    #define __PYX_EXTERN_C extern "C"
  #else
    #define __PYX_EXTERN_C extern
  #endif
#endif

#if defined(WIN32) || defined(MS_WINDOWS)
#define _USE_MATH_DEFINES
#endif
#include <math.h>
#define __PYX_HAVE__acora___acora
#define __PYX_HAVE_API__acora___acora
#include "string.h"
#include "stdio.h"
#include "acora_defs.h"
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

#ifdef PYREX_WITHOUT_ASSERTIONS
#define CYTHON_WITHOUT_ASSERTIONS
#endif

#ifndef CYTHON_UNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#     define CYTHON_UNUSED __attribute__ ((__unused__))
#   else
#     define CYTHON_UNUSED
#   endif
# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
#   define CYTHON_UNUSED __attribute__ ((__unused__))
# else
#   define CYTHON_UNUSED
# endif
#endif
typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding;
                const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/

#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
#define __PYX_DEFAULT_STRING_ENCODING ""
#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (    \
    (sizeof(type) < sizeof(Py_ssize_t))  ||             \
    (sizeof(type) > sizeof(Py_ssize_t) &&               \
          likely(v < (type)PY_SSIZE_T_MAX ||            \
                 v == (type)PY_SSIZE_T_MAX)  &&         \
          (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||       \
                                v == (type)PY_SSIZE_T_MIN)))  ||  \
    (sizeof(type) == sizeof(Py_ssize_t) &&              \
          (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||        \
                               v == (type)PY_SSIZE_T_MAX)))  )
static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
#define __Pyx_PyBytes_FromString        PyBytes_FromString
#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char*);
#if PY_MAJOR_VERSION < 3
    #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#else
    #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
#endif
#define __Pyx_PyObject_AsSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_FromUString(s)  __Pyx_PyObject_FromString((char*)s)
#define __Pyx_PyBytes_FromUString(s)   __Pyx_PyBytes_FromString((char*)s)
#define __Pyx_PyByteArray_FromUString(s)   __Pyx_PyByteArray_FromString((char*)s)
#define __Pyx_PyStr_FromUString(s)     __Pyx_PyStr_FromString((char*)s)
#define __Pyx_PyUnicode_FromUString(s) __Pyx_PyUnicode_FromString((char*)s)
#if PY_MAJOR_VERSION < 3
static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
{
    const Py_UNICODE *u_end = u;
    while (*u_end++) ;
    return u_end - u - 1;
}
#else
#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
#endif
#define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
#define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
#if CYTHON_COMPILING_IN_CPYTHON
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
#else
#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
#endif
#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
static int __Pyx_sys_getdefaultencoding_not_ascii;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
    PyObject* sys = NULL;
    PyObject* default_encoding = NULL;
    PyObject* ascii_chars_u = NULL;
    PyObject* ascii_chars_b = NULL;
    sys = PyImport_ImportModule("sys");
    if (sys == NULL) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
    if (default_encoding == NULL) goto bad;
    if (strcmp(PyBytes_AsString(default_encoding), "ascii") == 0) {
        __Pyx_sys_getdefaultencoding_not_ascii = 0;
    } else {
        const char* default_encoding_c = PyBytes_AS_STRING(default_encoding);
        char ascii_chars[128];
        int c;
        for (c = 0; c < 128; c++) {
            ascii_chars[c] = c;
        }
        __Pyx_sys_getdefaultencoding_not_ascii = 1;
        ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
        if (ascii_chars_u == NULL) goto bad;
        ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
        if (ascii_chars_b == NULL || strncmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
            PyErr_Format(
                PyExc_ValueError,
                "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
                default_encoding_c);
            goto bad;
        }
    }
    Py_XDECREF(sys);
    Py_XDECREF(default_encoding);
    Py_XDECREF(ascii_chars_u);
    Py_XDECREF(ascii_chars_b);
    return 0;
bad:
    Py_XDECREF(sys);
    Py_XDECREF(default_encoding);
    Py_XDECREF(ascii_chars_u);
    Py_XDECREF(ascii_chars_b);
    return -1;
}
#endif
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
#else
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
static char* __PYX_DEFAULT_STRING_ENCODING;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
    PyObject* sys = NULL;
    PyObject* default_encoding = NULL;
    char* default_encoding_c;
    sys = PyImport_ImportModule("sys");
    if (sys == NULL) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
    if (default_encoding == NULL) goto bad;
    default_encoding_c = PyBytes_AS_STRING(default_encoding);
    __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
    strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
    Py_DECREF(sys);
    Py_DECREF(default_encoding);
    return 0;
bad:
    Py_XDECREF(sys);
    Py_XDECREF(default_encoding);
    return -1;
}
#endif
#endif


#ifdef __GNUC__
  /* Test for GCC > 2.95 */
  #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
    #define likely(x)   __builtin_expect(!!(x), 1)
    #define unlikely(x) __builtin_expect(!!(x), 0)
  #else /* __GNUC__ > 2 ... */
    #define likely(x)   (x)
    #define unlikely(x) (x)
  #endif /* __GNUC__ > 2 ... */
#else /* __GNUC__ */
  #define likely(x)   (x)
  #define unlikely(x) (x)
#endif /* __GNUC__ */

static PyObject *__pyx_m;
static PyObject *__pyx_d;
static PyObject *__pyx_b;
static PyObject *__pyx_empty_tuple;
static PyObject *__pyx_empty_bytes;
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * __pyx_cfilenm= __FILE__;
static const char *__pyx_filename;


static const char *__pyx_f[] = {
  "_acora.pyx",
  "_acora.pxd",
};

/*--- Type declarations ---*/
struct __pyx_obj_5acora_6_acora__NfaState;
struct __pyx_obj_5acora_6_acora_UnicodeAcora;
struct __pyx_obj_5acora_6_acora__UnicodeAcoraIter;
struct __pyx_obj_5acora_6_acora_BytesAcora;
struct __pyx_obj_5acora_6_acora__BytesAcoraIter;
struct __pyx_obj_5acora_6_acora__FileAcoraIter;
struct __pyx_t_5acora_6_acora__AcoraUnicodeNodeStruct;
typedef struct __pyx_t_5acora_6_acora__AcoraUnicodeNodeStruct __pyx_t_5acora_6_acora__AcoraUnicodeNodeStruct;
struct __pyx_t_5acora_6_acora__AcoraBytesNodeStruct;
typedef struct __pyx_t_5acora_6_acora__AcoraBytesNodeStruct __pyx_t_5acora_6_acora__AcoraBytesNodeStruct;
struct __pyx_opt_args_5acora_6_acora_build_NfaState;

/* "acora/_acora.pyx":36
 * DEF FILE_BUFFER_SIZE = 32 * 1024
 * 
 * ctypedef struct _AcoraUnicodeNodeStruct:             # <<<<<<<<<<<<<<
 *     Py_UCS4* characters
 *     _AcoraUnicodeNodeStruct** targets
 */
struct __pyx_t_5acora_6_acora__AcoraUnicodeNodeStruct {
  Py_UCS4 *characters;
  __pyx_t_5acora_6_acora__AcoraUnicodeNodeStruct **targets;
  PyObject **matches;
  int char_count;
};

/* "acora/_acora.pyx":42
 *     int char_count
 * 
 * ctypedef struct _AcoraBytesNodeStruct:             # <<<<<<<<<<<<<<
 *     unsigned char* characters
 *     _AcoraBytesNodeStruct** targets
 */
struct __pyx_t_5acora_6_acora__AcoraBytesNodeStruct {
  unsigned char *characters;
  __pyx_t_5acora_6_acora__AcoraBytesNodeStruct **targets;
  PyObject **matches;
  int char_count;
};

/* "acora/_acora.pyx":95
 * 
 * 
 * cpdef _NfaState build_NfaState(state_id, list matches=None):             # <<<<<<<<<<<<<<
 *     cdef _NfaState state = _NfaState()
 *     state.id = state_id
 */
struct __pyx_opt_args_5acora_6_acora_build_NfaState {
  int __pyx_n;
  PyObject *matches;
};

/* "acora/_acora.pxd":2
 * 
 * cdef class _NfaState(dict):             # <<<<<<<<<<<<<<
 *     cdef public unsigned long id
 *     cdef public list matches
 */
struct __pyx_obj_5acora_6_acora__NfaState {
  PyDictObject __pyx_base;
  unsigned long id;
  PyObject *matches;
};


/* "acora/_acora.pyx":236
 * # unicode data handling
 * 
 * cdef class UnicodeAcora:             # <<<<<<<<<<<<<<
 *     """Acora search engine for unicode data.
 *     """
 */
struct __pyx_obj_5acora_6_acora_UnicodeAcora {
  PyObject_HEAD
  struct __pyx_vtabstruct_5acora_6_acora_UnicodeAcora *__pyx_vtab;
  __pyx_t_5acora_6_acora__AcoraUnicodeNodeStruct *start_node;
  Py_ssize_t node_count;
  PyObject *_pyrefs;
};


/* "acora/_acora.pyx":317
 * 
 * 
 * cdef class _UnicodeAcoraIter:             # <<<<<<<<<<<<<<
 *     cdef _AcoraUnicodeNodeStruct* current_node
 *     cdef _AcoraUnicodeNodeStruct* start_node
 */
struct __pyx_obj_5acora_6_acora__UnicodeAcoraIter {
  PyObject_HEAD
  struct __pyx_vtabstruct_5acora_6_acora__UnicodeAcoraIter *__pyx_vtab;
  __pyx_t_5acora_6_acora__AcoraUnicodeNodeStruct *current_node;
  __pyx_t_5acora_6_acora__AcoraUnicodeNodeStruct *start_node;
  Py_ssize_t data_pos;
  Py_ssize_t data_len;
  Py_ssize_t match_index;
  PyObject *data;
  struct __pyx_obj_5acora_6_acora_UnicodeAcora *acora;
  void *data_start;
  int unicode_kind;
};


/* "acora/_acora.pyx":409
 * # bytes data handling
 * 
 * cdef class BytesAcora:             # <<<<<<<<<<<<<<
 *     """Acora search engine for byte data.
 *     """
 */
struct __pyx_obj_5acora_6_acora_BytesAcora {
  PyObject_HEAD
  struct __pyx_vtabstruct_5acora_6_acora_BytesAcora *__pyx_vtab;
  __pyx_t_5acora_6_acora__AcoraBytesNodeStruct *start_node;
  Py_ssize_t node_count;
  PyObject *_pyrefs;
};


/* "acora/_acora.pyx":512
 * 
 * 
 * cdef class _BytesAcoraIter:             # <<<<<<<<<<<<<<
 *     cdef _AcoraBytesNodeStruct* current_node
 *     cdef _AcoraBytesNodeStruct* start_node
 */
struct __pyx_obj_5acora_6_acora__BytesAcoraIter {
  PyObject_HEAD
  struct __pyx_vtabstruct_5acora_6_acora__BytesAcoraIter *__pyx_vtab;
  __pyx_t_5acora_6_acora__AcoraBytesNodeStruct *current_node;
  __pyx_t_5acora_6_acora__AcoraBytesNodeStruct *start_node;
  Py_ssize_t match_index;
  PyObject *data;
  struct __pyx_obj_5acora_6_acora_BytesAcora *acora;
  unsigned char *data_char;
  unsigned char *data_end;
  unsigned char *data_start;
};


/* "acora/_acora.pyx":604
 * # file data handling
 * 
 * cdef class _FileAcoraIter:             # <<<<<<<<<<<<<<
 *     cdef _AcoraBytesNodeStruct* current_node
 *     cdef _AcoraBytesNodeStruct* start_node
 */
struct __pyx_obj_5acora_6_acora__FileAcoraIter {
  PyObject_HEAD
  struct __pyx_vtabstruct_5acora_6_acora__FileAcoraIter *__pyx_vtab;
  __pyx_t_5acora_6_acora__AcoraBytesNodeStruct *current_node;
  __pyx_t_5acora_6_acora__AcoraBytesNodeStruct *start_node;
  Py_ssize_t match_index;
  Py_ssize_t read_size;
  Py_ssize_t buffer_offset_count;
  PyObject *buffer;
  unsigned char *c_buffer_pos;
  unsigned char *c_buffer_end;
  PyObject *f;
  int close_file;
  int c_file;
  struct __pyx_obj_5acora_6_acora_BytesAcora *acora;
};



/* "acora/_acora.pyx":236
 * # unicode data handling
 * 
 * cdef class UnicodeAcora:             # <<<<<<<<<<<<<<
 *     """Acora search engine for unicode data.
 *     """
 */

struct __pyx_vtabstruct_5acora_6_acora_UnicodeAcora {
  PyObject *(*finditer)(struct __pyx_obj_5acora_6_acora_UnicodeAcora *, PyObject *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_5acora_6_acora_UnicodeAcora *__pyx_vtabptr_5acora_6_acora_UnicodeAcora;


/* "acora/_acora.pyx":317
 * 
 * 
 * cdef class _UnicodeAcoraIter:             # <<<<<<<<<<<<<<
 *     cdef _AcoraUnicodeNodeStruct* current_node
 *     cdef _AcoraUnicodeNodeStruct* start_node
 */

struct __pyx_vtabstruct_5acora_6_acora__UnicodeAcoraIter {
  PyObject *(*_build_next_match)(struct __pyx_obj_5acora_6_acora__UnicodeAcoraIter *);
};
static struct __pyx_vtabstruct_5acora_6_acora__UnicodeAcoraIter *__pyx_vtabptr_5acora_6_acora__UnicodeAcoraIter;


/* "acora/_acora.pyx":409
 * # bytes data handling
 * 
 * cdef class BytesAcora:             # <<<<<<<<<<<<<<
 *     """Acora search engine for byte data.
 *     """
 */

struct __pyx_vtabstruct_5acora_6_acora_BytesAcora {
  PyObject *(*finditer)(struct __pyx_obj_5acora_6_acora_BytesAcora *, PyObject *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_5acora_6_acora_BytesAcora *__pyx_vtabptr_5acora_6_acora_BytesAcora;


/* "acora/_acora.pyx":512
 * 
 * 
 * cdef class _BytesAcoraIter:             # <<<<<<<<<<<<<<
 *     cdef _AcoraBytesNodeStruct* current_node
 *     cdef _AcoraBytesNodeStruct* start_node
 */

struct __pyx_vtabstruct_5acora_6_acora__BytesAcoraIter {
  PyObject *(*_build_next_match)(struct __pyx_obj_5acora_6_acora__BytesAcoraIter *);
};
static struct __pyx_vtabstruct_5acora_6_acora__BytesAcoraIter *__pyx_vtabptr_5acora_6_acora__BytesAcoraIter;


/* "acora/_acora.pyx":604
 * # file data handling
 * 
 * cdef class _FileAcoraIter:             # <<<<<<<<<<<<<<
 *     cdef _AcoraBytesNodeStruct* current_node
 *     cdef _AcoraBytesNodeStruct* start_node
 */

struct __pyx_vtabstruct_5acora_6_acora__FileAcoraIter {
  PyObject *(*_build_next_match)(struct __pyx_obj_5acora_6_acora__FileAcoraIter *);
};
static struct __pyx_vtabstruct_5acora_6_acora__FileAcoraIter *__pyx_vtabptr_5acora_6_acora__FileAcoraIter;
#ifndef CYTHON_REFNANNY
  #define CYTHON_REFNANNY 0
#endif
#if CYTHON_REFNANNY
  typedef struct {
    void (*INCREF)(void*, PyObject*, int);
    void (*DECREF)(void*, PyObject*, int);
    void (*GOTREF)(void*, PyObject*, int);
    void (*GIVEREF)(void*, PyObject*, int);
    void* (*SetupContext)(const char*, int, const char*);
    void (*FinishContext)(void**);
  } __Pyx_RefNannyAPIStruct;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/
  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
#ifdef WITH_THREAD
  #define __Pyx_RefNannySetupContext(name, acquire_gil) \
          if (acquire_gil) { \
              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
              PyGILState_Release(__pyx_gilstate_save); \
          } else { \
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
          }
#else
  #define __Pyx_RefNannySetupContext(name, acquire_gil) \
          __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
#endif
  #define __Pyx_RefNannyFinishContext() \
          __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
  #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
  #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
  #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
#else
  #define __Pyx_RefNannyDeclarations
  #define __Pyx_RefNannySetupContext(name, acquire_gil)
  #define __Pyx_RefNannyFinishContext()
  #define __Pyx_INCREF(r) Py_INCREF(r)
  #define __Pyx_DECREF(r) Py_DECREF(r)
  #define __Pyx_GOTREF(r)
  #define __Pyx_GIVEREF(r)
  #define __Pyx_XINCREF(r) Py_XINCREF(r)
  #define __Pyx_XDECREF(r) Py_XDECREF(r)
  #define __Pyx_XGOTREF(r)
  #define __Pyx_XGIVEREF(r)
#endif /* CYTHON_REFNANNY */
#define __Pyx_XDECREF_SET(r, v) do {                            \
        PyObject *tmp = (PyObject *) r;                         \
        r = v; __Pyx_XDECREF(tmp);                              \
    } while (0)
#define __Pyx_DECREF_SET(r, v) do {                             \
        PyObject *tmp = (PyObject *) r;                         \
        r = v; __Pyx_DECREF(tmp);                               \
    } while (0)
#define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
#define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_getattro))
        return tp->tp_getattro(obj, attr_name);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_getattr))
        return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
#endif
    return PyObject_GetAttr(obj, attr_name);
}
#else
#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
#endif

static PyObject *__Pyx_GetBuiltinName(PyObject *name); /*proto*/

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); /*proto*/
#else
#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
#endif

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyList_GetSlice(PyObject* src, Py_ssize_t start, Py_ssize_t stop);
static CYTHON_INLINE PyObject* __Pyx_PyTuple_GetSlice(PyObject* src, Py_ssize_t start, Py_ssize_t stop);
#else
#define __Pyx_PyList_GetSlice(seq, start, stop)   PySequence_GetSlice(seq, start, stop)
#define __Pyx_PyTuple_GetSlice(seq, start, stop)  PySequence_GetSlice(seq, start, stop)
#endif

static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/

static PyObject* __Pyx_PyObject_CallMethodTuple(PyObject* obj, PyObject* method_name, PyObject* args) {
    PyObject *method, *result = NULL;
    if (unlikely(!args)) return NULL;
    method = __Pyx_PyObject_GetAttrStr(obj, method_name);
    if (unlikely(!method)) goto bad;
    result = __Pyx_PyObject_Call(method, args, NULL);
    Py_DECREF(method);
bad:
    Py_DECREF(args);
    return result;
}
#define __Pyx_PyObject_CallMethod3(obj, name, arg1, arg2, arg3) \
    __Pyx_PyObject_CallMethodTuple(obj, name, PyTuple_Pack(3, arg1, arg2, arg3))
#define __Pyx_PyObject_CallMethod2(obj, name, arg1, arg2) \
    __Pyx_PyObject_CallMethodTuple(obj, name, PyTuple_Pack(2, arg1, arg2))
#define __Pyx_PyObject_CallMethod1(obj, name, arg1) \
    __Pyx_PyObject_CallMethodTuple(obj, name, PyTuple_Pack(1, arg1))
#define __Pyx_PyObject_CallMethod0(obj, name) \
    __Pyx_PyObject_CallMethodTuple(obj, name, (Py_INCREF(__pyx_empty_tuple), __pyx_empty_tuple))

static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);

static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/

static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);

static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/

static CYTHON_INLINE int __Pyx_unpack_tuple2(PyObject* tuple, PyObject** value1, PyObject** value2,
                                             int is_tuple, int has_known_size, int decref_tuple);

static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* dict, int is_dict, PyObject* method_name,
                                                   Py_ssize_t* p_orig_length, int* p_is_dict);
static CYTHON_INLINE int __Pyx_dict_iter_next(PyObject* dict_or_iter, Py_ssize_t orig_length, Py_ssize_t* ppos,
                                              PyObject** pkey, PyObject** pvalue, PyObject** pitem, int is_dict);

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
    PyListObject* L = (PyListObject*) list;
    Py_ssize_t len = Py_SIZE(list);
    if (likely(L->allocated > len)) {
        Py_INCREF(x);
        PyList_SET_ITEM(list, len, x);
        Py_SIZE(list) = len+1;
        return 0;
    }
    return PyList_Append(list, x);
}
#else
#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
#endif

static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); /*proto*/

static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/

static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \
    PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \
    const char* function_name); /*proto*/

static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
    Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/

static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
    const char *name, int exact); /*proto*/

#if PY_MAJOR_VERSION >= 3
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
    PyObject *value;
    value = PyDict_GetItemWithError(d, key);
    if (unlikely(!value)) {
        if (!PyErr_Occurred()) {
            PyObject* args = PyTuple_Pack(1, key);
            if (likely(args))
                PyErr_SetObject(PyExc_KeyError, args);
            Py_XDECREF(args);
        }
        return NULL;
    }
    Py_INCREF(value);
    return value;
}
#else
    #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
#endif

static CYTHON_INLINE int __Pyx_init_unicode_iteration(
    PyObject* ustring, Py_ssize_t *length, void** data, int *kind); /* proto */

#if PY_MAJOR_VERSION < 3
#define __Pyx_PyString_Join __Pyx_PyBytes_Join
#define __Pyx_PyBaseString_Join(s, v) (PyUnicode_CheckExact(s) ? PyUnicode_Join(s, v) : __Pyx_PyBytes_Join(s, v))
#else
#define __Pyx_PyString_Join PyUnicode_Join
#define __Pyx_PyBaseString_Join PyUnicode_Join
#endif
#if CYTHON_COMPILING_IN_CPYTHON
    #if PY_MAJOR_VERSION < 3
    #define __Pyx_PyBytes_Join _PyString_Join
    #else
    #define __Pyx_PyBytes_Join _PyBytes_Join
    #endif
#else
static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values); /*proto*/
#endif

static CYTHON_INLINE int __Pyx_PyDict_Contains(PyObject* item, PyObject* dict, int eq) {
    int result = PyDict_Contains(dict, item);
    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
}

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
    PyListObject* L = (PyListObject*) list;
    Py_ssize_t len = Py_SIZE(list);
    if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
        Py_INCREF(x);
        PyList_SET_ITEM(list, len, x);
        Py_SIZE(list) = len+1;
        return 0;
    }
    return PyList_Append(list, x);
}
#else
#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
#endif

static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x); /*proto*/

static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d); /*proto*/

static CYTHON_INLINE long __Pyx_div_long(long, long); /* proto */

static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/

static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/

static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/

static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/

static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_long(unsigned long value);

static CYTHON_INLINE unsigned long __Pyx_PyInt_As_unsigned_long(PyObject *);

static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);

static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *);

static CYTHON_INLINE Py_UCS4 __Pyx_PyObject_AsPy_UCS4(PyObject*);

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_ptrdiff_t(ptrdiff_t value);

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);

#ifndef __PYX_FORCE_INIT_THREADS
  #define __PYX_FORCE_INIT_THREADS 0
#endif

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_char(unsigned char value);

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);

static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);

static int __Pyx_check_binary_version(void);

typedef struct {
    int code_line;
    PyCodeObject* code_object;
} __Pyx_CodeObjectCacheEntry;
struct __Pyx_CodeObjectCache {
    int count;
    int max_count;
    __Pyx_CodeObjectCacheEntry* entries;
};
static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
static PyCodeObject *__pyx_find_code_object(int code_line);
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);

static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename); /*proto*/

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/


/* Module declarations from 'libc' */

/* Module declarations from 'libc.string' */

/* Module declarations from 'libc.stdio' */

/* Module declarations from 'cpython.ref' */

/* Module declarations from 'cpython.exc' */

/* Module declarations from 'cpython.mem' */

/* Module declarations from 'cpython.object' */

/* Module declarations from 'cpython' */

/* Module declarations from 'cpython.version' */

/* Module declarations from 'cpython.unicode' */

/* Module declarations from 'acora._acora' */
static PyTypeObject *__pyx_ptype_5acora_6_acora__NfaState = 0;
static PyTypeObject *__pyx_ptype_5acora_6_acora_UnicodeAcora = 0;
static PyTypeObject *__pyx_ptype_5acora_6_acora__UnicodeAcoraIter = 0;
static PyTypeObject *__pyx_ptype_5acora_6_acora_BytesAcora = 0;
static PyTypeObject *__pyx_ptype_5acora_6_acora__BytesAcoraIter = 0;
static PyTypeObject *__pyx_ptype_5acora_6_acora__FileAcoraIter = 0;
static struct __pyx_obj_5acora_6_acora__NfaState *__pyx_f_5acora_6_acora_build_NfaState(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_5acora_6_acora_build_NfaState *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_5acora_6_acora__init_unicode_node(__pyx_t_5acora_6_acora__AcoraUnicodeNodeStruct *, PyObject *, PyObject *, __pyx_t_5acora_6_acora__AcoraUnicodeNodeStruct *, PyObject *, PyObject *); /*proto*/
static PyObject *__pyx_f_5acora_6_acora__init_bytes_node(__pyx_t_5acora_6_acora__AcoraBytesNodeStruct *, PyObject *, PyObject *, __pyx_t_5acora_6_acora__AcoraBytesNodeStruct *, PyObject *, PyObject *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_5acora_6_acora__intern(PyObject *, PyObject *); /*proto*/
static PyObject *__pyx_f_5acora_6_acora_group_transitions_by_state(PyObject *); /*proto*/
static int __pyx_f_5acora_6_acora__search_in_bytes(__pyx_t_5acora_6_acora__AcoraBytesNodeStruct *, unsigned char *, unsigned char **, __pyx_t_5acora_6_acora__AcoraBytesNodeStruct **); /*proto*/
static int __pyx_f_5acora_6_acora__find_next_match_in_cfile(int, unsigned char *, size_t, __pyx_t_5acora_6_acora__AcoraBytesNodeStruct *, unsigned char **, unsigned char **, Py_ssize_t *, __pyx_t_5acora_6_acora__AcoraBytesNodeStruct **, int *); /*proto*/
#define __Pyx_MODULE_NAME "acora._acora"
int __pyx_module_is_main_acora___acora = 0;

/* Implementation of 'acora._acora' */
static PyObject *__pyx_builtin_zip;
static PyObject *__pyx_builtin_MemoryError;
static PyObject *__pyx_builtin_enumerate;
static PyObject *__pyx_builtin_sorted;
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_StopIteration;
static PyObject *__pyx_builtin_open;
static PyObject *__pyx_builtin_IOError;
static PyObject *__pyx_pf_5acora_6_acora_9_NfaState___richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_cmp_type); /* proto */
static Py_hash_t __pyx_pf_5acora_6_acora_9_NfaState_2__hash__(struct __pyx_obj_5acora_6_acora__NfaState *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5acora_6_acora_9_NfaState_4__str__(struct __pyx_obj_5acora_6_acora__NfaState *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5acora_6_acora_9_NfaState_6__repr__(struct __pyx_obj_5acora_6_acora__NfaState *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5acora_6_acora_9_NfaState_8__copy__(struct __pyx_obj_5acora_6_acora__NfaState *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5acora_6_acora_9_NfaState_10__deepcopy__(struct __pyx_obj_5acora_6_acora__NfaState *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_memo); /* proto */
static PyObject *__pyx_pf_5acora_6_acora_9_NfaState_12__reduce__(struct __pyx_obj_5acora_6_acora__NfaState *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5acora_6_acora_9_NfaState_2id___get__(struct __pyx_obj_5acora_6_acora__NfaState *__pyx_v_self); /* proto */
static int __pyx_pf_5acora_6_acora_9_NfaState_2id_2__set__(struct __pyx_obj_5acora_6_acora__NfaState *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_5acora_6_acora_9_NfaState_7matches___get__(struct __pyx_obj_5acora_6_acora__NfaState *__pyx_v_self); /* proto */
static int __pyx_pf_5acora_6_acora_9_NfaState_7matches_2__set__(struct __pyx_obj_5acora_6_acora__NfaState *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_5acora_6_acora_9_NfaState_7matches_4__del__(struct __pyx_obj_5acora_6_acora__NfaState *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5acora_6_acora_build_NfaState(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_state_id, PyObject *__pyx_v_matches); /* proto */
static int __pyx_pf_5acora_6_acora_12UnicodeAcora___cinit__(struct __pyx_obj_5acora_6_acora_UnicodeAcora *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_start_state, PyObject *__pyx_v_transitions); /* proto */
static void __pyx_pf_5acora_6_acora_12UnicodeAcora_2__dealloc__(struct __pyx_obj_5acora_6_acora_UnicodeAcora *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5acora_6_acora_12UnicodeAcora_4__reduce__(struct __pyx_obj_5acora_6_acora_UnicodeAcora *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5acora_6_acora_12UnicodeAcora_6finditer(struct __pyx_obj_5acora_6_acora_UnicodeAcora *__pyx_v_self, PyObject *__pyx_v_data); /* proto */
static PyObject *__pyx_pf_5acora_6_acora_12UnicodeAcora_8findall(struct __pyx_obj_5acora_6_acora_UnicodeAcora *__pyx_v_self, PyObject *__pyx_v_data); /* proto */
static int __pyx_pf_5acora_6_acora_17_UnicodeAcoraIter___cinit__(struct __pyx_obj_5acora_6_acora__UnicodeAcoraIter *__pyx_v_self, struct __pyx_obj_5acora_6_acora_UnicodeAcora *__pyx_v_acora, PyObject *__pyx_v_data); /* proto */
static PyObject *__pyx_pf_5acora_6_acora_17_UnicodeAcoraIter_2__iter__(struct __pyx_obj_5acora_6_acora__UnicodeAcoraIter *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5acora_6_acora_17_UnicodeAcoraIter_4__next__(struct __pyx_obj_5acora_6_acora__UnicodeAcoraIter *__pyx_v_self); /* proto */
static int __pyx_pf_5acora_6_acora_10BytesAcora___cinit__(struct __pyx_obj_5acora_6_acora_BytesAcora *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_start_state, PyObject *__pyx_v_transitions); /* proto */
static void __pyx_pf_5acora_6_acora_10BytesAcora_2__dealloc__(struct __pyx_obj_5acora_6_acora_BytesAcora *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5acora_6_acora_10BytesAcora_4__reduce__(struct __pyx_obj_5acora_6_acora_BytesAcora *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5acora_6_acora_10BytesAcora_6finditer(struct __pyx_obj_5acora_6_acora_BytesAcora *__pyx_v_self, PyObject *__pyx_v_data); /* proto */
static PyObject *__pyx_pf_5acora_6_acora_10BytesAcora_8findall(struct __pyx_obj_5acora_6_acora_BytesAcora *__pyx_v_self, PyObject *__pyx_v_data); /* proto */
static PyObject *__pyx_pf_5acora_6_acora_10BytesAcora_10filefind(struct __pyx_obj_5acora_6_acora_BytesAcora *__pyx_v_self, PyObject *__pyx_v_f); /* proto */
static PyObject *__pyx_pf_5acora_6_acora_10BytesAcora_12filefindall(struct __pyx_obj_5acora_6_acora_BytesAcora *__pyx_v_self, PyObject *__pyx_v_f); /* proto */
static int __pyx_pf_5acora_6_acora_15_BytesAcoraIter___cinit__(struct __pyx_obj_5acora_6_acora__BytesAcoraIter *__pyx_v_self, struct __pyx_obj_5acora_6_acora_BytesAcora *__pyx_v_acora, PyObject *__pyx_v_data); /* proto */
static PyObject *__pyx_pf_5acora_6_acora_15_BytesAcoraIter_2__iter__(struct __pyx_obj_5acora_6_acora__BytesAcoraIter *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5acora_6_acora_15_BytesAcoraIter_4__next__(struct __pyx_obj_5acora_6_acora__BytesAcoraIter *__pyx_v_self); /* proto */
static int __pyx_pf_5acora_6_acora_14_FileAcoraIter___cinit__(struct __pyx_obj_5acora_6_acora__FileAcoraIter *__pyx_v_self, struct __pyx_obj_5acora_6_acora_BytesAcora *__pyx_v_acora, PyObject *__pyx_v_f, int __pyx_v_close, Py_ssize_t __pyx_v_buffer_size); /* proto */
static PyObject *__pyx_pf_5acora_6_acora_14_FileAcoraIter_2__iter__(struct __pyx_obj_5acora_6_acora__FileAcoraIter *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5acora_6_acora_14_FileAcoraIter_4__next__(struct __pyx_obj_5acora_6_acora__FileAcoraIter *__pyx_v_self); /* proto */
static PyObject *__pyx_tp_new_5acora_6_acora__NfaState(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5acora_6_acora_UnicodeAcora(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5acora_6_acora__UnicodeAcoraIter(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5acora_6_acora_BytesAcora(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5acora_6_acora__BytesAcoraIter(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5acora_6_acora__FileAcoraIter(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static char __pyx_k_f[] = "f";
static char __pyx_k__2[] = "";
static char __pyx_k__3[] = "\000";
static char __pyx_k_rb[] = "rb";
static char __pyx_k_all[] = "__all__";
static char __pyx_k_zip[] = "zip";
static char __pyx_k_data[] = "data";
static char __pyx_k_join[] = "join";
static char __pyx_k_main[] = "__main__";
static char __pyx_k_open[] = "open";
static char __pyx_k_read[] = "read";
static char __pyx_k_tell[] = "tell";
static char __pyx_k_test[] = "__test__";
static char __pyx_k_acora[] = "acora";
static char __pyx_k_close[] = "close";
static char __pyx_k_items[] = "items";
static char __pyx_k_range[] = "range";
static char __pyx_k_append[] = "append";
static char __pyx_k_fileno[] = "fileno";
static char __pyx_k_sorted[] = "sorted";
static char __pyx_k_IOError[] = "IOError";
static char __pyx_k_matches[] = "matches";
static char __pyx_k_deepcopy[] = "__deepcopy__";
static char __pyx_k_filefind[] = "filefind";
static char __pyx_k_finditer[] = "finditer";
static char __pyx_k_state_id[] = "state_id";
static char __pyx_k_enumerate[] = "enumerate";
static char __pyx_k_iteritems[] = "iteritems";
static char __pyx_k_BytesAcora[] = "BytesAcora";
static char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
static char __pyx_k_MemoryError[] = "MemoryError";
static char __pyx_k_buffer_size[] = "buffer_size";
static char __pyx_k_start_state[] = "start_state";
static char __pyx_k_transitions[] = "transitions";
static char __pyx_k_UnicodeAcora[] = "UnicodeAcora";
static char __pyx_k_matches_list[] = "matches: list";
static char __pyx_k_StopIteration[] = "StopIteration";
static char __pyx_k_build_NfaState[] = "build_NfaState";
static char __pyx_k_id_unsigned_long[] = "id: 'unsigned long'";
static char __pyx_k_A_fast_C_implementation_of_the_A[] = "A fast C implementation of the Acora search engine.\n\nThere are two main classes, UnicodeAcora and BytesAcora, that handle\nbyte data and unicode data respectively.\n";
static PyObject *__pyx_n_u_BytesAcora;
static PyObject *__pyx_n_s_IOError;
static PyObject *__pyx_n_s_MemoryError;
static PyObject *__pyx_n_s_StopIteration;
static PyObject *__pyx_n_u_UnicodeAcora;
static PyObject *__pyx_kp_b__2;
static PyObject *__pyx_kp_u__2;
static PyObject *__pyx_kp_b__3;
static PyObject *__pyx_n_s_acora;
static PyObject *__pyx_n_s_all;
static PyObject *__pyx_n_s_append;
static PyObject *__pyx_n_s_buffer_size;
static PyObject *__pyx_n_s_build_NfaState;
static PyObject *__pyx_n_s_close;
static PyObject *__pyx_n_s_data;
static PyObject *__pyx_n_s_deepcopy;
static PyObject *__pyx_n_s_enumerate;
static PyObject *__pyx_n_s_f;
static PyObject *__pyx_n_s_filefind;
static PyObject *__pyx_n_s_fileno;
static PyObject *__pyx_n_s_finditer;
static PyObject *__pyx_n_s_items;
static PyObject *__pyx_n_s_iteritems;
static PyObject *__pyx_n_s_join;
static PyObject *__pyx_n_s_main;
static PyObject *__pyx_n_s_matches;
static PyObject *__pyx_n_s_open;
static PyObject *__pyx_n_s_pyx_vtable;
static PyObject *__pyx_n_s_range;
static PyObject *__pyx_n_u_rb;
static PyObject *__pyx_n_s_read;
static PyObject *__pyx_n_u_read;
static PyObject *__pyx_n_s_sorted;
static PyObject *__pyx_n_s_start_state;
static PyObject *__pyx_n_s_state_id;
static PyObject *__pyx_n_s_tell;
static PyObject *__pyx_n_s_test;
static PyObject *__pyx_n_s_transitions;
static PyObject *__pyx_n_s_zip;
static PyObject *__pyx_int_0;
static PyObject *__pyx_tuple_;

/* "acora/_acora.pyx":54
 *     """NFA state for the untransformed automaton.
 *     """
 *     def __richcmp__(self, other, int cmp_type):             # <<<<<<<<<<<<<<
 *         if type(self) is not _NfaState or type(other) is not _NfaState:
 *             return cmp_type == cpython.object.Py_NE
 */

/* Python wrapper */
static PyObject *__pyx_pw_5acora_6_acora_9_NfaState_1__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_cmp_type); /*proto*/
static PyObject *__pyx_pw_5acora_6_acora_9_NfaState_1__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_cmp_type) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__richcmp__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5acora_6_acora_9_NfaState___richcmp__(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_other), ((int)__pyx_v_cmp_type));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5acora_6_acora_9_NfaState___richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_cmp_type) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__richcmp__", 0);

  /* "acora/_acora.pyx":55
 *     """
 *     def __richcmp__(self, other, int cmp_type):
 *         if type(self) is not _NfaState or type(other) is not _NfaState:             # <<<<<<<<<<<<<<
 *             return cmp_type == cpython.object.Py_NE
 *         if cmp_type == cpython.object.Py_EQ:
 */
  __pyx_t_1 = (((PyObject *)Py_TYPE(__pyx_v_self)) != ((PyObject *)((PyObject*)__pyx_ptype_5acora_6_acora__NfaState)));
  if (!(__pyx_t_1 != 0)) {
    __pyx_t_2 = (((PyObject *)Py_TYPE(__pyx_v_other)) != ((PyObject *)((PyObject*)__pyx_ptype_5acora_6_acora__NfaState)));
    __pyx_t_3 = (__pyx_t_2 != 0);
  } else {
    __pyx_t_3 = (__pyx_t_1 != 0);
  }
  if (__pyx_t_3) {

    /* "acora/_acora.pyx":56
 *     def __richcmp__(self, other, int cmp_type):
 *         if type(self) is not _NfaState or type(other) is not _NfaState:
 *             return cmp_type == cpython.object.Py_NE             # <<<<<<<<<<<<<<
 *         if cmp_type == cpython.object.Py_EQ:
 *             return (<_NfaState>self).id == (<_NfaState>other).id
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_PyBool_FromLong((__pyx_v_cmp_type == Py_NE)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "acora/_acora.pyx":57
 *         if type(self) is not _NfaState or type(other) is not _NfaState:
 *             return cmp_type == cpython.object.Py_NE
 *         if cmp_type == cpython.object.Py_EQ:             # <<<<<<<<<<<<<<
 *             return (<_NfaState>self).id == (<_NfaState>other).id
 *         elif cmp_type == cpython.object.Py_LT:
 */
  __pyx_t_3 = ((__pyx_v_cmp_type == Py_EQ) != 0);
  if (__pyx_t_3) {

    /* "acora/_acora.pyx":58
 *             return cmp_type == cpython.object.Py_NE
 *         if cmp_type == cpython.object.Py_EQ:
 *             return (<_NfaState>self).id == (<_NfaState>other).id             # <<<<<<<<<<<<<<
 *         elif cmp_type == cpython.object.Py_LT:
 *             return (<_NfaState>self).id < (<_NfaState>other).id
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_PyBool_FromLong((((struct __pyx_obj_5acora_6_acora__NfaState *)__pyx_v_self)->id == ((struct __pyx_obj_5acora_6_acora__NfaState *)__pyx_v_other)->id)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "acora/_acora.pyx":59
 *         if cmp_type == cpython.object.Py_EQ:
 *             return (<_NfaState>self).id == (<_NfaState>other).id
 *         elif cmp_type == cpython.object.Py_LT:             # <<<<<<<<<<<<<<
 *             return (<_NfaState>self).id < (<_NfaState>other).id
 *         elif cmp_type == cpython.object.Py_NE:
 */
  __pyx_t_3 = ((__pyx_v_cmp_type == Py_LT) != 0);
  if (__pyx_t_3) {

    /* "acora/_acora.pyx":60
 *             return (<_NfaState>self).id == (<_NfaState>other).id
 *         elif cmp_type == cpython.object.Py_LT:
 *             return (<_NfaState>self).id < (<_NfaState>other).id             # <<<<<<<<<<<<<<
 *         elif cmp_type == cpython.object.Py_NE:
 *             return (<_NfaState>self).id != (<_NfaState>other).id
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_PyBool_FromLong((((struct __pyx_obj_5acora_6_acora__NfaState *)__pyx_v_self)->id < ((struct __pyx_obj_5acora_6_acora__NfaState *)__pyx_v_other)->id)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "acora/_acora.pyx":61
 *         elif cmp_type == cpython.object.Py_LT:
 *             return (<_NfaState>self).id < (<_NfaState>other).id
 *         elif cmp_type == cpython.object.Py_NE:             # <<<<<<<<<<<<<<
 *             return (<_NfaState>self).id != (<_NfaState>other).id
 *         # that's all we need
 */
  __pyx_t_3 = ((__pyx_v_cmp_type == Py_NE) != 0);
  if (__pyx_t_3) {

    /* "acora/_acora.pyx":62
 *             return (<_NfaState>self).id < (<_NfaState>other).id
 *         elif cmp_type == cpython.object.Py_NE:
 *             return (<_NfaState>self).id != (<_NfaState>other).id             # <<<<<<<<<<<<<<
 *         # that's all we need
 *         return False
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_PyBool_FromLong((((struct __pyx_obj_5acora_6_acora__NfaState *)__pyx_v_self)->id != ((struct __pyx_obj_5acora_6_acora__NfaState *)__pyx_v_other)->id)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "acora/_acora.pyx":64
 *             return (<_NfaState>self).id != (<_NfaState>other).id
 *         # that's all we need
 *         return False             # <<<<<<<<<<<<<<
 * 
 *     def __hash__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_False);
  __pyx_r = Py_False;
  goto __pyx_L0;

  /* "acora/_acora.pyx":54
 *     """NFA state for the untransformed automaton.
 *     """
 *     def __richcmp__(self, other, int cmp_type):             # <<<<<<<<<<<<<<
 *         if type(self) is not _NfaState or type(other) is not _NfaState:
 *             return cmp_type == cpython.object.Py_NE
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("acora._acora._NfaState.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "acora/_acora.pyx":66
 *         return False
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         return <long>self.id
 * 
 */

/* Python wrapper */
static Py_hash_t __pyx_pw_5acora_6_acora_9_NfaState_3__hash__(PyObject *__pyx_v_self); /*proto*/
static Py_hash_t __pyx_pw_5acora_6_acora_9_NfaState_3__hash__(PyObject *__pyx_v_self) {
  Py_hash_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__hash__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5acora_6_acora_9_NfaState_2__hash__(((struct __pyx_obj_5acora_6_acora__NfaState *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_hash_t __pyx_pf_5acora_6_acora_9_NfaState_2__hash__(struct __pyx_obj_5acora_6_acora__NfaState *__pyx_v_self) {
  Py_hash_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__hash__", 0);

  /* "acora/_acora.pyx":67
 * 
 *     def __hash__(self):
 *         return <long>self.id             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self):
 */
  __pyx_r = ((long)__pyx_v_self->id);
  goto __pyx_L0;

  /* "acora/_acora.pyx":66
 *         return False
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         return <long>self.id
 * 
 */

  /* function exit code */
  __pyx_L0:;
  if (unlikely(__pyx_r == -1) && !PyErr_Occurred()) __pyx_r = -2;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "acora/_acora.pyx":69
 *         return <long>self.id
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return str(self.id)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5acora_6_acora_9_NfaState_5__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5acora_6_acora_9_NfaState_5__str__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5acora_6_acora_9_NfaState_4__str__(((struct __pyx_obj_5acora_6_acora__NfaState *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5acora_6_acora_9_NfaState_4__str__(struct __pyx_obj_5acora_6_acora__NfaState *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__str__", 0);

  /* "acora/_acora.pyx":70
 * 
 *     def __str__(self):
 *         return str(self.id)             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_unsigned_long(__pyx_v_self->id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "acora/_acora.pyx":69
 *         return <long>self.id
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return str(self.id)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("acora._acora._NfaState.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "acora/_acora.pyx":72
 *         return str(self.id)
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return str(self.id)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5acora_6_acora_9_NfaState_7__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5acora_6_acora_9_NfaState_7__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5acora_6_acora_9_NfaState_6__repr__(((struct __pyx_obj_5acora_6_acora__NfaState *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5acora_6_acora_9_NfaState_6__repr__(struct __pyx_obj_5acora_6_acora__NfaState *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "acora/_acora.pyx":73
 * 
 *     def __repr__(self):
 *         return str(self.id)             # <<<<<<<<<<<<<<
 * 
 *     def __copy__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_unsigned_long(__pyx_v_self->id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "acora/_acora.pyx":72
 *         return str(self.id)
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return str(self.id)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("acora._acora._NfaState.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "acora/_acora.pyx":75
 *         return str(self.id)
 * 
 *     def __copy__(self):             # <<<<<<<<<<<<<<
 *         state = _NfaState(self)
 *         state.id = self.id
 */

/* Python wrapper */
static PyObject *__pyx_pw_5acora_6_acora_9_NfaState_9__copy__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5acora_6_acora_9_NfaState_8__copy__[] = "_NfaState.__copy__(self)";
static PyObject *__pyx_pw_5acora_6_acora_9_NfaState_9__copy__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__copy__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5acora_6_acora_9_NfaState_8__copy__(((struct __pyx_obj_5acora_6_acora__NfaState *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5acora_6_acora_9_NfaState_8__copy__(struct __pyx_obj_5acora_6_acora__NfaState *__pyx_v_self) {
  struct __pyx_obj_5acora_6_acora__NfaState *__pyx_v_state = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  unsigned long __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__copy__", 0);

  /* "acora/_acora.pyx":76
 * 
 *     def __copy__(self):
 *         state = _NfaState(self)             # <<<<<<<<<<<<<<
 *         state.id = self.id
 *         state.matches = self.matches[:]
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5acora_6_acora__NfaState)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_state = ((struct __pyx_obj_5acora_6_acora__NfaState *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "acora/_acora.pyx":77
 *     def __copy__(self):
 *         state = _NfaState(self)
 *         state.id = self.id             # <<<<<<<<<<<<<<
 *         state.matches = self.matches[:]
 *         return state
 */
  __pyx_t_3 = __pyx_v_self->id;
  __pyx_v_state->id = __pyx_t_3;

  /* "acora/_acora.pyx":78
 *         state = _NfaState(self)
 *         state.id = self.id
 *         state.matches = self.matches[:]             # <<<<<<<<<<<<<<
 *         return state
 * 
 */
  if (unlikely(__pyx_v_self->matches == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_2 = __Pyx_PyList_GetSlice(__pyx_v_self->matches, 0, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_state->matches);
  __Pyx_DECREF(__pyx_v_state->matches);
  __pyx_v_state->matches = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "acora/_acora.pyx":79
 *         state.id = self.id
 *         state.matches = self.matches[:]
 *         return state             # <<<<<<<<<<<<<<
 * 
 *     def __deepcopy__(self, memo):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_state));
  __pyx_r = ((PyObject *)__pyx_v_state);
  goto __pyx_L0;

  /* "acora/_acora.pyx":75
 *         return str(self.id)
 * 
 *     def __copy__(self):             # <<<<<<<<<<<<<<
 *         state = _NfaState(self)
 *         state.id = self.id
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("acora._acora._NfaState.__copy__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_state);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "acora/_acora.pyx":81
 *         return state
 * 
 *     def __deepcopy__(self, memo):             # <<<<<<<<<<<<<<
 *         state = _NfaState(
 *             [ (character, child.__deepcopy__(None))
 */

/* Python wrapper */
static PyObject *__pyx_pw_5acora_6_acora_9_NfaState_11__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo); /*proto*/
static char __pyx_doc_5acora_6_acora_9_NfaState_10__deepcopy__[] = "_NfaState.__deepcopy__(self, memo)";
static PyObject *__pyx_pw_5acora_6_acora_9_NfaState_11__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__deepcopy__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5acora_6_acora_9_NfaState_10__deepcopy__(((struct __pyx_obj_5acora_6_acora__NfaState *)__pyx_v_self), ((PyObject *)__pyx_v_memo));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5acora_6_acora_9_NfaState_10__deepcopy__(struct __pyx_obj_5acora_6_acora__NfaState *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_memo) {
  struct __pyx_obj_5acora_6_acora__NfaState *__pyx_v_state = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  unsigned long __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__deepcopy__", 0);

  /* "acora/_acora.pyx":82
 * 
 *     def __deepcopy__(self, memo):
 *         state = _NfaState(             # <<<<<<<<<<<<<<
 *             [ (character, child.__deepcopy__(None))
 *               for character, child in (<object>self).items() ])
 */
  { /* enter inner scope */
    PyObject *__pyx_7genexpr__pyx_v_character = NULL;
    PyObject *__pyx_7genexpr__pyx_v_child = NULL;

    /* "acora/_acora.pyx":83
 *     def __deepcopy__(self, memo):
 *         state = _NfaState(
 *             [ (character, child.__deepcopy__(None))             # <<<<<<<<<<<<<<
 *               for character, child in (<object>self).items() ])
 *         state.id = self.id
 */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
    __Pyx_GOTREF(__pyx_t_1);

    /* "acora/_acora.pyx":84
 *         state = _NfaState(
 *             [ (character, child.__deepcopy__(None))
 *               for character, child in (<object>self).items() ])             # <<<<<<<<<<<<<<
 *         state.id = self.id
 *         state.matches = self.matches[:]
 */
    __pyx_t_3 = 0;
    if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "items");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
    }
    __pyx_t_6 = __Pyx_dict_iterator(((PyObject *)__pyx_v_self), 0, __pyx_n_s_items, (&__pyx_t_4), (&__pyx_t_5)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_2);
    __pyx_t_2 = __pyx_t_6;
    __pyx_t_6 = 0;
    while (1) {
      __pyx_t_8 = __Pyx_dict_iter_next(__pyx_t_2, __pyx_t_4, &__pyx_t_3, &__pyx_t_6, &__pyx_t_7, NULL, __pyx_t_5);
      if (unlikely(__pyx_t_8 == 0)) break;
      if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_character, __pyx_t_6);
      __pyx_t_6 = 0;
      __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_child, __pyx_t_7);
      __pyx_t_7 = 0;

      /* "acora/_acora.pyx":83
 *     def __deepcopy__(self, memo):
 *         state = _NfaState(
 *             [ (character, child.__deepcopy__(None))             # <<<<<<<<<<<<<<
 *               for character, child in (<object>self).items() ])
 *         state.id = self.id
 */
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_7genexpr__pyx_v_child, __pyx_n_s_deepcopy); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_7genexpr__pyx_v_character);
      PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_7genexpr__pyx_v_character);
      __Pyx_GIVEREF(__pyx_7genexpr__pyx_v_character);
      PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_6);
      __pyx_t_6 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_7))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_7genexpr__pyx_v_character);
    __Pyx_XDECREF(__pyx_7genexpr__pyx_v_child);
    goto __pyx_L8_exit_scope;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_7genexpr__pyx_v_character);
    __Pyx_XDECREF(__pyx_7genexpr__pyx_v_child);
    goto __pyx_L1_error;
    __pyx_L8_exit_scope:;
  } /* exit inner scope */

  /* "acora/_acora.pyx":82
 * 
 *     def __deepcopy__(self, memo):
 *         state = _NfaState(             # <<<<<<<<<<<<<<
 *             [ (character, child.__deepcopy__(None))
 *               for character, child in (<object>self).items() ])
 */
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5acora_6_acora__NfaState)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_state = ((struct __pyx_obj_5acora_6_acora__NfaState *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "acora/_acora.pyx":85
 *             [ (character, child.__deepcopy__(None))
 *               for character, child in (<object>self).items() ])
 *         state.id = self.id             # <<<<<<<<<<<<<<
 *         state.matches = self.matches[:]
 *         return state
 */
  __pyx_t_9 = __pyx_v_self->id;
  __pyx_v_state->id = __pyx_t_9;

  /* "acora/_acora.pyx":86
 *               for character, child in (<object>self).items() ])
 *         state.id = self.id
 *         state.matches = self.matches[:]             # <<<<<<<<<<<<<<
 *         return state
 * 
 */
  if (unlikely(__pyx_v_self->matches == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_1 = __Pyx_PyList_GetSlice(__pyx_v_self->matches, 0, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_state->matches);
  __Pyx_DECREF(__pyx_v_state->matches);
  __pyx_v_state->matches = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "acora/_acora.pyx":87
 *         state.id = self.id
 *         state.matches = self.matches[:]
 *         return state             # <<<<<<<<<<<<<<
 * 
 *     def __reduce__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_state));
  __pyx_r = ((PyObject *)__pyx_v_state);
  goto __pyx_L0;

  /* "acora/_acora.pyx":81
 *         return state
 * 
 *     def __deepcopy__(self, memo):             # <<<<<<<<<<<<<<
 *         state = _NfaState(
 *             [ (character, child.__deepcopy__(None))
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("acora._acora._NfaState.__deepcopy__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_state);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "acora/_acora.pyx":89
 *         return state
 * 
 *     def __reduce__(self):             # <<<<<<<<<<<<<<
 *         """pickle"""
 *         return (build_NfaState, (self.id, self.matches),
 */

/* Python wrapper */
static PyObject *__pyx_pw_5acora_6_acora_9_NfaState_13__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5acora_6_acora_9_NfaState_12__reduce__[] = "_NfaState.__reduce__(self)\npickle";
static PyObject *__pyx_pw_5acora_6_acora_9_NfaState_13__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5acora_6_acora_9_NfaState_12__reduce__(((struct __pyx_obj_5acora_6_acora__NfaState *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5acora_6_acora_9_NfaState_12__reduce__(struct __pyx_obj_5acora_6_acora__NfaState *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce__", 0);

  /* "acora/_acora.pyx":91
 *     def __reduce__(self):
 *         """pickle"""
 *         return (build_NfaState, (self.id, self.matches),             # <<<<<<<<<<<<<<
 *                 None, None, iter(self.items()))
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_build_NfaState); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_From_unsigned_long(__pyx_v_self->id); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_self->matches);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_self->matches);
  __Pyx_GIVEREF(__pyx_v_self->matches);
  __pyx_t_2 = 0;

  /* "acora/_acora.pyx":92
 *         """pickle"""
 *         return (build_NfaState, (self.id, self.matches),
 *                 None, None, iter(self.items()))             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_items); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "acora/_acora.pyx":91
 *     def __reduce__(self):
 *         """pickle"""
 *         return (build_NfaState, (self.id, self.matches),             # <<<<<<<<<<<<<<
 *                 None, None, iter(self.items()))
 * 
 */
  __pyx_t_4 = PyTuple_New(5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_4, 2, Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_4, 3, Py_None);
  __Pyx_GIVEREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_3 = 0;
  __pyx_t_2 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "acora/_acora.pyx":89
 *         return state
 * 
 *     def __reduce__(self):             # <<<<<<<<<<<<<<
 *         """pickle"""
 *         return (build_NfaState, (self.id, self.matches),
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("acora._acora._NfaState.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "acora/_acora.pxd":3
 * 
 * cdef class _NfaState(dict):
 *     cdef public unsigned long id             # <<<<<<<<<<<<<<
 *     cdef public list matches
 */

/* Python wrapper */
static PyObject *__pyx_pw_5acora_6_acora_9_NfaState_2id_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5acora_6_acora_9_NfaState_2id_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5acora_6_acora_9_NfaState_2id___get__(((struct __pyx_obj_5acora_6_acora__NfaState *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5acora_6_acora_9_NfaState_2id___get__(struct __pyx_obj_5acora_6_acora__NfaState *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_unsigned_long(__pyx_v_self->id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("acora._acora._NfaState.id.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_5acora_6_acora_9_NfaState_2id_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5acora_6_acora_9_NfaState_2id_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5acora_6_acora_9_NfaState_2id_2__set__(((struct __pyx_obj_5acora_6_acora__NfaState *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5acora_6_acora_9_NfaState_2id_2__set__(struct __pyx_obj_5acora_6_acora__NfaState *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  unsigned long __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  __pyx_t_1 = __Pyx_PyInt_As_unsigned_long(__pyx_v_value); if (unlikely((__pyx_t_1 == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_self->id = __pyx_t_1;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("acora._acora._NfaState.id.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "acora/_acora.pxd":4
 * cdef class _NfaState(dict):
 *     cdef public unsigned long id
 *     cdef public list matches             # <<<<<<<<<<<<<<
 */

/* Python wrapper */
static PyObject *__pyx_pw_5acora_6_acora_9_NfaState_7matches_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5acora_6_acora_9_NfaState_7matches_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5acora_6_acora_9_NfaState_7matches___get__(((struct __pyx_obj_5acora_6_acora__NfaState *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5acora_6_acora_9_NfaState_7matches___get__(struct __pyx_obj_5acora_6_acora__NfaState *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->matches);
  __pyx_r = __pyx_v_self->matches;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_5acora_6_acora_9_NfaState_7matches_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5acora_6_acora_9_NfaState_7matches_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5acora_6_acora_9_NfaState_7matches_2__set__(((struct __pyx_obj_5acora_6_acora__NfaState *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5acora_6_acora_9_NfaState_7matches_2__set__(struct __pyx_obj_5acora_6_acora__NfaState *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  if (!(likely(PyList_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = __pyx_v_value;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->matches);
  __Pyx_DECREF(__pyx_v_self->matches);
  __pyx_v_self->matches = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("acora._acora._NfaState.matches.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_5acora_6_acora_9_NfaState_7matches_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5acora_6_acora_9_NfaState_7matches_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5acora_6_acora_9_NfaState_7matches_4__del__(((struct __pyx_obj_5acora_6_acora__NfaState *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5acora_6_acora_9_NfaState_7matches_4__del__(struct __pyx_obj_5acora_6_acora__NfaState *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->matches);
  __Pyx_DECREF(__pyx_v_self->matches);
  __pyx_v_self->matches = ((PyObject*)Py_None);

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "acora/_acora.pyx":95
 * 
 * 
 * cpdef _NfaState build_NfaState(state_id, list matches=None):             # <<<<<<<<<<<<<<
 *     cdef _NfaState state = _NfaState()
 *     state.id = state_id
 */

static PyObject *__pyx_pw_5acora_6_acora_1build_NfaState(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static struct __pyx_obj_5acora_6_acora__NfaState *__pyx_f_5acora_6_acora_build_NfaState(PyObject *__pyx_v_state_id, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_5acora_6_acora_build_NfaState *__pyx_optional_args) {
  PyObject *__pyx_v_matches = ((PyObject*)Py_None);
  struct __pyx_obj_5acora_6_acora__NfaState *__pyx_v_state = 0;
  struct __pyx_obj_5acora_6_acora__NfaState *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  unsigned long __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("build_NfaState", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_matches = __pyx_optional_args->matches;
    }
  }

  /* "acora/_acora.pyx":96
 * 
 * cpdef _NfaState build_NfaState(state_id, list matches=None):
 *     cdef _NfaState state = _NfaState()             # <<<<<<<<<<<<<<
 *     state.id = state_id
 *     state.matches = [] if matches is None else matches
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5acora_6_acora__NfaState)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_state = ((struct __pyx_obj_5acora_6_acora__NfaState *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "acora/_acora.pyx":97
 * cpdef _NfaState build_NfaState(state_id, list matches=None):
 *     cdef _NfaState state = _NfaState()
 *     state.id = state_id             # <<<<<<<<<<<<<<
 *     state.matches = [] if matches is None else matches
 *     return state
 */
  __pyx_t_2 = __Pyx_PyInt_As_unsigned_long(__pyx_v_state_id); if (unlikely((__pyx_t_2 == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_state->id = __pyx_t_2;

  /* "acora/_acora.pyx":98
 *     cdef _NfaState state = _NfaState()
 *     state.id = state_id
 *     state.matches = [] if matches is None else matches             # <<<<<<<<<<<<<<
 *     return state
 * 
 */
  __pyx_t_3 = (__pyx_v_matches == ((PyObject*)Py_None));
  if ((__pyx_t_3 != 0)) {
    __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = __pyx_t_4;
    __pyx_t_4 = 0;
  } else {
    __Pyx_INCREF(__pyx_v_matches);
    __pyx_t_1 = __pyx_v_matches;
  }
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_state->matches);
  __Pyx_DECREF(__pyx_v_state->matches);
  __pyx_v_state->matches = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "acora/_acora.pyx":99
 *     state.id = state_id
 *     state.matches = [] if matches is None else matches
 *     return state             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_state));
  __pyx_r = __pyx_v_state;
  goto __pyx_L0;

  /* "acora/_acora.pyx":95
 * 
 * 
 * cpdef _NfaState build_NfaState(state_id, list matches=None):             # <<<<<<<<<<<<<<
 *     cdef _NfaState state = _NfaState()
 *     state.id = state_id
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("acora._acora.build_NfaState", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_state);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5acora_6_acora_1build_NfaState(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5acora_6_acora_build_NfaState[] = "build_NfaState(state_id, list matches=None) -> _NfaState";
static PyObject *__pyx_pw_5acora_6_acora_1build_NfaState(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_state_id = 0;
  PyObject *__pyx_v_matches = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("build_NfaState (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_state_id,&__pyx_n_s_matches,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject*)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_state_id)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_matches);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "build_NfaState") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_state_id = values[0];
    __pyx_v_matches = ((PyObject*)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("build_NfaState", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("acora._acora.build_NfaState", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_matches), (&PyList_Type), 1, "matches", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_5acora_6_acora_build_NfaState(__pyx_self, __pyx_v_state_id, __pyx_v_matches);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5acora_6_acora_build_NfaState(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_state_id, PyObject *__pyx_v_matches) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_5acora_6_acora_build_NfaState __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("build_NfaState", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.matches = __pyx_v_matches;
  __pyx_t_1 = ((PyObject *)__pyx_f_5acora_6_acora_build_NfaState(__pyx_v_state_id, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("acora._acora.build_NfaState", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "acora/_acora.pyx":104
 * # Unicode machine
 * 
 * cdef _init_unicode_node(_AcoraUnicodeNodeStruct* c_node, state,             # <<<<<<<<<<<<<<
 *                         list state_transitions,
 *                         _AcoraUnicodeNodeStruct* all_nodes,
 */

static PyObject *__pyx_f_5acora_6_acora__init_unicode_node(__pyx_t_5acora_6_acora__AcoraUnicodeNodeStruct *__pyx_v_c_node, PyObject *__pyx_v_state, PyObject *__pyx_v_state_transitions, __pyx_t_5acora_6_acora__AcoraUnicodeNodeStruct *__pyx_v_all_nodes, PyObject *__pyx_v_node_offsets, PyObject *__pyx_v_pyrefs) {
  CYTHON_UNUSED size_t __pyx_v_targets_mem_size;
  size_t __pyx_v_mem_size;
  Py_ssize_t __pyx_v_i;
  PyObject *__pyx_v_matches = 0;
  PyObject *__pyx_v_characters = 0;
  Py_UCS4 __pyx_v_ch;
  PyObject *__pyx_v_chars = NULL;
  PyObject *__pyx_v_targets = NULL;
  PyObject *__pyx_v_target = NULL;
  Py_UCS4 *__pyx_v_c_characters;
  PyObject *__pyx_v_match = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  size_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  PyObject *(*__pyx_t_9)(PyObject *);
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  Py_ssize_t __pyx_t_12;
  void *__pyx_t_13;
  int __pyx_t_14;
  int __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_init_unicode_node", 0);

  /* "acora/_acora.pyx":114
 *     cdef Py_UCS4 ch
 * 
 *     state_transitions.sort() # sort by characters             # <<<<<<<<<<<<<<
 *     chars, targets = list(zip(*state_transitions))
 *     characters = u''.join(chars)
 */
  if (unlikely(__pyx_v_state_transitions == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "sort");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_1 = PyList_Sort(__pyx_v_state_transitions); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "acora/_acora.pyx":115
 * 
 *     state_transitions.sort() # sort by characters
 *     chars, targets = list(zip(*state_transitions))             # <<<<<<<<<<<<<<
 *     characters = u''.join(chars)
 *     matches = tuple(state.matches) if state.matches else None
 */
  __pyx_t_2 = PySequence_Tuple(__pyx_v_state_transitions); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_zip, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (1) {
    PyObject* sequence = __pyx_t_3;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
    __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_v_chars = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_targets = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "acora/_acora.pyx":116
 *     state_transitions.sort() # sort by characters
 *     chars, targets = list(zip(*state_transitions))
 *     characters = u''.join(chars)             # <<<<<<<<<<<<<<
 *     matches = tuple(state.matches) if state.matches else None
 * 
 */
  __pyx_t_3 = PyUnicode_Join(__pyx_kp_u__2, __pyx_v_chars); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_characters = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "acora/_acora.pyx":117
 *     chars, targets = list(zip(*state_transitions))
 *     characters = u''.join(chars)
 *     matches = tuple(state.matches) if state.matches else None             # <<<<<<<<<<<<<<
 * 
 *     # use a single malloc for targets and match-string pointers
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_state, __pyx_n_s_matches); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_5) {
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_state, __pyx_n_s_matches); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_3 = __pyx_t_4;
    __pyx_t_4 = 0;
  } else {
    __Pyx_INCREF(Py_None);
    __pyx_t_3 = Py_None;
  }
  __pyx_v_matches = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "acora/_acora.pyx":120
 * 
 *     # use a single malloc for targets and match-string pointers
 *     mem_size = targets_mem_size = sizeof(_AcoraUnicodeNodeStruct**) * len(targets)             # <<<<<<<<<<<<<<
 *     if matches:
 *         mem_size += sizeof(PyObject*) * (len(matches) + 1) # NULL terminated
 */
  __pyx_t_6 = PyObject_Length(__pyx_v_targets); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_7 = ((sizeof(__pyx_t_5acora_6_acora__AcoraUnicodeNodeStruct **)) * __pyx_t_6);
  __pyx_v_mem_size = __pyx_t_7;
  __pyx_v_targets_mem_size = __pyx_t_7;

  /* "acora/_acora.pyx":121
 *     # use a single malloc for targets and match-string pointers
 *     mem_size = targets_mem_size = sizeof(_AcoraUnicodeNodeStruct**) * len(targets)
 *     if matches:             # <<<<<<<<<<<<<<
 *         mem_size += sizeof(PyObject*) * (len(matches) + 1) # NULL terminated
 *     mem_size += sizeof(Py_UCS4) * len(characters)
 */
  __pyx_t_5 = (__pyx_v_matches != Py_None) && (PyTuple_GET_SIZE(__pyx_v_matches) != 0);
  if (__pyx_t_5) {

    /* "acora/_acora.pyx":122
 *     mem_size = targets_mem_size = sizeof(_AcoraUnicodeNodeStruct**) * len(targets)
 *     if matches:
 *         mem_size += sizeof(PyObject*) * (len(matches) + 1) # NULL terminated             # <<<<<<<<<<<<<<
 *     mem_size += sizeof(Py_UCS4) * len(characters)
 *     c_node.targets = <_AcoraUnicodeNodeStruct**> cpython.mem.PyMem_Malloc(mem_size)
 */
    if (unlikely(__pyx_v_matches == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_6 = PyTuple_GET_SIZE(__pyx_v_matches); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_mem_size = (__pyx_v_mem_size + ((sizeof(PyObject *)) * (__pyx_t_6 + 1)));
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "acora/_acora.pyx":123
 *     if matches:
 *         mem_size += sizeof(PyObject*) * (len(matches) + 1) # NULL terminated
 *     mem_size += sizeof(Py_UCS4) * len(characters)             # <<<<<<<<<<<<<<
 *     c_node.targets = <_AcoraUnicodeNodeStruct**> cpython.mem.PyMem_Malloc(mem_size)
 *     if c_node.targets is NULL:
 */
  if (unlikely(__pyx_v_characters == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_6 = __Pyx_PyUnicode_GET_LENGTH(__pyx_v_characters); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_mem_size = (__pyx_v_mem_size + ((sizeof(Py_UCS4)) * __pyx_t_6));

  /* "acora/_acora.pyx":124
 *         mem_size += sizeof(PyObject*) * (len(matches) + 1) # NULL terminated
 *     mem_size += sizeof(Py_UCS4) * len(characters)
 *     c_node.targets = <_AcoraUnicodeNodeStruct**> cpython.mem.PyMem_Malloc(mem_size)             # <<<<<<<<<<<<<<
 *     if c_node.targets is NULL:
 *         raise MemoryError()
 */
  __pyx_v_c_node->targets = ((__pyx_t_5acora_6_acora__AcoraUnicodeNodeStruct **)PyMem_Malloc(__pyx_v_mem_size));

  /* "acora/_acora.pyx":125
 *     mem_size += sizeof(Py_UCS4) * len(characters)
 *     c_node.targets = <_AcoraUnicodeNodeStruct**> cpython.mem.PyMem_Malloc(mem_size)
 *     if c_node.targets is NULL:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 * 
 */
  __pyx_t_5 = ((__pyx_v_c_node->targets == NULL) != 0);
  if (__pyx_t_5) {

    /* "acora/_acora.pyx":126
 *     c_node.targets = <_AcoraUnicodeNodeStruct**> cpython.mem.PyMem_Malloc(mem_size)
 *     if c_node.targets is NULL:
 *         raise MemoryError()             # <<<<<<<<<<<<<<
 * 
 *     for i, target in enumerate(targets):
 */
    PyErr_NoMemory(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "acora/_acora.pyx":128
 *         raise MemoryError()
 * 
 *     for i, target in enumerate(targets):             # <<<<<<<<<<<<<<
 *         c_node.targets[i] = all_nodes + <size_t>node_offsets[target]
 * 
 */
  __pyx_t_6 = 0;
  if (PyList_CheckExact(__pyx_v_targets) || PyTuple_CheckExact(__pyx_v_targets)) {
    __pyx_t_3 = __pyx_v_targets; __Pyx_INCREF(__pyx_t_3); __pyx_t_8 = 0;
    __pyx_t_9 = NULL;
  } else {
    __pyx_t_8 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_targets); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_9 = Py_TYPE(__pyx_t_3)->tp_iternext;
  }
  for (;;) {
    if (!__pyx_t_9 && PyList_CheckExact(__pyx_t_3)) {
      if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_3)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else if (!__pyx_t_9 && PyTuple_CheckExact(__pyx_t_3)) {
      if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else {
      __pyx_t_4 = __pyx_t_9(__pyx_t_3);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_target, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_v_i = __pyx_t_6;
    __pyx_t_6 = (__pyx_t_6 + 1);

    /* "acora/_acora.pyx":129
 * 
 *     for i, target in enumerate(targets):
 *         c_node.targets[i] = all_nodes + <size_t>node_offsets[target]             # <<<<<<<<<<<<<<
 * 
 *     if not matches:
 */
    if (unlikely(__pyx_v_node_offsets == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_4 = __Pyx_PyDict_GetItem(__pyx_v_node_offsets, __pyx_v_target); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = __Pyx_PyInt_As_size_t(__pyx_t_4); if (unlikely((__pyx_t_7 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    (__pyx_v_c_node->targets[__pyx_v_i]) = (__pyx_v_all_nodes + ((size_t)__pyx_t_7));
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "acora/_acora.pyx":131
 *         c_node.targets[i] = all_nodes + <size_t>node_offsets[target]
 * 
 *     if not matches:             # <<<<<<<<<<<<<<
 *         c_node.matches = NULL
 *         c_characters = <Py_UCS4*> (c_node.targets + len(targets))
 */
  __pyx_t_5 = (__pyx_v_matches != Py_None) && (PyTuple_GET_SIZE(__pyx_v_matches) != 0);
  __pyx_t_10 = ((!__pyx_t_5) != 0);
  if (__pyx_t_10) {

    /* "acora/_acora.pyx":132
 * 
 *     if not matches:
 *         c_node.matches = NULL             # <<<<<<<<<<<<<<
 *         c_characters = <Py_UCS4*> (c_node.targets + len(targets))
 *     else:
 */
    __pyx_v_c_node->matches = NULL;

    /* "acora/_acora.pyx":133
 *     if not matches:
 *         c_node.matches = NULL
 *         c_characters = <Py_UCS4*> (c_node.targets + len(targets))             # <<<<<<<<<<<<<<
 *     else:
 *         c_node.matches = <PyObject**> (c_node.targets + len(targets))
 */
    __pyx_t_6 = PyObject_Length(__pyx_v_targets); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_c_characters = ((Py_UCS4 *)(__pyx_v_c_node->targets + __pyx_t_6));
    goto __pyx_L7;
  }
  /*else*/ {

    /* "acora/_acora.pyx":135
 *         c_characters = <Py_UCS4*> (c_node.targets + len(targets))
 *     else:
 *         c_node.matches = <PyObject**> (c_node.targets + len(targets))             # <<<<<<<<<<<<<<
 *         matches = _intern(pyrefs, matches)
 *         i = 0
 */
    __pyx_t_6 = PyObject_Length(__pyx_v_targets); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_c_node->matches = ((PyObject **)(__pyx_v_c_node->targets + __pyx_t_6));

    /* "acora/_acora.pyx":136
 *     else:
 *         c_node.matches = <PyObject**> (c_node.targets + len(targets))
 *         matches = _intern(pyrefs, matches)             # <<<<<<<<<<<<<<
 *         i = 0
 *         for match in matches:
 */
    __pyx_t_3 = __pyx_f_5acora_6_acora__intern(__pyx_v_pyrefs, __pyx_v_matches); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF_SET(__pyx_v_matches, ((PyObject*)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "acora/_acora.pyx":137
 *         c_node.matches = <PyObject**> (c_node.targets + len(targets))
 *         matches = _intern(pyrefs, matches)
 *         i = 0             # <<<<<<<<<<<<<<
 *         for match in matches:
 *             c_node.matches[i] = <PyObject*>match
 */
    __pyx_v_i = 0;

    /* "acora/_acora.pyx":138
 *         matches = _intern(pyrefs, matches)
 *         i = 0
 *         for match in matches:             # <<<<<<<<<<<<<<
 *             c_node.matches[i] = <PyObject*>match
 *             i += 1
 */
    if (unlikely(__pyx_v_matches == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_3 = __pyx_v_matches; __Pyx_INCREF(__pyx_t_3); __pyx_t_6 = 0;
    for (;;) {
      if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
      __Pyx_XDECREF_SET(__pyx_v_match, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "acora/_acora.pyx":139
 *         i = 0
 *         for match in matches:
 *             c_node.matches[i] = <PyObject*>match             # <<<<<<<<<<<<<<
 *             i += 1
 *         c_node.matches[i] = NULL
 */
      (__pyx_v_c_node->matches[__pyx_v_i]) = ((PyObject *)__pyx_v_match);

      /* "acora/_acora.pyx":140
 *         for match in matches:
 *             c_node.matches[i] = <PyObject*>match
 *             i += 1             # <<<<<<<<<<<<<<
 *         c_node.matches[i] = NULL
 *         c_characters = <Py_UCS4*> (c_node.matches + i + 1)
 */
      __pyx_v_i = (__pyx_v_i + 1);
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "acora/_acora.pyx":141
 *             c_node.matches[i] = <PyObject*>match
 *             i += 1
 *         c_node.matches[i] = NULL             # <<<<<<<<<<<<<<
 *         c_characters = <Py_UCS4*> (c_node.matches + i + 1)
 * 
 */
    (__pyx_v_c_node->matches[__pyx_v_i]) = NULL;

    /* "acora/_acora.pyx":142
 *             i += 1
 *         c_node.matches[i] = NULL
 *         c_characters = <Py_UCS4*> (c_node.matches + i + 1)             # <<<<<<<<<<<<<<
 * 
 *     for i, ch in enumerate(characters):
 */
    __pyx_v_c_characters = ((Py_UCS4 *)((__pyx_v_c_node->matches + __pyx_v_i) + 1));
  }
  __pyx_L7:;

  /* "acora/_acora.pyx":144
 *         c_characters = <Py_UCS4*> (c_node.matches + i + 1)
 * 
 *     for i, ch in enumerate(characters):             # <<<<<<<<<<<<<<
 *         c_characters[i] = ch
 *     c_node.characters = c_characters
 */
  __pyx_t_6 = 0;
  if (unlikely(__pyx_v_characters == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_INCREF(__pyx_v_characters);
  __pyx_t_11 = __pyx_v_characters;
  __pyx_t_15 = __Pyx_init_unicode_iteration(__pyx_t_11, (&__pyx_t_12), (&__pyx_t_13), (&__pyx_t_14)); if (unlikely(__pyx_t_15 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_12; __pyx_t_16++) {
    __pyx_t_8 = __pyx_t_16;
    __pyx_v_ch = __Pyx_PyUnicode_READ(__pyx_t_14, __pyx_t_13, __pyx_t_8);

    /* "acora/_acora.pyx":145
 * 
 *     for i, ch in enumerate(characters):
 *         c_characters[i] = ch             # <<<<<<<<<<<<<<
 *     c_node.characters = c_characters
 *     c_node.char_count = len(characters)
 */
    __pyx_v_i = __pyx_t_6;

    /* "acora/_acora.pyx":144
 *         c_characters = <Py_UCS4*> (c_node.matches + i + 1)
 * 
 *     for i, ch in enumerate(characters):             # <<<<<<<<<<<<<<
 *         c_characters[i] = ch
 *     c_node.characters = c_characters
 */
    __pyx_t_6 = (__pyx_t_6 + 1);

    /* "acora/_acora.pyx":145
 * 
 *     for i, ch in enumerate(characters):
 *         c_characters[i] = ch             # <<<<<<<<<<<<<<
 *     c_node.characters = c_characters
 *     c_node.char_count = len(characters)
 */
    (__pyx_v_c_characters[__pyx_v_i]) = __pyx_v_ch;
  }
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "acora/_acora.pyx":146
 *     for i, ch in enumerate(characters):
 *         c_characters[i] = ch
 *     c_node.characters = c_characters             # <<<<<<<<<<<<<<
 *     c_node.char_count = len(characters)
 * 
 */
  __pyx_v_c_node->characters = __pyx_v_c_characters;

  /* "acora/_acora.pyx":147
 *         c_characters[i] = ch
 *     c_node.characters = c_characters
 *     c_node.char_count = len(characters)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  if (unlikely(__pyx_v_characters == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_6 = __Pyx_PyUnicode_GET_LENGTH(__pyx_v_characters); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_node->char_count = __pyx_t_6;

  /* "acora/_acora.pyx":104
 * # Unicode machine
 * 
 * cdef _init_unicode_node(_AcoraUnicodeNodeStruct* c_node, state,             # <<<<<<<<<<<<<<
 *                         list state_transitions,
 *                         _AcoraUnicodeNodeStruct* all_nodes,
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("acora._acora._init_unicode_node", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_matches);
  __Pyx_XDECREF(__pyx_v_characters);
  __Pyx_XDECREF(__pyx_v_chars);
  __Pyx_XDECREF(__pyx_v_targets);
  __Pyx_XDECREF(__pyx_v_target);
  __Pyx_XDECREF(__pyx_v_match);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "acora/_acora.pyx":150
 * 
 * 
 * cdef _init_bytes_node(_AcoraBytesNodeStruct* c_node, state,             # <<<<<<<<<<<<<<
 *                       list state_transitions,
 *                       _AcoraBytesNodeStruct* all_nodes,
 */

static PyObject *__pyx_f_5acora_6_acora__init_bytes_node(__pyx_t_5acora_6_acora__AcoraBytesNodeStruct *__pyx_v_c_node, PyObject *__pyx_v_state, PyObject *__pyx_v_state_transitions, __pyx_t_5acora_6_acora__AcoraBytesNodeStruct *__pyx_v_all_nodes, PyObject *__pyx_v_node_offsets, PyObject *__pyx_v_pyrefs) {
  size_t __pyx_v_targets_mem_size;
  size_t __pyx_v_mem_size;
  Py_ssize_t __pyx_v_i;
  PyObject *__pyx_v_characters = NULL;
  PyObject *__pyx_v_targets = NULL;
  PyObject *__pyx_v_target = NULL;
  PyObject *__pyx_v_matches = NULL;
  PyObject *__pyx_v_match = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  unsigned char *__pyx_t_6;
  Py_ssize_t __pyx_t_7;
  size_t __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  PyObject *(*__pyx_t_12)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_init_bytes_node", 0);

  /* "acora/_acora.pyx":157
 *     cdef Py_ssize_t i
 * 
 *     state_transitions.sort() # sort by characters             # <<<<<<<<<<<<<<
 *     characters, targets = list(zip(*state_transitions))
 *     if PY_MAJOR_VERSION >= 3:
 */
  if (unlikely(__pyx_v_state_transitions == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "sort");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_1 = PyList_Sort(__pyx_v_state_transitions); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "acora/_acora.pyx":158
 * 
 *     state_transitions.sort() # sort by characters
 *     characters, targets = list(zip(*state_transitions))             # <<<<<<<<<<<<<<
 *     if PY_MAJOR_VERSION >= 3:
 *         characters = bytes(characters) # items are integers, not byte strings
 */
  __pyx_t_2 = PySequence_Tuple(__pyx_v_state_transitions); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_zip, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (1) {
    PyObject* sequence = __pyx_t_3;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
    __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_v_characters = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_targets = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "acora/_acora.pyx":159
 *     state_transitions.sort() # sort by characters
 *     characters, targets = list(zip(*state_transitions))
 *     if PY_MAJOR_VERSION >= 3:             # <<<<<<<<<<<<<<
 *         characters = bytes(characters) # items are integers, not byte strings
 *     else:
 */
  __pyx_t_5 = ((PY_MAJOR_VERSION >= 3) != 0);
  if (__pyx_t_5) {

    /* "acora/_acora.pyx":160
 *     characters, targets = list(zip(*state_transitions))
 *     if PY_MAJOR_VERSION >= 3:
 *         characters = bytes(characters) # items are integers, not byte strings             # <<<<<<<<<<<<<<
 *     else:
 *         characters = b''.join(characters)
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_characters);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_characters);
    __Pyx_GIVEREF(__pyx_v_characters);
    __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyBytes_Type))), __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_characters, __pyx_t_4);
    __pyx_t_4 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "acora/_acora.pyx":162
 *         characters = bytes(characters) # items are integers, not byte strings
 *     else:
 *         characters = b''.join(characters)             # <<<<<<<<<<<<<<
 *     characters = _intern(pyrefs, characters)
 * 
 */
    __pyx_t_4 = __Pyx_PyBytes_Join(__pyx_kp_b__2, __pyx_v_characters); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v_characters, __pyx_t_4);
    __pyx_t_4 = 0;
  }
  __pyx_L3:;

  /* "acora/_acora.pyx":163
 *     else:
 *         characters = b''.join(characters)
 *     characters = _intern(pyrefs, characters)             # <<<<<<<<<<<<<<
 * 
 *     c_node.characters = characters
 */
  __pyx_t_4 = __pyx_f_5acora_6_acora__intern(__pyx_v_pyrefs, __pyx_v_characters); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF_SET(__pyx_v_characters, __pyx_t_4);
  __pyx_t_4 = 0;

  /* "acora/_acora.pyx":165
 *     characters = _intern(pyrefs, characters)
 * 
 *     c_node.characters = characters             # <<<<<<<<<<<<<<
 *     c_node.char_count = len(characters)
 * 
 */
  __pyx_t_6 = __Pyx_PyObject_AsUString(__pyx_v_characters); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_node->characters = __pyx_t_6;

  /* "acora/_acora.pyx":166
 * 
 *     c_node.characters = characters
 *     c_node.char_count = len(characters)             # <<<<<<<<<<<<<<
 * 
 *     # use a single malloc for targets and match-string pointers
 */
  __pyx_t_7 = PyObject_Length(__pyx_v_characters); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_node->char_count = __pyx_t_7;

  /* "acora/_acora.pyx":169
 * 
 *     # use a single malloc for targets and match-string pointers
 *     mem_size = targets_mem_size = sizeof(_AcoraBytesNodeStruct**) * len(targets)             # <<<<<<<<<<<<<<
 *     if state.matches is not None and len(state.matches) > 0:
 *         mem_size += sizeof(PyObject*) * (len(state.matches) + 1) # NULL terminated
 */
  __pyx_t_7 = PyObject_Length(__pyx_v_targets); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_8 = ((sizeof(__pyx_t_5acora_6_acora__AcoraBytesNodeStruct **)) * __pyx_t_7);
  __pyx_v_mem_size = __pyx_t_8;
  __pyx_v_targets_mem_size = __pyx_t_8;

  /* "acora/_acora.pyx":170
 *     # use a single malloc for targets and match-string pointers
 *     mem_size = targets_mem_size = sizeof(_AcoraBytesNodeStruct**) * len(targets)
 *     if state.matches is not None and len(state.matches) > 0:             # <<<<<<<<<<<<<<
 *         mem_size += sizeof(PyObject*) * (len(state.matches) + 1) # NULL terminated
 *     c_node.targets = <_AcoraBytesNodeStruct**> cpython.mem.PyMem_Malloc(mem_size)
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_state, __pyx_n_s_matches); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = (__pyx_t_4 != Py_None);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if ((__pyx_t_5 != 0)) {
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_state, __pyx_n_s_matches); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_9 = ((__pyx_t_7 > 0) != 0);
    __pyx_t_10 = __pyx_t_9;
  } else {
    __pyx_t_10 = (__pyx_t_5 != 0);
  }
  if (__pyx_t_10) {

    /* "acora/_acora.pyx":171
 *     mem_size = targets_mem_size = sizeof(_AcoraBytesNodeStruct**) * len(targets)
 *     if state.matches is not None and len(state.matches) > 0:
 *         mem_size += sizeof(PyObject*) * (len(state.matches) + 1) # NULL terminated             # <<<<<<<<<<<<<<
 *     c_node.targets = <_AcoraBytesNodeStruct**> cpython.mem.PyMem_Malloc(mem_size)
 *     if c_node.targets is NULL:
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_state, __pyx_n_s_matches); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_mem_size = (__pyx_v_mem_size + ((sizeof(PyObject *)) * (__pyx_t_7 + 1)));
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "acora/_acora.pyx":172
 *     if state.matches is not None and len(state.matches) > 0:
 *         mem_size += sizeof(PyObject*) * (len(state.matches) + 1) # NULL terminated
 *     c_node.targets = <_AcoraBytesNodeStruct**> cpython.mem.PyMem_Malloc(mem_size)             # <<<<<<<<<<<<<<
 *     if c_node.targets is NULL:
 *         raise MemoryError()
 */
  __pyx_v_c_node->targets = ((__pyx_t_5acora_6_acora__AcoraBytesNodeStruct **)PyMem_Malloc(__pyx_v_mem_size));

  /* "acora/_acora.pyx":173
 *         mem_size += sizeof(PyObject*) * (len(state.matches) + 1) # NULL terminated
 *     c_node.targets = <_AcoraBytesNodeStruct**> cpython.mem.PyMem_Malloc(mem_size)
 *     if c_node.targets is NULL:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 * 
 */
  __pyx_t_10 = ((__pyx_v_c_node->targets == NULL) != 0);
  if (__pyx_t_10) {

    /* "acora/_acora.pyx":174
 *     c_node.targets = <_AcoraBytesNodeStruct**> cpython.mem.PyMem_Malloc(mem_size)
 *     if c_node.targets is NULL:
 *         raise MemoryError()             # <<<<<<<<<<<<<<
 * 
 *     for i, target in enumerate(targets):
 */
    PyErr_NoMemory(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "acora/_acora.pyx":176
 *         raise MemoryError()
 * 
 *     for i, target in enumerate(targets):             # <<<<<<<<<<<<<<
 *         c_node.targets[i] = all_nodes + <size_t>node_offsets[target]
 * 
 */
  __pyx_t_7 = 0;
  if (PyList_CheckExact(__pyx_v_targets) || PyTuple_CheckExact(__pyx_v_targets)) {
    __pyx_t_4 = __pyx_v_targets; __Pyx_INCREF(__pyx_t_4); __pyx_t_11 = 0;
    __pyx_t_12 = NULL;
  } else {
    __pyx_t_11 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_targets); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_12 = Py_TYPE(__pyx_t_4)->tp_iternext;
  }
  for (;;) {
    if (!__pyx_t_12 && PyList_CheckExact(__pyx_t_4)) {
      if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_4)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_11); __Pyx_INCREF(__pyx_t_3); __pyx_t_11++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else if (!__pyx_t_12 && PyTuple_CheckExact(__pyx_t_4)) {
      if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_11); __Pyx_INCREF(__pyx_t_3); __pyx_t_11++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else {
      __pyx_t_3 = __pyx_t_12(__pyx_t_4);
      if (unlikely(!__pyx_t_3)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_XDECREF_SET(__pyx_v_target, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_v_i = __pyx_t_7;
    __pyx_t_7 = (__pyx_t_7 + 1);

    /* "acora/_acora.pyx":177
 * 
 *     for i, target in enumerate(targets):
 *         c_node.targets[i] = all_nodes + <size_t>node_offsets[target]             # <<<<<<<<<<<<<<
 * 
 *     if mem_size == targets_mem_size:
 */
    if (unlikely(__pyx_v_node_offsets == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_node_offsets, __pyx_v_target); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = __Pyx_PyInt_As_size_t(__pyx_t_3); if (unlikely((__pyx_t_8 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    (__pyx_v_c_node->targets[__pyx_v_i]) = (__pyx_v_all_nodes + ((size_t)__pyx_t_8));
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "acora/_acora.pyx":179
 *         c_node.targets[i] = all_nodes + <size_t>node_offsets[target]
 * 
 *     if mem_size == targets_mem_size:             # <<<<<<<<<<<<<<
 *         c_node.matches = NULL
 *     else:
 */
  __pyx_t_10 = ((__pyx_v_mem_size == __pyx_v_targets_mem_size) != 0);
  if (__pyx_t_10) {

    /* "acora/_acora.pyx":180
 * 
 *     if mem_size == targets_mem_size:
 *         c_node.matches = NULL             # <<<<<<<<<<<<<<
 *     else:
 *         c_node.matches = <PyObject**> (c_node.targets + len(targets))
 */
    __pyx_v_c_node->matches = NULL;
    goto __pyx_L8;
  }
  /*else*/ {

    /* "acora/_acora.pyx":182
 *         c_node.matches = NULL
 *     else:
 *         c_node.matches = <PyObject**> (c_node.targets + len(targets))             # <<<<<<<<<<<<<<
 *         matches = _intern(pyrefs, tuple(state.matches))
 *         i = 0
 */
    __pyx_t_7 = PyObject_Length(__pyx_v_targets); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_c_node->matches = ((PyObject **)(__pyx_v_c_node->targets + __pyx_t_7));

    /* "acora/_acora.pyx":183
 *     else:
 *         c_node.matches = <PyObject**> (c_node.targets + len(targets))
 *         matches = _intern(pyrefs, tuple(state.matches))             # <<<<<<<<<<<<<<
 *         i = 0
 *         for match in matches:
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_state, __pyx_n_s_matches); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __pyx_f_5acora_6_acora__intern(__pyx_v_pyrefs, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_matches = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "acora/_acora.pyx":184
 *         c_node.matches = <PyObject**> (c_node.targets + len(targets))
 *         matches = _intern(pyrefs, tuple(state.matches))
 *         i = 0             # <<<<<<<<<<<<<<
 *         for match in matches:
 *             c_node.matches[i] = <PyObject*>match
 */
    __pyx_v_i = 0;

    /* "acora/_acora.pyx":185
 *         matches = _intern(pyrefs, tuple(state.matches))
 *         i = 0
 *         for match in matches:             # <<<<<<<<<<<<<<
 *             c_node.matches[i] = <PyObject*>match
 *             i += 1
 */
    if (PyList_CheckExact(__pyx_v_matches) || PyTuple_CheckExact(__pyx_v_matches)) {
      __pyx_t_3 = __pyx_v_matches; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0;
      __pyx_t_12 = NULL;
    } else {
      __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_matches); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_12 = Py_TYPE(__pyx_t_3)->tp_iternext;
    }
    for (;;) {
      if (!__pyx_t_12 && PyList_CheckExact(__pyx_t_3)) {
        if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else if (!__pyx_t_12 && PyTuple_CheckExact(__pyx_t_3)) {
        if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else {
        __pyx_t_4 = __pyx_t_12(__pyx_t_3);
        if (unlikely(!__pyx_t_4)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_4);
      }
      __Pyx_XDECREF_SET(__pyx_v_match, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "acora/_acora.pyx":186
 *         i = 0
 *         for match in matches:
 *             c_node.matches[i] = <PyObject*>match             # <<<<<<<<<<<<<<
 *             i += 1
 *         c_node.matches[i] = NULL
 */
      (__pyx_v_c_node->matches[__pyx_v_i]) = ((PyObject *)__pyx_v_match);

      /* "acora/_acora.pyx":187
 *         for match in matches:
 *             c_node.matches[i] = <PyObject*>match
 *             i += 1             # <<<<<<<<<<<<<<
 *         c_node.matches[i] = NULL
 * 
 */
      __pyx_v_i = (__pyx_v_i + 1);
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "acora/_acora.pyx":188
 *             c_node.matches[i] = <PyObject*>match
 *             i += 1
 *         c_node.matches[i] = NULL             # <<<<<<<<<<<<<<
 * 
 * 
 */
    (__pyx_v_c_node->matches[__pyx_v_i]) = NULL;
  }
  __pyx_L8:;

  /* "acora/_acora.pyx":150
 * 
 * 
 * cdef _init_bytes_node(_AcoraBytesNodeStruct* c_node, state,             # <<<<<<<<<<<<<<
 *                       list state_transitions,
 *                       _AcoraBytesNodeStruct* all_nodes,
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("acora._acora._init_bytes_node", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_characters);
  __Pyx_XDECREF(__pyx_v_targets);
  __Pyx_XDECREF(__pyx_v_target);
  __Pyx_XDECREF(__pyx_v_matches);
  __Pyx_XDECREF(__pyx_v_match);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "acora/_acora.pyx":191
 * 
 * 
 * cdef inline _intern(dict d, obj):             # <<<<<<<<<<<<<<
 *     if obj in d:
 *         return d[obj]
 */

static CYTHON_INLINE PyObject *__pyx_f_5acora_6_acora__intern(PyObject *__pyx_v_d, PyObject *__pyx_v_obj) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_intern", 0);

  /* "acora/_acora.pyx":192
 * 
 * cdef inline _intern(dict d, obj):
 *     if obj in d:             # <<<<<<<<<<<<<<
 *         return d[obj]
 *     d[obj] = obj
 */
  if (unlikely(__pyx_v_d == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_1 = (__Pyx_PyDict_Contains(__pyx_v_obj, __pyx_v_d, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "acora/_acora.pyx":193
 * cdef inline _intern(dict d, obj):
 *     if obj in d:
 *         return d[obj]             # <<<<<<<<<<<<<<
 *     d[obj] = obj
 *     return obj
 */
    __Pyx_XDECREF(__pyx_r);
    if (unlikely(__pyx_v_d == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_d, __pyx_v_obj); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "acora/_acora.pyx":194
 *     if obj in d:
 *         return d[obj]
 *     d[obj] = obj             # <<<<<<<<<<<<<<
 *     return obj
 * 
 */
  if (unlikely(__pyx_v_d == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  if (unlikely(PyDict_SetItem(__pyx_v_d, __pyx_v_obj, __pyx_v_obj) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "acora/_acora.pyx":195
 *         return d[obj]
 *     d[obj] = obj
 *     return obj             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_obj);
  __pyx_r = __pyx_v_obj;
  goto __pyx_L0;

  /* "acora/_acora.pyx":191
 * 
 * 
 * cdef inline _intern(dict d, obj):             # <<<<<<<<<<<<<<
 *     if obj in d:
 *         return d[obj]
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("acora._acora._intern", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "acora/_acora.pyx":198
 * 
 * 
 * cdef dict group_transitions_by_state(dict transitions):             # <<<<<<<<<<<<<<
 *     transitions_by_state = {}
 *     for (state, character), target in transitions.iteritems():
 */

static PyObject *__pyx_f_5acora_6_acora_group_transitions_by_state(PyObject *__pyx_v_transitions) {
  PyObject *__pyx_v_transitions_by_state = NULL;
  PyObject *__pyx_v_state = NULL;
  PyObject *__pyx_v_character = NULL;
  PyObject *__pyx_v_target = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *(*__pyx_t_11)(PyObject *);
  int __pyx_t_12;
  int __pyx_t_13;
  int __pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("group_transitions_by_state", 0);

  /* "acora/_acora.pyx":199
 * 
 * cdef dict group_transitions_by_state(dict transitions):
 *     transitions_by_state = {}             # <<<<<<<<<<<<<<
 *     for (state, character), target in transitions.iteritems():
 *         if state in transitions_by_state:
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_transitions_by_state = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "acora/_acora.pyx":200
 * cdef dict group_transitions_by_state(dict transitions):
 *     transitions_by_state = {}
 *     for (state, character), target in transitions.iteritems():             # <<<<<<<<<<<<<<
 *         if state in transitions_by_state:
 *             transitions_by_state[state].append((character, target))
 */
  __pyx_t_2 = 0;
  if (unlikely(__pyx_v_transitions == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "iteritems");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_transitions, 1, __pyx_n_s_iteritems, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = __pyx_t_5;
  __pyx_t_5 = 0;
  while (1) {
    __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, &__pyx_t_5, &__pyx_t_6, NULL, __pyx_t_4);
    if (unlikely(__pyx_t_7 == 0)) break;
    if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GOTREF(__pyx_t_6);
    if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
      PyObject* sequence = __pyx_t_5;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_8 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_9 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_9);
      #else
      __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      #endif
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_10 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext;
      index = 0; __pyx_t_8 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_8)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_8);
      index = 1; __pyx_t_9 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_9);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_11 = NULL;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      goto __pyx_L6_unpacking_done;
      __pyx_L5_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_11 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L6_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_state, __pyx_t_8);
    __pyx_t_8 = 0;
    __Pyx_XDECREF_SET(__pyx_v_character, __pyx_t_9);
    __pyx_t_9 = 0;
    __Pyx_XDECREF_SET(__pyx_v_target, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "acora/_acora.pyx":201
 *     transitions_by_state = {}
 *     for (state, character), target in transitions.iteritems():
 *         if state in transitions_by_state:             # <<<<<<<<<<<<<<
 *             transitions_by_state[state].append((character, target))
 *         else:
 */
    __pyx_t_12 = (__Pyx_PyDict_Contains(__pyx_v_state, __pyx_v_transitions_by_state, Py_EQ)); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_13 = (__pyx_t_12 != 0);
    if (__pyx_t_13) {

      /* "acora/_acora.pyx":202
 *     for (state, character), target in transitions.iteritems():
 *         if state in transitions_by_state:
 *             transitions_by_state[state].append((character, target))             # <<<<<<<<<<<<<<
 *         else:
 *             transitions_by_state[state] = [(character, target)]
 */
      __pyx_t_6 = __Pyx_PyDict_GetItem(__pyx_v_transitions_by_state, __pyx_v_state); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_v_character);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_character);
      __Pyx_GIVEREF(__pyx_v_character);
      __Pyx_INCREF(__pyx_v_target);
      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_target);
      __Pyx_GIVEREF(__pyx_v_target);
      __pyx_t_14 = __Pyx_PyObject_Append(__pyx_t_6, __pyx_t_5); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L7;
    }
    /*else*/ {

      /* "acora/_acora.pyx":204
 *             transitions_by_state[state].append((character, target))
 *         else:
 *             transitions_by_state[state] = [(character, target)]             # <<<<<<<<<<<<<<
 *     #_dump_transitions(transitions_by_state)
 *     return transitions_by_state
 */
      __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_v_character);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_character);
      __Pyx_GIVEREF(__pyx_v_character);
      __Pyx_INCREF(__pyx_v_target);
      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_target);
      __Pyx_GIVEREF(__pyx_v_target);
      __pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      PyList_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_5);
      __pyx_t_5 = 0;
      if (unlikely(PyDict_SetItem(__pyx_v_transitions_by_state, __pyx_v_state, __pyx_t_6) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __pyx_L7:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "acora/_acora.pyx":206
 *             transitions_by_state[state] = [(character, target)]
 *     #_dump_transitions(transitions_by_state)
 *     return transitions_by_state             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_transitions_by_state);
  __pyx_r = __pyx_v_transitions_by_state;
  goto __pyx_L0;

  /* "acora/_acora.pyx":198
 * 
 * 
 * cdef dict group_transitions_by_state(dict transitions):             # <<<<<<<<<<<<<<
 *     transitions_by_state = {}
 *     for (state, character), target in transitions.iteritems():
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("acora._acora.group_transitions_by_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_transitions_by_state);
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v_character);
  __Pyx_XDECREF(__pyx_v_target);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "acora/_acora.pyx":243
 *     cdef tuple _pyrefs
 * 
 *     def __cinit__(self, start_state, dict transitions not None):             # <<<<<<<<<<<<<<
 *         cdef _AcoraUnicodeNodeStruct* c_nodes
 *         cdef Py_ssize_t i
 */

/* Python wrapper */
static int __pyx_pw_5acora_6_acora_12UnicodeAcora_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5acora_6_acora_12UnicodeAcora_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_start_state = 0;
  PyObject *__pyx_v_transitions = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_start_state,&__pyx_n_s_transitions,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_start_state)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_transitions)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_start_state = values[0];
    __pyx_v_transitions = ((PyObject*)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("acora._acora.UnicodeAcora.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_transitions), (&PyDict_Type), 0, "transitions", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_5acora_6_acora_12UnicodeAcora___cinit__(((struct __pyx_obj_5acora_6_acora_UnicodeAcora *)__pyx_v_self), __pyx_v_start_state, __pyx_v_transitions);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5acora_6_acora_12UnicodeAcora___cinit__(struct __pyx_obj_5acora_6_acora_UnicodeAcora *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_start_state, PyObject *__pyx_v_transitions) {
  __pyx_t_5acora_6_acora__AcoraUnicodeNodeStruct *__pyx_v_c_nodes;
  Py_ssize_t __pyx_v_i;
  PyObject *__pyx_v_states = NULL;
  PyObject *__pyx_v_node_offsets = NULL;
  PyObject *__pyx_v_pyrefs = NULL;
  PyObject *__pyx_v_state = NULL;
  PyObject *__pyx_v_state_transitions = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  __pyx_t_5acora_6_acora__AcoraUnicodeNodeStruct *__pyx_t_4;
  int __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *(*__pyx_t_11)(PyObject *);
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "acora/_acora.pyx":246
 *         cdef _AcoraUnicodeNodeStruct* c_nodes
 *         cdef Py_ssize_t i
 *         self.start_node = NULL             # <<<<<<<<<<<<<<
 *         # sort states by id (start state first)
 *         states = list(enumerate(
 */
  __pyx_v_self->start_node = NULL;

  /* "acora/_acora.pyx":249
 *         # sort states by id (start state first)
 *         states = list(enumerate(
 *             sorted(group_transitions_by_state(transitions).items())))             # <<<<<<<<<<<<<<
 * 
 *         self.node_count = len(states)
 */
  __pyx_t_1 = __pyx_f_5acora_6_acora_group_transitions_by_state(__pyx_v_transitions); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "items");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_2 = __Pyx_PyDict_Items(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_sorted, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "acora/_acora.pyx":248
 *         self.start_node = NULL
 *         # sort states by id (start state first)
 *         states = list(enumerate(             # <<<<<<<<<<<<<<
 *             sorted(group_transitions_by_state(transitions).items())))
 * 
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_enumerate, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_states = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "acora/_acora.pyx":251
 *             sorted(group_transitions_by_state(transitions).items())))
 * 
 *         self.node_count = len(states)             # <<<<<<<<<<<<<<
 *         c_nodes = self.start_node = <_AcoraUnicodeNodeStruct*> cpython.mem.PyMem_Malloc(
 *             sizeof(_AcoraUnicodeNodeStruct) * self.node_count)
 */
  __pyx_t_3 = PyList_GET_SIZE(__pyx_v_states); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_self->node_count = __pyx_t_3;

  /* "acora/_acora.pyx":252
 * 
 *         self.node_count = len(states)
 *         c_nodes = self.start_node = <_AcoraUnicodeNodeStruct*> cpython.mem.PyMem_Malloc(             # <<<<<<<<<<<<<<
 *             sizeof(_AcoraUnicodeNodeStruct) * self.node_count)
 *         if c_nodes is NULL:
 */
  __pyx_t_4 = ((__pyx_t_5acora_6_acora__AcoraUnicodeNodeStruct *)PyMem_Malloc(((sizeof(__pyx_t_5acora_6_acora__AcoraUnicodeNodeStruct)) * __pyx_v_self->node_count)));
  __pyx_v_c_nodes = __pyx_t_4;
  __pyx_v_self->start_node = __pyx_t_4;

  /* "acora/_acora.pyx":254
 *         c_nodes = self.start_node = <_AcoraUnicodeNodeStruct*> cpython.mem.PyMem_Malloc(
 *             sizeof(_AcoraUnicodeNodeStruct) * self.node_count)
 *         if c_nodes is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 * 
 */
  __pyx_t_5 = ((__pyx_v_c_nodes == NULL) != 0);
  if (__pyx_t_5) {

    /* "acora/_acora.pyx":255
 *             sizeof(_AcoraUnicodeNodeStruct) * self.node_count)
 *         if c_nodes is NULL:
 *             raise MemoryError()             # <<<<<<<<<<<<<<
 * 
 *         for i in range(self.node_count):
 */
    PyErr_NoMemory(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "acora/_acora.pyx":257
 *             raise MemoryError()
 * 
 *         for i in range(self.node_count):             # <<<<<<<<<<<<<<
 *             # required by __dealloc__ in case of subsequent errors
 *             c_nodes[i].targets = NULL
 */
  __pyx_t_3 = __pyx_v_self->node_count;
  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_3; __pyx_t_6+=1) {
    __pyx_v_i = __pyx_t_6;

    /* "acora/_acora.pyx":259
 *         for i in range(self.node_count):
 *             # required by __dealloc__ in case of subsequent errors
 *             c_nodes[i].targets = NULL             # <<<<<<<<<<<<<<
 * 
 *         node_offsets = dict([
 */
    (__pyx_v_c_nodes[__pyx_v_i]).targets = NULL;
  }

  /* "acora/_acora.pyx":261
 *             c_nodes[i].targets = NULL
 * 
 *         node_offsets = dict([             # <<<<<<<<<<<<<<
 *             (state, i) for i, (state, state_transitions) in states])
 *         pyrefs = {} # used to keep Python references alive (and intern them)
 */
  { /* enter inner scope */
    Py_ssize_t __pyx_8genexpr1__pyx_v_i;
    PyObject *__pyx_8genexpr1__pyx_v_state = NULL;
    CYTHON_UNUSED PyObject *__pyx_8genexpr1__pyx_v_state_transitions = NULL;
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
    __Pyx_GOTREF(__pyx_t_2);

    /* "acora/_acora.pyx":262
 * 
 *         node_offsets = dict([
 *             (state, i) for i, (state, state_transitions) in states])             # <<<<<<<<<<<<<<
 *         pyrefs = {} # used to keep Python references alive (and intern them)
 *         for i, (state, state_transitions) in states:
 */
    __pyx_t_1 = __pyx_v_states; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
    for (;;) {
      if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_7 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_7); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
      #else
      __pyx_t_7 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
      #endif
      if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) {
        PyObject* sequence = __pyx_t_7;
        #if CYTHON_COMPILING_IN_CPYTHON
        Py_ssize_t size = Py_SIZE(sequence);
        #else
        Py_ssize_t size = PySequence_Size(sequence);
        #endif
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
        }
        #if CYTHON_COMPILING_IN_CPYTHON
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          __pyx_t_8 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_9 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_9);
        #else
        __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
        __Pyx_GOTREF(__pyx_t_9);
        #endif
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_10 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext;
        index = 0; __pyx_t_8 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_8)) goto __pyx_L11_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_8);
        index = 1; __pyx_t_9 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L11_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_9);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
        __pyx_t_11 = NULL;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        goto __pyx_L12_unpacking_done;
        __pyx_L11_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_11 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
        __pyx_L12_unpacking_done:;
      }
      __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_8genexpr1__pyx_v_i = __pyx_t_6;
      if ((likely(PyTuple_CheckExact(__pyx_t_9))) || (PyList_CheckExact(__pyx_t_9))) {
        PyObject* sequence = __pyx_t_9;
        #if CYTHON_COMPILING_IN_CPYTHON
        Py_ssize_t size = Py_SIZE(sequence);
        #else
        Py_ssize_t size = PySequence_Size(sequence);
        #endif
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
        }
        #if CYTHON_COMPILING_IN_CPYTHON
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_10 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_12 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          __pyx_t_10 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_12 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(__pyx_t_12);
        #else
        __pyx_t_10 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_12 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
        __Pyx_GOTREF(__pyx_t_12);
        #endif
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_13 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
        __Pyx_GOTREF(__pyx_t_13);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_11 = Py_TYPE(__pyx_t_13)->tp_iternext;
        index = 0; __pyx_t_10 = __pyx_t_11(__pyx_t_13); if (unlikely(!__pyx_t_10)) goto __pyx_L13_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_10);
        index = 1; __pyx_t_12 = __pyx_t_11(__pyx_t_13); if (unlikely(!__pyx_t_12)) goto __pyx_L13_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_12);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_13), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
        __pyx_t_11 = NULL;
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        goto __pyx_L14_unpacking_done;
        __pyx_L13_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __pyx_t_11 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
        __pyx_L14_unpacking_done:;
      }
      __Pyx_XDECREF_SET(__pyx_8genexpr1__pyx_v_state, __pyx_t_10);
      __pyx_t_10 = 0;
      __Pyx_XDECREF_SET(__pyx_8genexpr1__pyx_v_state_transitions, __pyx_t_12);
      __pyx_t_12 = 0;
      __pyx_t_7 = PyInt_FromSsize_t(__pyx_8genexpr1__pyx_v_i); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_8genexpr1__pyx_v_state);
      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_8genexpr1__pyx_v_state);
      __Pyx_GIVEREF(__pyx_8genexpr1__pyx_v_state);
      PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_7);
      __pyx_t_7 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_9))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_state);
    __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_state_transitions);
    goto __pyx_L15_exit_scope;
    __pyx_L8_error:;
    __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_state);
    __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_state_transitions);
    goto __pyx_L1_error;
    __pyx_L15_exit_scope:;
  } /* exit inner scope */

  /* "acora/_acora.pyx":261
 *             c_nodes[i].targets = NULL
 * 
 *         node_offsets = dict([             # <<<<<<<<<<<<<<
 *             (state, i) for i, (state, state_transitions) in states])
 *         pyrefs = {} # used to keep Python references alive (and intern them)
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyDict_Type))), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_node_offsets = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "acora/_acora.pyx":263
 *         node_offsets = dict([
 *             (state, i) for i, (state, state_transitions) in states])
 *         pyrefs = {} # used to keep Python references alive (and intern them)             # <<<<<<<<<<<<<<
 *         for i, (state, state_transitions) in states:
 *             _init_unicode_node(&c_nodes[i], state, state_transitions,
 */
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_pyrefs = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "acora/_acora.pyx":264
 *             (state, i) for i, (state, state_transitions) in states])
 *         pyrefs = {} # used to keep Python references alive (and intern them)
 *         for i, (state, state_transitions) in states:             # <<<<<<<<<<<<<<
 *             _init_unicode_node(&c_nodes[i], state, state_transitions,
 *                                c_nodes, node_offsets, pyrefs)
 */
  __pyx_t_2 = __pyx_v_states; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
  for (;;) {
    if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #else
    __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
      PyObject* sequence = __pyx_t_1;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_9 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_7 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_7);
      #else
      __pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_8 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_11 = Py_TYPE(__pyx_t_8)->tp_iternext;
      index = 0; __pyx_t_9 = __pyx_t_11(__pyx_t_8); if (unlikely(!__pyx_t_9)) goto __pyx_L18_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_9);
      index = 1; __pyx_t_7 = __pyx_t_11(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L18_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_8), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_11 = NULL;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L19_unpacking_done;
      __pyx_L18_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_11 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L19_unpacking_done:;
    }
    __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_v_i = __pyx_t_6;
    if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) {
      PyObject* sequence = __pyx_t_7;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_12 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_8 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_12 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_12);
      #else
      __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_12 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_12);
      #endif
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_10 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext;
      index = 0; __pyx_t_8 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_8)) goto __pyx_L20_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_8);
      index = 1; __pyx_t_12 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_12)) goto __pyx_L20_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_12);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_11 = NULL;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      goto __pyx_L21_unpacking_done;
      __pyx_L20_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_11 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L21_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_state, __pyx_t_8);
    __pyx_t_8 = 0;
    __Pyx_XDECREF_SET(__pyx_v_state_transitions, __pyx_t_12);
    __pyx_t_12 = 0;

    /* "acora/_acora.pyx":265
 *         pyrefs = {} # used to keep Python references alive (and intern them)
 *         for i, (state, state_transitions) in states:
 *             _init_unicode_node(&c_nodes[i], state, state_transitions,             # <<<<<<<<<<<<<<
 *                                c_nodes, node_offsets, pyrefs)
 * 
 */
    if (!(likely(PyList_CheckExact(__pyx_v_state_transitions))||((__pyx_v_state_transitions) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_v_state_transitions)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "acora/_acora.pyx":266
 *         for i, (state, state_transitions) in states:
 *             _init_unicode_node(&c_nodes[i], state, state_transitions,
 *                                c_nodes, node_offsets, pyrefs)             # <<<<<<<<<<<<<<
 * 
 *         self._pyrefs = tuple(pyrefs)
 */
    __pyx_t_1 = __pyx_f_5acora_6_acora__init_unicode_node((&(__pyx_v_c_nodes[__pyx_v_i])), __pyx_v_state, ((PyObject*)__pyx_v_state_transitions), __pyx_v_c_nodes, __pyx_v_node_offsets, __pyx_v_pyrefs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "acora/_acora.pyx":268
 *                                c_nodes, node_offsets, pyrefs)
 * 
 *         self._pyrefs = tuple(pyrefs)             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_pyrefs);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_pyrefs);
  __Pyx_GIVEREF(__pyx_v_pyrefs);
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_pyrefs);
  __Pyx_DECREF(__pyx_v_self->_pyrefs);
  __pyx_v_self->_pyrefs = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "acora/_acora.pyx":243
 *     cdef tuple _pyrefs
 * 
 *     def __cinit__(self, start_state, dict transitions not None):             # <<<<<<<<<<<<<<
 *         cdef _AcoraUnicodeNodeStruct* c_nodes
 *         cdef Py_ssize_t i
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("acora._acora.UnicodeAcora.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_states);
  __Pyx_XDECREF(__pyx_v_node_offsets);
  __Pyx_XDECREF(__pyx_v_pyrefs);
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v_state_transitions);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "acora/_acora.pyx":270
 *         self._pyrefs = tuple(pyrefs)
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t i
 *         if self.start_node is not NULL:
 */

/* Python wrapper */
static void __pyx_pw_5acora_6_acora_12UnicodeAcora_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_5acora_6_acora_12UnicodeAcora_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_5acora_6_acora_12UnicodeAcora_2__dealloc__(((struct __pyx_obj_5acora_6_acora_UnicodeAcora *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_5acora_6_acora_12UnicodeAcora_2__dealloc__(struct __pyx_obj_5acora_6_acora_UnicodeAcora *__pyx_v_self) {
  Py_ssize_t __pyx_v_i;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "acora/_acora.pyx":272
 *     def __dealloc__(self):
 *         cdef Py_ssize_t i
 *         if self.start_node is not NULL:             # <<<<<<<<<<<<<<
 *             for i in range(self.node_count):
 *                 if self.start_node[i].targets is not NULL:
 */
  __pyx_t_1 = ((__pyx_v_self->start_node != NULL) != 0);
  if (__pyx_t_1) {

    /* "acora/_acora.pyx":273
 *         cdef Py_ssize_t i
 *         if self.start_node is not NULL:
 *             for i in range(self.node_count):             # <<<<<<<<<<<<<<
 *                 if self.start_node[i].targets is not NULL:
 *                     cpython.mem.PyMem_Free(self.start_node[i].targets)
 */
    __pyx_t_2 = __pyx_v_self->node_count;
    for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
      __pyx_v_i = __pyx_t_3;

      /* "acora/_acora.pyx":274
 *         if self.start_node is not NULL:
 *             for i in range(self.node_count):
 *                 if self.start_node[i].targets is not NULL:             # <<<<<<<<<<<<<<
 *                     cpython.mem.PyMem_Free(self.start_node[i].targets)
 *             cpython.mem.PyMem_Free(self.start_node)
 */
      __pyx_t_1 = (((__pyx_v_self->start_node[__pyx_v_i]).targets != NULL) != 0);
      if (__pyx_t_1) {

        /* "acora/_acora.pyx":275
 *             for i in range(self.node_count):
 *                 if self.start_node[i].targets is not NULL:
 *                     cpython.mem.PyMem_Free(self.start_node[i].targets)             # <<<<<<<<<<<<<<
 *             cpython.mem.PyMem_Free(self.start_node)
 * 
 */
        PyMem_Free((__pyx_v_self->start_node[__pyx_v_i]).targets);
        goto __pyx_L6;
      }
      __pyx_L6:;
    }

    /* "acora/_acora.pyx":276
 *                 if self.start_node[i].targets is not NULL:
 *                     cpython.mem.PyMem_Free(self.start_node[i].targets)
 *             cpython.mem.PyMem_Free(self.start_node)             # <<<<<<<<<<<<<<
 * 
 *     def __reduce__(self):
 */
    PyMem_Free(__pyx_v_self->start_node);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "acora/_acora.pyx":270
 *         self._pyrefs = tuple(pyrefs)
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t i
 *         if self.start_node is not NULL:
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "acora/_acora.pyx":278
 *             cpython.mem.PyMem_Free(self.start_node)
 * 
 *     def __reduce__(self):             # <<<<<<<<<<<<<<
 *         """pickle"""
 *         cdef _AcoraUnicodeNodeStruct* c_node
 */

/* Python wrapper */
static PyObject *__pyx_pw_5acora_6_acora_12UnicodeAcora_5__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5acora_6_acora_12UnicodeAcora_4__reduce__[] = "UnicodeAcora.__reduce__(self)\npickle";
static PyObject *__pyx_pw_5acora_6_acora_12UnicodeAcora_5__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5acora_6_acora_12UnicodeAcora_4__reduce__(((struct __pyx_obj_5acora_6_acora_UnicodeAcora *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5acora_6_acora_12UnicodeAcora_4__reduce__(struct __pyx_obj_5acora_6_acora_UnicodeAcora *__pyx_v_self) {
  __pyx_t_5acora_6_acora__AcoraUnicodeNodeStruct *__pyx_v_c_node;
  PyObject *__pyx_v_states = NULL;
  ptrdiff_t __pyx_v_state_id;
  PyObject *__pyx_v_state = NULL;
  PyObject **__pyx_v_match;
  PyObject *__pyx_v_transitions = NULL;
  int __pyx_v_i;
  PyObject *__pyx_v_ch = NULL;
  ptrdiff_t __pyx_v_target_id;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __pyx_t_5acora_6_acora__AcoraUnicodeNodeStruct *__pyx_t_2;
  __pyx_t_5acora_6_acora__AcoraUnicodeNodeStruct *__pyx_t_3;
  __pyx_t_5acora_6_acora__AcoraUnicodeNodeStruct *__pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject **__pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce__", 0);

  /* "acora/_acora.pyx":281
 *         """pickle"""
 *         cdef _AcoraUnicodeNodeStruct* c_node
 *         states = {}             # <<<<<<<<<<<<<<
 *         for c_node in self.start_node[:self.node_count]:
 *             state_id = c_node - self.start_node
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_states = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "acora/_acora.pyx":282
 *         cdef _AcoraUnicodeNodeStruct* c_node
 *         states = {}
 *         for c_node in self.start_node[:self.node_count]:             # <<<<<<<<<<<<<<
 *             state_id = c_node - self.start_node
 *             state = states[state_id] = build_NfaState(state_id)
 */
  __pyx_t_3 = (__pyx_v_self->start_node + __pyx_v_self->node_count);
  for (__pyx_t_4 = __pyx_v_self->start_node; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
    __pyx_t_2 = __pyx_t_4;
    __pyx_v_c_node = __pyx_t_2;

    /* "acora/_acora.pyx":283
 *         states = {}
 *         for c_node in self.start_node[:self.node_count]:
 *             state_id = c_node - self.start_node             # <<<<<<<<<<<<<<
 *             state = states[state_id] = build_NfaState(state_id)
 *             if c_node.matches:
 */
    __pyx_v_state_id = (__pyx_v_c_node - __pyx_v_self->start_node);

    /* "acora/_acora.pyx":284
 *         for c_node in self.start_node[:self.node_count]:
 *             state_id = c_node - self.start_node
 *             state = states[state_id] = build_NfaState(state_id)             # <<<<<<<<<<<<<<
 *             if c_node.matches:
 *                 match = c_node.matches
 */
    __pyx_t_1 = __Pyx_PyInt_From_ptrdiff_t(__pyx_v_state_id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = ((PyObject *)__pyx_f_5acora_6_acora_build_NfaState(__pyx_t_1, 0, NULL)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_XDECREF_SET(__pyx_v_state, __pyx_t_5);
    __pyx_t_1 = __Pyx_PyInt_From_ptrdiff_t(__pyx_v_state_id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (unlikely(PyDict_SetItem(__pyx_v_states, __pyx_t_1, __pyx_t_5) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "acora/_acora.pyx":285
 *             state_id = c_node - self.start_node
 *             state = states[state_id] = build_NfaState(state_id)
 *             if c_node.matches:             # <<<<<<<<<<<<<<
 *                 match = c_node.matches
 *                 while match[0]:
 */
    __pyx_t_6 = (__pyx_v_c_node->matches != 0);
    if (__pyx_t_6) {

      /* "acora/_acora.pyx":286
 *             state = states[state_id] = build_NfaState(state_id)
 *             if c_node.matches:
 *                 match = c_node.matches             # <<<<<<<<<<<<<<
 *                 while match[0]:
 *                     state.matches.append(<unicode>match[0])
 */
      __pyx_t_7 = __pyx_v_c_node->matches;
      __pyx_v_match = __pyx_t_7;

      /* "acora/_acora.pyx":287
 *             if c_node.matches:
 *                 match = c_node.matches
 *                 while match[0]:             # <<<<<<<<<<<<<<
 *                     state.matches.append(<unicode>match[0])
 *                     match += 1
 */
      while (1) {
        __pyx_t_6 = ((__pyx_v_match[0]) != 0);
        if (!__pyx_t_6) break;

        /* "acora/_acora.pyx":288
 *                 match = c_node.matches
 *                 while match[0]:
 *                     state.matches.append(<unicode>match[0])             # <<<<<<<<<<<<<<
 *                     match += 1
 * 
 */
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_state, __pyx_n_s_matches); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_8 = __Pyx_PyObject_Append(__pyx_t_5, ((PyObject *)(__pyx_v_match[0]))); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "acora/_acora.pyx":289
 *                 while match[0]:
 *                     state.matches.append(<unicode>match[0])
 *                     match += 1             # <<<<<<<<<<<<<<
 * 
 *         transitions = {}
 */
        __pyx_v_match = (__pyx_v_match + 1);
      }
      goto __pyx_L5;
    }
    __pyx_L5:;
  }

  /* "acora/_acora.pyx":291
 *                     match += 1
 * 
 *         transitions = {}             # <<<<<<<<<<<<<<
 *         for c_node in self.start_node[:self.node_count]:
 *             state_id = c_node - self.start_node
 */
  __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_v_transitions = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "acora/_acora.pyx":292
 * 
 *         transitions = {}
 *         for c_node in self.start_node[:self.node_count]:             # <<<<<<<<<<<<<<
 *             state_id = c_node - self.start_node
 *             state = states[state_id]
 */
  __pyx_t_3 = (__pyx_v_self->start_node + __pyx_v_self->node_count);
  for (__pyx_t_4 = __pyx_v_self->start_node; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
    __pyx_t_2 = __pyx_t_4;
    __pyx_v_c_node = __pyx_t_2;

    /* "acora/_acora.pyx":293
 *         transitions = {}
 *         for c_node in self.start_node[:self.node_count]:
 *             state_id = c_node - self.start_node             # <<<<<<<<<<<<<<
 *             state = states[state_id]
 *             for i in range(c_node.char_count):
 */
    __pyx_v_state_id = (__pyx_v_c_node - __pyx_v_self->start_node);

    /* "acora/_acora.pyx":294
 *         for c_node in self.start_node[:self.node_count]:
 *             state_id = c_node - self.start_node
 *             state = states[state_id]             # <<<<<<<<<<<<<<
 *             for i in range(c_node.char_count):
 *                 ch = <unicode>c_node.characters[i]
 */
    __pyx_t_5 = __Pyx_PyInt_From_ptrdiff_t(__pyx_v_state_id); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_states, __pyx_t_5); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_state, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "acora/_acora.pyx":295
 *             state_id = c_node - self.start_node
 *             state = states[state_id]
 *             for i in range(c_node.char_count):             # <<<<<<<<<<<<<<
 *                 ch = <unicode>c_node.characters[i]
 *                 target_id = c_node.targets[i] - self.start_node
 */
    __pyx_t_9 = __pyx_v_c_node->char_count;
    for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
      __pyx_v_i = __pyx_t_10;

      /* "acora/_acora.pyx":296
 *             state = states[state_id]
 *             for i in range(c_node.char_count):
 *                 ch = <unicode>c_node.characters[i]             # <<<<<<<<<<<<<<
 *                 target_id = c_node.targets[i] - self.start_node
 *                 transitions[(state, ch)] = states[target_id]
 */
      __pyx_t_1 = PyUnicode_FromOrdinal((__pyx_v_c_node->characters[__pyx_v_i])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_5 = __pyx_t_1;
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF_SET(__pyx_v_ch, ((PyObject*)__pyx_t_5));
      __pyx_t_5 = 0;

      /* "acora/_acora.pyx":297
 *             for i in range(c_node.char_count):
 *                 ch = <unicode>c_node.characters[i]
 *                 target_id = c_node.targets[i] - self.start_node             # <<<<<<<<<<<<<<
 *                 transitions[(state, ch)] = states[target_id]
 * 
 */
      __pyx_v_target_id = ((__pyx_v_c_node->targets[__pyx_v_i]) - __pyx_v_self->start_node);

      /* "acora/_acora.pyx":298
 *                 ch = <unicode>c_node.characters[i]
 *                 target_id = c_node.targets[i] - self.start_node
 *                 transitions[(state, ch)] = states[target_id]             # <<<<<<<<<<<<<<
 * 
 *         return type(self), (states[0], transitions)
 */
      __pyx_t_5 = __Pyx_PyInt_From_ptrdiff_t(__pyx_v_target_id); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_states, __pyx_t_5); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_v_state);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_state);
      __Pyx_GIVEREF(__pyx_v_state);
      __Pyx_INCREF(__pyx_v_ch);
      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_ch);
      __Pyx_GIVEREF(__pyx_v_ch);
      if (unlikely(PyDict_SetItem(__pyx_v_transitions, __pyx_t_5, __pyx_t_1) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
  }

  /* "acora/_acora.pyx":300
 *                 transitions[(state, ch)] = states[target_id]
 * 
 *         return type(self), (states[0], transitions)             # <<<<<<<<<<<<<<
 * 
 *     cpdef finditer(self, unicode data):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_states, __pyx_int_0); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_transitions);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_transitions);
  __Pyx_GIVEREF(__pyx_v_transitions);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
  __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "acora/_acora.pyx":278
 *             cpython.mem.PyMem_Free(self.start_node)
 * 
 *     def __reduce__(self):             # <<<<<<<<<<<<<<
 *         """pickle"""
 *         cdef _AcoraUnicodeNodeStruct* c_node
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("acora._acora.UnicodeAcora.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_states);
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v_transitions);
  __Pyx_XDECREF(__pyx_v_ch);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "acora/_acora.pyx":302
 *         return type(self), (states[0], transitions)
 * 
 *     cpdef finditer(self, unicode data):             # <<<<<<<<<<<<<<
 *         """Iterate over all occurrences of any keyword in the string.
 * 
 */

static PyObject *__pyx_pw_5acora_6_acora_12UnicodeAcora_7finditer(PyObject *__pyx_v_self, PyObject *__pyx_v_data); /*proto*/
static PyObject *__pyx_f_5acora_6_acora_12UnicodeAcora_finditer(struct __pyx_obj_5acora_6_acora_UnicodeAcora *__pyx_v_self, PyObject *__pyx_v_data, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("finditer", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_finditer); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_5acora_6_acora_12UnicodeAcora_7finditer)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_v_data);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_data);
      __Pyx_GIVEREF(__pyx_v_data);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "acora/_acora.pyx":307
 *         Returns (keyword, offset) pairs.
 *         """
 *         return _UnicodeAcoraIter(self, data)             # <<<<<<<<<<<<<<
 * 
 *     def findall(self, unicode data):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __Pyx_INCREF(__pyx_v_data);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_data);
  __Pyx_GIVEREF(__pyx_v_data);
  __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5acora_6_acora__UnicodeAcoraIter)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "acora/_acora.pyx":302
 *         return type(self), (states[0], transitions)
 * 
 *     cpdef finditer(self, unicode data):             # <<<<<<<<<<<<<<
 *         """Iterate over all occurrences of any keyword in the string.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("acora._acora.UnicodeAcora.finditer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5acora_6_acora_12UnicodeAcora_7finditer(PyObject *__pyx_v_self, PyObject *__pyx_v_data); /*proto*/
static char __pyx_doc_5acora_6_acora_12UnicodeAcora_6finditer[] = "UnicodeAcora.finditer(self, unicode data)\nIterate over all occurrences of any keyword in the string.\n\n        Returns (keyword, offset) pairs.\n        ";
static PyObject *__pyx_pw_5acora_6_acora_12UnicodeAcora_7finditer(PyObject *__pyx_v_self, PyObject *__pyx_v_data) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("finditer (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data), (&PyUnicode_Type), 1, "data", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_5acora_6_acora_12UnicodeAcora_6finditer(((struct __pyx_obj_5acora_6_acora_UnicodeAcora *)__pyx_v_self), ((PyObject*)__pyx_v_data));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5acora_6_acora_12UnicodeAcora_6finditer(struct __pyx_obj_5acora_6_acora_UnicodeAcora *__pyx_v_self, PyObject *__pyx_v_data) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("finditer", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_5acora_6_acora_UnicodeAcora *)__pyx_v_self->__pyx_vtab)->finditer(__pyx_v_self, __pyx_v_data, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("acora._acora.UnicodeAcora.finditer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "acora/_acora.pyx":309
 *         return _UnicodeAcoraIter(self, data)
 * 
 *     def findall(self, unicode data):             # <<<<<<<<<<<<<<
 *         """Find all occurrences of any keyword in the string.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5acora_6_acora_12UnicodeAcora_9findall(PyObject *__pyx_v_self, PyObject *__pyx_v_data); /*proto*/
static char __pyx_doc_5acora_6_acora_12UnicodeAcora_8findall[] = "UnicodeAcora.findall(self, unicode data)\nFind all occurrences of any keyword in the string.\n\n        Returns a list of (keyword, offset) pairs.\n        ";
static PyObject *__pyx_pw_5acora_6_acora_12UnicodeAcora_9findall(PyObject *__pyx_v_self, PyObject *__pyx_v_data) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("findall (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data), (&PyUnicode_Type), 1, "data", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_5acora_6_acora_12UnicodeAcora_8findall(((struct __pyx_obj_5acora_6_acora_UnicodeAcora *)__pyx_v_self), ((PyObject*)__pyx_v_data));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5acora_6_acora_12UnicodeAcora_8findall(struct __pyx_obj_5acora_6_acora_UnicodeAcora *__pyx_v_self, PyObject *__pyx_v_data) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("findall", 0);

  /* "acora/_acora.pyx":314
 *         Returns a list of (keyword, offset) pairs.
 *         """
 *         return list(self.finditer(data))             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_5acora_6_acora_UnicodeAcora *)__pyx_v_self->__pyx_vtab)->finditer(__pyx_v_self, __pyx_v_data, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "acora/_acora.pyx":309
 *         return _UnicodeAcoraIter(self, data)
 * 
 *     def findall(self, unicode data):             # <<<<<<<<<<<<<<
 *         """Find all occurrences of any keyword in the string.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("acora._acora.UnicodeAcora.findall", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "acora/_acora.pyx":326
 *     cdef int unicode_kind
 * 
 *     def __cinit__(self, UnicodeAcora acora not None, unicode data not None):             # <<<<<<<<<<<<<<
 *         assert acora.start_node is not NULL
 *         assert acora.start_node.matches is NULL
 */

/* Python wrapper */
static int __pyx_pw_5acora_6_acora_17_UnicodeAcoraIter_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5acora_6_acora_17_UnicodeAcoraIter_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_5acora_6_acora_UnicodeAcora *__pyx_v_acora = 0;
  PyObject *__pyx_v_data = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_acora,&__pyx_n_s_data,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_acora)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_data)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_acora = ((struct __pyx_obj_5acora_6_acora_UnicodeAcora *)values[0]);
    __pyx_v_data = ((PyObject*)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("acora._acora._UnicodeAcoraIter.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_acora), __pyx_ptype_5acora_6_acora_UnicodeAcora, 0, "acora", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data), (&PyUnicode_Type), 0, "data", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_5acora_6_acora_17_UnicodeAcoraIter___cinit__(((struct __pyx_obj_5acora_6_acora__UnicodeAcoraIter *)__pyx_v_self), __pyx_v_acora, __pyx_v_data);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5acora_6_acora_17_UnicodeAcoraIter___cinit__(struct __pyx_obj_5acora_6_acora__UnicodeAcoraIter *__pyx_v_self, struct __pyx_obj_5acora_6_acora_UnicodeAcora *__pyx_v_acora, PyObject *__pyx_v_data) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __pyx_t_5acora_6_acora__AcoraUnicodeNodeStruct *__pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "acora/_acora.pyx":327
 * 
 *     def __cinit__(self, UnicodeAcora acora not None, unicode data not None):
 *         assert acora.start_node is not NULL             # <<<<<<<<<<<<<<
 *         assert acora.start_node.matches is NULL
 *         self.acora = acora
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_acora->start_node != NULL) != 0))) {
      PyErr_SetNone(PyExc_AssertionError);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  #endif

  /* "acora/_acora.pyx":328
 *     def __cinit__(self, UnicodeAcora acora not None, unicode data not None):
 *         assert acora.start_node is not NULL
 *         assert acora.start_node.matches is NULL             # <<<<<<<<<<<<<<
 *         self.acora = acora
 *         self.start_node = self.current_node = acora.start_node
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_acora->start_node->matches == NULL) != 0))) {
      PyErr_SetNone(PyExc_AssertionError);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  #endif

  /* "acora/_acora.pyx":329
 *         assert acora.start_node is not NULL
 *         assert acora.start_node.matches is NULL
 *         self.acora = acora             # <<<<<<<<<<<<<<
 *         self.start_node = self.current_node = acora.start_node
 *         self.match_index = 0
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_acora));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_acora));
  __Pyx_GOTREF(__pyx_v_self->acora);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->acora));
  __pyx_v_self->acora = __pyx_v_acora;

  /* "acora/_acora.pyx":330
 *         assert acora.start_node.matches is NULL
 *         self.acora = acora
 *         self.start_node = self.current_node = acora.start_node             # <<<<<<<<<<<<<<
 *         self.match_index = 0
 *         self.data = data
 */
  __pyx_t_1 = __pyx_v_acora->start_node;
  __pyx_v_self->start_node = __pyx_t_1;
  __pyx_v_self->current_node = __pyx_t_1;

  /* "acora/_acora.pyx":331
 *         self.acora = acora
 *         self.start_node = self.current_node = acora.start_node
 *         self.match_index = 0             # <<<<<<<<<<<<<<
 *         self.data = data
 *         self.data_pos = 0
 */
  __pyx_v_self->match_index = 0;

  /* "acora/_acora.pyx":332
 *         self.start_node = self.current_node = acora.start_node
 *         self.match_index = 0
 *         self.data = data             # <<<<<<<<<<<<<<
 *         self.data_pos = 0
 *         if PyUnicode_IS_READY(data):
 */
  __Pyx_INCREF(__pyx_v_data);
  __Pyx_GIVEREF(__pyx_v_data);
  __Pyx_GOTREF(__pyx_v_self->data);
  __Pyx_DECREF(__pyx_v_self->data);
  __pyx_v_self->data = __pyx_v_data;

  /* "acora/_acora.pyx":333
 *         self.match_index = 0
 *         self.data = data
 *         self.data_pos = 0             # <<<<<<<<<<<<<<
 *         if PyUnicode_IS_READY(data):
 *             # PEP393 Unicode string
 */
  __pyx_v_self->data_pos = 0;

  /* "acora/_acora.pyx":334
 *         self.data = data
 *         self.data_pos = 0
 *         if PyUnicode_IS_READY(data):             # <<<<<<<<<<<<<<
 *             # PEP393 Unicode string
 *             self.data_start = PyUnicode_DATA(data)
 */
  __pyx_t_2 = (PyUnicode_IS_READY(__pyx_v_data) != 0);
  if (__pyx_t_2) {

    /* "acora/_acora.pyx":336
 *         if PyUnicode_IS_READY(data):
 *             # PEP393 Unicode string
 *             self.data_start = PyUnicode_DATA(data)             # <<<<<<<<<<<<<<
 *             self.data_len = PyUnicode_GET_LENGTH(data)
 *             self.unicode_kind = PyUnicode_KIND(data)
 */
    __pyx_v_self->data_start = PyUnicode_DATA(__pyx_v_data);

    /* "acora/_acora.pyx":337
 *             # PEP393 Unicode string
 *             self.data_start = PyUnicode_DATA(data)
 *             self.data_len = PyUnicode_GET_LENGTH(data)             # <<<<<<<<<<<<<<
 *             self.unicode_kind = PyUnicode_KIND(data)
 *         else:
 */
    __pyx_v_self->data_len = PyUnicode_GET_LENGTH(__pyx_v_data);

    /* "acora/_acora.pyx":338
 *             self.data_start = PyUnicode_DATA(data)
 *             self.data_len = PyUnicode_GET_LENGTH(data)
 *             self.unicode_kind = PyUnicode_KIND(data)             # <<<<<<<<<<<<<<
 *         else:
 *             # pre-/non-PEP393 Unicode string
 */
    __pyx_v_self->unicode_kind = PyUnicode_KIND(__pyx_v_data);
    goto __pyx_L3;
  }
  /*else*/ {

    /* "acora/_acora.pyx":341
 *         else:
 *             # pre-/non-PEP393 Unicode string
 *             self.data_start = PyUnicode_AS_UNICODE(data)             # <<<<<<<<<<<<<<
 *             self.data_len = PyUnicode_GET_SIZE(data)
 *             self.unicode_kind = PyUnicode_WCHAR_KIND
 */
    __pyx_v_self->data_start = PyUnicode_AS_UNICODE(__pyx_v_data);

    /* "acora/_acora.pyx":342
 *             # pre-/non-PEP393 Unicode string
 *             self.data_start = PyUnicode_AS_UNICODE(data)
 *             self.data_len = PyUnicode_GET_SIZE(data)             # <<<<<<<<<<<<<<
 *             self.unicode_kind = PyUnicode_WCHAR_KIND
 * 
 */
    __pyx_v_self->data_len = PyUnicode_GET_SIZE(__pyx_v_data);

    /* "acora/_acora.pyx":343
 *             self.data_start = PyUnicode_AS_UNICODE(data)
 *             self.data_len = PyUnicode_GET_SIZE(data)
 *             self.unicode_kind = PyUnicode_WCHAR_KIND             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
    __pyx_v_self->unicode_kind = PyUnicode_WCHAR_KIND;
  }
  __pyx_L3:;

  /* "acora/_acora.pyx":326
 *     cdef int unicode_kind
 * 
 *     def __cinit__(self, UnicodeAcora acora not None, unicode data not None):             # <<<<<<<<<<<<<<
 *         assert acora.start_node is not NULL
 *         assert acora.start_node.matches is NULL
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("acora._acora._UnicodeAcoraIter.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "acora/_acora.pyx":345
 *             self.unicode_kind = PyUnicode_WCHAR_KIND
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5acora_6_acora_17_UnicodeAcoraIter_3__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5acora_6_acora_17_UnicodeAcoraIter_3__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5acora_6_acora_17_UnicodeAcoraIter_2__iter__(((struct __pyx_obj_5acora_6_acora__UnicodeAcoraIter *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5acora_6_acora_17_UnicodeAcoraIter_2__iter__(struct __pyx_obj_5acora_6_acora__UnicodeAcoraIter *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "acora/_acora.pyx":346
 * 
 *     def __iter__(self):
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __next__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "acora/_acora.pyx":345
 *             self.unicode_kind = PyUnicode_WCHAR_KIND
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "acora/_acora.pyx":348
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         cdef void* data_start = self.data_start
 *         cdef Py_UCS4* test_chars
 */

/* Python wrapper */
static PyObject *__pyx_pw_5acora_6_acora_17_UnicodeAcoraIter_5__next__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5acora_6_acora_17_UnicodeAcoraIter_5__next__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5acora_6_acora_17_UnicodeAcoraIter_4__next__(((struct __pyx_obj_5acora_6_acora__UnicodeAcoraIter *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5acora_6_acora_17_UnicodeAcoraIter_4__next__(struct __pyx_obj_5acora_6_acora__UnicodeAcoraIter *__pyx_v_self) {
  void *__pyx_v_data_start;
  Py_UCS4 *__pyx_v_test_chars;
  Py_UCS4 __pyx_v_current_char;
  int __pyx_v_i;
  int __pyx_v_found;
  int __pyx_v_start;
  int __pyx_v_mid;
  int __pyx_v_end;
  Py_ssize_t __pyx_v_data_len;
  Py_ssize_t __pyx_v_data_pos;
  __pyx_t_5acora_6_acora__AcoraUnicodeNodeStruct *__pyx_v_start_node;
  __pyx_t_5acora_6_acora__AcoraUnicodeNodeStruct *__pyx_v_current_node;
  int __pyx_v_kind;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  void *__pyx_t_1;
  Py_ssize_t __pyx_t_2;
  __pyx_t_5acora_6_acora__AcoraUnicodeNodeStruct *__pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  Py_UCS4 *__pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__next__", 0);

  /* "acora/_acora.pyx":349
 * 
 *     def __next__(self):
 *         cdef void* data_start = self.data_start             # <<<<<<<<<<<<<<
 *         cdef Py_UCS4* test_chars
 *         cdef Py_UCS4 current_char
 */
  __pyx_t_1 = __pyx_v_self->data_start;
  __pyx_v_data_start = __pyx_t_1;

  /* "acora/_acora.pyx":352
 *         cdef Py_UCS4* test_chars
 *         cdef Py_UCS4 current_char
 *         cdef int i, found = 0, start, mid, end             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t data_len = self.data_len, data_pos = self.data_pos
 *         cdef _AcoraUnicodeNodeStruct* start_node = self.start_node
 */
  __pyx_v_found = 0;

  /* "acora/_acora.pyx":353
 *         cdef Py_UCS4 current_char
 *         cdef int i, found = 0, start, mid, end
 *         cdef Py_ssize_t data_len = self.data_len, data_pos = self.data_pos             # <<<<<<<<<<<<<<
 *         cdef _AcoraUnicodeNodeStruct* start_node = self.start_node
 *         cdef _AcoraUnicodeNodeStruct* current_node = self.current_node
 */
  __pyx_t_2 = __pyx_v_self->data_len;
  __pyx_v_data_len = __pyx_t_2;
  __pyx_t_2 = __pyx_v_self->data_pos;
  __pyx_v_data_pos = __pyx_t_2;

  /* "acora/_acora.pyx":354
 *         cdef int i, found = 0, start, mid, end
 *         cdef Py_ssize_t data_len = self.data_len, data_pos = self.data_pos
 *         cdef _AcoraUnicodeNodeStruct* start_node = self.start_node             # <<<<<<<<<<<<<<
 *         cdef _AcoraUnicodeNodeStruct* current_node = self.current_node
 * 
 */
  __pyx_t_3 = __pyx_v_self->start_node;
  __pyx_v_start_node = __pyx_t_3;

  /* "acora/_acora.pyx":355
 *         cdef Py_ssize_t data_len = self.data_len, data_pos = self.data_pos
 *         cdef _AcoraUnicodeNodeStruct* start_node = self.start_node
 *         cdef _AcoraUnicodeNodeStruct* current_node = self.current_node             # <<<<<<<<<<<<<<
 * 
 *         if current_node.matches is not NULL:
 */
  __pyx_t_3 = __pyx_v_self->current_node;
  __pyx_v_current_node = __pyx_t_3;

  /* "acora/_acora.pyx":357
 *         cdef _AcoraUnicodeNodeStruct* current_node = self.current_node
 * 
 *         if current_node.matches is not NULL:             # <<<<<<<<<<<<<<
 *             if current_node.matches[self.match_index] is not NULL:
 *                 return self._build_next_match()
 */
  __pyx_t_4 = ((__pyx_v_current_node->matches != NULL) != 0);
  if (__pyx_t_4) {

    /* "acora/_acora.pyx":358
 * 
 *         if current_node.matches is not NULL:
 *             if current_node.matches[self.match_index] is not NULL:             # <<<<<<<<<<<<<<
 *                 return self._build_next_match()
 *             self.match_index = 0
 */
    __pyx_t_4 = (((__pyx_v_current_node->matches[__pyx_v_self->match_index]) != NULL) != 0);
    if (__pyx_t_4) {

      /* "acora/_acora.pyx":359
 *         if current_node.matches is not NULL:
 *             if current_node.matches[self.match_index] is not NULL:
 *                 return self._build_next_match()             # <<<<<<<<<<<<<<
 *             self.match_index = 0
 * 
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_5 = ((struct __pyx_vtabstruct_5acora_6_acora__UnicodeAcoraIter *)__pyx_v_self->__pyx_vtab)->_build_next_match(__pyx_v_self); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L0;
    }

    /* "acora/_acora.pyx":360
 *             if current_node.matches[self.match_index] is not NULL:
 *                 return self._build_next_match()
 *             self.match_index = 0             # <<<<<<<<<<<<<<
 * 
 *         kind = self.unicode_kind
 */
    __pyx_v_self->match_index = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "acora/_acora.pyx":362
 *             self.match_index = 0
 * 
 *         kind = self.unicode_kind             # <<<<<<<<<<<<<<
 *         with nogil:
 *             while data_pos < data_len:
 */
  __pyx_t_6 = __pyx_v_self->unicode_kind;
  __pyx_v_kind = __pyx_t_6;

  /* "acora/_acora.pyx":363
 * 
 *         kind = self.unicode_kind
 *         with nogil:             # <<<<<<<<<<<<<<
 *             while data_pos < data_len:
 *                 current_char = PyUnicode_READ(kind, data_start, data_pos)
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      #endif
      /*try:*/ {

        /* "acora/_acora.pyx":364
 *         kind = self.unicode_kind
 *         with nogil:
 *             while data_pos < data_len:             # <<<<<<<<<<<<<<
 *                 current_char = PyUnicode_READ(kind, data_start, data_pos)
 *                 data_pos += 1
 */
        while (1) {
          __pyx_t_4 = ((__pyx_v_data_pos < __pyx_v_data_len) != 0);
          if (!__pyx_t_4) break;

          /* "acora/_acora.pyx":365
 *         with nogil:
 *             while data_pos < data_len:
 *                 current_char = PyUnicode_READ(kind, data_start, data_pos)             # <<<<<<<<<<<<<<
 *                 data_pos += 1
 *                 test_chars = current_node.characters
 */
          __pyx_v_current_char = PyUnicode_READ(__pyx_v_kind, __pyx_v_data_start, __pyx_v_data_pos);

          /* "acora/_acora.pyx":366
 *             while data_pos < data_len:
 *                 current_char = PyUnicode_READ(kind, data_start, data_pos)
 *                 data_pos += 1             # <<<<<<<<<<<<<<
 *                 test_chars = current_node.characters
 *                 if current_char == test_chars[0]:
 */
          __pyx_v_data_pos = (__pyx_v_data_pos + 1);

          /* "acora/_acora.pyx":367
 *                 current_char = PyUnicode_READ(kind, data_start, data_pos)
 *                 data_pos += 1
 *                 test_chars = current_node.characters             # <<<<<<<<<<<<<<
 *                 if current_char == test_chars[0]:
 *                     current_node = current_node.targets[0]
 */
          __pyx_t_7 = __pyx_v_current_node->characters;
          __pyx_v_test_chars = __pyx_t_7;

          /* "acora/_acora.pyx":368
 *                 data_pos += 1
 *                 test_chars = current_node.characters
 *                 if current_char == test_chars[0]:             # <<<<<<<<<<<<<<
 *                     current_node = current_node.targets[0]
 *                 elif current_char < test_chars[0] \
 */
          __pyx_t_4 = ((__pyx_v_current_char == (__pyx_v_test_chars[0])) != 0);
          if (__pyx_t_4) {

            /* "acora/_acora.pyx":369
 *                 test_chars = current_node.characters
 *                 if current_char == test_chars[0]:
 *                     current_node = current_node.targets[0]             # <<<<<<<<<<<<<<
 *                 elif current_char < test_chars[0] \
 *                         or current_char > test_chars[current_node.char_count-1]:
 */
            __pyx_v_current_node = (__pyx_v_current_node->targets[0]);
            goto __pyx_L10;
          }

          /* "acora/_acora.pyx":370
 *                 if current_char == test_chars[0]:
 *                     current_node = current_node.targets[0]
 *                 elif current_char < test_chars[0] \             # <<<<<<<<<<<<<<
 *                         or current_char > test_chars[current_node.char_count-1]:
 *                     current_node = start_node
 */
          __pyx_t_4 = ((__pyx_v_current_char < (__pyx_v_test_chars[0])) != 0);
          if (!__pyx_t_4) {

            /* "acora/_acora.pyx":371
 *                     current_node = current_node.targets[0]
 *                 elif current_char < test_chars[0] \
 *                         or current_char > test_chars[current_node.char_count-1]:             # <<<<<<<<<<<<<<
 *                     current_node = start_node
 *                 else:
 */
            __pyx_t_8 = ((__pyx_v_current_char > (__pyx_v_test_chars[(__pyx_v_current_node->char_count - 1)])) != 0);
            __pyx_t_9 = __pyx_t_8;
          } else {
            __pyx_t_9 = __pyx_t_4;
          }
          if (__pyx_t_9) {

            /* "acora/_acora.pyx":372
 *                 elif current_char < test_chars[0] \
 *                         or current_char > test_chars[current_node.char_count-1]:
 *                     current_node = start_node             # <<<<<<<<<<<<<<
 *                 else:
 *                     # walk through at most half the characters
 */
            __pyx_v_current_node = __pyx_v_start_node;
            goto __pyx_L10;
          }
          /*else*/ {

            /* "acora/_acora.pyx":375
 *                 else:
 *                     # walk through at most half the characters
 *                     mid = current_node.char_count // 2             # <<<<<<<<<<<<<<
 *                     if current_char < test_chars[mid]:
 *                         start = 0
 */
            __pyx_v_mid = __Pyx_div_long(__pyx_v_current_node->char_count, 2);

            /* "acora/_acora.pyx":376
 *                     # walk through at most half the characters
 *                     mid = current_node.char_count // 2
 *                     if current_char < test_chars[mid]:             # <<<<<<<<<<<<<<
 *                         start = 0
 *                         end = mid
 */
            __pyx_t_9 = ((__pyx_v_current_char < (__pyx_v_test_chars[__pyx_v_mid])) != 0);
            if (__pyx_t_9) {

              /* "acora/_acora.pyx":377
 *                     mid = current_node.char_count // 2
 *                     if current_char < test_chars[mid]:
 *                         start = 0             # <<<<<<<<<<<<<<
 *                         end = mid
 *                     else:
 */
              __pyx_v_start = 0;

              /* "acora/_acora.pyx":378
 *                     if current_char < test_chars[mid]:
 *                         start = 0
 *                         end = mid             # <<<<<<<<<<<<<<
 *                     else:
 *                         start = mid
 */
              __pyx_v_end = __pyx_v_mid;
              goto __pyx_L11;
            }
            /*else*/ {

              /* "acora/_acora.pyx":380
 *                         end = mid
 *                     else:
 *                         start = mid             # <<<<<<<<<<<<<<
 *                         end = current_node.char_count
 * 
 */
              __pyx_v_start = __pyx_v_mid;

              /* "acora/_acora.pyx":381
 *                     else:
 *                         start = mid
 *                         end = current_node.char_count             # <<<<<<<<<<<<<<
 * 
 *                     for i in range(start, end):
 */
              __pyx_t_6 = __pyx_v_current_node->char_count;
              __pyx_v_end = __pyx_t_6;
            }
            __pyx_L11:;

            /* "acora/_acora.pyx":383
 *                         end = current_node.char_count
 * 
 *                     for i in range(start, end):             # <<<<<<<<<<<<<<
 *                         if current_char <= test_chars[i]:
 *                             if current_char == test_chars[i]:
 */
            __pyx_t_6 = __pyx_v_end;
            for (__pyx_t_10 = __pyx_v_start; __pyx_t_10 < __pyx_t_6; __pyx_t_10+=1) {
              __pyx_v_i = __pyx_t_10;

              /* "acora/_acora.pyx":384
 * 
 *                     for i in range(start, end):
 *                         if current_char <= test_chars[i]:             # <<<<<<<<<<<<<<
 *                             if current_char == test_chars[i]:
 *                                 current_node = current_node.targets[i]
 */
              __pyx_t_9 = ((__pyx_v_current_char <= (__pyx_v_test_chars[__pyx_v_i])) != 0);
              if (__pyx_t_9) {

                /* "acora/_acora.pyx":385
 *                     for i in range(start, end):
 *                         if current_char <= test_chars[i]:
 *                             if current_char == test_chars[i]:             # <<<<<<<<<<<<<<
 *                                 current_node = current_node.targets[i]
 *                             else:
 */
                __pyx_t_9 = ((__pyx_v_current_char == (__pyx_v_test_chars[__pyx_v_i])) != 0);
                if (__pyx_t_9) {

                  /* "acora/_acora.pyx":386
 *                         if current_char <= test_chars[i]:
 *                             if current_char == test_chars[i]:
 *                                 current_node = current_node.targets[i]             # <<<<<<<<<<<<<<
 *                             else:
 *                                 current_node = start_node
 */
                  __pyx_v_current_node = (__pyx_v_current_node->targets[__pyx_v_i]);
                  goto __pyx_L15;
                }
                /*else*/ {

                  /* "acora/_acora.pyx":388
 *                                 current_node = current_node.targets[i]
 *                             else:
 *                                 current_node = start_node             # <<<<<<<<<<<<<<
 *                             break
 *                     else:
 */
                  __pyx_v_current_node = __pyx_v_start_node;
                }
                __pyx_L15:;

                /* "acora/_acora.pyx":389
 *                             else:
 *                                 current_node = start_node
 *                             break             # <<<<<<<<<<<<<<
 *                     else:
 *                         current_node = start_node
 */
                goto __pyx_L13_break;
              }
            }
            /*else*/ {

              /* "acora/_acora.pyx":391
 *                             break
 *                     else:
 *                         current_node = start_node             # <<<<<<<<<<<<<<
 *                 if current_node.matches is not NULL:
 *                     found = 1
 */
              __pyx_v_current_node = __pyx_v_start_node;
            }
            __pyx_L13_break:;
          }
          __pyx_L10:;

          /* "acora/_acora.pyx":392
 *                     else:
 *                         current_node = start_node
 *                 if current_node.matches is not NULL:             # <<<<<<<<<<<<<<
 *                     found = 1
 *                     break
 */
          __pyx_t_9 = ((__pyx_v_current_node->matches != NULL) != 0);
          if (__pyx_t_9) {

            /* "acora/_acora.pyx":393
 *                         current_node = start_node
 *                 if current_node.matches is not NULL:
 *                     found = 1             # <<<<<<<<<<<<<<
 *                     break
 *         self.data_pos = data_pos
 */
            __pyx_v_found = 1;

            /* "acora/_acora.pyx":394
 *                 if current_node.matches is not NULL:
 *                     found = 1
 *                     break             # <<<<<<<<<<<<<<
 *         self.data_pos = data_pos
 *         self.current_node = current_node
 */
            goto __pyx_L9_break;
          }
        }
        __pyx_L9_break:;
      }

      /* "acora/_acora.pyx":363
 * 
 *         kind = self.unicode_kind
 *         with nogil:             # <<<<<<<<<<<<<<
 *             while data_pos < data_len:
 *                 current_char = PyUnicode_READ(kind, data_start, data_pos)
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L7;
        }
        __pyx_L7:;
      }
  }

  /* "acora/_acora.pyx":395
 *                     found = 1
 *                     break
 *         self.data_pos = data_pos             # <<<<<<<<<<<<<<
 *         self.current_node = current_node
 *         if found:
 */
  __pyx_v_self->data_pos = __pyx_v_data_pos;

  /* "acora/_acora.pyx":396
 *                     break
 *         self.data_pos = data_pos
 *         self.current_node = current_node             # <<<<<<<<<<<<<<
 *         if found:
 *             return self._build_next_match()
 */
  __pyx_v_self->current_node = __pyx_v_current_node;

  /* "acora/_acora.pyx":397
 *         self.data_pos = data_pos
 *         self.current_node = current_node
 *         if found:             # <<<<<<<<<<<<<<
 *             return self._build_next_match()
 *         raise StopIteration
 */
  __pyx_t_9 = (__pyx_v_found != 0);
  if (__pyx_t_9) {

    /* "acora/_acora.pyx":398
 *         self.current_node = current_node
 *         if found:
 *             return self._build_next_match()             # <<<<<<<<<<<<<<
 *         raise StopIteration
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = ((struct __pyx_vtabstruct_5acora_6_acora__UnicodeAcoraIter *)__pyx_v_self->__pyx_vtab)->_build_next_match(__pyx_v_self); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;
  }

  /* "acora/_acora.pyx":399
 *         if found:
 *             return self._build_next_match()
 *         raise StopIteration             # <<<<<<<<<<<<<<
 * 
 *     cdef _build_next_match(self):
 */
  __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "acora/_acora.pyx":348
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         cdef void* data_start = self.data_start
 *         cdef Py_UCS4* test_chars
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("acora._acora._UnicodeAcoraIter.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "acora/_acora.pyx":401
 *         raise StopIteration
 * 
 *     cdef _build_next_match(self):             # <<<<<<<<<<<<<<
 *         match = <unicode> self.current_node.matches[self.match_index]
 *         self.match_index += 1
 */

static PyObject *__pyx_f_5acora_6_acora_17_UnicodeAcoraIter__build_next_match(struct __pyx_obj_5acora_6_acora__UnicodeAcoraIter *__pyx_v_self) {
  PyObject *__pyx_v_match = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_build_next_match", 0);

  /* "acora/_acora.pyx":402
 * 
 *     cdef _build_next_match(self):
 *         match = <unicode> self.current_node.matches[self.match_index]             # <<<<<<<<<<<<<<
 *         self.match_index += 1
 *         return match, self.data_pos - len(match)
 */
  __pyx_t_1 = ((PyObject *)(__pyx_v_self->current_node->matches[__pyx_v_self->match_index]));
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_match = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "acora/_acora.pyx":403
 *     cdef _build_next_match(self):
 *         match = <unicode> self.current_node.matches[self.match_index]
 *         self.match_index += 1             # <<<<<<<<<<<<<<
 *         return match, self.data_pos - len(match)
 * 
 */
  __pyx_v_self->match_index = (__pyx_v_self->match_index + 1);

  /* "acora/_acora.pyx":404
 *         match = <unicode> self.current_node.matches[self.match_index]
 *         self.match_index += 1
 *         return match, self.data_pos - len(match)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(__pyx_v_match == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_2 = __Pyx_PyUnicode_GET_LENGTH(__pyx_v_match); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = PyInt_FromSsize_t((__pyx_v_self->data_pos - __pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_match);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_match);
  __Pyx_GIVEREF(__pyx_v_match);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "acora/_acora.pyx":401
 *         raise StopIteration
 * 
 *     cdef _build_next_match(self):             # <<<<<<<<<<<<<<
 *         match = <unicode> self.current_node.matches[self.match_index]
 *         self.match_index += 1
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("acora._acora._UnicodeAcoraIter._build_next_match", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_match);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "acora/_acora.pyx":416
 *     cdef tuple _pyrefs
 * 
 *     def __cinit__(self, start_state, dict transitions not None):             # <<<<<<<<<<<<<<
 *         cdef _AcoraBytesNodeStruct* c_nodes
 *         cdef Py_ssize_t i
 */

/* Python wrapper */
static int __pyx_pw_5acora_6_acora_10BytesAcora_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5acora_6_acora_10BytesAcora_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_start_state = 0;
  PyObject *__pyx_v_transitions = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_start_state,&__pyx_n_s_transitions,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_start_state)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_transitions)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_start_state = values[0];
    __pyx_v_transitions = ((PyObject*)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("acora._acora.BytesAcora.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_transitions), (&PyDict_Type), 0, "transitions", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_5acora_6_acora_10BytesAcora___cinit__(((struct __pyx_obj_5acora_6_acora_BytesAcora *)__pyx_v_self), __pyx_v_start_state, __pyx_v_transitions);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5acora_6_acora_10BytesAcora___cinit__(struct __pyx_obj_5acora_6_acora_BytesAcora *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_start_state, PyObject *__pyx_v_transitions) {
  __pyx_t_5acora_6_acora__AcoraBytesNodeStruct *__pyx_v_c_nodes;
  Py_ssize_t __pyx_v_i;
  PyObject *__pyx_v_states = NULL;
  PyObject *__pyx_v_node_offsets = NULL;
  PyObject *__pyx_v_pyrefs = NULL;
  PyObject *__pyx_v_state = NULL;
  PyObject *__pyx_v_state_transitions = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  __pyx_t_5acora_6_acora__AcoraBytesNodeStruct *__pyx_t_4;
  int __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *(*__pyx_t_11)(PyObject *);
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "acora/_acora.pyx":419
 *         cdef _AcoraBytesNodeStruct* c_nodes
 *         cdef Py_ssize_t i
 *         self.start_node = NULL             # <<<<<<<<<<<<<<
 *         # sort states by id (start state first)
 *         states = list(enumerate(
 */
  __pyx_v_self->start_node = NULL;

  /* "acora/_acora.pyx":422
 *         # sort states by id (start state first)
 *         states = list(enumerate(
 *             sorted(group_transitions_by_state(transitions).items())))             # <<<<<<<<<<<<<<
 * 
 *         self.node_count = len(states)
 */
  __pyx_t_1 = __pyx_f_5acora_6_acora_group_transitions_by_state(__pyx_v_transitions); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "items");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_2 = __Pyx_PyDict_Items(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_sorted, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "acora/_acora.pyx":421
 *         self.start_node = NULL
 *         # sort states by id (start state first)
 *         states = list(enumerate(             # <<<<<<<<<<<<<<
 *             sorted(group_transitions_by_state(transitions).items())))
 * 
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_enumerate, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_states = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "acora/_acora.pyx":424
 *             sorted(group_transitions_by_state(transitions).items())))
 * 
 *         self.node_count = len(states)             # <<<<<<<<<<<<<<
 *         c_nodes = self.start_node = <_AcoraBytesNodeStruct*> cpython.mem.PyMem_Malloc(
 *             sizeof(_AcoraBytesNodeStruct) * self.node_count)
 */
  __pyx_t_3 = PyList_GET_SIZE(__pyx_v_states); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_self->node_count = __pyx_t_3;

  /* "acora/_acora.pyx":425
 * 
 *         self.node_count = len(states)
 *         c_nodes = self.start_node = <_AcoraBytesNodeStruct*> cpython.mem.PyMem_Malloc(             # <<<<<<<<<<<<<<
 *             sizeof(_AcoraBytesNodeStruct) * self.node_count)
 *         if c_nodes is NULL:
 */
  __pyx_t_4 = ((__pyx_t_5acora_6_acora__AcoraBytesNodeStruct *)PyMem_Malloc(((sizeof(__pyx_t_5acora_6_acora__AcoraBytesNodeStruct)) * __pyx_v_self->node_count)));
  __pyx_v_c_nodes = __pyx_t_4;
  __pyx_v_self->start_node = __pyx_t_4;

  /* "acora/_acora.pyx":427
 *         c_nodes = self.start_node = <_AcoraBytesNodeStruct*> cpython.mem.PyMem_Malloc(
 *             sizeof(_AcoraBytesNodeStruct) * self.node_count)
 *         if c_nodes is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 * 
 */
  __pyx_t_5 = ((__pyx_v_c_nodes == NULL) != 0);
  if (__pyx_t_5) {

    /* "acora/_acora.pyx":428
 *             sizeof(_AcoraBytesNodeStruct) * self.node_count)
 *         if c_nodes is NULL:
 *             raise MemoryError()             # <<<<<<<<<<<<<<
 * 
 *         for i in range(self.node_count):
 */
    PyErr_NoMemory(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "acora/_acora.pyx":430
 *             raise MemoryError()
 * 
 *         for i in range(self.node_count):             # <<<<<<<<<<<<<<
 *             # required by __dealloc__ in case of subsequent errors
 *             c_nodes[i].targets = NULL
 */
  __pyx_t_3 = __pyx_v_self->node_count;
  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_3; __pyx_t_6+=1) {
    __pyx_v_i = __pyx_t_6;

    /* "acora/_acora.pyx":432
 *         for i in range(self.node_count):
 *             # required by __dealloc__ in case of subsequent errors
 *             c_nodes[i].targets = NULL             # <<<<<<<<<<<<<<
 * 
 *         node_offsets = dict([
 */
    (__pyx_v_c_nodes[__pyx_v_i]).targets = NULL;
  }

  /* "acora/_acora.pyx":434
 *             c_nodes[i].targets = NULL
 * 
 *         node_offsets = dict([             # <<<<<<<<<<<<<<
 *             (state, i) for i, (state, state_transitions) in states])
 *         pyrefs = {} # used to keep Python references alive (and intern them)
 */
  { /* enter inner scope */
    Py_ssize_t __pyx_8genexpr2__pyx_v_i;
    PyObject *__pyx_8genexpr2__pyx_v_state = NULL;
    CYTHON_UNUSED PyObject *__pyx_8genexpr2__pyx_v_state_transitions = NULL;
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
    __Pyx_GOTREF(__pyx_t_2);

    /* "acora/_acora.pyx":435
 * 
 *         node_offsets = dict([
 *             (state, i) for i, (state, state_transitions) in states])             # <<<<<<<<<<<<<<
 *         pyrefs = {} # used to keep Python references alive (and intern them)
 *         for i, (state, state_transitions) in states:
 */
    __pyx_t_1 = __pyx_v_states; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
    for (;;) {
      if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_7 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_7); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
      #else
      __pyx_t_7 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
      #endif
      if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) {
        PyObject* sequence = __pyx_t_7;
        #if CYTHON_COMPILING_IN_CPYTHON
        Py_ssize_t size = Py_SIZE(sequence);
        #else
        Py_ssize_t size = PySequence_Size(sequence);
        #endif
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
        }
        #if CYTHON_COMPILING_IN_CPYTHON
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          __pyx_t_8 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_9 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_9);
        #else
        __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
        __Pyx_GOTREF(__pyx_t_9);
        #endif
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_10 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext;
        index = 0; __pyx_t_8 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_8)) goto __pyx_L11_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_8);
        index = 1; __pyx_t_9 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L11_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_9);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
        __pyx_t_11 = NULL;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        goto __pyx_L12_unpacking_done;
        __pyx_L11_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_11 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
        __pyx_L12_unpacking_done:;
      }
      __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_8genexpr2__pyx_v_i = __pyx_t_6;
      if ((likely(PyTuple_CheckExact(__pyx_t_9))) || (PyList_CheckExact(__pyx_t_9))) {
        PyObject* sequence = __pyx_t_9;
        #if CYTHON_COMPILING_IN_CPYTHON
        Py_ssize_t size = Py_SIZE(sequence);
        #else
        Py_ssize_t size = PySequence_Size(sequence);
        #endif
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
        }
        #if CYTHON_COMPILING_IN_CPYTHON
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_10 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_12 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          __pyx_t_10 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_12 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(__pyx_t_12);
        #else
        __pyx_t_10 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_12 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
        __Pyx_GOTREF(__pyx_t_12);
        #endif
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_13 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
        __Pyx_GOTREF(__pyx_t_13);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_11 = Py_TYPE(__pyx_t_13)->tp_iternext;
        index = 0; __pyx_t_10 = __pyx_t_11(__pyx_t_13); if (unlikely(!__pyx_t_10)) goto __pyx_L13_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_10);
        index = 1; __pyx_t_12 = __pyx_t_11(__pyx_t_13); if (unlikely(!__pyx_t_12)) goto __pyx_L13_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_12);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_13), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
        __pyx_t_11 = NULL;
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        goto __pyx_L14_unpacking_done;
        __pyx_L13_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __pyx_t_11 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
        __pyx_L14_unpacking_done:;
      }
      __Pyx_XDECREF_SET(__pyx_8genexpr2__pyx_v_state, __pyx_t_10);
      __pyx_t_10 = 0;
      __Pyx_XDECREF_SET(__pyx_8genexpr2__pyx_v_state_transitions, __pyx_t_12);
      __pyx_t_12 = 0;
      __pyx_t_7 = PyInt_FromSsize_t(__pyx_8genexpr2__pyx_v_i); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_8genexpr2__pyx_v_state);
      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_8genexpr2__pyx_v_state);
      __Pyx_GIVEREF(__pyx_8genexpr2__pyx_v_state);
      PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_7);
      __pyx_t_7 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_9))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_state);
    __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_state_transitions);
    goto __pyx_L15_exit_scope;
    __pyx_L8_error:;
    __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_state);
    __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_state_transitions);
    goto __pyx_L1_error;
    __pyx_L15_exit_scope:;
  } /* exit inner scope */

  /* "acora/_acora.pyx":434
 *             c_nodes[i].targets = NULL
 * 
 *         node_offsets = dict([             # <<<<<<<<<<<<<<
 *             (state, i) for i, (state, state_transitions) in states])
 *         pyrefs = {} # used to keep Python references alive (and intern them)
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyDict_Type))), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_node_offsets = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "acora/_acora.pyx":436
 *         node_offsets = dict([
 *             (state, i) for i, (state, state_transitions) in states])
 *         pyrefs = {} # used to keep Python references alive (and intern them)             # <<<<<<<<<<<<<<
 *         for i, (state, state_transitions) in states:
 *             _init_bytes_node(&c_nodes[i], state, state_transitions,
 */
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_pyrefs = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "acora/_acora.pyx":437
 *             (state, i) for i, (state, state_transitions) in states])
 *         pyrefs = {} # used to keep Python references alive (and intern them)
 *         for i, (state, state_transitions) in states:             # <<<<<<<<<<<<<<
 *             _init_bytes_node(&c_nodes[i], state, state_transitions,
 *                              c_nodes, node_offsets, pyrefs)
 */
  __pyx_t_2 = __pyx_v_states; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
  for (;;) {
    if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #else
    __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
      PyObject* sequence = __pyx_t_1;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_9 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_7 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_7);
      #else
      __pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_8 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_11 = Py_TYPE(__pyx_t_8)->tp_iternext;
      index = 0; __pyx_t_9 = __pyx_t_11(__pyx_t_8); if (unlikely(!__pyx_t_9)) goto __pyx_L18_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_9);
      index = 1; __pyx_t_7 = __pyx_t_11(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L18_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_8), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_11 = NULL;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L19_unpacking_done;
      __pyx_L18_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_11 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L19_unpacking_done:;
    }
    __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_v_i = __pyx_t_6;
    if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) {
      PyObject* sequence = __pyx_t_7;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_12 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_8 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_12 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_12);
      #else
      __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_12 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_12);
      #endif
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_10 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext;
      index = 0; __pyx_t_8 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_8)) goto __pyx_L20_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_8);
      index = 1; __pyx_t_12 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_12)) goto __pyx_L20_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_12);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_11 = NULL;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      goto __pyx_L21_unpacking_done;
      __pyx_L20_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_11 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L21_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_state, __pyx_t_8);
    __pyx_t_8 = 0;
    __Pyx_XDECREF_SET(__pyx_v_state_transitions, __pyx_t_12);
    __pyx_t_12 = 0;

    /* "acora/_acora.pyx":438
 *         pyrefs = {} # used to keep Python references alive (and intern them)
 *         for i, (state, state_transitions) in states:
 *             _init_bytes_node(&c_nodes[i], state, state_transitions,             # <<<<<<<<<<<<<<
 *                              c_nodes, node_offsets, pyrefs)
 * 
 */
    if (!(likely(PyList_CheckExact(__pyx_v_state_transitions))||((__pyx_v_state_transitions) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_v_state_transitions)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "acora/_acora.pyx":439
 *         for i, (state, state_transitions) in states:
 *             _init_bytes_node(&c_nodes[i], state, state_transitions,
 *                              c_nodes, node_offsets, pyrefs)             # <<<<<<<<<<<<<<
 * 
 *         self._pyrefs = tuple(pyrefs)
 */
    __pyx_t_1 = __pyx_f_5acora_6_acora__init_bytes_node((&(__pyx_v_c_nodes[__pyx_v_i])), __pyx_v_state, ((PyObject*)__pyx_v_state_transitions), __pyx_v_c_nodes, __pyx_v_node_offsets, __pyx_v_pyrefs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "acora/_acora.pyx":441
 *                              c_nodes, node_offsets, pyrefs)
 * 
 *         self._pyrefs = tuple(pyrefs)             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_pyrefs);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_pyrefs);
  __Pyx_GIVEREF(__pyx_v_pyrefs);
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_pyrefs);
  __Pyx_DECREF(__pyx_v_self->_pyrefs);
  __pyx_v_self->_pyrefs = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "acora/_acora.pyx":416
 *     cdef tuple _pyrefs
 * 
 *     def __cinit__(self, start_state, dict transitions not None):             # <<<<<<<<<<<<<<
 *         cdef _AcoraBytesNodeStruct* c_nodes
 *         cdef Py_ssize_t i
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("acora._acora.BytesAcora.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_states);
  __Pyx_XDECREF(__pyx_v_node_offsets);
  __Pyx_XDECREF(__pyx_v_pyrefs);
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v_state_transitions);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "acora/_acora.pyx":443
 *         self._pyrefs = tuple(pyrefs)
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t i
 *         if self.start_node is not NULL:
 */

/* Python wrapper */
static void __pyx_pw_5acora_6_acora_10BytesAcora_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_5acora_6_acora_10BytesAcora_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_5acora_6_acora_10BytesAcora_2__dealloc__(((struct __pyx_obj_5acora_6_acora_BytesAcora *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_5acora_6_acora_10BytesAcora_2__dealloc__(struct __pyx_obj_5acora_6_acora_BytesAcora *__pyx_v_self) {
  Py_ssize_t __pyx_v_i;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "acora/_acora.pyx":445
 *     def __dealloc__(self):
 *         cdef Py_ssize_t i
 *         if self.start_node is not NULL:             # <<<<<<<<<<<<<<
 *             for i in range(self.node_count):
 *                 if self.start_node[i].targets is not NULL:
 */
  __pyx_t_1 = ((__pyx_v_self->start_node != NULL) != 0);
  if (__pyx_t_1) {

    /* "acora/_acora.pyx":446
 *         cdef Py_ssize_t i
 *         if self.start_node is not NULL:
 *             for i in range(self.node_count):             # <<<<<<<<<<<<<<
 *                 if self.start_node[i].targets is not NULL:
 *                     cpython.mem.PyMem_Free(self.start_node[i].targets)
 */
    __pyx_t_2 = __pyx_v_self->node_count;
    for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
      __pyx_v_i = __pyx_t_3;

      /* "acora/_acora.pyx":447
 *         if self.start_node is not NULL:
 *             for i in range(self.node_count):
 *                 if self.start_node[i].targets is not NULL:             # <<<<<<<<<<<<<<
 *                     cpython.mem.PyMem_Free(self.start_node[i].targets)
 *             cpython.mem.PyMem_Free(self.start_node)
 */
      __pyx_t_1 = (((__pyx_v_self->start_node[__pyx_v_i]).targets != NULL) != 0);
      if (__pyx_t_1) {

        /* "acora/_acora.pyx":448
 *             for i in range(self.node_count):
 *                 if self.start_node[i].targets is not NULL:
 *                     cpython.mem.PyMem_Free(self.start_node[i].targets)             # <<<<<<<<<<<<<<
 *             cpython.mem.PyMem_Free(self.start_node)
 * 
 */
        PyMem_Free((__pyx_v_self->start_node[__pyx_v_i]).targets);
        goto __pyx_L6;
      }
      __pyx_L6:;
    }

    /* "acora/_acora.pyx":449
 *                 if self.start_node[i].targets is not NULL:
 *                     cpython.mem.PyMem_Free(self.start_node[i].targets)
 *             cpython.mem.PyMem_Free(self.start_node)             # <<<<<<<<<<<<<<
 * 
 *     def __reduce__(self):
 */
    PyMem_Free(__pyx_v_self->start_node);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "acora/_acora.pyx":443
 *         self._pyrefs = tuple(pyrefs)
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t i
 *         if self.start_node is not NULL:
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "acora/_acora.pyx":451
 *             cpython.mem.PyMem_Free(self.start_node)
 * 
 *     def __reduce__(self):             # <<<<<<<<<<<<<<
 *         """pickle"""
 *         cdef _AcoraBytesNodeStruct* c_node
 */

/* Python wrapper */
static PyObject *__pyx_pw_5acora_6_acora_10BytesAcora_5__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5acora_6_acora_10BytesAcora_4__reduce__[] = "BytesAcora.__reduce__(self)\npickle";
static PyObject *__pyx_pw_5acora_6_acora_10BytesAcora_5__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5acora_6_acora_10BytesAcora_4__reduce__(((struct __pyx_obj_5acora_6_acora_BytesAcora *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5acora_6_acora_10BytesAcora_4__reduce__(struct __pyx_obj_5acora_6_acora_BytesAcora *__pyx_v_self) {
  __pyx_t_5acora_6_acora__AcoraBytesNodeStruct *__pyx_v_c_node;
  PyObject *__pyx_v_states = NULL;
  ptrdiff_t __pyx_v_state_id;
  PyObject *__pyx_v_state = NULL;
  PyObject **__pyx_v_match;
  PyObject *__pyx_v_transitions = NULL;
  int __pyx_v_i;
  unsigned char __pyx_v_ch;
  PyObject *__pyx_v_character = NULL;
  ptrdiff_t __pyx_v_target_id;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __pyx_t_5acora_6_acora__AcoraBytesNodeStruct *__pyx_t_2;
  __pyx_t_5acora_6_acora__AcoraBytesNodeStruct *__pyx_t_3;
  __pyx_t_5acora_6_acora__AcoraBytesNodeStruct *__pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject **__pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  char __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce__", 0);

  /* "acora/_acora.pyx":454
 *         """pickle"""
 *         cdef _AcoraBytesNodeStruct* c_node
 *         states = {}             # <<<<<<<<<<<<<<
 *         for c_node in self.start_node[:self.node_count]:
 *             state_id = c_node - self.start_node
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_states = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "acora/_acora.pyx":455
 *         cdef _AcoraBytesNodeStruct* c_node
 *         states = {}
 *         for c_node in self.start_node[:self.node_count]:             # <<<<<<<<<<<<<<
 *             state_id = c_node - self.start_node
 *             state = states[state_id] = build_NfaState(state_id)
 */
  __pyx_t_3 = (__pyx_v_self->start_node + __pyx_v_self->node_count);
  for (__pyx_t_4 = __pyx_v_self->start_node; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
    __pyx_t_2 = __pyx_t_4;
    __pyx_v_c_node = __pyx_t_2;

    /* "acora/_acora.pyx":456
 *         states = {}
 *         for c_node in self.start_node[:self.node_count]:
 *             state_id = c_node - self.start_node             # <<<<<<<<<<<<<<
 *             state = states[state_id] = build_NfaState(state_id)
 *             if c_node.matches:
 */
    __pyx_v_state_id = (__pyx_v_c_node - __pyx_v_self->start_node);

    /* "acora/_acora.pyx":457
 *         for c_node in self.start_node[:self.node_count]:
 *             state_id = c_node - self.start_node
 *             state = states[state_id] = build_NfaState(state_id)             # <<<<<<<<<<<<<<
 *             if c_node.matches:
 *                 match = c_node.matches
 */
    __pyx_t_1 = __Pyx_PyInt_From_ptrdiff_t(__pyx_v_state_id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = ((PyObject *)__pyx_f_5acora_6_acora_build_NfaState(__pyx_t_1, 0, NULL)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_XDECREF_SET(__pyx_v_state, __pyx_t_5);
    __pyx_t_1 = __Pyx_PyInt_From_ptrdiff_t(__pyx_v_state_id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (unlikely(PyDict_SetItem(__pyx_v_states, __pyx_t_1, __pyx_t_5) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "acora/_acora.pyx":458
 *             state_id = c_node - self.start_node
 *             state = states[state_id] = build_NfaState(state_id)
 *             if c_node.matches:             # <<<<<<<<<<<<<<
 *                 match = c_node.matches
 *                 while match[0]:
 */
    __pyx_t_6 = (__pyx_v_c_node->matches != 0);
    if (__pyx_t_6) {

      /* "acora/_acora.pyx":459
 *             state = states[state_id] = build_NfaState(state_id)
 *             if c_node.matches:
 *                 match = c_node.matches             # <<<<<<<<<<<<<<
 *                 while match[0]:
 *                     state.matches.append(<bytes>match[0])
 */
      __pyx_t_7 = __pyx_v_c_node->matches;
      __pyx_v_match = __pyx_t_7;

      /* "acora/_acora.pyx":460
 *             if c_node.matches:
 *                 match = c_node.matches
 *                 while match[0]:             # <<<<<<<<<<<<<<
 *                     state.matches.append(<bytes>match[0])
 *                     match += 1
 */
      while (1) {
        __pyx_t_6 = ((__pyx_v_match[0]) != 0);
        if (!__pyx_t_6) break;

        /* "acora/_acora.pyx":461
 *                 match = c_node.matches
 *                 while match[0]:
 *                     state.matches.append(<bytes>match[0])             # <<<<<<<<<<<<<<
 *                     match += 1
 * 
 */
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_state, __pyx_n_s_matches); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_8 = __Pyx_PyObject_Append(__pyx_t_5, ((PyObject *)(__pyx_v_match[0]))); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "acora/_acora.pyx":462
 *                 while match[0]:
 *                     state.matches.append(<bytes>match[0])
 *                     match += 1             # <<<<<<<<<<<<<<
 * 
 *         transitions = {}
 */
        __pyx_v_match = (__pyx_v_match + 1);
      }
      goto __pyx_L5;
    }
    __pyx_L5:;
  }

  /* "acora/_acora.pyx":464
 *                     match += 1
 * 
 *         transitions = {}             # <<<<<<<<<<<<<<
 *         for c_node in self.start_node[:self.node_count]:
 *             state_id = c_node - self.start_node
 */
  __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_v_transitions = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "acora/_acora.pyx":465
 * 
 *         transitions = {}
 *         for c_node in self.start_node[:self.node_count]:             # <<<<<<<<<<<<<<
 *             state_id = c_node - self.start_node
 *             state = states[state_id]
 */
  __pyx_t_3 = (__pyx_v_self->start_node + __pyx_v_self->node_count);
  for (__pyx_t_4 = __pyx_v_self->start_node; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
    __pyx_t_2 = __pyx_t_4;
    __pyx_v_c_node = __pyx_t_2;

    /* "acora/_acora.pyx":466
 *         transitions = {}
 *         for c_node in self.start_node[:self.node_count]:
 *             state_id = c_node - self.start_node             # <<<<<<<<<<<<<<
 *             state = states[state_id]
 *             for i in range(c_node.char_count):
 */
    __pyx_v_state_id = (__pyx_v_c_node - __pyx_v_self->start_node);

    /* "acora/_acora.pyx":467
 *         for c_node in self.start_node[:self.node_count]:
 *             state_id = c_node - self.start_node
 *             state = states[state_id]             # <<<<<<<<<<<<<<
 *             for i in range(c_node.char_count):
 *                 ch = c_node.characters[i]
 */
    __pyx_t_5 = __Pyx_PyInt_From_ptrdiff_t(__pyx_v_state_id); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_states, __pyx_t_5); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_state, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "acora/_acora.pyx":468
 *             state_id = c_node - self.start_node
 *             state = states[state_id]
 *             for i in range(c_node.char_count):             # <<<<<<<<<<<<<<
 *                 ch = c_node.characters[i]
 *                 character = <bytes>ch if PY_MAJOR_VERSION < 3 else ch
 */
    __pyx_t_9 = __pyx_v_c_node->char_count;
    for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
      __pyx_v_i = __pyx_t_10;

      /* "acora/_acora.pyx":469
 *             state = states[state_id]
 *             for i in range(c_node.char_count):
 *                 ch = c_node.characters[i]             # <<<<<<<<<<<<<<
 *                 character = <bytes>ch if PY_MAJOR_VERSION < 3 else ch
 *                 target_id = c_node.targets[i] - self.start_node
 */
      __pyx_v_ch = (__pyx_v_c_node->characters[__pyx_v_i]);

      /* "acora/_acora.pyx":470
 *             for i in range(c_node.char_count):
 *                 ch = c_node.characters[i]
 *                 character = <bytes>ch if PY_MAJOR_VERSION < 3 else ch             # <<<<<<<<<<<<<<
 *                 target_id = c_node.targets[i] - self.start_node
 *                 transitions[(state, character)] = states[target_id]
 */
      if (((PY_MAJOR_VERSION < 3) != 0)) {
        __pyx_t_11 = (char)__pyx_v_ch;
        __pyx_t_5 = PyBytes_FromStringAndSize(&__pyx_t_11, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_1 = __pyx_t_5;
        __pyx_t_5 = 0;
      } else {
        __pyx_t_5 = __Pyx_PyInt_From_unsigned_char(__pyx_v_ch); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_1 = __pyx_t_5;
        __pyx_t_5 = 0;
      }
      __Pyx_XDECREF_SET(__pyx_v_character, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "acora/_acora.pyx":471
 *                 ch = c_node.characters[i]
 *                 character = <bytes>ch if PY_MAJOR_VERSION < 3 else ch
 *                 target_id = c_node.targets[i] - self.start_node             # <<<<<<<<<<<<<<
 *                 transitions[(state, character)] = states[target_id]
 * 
 */
      __pyx_v_target_id = ((__pyx_v_c_node->targets[__pyx_v_i]) - __pyx_v_self->start_node);

      /* "acora/_acora.pyx":472
 *                 character = <bytes>ch if PY_MAJOR_VERSION < 3 else ch
 *                 target_id = c_node.targets[i] - self.start_node
 *                 transitions[(state, character)] = states[target_id]             # <<<<<<<<<<<<<<
 * 
 *         return type(self), (states[0], transitions)
 */
      __pyx_t_1 = __Pyx_PyInt_From_ptrdiff_t(__pyx_v_target_id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = __Pyx_PyDict_GetItem(__pyx_v_states, __pyx_t_1); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_v_state);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_state);
      __Pyx_GIVEREF(__pyx_v_state);
      __Pyx_INCREF(__pyx_v_character);
      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_character);
      __Pyx_GIVEREF(__pyx_v_character);
      if (unlikely(PyDict_SetItem(__pyx_v_transitions, __pyx_t_1, __pyx_t_5) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  }

  /* "acora/_acora.pyx":474
 *                 transitions[(state, character)] = states[target_id]
 * 
 *         return type(self), (states[0], transitions)             # <<<<<<<<<<<<<<
 * 
 *     cpdef finditer(self, bytes data):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = __Pyx_PyDict_GetItem(__pyx_v_states, __pyx_int_0); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_transitions);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_transitions);
  __Pyx_GIVEREF(__pyx_v_transitions);
  __pyx_t_5 = 0;
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
  PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
  __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "acora/_acora.pyx":451
 *             cpython.mem.PyMem_Free(self.start_node)
 * 
 *     def __reduce__(self):             # <<<<<<<<<<<<<<
 *         """pickle"""
 *         cdef _AcoraBytesNodeStruct* c_node
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("acora._acora.BytesAcora.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_states);
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v_transitions);
  __Pyx_XDECREF(__pyx_v_character);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "acora/_acora.pyx":476
 *         return type(self), (states[0], transitions)
 * 
 *     cpdef finditer(self, bytes data):             # <<<<<<<<<<<<<<
 *         """Iterate over all occurrences of any keyword in the string.
 * 
 */

static PyObject *__pyx_pw_5acora_6_acora_10BytesAcora_7finditer(PyObject *__pyx_v_self, PyObject *__pyx_v_data); /*proto*/
static PyObject *__pyx_f_5acora_6_acora_10BytesAcora_finditer(struct __pyx_obj_5acora_6_acora_BytesAcora *__pyx_v_self, PyObject *__pyx_v_data, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("finditer", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_finditer); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_5acora_6_acora_10BytesAcora_7finditer)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_v_data);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_data);
      __Pyx_GIVEREF(__pyx_v_data);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "acora/_acora.pyx":481
 *         Returns (keyword, offset) pairs.
 *         """
 *         return _BytesAcoraIter(self, data)             # <<<<<<<<<<<<<<
 * 
 *     def findall(self, bytes data):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __Pyx_INCREF(__pyx_v_data);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_data);
  __Pyx_GIVEREF(__pyx_v_data);
  __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5acora_6_acora__BytesAcoraIter)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "acora/_acora.pyx":476
 *         return type(self), (states[0], transitions)
 * 
 *     cpdef finditer(self, bytes data):             # <<<<<<<<<<<<<<
 *         """Iterate over all occurrences of any keyword in the string.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("acora._acora.BytesAcora.finditer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5acora_6_acora_10BytesAcora_7finditer(PyObject *__pyx_v_self, PyObject *__pyx_v_data); /*proto*/
static char __pyx_doc_5acora_6_acora_10BytesAcora_6finditer[] = "BytesAcora.finditer(self, bytes data)\nIterate over all occurrences of any keyword in the string.\n\n        Returns (keyword, offset) pairs.\n        ";
static PyObject *__pyx_pw_5acora_6_acora_10BytesAcora_7finditer(PyObject *__pyx_v_self, PyObject *__pyx_v_data) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("finditer (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data), (&PyBytes_Type), 1, "data", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_5acora_6_acora_10BytesAcora_6finditer(((struct __pyx_obj_5acora_6_acora_BytesAcora *)__pyx_v_self), ((PyObject*)__pyx_v_data));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5acora_6_acora_10BytesAcora_6finditer(struct __pyx_obj_5acora_6_acora_BytesAcora *__pyx_v_self, PyObject *__pyx_v_data) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("finditer", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_5acora_6_acora_BytesAcora *)__pyx_v_self->__pyx_vtab)->finditer(__pyx_v_self, __pyx_v_data, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("acora._acora.BytesAcora.finditer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "acora/_acora.pyx":483
 *         return _BytesAcoraIter(self, data)
 * 
 *     def findall(self, bytes data):             # <<<<<<<<<<<<<<
 *         """Find all occurrences of any keyword in the string.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5acora_6_acora_10BytesAcora_9findall(PyObject *__pyx_v_self, PyObject *__pyx_v_data); /*proto*/
static char __pyx_doc_5acora_6_acora_10BytesAcora_8findall[] = "BytesAcora.findall(self, bytes data)\nFind all occurrences of any keyword in the string.\n\n        Returns a list of (keyword, offset) pairs.\n        ";
static PyObject *__pyx_pw_5acora_6_acora_10BytesAcora_9findall(PyObject *__pyx_v_self, PyObject *__pyx_v_data) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("findall (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data), (&PyBytes_Type), 1, "data", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_5acora_6_acora_10BytesAcora_8findall(((struct __pyx_obj_5acora_6_acora_BytesAcora *)__pyx_v_self), ((PyObject*)__pyx_v_data));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5acora_6_acora_10BytesAcora_8findall(struct __pyx_obj_5acora_6_acora_BytesAcora *__pyx_v_self, PyObject *__pyx_v_data) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("findall", 0);

  /* "acora/_acora.pyx":488
 *         Returns a list of (keyword, offset) pairs.
 *         """
 *         return list(self.finditer(data))             # <<<<<<<<<<<<<<
 * 
 *     def filefind(self, f):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_5acora_6_acora_BytesAcora *)__pyx_v_self->__pyx_vtab)->finditer(__pyx_v_self, __pyx_v_data, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "acora/_acora.pyx":483
 *         return _BytesAcoraIter(self, data)
 * 
 *     def findall(self, bytes data):             # <<<<<<<<<<<<<<
 *         """Find all occurrences of any keyword in the string.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("acora._acora.BytesAcora.findall", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "acora/_acora.pyx":490
 *         return list(self.finditer(data))
 * 
 *     def filefind(self, f):             # <<<<<<<<<<<<<<
 *         """Iterate over all occurrences of any keyword in a file.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5acora_6_acora_10BytesAcora_11filefind(PyObject *__pyx_v_self, PyObject *__pyx_v_f); /*proto*/
static char __pyx_doc_5acora_6_acora_10BytesAcora_10filefind[] = "BytesAcora.filefind(self, f)\nIterate over all occurrences of any keyword in a file.\n\n        The file must be either a file path, a file opened in binary mode\n        or a file-like object returning bytes objects on .read().\n\n        Returns (keyword, offset) pairs.\n        ";
static PyObject *__pyx_pw_5acora_6_acora_10BytesAcora_11filefind(PyObject *__pyx_v_self, PyObject *__pyx_v_f) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("filefind (wrapper)", 0);
  __pyx_r = __pyx_pf_5acora_6_acora_10BytesAcora_10filefind(((struct __pyx_obj_5acora_6_acora_BytesAcora *)__pyx_v_self), ((PyObject *)__pyx_v_f));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5acora_6_acora_10BytesAcora_10filefind(struct __pyx_obj_5acora_6_acora_BytesAcora *__pyx_v_self, PyObject *__pyx_v_f) {
  int __pyx_v_close_file;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("filefind", 0);
  __Pyx_INCREF(__pyx_v_f);

  /* "acora/_acora.pyx":498
 *         Returns (keyword, offset) pairs.
 *         """
 *         close_file = False             # <<<<<<<<<<<<<<
 *         if not hasattr(f, 'read'):
 *             f = open(f, 'rb')
 */
  __pyx_v_close_file = 0;

  /* "acora/_acora.pyx":499
 *         """
 *         close_file = False
 *         if not hasattr(f, 'read'):             # <<<<<<<<<<<<<<
 *             f = open(f, 'rb')
 *             close_file = True
 */
  __pyx_t_1 = PyObject_HasAttr(__pyx_v_f, __pyx_n_u_read); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (__pyx_t_2) {

    /* "acora/_acora.pyx":500
 *         close_file = False
 *         if not hasattr(f, 'read'):
 *             f = open(f, 'rb')             # <<<<<<<<<<<<<<
 *             close_file = True
 *         return _FileAcoraIter(self, f, close_file)
 */
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_f);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_f);
    __Pyx_GIVEREF(__pyx_v_f);
    __Pyx_INCREF(__pyx_n_u_rb);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_n_u_rb);
    __Pyx_GIVEREF(__pyx_n_u_rb);
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_f, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "acora/_acora.pyx":501
 *         if not hasattr(f, 'read'):
 *             f = open(f, 'rb')
 *             close_file = True             # <<<<<<<<<<<<<<
 *         return _FileAcoraIter(self, f, close_file)
 * 
 */
    __pyx_v_close_file = 1;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "acora/_acora.pyx":502
 *             f = open(f, 'rb')
 *             close_file = True
 *         return _FileAcoraIter(self, f, close_file)             # <<<<<<<<<<<<<<
 * 
 *     def filefindall(self, f):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_close_file); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __Pyx_INCREF(__pyx_v_f);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_f);
  __Pyx_GIVEREF(__pyx_v_f);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5acora_6_acora__FileAcoraIter)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "acora/_acora.pyx":490
 *         return list(self.finditer(data))
 * 
 *     def filefind(self, f):             # <<<<<<<<<<<<<<
 *         """Iterate over all occurrences of any keyword in a file.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("acora._acora.BytesAcora.filefind", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_f);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "acora/_acora.pyx":504
 *         return _FileAcoraIter(self, f, close_file)
 * 
 *     def filefindall(self, f):             # <<<<<<<<<<<<<<
 *         """Find all occurrences of any keyword in a file.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5acora_6_acora_10BytesAcora_13filefindall(PyObject *__pyx_v_self, PyObject *__pyx_v_f); /*proto*/
static char __pyx_doc_5acora_6_acora_10BytesAcora_12filefindall[] = "BytesAcora.filefindall(self, f)\nFind all occurrences of any keyword in a file.\n\n        Returns a list of (keyword, offset) pairs.\n        ";
static PyObject *__pyx_pw_5acora_6_acora_10BytesAcora_13filefindall(PyObject *__pyx_v_self, PyObject *__pyx_v_f) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("filefindall (wrapper)", 0);
  __pyx_r = __pyx_pf_5acora_6_acora_10BytesAcora_12filefindall(((struct __pyx_obj_5acora_6_acora_BytesAcora *)__pyx_v_self), ((PyObject *)__pyx_v_f));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5acora_6_acora_10BytesAcora_12filefindall(struct __pyx_obj_5acora_6_acora_BytesAcora *__pyx_v_self, PyObject *__pyx_v_f) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("filefindall", 0);

  /* "acora/_acora.pyx":509
 *         Returns a list of (keyword, offset) pairs.
 *         """
 *         return list(self.filefind(f))             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_filefind); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_f);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_f);
  __Pyx_GIVEREF(__pyx_v_f);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "acora/_acora.pyx":504
 *         return _FileAcoraIter(self, f, close_file)
 * 
 *     def filefindall(self, f):             # <<<<<<<<<<<<<<
 *         """Find all occurrences of any keyword in a file.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("acora._acora.BytesAcora.filefindall", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "acora/_acora.pyx":522
 *     cdef unsigned char* data_start
 * 
 *     def __cinit__(self, BytesAcora acora not None, bytes data):             # <<<<<<<<<<<<<<
 *         assert acora.start_node is not NULL and acora.start_node.matches is NULL
 *         self.acora = acora
 */

/* Python wrapper */
static int __pyx_pw_5acora_6_acora_15_BytesAcoraIter_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5acora_6_acora_15_BytesAcoraIter_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_5acora_6_acora_BytesAcora *__pyx_v_acora = 0;
  PyObject *__pyx_v_data = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_acora,&__pyx_n_s_data,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_acora)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_data)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_acora = ((struct __pyx_obj_5acora_6_acora_BytesAcora *)values[0]);
    __pyx_v_data = ((PyObject*)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("acora._acora._BytesAcoraIter.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_acora), __pyx_ptype_5acora_6_acora_BytesAcora, 0, "acora", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data), (&PyBytes_Type), 1, "data", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_5acora_6_acora_15_BytesAcoraIter___cinit__(((struct __pyx_obj_5acora_6_acora__BytesAcoraIter *)__pyx_v_self), __pyx_v_acora, __pyx_v_data);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5acora_6_acora_15_BytesAcoraIter___cinit__(struct __pyx_obj_5acora_6_acora__BytesAcoraIter *__pyx_v_self, struct __pyx_obj_5acora_6_acora_BytesAcora *__pyx_v_acora, PyObject *__pyx_v_data) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __pyx_t_5acora_6_acora__AcoraBytesNodeStruct *__pyx_t_4;
  unsigned char *__pyx_t_5;
  Py_ssize_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "acora/_acora.pyx":523
 * 
 *     def __cinit__(self, BytesAcora acora not None, bytes data):
 *         assert acora.start_node is not NULL and acora.start_node.matches is NULL             # <<<<<<<<<<<<<<
 *         self.acora = acora
 *         self.start_node = self.current_node = acora.start_node
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_1 = ((__pyx_v_acora->start_node != NULL) != 0);
    if (__pyx_t_1) {
      __pyx_t_2 = ((__pyx_v_acora->start_node->matches == NULL) != 0);
      __pyx_t_3 = __pyx_t_2;
    } else {
      __pyx_t_3 = __pyx_t_1;
    }
    if (unlikely(!__pyx_t_3)) {
      PyErr_SetNone(PyExc_AssertionError);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  #endif

  /* "acora/_acora.pyx":524
 *     def __cinit__(self, BytesAcora acora not None, bytes data):
 *         assert acora.start_node is not NULL and acora.start_node.matches is NULL
 *         self.acora = acora             # <<<<<<<<<<<<<<
 *         self.start_node = self.current_node = acora.start_node
 *         self.match_index = 0
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_acora));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_acora));
  __Pyx_GOTREF(__pyx_v_self->acora);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->acora));
  __pyx_v_self->acora = __pyx_v_acora;

  /* "acora/_acora.pyx":525
 *         assert acora.start_node is not NULL and acora.start_node.matches is NULL
 *         self.acora = acora
 *         self.start_node = self.current_node = acora.start_node             # <<<<<<<<<<<<<<
 *         self.match_index = 0
 *         self.data_char = self.data_start = self.data = data
 */
  __pyx_t_4 = __pyx_v_acora->start_node;
  __pyx_v_self->start_node = __pyx_t_4;
  __pyx_v_self->current_node = __pyx_t_4;

  /* "acora/_acora.pyx":526
 *         self.acora = acora
 *         self.start_node = self.current_node = acora.start_node
 *         self.match_index = 0             # <<<<<<<<<<<<<<
 *         self.data_char = self.data_start = self.data = data
 *         self.data_end = self.data_char + len(data)
 */
  __pyx_v_self->match_index = 0;

  /* "acora/_acora.pyx":527
 *         self.start_node = self.current_node = acora.start_node
 *         self.match_index = 0
 *         self.data_char = self.data_start = self.data = data             # <<<<<<<<<<<<<<
 *         self.data_end = self.data_char + len(data)
 * 
 */
  __pyx_t_5 = __Pyx_PyObject_AsUString(__pyx_v_data); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_self->data_char = __pyx_t_5;
  __pyx_t_5 = __Pyx_PyObject_AsUString(__pyx_v_data); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_self->data_start = __pyx_t_5;
  __Pyx_INCREF(__pyx_v_data);
  __Pyx_GIVEREF(__pyx_v_data);
  __Pyx_GOTREF(__pyx_v_self->data);
  __Pyx_DECREF(__pyx_v_self->data);
  __pyx_v_self->data = __pyx_v_data;

  /* "acora/_acora.pyx":528
 *         self.match_index = 0
 *         self.data_char = self.data_start = self.data = data
 *         self.data_end = self.data_char + len(data)             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  if (unlikely(__pyx_v_data == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_6 = PyBytes_GET_SIZE(__pyx_v_data); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_self->data_end = (__pyx_v_self->data_char + __pyx_t_6);

  /* "acora/_acora.pyx":522
 *     cdef unsigned char* data_start
 * 
 *     def __cinit__(self, BytesAcora acora not None, bytes data):             # <<<<<<<<<<<<<<
 *         assert acora.start_node is not NULL and acora.start_node.matches is NULL
 *         self.acora = acora
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("acora._acora._BytesAcoraIter.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "acora/_acora.pyx":530
 *         self.data_end = self.data_char + len(data)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5acora_6_acora_15_BytesAcoraIter_3__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5acora_6_acora_15_BytesAcoraIter_3__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5acora_6_acora_15_BytesAcoraIter_2__iter__(((struct __pyx_obj_5acora_6_acora__BytesAcoraIter *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5acora_6_acora_15_BytesAcoraIter_2__iter__(struct __pyx_obj_5acora_6_acora__BytesAcoraIter *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "acora/_acora.pyx":531
 * 
 *     def __iter__(self):
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __next__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "acora/_acora.pyx":530
 *         self.data_end = self.data_char + len(data)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "acora/_acora.pyx":533
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         cdef unsigned char* data_char = self.data_char
 *         cdef unsigned char* data_end = self.data_end
 */

/* Python wrapper */
static PyObject *__pyx_pw_5acora_6_acora_15_BytesAcoraIter_5__next__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5acora_6_acora_15_BytesAcoraIter_5__next__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5acora_6_acora_15_BytesAcoraIter_4__next__(((struct __pyx_obj_5acora_6_acora__BytesAcoraIter *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5acora_6_acora_15_BytesAcoraIter_4__next__(struct __pyx_obj_5acora_6_acora__BytesAcoraIter *__pyx_v_self) {
  CYTHON_UNUSED unsigned char *__pyx_v_data_char;
  unsigned char *__pyx_v_data_end;
  int __pyx_v_found;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  unsigned char *__pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__next__", 0);

  /* "acora/_acora.pyx":534
 * 
 *     def __next__(self):
 *         cdef unsigned char* data_char = self.data_char             # <<<<<<<<<<<<<<
 *         cdef unsigned char* data_end = self.data_end
 *         cdef unsigned char* test_chars
 */
  __pyx_t_1 = __pyx_v_self->data_char;
  __pyx_v_data_char = __pyx_t_1;

  /* "acora/_acora.pyx":535
 *     def __next__(self):
 *         cdef unsigned char* data_char = self.data_char
 *         cdef unsigned char* data_end = self.data_end             # <<<<<<<<<<<<<<
 *         cdef unsigned char* test_chars
 *         cdef unsigned char current_char
 */
  __pyx_t_1 = __pyx_v_self->data_end;
  __pyx_v_data_end = __pyx_t_1;

  /* "acora/_acora.pyx":538
 *         cdef unsigned char* test_chars
 *         cdef unsigned char current_char
 *         cdef int i, found = 0             # <<<<<<<<<<<<<<
 *         if self.current_node.matches is not NULL:
 *             if self.current_node.matches[self.match_index] is not NULL:
 */
  __pyx_v_found = 0;

  /* "acora/_acora.pyx":539
 *         cdef unsigned char current_char
 *         cdef int i, found = 0
 *         if self.current_node.matches is not NULL:             # <<<<<<<<<<<<<<
 *             if self.current_node.matches[self.match_index] is not NULL:
 *                 return self._build_next_match()
 */
  __pyx_t_2 = ((__pyx_v_self->current_node->matches != NULL) != 0);
  if (__pyx_t_2) {

    /* "acora/_acora.pyx":540
 *         cdef int i, found = 0
 *         if self.current_node.matches is not NULL:
 *             if self.current_node.matches[self.match_index] is not NULL:             # <<<<<<<<<<<<<<
 *                 return self._build_next_match()
 *             self.match_index = 0
 */
    __pyx_t_2 = (((__pyx_v_self->current_node->matches[__pyx_v_self->match_index]) != NULL) != 0);
    if (__pyx_t_2) {

      /* "acora/_acora.pyx":541
 *         if self.current_node.matches is not NULL:
 *             if self.current_node.matches[self.match_index] is not NULL:
 *                 return self._build_next_match()             # <<<<<<<<<<<<<<
 *             self.match_index = 0
 *         with nogil:
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = ((struct __pyx_vtabstruct_5acora_6_acora__BytesAcoraIter *)__pyx_v_self->__pyx_vtab)->_build_next_match(__pyx_v_self); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L0;
    }

    /* "acora/_acora.pyx":542
 *             if self.current_node.matches[self.match_index] is not NULL:
 *                 return self._build_next_match()
 *             self.match_index = 0             # <<<<<<<<<<<<<<
 *         with nogil:
 *             found = _search_in_bytes(self.start_node, data_end,
 */
    __pyx_v_self->match_index = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "acora/_acora.pyx":543
 *                 return self._build_next_match()
 *             self.match_index = 0
 *         with nogil:             # <<<<<<<<<<<<<<
 *             found = _search_in_bytes(self.start_node, data_end,
 *                                      &self.data_char, &self.current_node)
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      #endif
      /*try:*/ {

        /* "acora/_acora.pyx":544
 *             self.match_index = 0
 *         with nogil:
 *             found = _search_in_bytes(self.start_node, data_end,             # <<<<<<<<<<<<<<
 *                                      &self.data_char, &self.current_node)
 *         if found:
 */
        __pyx_v_found = __pyx_f_5acora_6_acora__search_in_bytes(__pyx_v_self->start_node, __pyx_v_data_end, (&__pyx_v_self->data_char), (&__pyx_v_self->current_node));
      }

      /* "acora/_acora.pyx":543
 *                 return self._build_next_match()
 *             self.match_index = 0
 *         with nogil:             # <<<<<<<<<<<<<<
 *             found = _search_in_bytes(self.start_node, data_end,
 *                                      &self.data_char, &self.current_node)
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L7;
        }
        __pyx_L7:;
      }
  }

  /* "acora/_acora.pyx":546
 *             found = _search_in_bytes(self.start_node, data_end,
 *                                      &self.data_char, &self.current_node)
 *         if found:             # <<<<<<<<<<<<<<
 *             return self._build_next_match()
 *         raise StopIteration
 */
  __pyx_t_2 = (__pyx_v_found != 0);
  if (__pyx_t_2) {

    /* "acora/_acora.pyx":547
 *                                      &self.data_char, &self.current_node)
 *         if found:
 *             return self._build_next_match()             # <<<<<<<<<<<<<<
 *         raise StopIteration
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = ((struct __pyx_vtabstruct_5acora_6_acora__BytesAcoraIter *)__pyx_v_self->__pyx_vtab)->_build_next_match(__pyx_v_self); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "acora/_acora.pyx":548
 *         if found:
 *             return self._build_next_match()
 *         raise StopIteration             # <<<<<<<<<<<<<<
 * 
 *     cdef _build_next_match(self):
 */
  __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "acora/_acora.pyx":533
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         cdef unsigned char* data_char = self.data_char
 *         cdef unsigned char* data_end = self.data_end
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("acora._acora._BytesAcoraIter.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "acora/_acora.pyx":550
 *         raise StopIteration
 * 
 *     cdef _build_next_match(self):             # <<<<<<<<<<<<<<
 *         match = <bytes> self.current_node.matches[self.match_index]
 *         self.match_index += 1
 */

static PyObject *__pyx_f_5acora_6_acora_15_BytesAcoraIter__build_next_match(struct __pyx_obj_5acora_6_acora__BytesAcoraIter *__pyx_v_self) {
  PyObject *__pyx_v_match = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_build_next_match", 0);

  /* "acora/_acora.pyx":551
 * 
 *     cdef _build_next_match(self):
 *         match = <bytes> self.current_node.matches[self.match_index]             # <<<<<<<<<<<<<<
 *         self.match_index += 1
 *         return (match, <Py_ssize_t>(self.data_char - self.data_start) - len(match))
 */
  __pyx_t_1 = ((PyObject *)(__pyx_v_self->current_node->matches[__pyx_v_self->match_index]));
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_match = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "acora/_acora.pyx":552
 *     cdef _build_next_match(self):
 *         match = <bytes> self.current_node.matches[self.match_index]
 *         self.match_index += 1             # <<<<<<<<<<<<<<
 *         return (match, <Py_ssize_t>(self.data_char - self.data_start) - len(match))
 * 
 */
  __pyx_v_self->match_index = (__pyx_v_self->match_index + 1);

  /* "acora/_acora.pyx":553
 *         match = <bytes> self.current_node.matches[self.match_index]
 *         self.match_index += 1
 *         return (match, <Py_ssize_t>(self.data_char - self.data_start) - len(match))             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(__pyx_v_match == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_2 = PyBytes_GET_SIZE(__pyx_v_match); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = PyInt_FromSsize_t((((Py_ssize_t)(__pyx_v_self->data_char - __pyx_v_self->data_start)) - __pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_match);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_match);
  __Pyx_GIVEREF(__pyx_v_match);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "acora/_acora.pyx":550
 *         raise StopIteration
 * 
 *     cdef _build_next_match(self):             # <<<<<<<<<<<<<<
 *         match = <bytes> self.current_node.matches[self.match_index]
 *         self.match_index += 1
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("acora._acora._BytesAcoraIter._build_next_match", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_match);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "acora/_acora.pyx":556
 * 
 * 
 * cdef int _search_in_bytes(_AcoraBytesNodeStruct* start_node,             # <<<<<<<<<<<<<<
 *                           unsigned char* data_end,
 *                           unsigned char** _data_char,
 */

static int __pyx_f_5acora_6_acora__search_in_bytes(__pyx_t_5acora_6_acora__AcoraBytesNodeStruct *__pyx_v_start_node, unsigned char *__pyx_v_data_end, unsigned char **__pyx_v__data_char, __pyx_t_5acora_6_acora__AcoraBytesNodeStruct **__pyx_v__current_node) {
  unsigned char *__pyx_v_data_char;
  __pyx_t_5acora_6_acora__AcoraBytesNodeStruct *__pyx_v_current_node;
  unsigned char *__pyx_v_test_chars;
  unsigned char __pyx_v_current_char;
  int __pyx_v_i;
  int __pyx_v_found;
  int __pyx_v_start;
  int __pyx_v_mid;
  int __pyx_v_end;
  int __pyx_r;
  int __pyx_t_1;
  unsigned char *__pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;

  /* "acora/_acora.pyx":560
 *                           unsigned char** _data_char,
 *                           _AcoraBytesNodeStruct** _current_node) nogil:
 *     cdef unsigned char* data_char = _data_char[0]             # <<<<<<<<<<<<<<
 *     cdef _AcoraBytesNodeStruct* current_node = _current_node[0]
 *     cdef unsigned char* test_chars
 */
  __pyx_v_data_char = (__pyx_v__data_char[0]);

  /* "acora/_acora.pyx":561
 *                           _AcoraBytesNodeStruct** _current_node) nogil:
 *     cdef unsigned char* data_char = _data_char[0]
 *     cdef _AcoraBytesNodeStruct* current_node = _current_node[0]             # <<<<<<<<<<<<<<
 *     cdef unsigned char* test_chars
 *     cdef unsigned char current_char
 */
  __pyx_v_current_node = (__pyx_v__current_node[0]);

  /* "acora/_acora.pyx":564
 *     cdef unsigned char* test_chars
 *     cdef unsigned char current_char
 *     cdef int i, found = 0, start, mid, end             # <<<<<<<<<<<<<<
 * 
 *     while data_char < data_end:
 */
  __pyx_v_found = 0;

  /* "acora/_acora.pyx":566
 *     cdef int i, found = 0, start, mid, end
 * 
 *     while data_char < data_end:             # <<<<<<<<<<<<<<
 *         current_char = data_char[0]
 *         data_char += 1
 */
  while (1) {
    __pyx_t_1 = ((__pyx_v_data_char < __pyx_v_data_end) != 0);
    if (!__pyx_t_1) break;

    /* "acora/_acora.pyx":567
 * 
 *     while data_char < data_end:
 *         current_char = data_char[0]             # <<<<<<<<<<<<<<
 *         data_char += 1
 *         test_chars = current_node.characters
 */
    __pyx_v_current_char = (__pyx_v_data_char[0]);

    /* "acora/_acora.pyx":568
 *     while data_char < data_end:
 *         current_char = data_char[0]
 *         data_char += 1             # <<<<<<<<<<<<<<
 *         test_chars = current_node.characters
 *         if current_char == test_chars[0]:
 */
    __pyx_v_data_char = (__pyx_v_data_char + 1);

    /* "acora/_acora.pyx":569
 *         current_char = data_char[0]
 *         data_char += 1
 *         test_chars = current_node.characters             # <<<<<<<<<<<<<<
 *         if current_char == test_chars[0]:
 *             current_node = current_node.targets[0]
 */
    __pyx_t_2 = __pyx_v_current_node->characters;
    __pyx_v_test_chars = __pyx_t_2;

    /* "acora/_acora.pyx":570
 *         data_char += 1
 *         test_chars = current_node.characters
 *         if current_char == test_chars[0]:             # <<<<<<<<<<<<<<
 *             current_node = current_node.targets[0]
 *         elif current_char < test_chars[0] \
 */
    __pyx_t_1 = ((__pyx_v_current_char == (__pyx_v_test_chars[0])) != 0);
    if (__pyx_t_1) {

      /* "acora/_acora.pyx":571
 *         test_chars = current_node.characters
 *         if current_char == test_chars[0]:
 *             current_node = current_node.targets[0]             # <<<<<<<<<<<<<<
 *         elif current_char < test_chars[0] \
 *                 or current_char > test_chars[current_node.char_count-1]:
 */
      __pyx_v_current_node = (__pyx_v_current_node->targets[0]);
      goto __pyx_L5;
    }

    /* "acora/_acora.pyx":572
 *         if current_char == test_chars[0]:
 *             current_node = current_node.targets[0]
 *         elif current_char < test_chars[0] \             # <<<<<<<<<<<<<<
 *                 or current_char > test_chars[current_node.char_count-1]:
 *             current_node = start_node
 */
    __pyx_t_1 = ((__pyx_v_current_char < (__pyx_v_test_chars[0])) != 0);
    if (!__pyx_t_1) {

      /* "acora/_acora.pyx":573
 *             current_node = current_node.targets[0]
 *         elif current_char < test_chars[0] \
 *                 or current_char > test_chars[current_node.char_count-1]:             # <<<<<<<<<<<<<<
 *             current_node = start_node
 *         else:
 */
      __pyx_t_3 = ((__pyx_v_current_char > (__pyx_v_test_chars[(__pyx_v_current_node->char_count - 1)])) != 0);
      __pyx_t_4 = __pyx_t_3;
    } else {
      __pyx_t_4 = __pyx_t_1;
    }
    if (__pyx_t_4) {

      /* "acora/_acora.pyx":574
 *         elif current_char < test_chars[0] \
 *                 or current_char > test_chars[current_node.char_count-1]:
 *             current_node = start_node             # <<<<<<<<<<<<<<
 *         else:
 *             # walk through at most half the characters
 */
      __pyx_v_current_node = __pyx_v_start_node;
      goto __pyx_L5;
    }
    /*else*/ {

      /* "acora/_acora.pyx":577
 *         else:
 *             # walk through at most half the characters
 *             mid = current_node.char_count // 2             # <<<<<<<<<<<<<<
 *             if current_char < test_chars[mid]:
 *                 start = 0
 */
      __pyx_v_mid = __Pyx_div_long(__pyx_v_current_node->char_count, 2);

      /* "acora/_acora.pyx":578
 *             # walk through at most half the characters
 *             mid = current_node.char_count // 2
 *             if current_char < test_chars[mid]:             # <<<<<<<<<<<<<<
 *                 start = 0
 *                 end = mid
 */
      __pyx_t_4 = ((__pyx_v_current_char < (__pyx_v_test_chars[__pyx_v_mid])) != 0);
      if (__pyx_t_4) {

        /* "acora/_acora.pyx":579
 *             mid = current_node.char_count // 2
 *             if current_char < test_chars[mid]:
 *                 start = 0             # <<<<<<<<<<<<<<
 *                 end = mid
 *             else:
 */
        __pyx_v_start = 0;

        /* "acora/_acora.pyx":580
 *             if current_char < test_chars[mid]:
 *                 start = 0
 *                 end = mid             # <<<<<<<<<<<<<<
 *             else:
 *                 start = mid
 */
        __pyx_v_end = __pyx_v_mid;
        goto __pyx_L6;
      }
      /*else*/ {

        /* "acora/_acora.pyx":582
 *                 end = mid
 *             else:
 *                 start = mid             # <<<<<<<<<<<<<<
 *                 end = current_node.char_count
 * 
 */
        __pyx_v_start = __pyx_v_mid;

        /* "acora/_acora.pyx":583
 *             else:
 *                 start = mid
 *                 end = current_node.char_count             # <<<<<<<<<<<<<<
 * 
 *             for i in range(start, end):
 */
        __pyx_t_5 = __pyx_v_current_node->char_count;
        __pyx_v_end = __pyx_t_5;
      }
      __pyx_L6:;

      /* "acora/_acora.pyx":585
 *                 end = current_node.char_count
 * 
 *             for i in range(start, end):             # <<<<<<<<<<<<<<
 *                 if current_char <= test_chars[i]:
 *                     if current_char == test_chars[i]:
 */
      __pyx_t_5 = __pyx_v_end;
      for (__pyx_t_6 = __pyx_v_start; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
        __pyx_v_i = __pyx_t_6;

        /* "acora/_acora.pyx":586
 * 
 *             for i in range(start, end):
 *                 if current_char <= test_chars[i]:             # <<<<<<<<<<<<<<
 *                     if current_char == test_chars[i]:
 *                         current_node = current_node.targets[i]
 */
        __pyx_t_4 = ((__pyx_v_current_char <= (__pyx_v_test_chars[__pyx_v_i])) != 0);
        if (__pyx_t_4) {

          /* "acora/_acora.pyx":587
 *             for i in range(start, end):
 *                 if current_char <= test_chars[i]:
 *                     if current_char == test_chars[i]:             # <<<<<<<<<<<<<<
 *                         current_node = current_node.targets[i]
 *                     else:
 */
          __pyx_t_4 = ((__pyx_v_current_char == (__pyx_v_test_chars[__pyx_v_i])) != 0);
          if (__pyx_t_4) {

            /* "acora/_acora.pyx":588
 *                 if current_char <= test_chars[i]:
 *                     if current_char == test_chars[i]:
 *                         current_node = current_node.targets[i]             # <<<<<<<<<<<<<<
 *                     else:
 *                         current_node = start_node
 */
            __pyx_v_current_node = (__pyx_v_current_node->targets[__pyx_v_i]);
            goto __pyx_L10;
          }
          /*else*/ {

            /* "acora/_acora.pyx":590
 *                         current_node = current_node.targets[i]
 *                     else:
 *                         current_node = start_node             # <<<<<<<<<<<<<<
 *                     break
 *             else:
 */
            __pyx_v_current_node = __pyx_v_start_node;
          }
          __pyx_L10:;

          /* "acora/_acora.pyx":591
 *                     else:
 *                         current_node = start_node
 *                     break             # <<<<<<<<<<<<<<
 *             else:
 *                 current_node = start_node
 */
          goto __pyx_L8_break;
        }
      }
      /*else*/ {

        /* "acora/_acora.pyx":593
 *                     break
 *             else:
 *                 current_node = start_node             # <<<<<<<<<<<<<<
 *         if current_node.matches is not NULL:
 *             found = 1
 */
        __pyx_v_current_node = __pyx_v_start_node;
      }
      __pyx_L8_break:;
    }
    __pyx_L5:;

    /* "acora/_acora.pyx":594
 *             else:
 *                 current_node = start_node
 *         if current_node.matches is not NULL:             # <<<<<<<<<<<<<<
 *             found = 1
 *             break
 */
    __pyx_t_4 = ((__pyx_v_current_node->matches != NULL) != 0);
    if (__pyx_t_4) {

      /* "acora/_acora.pyx":595
 *                 current_node = start_node
 *         if current_node.matches is not NULL:
 *             found = 1             # <<<<<<<<<<<<<<
 *             break
 *     _data_char[0] = data_char
 */
      __pyx_v_found = 1;

      /* "acora/_acora.pyx":596
 *         if current_node.matches is not NULL:
 *             found = 1
 *             break             # <<<<<<<<<<<<<<
 *     _data_char[0] = data_char
 *     _current_node[0] = current_node
 */
      goto __pyx_L4_break;
    }
  }
  __pyx_L4_break:;

  /* "acora/_acora.pyx":597
 *             found = 1
 *             break
 *     _data_char[0] = data_char             # <<<<<<<<<<<<<<
 *     _current_node[0] = current_node
 *     return found
 */
  (__pyx_v__data_char[0]) = __pyx_v_data_char;

  /* "acora/_acora.pyx":598
 *             break
 *     _data_char[0] = data_char
 *     _current_node[0] = current_node             # <<<<<<<<<<<<<<
 *     return found
 * 
 */
  (__pyx_v__current_node[0]) = __pyx_v_current_node;

  /* "acora/_acora.pyx":599
 *     _data_char[0] = data_char
 *     _current_node[0] = current_node
 *     return found             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_found;
  goto __pyx_L0;

  /* "acora/_acora.pyx":556
 * 
 * 
 * cdef int _search_in_bytes(_AcoraBytesNodeStruct* start_node,             # <<<<<<<<<<<<<<
 *                           unsigned char* data_end,
 *                           unsigned char** _data_char,
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "acora/_acora.pyx":616
 *     cdef BytesAcora acora
 * 
 *     def __cinit__(self, BytesAcora acora not None, f, bint close=False, Py_ssize_t buffer_size=FILE_BUFFER_SIZE):             # <<<<<<<<<<<<<<
 *         assert acora.start_node is not NULL and acora.start_node.matches is NULL
 *         self.acora = acora
 */

/* Python wrapper */
static int __pyx_pw_5acora_6_acora_14_FileAcoraIter_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5acora_6_acora_14_FileAcoraIter_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_5acora_6_acora_BytesAcora *__pyx_v_acora = 0;
  PyObject *__pyx_v_f = 0;
  int __pyx_v_close;
  Py_ssize_t __pyx_v_buffer_size;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_acora,&__pyx_n_s_f,&__pyx_n_s_close,&__pyx_n_s_buffer_size,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_acora)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_f)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_close);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_buffer_size);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_acora = ((struct __pyx_obj_5acora_6_acora_BytesAcora *)values[0]);
    __pyx_v_f = values[1];
    if (values[2]) {
      __pyx_v_close = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_close == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_close = ((int)0);
    }
    if (values[3]) {
      __pyx_v_buffer_size = __Pyx_PyIndex_AsSsize_t(values[3]); if (unlikely((__pyx_v_buffer_size == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_buffer_size = ((Py_ssize_t)32768);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("acora._acora._FileAcoraIter.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_acora), __pyx_ptype_5acora_6_acora_BytesAcora, 0, "acora", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_5acora_6_acora_14_FileAcoraIter___cinit__(((struct __pyx_obj_5acora_6_acora__FileAcoraIter *)__pyx_v_self), __pyx_v_acora, __pyx_v_f, __pyx_v_close, __pyx_v_buffer_size);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5acora_6_acora_14_FileAcoraIter___cinit__(struct __pyx_obj_5acora_6_acora__FileAcoraIter *__pyx_v_self, struct __pyx_obj_5acora_6_acora_BytesAcora *__pyx_v_acora, PyObject *__pyx_v_f, int __pyx_v_close, Py_ssize_t __pyx_v_buffer_size) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __pyx_t_5acora_6_acora__AcoraBytesNodeStruct *__pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  unsigned char *__pyx_t_13;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "acora/_acora.pyx":617
 * 
 *     def __cinit__(self, BytesAcora acora not None, f, bint close=False, Py_ssize_t buffer_size=FILE_BUFFER_SIZE):
 *         assert acora.start_node is not NULL and acora.start_node.matches is NULL             # <<<<<<<<<<<<<<
 *         self.acora = acora
 *         self.start_node = self.current_node = acora.start_node
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_1 = ((__pyx_v_acora->start_node != NULL) != 0);
    if (__pyx_t_1) {
      __pyx_t_2 = ((__pyx_v_acora->start_node->matches == NULL) != 0);
      __pyx_t_3 = __pyx_t_2;
    } else {
      __pyx_t_3 = __pyx_t_1;
    }
    if (unlikely(!__pyx_t_3)) {
      PyErr_SetNone(PyExc_AssertionError);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  #endif

  /* "acora/_acora.pyx":618
 *     def __cinit__(self, BytesAcora acora not None, f, bint close=False, Py_ssize_t buffer_size=FILE_BUFFER_SIZE):
 *         assert acora.start_node is not NULL and acora.start_node.matches is NULL
 *         self.acora = acora             # <<<<<<<<<<<<<<
 *         self.start_node = self.current_node = acora.start_node
 *         self.match_index = 0
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_acora));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_acora));
  __Pyx_GOTREF(__pyx_v_self->acora);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->acora));
  __pyx_v_self->acora = __pyx_v_acora;

  /* "acora/_acora.pyx":619
 *         assert acora.start_node is not NULL and acora.start_node.matches is NULL
 *         self.acora = acora
 *         self.start_node = self.current_node = acora.start_node             # <<<<<<<<<<<<<<
 *         self.match_index = 0
 *         self.buffer_offset_count = 0
 */
  __pyx_t_4 = __pyx_v_acora->start_node;
  __pyx_v_self->start_node = __pyx_t_4;
  __pyx_v_self->current_node = __pyx_t_4;

  /* "acora/_acora.pyx":620
 *         self.acora = acora
 *         self.start_node = self.current_node = acora.start_node
 *         self.match_index = 0             # <<<<<<<<<<<<<<
 *         self.buffer_offset_count = 0
 *         self.f = f
 */
  __pyx_v_self->match_index = 0;

  /* "acora/_acora.pyx":621
 *         self.start_node = self.current_node = acora.start_node
 *         self.match_index = 0
 *         self.buffer_offset_count = 0             # <<<<<<<<<<<<<<
 *         self.f = f
 *         self.close_file = close
 */
  __pyx_v_self->buffer_offset_count = 0;

  /* "acora/_acora.pyx":622
 *         self.match_index = 0
 *         self.buffer_offset_count = 0
 *         self.f = f             # <<<<<<<<<<<<<<
 *         self.close_file = close
 *         try:
 */
  __Pyx_INCREF(__pyx_v_f);
  __Pyx_GIVEREF(__pyx_v_f);
  __Pyx_GOTREF(__pyx_v_self->f);
  __Pyx_DECREF(__pyx_v_self->f);
  __pyx_v_self->f = __pyx_v_f;

  /* "acora/_acora.pyx":623
 *         self.buffer_offset_count = 0
 *         self.f = f
 *         self.close_file = close             # <<<<<<<<<<<<<<
 *         try:
 *             self.c_file = f.fileno() if f.tell() == 0 else -1
 */
  __pyx_v_self->close_file = __pyx_v_close;

  /* "acora/_acora.pyx":624
 *         self.f = f
 *         self.close_file = close
 *         try:             # <<<<<<<<<<<<<<
 *             self.c_file = f.fileno() if f.tell() == 0 else -1
 *         except:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
    __Pyx_XGOTREF(__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_6);
    __Pyx_XGOTREF(__pyx_t_7);
    /*try:*/ {

      /* "acora/_acora.pyx":625
 *         self.close_file = close
 *         try:
 *             self.c_file = f.fileno() if f.tell() == 0 else -1             # <<<<<<<<<<<<<<
 *         except:
 *             # maybe not a C file?
 */
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_tell); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = PyObject_RichCompare(__pyx_t_10, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (__pyx_t_3) {
        __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_fileno); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_11 = __Pyx_PyInt_As_int(__pyx_t_10); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_8 = __pyx_t_11;
      } else {
        __pyx_t_8 = -1;
      }
      __pyx_v_self->c_file = __pyx_t_8;
    }
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    goto __pyx_L10_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;

    /* "acora/_acora.pyx":626
 *         try:
 *             self.c_file = f.fileno() if f.tell() == 0 else -1
 *         except:             # <<<<<<<<<<<<<<
 *             # maybe not a C file?
 *             self.c_file = -1
 */
    /*except:*/ {
      __Pyx_AddTraceback("acora._acora._FileAcoraIter.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_10, &__pyx_t_9, &__pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_GOTREF(__pyx_t_12);

      /* "acora/_acora.pyx":628
 *         except:
 *             # maybe not a C file?
 *             self.c_file = -1             # <<<<<<<<<<<<<<
 *         self.read_size = buffer_size
 *         if self.c_file == -1:
 */
      __pyx_v_self->c_file = -1;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      goto __pyx_L4_exception_handled;
    }
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
    goto __pyx_L1_error;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
    __pyx_L10_try_end:;
  }

  /* "acora/_acora.pyx":629
 *             # maybe not a C file?
 *             self.c_file = -1
 *         self.read_size = buffer_size             # <<<<<<<<<<<<<<
 *         if self.c_file == -1:
 *             self.buffer = b''
 */
  __pyx_v_self->read_size = __pyx_v_buffer_size;

  /* "acora/_acora.pyx":630
 *             self.c_file = -1
 *         self.read_size = buffer_size
 *         if self.c_file == -1:             # <<<<<<<<<<<<<<
 *             self.buffer = b''
 *         else:
 */
  __pyx_t_3 = ((__pyx_v_self->c_file == -1) != 0);
  if (__pyx_t_3) {

    /* "acora/_acora.pyx":631
 *         self.read_size = buffer_size
 *         if self.c_file == -1:
 *             self.buffer = b''             # <<<<<<<<<<<<<<
 *         else:
 *             # use a statically allocated, fixed-size C buffer
 */
    __Pyx_INCREF(__pyx_kp_b__2);
    __Pyx_GIVEREF(__pyx_kp_b__2);
    __Pyx_GOTREF(__pyx_v_self->buffer);
    __Pyx_DECREF(__pyx_v_self->buffer);
    __pyx_v_self->buffer = __pyx_kp_b__2;
    goto __pyx_L13;
  }
  /*else*/ {

    /* "acora/_acora.pyx":634
 *         else:
 *             # use a statically allocated, fixed-size C buffer
 *             self.buffer = b'\0' * buffer_size             # <<<<<<<<<<<<<<
 *         self.c_buffer_pos = self.c_buffer_end = <unsigned char*> self.buffer
 * 
 */
    __pyx_t_12 = PyInt_FromSsize_t(__pyx_v_buffer_size); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_9 = PyNumber_Multiply(__pyx_kp_b__3, __pyx_t_12); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    if (!(likely(PyBytes_CheckExact(__pyx_t_9))||((__pyx_t_9) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_9)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GIVEREF(__pyx_t_9);
    __Pyx_GOTREF(__pyx_v_self->buffer);
    __Pyx_DECREF(__pyx_v_self->buffer);
    __pyx_v_self->buffer = ((PyObject*)__pyx_t_9);
    __pyx_t_9 = 0;
  }
  __pyx_L13:;

  /* "acora/_acora.pyx":635
 *             # use a statically allocated, fixed-size C buffer
 *             self.buffer = b'\0' * buffer_size
 *         self.c_buffer_pos = self.c_buffer_end = <unsigned char*> self.buffer             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __pyx_t_13 = __Pyx_PyObject_AsUString(__pyx_v_self->buffer); if (unlikely((!__pyx_t_13) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_self->c_buffer_pos = ((unsigned char *)__pyx_t_13);
  __pyx_v_self->c_buffer_end = ((unsigned char *)__pyx_t_13);

  /* "acora/_acora.pyx":616
 *     cdef BytesAcora acora
 * 
 *     def __cinit__(self, BytesAcora acora not None, f, bint close=False, Py_ssize_t buffer_size=FILE_BUFFER_SIZE):             # <<<<<<<<<<<<<<
 *         assert acora.start_node is not NULL and acora.start_node.matches is NULL
 *         self.acora = acora
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("acora._acora._FileAcoraIter.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "acora/_acora.pyx":637
 *         self.c_buffer_pos = self.c_buffer_end = <unsigned char*> self.buffer
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5acora_6_acora_14_FileAcoraIter_3__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5acora_6_acora_14_FileAcoraIter_3__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5acora_6_acora_14_FileAcoraIter_2__iter__(((struct __pyx_obj_5acora_6_acora__FileAcoraIter *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5acora_6_acora_14_FileAcoraIter_2__iter__(struct __pyx_obj_5acora_6_acora__FileAcoraIter *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "acora/_acora.pyx":638
 * 
 *     def __iter__(self):
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __next__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "acora/_acora.pyx":637
 *         self.c_buffer_pos = self.c_buffer_end = <unsigned char*> self.buffer
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "acora/_acora.pyx":640
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         cdef bytes buffer
 *         cdef unsigned char* c_buffer
 */

/* Python wrapper */
static PyObject *__pyx_pw_5acora_6_acora_14_FileAcoraIter_5__next__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5acora_6_acora_14_FileAcoraIter_5__next__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5acora_6_acora_14_FileAcoraIter_4__next__(((struct __pyx_obj_5acora_6_acora__FileAcoraIter *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5acora_6_acora_14_FileAcoraIter_4__next__(struct __pyx_obj_5acora_6_acora__FileAcoraIter *__pyx_v_self) {
  unsigned char *__pyx_v_c_buffer;
  unsigned char *__pyx_v_data_end;
  int __pyx_v_error;
  int __pyx_v_found;
  Py_ssize_t __pyx_v_buffer_size;
  CYTHON_UNUSED Py_ssize_t __pyx_v_bytes_read;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  unsigned char *__pyx_t_4;
  PyObject *__pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__next__", 0);

  /* "acora/_acora.pyx":644
 *         cdef unsigned char* c_buffer
 *         cdef unsigned char* data_end
 *         cdef int error = 0, found = 0             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t buffer_size, bytes_read = 0
 *         if self.c_buffer_pos is NULL:
 */
  __pyx_v_error = 0;
  __pyx_v_found = 0;

  /* "acora/_acora.pyx":645
 *         cdef unsigned char* data_end
 *         cdef int error = 0, found = 0
 *         cdef Py_ssize_t buffer_size, bytes_read = 0             # <<<<<<<<<<<<<<
 *         if self.c_buffer_pos is NULL:
 *             raise StopIteration
 */
  __pyx_v_bytes_read = 0;

  /* "acora/_acora.pyx":646
 *         cdef int error = 0, found = 0
 *         cdef Py_ssize_t buffer_size, bytes_read = 0
 *         if self.c_buffer_pos is NULL:             # <<<<<<<<<<<<<<
 *             raise StopIteration
 *         if self.current_node.matches is not NULL:
 */
  __pyx_t_1 = ((__pyx_v_self->c_buffer_pos == NULL) != 0);
  if (__pyx_t_1) {

    /* "acora/_acora.pyx":647
 *         cdef Py_ssize_t buffer_size, bytes_read = 0
 *         if self.c_buffer_pos is NULL:
 *             raise StopIteration             # <<<<<<<<<<<<<<
 *         if self.current_node.matches is not NULL:
 *             if self.current_node.matches[self.match_index] is not NULL:
 */
    __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "acora/_acora.pyx":648
 *         if self.c_buffer_pos is NULL:
 *             raise StopIteration
 *         if self.current_node.matches is not NULL:             # <<<<<<<<<<<<<<
 *             if self.current_node.matches[self.match_index] is not NULL:
 *                 return self._build_next_match()
 */
  __pyx_t_1 = ((__pyx_v_self->current_node->matches != NULL) != 0);
  if (__pyx_t_1) {

    /* "acora/_acora.pyx":649
 *             raise StopIteration
 *         if self.current_node.matches is not NULL:
 *             if self.current_node.matches[self.match_index] is not NULL:             # <<<<<<<<<<<<<<
 *                 return self._build_next_match()
 *             self.match_index = 0
 */
    __pyx_t_1 = (((__pyx_v_self->current_node->matches[__pyx_v_self->match_index]) != NULL) != 0);
    if (__pyx_t_1) {

      /* "acora/_acora.pyx":650
 *         if self.current_node.matches is not NULL:
 *             if self.current_node.matches[self.match_index] is not NULL:
 *                 return self._build_next_match()             # <<<<<<<<<<<<<<
 *             self.match_index = 0
 * 
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = ((struct __pyx_vtabstruct_5acora_6_acora__FileAcoraIter *)__pyx_v_self->__pyx_vtab)->_build_next_match(__pyx_v_self); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;
    }

    /* "acora/_acora.pyx":651
 *             if self.current_node.matches[self.match_index] is not NULL:
 *                 return self._build_next_match()
 *             self.match_index = 0             # <<<<<<<<<<<<<<
 * 
 *         buffer_size = len(self.buffer)
 */
    __pyx_v_self->match_index = 0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "acora/_acora.pyx":653
 *             self.match_index = 0
 * 
 *         buffer_size = len(self.buffer)             # <<<<<<<<<<<<<<
 *         c_buffer = <unsigned char*> self.buffer
 *         if self.c_file != -1:
 */
  __pyx_t_2 = __pyx_v_self->buffer;
  __Pyx_INCREF(__pyx_t_2);
  if (unlikely(__pyx_t_2 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_3 = PyBytes_GET_SIZE(__pyx_t_2); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_buffer_size = __pyx_t_3;

  /* "acora/_acora.pyx":654
 * 
 *         buffer_size = len(self.buffer)
 *         c_buffer = <unsigned char*> self.buffer             # <<<<<<<<<<<<<<
 *         if self.c_file != -1:
 *             with nogil:
 */
  __pyx_t_4 = __Pyx_PyObject_AsUString(__pyx_v_self->buffer); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_buffer = ((unsigned char *)__pyx_t_4);

  /* "acora/_acora.pyx":655
 *         buffer_size = len(self.buffer)
 *         c_buffer = <unsigned char*> self.buffer
 *         if self.c_file != -1:             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 found = _find_next_match_in_cfile(
 */
  __pyx_t_1 = ((__pyx_v_self->c_file != -1) != 0);
  if (__pyx_t_1) {

    /* "acora/_acora.pyx":656
 *         c_buffer = <unsigned char*> self.buffer
 *         if self.c_file != -1:
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 found = _find_next_match_in_cfile(
 *                     self.c_file, c_buffer, buffer_size, self.start_node,
 */
    {
        #ifdef WITH_THREAD
        PyThreadState *_save;
        Py_UNBLOCK_THREADS
        #endif
        /*try:*/ {

          /* "acora/_acora.pyx":657
 *         if self.c_file != -1:
 *             with nogil:
 *                 found = _find_next_match_in_cfile(             # <<<<<<<<<<<<<<
 *                     self.c_file, c_buffer, buffer_size, self.start_node,
 *                     &self.c_buffer_pos, &self.c_buffer_end,
 */
          __pyx_v_found = __pyx_f_5acora_6_acora__find_next_match_in_cfile(__pyx_v_self->c_file, __pyx_v_c_buffer, __pyx_v_buffer_size, __pyx_v_self->start_node, (&__pyx_v_self->c_buffer_pos), (&__pyx_v_self->c_buffer_end), (&__pyx_v_self->buffer_offset_count), (&__pyx_v_self->current_node), (&__pyx_v_error));
        }

        /* "acora/_acora.pyx":656
 *         c_buffer = <unsigned char*> self.buffer
 *         if self.c_file != -1:
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 found = _find_next_match_in_cfile(
 *                     self.c_file, c_buffer, buffer_size, self.start_node,
 */
        /*finally:*/ {
          /*normal exit:*/{
            #ifdef WITH_THREAD
            Py_BLOCK_THREADS
            #endif
            goto __pyx_L9;
          }
          __pyx_L9:;
        }
    }

    /* "acora/_acora.pyx":661
 *                     &self.c_buffer_pos, &self.c_buffer_end,
 *                     &self.buffer_offset_count, &self.current_node, &error)
 *             if error:             # <<<<<<<<<<<<<<
 *                 cpython.exc.PyErr_SetFromErrno(IOError)
 *         else:
 */
    __pyx_t_1 = (__pyx_v_error != 0);
    if (__pyx_t_1) {

      /* "acora/_acora.pyx":662
 *                     &self.buffer_offset_count, &self.current_node, &error)
 *             if error:
 *                 cpython.exc.PyErr_SetFromErrno(IOError)             # <<<<<<<<<<<<<<
 *         else:
 *             data_end = c_buffer + buffer_size
 */
      __pyx_t_5 = PyErr_SetFromErrno(__pyx_builtin_IOError); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L10;
    }
    __pyx_L10:;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "acora/_acora.pyx":664
 *                 cpython.exc.PyErr_SetFromErrno(IOError)
 *         else:
 *             data_end = c_buffer + buffer_size             # <<<<<<<<<<<<<<
 *             while not found:
 *                 if self.c_buffer_pos >= data_end:
 */
    __pyx_v_data_end = (__pyx_v_c_buffer + __pyx_v_buffer_size);

    /* "acora/_acora.pyx":665
 *         else:
 *             data_end = c_buffer + buffer_size
 *             while not found:             # <<<<<<<<<<<<<<
 *                 if self.c_buffer_pos >= data_end:
 *                     self.buffer_offset_count += buffer_size
 */
    while (1) {
      __pyx_t_1 = ((!(__pyx_v_found != 0)) != 0);
      if (!__pyx_t_1) break;

      /* "acora/_acora.pyx":666
 *             data_end = c_buffer + buffer_size
 *             while not found:
 *                 if self.c_buffer_pos >= data_end:             # <<<<<<<<<<<<<<
 *                     self.buffer_offset_count += buffer_size
 *                     self.buffer = self.f.read(self.read_size)
 */
      __pyx_t_1 = ((__pyx_v_self->c_buffer_pos >= __pyx_v_data_end) != 0);
      if (__pyx_t_1) {

        /* "acora/_acora.pyx":667
 *             while not found:
 *                 if self.c_buffer_pos >= data_end:
 *                     self.buffer_offset_count += buffer_size             # <<<<<<<<<<<<<<
 *                     self.buffer = self.f.read(self.read_size)
 *                     buffer_size = len(self.buffer)
 */
        __pyx_v_self->buffer_offset_count = (__pyx_v_self->buffer_offset_count + __pyx_v_buffer_size);

        /* "acora/_acora.pyx":668
 *                 if self.c_buffer_pos >= data_end:
 *                     self.buffer_offset_count += buffer_size
 *                     self.buffer = self.f.read(self.read_size)             # <<<<<<<<<<<<<<
 *                     buffer_size = len(self.buffer)
 *                     if buffer_size == 0:
 */
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->f, __pyx_n_s_read); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 668; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_self->read_size); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 668; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 668; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_6);
        __pyx_t_6 = 0;
        __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 668; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (!(likely(PyBytes_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_6)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 668; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GIVEREF(__pyx_t_6);
        __Pyx_GOTREF(__pyx_v_self->buffer);
        __Pyx_DECREF(__pyx_v_self->buffer);
        __pyx_v_self->buffer = ((PyObject*)__pyx_t_6);
        __pyx_t_6 = 0;

        /* "acora/_acora.pyx":669
 *                     self.buffer_offset_count += buffer_size
 *                     self.buffer = self.f.read(self.read_size)
 *                     buffer_size = len(self.buffer)             # <<<<<<<<<<<<<<
 *                     if buffer_size == 0:
 *                         self.c_buffer_pos = NULL
 */
        __pyx_t_6 = __pyx_v_self->buffer;
        __Pyx_INCREF(__pyx_t_6);
        if (unlikely(__pyx_t_6 == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_3 = PyBytes_GET_SIZE(__pyx_t_6); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_v_buffer_size = __pyx_t_3;

        /* "acora/_acora.pyx":670
 *                     self.buffer = self.f.read(self.read_size)
 *                     buffer_size = len(self.buffer)
 *                     if buffer_size == 0:             # <<<<<<<<<<<<<<
 *                         self.c_buffer_pos = NULL
 *                         break
 */
        __pyx_t_1 = ((__pyx_v_buffer_size == 0) != 0);
        if (__pyx_t_1) {

          /* "acora/_acora.pyx":671
 *                     buffer_size = len(self.buffer)
 *                     if buffer_size == 0:
 *                         self.c_buffer_pos = NULL             # <<<<<<<<<<<<<<
 *                         break
 *                     c_buffer = self.c_buffer_pos = <unsigned char*> self.buffer
 */
          __pyx_v_self->c_buffer_pos = NULL;

          /* "acora/_acora.pyx":672
 *                     if buffer_size == 0:
 *                         self.c_buffer_pos = NULL
 *                         break             # <<<<<<<<<<<<<<
 *                     c_buffer = self.c_buffer_pos = <unsigned char*> self.buffer
 *                     data_end = c_buffer + buffer_size
 */
          goto __pyx_L12_break;
        }

        /* "acora/_acora.pyx":673
 *                         self.c_buffer_pos = NULL
 *                         break
 *                     c_buffer = self.c_buffer_pos = <unsigned char*> self.buffer             # <<<<<<<<<<<<<<
 *                     data_end = c_buffer + buffer_size
 *                 with nogil:
 */
        __pyx_t_4 = __Pyx_PyObject_AsUString(__pyx_v_self->buffer); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_v_c_buffer = ((unsigned char *)__pyx_t_4);
        __pyx_v_self->c_buffer_pos = ((unsigned char *)__pyx_t_4);

        /* "acora/_acora.pyx":674
 *                         break
 *                     c_buffer = self.c_buffer_pos = <unsigned char*> self.buffer
 *                     data_end = c_buffer + buffer_size             # <<<<<<<<<<<<<<
 *                 with nogil:
 *                     found = _search_in_bytes(
 */
        __pyx_v_data_end = (__pyx_v_c_buffer + __pyx_v_buffer_size);
        goto __pyx_L13;
      }
      __pyx_L13:;

      /* "acora/_acora.pyx":675
 *                     c_buffer = self.c_buffer_pos = <unsigned char*> self.buffer
 *                     data_end = c_buffer + buffer_size
 *                 with nogil:             # <<<<<<<<<<<<<<
 *                     found = _search_in_bytes(
 *                         self.start_node, data_end,
 */
      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          #endif
          /*try:*/ {

            /* "acora/_acora.pyx":676
 *                     data_end = c_buffer + buffer_size
 *                 with nogil:
 *                     found = _search_in_bytes(             # <<<<<<<<<<<<<<
 *                         self.start_node, data_end,
 *                         &self.c_buffer_pos, &self.current_node)
 */
            __pyx_v_found = __pyx_f_5acora_6_acora__search_in_bytes(__pyx_v_self->start_node, __pyx_v_data_end, (&__pyx_v_self->c_buffer_pos), (&__pyx_v_self->current_node));
          }

          /* "acora/_acora.pyx":675
 *                     c_buffer = self.c_buffer_pos = <unsigned char*> self.buffer
 *                     data_end = c_buffer + buffer_size
 *                 with nogil:             # <<<<<<<<<<<<<<
 *                     found = _search_in_bytes(
 *                         self.start_node, data_end,
 */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L19;
            }
            __pyx_L19:;
          }
      }
    }
    __pyx_L12_break:;
  }
  __pyx_L6:;

  /* "acora/_acora.pyx":679
 *                         self.start_node, data_end,
 *                         &self.c_buffer_pos, &self.current_node)
 *         if self.c_buffer_pos is NULL:             # <<<<<<<<<<<<<<
 *             if self.close_file:
 *                 self.f.close()
 */
  __pyx_t_1 = ((__pyx_v_self->c_buffer_pos == NULL) != 0);
  if (__pyx_t_1) {

    /* "acora/_acora.pyx":680
 *                         &self.c_buffer_pos, &self.current_node)
 *         if self.c_buffer_pos is NULL:
 *             if self.close_file:             # <<<<<<<<<<<<<<
 *                 self.f.close()
 *         elif found:
 */
    __pyx_t_1 = (__pyx_v_self->close_file != 0);
    if (__pyx_t_1) {

      /* "acora/_acora.pyx":681
 *         if self.c_buffer_pos is NULL:
 *             if self.close_file:
 *                 self.f.close()             # <<<<<<<<<<<<<<
 *         elif found:
 *             return self._build_next_match()
 */
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->f, __pyx_n_s_close); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L21;
    }
    __pyx_L21:;
    goto __pyx_L20;
  }

  /* "acora/_acora.pyx":682
 *             if self.close_file:
 *                 self.f.close()
 *         elif found:             # <<<<<<<<<<<<<<
 *             return self._build_next_match()
 *         raise StopIteration
 */
  __pyx_t_1 = (__pyx_v_found != 0);
  if (__pyx_t_1) {

    /* "acora/_acora.pyx":683
 *                 self.f.close()
 *         elif found:
 *             return self._build_next_match()             # <<<<<<<<<<<<<<
 *         raise StopIteration
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_7 = ((struct __pyx_vtabstruct_5acora_6_acora__FileAcoraIter *)__pyx_v_self->__pyx_vtab)->_build_next_match(__pyx_v_self); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 683; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_r = __pyx_t_7;
    __pyx_t_7 = 0;
    goto __pyx_L0;
  }
  __pyx_L20:;

  /* "acora/_acora.pyx":684
 *         elif found:
 *             return self._build_next_match()
 *         raise StopIteration             # <<<<<<<<<<<<<<
 * 
 *     cdef _build_next_match(self):
 */
  __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "acora/_acora.pyx":640
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         cdef bytes buffer
 *         cdef unsigned char* c_buffer
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("acora._acora._FileAcoraIter.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "acora/_acora.pyx":686
 *         raise StopIteration
 * 
 *     cdef _build_next_match(self):             # <<<<<<<<<<<<<<
 *         match = <bytes> self.current_node.matches[self.match_index]
 *         self.match_index += 1
 */

static PyObject *__pyx_f_5acora_6_acora_14_FileAcoraIter__build_next_match(struct __pyx_obj_5acora_6_acora__FileAcoraIter *__pyx_v_self) {
  PyObject *__pyx_v_match = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  unsigned char *__pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_build_next_match", 0);

  /* "acora/_acora.pyx":687
 * 
 *     cdef _build_next_match(self):
 *         match = <bytes> self.current_node.matches[self.match_index]             # <<<<<<<<<<<<<<
 *         self.match_index += 1
 *         return (match, self.buffer_offset_count + (
 */
  __pyx_t_1 = ((PyObject *)(__pyx_v_self->current_node->matches[__pyx_v_self->match_index]));
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_match = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "acora/_acora.pyx":688
 *     cdef _build_next_match(self):
 *         match = <bytes> self.current_node.matches[self.match_index]
 *         self.match_index += 1             # <<<<<<<<<<<<<<
 *         return (match, self.buffer_offset_count + (
 *                 self.c_buffer_pos - (<unsigned char*> self.buffer)) - len(match))
 */
  __pyx_v_self->match_index = (__pyx_v_self->match_index + 1);

  /* "acora/_acora.pyx":689
 *         match = <bytes> self.current_node.matches[self.match_index]
 *         self.match_index += 1
 *         return (match, self.buffer_offset_count + (             # <<<<<<<<<<<<<<
 *                 self.c_buffer_pos - (<unsigned char*> self.buffer)) - len(match))
 * 
 */
  __Pyx_XDECREF(__pyx_r);

  /* "acora/_acora.pyx":690
 *         self.match_index += 1
 *         return (match, self.buffer_offset_count + (
 *                 self.c_buffer_pos - (<unsigned char*> self.buffer)) - len(match))             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_AsUString(__pyx_v_self->buffer); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "acora/_acora.pyx":689
 *         match = <bytes> self.current_node.matches[self.match_index]
 *         self.match_index += 1
 *         return (match, self.buffer_offset_count + (             # <<<<<<<<<<<<<<
 *                 self.c_buffer_pos - (<unsigned char*> self.buffer)) - len(match))
 * 
 */
  if (unlikely(__pyx_v_match == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "acora/_acora.pyx":690
 *         self.match_index += 1
 *         return (match, self.buffer_offset_count + (
 *                 self.c_buffer_pos - (<unsigned char*> self.buffer)) - len(match))             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_3 = PyBytes_GET_SIZE(__pyx_v_match); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = __Pyx_PyInt_From_ptrdiff_t(((__pyx_v_self->buffer_offset_count + (__pyx_v_self->c_buffer_pos - ((unsigned char *)__pyx_t_2))) - __pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);

  /* "acora/_acora.pyx":689
 *         match = <bytes> self.current_node.matches[self.match_index]
 *         self.match_index += 1
 *         return (match, self.buffer_offset_count + (             # <<<<<<<<<<<<<<
 *                 self.c_buffer_pos - (<unsigned char*> self.buffer)) - len(match))
 * 
 */
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_match);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_match);
  __Pyx_GIVEREF(__pyx_v_match);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "acora/_acora.pyx":686
 *         raise StopIteration
 * 
 *     cdef _build_next_match(self):             # <<<<<<<<<<<<<<
 *         match = <bytes> self.current_node.matches[self.match_index]
 *         self.match_index += 1
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("acora._acora._FileAcoraIter._build_next_match", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_match);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "acora/_acora.pyx":693
 * 
 * 
 * cdef int _find_next_match_in_cfile(int c_file, unsigned char* c_buffer, size_t buffer_size,             # <<<<<<<<<<<<<<
 *                                    _AcoraBytesNodeStruct* start_node,
 *                                    unsigned char** _buffer_pos, unsigned char** _buffer_end,
 */

static int __pyx_f_5acora_6_acora__find_next_match_in_cfile(int __pyx_v_c_file, unsigned char *__pyx_v_c_buffer, size_t __pyx_v_buffer_size, __pyx_t_5acora_6_acora__AcoraBytesNodeStruct *__pyx_v_start_node, unsigned char **__pyx_v__buffer_pos, unsigned char **__pyx_v__buffer_end, Py_ssize_t *__pyx_v__buffer_offset_count, __pyx_t_5acora_6_acora__AcoraBytesNodeStruct **__pyx_v__current_node, int *__pyx_v_error) {
  unsigned char *__pyx_v_buffer_pos;
  unsigned char *__pyx_v_buffer_end;
  CYTHON_UNUSED unsigned char *__pyx_v_data_end;
  Py_ssize_t __pyx_v_buffer_offset_count;
  __pyx_t_5acora_6_acora__AcoraBytesNodeStruct *__pyx_v_current_node;
  int __pyx_v_found;
  Py_ssize_t __pyx_v_bytes_read;
  int __pyx_r;
  int __pyx_t_1;

  /* "acora/_acora.pyx":699
 *                                    _AcoraBytesNodeStruct** _current_node,
 *                                    int* error) nogil:
 *     cdef unsigned char* buffer_pos = _buffer_pos[0]             # <<<<<<<<<<<<<<
 *     cdef unsigned char* buffer_end = _buffer_end[0]
 *     cdef unsigned char* data_end = c_buffer + buffer_size
 */
  __pyx_v_buffer_pos = (__pyx_v__buffer_pos[0]);

  /* "acora/_acora.pyx":700
 *                                    int* error) nogil:
 *     cdef unsigned char* buffer_pos = _buffer_pos[0]
 *     cdef unsigned char* buffer_end = _buffer_end[0]             # <<<<<<<<<<<<<<
 *     cdef unsigned char* data_end = c_buffer + buffer_size
 *     cdef Py_ssize_t buffer_offset_count = _buffer_offset_count[0]
 */
  __pyx_v_buffer_end = (__pyx_v__buffer_end[0]);

  /* "acora/_acora.pyx":701
 *     cdef unsigned char* buffer_pos = _buffer_pos[0]
 *     cdef unsigned char* buffer_end = _buffer_end[0]
 *     cdef unsigned char* data_end = c_buffer + buffer_size             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t buffer_offset_count = _buffer_offset_count[0]
 *     cdef _AcoraBytesNodeStruct* current_node = _current_node[0]
 */
  __pyx_v_data_end = (__pyx_v_c_buffer + __pyx_v_buffer_size);

  /* "acora/_acora.pyx":702
 *     cdef unsigned char* buffer_end = _buffer_end[0]
 *     cdef unsigned char* data_end = c_buffer + buffer_size
 *     cdef Py_ssize_t buffer_offset_count = _buffer_offset_count[0]             # <<<<<<<<<<<<<<
 *     cdef _AcoraBytesNodeStruct* current_node = _current_node[0]
 *     cdef int found = 0
 */
  __pyx_v_buffer_offset_count = (__pyx_v__buffer_offset_count[0]);

  /* "acora/_acora.pyx":703
 *     cdef unsigned char* data_end = c_buffer + buffer_size
 *     cdef Py_ssize_t buffer_offset_count = _buffer_offset_count[0]
 *     cdef _AcoraBytesNodeStruct* current_node = _current_node[0]             # <<<<<<<<<<<<<<
 *     cdef int found = 0
 *     cdef Py_ssize_t bytes_read
 */
  __pyx_v_current_node = (__pyx_v__current_node[0]);

  /* "acora/_acora.pyx":704
 *     cdef Py_ssize_t buffer_offset_count = _buffer_offset_count[0]
 *     cdef _AcoraBytesNodeStruct* current_node = _current_node[0]
 *     cdef int found = 0             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t bytes_read
 * 
 */
  __pyx_v_found = 0;

  /* "acora/_acora.pyx":707
 *     cdef Py_ssize_t bytes_read
 * 
 *     while not found:             # <<<<<<<<<<<<<<
 *         if buffer_pos >= buffer_end:
 *             buffer_offset_count += buffer_end - c_buffer
 */
  while (1) {
    __pyx_t_1 = ((!(__pyx_v_found != 0)) != 0);
    if (!__pyx_t_1) break;

    /* "acora/_acora.pyx":708
 * 
 *     while not found:
 *         if buffer_pos >= buffer_end:             # <<<<<<<<<<<<<<
 *             buffer_offset_count += buffer_end - c_buffer
 *             bytes_read = read(c_file, c_buffer, buffer_size)
 */
    __pyx_t_1 = ((__pyx_v_buffer_pos >= __pyx_v_buffer_end) != 0);
    if (__pyx_t_1) {

      /* "acora/_acora.pyx":709
 *     while not found:
 *         if buffer_pos >= buffer_end:
 *             buffer_offset_count += buffer_end - c_buffer             # <<<<<<<<<<<<<<
 *             bytes_read = read(c_file, c_buffer, buffer_size)
 *             if bytes_read <= 0:
 */
      __pyx_v_buffer_offset_count = (__pyx_v_buffer_offset_count + (__pyx_v_buffer_end - __pyx_v_c_buffer));

      /* "acora/_acora.pyx":710
 *         if buffer_pos >= buffer_end:
 *             buffer_offset_count += buffer_end - c_buffer
 *             bytes_read = read(c_file, c_buffer, buffer_size)             # <<<<<<<<<<<<<<
 *             if bytes_read <= 0:
 *                 if bytes_read < 0:
 */
      __pyx_v_bytes_read = read(__pyx_v_c_file, __pyx_v_c_buffer, __pyx_v_buffer_size);

      /* "acora/_acora.pyx":711
 *             buffer_offset_count += buffer_end - c_buffer
 *             bytes_read = read(c_file, c_buffer, buffer_size)
 *             if bytes_read <= 0:             # <<<<<<<<<<<<<<
 *                 if bytes_read < 0:
 *                     error[0] = 1
 */
      __pyx_t_1 = ((__pyx_v_bytes_read <= 0) != 0);
      if (__pyx_t_1) {

        /* "acora/_acora.pyx":712
 *             bytes_read = read(c_file, c_buffer, buffer_size)
 *             if bytes_read <= 0:
 *                 if bytes_read < 0:             # <<<<<<<<<<<<<<
 *                     error[0] = 1
 *                 buffer_pos = NULL
 */
        __pyx_t_1 = ((__pyx_v_bytes_read < 0) != 0);
        if (__pyx_t_1) {

          /* "acora/_acora.pyx":713
 *             if bytes_read <= 0:
 *                 if bytes_read < 0:
 *                     error[0] = 1             # <<<<<<<<<<<<<<
 *                 buffer_pos = NULL
 *                 break
 */
          (__pyx_v_error[0]) = 1;
          goto __pyx_L7;
        }
        __pyx_L7:;

        /* "acora/_acora.pyx":714
 *                 if bytes_read < 0:
 *                     error[0] = 1
 *                 buffer_pos = NULL             # <<<<<<<<<<<<<<
 *                 break
 *             buffer_pos = c_buffer
 */
        __pyx_v_buffer_pos = NULL;

        /* "acora/_acora.pyx":715
 *                     error[0] = 1
 *                 buffer_pos = NULL
 *                 break             # <<<<<<<<<<<<<<
 *             buffer_pos = c_buffer
 *             buffer_end = c_buffer + bytes_read
 */
        goto __pyx_L4_break;
      }

      /* "acora/_acora.pyx":716
 *                 buffer_pos = NULL
 *                 break
 *             buffer_pos = c_buffer             # <<<<<<<<<<<<<<
 *             buffer_end = c_buffer + bytes_read
 * 
 */
      __pyx_v_buffer_pos = __pyx_v_c_buffer;

      /* "acora/_acora.pyx":717
 *                 break
 *             buffer_pos = c_buffer
 *             buffer_end = c_buffer + bytes_read             # <<<<<<<<<<<<<<
 * 
 *         found = _search_in_bytes(
 */
      __pyx_v_buffer_end = (__pyx_v_c_buffer + __pyx_v_bytes_read);
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "acora/_acora.pyx":719
 *             buffer_end = c_buffer + bytes_read
 * 
 *         found = _search_in_bytes(             # <<<<<<<<<<<<<<
 *             start_node, buffer_end, &buffer_pos, &current_node)
 * 
 */
    __pyx_v_found = __pyx_f_5acora_6_acora__search_in_bytes(__pyx_v_start_node, __pyx_v_buffer_end, (&__pyx_v_buffer_pos), (&__pyx_v_current_node));
  }
  __pyx_L4_break:;

  /* "acora/_acora.pyx":722
 *             start_node, buffer_end, &buffer_pos, &current_node)
 * 
 *     _current_node[0] = current_node             # <<<<<<<<<<<<<<
 *     _buffer_offset_count[0] = buffer_offset_count
 *     _buffer_pos[0] = buffer_pos
 */
  (__pyx_v__current_node[0]) = __pyx_v_current_node;

  /* "acora/_acora.pyx":723
 * 
 *     _current_node[0] = current_node
 *     _buffer_offset_count[0] = buffer_offset_count             # <<<<<<<<<<<<<<
 *     _buffer_pos[0] = buffer_pos
 *     _buffer_end[0] = buffer_end
 */
  (__pyx_v__buffer_offset_count[0]) = __pyx_v_buffer_offset_count;

  /* "acora/_acora.pyx":724
 *     _current_node[0] = current_node
 *     _buffer_offset_count[0] = buffer_offset_count
 *     _buffer_pos[0] = buffer_pos             # <<<<<<<<<<<<<<
 *     _buffer_end[0] = buffer_end
 *     return found
 */
  (__pyx_v__buffer_pos[0]) = __pyx_v_buffer_pos;

  /* "acora/_acora.pyx":725
 *     _buffer_offset_count[0] = buffer_offset_count
 *     _buffer_pos[0] = buffer_pos
 *     _buffer_end[0] = buffer_end             # <<<<<<<<<<<<<<
 *     return found
 */
  (__pyx_v__buffer_end[0]) = __pyx_v_buffer_end;

  /* "acora/_acora.pyx":726
 *     _buffer_pos[0] = buffer_pos
 *     _buffer_end[0] = buffer_end
 *     return found             # <<<<<<<<<<<<<<
 */
  __pyx_r = __pyx_v_found;
  goto __pyx_L0;

  /* "acora/_acora.pyx":693
 * 
 * 
 * cdef int _find_next_match_in_cfile(int c_file, unsigned char* c_buffer, size_t buffer_size,             # <<<<<<<<<<<<<<
 *                                    _AcoraBytesNodeStruct* start_node,
 *                                    unsigned char** _buffer_pos, unsigned char** _buffer_end,
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

static PyObject *__pyx_tp_new_5acora_6_acora__NfaState(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_5acora_6_acora__NfaState *p;
  PyObject *o = (&PyDict_Type)->tp_new(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_5acora_6_acora__NfaState *)o);
  p->matches = ((PyObject*)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_5acora_6_acora__NfaState(PyObject *o) {
  struct __pyx_obj_5acora_6_acora__NfaState *p = (struct __pyx_obj_5acora_6_acora__NfaState *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->matches);
  PyObject_GC_Track(o);
  (&PyDict_Type)->tp_dealloc(o);
}

static int __pyx_tp_traverse_5acora_6_acora__NfaState(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5acora_6_acora__NfaState *p = (struct __pyx_obj_5acora_6_acora__NfaState *)o;
  if (!(&PyDict_Type)->tp_traverse); else { e = (&PyDict_Type)->tp_traverse(o,v,a); if (e) return e; }
  if (p->matches) {
    e = (*v)(p->matches, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5acora_6_acora__NfaState(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5acora_6_acora__NfaState *p = (struct __pyx_obj_5acora_6_acora__NfaState *)o;
  if (!(&PyDict_Type)->tp_clear); else (&PyDict_Type)->tp_clear(o);
  tmp = ((PyObject*)p->matches);
  p->matches = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_5acora_6_acora_9_NfaState_id(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5acora_6_acora_9_NfaState_2id_1__get__(o);
}

static int __pyx_setprop_5acora_6_acora_9_NfaState_id(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5acora_6_acora_9_NfaState_2id_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5acora_6_acora_9_NfaState_matches(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5acora_6_acora_9_NfaState_7matches_1__get__(o);
}

static int __pyx_setprop_5acora_6_acora_9_NfaState_matches(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5acora_6_acora_9_NfaState_7matches_3__set__(o, v);
  }
  else {
    return __pyx_pw_5acora_6_acora_9_NfaState_7matches_5__del__(o);
  }
}

static PyMethodDef __pyx_methods_5acora_6_acora__NfaState[] = {
  {__Pyx_NAMESTR("__copy__"), (PyCFunction)__pyx_pw_5acora_6_acora_9_NfaState_9__copy__, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5acora_6_acora_9_NfaState_8__copy__)},
  {__Pyx_NAMESTR("__deepcopy__"), (PyCFunction)__pyx_pw_5acora_6_acora_9_NfaState_11__deepcopy__, METH_O, __Pyx_DOCSTR(__pyx_doc_5acora_6_acora_9_NfaState_10__deepcopy__)},
  {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pw_5acora_6_acora_9_NfaState_13__reduce__, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5acora_6_acora_9_NfaState_12__reduce__)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_5acora_6_acora__NfaState[] = {
  {(char *)"id", __pyx_getprop_5acora_6_acora_9_NfaState_id, __pyx_setprop_5acora_6_acora_9_NfaState_id, __Pyx_DOCSTR(__pyx_k_id_unsigned_long), 0},
  {(char *)"matches", __pyx_getprop_5acora_6_acora_9_NfaState_matches, __pyx_setprop_5acora_6_acora_9_NfaState_matches, __Pyx_DOCSTR(__pyx_k_matches_list), 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_5acora_6_acora__NfaState = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("acora._acora._NfaState"), /*tp_name*/
  sizeof(struct __pyx_obj_5acora_6_acora__NfaState), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5acora_6_acora__NfaState, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pw_5acora_6_acora_9_NfaState_7__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  __pyx_pw_5acora_6_acora_9_NfaState_3__hash__, /*tp_hash*/
  0, /*tp_call*/
  __pyx_pw_5acora_6_acora_9_NfaState_5__str__, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("NFA state for the untransformed automaton.\n    "), /*tp_doc*/
  __pyx_tp_traverse_5acora_6_acora__NfaState, /*tp_traverse*/
  __pyx_tp_clear_5acora_6_acora__NfaState, /*tp_clear*/
  __pyx_pw_5acora_6_acora_9_NfaState_1__richcmp__, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5acora_6_acora__NfaState, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_5acora_6_acora__NfaState, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5acora_6_acora__NfaState, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_5acora_6_acora_UnicodeAcora __pyx_vtable_5acora_6_acora_UnicodeAcora;

static PyObject *__pyx_tp_new_5acora_6_acora_UnicodeAcora(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_5acora_6_acora_UnicodeAcora *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_5acora_6_acora_UnicodeAcora *)o);
  p->__pyx_vtab = __pyx_vtabptr_5acora_6_acora_UnicodeAcora;
  p->_pyrefs = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_5acora_6_acora_12UnicodeAcora_1__cinit__(o, a, k) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_5acora_6_acora_UnicodeAcora(PyObject *o) {
  struct __pyx_obj_5acora_6_acora_UnicodeAcora *p = (struct __pyx_obj_5acora_6_acora_UnicodeAcora *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_5acora_6_acora_12UnicodeAcora_3__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->_pyrefs);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_5acora_6_acora_UnicodeAcora(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5acora_6_acora_UnicodeAcora *p = (struct __pyx_obj_5acora_6_acora_UnicodeAcora *)o;
  if (p->_pyrefs) {
    e = (*v)(p->_pyrefs, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5acora_6_acora_UnicodeAcora(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5acora_6_acora_UnicodeAcora *p = (struct __pyx_obj_5acora_6_acora_UnicodeAcora *)o;
  tmp = ((PyObject*)p->_pyrefs);
  p->_pyrefs = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_5acora_6_acora_UnicodeAcora[] = {
  {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pw_5acora_6_acora_12UnicodeAcora_5__reduce__, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5acora_6_acora_12UnicodeAcora_4__reduce__)},
  {__Pyx_NAMESTR("finditer"), (PyCFunction)__pyx_pw_5acora_6_acora_12UnicodeAcora_7finditer, METH_O, __Pyx_DOCSTR(__pyx_doc_5acora_6_acora_12UnicodeAcora_6finditer)},
  {__Pyx_NAMESTR("findall"), (PyCFunction)__pyx_pw_5acora_6_acora_12UnicodeAcora_9findall, METH_O, __Pyx_DOCSTR(__pyx_doc_5acora_6_acora_12UnicodeAcora_8findall)},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_5acora_6_acora_UnicodeAcora = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("acora._acora.UnicodeAcora"), /*tp_name*/
  sizeof(struct __pyx_obj_5acora_6_acora_UnicodeAcora), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5acora_6_acora_UnicodeAcora, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("Acora search engine for unicode data.\n    "), /*tp_doc*/
  __pyx_tp_traverse_5acora_6_acora_UnicodeAcora, /*tp_traverse*/
  __pyx_tp_clear_5acora_6_acora_UnicodeAcora, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5acora_6_acora_UnicodeAcora, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5acora_6_acora_UnicodeAcora, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_5acora_6_acora__UnicodeAcoraIter __pyx_vtable_5acora_6_acora__UnicodeAcoraIter;

static PyObject *__pyx_tp_new_5acora_6_acora__UnicodeAcoraIter(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_5acora_6_acora__UnicodeAcoraIter *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_5acora_6_acora__UnicodeAcoraIter *)o);
  p->__pyx_vtab = __pyx_vtabptr_5acora_6_acora__UnicodeAcoraIter;
  p->data = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->acora = ((struct __pyx_obj_5acora_6_acora_UnicodeAcora *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_5acora_6_acora_17_UnicodeAcoraIter_1__cinit__(o, a, k) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_5acora_6_acora__UnicodeAcoraIter(PyObject *o) {
  struct __pyx_obj_5acora_6_acora__UnicodeAcoraIter *p = (struct __pyx_obj_5acora_6_acora__UnicodeAcoraIter *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->data);
  Py_CLEAR(p->acora);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_5acora_6_acora__UnicodeAcoraIter(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5acora_6_acora__UnicodeAcoraIter *p = (struct __pyx_obj_5acora_6_acora__UnicodeAcoraIter *)o;
  if (p->acora) {
    e = (*v)(((PyObject*)p->acora), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5acora_6_acora__UnicodeAcoraIter(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5acora_6_acora__UnicodeAcoraIter *p = (struct __pyx_obj_5acora_6_acora__UnicodeAcoraIter *)o;
  tmp = ((PyObject*)p->acora);
  p->acora = ((struct __pyx_obj_5acora_6_acora_UnicodeAcora *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_5acora_6_acora__UnicodeAcoraIter[] = {
  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_5acora_6_acora_17_UnicodeAcoraIter_5__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_5acora_6_acora__UnicodeAcoraIter = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("acora._acora._UnicodeAcoraIter"), /*tp_name*/
  sizeof(struct __pyx_obj_5acora_6_acora__UnicodeAcoraIter), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5acora_6_acora__UnicodeAcoraIter, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5acora_6_acora__UnicodeAcoraIter, /*tp_traverse*/
  __pyx_tp_clear_5acora_6_acora__UnicodeAcoraIter, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_5acora_6_acora_17_UnicodeAcoraIter_3__iter__, /*tp_iter*/
  __pyx_pw_5acora_6_acora_17_UnicodeAcoraIter_5__next__, /*tp_iternext*/
  __pyx_methods_5acora_6_acora__UnicodeAcoraIter, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5acora_6_acora__UnicodeAcoraIter, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_5acora_6_acora_BytesAcora __pyx_vtable_5acora_6_acora_BytesAcora;

static PyObject *__pyx_tp_new_5acora_6_acora_BytesAcora(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_5acora_6_acora_BytesAcora *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_5acora_6_acora_BytesAcora *)o);
  p->__pyx_vtab = __pyx_vtabptr_5acora_6_acora_BytesAcora;
  p->_pyrefs = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_5acora_6_acora_10BytesAcora_1__cinit__(o, a, k) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_5acora_6_acora_BytesAcora(PyObject *o) {
  struct __pyx_obj_5acora_6_acora_BytesAcora *p = (struct __pyx_obj_5acora_6_acora_BytesAcora *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_5acora_6_acora_10BytesAcora_3__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->_pyrefs);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_5acora_6_acora_BytesAcora(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5acora_6_acora_BytesAcora *p = (struct __pyx_obj_5acora_6_acora_BytesAcora *)o;
  if (p->_pyrefs) {
    e = (*v)(p->_pyrefs, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5acora_6_acora_BytesAcora(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5acora_6_acora_BytesAcora *p = (struct __pyx_obj_5acora_6_acora_BytesAcora *)o;
  tmp = ((PyObject*)p->_pyrefs);
  p->_pyrefs = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_5acora_6_acora_BytesAcora[] = {
  {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pw_5acora_6_acora_10BytesAcora_5__reduce__, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5acora_6_acora_10BytesAcora_4__reduce__)},
  {__Pyx_NAMESTR("finditer"), (PyCFunction)__pyx_pw_5acora_6_acora_10BytesAcora_7finditer, METH_O, __Pyx_DOCSTR(__pyx_doc_5acora_6_acora_10BytesAcora_6finditer)},
  {__Pyx_NAMESTR("findall"), (PyCFunction)__pyx_pw_5acora_6_acora_10BytesAcora_9findall, METH_O, __Pyx_DOCSTR(__pyx_doc_5acora_6_acora_10BytesAcora_8findall)},
  {__Pyx_NAMESTR("filefind"), (PyCFunction)__pyx_pw_5acora_6_acora_10BytesAcora_11filefind, METH_O, __Pyx_DOCSTR(__pyx_doc_5acora_6_acora_10BytesAcora_10filefind)},
  {__Pyx_NAMESTR("filefindall"), (PyCFunction)__pyx_pw_5acora_6_acora_10BytesAcora_13filefindall, METH_O, __Pyx_DOCSTR(__pyx_doc_5acora_6_acora_10BytesAcora_12filefindall)},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_5acora_6_acora_BytesAcora = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("acora._acora.BytesAcora"), /*tp_name*/
  sizeof(struct __pyx_obj_5acora_6_acora_BytesAcora), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5acora_6_acora_BytesAcora, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("Acora search engine for byte data.\n    "), /*tp_doc*/
  __pyx_tp_traverse_5acora_6_acora_BytesAcora, /*tp_traverse*/
  __pyx_tp_clear_5acora_6_acora_BytesAcora, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5acora_6_acora_BytesAcora, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5acora_6_acora_BytesAcora, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_5acora_6_acora__BytesAcoraIter __pyx_vtable_5acora_6_acora__BytesAcoraIter;

static PyObject *__pyx_tp_new_5acora_6_acora__BytesAcoraIter(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_5acora_6_acora__BytesAcoraIter *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_5acora_6_acora__BytesAcoraIter *)o);
  p->__pyx_vtab = __pyx_vtabptr_5acora_6_acora__BytesAcoraIter;
  p->data = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->acora = ((struct __pyx_obj_5acora_6_acora_BytesAcora *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_5acora_6_acora_15_BytesAcoraIter_1__cinit__(o, a, k) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_5acora_6_acora__BytesAcoraIter(PyObject *o) {
  struct __pyx_obj_5acora_6_acora__BytesAcoraIter *p = (struct __pyx_obj_5acora_6_acora__BytesAcoraIter *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->data);
  Py_CLEAR(p->acora);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_5acora_6_acora__BytesAcoraIter(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5acora_6_acora__BytesAcoraIter *p = (struct __pyx_obj_5acora_6_acora__BytesAcoraIter *)o;
  if (p->acora) {
    e = (*v)(((PyObject*)p->acora), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5acora_6_acora__BytesAcoraIter(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5acora_6_acora__BytesAcoraIter *p = (struct __pyx_obj_5acora_6_acora__BytesAcoraIter *)o;
  tmp = ((PyObject*)p->acora);
  p->acora = ((struct __pyx_obj_5acora_6_acora_BytesAcora *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_5acora_6_acora__BytesAcoraIter[] = {
  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_5acora_6_acora_15_BytesAcoraIter_5__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_5acora_6_acora__BytesAcoraIter = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("acora._acora._BytesAcoraIter"), /*tp_name*/
  sizeof(struct __pyx_obj_5acora_6_acora__BytesAcoraIter), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5acora_6_acora__BytesAcoraIter, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5acora_6_acora__BytesAcoraIter, /*tp_traverse*/
  __pyx_tp_clear_5acora_6_acora__BytesAcoraIter, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_5acora_6_acora_15_BytesAcoraIter_3__iter__, /*tp_iter*/
  __pyx_pw_5acora_6_acora_15_BytesAcoraIter_5__next__, /*tp_iternext*/
  __pyx_methods_5acora_6_acora__BytesAcoraIter, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5acora_6_acora__BytesAcoraIter, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_5acora_6_acora__FileAcoraIter __pyx_vtable_5acora_6_acora__FileAcoraIter;

static PyObject *__pyx_tp_new_5acora_6_acora__FileAcoraIter(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_5acora_6_acora__FileAcoraIter *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_5acora_6_acora__FileAcoraIter *)o);
  p->__pyx_vtab = __pyx_vtabptr_5acora_6_acora__FileAcoraIter;
  p->buffer = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->f = Py_None; Py_INCREF(Py_None);
  p->acora = ((struct __pyx_obj_5acora_6_acora_BytesAcora *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_5acora_6_acora_14_FileAcoraIter_1__cinit__(o, a, k) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_5acora_6_acora__FileAcoraIter(PyObject *o) {
  struct __pyx_obj_5acora_6_acora__FileAcoraIter *p = (struct __pyx_obj_5acora_6_acora__FileAcoraIter *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->buffer);
  Py_CLEAR(p->f);
  Py_CLEAR(p->acora);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_5acora_6_acora__FileAcoraIter(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5acora_6_acora__FileAcoraIter *p = (struct __pyx_obj_5acora_6_acora__FileAcoraIter *)o;
  if (p->f) {
    e = (*v)(p->f, a); if (e) return e;
  }
  if (p->acora) {
    e = (*v)(((PyObject*)p->acora), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5acora_6_acora__FileAcoraIter(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5acora_6_acora__FileAcoraIter *p = (struct __pyx_obj_5acora_6_acora__FileAcoraIter *)o;
  tmp = ((PyObject*)p->f);
  p->f = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->acora);
  p->acora = ((struct __pyx_obj_5acora_6_acora_BytesAcora *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_5acora_6_acora__FileAcoraIter[] = {
  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_5acora_6_acora_14_FileAcoraIter_5__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_5acora_6_acora__FileAcoraIter = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("acora._acora._FileAcoraIter"), /*tp_name*/
  sizeof(struct __pyx_obj_5acora_6_acora__FileAcoraIter), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5acora_6_acora__FileAcoraIter, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5acora_6_acora__FileAcoraIter, /*tp_traverse*/
  __pyx_tp_clear_5acora_6_acora__FileAcoraIter, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_5acora_6_acora_14_FileAcoraIter_3__iter__, /*tp_iter*/
  __pyx_pw_5acora_6_acora_14_FileAcoraIter_5__next__, /*tp_iternext*/
  __pyx_methods_5acora_6_acora__FileAcoraIter, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5acora_6_acora__FileAcoraIter, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyMethodDef __pyx_methods[] = {
  {__Pyx_NAMESTR("build_NfaState"), (PyCFunction)__pyx_pw_5acora_6_acora_1build_NfaState, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5acora_6_acora_build_NfaState)},
  {0, 0, 0, 0}
};

#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef __pyx_moduledef = {
  #if PY_VERSION_HEX < 0x03020000
    { PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
  #else
    PyModuleDef_HEAD_INIT,
  #endif
    __Pyx_NAMESTR("_acora"),
    __Pyx_DOCSTR(__pyx_k_A_fast_C_implementation_of_the_A), /* m_doc */
    -1, /* m_size */
    __pyx_methods /* m_methods */,
    NULL, /* m_reload */
    NULL, /* m_traverse */
    NULL, /* m_clear */
    NULL /* m_free */
};
#endif

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_n_u_BytesAcora, __pyx_k_BytesAcora, sizeof(__pyx_k_BytesAcora), 0, 1, 0, 1},
  {&__pyx_n_s_IOError, __pyx_k_IOError, sizeof(__pyx_k_IOError), 0, 0, 1, 1},
  {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
  {&__pyx_n_s_StopIteration, __pyx_k_StopIteration, sizeof(__pyx_k_StopIteration), 0, 0, 1, 1},
  {&__pyx_n_u_UnicodeAcora, __pyx_k_UnicodeAcora, sizeof(__pyx_k_UnicodeAcora), 0, 1, 0, 1},
  {&__pyx_kp_b__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 0, 0, 0},
  {&__pyx_kp_u__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 1, 0, 0},
  {&__pyx_kp_b__3, __pyx_k__3, sizeof(__pyx_k__3), 0, 0, 0, 0},
  {&__pyx_n_s_acora, __pyx_k_acora, sizeof(__pyx_k_acora), 0, 0, 1, 1},
  {&__pyx_n_s_all, __pyx_k_all, sizeof(__pyx_k_all), 0, 0, 1, 1},
  {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 0, 0, 1, 1},
  {&__pyx_n_s_buffer_size, __pyx_k_buffer_size, sizeof(__pyx_k_buffer_size), 0, 0, 1, 1},
  {&__pyx_n_s_build_NfaState, __pyx_k_build_NfaState, sizeof(__pyx_k_build_NfaState), 0, 0, 1, 1},
  {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1},
  {&__pyx_n_s_data, __pyx_k_data, sizeof(__pyx_k_data), 0, 0, 1, 1},
  {&__pyx_n_s_deepcopy, __pyx_k_deepcopy, sizeof(__pyx_k_deepcopy), 0, 0, 1, 1},
  {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
  {&__pyx_n_s_f, __pyx_k_f, sizeof(__pyx_k_f), 0, 0, 1, 1},
  {&__pyx_n_s_filefind, __pyx_k_filefind, sizeof(__pyx_k_filefind), 0, 0, 1, 1},
  {&__pyx_n_s_fileno, __pyx_k_fileno, sizeof(__pyx_k_fileno), 0, 0, 1, 1},
  {&__pyx_n_s_finditer, __pyx_k_finditer, sizeof(__pyx_k_finditer), 0, 0, 1, 1},
  {&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1},
  {&__pyx_n_s_iteritems, __pyx_k_iteritems, sizeof(__pyx_k_iteritems), 0, 0, 1, 1},
  {&__pyx_n_s_join, __pyx_k_join, sizeof(__pyx_k_join), 0, 0, 1, 1},
  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
  {&__pyx_n_s_matches, __pyx_k_matches, sizeof(__pyx_k_matches), 0, 0, 1, 1},
  {&__pyx_n_s_open, __pyx_k_open, sizeof(__pyx_k_open), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
  {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
  {&__pyx_n_u_rb, __pyx_k_rb, sizeof(__pyx_k_rb), 0, 1, 0, 1},
  {&__pyx_n_s_read, __pyx_k_read, sizeof(__pyx_k_read), 0, 0, 1, 1},
  {&__pyx_n_u_read, __pyx_k_read, sizeof(__pyx_k_read), 0, 1, 0, 1},
  {&__pyx_n_s_sorted, __pyx_k_sorted, sizeof(__pyx_k_sorted), 0, 0, 1, 1},
  {&__pyx_n_s_start_state, __pyx_k_start_state, sizeof(__pyx_k_start_state), 0, 0, 1, 1},
  {&__pyx_n_s_state_id, __pyx_k_state_id, sizeof(__pyx_k_state_id), 0, 0, 1, 1},
  {&__pyx_n_s_tell, __pyx_k_tell, sizeof(__pyx_k_tell), 0, 0, 1, 1},
  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
  {&__pyx_n_s_transitions, __pyx_k_transitions, sizeof(__pyx_k_transitions), 0, 0, 1, 1},
  {&__pyx_n_s_zip, __pyx_k_zip, sizeof(__pyx_k_zip), 0, 0, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_zip = __Pyx_GetBuiltinName(__pyx_n_s_zip); if (!__pyx_builtin_zip) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_sorted = __Pyx_GetBuiltinName(__pyx_n_s_sorted); if (!__pyx_builtin_sorted) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_StopIteration = __Pyx_GetBuiltinName(__pyx_n_s_StopIteration); if (!__pyx_builtin_StopIteration) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_open = __Pyx_GetBuiltinName(__pyx_n_s_open); if (!__pyx_builtin_open) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_IOError = __Pyx_GetBuiltinName(__pyx_n_s_IOError); if (!__pyx_builtin_IOError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  return 0;
  __pyx_L1_error:;
  return -1;
}

static int __Pyx_InitCachedConstants(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);

  /* "acora/_acora.pyx":83
 *     def __deepcopy__(self, memo):
 *         state = _NfaState(
 *             [ (character, child.__deepcopy__(None))             # <<<<<<<<<<<<<<
 *               for character, child in (<object>self).items() ])
 *         state.id = self.id
 */
  __pyx_tuple_ = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_tuple_)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple_);
  __Pyx_GIVEREF(__pyx_tuple_);
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_InitGlobals(void) {
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  return 0;
  __pyx_L1_error:;
  return -1;
}

#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC init_acora(void); /*proto*/
PyMODINIT_FUNC init_acora(void)
#else
PyMODINIT_FUNC PyInit__acora(void); /*proto*/
PyMODINIT_FUNC PyInit__acora(void)
#endif
{
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  #if CYTHON_REFNANNY
  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
  if (!__Pyx_RefNanny) {
      PyErr_Clear();
      __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
      if (!__Pyx_RefNanny)
          Py_FatalError("failed to import 'refnanny' module");
  }
  #endif
  __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__acora(void)", 0);
  if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #ifdef __Pyx_CyFunction_USED
  if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  #ifdef __Pyx_FusedFunction_USED
  if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  #ifdef __Pyx_Generator_USED
  if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  /*--- Library function declarations ---*/
  /*--- Threads initialization code ---*/
  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  #ifdef WITH_THREAD /* Python build with threading support? */
  PyEval_InitThreads();
  #endif
  #endif
  /*--- Module creation code ---*/
  #if PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_acora"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_A_fast_C_implementation_of_the_A), 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  Py_INCREF(__pyx_d);
  __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #if CYTHON_COMPILING_IN_PYPY
  Py_INCREF(__pyx_b);
  #endif
  if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  /*--- Initialize various global constants etc. ---*/
  if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
  if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  if (__pyx_module_is_main_acora___acora) {
    if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  }
  #if PY_MAJOR_VERSION >= 3
  {
    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (!PyDict_GetItemString(modules, "acora._acora")) {
      if (unlikely(PyDict_SetItemString(modules, "acora._acora", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  #endif
  /*--- Builtin init code ---*/
  if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Constants init code ---*/
  if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Global init code ---*/
  /*--- Variable export code ---*/
  /*--- Function export code ---*/
  /*--- Type init code ---*/
  __pyx_type_5acora_6_acora__NfaState.tp_base = (&PyDict_Type);
  if (PyType_Ready(&__pyx_type_5acora_6_acora__NfaState) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5acora_6_acora__NfaState.tp_print = 0;
  if (__Pyx_SetAttrString(__pyx_m, "_NfaState", (PyObject *)&__pyx_type_5acora_6_acora__NfaState) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5acora_6_acora__NfaState = &__pyx_type_5acora_6_acora__NfaState;
  __pyx_vtabptr_5acora_6_acora_UnicodeAcora = &__pyx_vtable_5acora_6_acora_UnicodeAcora;
  __pyx_vtable_5acora_6_acora_UnicodeAcora.finditer = (PyObject *(*)(struct __pyx_obj_5acora_6_acora_UnicodeAcora *, PyObject *, int __pyx_skip_dispatch))__pyx_f_5acora_6_acora_12UnicodeAcora_finditer;
  if (PyType_Ready(&__pyx_type_5acora_6_acora_UnicodeAcora) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5acora_6_acora_UnicodeAcora.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_5acora_6_acora_UnicodeAcora.tp_dict, __pyx_vtabptr_5acora_6_acora_UnicodeAcora) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "UnicodeAcora", (PyObject *)&__pyx_type_5acora_6_acora_UnicodeAcora) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5acora_6_acora_UnicodeAcora = &__pyx_type_5acora_6_acora_UnicodeAcora;
  __pyx_vtabptr_5acora_6_acora__UnicodeAcoraIter = &__pyx_vtable_5acora_6_acora__UnicodeAcoraIter;
  __pyx_vtable_5acora_6_acora__UnicodeAcoraIter._build_next_match = (PyObject *(*)(struct __pyx_obj_5acora_6_acora__UnicodeAcoraIter *))__pyx_f_5acora_6_acora_17_UnicodeAcoraIter__build_next_match;
  if (PyType_Ready(&__pyx_type_5acora_6_acora__UnicodeAcoraIter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5acora_6_acora__UnicodeAcoraIter.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_5acora_6_acora__UnicodeAcoraIter.tp_dict, __pyx_vtabptr_5acora_6_acora__UnicodeAcoraIter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_UnicodeAcoraIter", (PyObject *)&__pyx_type_5acora_6_acora__UnicodeAcoraIter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5acora_6_acora__UnicodeAcoraIter = &__pyx_type_5acora_6_acora__UnicodeAcoraIter;
  __pyx_vtabptr_5acora_6_acora_BytesAcora = &__pyx_vtable_5acora_6_acora_BytesAcora;
  __pyx_vtable_5acora_6_acora_BytesAcora.finditer = (PyObject *(*)(struct __pyx_obj_5acora_6_acora_BytesAcora *, PyObject *, int __pyx_skip_dispatch))__pyx_f_5acora_6_acora_10BytesAcora_finditer;
  if (PyType_Ready(&__pyx_type_5acora_6_acora_BytesAcora) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5acora_6_acora_BytesAcora.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_5acora_6_acora_BytesAcora.tp_dict, __pyx_vtabptr_5acora_6_acora_BytesAcora) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "BytesAcora", (PyObject *)&__pyx_type_5acora_6_acora_BytesAcora) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5acora_6_acora_BytesAcora = &__pyx_type_5acora_6_acora_BytesAcora;
  __pyx_vtabptr_5acora_6_acora__BytesAcoraIter = &__pyx_vtable_5acora_6_acora__BytesAcoraIter;
  __pyx_vtable_5acora_6_acora__BytesAcoraIter._build_next_match = (PyObject *(*)(struct __pyx_obj_5acora_6_acora__BytesAcoraIter *))__pyx_f_5acora_6_acora_15_BytesAcoraIter__build_next_match;
  if (PyType_Ready(&__pyx_type_5acora_6_acora__BytesAcoraIter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5acora_6_acora__BytesAcoraIter.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_5acora_6_acora__BytesAcoraIter.tp_dict, __pyx_vtabptr_5acora_6_acora__BytesAcoraIter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_BytesAcoraIter", (PyObject *)&__pyx_type_5acora_6_acora__BytesAcoraIter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5acora_6_acora__BytesAcoraIter = &__pyx_type_5acora_6_acora__BytesAcoraIter;
  __pyx_vtabptr_5acora_6_acora__FileAcoraIter = &__pyx_vtable_5acora_6_acora__FileAcoraIter;
  __pyx_vtable_5acora_6_acora__FileAcoraIter._build_next_match = (PyObject *(*)(struct __pyx_obj_5acora_6_acora__FileAcoraIter *))__pyx_f_5acora_6_acora_14_FileAcoraIter__build_next_match;
  if (PyType_Ready(&__pyx_type_5acora_6_acora__FileAcoraIter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_5acora_6_acora__FileAcoraIter.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_5acora_6_acora__FileAcoraIter.tp_dict, __pyx_vtabptr_5acora_6_acora__FileAcoraIter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_FileAcoraIter", (PyObject *)&__pyx_type_5acora_6_acora__FileAcoraIter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5acora_6_acora__FileAcoraIter = &__pyx_type_5acora_6_acora__FileAcoraIter;
  /*--- Type import code ---*/
  /*--- Variable import code ---*/
  /*--- Function import code ---*/
  /*--- Execution code ---*/

  /* "acora/_acora.pyx":11
 * """
 * 
 * __all__ = ['BytesAcora', 'UnicodeAcora']             # <<<<<<<<<<<<<<
 * 
 * from libc cimport stdio
 */
  __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_u_BytesAcora);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_u_BytesAcora);
  __Pyx_GIVEREF(__pyx_n_u_BytesAcora);
  __Pyx_INCREF(__pyx_n_u_UnicodeAcora);
  PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_u_UnicodeAcora);
  __Pyx_GIVEREF(__pyx_n_u_UnicodeAcora);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_all, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "acora/_acora.pyx":1
 * #cython: embedsignature=True             # <<<<<<<<<<<<<<
 * #cython: language_level=3
 * #cython: binding=True
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  if (__pyx_m) {
    __Pyx_AddTraceback("init acora._acora", __pyx_clineno, __pyx_lineno, __pyx_filename);
    Py_DECREF(__pyx_m); __pyx_m = 0;
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init acora._acora");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if PY_MAJOR_VERSION < 3
  return;
  #else
  return __pyx_m;
  #endif
}

/* Runtime support code */
#if CYTHON_REFNANNY
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
    PyObject *m = NULL, *p = NULL;
    void *r = NULL;
    m = PyImport_ImportModule((char *)modname);
    if (!m) goto end;
    p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
    if (!p) goto end;
    r = PyLong_AsVoidPtr(p);
end:
    Py_XDECREF(p);
    Py_XDECREF(m);
    return (__Pyx_RefNannyAPIStruct *)r;
}
#endif /* CYTHON_REFNANNY */

static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
    PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
    if (unlikely(!result)) {
        PyErr_Format(PyExc_NameError,
#if PY_MAJOR_VERSION >= 3
            "name '%U' is not defined", name);
#else
            "name '%.200s' is not defined", PyString_AS_STRING(name));
#endif
    }
    return result;
}

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    PyObject *result;
    ternaryfunc call = func->ob_type->tp_call;
    if (unlikely(!call))
        return PyObject_Call(func, arg, kw);
#if PY_VERSION_HEX >= 0x02060000
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
#endif
    result = (*call)(func, arg, kw);
#if PY_VERSION_HEX >= 0x02060000
    Py_LeaveRecursiveCall();
#endif
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE void __Pyx_crop_slice(Py_ssize_t* _start, Py_ssize_t* _stop, Py_ssize_t* _length) {
    Py_ssize_t start = *_start, stop = *_stop, length = *_length;
    if (start < 0) {
        start += length;
        if (start < 0)
            start = 0;
    }
    if (stop < 0)
        stop += length;
    else if (stop > length)
        stop = length;
    *_length = stop - start;
    *_start = start;
    *_stop = stop;
}
static CYTHON_INLINE void __Pyx_copy_object_array(PyObject** CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) {
    PyObject *v;
    Py_ssize_t i;
    for (i = 0; i < length; i++) {
        v = dest[i] = src[i];
        Py_INCREF(v);
    }
}
static CYTHON_INLINE PyObject* __Pyx_PyList_GetSlice(
            PyObject* src, Py_ssize_t start, Py_ssize_t stop) {
    PyObject* dest;
    Py_ssize_t length = PyList_GET_SIZE(src);
    __Pyx_crop_slice(&start, &stop, &length);
    if (unlikely(length <= 0))
        return PyList_New(0);
    dest = PyList_New(length);
    if (unlikely(!dest))
        return NULL;
    __Pyx_copy_object_array(
        ((PyListObject*)src)->ob_item + start,
        ((PyListObject*)dest)->ob_item,
        length);
    return dest;
}
static CYTHON_INLINE PyObject* __Pyx_PyTuple_GetSlice(
            PyObject* src, Py_ssize_t start, Py_ssize_t stop) {
    PyObject* dest;
    Py_ssize_t length = PyTuple_GET_SIZE(src);
    __Pyx_crop_slice(&start, &stop, &length);
    if (unlikely(length <= 0))
        return PyTuple_New(0);
    dest = PyTuple_New(length);
    if (unlikely(!dest))
        return NULL;
    __Pyx_copy_object_array(
        ((PyTupleObject*)src)->ob_item + start,
        ((PyTupleObject*)dest)->ob_item,
        length);
    return dest;
}
#endif

static CYTHON_INLINE int __Pyx_IterFinish(void) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyThreadState *tstate = PyThreadState_GET();
    PyObject* exc_type = tstate->curexc_type;
    if (unlikely(exc_type)) {
        if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) {
            PyObject *exc_value, *exc_tb;
            exc_value = tstate->curexc_value;
            exc_tb = tstate->curexc_traceback;
            tstate->curexc_type = 0;
            tstate->curexc_value = 0;
            tstate->curexc_traceback = 0;
            Py_DECREF(exc_type);
            Py_XDECREF(exc_value);
            Py_XDECREF(exc_tb);
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
#else
    if (unlikely(PyErr_Occurred())) {
        if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
            PyErr_Clear();
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
#endif
}

static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
    PyErr_Format(PyExc_ValueError,
                 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
                 index, (index == 1) ? "" : "s");
}

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
    PyErr_Format(PyExc_ValueError,
                 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
}

static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
    if (unlikely(retval)) {
        Py_DECREF(retval);
        __Pyx_RaiseTooManyValuesError(expected);
        return -1;
    } else {
        return __Pyx_IterFinish();
    }
    return 0;
}

static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
}

static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) {
    if (t == Py_None) {
      __Pyx_RaiseNoneNotIterableError();
    } else if (PyTuple_GET_SIZE(t) < index) {
      __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t));
    } else {
      __Pyx_RaiseTooManyValuesError(index);
    }
}

static CYTHON_INLINE int __Pyx_unpack_tuple2(PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2,
                                             int is_tuple, int has_known_size, int decref_tuple) {
    Py_ssize_t index;
    PyObject *value1 = NULL, *value2 = NULL, *iter = NULL;
    if (!is_tuple && unlikely(!PyTuple_Check(tuple))) {
        iternextfunc iternext;
        iter = PyObject_GetIter(tuple);
        if (unlikely(!iter)) goto bad;
        if (decref_tuple) { Py_DECREF(tuple); tuple = NULL; }
        iternext = Py_TYPE(iter)->tp_iternext;
        value1 = iternext(iter); if (unlikely(!value1)) { index = 0; goto unpacking_failed; }
        value2 = iternext(iter); if (unlikely(!value2)) { index = 1; goto unpacking_failed; }
        if (!has_known_size && unlikely(__Pyx_IternextUnpackEndCheck(iternext(iter), 2))) goto bad;
        Py_DECREF(iter);
    } else {
        if (!has_known_size && unlikely(PyTuple_GET_SIZE(tuple) != 2)) {
            __Pyx_UnpackTupleError(tuple, 2);
            goto bad;
        }
#if CYTHON_COMPILING_IN_PYPY
        value1 = PySequence_ITEM(tuple, 0);
        if (unlikely(!value1)) goto bad;
        value2 = PySequence_ITEM(tuple, 1);
        if (unlikely(!value2)) goto bad;
#else
        value1 = PyTuple_GET_ITEM(tuple, 0);
        value2 = PyTuple_GET_ITEM(tuple, 1);
        Py_INCREF(value1);
        Py_INCREF(value2);
#endif
        if (decref_tuple) { Py_DECREF(tuple); }
    }
    *pvalue1 = value1;
    *pvalue2 = value2;
    return 0;
unpacking_failed:
    if (!has_known_size && __Pyx_IterFinish() == 0)
        __Pyx_RaiseNeedMoreValuesError(index);
bad:
    Py_XDECREF(iter);
    Py_XDECREF(value1);
    Py_XDECREF(value2);
    if (decref_tuple) { Py_XDECREF(tuple); }
    return -1;
}

static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* iterable, int is_dict, PyObject* method_name,
                                                   Py_ssize_t* p_orig_length, int* p_source_is_dict) {
    is_dict = is_dict || likely(PyDict_CheckExact(iterable));
    *p_source_is_dict = is_dict;
#if !CYTHON_COMPILING_IN_PYPY
    if (is_dict) {
        *p_orig_length = PyDict_Size(iterable);
        Py_INCREF(iterable);
        return iterable;
    }
#endif
    *p_orig_length = 0;
    if (method_name) {
        PyObject* iter;
        iterable = __Pyx_PyObject_CallMethod0(iterable, method_name);
        if (!iterable)
            return NULL;
#if !CYTHON_COMPILING_IN_PYPY
        if (PyTuple_CheckExact(iterable) || PyList_CheckExact(iterable))
            return iterable;
#endif
        iter = PyObject_GetIter(iterable);
        Py_DECREF(iterable);
        return iter;
    }
    return PyObject_GetIter(iterable);
}
static CYTHON_INLINE int __Pyx_dict_iter_next(PyObject* iter_obj, Py_ssize_t orig_length, Py_ssize_t* ppos,
                                              PyObject** pkey, PyObject** pvalue, PyObject** pitem, int source_is_dict) {
    PyObject* next_item;
#if !CYTHON_COMPILING_IN_PYPY
    if (source_is_dict) {
        PyObject *key, *value;
        if (unlikely(orig_length != PyDict_Size(iter_obj))) {
            PyErr_SetString(PyExc_RuntimeError, "dictionary changed size during iteration");
            return -1;
        }
        if (unlikely(!PyDict_Next(iter_obj, ppos, &key, &value))) {
            return 0;
        }
        if (pitem) {
            PyObject* tuple = PyTuple_New(2);
            if (unlikely(!tuple)) {
                return -1;
            }
            Py_INCREF(key);
            Py_INCREF(value);
            PyTuple_SET_ITEM(tuple, 0, key);
            PyTuple_SET_ITEM(tuple, 1, value);
            *pitem = tuple;
        } else {
            if (pkey) {
                Py_INCREF(key);
                *pkey = key;
            }
            if (pvalue) {
                Py_INCREF(value);
                *pvalue = value;
            }
        }
        return 1;
    } else if (PyTuple_CheckExact(iter_obj)) {
        Py_ssize_t pos = *ppos;
        if (unlikely(pos >= PyTuple_GET_SIZE(iter_obj))) return 0;
        *ppos = pos + 1;
        next_item = PyTuple_GET_ITEM(iter_obj, pos);
        Py_INCREF(next_item);
    } else if (PyList_CheckExact(iter_obj)) {
        Py_ssize_t pos = *ppos;
        if (unlikely(pos >= PyList_GET_SIZE(iter_obj))) return 0;
        *ppos = pos + 1;
        next_item = PyList_GET_ITEM(iter_obj, pos);
        Py_INCREF(next_item);
    } else
#endif
    {
        next_item = PyIter_Next(iter_obj);
        if (unlikely(!next_item)) {
            return __Pyx_IterFinish();
        }
    }
    if (pitem) {
        *pitem = next_item;
    } else if (pkey && pvalue) {
        if (__Pyx_unpack_tuple2(next_item, pkey, pvalue, source_is_dict, source_is_dict, 1))
            return -1;
    } else if (pkey) {
        *pkey = next_item;
    } else {
        *pvalue = next_item;
    }
    return 1;
}

static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
    PyObject *result;
#if CYTHON_COMPILING_IN_CPYTHON
    result = PyDict_GetItem(__pyx_d, name);
    if (result) {
        Py_INCREF(result);
    } else {
#else
    result = PyObject_GetItem(__pyx_d, name);
    if (!result) {
        PyErr_Clear();
#endif
        result = __Pyx_GetBuiltinName(name);
    }
    return result;
}

static void __Pyx_RaiseDoubleKeywordsError(
    const char* func_name,
    PyObject* kw_name)
{
    PyErr_Format(PyExc_TypeError,
        #if PY_MAJOR_VERSION >= 3
        "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
        #else
        "%s() got multiple values for keyword argument '%s'", func_name,
        PyString_AsString(kw_name));
        #endif
}

static int __Pyx_ParseOptionalKeywords(
    PyObject *kwds,
    PyObject **argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    const char* function_name)
{
    PyObject *key = 0, *value = 0;
    Py_ssize_t pos = 0;
    PyObject*** name;
    PyObject*** first_kw_arg = argnames + num_pos_args;
    while (PyDict_Next(kwds, &pos, &key, &value)) {
        name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (*name) {
            values[name-argnames] = value;
            continue;
        }
        name = first_kw_arg;
        #if PY_MAJOR_VERSION < 3
        if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
            while (*name) {
                if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
                        && _PyString_Eq(**name, key)) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    if ((**argname == key) || (
                            (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
                             && _PyString_Eq(**argname, key))) {
                        goto arg_passed_twice;
                    }
                    argname++;
                }
            }
        } else
        #endif
        if (likely(PyUnicode_Check(key))) {
            while (*name) {
                int cmp = (**name == key) ? 0 :
                #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                    (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                #endif
                    PyUnicode_Compare(**name, key);
                if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                if (cmp == 0) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    int cmp = (**argname == key) ? 0 :
                    #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                        (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                    #endif
                        PyUnicode_Compare(**argname, key);
                    if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                    if (cmp == 0) goto arg_passed_twice;
                    argname++;
                }
            }
        } else
            goto invalid_keyword_type;
        if (kwds2) {
            if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
        } else {
            goto invalid_keyword;
        }
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, key);
    goto bad;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%.200s() keywords must be strings", function_name);
    goto bad;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%.200s() got an unexpected keyword argument '%.200s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
bad:
    return -1;
}

static void __Pyx_RaiseArgtupleInvalid(
    const char* func_name,
    int exact,
    Py_ssize_t num_min,
    Py_ssize_t num_max,
    Py_ssize_t num_found)
{
    Py_ssize_t num_expected;
    const char *more_or_less;
    if (num_found < num_min) {
        num_expected = num_min;
        more_or_less = "at least";
    } else {
        num_expected = num_max;
        more_or_less = "at most";
    }
    if (exact) {
        more_or_less = "exactly";
    }
    PyErr_Format(PyExc_TypeError,
                 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
                 func_name, more_or_less, num_expected,
                 (num_expected == 1) ? "" : "s", num_found);
}

static void __Pyx_RaiseArgumentTypeInvalid(const char* name, PyObject *obj, PyTypeObject *type) {
    PyErr_Format(PyExc_TypeError,
        "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
        name, type->tp_name, Py_TYPE(obj)->tp_name);
}
static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
    const char *name, int exact)
{
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (none_allowed && obj == Py_None) return 1;
    else if (exact) {
        if (likely(Py_TYPE(obj) == type)) return 1;
        #if PY_MAJOR_VERSION == 2
        else if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
        #endif
    }
    else {
        if (likely(PyObject_TypeCheck(obj, type))) return 1;
    }
    __Pyx_RaiseArgumentTypeInvalid(name, obj, type);
    return 0;
}

static CYTHON_INLINE int __Pyx_init_unicode_iteration(
    PyObject* ustring, Py_ssize_t *length, void** data, int *kind) {
#if CYTHON_PEP393_ENABLED
    if (unlikely(__Pyx_PyUnicode_READY(ustring) < 0)) return -1;
    *kind   = PyUnicode_KIND(ustring);
    *length = PyUnicode_GET_LENGTH(ustring);
    *data   = PyUnicode_DATA(ustring);
#else
    *kind   = 0;
    *length = PyUnicode_GET_SIZE(ustring);
    *data   = (void*)PyUnicode_AS_UNICODE(ustring);
#endif
    return 0;
}

#if !CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values) {
    return PyObject_CallMethodObjArgs(sep, __pyx_n_s_join, values, NULL)
}
#endif

static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
    if (likely(PyList_CheckExact(L))) {
        if (unlikely(__Pyx_PyList_Append(L, x) < 0)) return -1;
    } else {
        PyObject* retval = __Pyx_PyObject_CallMethod1(L, __pyx_n_s_append, x);
        if (unlikely(!retval))
            return -1;
        Py_DECREF(retval);
    }
    return 0;
}

static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d) {
    if (PY_MAJOR_VERSION >= 3)
        return __Pyx_PyObject_CallMethod1((PyObject*)&PyDict_Type, __pyx_n_s_items, d);
    else
        return PyDict_Items(d);
}

static CYTHON_INLINE long __Pyx_div_long(long a, long b) {
    long q = a / b;
    long r = a - q*b;
    q -= ((r != 0) & ((r ^ b) < 0));
    return q;
}

static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();
    tmp_type = tstate->curexc_type;
    tmp_value = tstate->curexc_value;
    tmp_tb = tstate->curexc_traceback;
    tstate->curexc_type = type;
    tstate->curexc_value = value;
    tstate->curexc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#else
    PyErr_Restore(type, value, tb);
#endif
}
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyThreadState *tstate = PyThreadState_GET();
    *type = tstate->curexc_type;
    *value = tstate->curexc_value;
    *tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
#else
    PyErr_Fetch(type, value, tb);
#endif
}

#if PY_MAJOR_VERSION < 3
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
                        CYTHON_UNUSED PyObject *cause) {
    Py_XINCREF(type);
    if (!value || value == Py_None)
        value = NULL;
    else
        Py_INCREF(value);
    if (!tb || tb == Py_None)
        tb = NULL;
    else {
        Py_INCREF(tb);
        if (!PyTraceBack_Check(tb)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: arg 3 must be a traceback or None");
            goto raise_error;
        }
    }
    #if PY_VERSION_HEX < 0x02050000
    if (PyClass_Check(type)) {
    #else
    if (PyType_Check(type)) {
    #endif
#if CYTHON_COMPILING_IN_PYPY
        if (!value) {
            Py_INCREF(Py_None);
            value = Py_None;
        }
#endif
        PyErr_NormalizeException(&type, &value, &tb);
    } else {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto raise_error;
        }
        value = type;
        #if PY_VERSION_HEX < 0x02050000
        if (PyInstance_Check(type)) {
            type = (PyObject*) ((PyInstanceObject*)type)->in_class;
            Py_INCREF(type);
        } else {
            type = 0;
            PyErr_SetString(PyExc_TypeError,
                "raise: exception must be an old-style class or instance");
            goto raise_error;
        }
        #else
        type = (PyObject*) Py_TYPE(type);
        Py_INCREF(type);
        if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: exception class must be a subclass of BaseException");
            goto raise_error;
        }
        #endif
    }
    __Pyx_ErrRestore(type, value, tb);
    return;
raise_error:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}
#else /* Python 3+ */
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
    PyObject* owned_instance = NULL;
    if (tb == Py_None) {
        tb = 0;
    } else if (tb && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto bad;
    }
    if (value == Py_None)
        value = 0;
    if (PyExceptionInstance_Check(type)) {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto bad;
        }
        value = type;
        type = (PyObject*) Py_TYPE(value);
    } else if (PyExceptionClass_Check(type)) {
        PyObject *instance_class = NULL;
        if (value && PyExceptionInstance_Check(value)) {
            instance_class = (PyObject*) Py_TYPE(value);
            if (instance_class != type) {
                if (PyObject_IsSubclass(instance_class, type)) {
                    type = instance_class;
                } else {
                    instance_class = NULL;
                }
            }
        }
        if (!instance_class) {
            PyObject *args;
            if (!value)
                args = PyTuple_New(0);
            else if (PyTuple_Check(value)) {
                Py_INCREF(value);
                args = value;
            } else
                args = PyTuple_Pack(1, value);
            if (!args)
                goto bad;
            owned_instance = PyObject_Call(type, args, NULL);
            Py_DECREF(args);
            if (!owned_instance)
                goto bad;
            value = owned_instance;
            if (!PyExceptionInstance_Check(value)) {
                PyErr_Format(PyExc_TypeError,
                             "calling %R should have returned an instance of "
                             "BaseException, not %R",
                             type, Py_TYPE(value));
                goto bad;
            }
        }
    } else {
        PyErr_SetString(PyExc_TypeError,
            "raise: exception class must be a subclass of BaseException");
        goto bad;
    }
#if PY_VERSION_HEX >= 0x03030000
    if (cause) {
#else
    if (cause && cause != Py_None) {
#endif
        PyObject *fixed_cause;
        if (cause == Py_None) {
            fixed_cause = NULL;
        } else if (PyExceptionClass_Check(cause)) {
            fixed_cause = PyObject_CallObject(cause, NULL);
            if (fixed_cause == NULL)
                goto bad;
        } else if (PyExceptionInstance_Check(cause)) {
            fixed_cause = cause;
            Py_INCREF(fixed_cause);
        } else {
            PyErr_SetString(PyExc_TypeError,
                            "exception causes must derive from "
                            "BaseException");
            goto bad;
        }
        PyException_SetCause(value, fixed_cause);
    }
    PyErr_SetObject(type, value);
    if (tb) {
        PyThreadState *tstate = PyThreadState_GET();
        PyObject* tmp_tb = tstate->curexc_traceback;
        if (tb != tmp_tb) {
            Py_INCREF(tb);
            tstate->curexc_traceback = tb;
            Py_XDECREF(tmp_tb);
        }
    }
bad:
    Py_XDECREF(owned_instance);
    return;
}
#endif

static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyThreadState *tstate = PyThreadState_GET();
    *type = tstate->exc_type;
    *value = tstate->exc_value;
    *tb = tstate->exc_traceback;
    Py_XINCREF(*type);
    Py_XINCREF(*value);
    Py_XINCREF(*tb);
#else
    PyErr_GetExcInfo(type, value, tb);
#endif
}
static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = type;
    tstate->exc_value = value;
    tstate->exc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#else
    PyErr_SetExcInfo(type, value, tb);
#endif
}

static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *local_type, *local_value, *local_tb;
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();
    local_type = tstate->curexc_type;
    local_value = tstate->curexc_value;
    local_tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
#else
    PyErr_Fetch(&local_type, &local_value, &local_tb);
#endif
    PyErr_NormalizeException(&local_type, &local_value, &local_tb);
#if CYTHON_COMPILING_IN_CPYTHON
    if (unlikely(tstate->curexc_type))
#else
    if (unlikely(PyErr_Occurred()))
#endif
        goto bad;
    #if PY_MAJOR_VERSION >= 3
    if (local_tb) {
        if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
            goto bad;
    }
    #endif
    Py_XINCREF(local_tb);
    Py_XINCREF(local_type);
    Py_XINCREF(local_value);
    *type = local_type;
    *value = local_value;
    *tb = local_tb;
#if CYTHON_COMPILING_IN_CPYTHON
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = local_type;
    tstate->exc_value = local_value;
    tstate->exc_traceback = local_tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#else
    PyErr_SetExcInfo(local_type, local_value, local_tb);
#endif
    return 0;
bad:
    *type = 0;
    *value = 0;
    *tb = 0;
    Py_XDECREF(local_type);
    Py_XDECREF(local_value);
    Py_XDECREF(local_tb);
    return -1;
}

static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
    PyObject *ob = PyCapsule_New(vtable, 0, 0);
#else
    PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
#endif
    if (!ob)
        goto bad;
    if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
        goto bad;
    Py_DECREF(ob);
    return 0;
bad:
    Py_XDECREF(ob);
    return -1;
}

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_long(unsigned long value) {
    const unsigned long neg_one = (unsigned long) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(unsigned long) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(unsigned long) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(unsigned long) <= sizeof(unsigned long long)) {
            return PyLong_FromUnsignedLongLong((unsigned long long) value);
        }
    } else {
        if (sizeof(unsigned long) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(unsigned long) <= sizeof(long long)) {
            return PyLong_FromLongLong((long long) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(unsigned long),
                                     little, !is_unsigned);
    }
}

#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func)             \
    {                                                                     \
        func_type value = func(x);                                        \
        if (sizeof(target_type) < sizeof(func_type)) {                    \
            if (unlikely(value != (func_type) (target_type) value)) {     \
                func_type zero = 0;                                       \
                PyErr_SetString(PyExc_OverflowError,                      \
                    (is_unsigned && unlikely(value < zero)) ?             \
                    "can't convert negative value to " #target_type :     \
                    "value too large to convert to " #target_type);       \
                return (target_type) -1;                                  \
            }                                                             \
        }                                                                 \
        return (target_type) value;                                       \
    }

#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
  #include "longintrepr.h"
 #endif
#endif
static CYTHON_INLINE unsigned long __Pyx_PyInt_As_unsigned_long(PyObject *x) {
    const unsigned long neg_one = (unsigned long) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(unsigned long) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(unsigned long, long, PyInt_AS_LONG)
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to unsigned long");
                return (unsigned long) -1;
            }
            return (unsigned long) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(unsigned long)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return (unsigned long) ((PyLongObject*)x)->ob_digit[0];
                }
            }
 #endif
#endif
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to unsigned long");
                return (unsigned long) -1;
            }
            if (sizeof(unsigned long) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT(unsigned long, unsigned long, PyLong_AsUnsignedLong)
            } else if (sizeof(unsigned long) <= sizeof(unsigned long long)) {
                __PYX_VERIFY_RETURN_INT(unsigned long, unsigned long long, PyLong_AsUnsignedLongLong)
            }
        } else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(unsigned long)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return +(unsigned long) ((PyLongObject*)x)->ob_digit[0];
                    case -1: return -(unsigned long) ((PyLongObject*)x)->ob_digit[0];
                }
            }
 #endif
#endif
            if (sizeof(unsigned long) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT(unsigned long, long, PyLong_AsLong)
            } else if (sizeof(unsigned long) <= sizeof(long long)) {
                __PYX_VERIFY_RETURN_INT(unsigned long, long long, PyLong_AsLongLong)
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            unsigned long val;
            PyObject *v = __Pyx_PyNumber_Int(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (unsigned long) -1;
        }
    } else {
        unsigned long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (unsigned long) -1;
        val = __Pyx_PyInt_As_unsigned_long(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
  #include "longintrepr.h"
 #endif
#endif
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
    const int neg_one = (int) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(int) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG)
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to int");
                return (int) -1;
            }
            return (int) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(int)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return (int) ((PyLongObject*)x)->ob_digit[0];
                }
            }
 #endif
#endif
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to int");
                return (int) -1;
            }
            if (sizeof(int) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT(int, unsigned long, PyLong_AsUnsignedLong)
            } else if (sizeof(int) <= sizeof(unsigned long long)) {
                __PYX_VERIFY_RETURN_INT(int, unsigned long long, PyLong_AsUnsignedLongLong)
            }
        } else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(int)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return +(int) ((PyLongObject*)x)->ob_digit[0];
                    case -1: return -(int) ((PyLongObject*)x)->ob_digit[0];
                }
            }
 #endif
#endif
            if (sizeof(int) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT(int, long, PyLong_AsLong)
            } else if (sizeof(int) <= sizeof(long long)) {
                __PYX_VERIFY_RETURN_INT(int, long long, PyLong_AsLongLong)
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            int val;
            PyObject *v = __Pyx_PyNumber_Int(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (int) -1;
        }
    } else {
        int val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (int) -1;
        val = __Pyx_PyInt_As_int(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
  #include "longintrepr.h"
 #endif
#endif
static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) {
    const size_t neg_one = (size_t) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(size_t) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(size_t, long, PyInt_AS_LONG)
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to size_t");
                return (size_t) -1;
            }
            return (size_t) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(size_t)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return (size_t) ((PyLongObject*)x)->ob_digit[0];
                }
            }
 #endif
#endif
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to size_t");
                return (size_t) -1;
            }
            if (sizeof(size_t) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT(size_t, unsigned long, PyLong_AsUnsignedLong)
            } else if (sizeof(size_t) <= sizeof(unsigned long long)) {
                __PYX_VERIFY_RETURN_INT(size_t, unsigned long long, PyLong_AsUnsignedLongLong)
            }
        } else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(size_t)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return +(size_t) ((PyLongObject*)x)->ob_digit[0];
                    case -1: return -(size_t) ((PyLongObject*)x)->ob_digit[0];
                }
            }
 #endif
#endif
            if (sizeof(size_t) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT(size_t, long, PyLong_AsLong)
            } else if (sizeof(size_t) <= sizeof(long long)) {
                __PYX_VERIFY_RETURN_INT(size_t, long long, PyLong_AsLongLong)
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            size_t val;
            PyObject *v = __Pyx_PyNumber_Int(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (size_t) -1;
        }
    } else {
        size_t val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (size_t) -1;
        val = __Pyx_PyInt_As_size_t(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE Py_UCS4 __Pyx_PyObject_AsPy_UCS4(PyObject* x) {
   long ival;
   if (PyUnicode_Check(x)) {
       Py_ssize_t length;
       #if CYTHON_PEP393_ENABLED
       length = PyUnicode_GET_LENGTH(x);
       if (likely(length == 1)) {
           return PyUnicode_READ_CHAR(x, 0);
       }
       #else
       length = PyUnicode_GET_SIZE(x);
       if (likely(length == 1)) {
           return PyUnicode_AS_UNICODE(x)[0];
       }
       #if Py_UNICODE_SIZE == 2
       else if (PyUnicode_GET_SIZE(x) == 2) {
           Py_UCS4 high_val = PyUnicode_AS_UNICODE(x)[0];
           if (high_val >= 0xD800 && high_val <= 0xDBFF) {
               Py_UCS4 low_val = PyUnicode_AS_UNICODE(x)[1];
               if (low_val >= 0xDC00 && low_val <= 0xDFFF) {
                   return 0x10000 + (((high_val & ((1<<10)-1)) << 10) | (low_val & ((1<<10)-1)));
               }
           }
       }
       #endif
       #endif
       PyErr_Format(PyExc_ValueError,
                    "only single character unicode strings can be converted to Py_UCS4, "
                    "got length %" CYTHON_FORMAT_SSIZE_T "d", length);
       return (Py_UCS4)-1;
   }
   ival = __Pyx_PyInt_As_long(x);
   if (unlikely(ival < 0)) {
       if (!PyErr_Occurred())
           PyErr_SetString(PyExc_OverflowError,
                           "cannot convert negative value to Py_UCS4");
       return (Py_UCS4)-1;
   } else if (unlikely(ival > 1114111)) {
       PyErr_SetString(PyExc_OverflowError,
                       "value too large to convert to Py_UCS4");
       return (Py_UCS4)-1;
   }
   return (Py_UCS4)ival;
}

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_ptrdiff_t(ptrdiff_t value) {
    const ptrdiff_t neg_one = (ptrdiff_t) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(ptrdiff_t) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(ptrdiff_t) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(ptrdiff_t) <= sizeof(unsigned long long)) {
            return PyLong_FromUnsignedLongLong((unsigned long long) value);
        }
    } else {
        if (sizeof(ptrdiff_t) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(ptrdiff_t) <= sizeof(long long)) {
            return PyLong_FromLongLong((long long) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(ptrdiff_t),
                                     little, !is_unsigned);
    }
}

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
    const int neg_one = (int) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(int) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(int) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(int) <= sizeof(unsigned long long)) {
            return PyLong_FromUnsignedLongLong((unsigned long long) value);
        }
    } else {
        if (sizeof(int) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(int) <= sizeof(long long)) {
            return PyLong_FromLongLong((long long) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(int),
                                     little, !is_unsigned);
    }
}

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_char(unsigned char value) {
    const unsigned char neg_one = (unsigned char) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(unsigned char) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(unsigned char) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(unsigned char) <= sizeof(unsigned long long)) {
            return PyLong_FromUnsignedLongLong((unsigned long long) value);
        }
    } else {
        if (sizeof(unsigned char) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(unsigned char) <= sizeof(long long)) {
            return PyLong_FromLongLong((long long) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(unsigned char),
                                     little, !is_unsigned);
    }
}

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
    const long neg_one = (long) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(long) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(long) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(long) <= sizeof(unsigned long long)) {
            return PyLong_FromUnsignedLongLong((unsigned long long) value);
        }
    } else {
        if (sizeof(long) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(long) <= sizeof(long long)) {
            return PyLong_FromLongLong((long long) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(long),
                                     little, !is_unsigned);
    }
}

#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
  #include "longintrepr.h"
 #endif
#endif
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
    const long neg_one = (long) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(long) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG)
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to long");
                return (long) -1;
            }
            return (long) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(long)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return (long) ((PyLongObject*)x)->ob_digit[0];
                }
            }
 #endif
#endif
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to long");
                return (long) -1;
            }
            if (sizeof(long) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT(long, unsigned long, PyLong_AsUnsignedLong)
            } else if (sizeof(long) <= sizeof(unsigned long long)) {
                __PYX_VERIFY_RETURN_INT(long, unsigned long long, PyLong_AsUnsignedLongLong)
            }
        } else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(long)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return +(long) ((PyLongObject*)x)->ob_digit[0];
                    case -1: return -(long) ((PyLongObject*)x)->ob_digit[0];
                }
            }
 #endif
#endif
            if (sizeof(long) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT(long, long, PyLong_AsLong)
            } else if (sizeof(long) <= sizeof(long long)) {
                __PYX_VERIFY_RETURN_INT(long, long long, PyLong_AsLongLong)
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            long val;
            PyObject *v = __Pyx_PyNumber_Int(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (long) -1;
        }
    } else {
        long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (long) -1;
        val = __Pyx_PyInt_As_long(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static int __Pyx_check_binary_version(void) {
    char ctversion[4], rtversion[4];
    PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
    PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
    if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
        char message[200];
        PyOS_snprintf(message, sizeof(message),
                      "compiletime version %s of module '%.100s' "
                      "does not match runtime version %s",
                      ctversion, __Pyx_MODULE_NAME, rtversion);
        #if PY_VERSION_HEX < 0x02050000
        return PyErr_Warn(NULL, message);
        #else
        return PyErr_WarnEx(NULL, message, 1);
        #endif
    }
    return 0;
}

static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
    int start = 0, mid = 0, end = count - 1;
    if (end >= 0 && code_line > entries[end].code_line) {
        return count;
    }
    while (start < end) {
        mid = (start + end) / 2;
        if (code_line < entries[mid].code_line) {
            end = mid;
        } else if (code_line > entries[mid].code_line) {
             start = mid + 1;
        } else {
            return mid;
        }
    }
    if (code_line <= entries[mid].code_line) {
        return mid;
    } else {
        return mid + 1;
    }
}
static PyCodeObject *__pyx_find_code_object(int code_line) {
    PyCodeObject* code_object;
    int pos;
    if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
        return NULL;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
        return NULL;
    }
    code_object = __pyx_code_cache.entries[pos].code_object;
    Py_INCREF(code_object);
    return code_object;
}
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
    int pos, i;
    __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
    if (unlikely(!code_line)) {
        return;
    }
    if (unlikely(!entries)) {
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
        if (likely(entries)) {
            __pyx_code_cache.entries = entries;
            __pyx_code_cache.max_count = 64;
            __pyx_code_cache.count = 1;
            entries[0].code_line = code_line;
            entries[0].code_object = code_object;
            Py_INCREF(code_object);
        }
        return;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
        PyCodeObject* tmp = entries[pos].code_object;
        entries[pos].code_object = code_object;
        Py_DECREF(tmp);
        return;
    }
    if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
        int new_max = __pyx_code_cache.max_count + 64;
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
            __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry));
        if (unlikely(!entries)) {
            return;
        }
        __pyx_code_cache.entries = entries;
        __pyx_code_cache.max_count = new_max;
    }
    for (i=__pyx_code_cache.count; i>pos; i--) {
        entries[i] = entries[i-1];
    }
    entries[pos].code_line = code_line;
    entries[pos].code_object = code_object;
    __pyx_code_cache.count++;
    Py_INCREF(code_object);
}

#include "compile.h"
#include "frameobject.h"
#include "traceback.h"
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
            const char *funcname, int c_line,
            int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    #if PY_MAJOR_VERSION < 3
    py_srcfile = PyString_FromString(filename);
    #else
    py_srcfile = PyUnicode_FromString(filename);
    #endif
    if (!py_srcfile) goto bad;
    if (c_line) {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #else
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #endif
    }
    else {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromString(funcname);
        #else
        py_funcname = PyUnicode_FromString(funcname);
        #endif
    }
    if (!py_funcname) goto bad;
    py_code = __Pyx_PyCode_New(
        0,            /*int argcount,*/
        0,            /*int kwonlyargcount,*/
        0,            /*int nlocals,*/
        0,            /*int stacksize,*/
        0,            /*int flags,*/
        __pyx_empty_bytes, /*PyObject *code,*/
        __pyx_empty_tuple, /*PyObject *consts,*/
        __pyx_empty_tuple, /*PyObject *names,*/
        __pyx_empty_tuple, /*PyObject *varnames,*/
        __pyx_empty_tuple, /*PyObject *freevars,*/
        __pyx_empty_tuple, /*PyObject *cellvars,*/
        py_srcfile,   /*PyObject *filename,*/
        py_funcname,  /*PyObject *name,*/
        py_line,      /*int firstlineno,*/
        __pyx_empty_bytes  /*PyObject *lnotab*/
    );
    Py_DECREF(py_srcfile);
    Py_DECREF(py_funcname);
    return py_code;
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
    return NULL;
}
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyObject *py_globals = 0;
    PyFrameObject *py_frame = 0;
    py_code = __pyx_find_code_object(c_line ? c_line : py_line);
    if (!py_code) {
        py_code = __Pyx_CreateCodeObjectForTraceback(
            funcname, c_line, py_line, filename);
        if (!py_code) goto bad;
        __pyx_insert_code_object(c_line ? c_line : py_line, py_code);
    }
    py_globals = PyModule_GetDict(__pyx_m);
    if (!py_globals) goto bad;
    py_frame = PyFrame_New(
        PyThreadState_GET(), /*PyThreadState *tstate,*/
        py_code,             /*PyCodeObject *code,*/
        py_globals,          /*PyObject *globals,*/
        0                    /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    py_frame->f_lineno = py_line;
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
    while (t->p) {
        #if PY_MAJOR_VERSION < 3
        if (t->is_unicode) {
            *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
        } else if (t->intern) {
            *t->p = PyString_InternFromString(t->s);
        } else {
            *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
        }
        #else  /* Python 3+ has unicode identifiers */
        if (t->is_unicode | t->is_str) {
            if (t->intern) {
                *t->p = PyUnicode_InternFromString(t->s);
            } else if (t->encoding) {
                *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
            } else {
                *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
            }
        } else {
            *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
        }
        #endif
        if (!*t->p)
            return -1;
        ++t;
    }
    return 0;
}

static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char* c_str) {
    return __Pyx_PyUnicode_FromStringAndSize(c_str, strlen(c_str));
}
static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
    Py_ssize_t ignore;
    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
}
static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
    if (
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
            __Pyx_sys_getdefaultencoding_not_ascii &&
#endif
            PyUnicode_Check(o)) {
#if PY_VERSION_HEX < 0x03030000
        char* defenc_c;
        PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
        if (!defenc) return NULL;
        defenc_c = PyBytes_AS_STRING(defenc);
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
        {
            char* end = defenc_c + PyBytes_GET_SIZE(defenc);
            char* c;
            for (c = defenc_c; c < end; c++) {
                if ((unsigned char) (*c) >= 128) {
                    PyUnicode_AsASCIIString(o);
                    return NULL;
                }
            }
        }
#endif /*__PYX_DEFAULT_STRING_ENCODING_IS_ASCII*/
        *length = PyBytes_GET_SIZE(defenc);
        return defenc_c;
#else /* PY_VERSION_HEX < 0x03030000 */
        if (PyUnicode_READY(o) == -1) return NULL;
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
        if (PyUnicode_IS_ASCII(o)) {
            *length = PyUnicode_GET_DATA_SIZE(o);
            return PyUnicode_AsUTF8(o);
        } else {
            PyUnicode_AsASCIIString(o);
            return NULL;
        }
#else /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */
        return PyUnicode_AsUTF8AndSize(o, length);
#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */
#endif /* PY_VERSION_HEX < 0x03030000 */
    } else
#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII  || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT */
#if !CYTHON_COMPILING_IN_PYPY
#if PY_VERSION_HEX >= 0x02060000
    if (PyByteArray_Check(o)) {
        *length = PyByteArray_GET_SIZE(o);
        return PyByteArray_AS_STRING(o);
    } else
#endif
#endif
    {
        char* result;
        int r = PyBytes_AsStringAndSize(o, &result, length);
        if (unlikely(r < 0)) {
            return NULL;
        } else {
            return result;
        }
    }
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
   int is_true = x == Py_True;
   if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
   else return PyObject_IsTrue(x);
}
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
  PyNumberMethods *m;
  const char *name = NULL;
  PyObject *res = NULL;
#if PY_MAJOR_VERSION < 3
  if (PyInt_Check(x) || PyLong_Check(x))
#else
  if (PyLong_Check(x))
#endif
    return Py_INCREF(x), x;
  m = Py_TYPE(x)->tp_as_number;
#if PY_MAJOR_VERSION < 3
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Int(x);
  }
  else if (m && m->nb_long) {
    name = "long";
    res = PyNumber_Long(x);
  }
#else
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Long(x);
  }
#endif
  if (res) {
#if PY_MAJOR_VERSION < 3
    if (!PyInt_Check(res) && !PyLong_Check(res)) {
#else
    if (!PyLong_Check(res)) {
#endif
      PyErr_Format(PyExc_TypeError,
                   "__%.4s__ returned non-%.4s (type %.200s)",
                   name, name, Py_TYPE(res)->tp_name);
      Py_DECREF(res);
      return NULL;
    }
  }
  else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_TypeError,
                    "an integer is required");
  }
  return res;
}
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
  #include "longintrepr.h"
 #endif
#endif
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  Py_ssize_t ival;
  PyObject *x;
#if PY_MAJOR_VERSION < 3
  if (likely(PyInt_CheckExact(b)))
      return PyInt_AS_LONG(b);
#endif
  if (likely(PyLong_CheckExact(b))) {
    #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
     #if CYTHON_USE_PYLONG_INTERNALS
       switch (Py_SIZE(b)) {
       case -1: return -(sdigit)((PyLongObject*)b)->ob_digit[0];
       case  0: return 0;
       case  1: return ((PyLongObject*)b)->ob_digit[0];
       }
     #endif
    #endif
  #if PY_VERSION_HEX < 0x02060000
    return PyInt_AsSsize_t(b);
  #else
    return PyLong_AsSsize_t(b);
  #endif
  }
  x = PyNumber_Index(b);
  if (!x) return -1;
  ival = PyInt_AsSsize_t(x);
  Py_DECREF(x);
  return ival;
}
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
#if PY_VERSION_HEX < 0x02050000
   if (ival <= LONG_MAX)
       return PyInt_FromLong((long)ival);
   else {
       unsigned char *bytes = (unsigned char *) &ival;
       int one = 1; int little = (int)*(unsigned char*)&one;
       return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0);
   }
#else
   return PyInt_FromSize_t(ival);
#endif
}


#endif /* Py_PYTHON_H */
