/* Generated by Cython 0.22 */

/* BEGIN: Cython Metadata
{
    "distutils": {
        "depends": []
    }
}
END: Cython Metadata */

#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 < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000)
    #error Cython requires Python 2.6+ or Python 3.2+.
#else
#define CYTHON_ABI "0_22"
#include <stddef.h>
#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 && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
#define Py_OptimizeFlag 0
#endif
#define __PYX_BUILD_PY_SSIZE_T "n"
#define CYTHON_FORMAT_SSIZE_T "z"
#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_MAJOR_VERSION >= 3
  #define Py_TPFLAGS_CHECKTYPES 0
  #define Py_TPFLAGS_HAVE_INDEX 0
  #define Py_TPFLAGS_HAVE_NEWBUFFER 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)
  #define __Pyx_PyFrozenSet_Size(s)         PyObject_Size(s)
#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))
  #define __Pyx_PyFrozenSet_Size(s)         PySet_Size(s)
#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_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_Check(obj) || PyUnicode_Check(obj))
  #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
#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_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
  #ifndef PyUnicode_InternFromString
    #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
  #endif
#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
  #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
#else
  #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
#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
#define __Pyx_void_to_None(void_result) (void_result, Py_INCREF(Py_None), Py_None)
#ifdef __cplusplus
template<typename T>
void __Pyx_call_destructor(T* x) {
    x->~T();
}
template<typename T>
class __Pyx_FakeReference {
  public:
    __Pyx_FakeReference() : ptr(NULL) { }
    __Pyx_FakeReference(T& ref) : ptr(&ref) { }
    T *operator->() { return ptr; }
    operator T&() { return *ptr; }
  private:
    T *ptr;
};
#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__trimxtreme___align
#define __PYX_HAVE_API__trimxtreme___align
#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;

#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(const 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_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
#define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
#define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
#define __Pyx_PyStr_FromCString(s)     __Pyx_PyStr_FromString((const char*)s)
#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const 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 (size_t)(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;
    PyObject* default_encoding = NULL;
    PyObject* ascii_chars_u = NULL;
    PyObject* ascii_chars_b = NULL;
    const char* default_encoding_c;
    sys = PyImport_ImportModule("sys");
    if (!sys) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
    Py_DECREF(sys);
    if (!default_encoding) goto bad;
    default_encoding_c = PyBytes_AsString(default_encoding);
    if (!default_encoding_c) goto bad;
    if (strcmp(default_encoding_c, "ascii") == 0) {
        __Pyx_sys_getdefaultencoding_not_ascii = 0;
    } else {
        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) goto bad;
        ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
        if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(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_DECREF(ascii_chars_u);
        Py_DECREF(ascii_chars_b);
    }
    Py_DECREF(default_encoding);
    return 0;
bad:
    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;
    PyObject* default_encoding = NULL;
    char* default_encoding_c;
    sys = PyImport_ImportModule("sys");
    if (!sys) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
    Py_DECREF(sys);
    if (!default_encoding) goto bad;
    default_encoding_c = PyBytes_AsString(default_encoding);
    if (!default_encoding_c) goto bad;
    __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
    if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
    strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
    Py_DECREF(default_encoding);
    return 0;
bad:
    Py_XDECREF(default_encoding);
    return -1;
}
#endif
#endif


/* Test for GCC > 2.95 */
#if defined(__GNUC__)     && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
  #define likely(x)   __builtin_expect(!!(x), 1)
  #define unlikely(x) __builtin_expect(!!(x), 0)
#else /* !__GNUC__ or GCC < 2.95 */
  #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[] = {
  "trimxtreme/_align.pyx",
};

/*--- Type declarations ---*/
struct __pyx_obj_10trimxtreme_6_align_Aligner;
struct __pyx_t_10trimxtreme_6_align__Entry;
typedef struct __pyx_t_10trimxtreme_6_align__Entry __pyx_t_10trimxtreme_6_align__Entry;
struct __pyx_t_10trimxtreme_6_align__Match;
typedef struct __pyx_t_10trimxtreme_6_align__Match __pyx_t_10trimxtreme_6_align__Match;

/* "trimxtreme/_align.pyx":18
 * 
 * # structure for a DP matrix entry
 * ctypedef struct _Entry:             # <<<<<<<<<<<<<<
 * 	int cost
 * 	int matches  # no. of matches in this alignment
 */
struct __pyx_t_10trimxtreme_6_align__Entry {
  int cost;
  int matches;
  int origin;
};

/* "trimxtreme/_align.pyx":24
 * 
 * 
 * ctypedef struct _Match:             # <<<<<<<<<<<<<<
 * 	int origin
 * 	int cost
 */
struct __pyx_t_10trimxtreme_6_align__Match {
  int origin;
  int cost;
  int matches;
  int ref_stop;
  int query_stop;
};

/* "trimxtreme/_align.pyx":92
 * 
 * 
 * cdef class Aligner:             # <<<<<<<<<<<<<<
 * 	"""
 * 	TODO documentation still uses s1 (reference) and s2 (query).
 */
struct __pyx_obj_10trimxtreme_6_align_Aligner {
  PyObject_HEAD
  int m;
  __pyx_t_10trimxtreme_6_align__Entry *column;
  double max_error_rate;
  int flags;
  int min_overlap;
  int wildcard_ref;
  int wildcard_query;
  PyObject *_reference;
};


/* --- Runtime support code (head) --- */
#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);
  #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
#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);

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

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
#endif

static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);

static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg);

static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d);

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);

static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);

static CYTHON_INLINE int __Pyx_IterFinish(void);

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

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
#else
#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
#endif

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);

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

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

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

#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o,n,NULL)
static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_setattro))
        return tp->tp_setattro(obj, attr_name, value);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_setattr))
        return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value);
#endif
    return PyObject_SetAttr(obj, attr_name, value);
}
#else
#define __Pyx_PyObject_DelAttrStr(o,n)   PyObject_DelAttr(o,n)
#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
#endif

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

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

#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \
    __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) : \
    (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) : \
               __Pyx_GetItemInt_Generic(o, to_py_func(i))))
#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \
    __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) : \
    (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck);
#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \
    __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) : \
    (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck);
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
                                                     int is_list, int wraparound, int boundscheck);

static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name);

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);

static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);

static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);

static int __Pyx_check_binary_version(void);

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);


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

/* Module declarations from 'trimxtreme._align' */
static PyTypeObject *__pyx_ptype_10trimxtreme_6_align_Aligner = 0;
static PyObject *__pyx_v_10trimxtreme_6_align_ACGT_TABLE = 0;
static PyObject *__pyx_v_10trimxtreme_6_align_IUPAC_TABLE = 0;
#define __Pyx_MODULE_NAME "trimxtreme._align"
int __pyx_module_is_main_trimxtreme___align = 0;

/* Implementation of 'trimxtreme._align' */
static PyObject *__pyx_builtin_ord;
static PyObject *__pyx_builtin_ValueError;
static PyObject *__pyx_builtin_MemoryError;
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_pf_10trimxtreme_6_align__acgt_table(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_10trimxtreme_6_align_2_iupac_table(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static int __pyx_pf_10trimxtreme_6_align_7Aligner___cinit__(struct __pyx_obj_10trimxtreme_6_align_Aligner *__pyx_v_self, PyObject *__pyx_v_reference, double __pyx_v_max_error_rate, int __pyx_v_flags, int __pyx_v_degenerate, int __pyx_v_min_overlap); /* proto */
static PyObject *__pyx_pf_10trimxtreme_6_align_7Aligner_9reference___get__(struct __pyx_obj_10trimxtreme_6_align_Aligner *__pyx_v_self); /* proto */
static int __pyx_pf_10trimxtreme_6_align_7Aligner_9reference_2__set__(struct __pyx_obj_10trimxtreme_6_align_Aligner *__pyx_v_self, PyObject *__pyx_v_reference); /* proto */
static PyObject *__pyx_pf_10trimxtreme_6_align_7Aligner_2locate(struct __pyx_obj_10trimxtreme_6_align_Aligner *__pyx_v_self, PyObject *__pyx_v_query); /* proto */
static void __pyx_pf_10trimxtreme_6_align_7Aligner_4__dealloc__(struct __pyx_obj_10trimxtreme_6_align_Aligner *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10trimxtreme_6_align_4locate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_reference, PyObject *__pyx_v_query, double __pyx_v_max_error_rate, int __pyx_v_flags, int __pyx_v_degenerate, int __pyx_v_min_overlap); /* proto */
static PyObject *__pyx_pf_10trimxtreme_6_align_6compare_prefixes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_ref, PyObject *__pyx_v_query, int __pyx_v_degenerate); /* proto */
static PyObject *__pyx_tp_new_10trimxtreme_6_align_Aligner(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static char __pyx_k_[] = "\000";
static char __pyx_k_A[] = "A";
static char __pyx_k_B[] = "B";
static char __pyx_k_C[] = "C";
static char __pyx_k_D[] = "D";
static char __pyx_k_G[] = "G";
static char __pyx_k_H[] = "H";
static char __pyx_k_K[] = "K";
static char __pyx_k_M[] = "M";
static char __pyx_k_N[] = "N";
static char __pyx_k_R[] = "R";
static char __pyx_k_S[] = "S";
static char __pyx_k_T[] = "T";
static char __pyx_k_U[] = "U";
static char __pyx_k_V[] = "V";
static char __pyx_k_W[] = "W";
static char __pyx_k_X[] = "X";
static char __pyx_k_Y[] = "Y";
static char __pyx_k_c[] = "c";
static char __pyx_k_d[] = "d";
static char __pyx_k_i[] = "i";
static char __pyx_k_m[] = "m";
static char __pyx_k_n[] = "n";
static char __pyx_k_t[] = "t";
static char __pyx_k_v[] = "v";
static char __pyx_k_ord[] = "ord";
static char __pyx_k_ref[] = "ref";
static char __pyx_k_main[] = "__main__";
static char __pyx_k_test[] = "__test__";
static char __pyx_k_ascii[] = "ascii";
static char __pyx_k_flags[] = "flags";
static char __pyx_k_items[] = "items";
static char __pyx_k_lower[] = "lower";
static char __pyx_k_q_ptr[] = "q_ptr";
static char __pyx_k_query[] = "query";
static char __pyx_k_r_ptr[] = "r_ptr";
static char __pyx_k_range[] = "range";
static char __pyx_k_encode[] = "encode";
static char __pyx_k_length[] = "length";
static char __pyx_k_locate[] = "locate";
static char __pyx_k_aligner[] = "aligner";
static char __pyx_k_matches[] = "matches";
static char __pyx_k_ref_bytes[] = "ref_bytes";
static char __pyx_k_reference[] = "reference";
static char __pyx_k_translate[] = "translate";
static char __pyx_k_ValueError[] = "ValueError";
static char __pyx_k_acgt_table[] = "_acgt_table";
static char __pyx_k_degenerate[] = "degenerate";
static char __pyx_k_MemoryError[] = "MemoryError";
static char __pyx_k_iupac_table[] = "_iupac_table";
static char __pyx_k_min_overlap[] = "min_overlap";
static char __pyx_k_query_bytes[] = "query_bytes";
static char __pyx_k_wildcard_ref[] = "wildcard_ref";
static char __pyx_k_compare_ascii[] = "compare_ascii";
static char __pyx_k_max_error_rate[] = "max_error_rate";
static char __pyx_k_wildcard_query[] = "wildcard_query";
static char __pyx_k_compare_prefixes[] = "compare_prefixes";
static char __pyx_k_trimxtreme__align[] = "trimxtreme._align";
static char __pyx_k_bi_home_rocks_av_cegx_barcoding[] = "/bi/home/rocks-av/cegx-barcoding/trimxtreme/trimxtreme/_align.pyx";
static char __pyx_k_minimum_overlap_must_be_at_least[] = "minimum overlap must be at least 1";
static PyObject *__pyx_kp_b_;
static PyObject *__pyx_n_s_A;
static PyObject *__pyx_n_s_B;
static PyObject *__pyx_n_s_C;
static PyObject *__pyx_n_s_D;
static PyObject *__pyx_n_s_G;
static PyObject *__pyx_n_s_H;
static PyObject *__pyx_n_s_K;
static PyObject *__pyx_n_s_M;
static PyObject *__pyx_n_s_MemoryError;
static PyObject *__pyx_n_s_N;
static PyObject *__pyx_n_s_R;
static PyObject *__pyx_n_s_S;
static PyObject *__pyx_n_s_T;
static PyObject *__pyx_n_s_U;
static PyObject *__pyx_n_s_V;
static PyObject *__pyx_n_s_ValueError;
static PyObject *__pyx_n_s_W;
static PyObject *__pyx_n_s_X;
static PyObject *__pyx_n_s_Y;
static PyObject *__pyx_n_s_acgt_table;
static PyObject *__pyx_n_s_aligner;
static PyObject *__pyx_n_s_ascii;
static PyObject *__pyx_kp_s_bi_home_rocks_av_cegx_barcoding;
static PyObject *__pyx_n_s_c;
static PyObject *__pyx_n_s_compare_ascii;
static PyObject *__pyx_n_s_compare_prefixes;
static PyObject *__pyx_n_s_d;
static PyObject *__pyx_n_s_degenerate;
static PyObject *__pyx_n_s_encode;
static PyObject *__pyx_n_s_flags;
static PyObject *__pyx_n_s_i;
static PyObject *__pyx_n_s_items;
static PyObject *__pyx_n_s_iupac_table;
static PyObject *__pyx_n_s_length;
static PyObject *__pyx_n_s_locate;
static PyObject *__pyx_n_s_lower;
static PyObject *__pyx_n_s_m;
static PyObject *__pyx_n_s_main;
static PyObject *__pyx_n_s_matches;
static PyObject *__pyx_n_s_max_error_rate;
static PyObject *__pyx_n_s_min_overlap;
static PyObject *__pyx_kp_s_minimum_overlap_must_be_at_least;
static PyObject *__pyx_n_s_n;
static PyObject *__pyx_n_s_ord;
static PyObject *__pyx_n_s_q_ptr;
static PyObject *__pyx_n_s_query;
static PyObject *__pyx_n_s_query_bytes;
static PyObject *__pyx_n_s_r_ptr;
static PyObject *__pyx_n_s_range;
static PyObject *__pyx_n_s_ref;
static PyObject *__pyx_n_s_ref_bytes;
static PyObject *__pyx_n_s_reference;
static PyObject *__pyx_n_s_t;
static PyObject *__pyx_n_s_test;
static PyObject *__pyx_n_s_translate;
static PyObject *__pyx_n_s_trimxtreme__align;
static PyObject *__pyx_n_s_v;
static PyObject *__pyx_n_s_wildcard_query;
static PyObject *__pyx_n_s_wildcard_ref;
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static PyObject *__pyx_int_2;
static PyObject *__pyx_int_4;
static PyObject *__pyx_int_8;
static PyObject *__pyx_int_256;
static PyObject *__pyx_tuple__2;
static PyObject *__pyx_tuple__3;
static PyObject *__pyx_tuple__4;
static PyObject *__pyx_tuple__5;
static PyObject *__pyx_tuple__6;
static PyObject *__pyx_tuple__7;
static PyObject *__pyx_tuple__8;
static PyObject *__pyx_tuple__9;
static PyObject *__pyx_tuple__11;
static PyObject *__pyx_tuple__13;
static PyObject *__pyx_tuple__15;
static PyObject *__pyx_codeobj__10;
static PyObject *__pyx_codeobj__12;
static PyObject *__pyx_codeobj__14;
static PyObject *__pyx_codeobj__16;

/* "trimxtreme/_align.pyx":32
 * 
 * 
 * def _acgt_table():             # <<<<<<<<<<<<<<
 * 	"""
 * 	Return a translation table that maps A, C, G, T characters to the lower
 */

/* Python wrapper */
static PyObject *__pyx_pw_10trimxtreme_6_align_1_acgt_table(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10trimxtreme_6_align__acgt_table[] = "\n\tReturn a translation table that maps A, C, G, T characters to the lower\n\tfour bits of a byte. Other characters (including possibly IUPAC characters)\n\tare mapped to zero.\n\n\tLowercase versions are also translated, and U is treated the same as T.\n\t";
static PyMethodDef __pyx_mdef_10trimxtreme_6_align_1_acgt_table = {"_acgt_table", (PyCFunction)__pyx_pw_10trimxtreme_6_align_1_acgt_table, METH_NOARGS, __pyx_doc_10trimxtreme_6_align__acgt_table};
static PyObject *__pyx_pw_10trimxtreme_6_align_1_acgt_table(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_acgt_table (wrapper)", 0);
  __pyx_r = __pyx_pf_10trimxtreme_6_align__acgt_table(__pyx_self);

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

static PyObject *__pyx_pf_10trimxtreme_6_align__acgt_table(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_v_d = NULL;
  PyObject *__pyx_v_t = NULL;
  PyObject *__pyx_v_c = NULL;
  PyObject *__pyx_v_v = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_acgt_table", 0);

  /* "trimxtreme/_align.pyx":40
 * 	Lowercase versions are also translated, and U is treated the same as T.
 * 	"""
 * 	d = dict(A=1, C=2, G=4, T=8, U=8)             # <<<<<<<<<<<<<<
 * 	t = bytearray(b'\0') * 256
 * 	for c, v in d.items():
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_A, __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_C, __pyx_int_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_G, __pyx_int_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_T, __pyx_int_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_U, __pyx_int_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_d = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "trimxtreme/_align.pyx":41
 * 	"""
 * 	d = dict(A=1, C=2, G=4, T=8, U=8)
 * 	t = bytearray(b'\0') * 256             # <<<<<<<<<<<<<<
 * 	for c, v in d.items():
 * 		t[ord(c)] = v
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyByteArray_Type))), __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_int_256); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(PyByteArray_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytearray", Py_TYPE(__pyx_t_2)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_t = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "trimxtreme/_align.pyx":42
 * 	d = dict(A=1, C=2, G=4, T=8, U=8)
 * 	t = bytearray(b'\0') * 256
 * 	for c, v in d.items():             # <<<<<<<<<<<<<<
 * 		t[ord(c)] = v
 * 		t[ord(c.lower())] = v
 */
  __pyx_t_2 = __Pyx_PyDict_Items(__pyx_v_d); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
    __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      }
    } else {
      __pyx_t_2 = __pyx_t_4(__pyx_t_1);
      if (unlikely(!__pyx_t_2)) {
        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 = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
      PyObject* sequence = __pyx_t_2;
      #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 = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      #else
      __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      #endif
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L6_unpacking_done;
      __pyx_L5_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L6_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_c, __pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "trimxtreme/_align.pyx":43
 * 	t = bytearray(b'\0') * 256
 * 	for c, v in d.items():
 * 		t[ord(c)] = v             # <<<<<<<<<<<<<<
 * 		t[ord(c.lower())] = v
 * 	return bytes(t)
 */
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_c);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_c);
    __Pyx_GIVEREF(__pyx_v_c);
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ord, __pyx_t_2, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(PyObject_SetItem(__pyx_v_t, __pyx_t_6, __pyx_v_v) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "trimxtreme/_align.pyx":44
 * 	for c, v in d.items():
 * 		t[ord(c)] = v
 * 		t[ord(c.lower())] = v             # <<<<<<<<<<<<<<
 * 	return bytes(t)
 * 
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_c, __pyx_n_s_lower); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    if (__pyx_t_5) {
      __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __pyx_t_6 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_6);
    __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 = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ord, __pyx_t_2, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(PyObject_SetItem(__pyx_v_t, __pyx_t_6, __pyx_v_v) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "trimxtreme/_align.pyx":42
 * 	d = dict(A=1, C=2, G=4, T=8, U=8)
 * 	t = bytearray(b'\0') * 256
 * 	for c, v in d.items():             # <<<<<<<<<<<<<<
 * 		t[ord(c)] = v
 * 		t[ord(c.lower())] = v
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "trimxtreme/_align.pyx":45
 * 		t[ord(c)] = v
 * 		t[ord(c.lower())] = v
 * 	return bytes(t)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_t);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_t);
  __Pyx_GIVEREF(__pyx_v_t);
  __pyx_t_6 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyBytes_Type))), __pyx_t_1, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "trimxtreme/_align.pyx":32
 * 
 * 
 * def _acgt_table():             # <<<<<<<<<<<<<<
 * 	"""
 * 	Return a translation table that maps A, C, G, T characters to the lower
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("trimxtreme._align._acgt_table", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_d);
  __Pyx_XDECREF(__pyx_v_t);
  __Pyx_XDECREF(__pyx_v_c);
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trimxtreme/_align.pyx":48
 * 
 * 
 * def _iupac_table():             # <<<<<<<<<<<<<<
 * 	"""
 * 	Return a translation table for IUPAC characters.
 */

/* Python wrapper */
static PyObject *__pyx_pw_10trimxtreme_6_align_3_iupac_table(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10trimxtreme_6_align_2_iupac_table[] = "\n\tReturn a translation table for IUPAC characters.\n\n\tThe table maps ASCII-encoded IUPAC nucleotide characters to bytes in which\n\tthe four least significant bits are used to represent one nucleotide each.\n\n\tWhether two characters x and y match can then be checked with the\n\texpression \"x & y != 0\".\n\t";
static PyMethodDef __pyx_mdef_10trimxtreme_6_align_3_iupac_table = {"_iupac_table", (PyCFunction)__pyx_pw_10trimxtreme_6_align_3_iupac_table, METH_NOARGS, __pyx_doc_10trimxtreme_6_align_2_iupac_table};
static PyObject *__pyx_pw_10trimxtreme_6_align_3_iupac_table(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_iupac_table (wrapper)", 0);
  __pyx_r = __pyx_pf_10trimxtreme_6_align_2_iupac_table(__pyx_self);

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

static PyObject *__pyx_pf_10trimxtreme_6_align_2_iupac_table(CYTHON_UNUSED PyObject *__pyx_self) {
  long __pyx_v_A;
  long __pyx_v_C;
  long __pyx_v_G;
  long __pyx_v_T;
  PyObject *__pyx_v_d = NULL;
  PyObject *__pyx_v_t = NULL;
  PyObject *__pyx_v_c = NULL;
  PyObject *__pyx_v_v = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_iupac_table", 0);

  /* "trimxtreme/_align.pyx":58
 * 	expression "x & y != 0".
 * 	"""
 * 	A = 1             # <<<<<<<<<<<<<<
 * 	C = 2
 * 	G = 4
 */
  __pyx_v_A = 1;

  /* "trimxtreme/_align.pyx":59
 * 	"""
 * 	A = 1
 * 	C = 2             # <<<<<<<<<<<<<<
 * 	G = 4
 * 	T = 8
 */
  __pyx_v_C = 2;

  /* "trimxtreme/_align.pyx":60
 * 	A = 1
 * 	C = 2
 * 	G = 4             # <<<<<<<<<<<<<<
 * 	T = 8
 * 	d = dict(
 */
  __pyx_v_G = 4;

  /* "trimxtreme/_align.pyx":61
 * 	C = 2
 * 	G = 4
 * 	T = 8             # <<<<<<<<<<<<<<
 * 	d = dict(
 * 		X=0,
 */
  __pyx_v_T = 8;

  /* "trimxtreme/_align.pyx":62
 * 	G = 4
 * 	T = 8
 * 	d = dict(             # <<<<<<<<<<<<<<
 * 		X=0,
 * 		A=A,
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_X, __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "trimxtreme/_align.pyx":64
 * 	d = dict(
 * 		X=0,
 * 		A=A,             # <<<<<<<<<<<<<<
 * 		C=C,
 * 		G=G,
 */
  __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v_A); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_A, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "trimxtreme/_align.pyx":65
 * 		X=0,
 * 		A=A,
 * 		C=C,             # <<<<<<<<<<<<<<
 * 		G=G,
 * 		T=T,
 */
  __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v_C); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_C, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "trimxtreme/_align.pyx":66
 * 		A=A,
 * 		C=C,
 * 		G=G,             # <<<<<<<<<<<<<<
 * 		T=T,
 * 		U=T,
 */
  __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v_G); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_G, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "trimxtreme/_align.pyx":67
 * 		C=C,
 * 		G=G,
 * 		T=T,             # <<<<<<<<<<<<<<
 * 		U=T,
 * 		R=A|G,
 */
  __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v_T); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_T, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "trimxtreme/_align.pyx":68
 * 		G=G,
 * 		T=T,
 * 		U=T,             # <<<<<<<<<<<<<<
 * 		R=A|G,
 * 		Y=C|T,
 */
  __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v_T); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_U, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "trimxtreme/_align.pyx":69
 * 		T=T,
 * 		U=T,
 * 		R=A|G,             # <<<<<<<<<<<<<<
 * 		Y=C|T,
 * 		S=G|C,
 */
  __pyx_t_2 = __Pyx_PyInt_From_long((__pyx_v_A | __pyx_v_G)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_R, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "trimxtreme/_align.pyx":70
 * 		U=T,
 * 		R=A|G,
 * 		Y=C|T,             # <<<<<<<<<<<<<<
 * 		S=G|C,
 * 		W=A|T,
 */
  __pyx_t_2 = __Pyx_PyInt_From_long((__pyx_v_C | __pyx_v_T)); 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);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_Y, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "trimxtreme/_align.pyx":71
 * 		R=A|G,
 * 		Y=C|T,
 * 		S=G|C,             # <<<<<<<<<<<<<<
 * 		W=A|T,
 * 		K=G|T,
 */
  __pyx_t_2 = __Pyx_PyInt_From_long((__pyx_v_G | __pyx_v_C)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_S, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "trimxtreme/_align.pyx":72
 * 		Y=C|T,
 * 		S=G|C,
 * 		W=A|T,             # <<<<<<<<<<<<<<
 * 		K=G|T,
 * 		M=A|C,
 */
  __pyx_t_2 = __Pyx_PyInt_From_long((__pyx_v_A | __pyx_v_T)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_W, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "trimxtreme/_align.pyx":73
 * 		S=G|C,
 * 		W=A|T,
 * 		K=G|T,             # <<<<<<<<<<<<<<
 * 		M=A|C,
 * 		B=C|G|T,
 */
  __pyx_t_2 = __Pyx_PyInt_From_long((__pyx_v_G | __pyx_v_T)); 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);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_K, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "trimxtreme/_align.pyx":74
 * 		W=A|T,
 * 		K=G|T,
 * 		M=A|C,             # <<<<<<<<<<<<<<
 * 		B=C|G|T,
 * 		D=A|G|T,
 */
  __pyx_t_2 = __Pyx_PyInt_From_long((__pyx_v_A | __pyx_v_C)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_M, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "trimxtreme/_align.pyx":75
 * 		K=G|T,
 * 		M=A|C,
 * 		B=C|G|T,             # <<<<<<<<<<<<<<
 * 		D=A|G|T,
 * 		H=A|C|T,
 */
  __pyx_t_2 = __Pyx_PyInt_From_long(((__pyx_v_C | __pyx_v_G) | __pyx_v_T)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_B, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "trimxtreme/_align.pyx":76
 * 		M=A|C,
 * 		B=C|G|T,
 * 		D=A|G|T,             # <<<<<<<<<<<<<<
 * 		H=A|C|T,
 * 		V=A|C|G,
 */
  __pyx_t_2 = __Pyx_PyInt_From_long(((__pyx_v_A | __pyx_v_G) | __pyx_v_T)); 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);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_D, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "trimxtreme/_align.pyx":77
 * 		B=C|G|T,
 * 		D=A|G|T,
 * 		H=A|C|T,             # <<<<<<<<<<<<<<
 * 		V=A|C|G,
 * 		N=A|C|G|T
 */
  __pyx_t_2 = __Pyx_PyInt_From_long(((__pyx_v_A | __pyx_v_C) | __pyx_v_T)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_H, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "trimxtreme/_align.pyx":78
 * 		D=A|G|T,
 * 		H=A|C|T,
 * 		V=A|C|G,             # <<<<<<<<<<<<<<
 * 		N=A|C|G|T
 * 	)
 */
  __pyx_t_2 = __Pyx_PyInt_From_long(((__pyx_v_A | __pyx_v_C) | __pyx_v_G)); 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);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_V, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "trimxtreme/_align.pyx":79
 * 		H=A|C|T,
 * 		V=A|C|G,
 * 		N=A|C|G|T             # <<<<<<<<<<<<<<
 * 	)
 * 	t = bytearray(b'\0') * 256
 */
  __pyx_t_2 = __Pyx_PyInt_From_long((((__pyx_v_A | __pyx_v_C) | __pyx_v_G) | __pyx_v_T)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_N, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_d = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "trimxtreme/_align.pyx":81
 * 		N=A|C|G|T
 * 	)
 * 	t = bytearray(b'\0') * 256             # <<<<<<<<<<<<<<
 * 	for c, v in d.items():
 * 		t[ord(c)] = v
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyByteArray_Type))), __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_int_256); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(PyByteArray_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytearray", Py_TYPE(__pyx_t_2)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_t = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "trimxtreme/_align.pyx":82
 * 	)
 * 	t = bytearray(b'\0') * 256
 * 	for c, v in d.items():             # <<<<<<<<<<<<<<
 * 		t[ord(c)] = v
 * 		t[ord(c.lower())] = v
 */
  __pyx_t_2 = __Pyx_PyDict_Items(__pyx_v_d); 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);
  if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
    __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); 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_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      }
    } else {
      __pyx_t_2 = __pyx_t_4(__pyx_t_1);
      if (unlikely(!__pyx_t_2)) {
        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 = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
      PyObject* sequence = __pyx_t_2;
      #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 = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      #else
      __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      #endif
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L6_unpacking_done;
      __pyx_L5_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L6_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_c, __pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "trimxtreme/_align.pyx":83
 * 	t = bytearray(b'\0') * 256
 * 	for c, v in d.items():
 * 		t[ord(c)] = v             # <<<<<<<<<<<<<<
 * 		t[ord(c.lower())] = v
 * 	return bytes(t)
 */
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_c);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_c);
    __Pyx_GIVEREF(__pyx_v_c);
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ord, __pyx_t_2, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(PyObject_SetItem(__pyx_v_t, __pyx_t_6, __pyx_v_v) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "trimxtreme/_align.pyx":84
 * 	for c, v in d.items():
 * 		t[ord(c)] = v
 * 		t[ord(c.lower())] = v             # <<<<<<<<<<<<<<
 * 	return bytes(t)
 * 
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_c, __pyx_n_s_lower); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    if (__pyx_t_5) {
      __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __pyx_t_6 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_6);
    __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 = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ord, __pyx_t_2, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(PyObject_SetItem(__pyx_v_t, __pyx_t_6, __pyx_v_v) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "trimxtreme/_align.pyx":82
 * 	)
 * 	t = bytearray(b'\0') * 256
 * 	for c, v in d.items():             # <<<<<<<<<<<<<<
 * 		t[ord(c)] = v
 * 		t[ord(c.lower())] = v
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "trimxtreme/_align.pyx":85
 * 		t[ord(c)] = v
 * 		t[ord(c.lower())] = v
 * 	return bytes(t)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_t);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_t);
  __Pyx_GIVEREF(__pyx_v_t);
  __pyx_t_6 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyBytes_Type))), __pyx_t_1, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "trimxtreme/_align.pyx":48
 * 
 * 
 * def _iupac_table():             # <<<<<<<<<<<<<<
 * 	"""
 * 	Return a translation table for IUPAC characters.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("trimxtreme._align._iupac_table", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_d);
  __Pyx_XDECREF(__pyx_v_t);
  __Pyx_XDECREF(__pyx_v_c);
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trimxtreme/_align.pyx":163
 * 	cdef bytes _reference
 * 
 * 	def __cinit__(self, str reference, double max_error_rate, int flags=SEMIGLOBAL, int degenerate=0, int min_overlap=1):             # <<<<<<<<<<<<<<
 * 		self.max_error_rate = max_error_rate
 * 		self.flags = flags
 */

/* Python wrapper */
static int __pyx_pw_10trimxtreme_6_align_7Aligner_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_10trimxtreme_6_align_7Aligner_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_reference = 0;
  double __pyx_v_max_error_rate;
  int __pyx_v_flags;
  int __pyx_v_degenerate;
  int __pyx_v_min_overlap;
  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_reference,&__pyx_n_s_max_error_rate,&__pyx_n_s_flags,&__pyx_n_s_degenerate,&__pyx_n_s_min_overlap,0};
    PyObject* values[5] = {0,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  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        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_reference)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_max_error_rate)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_flags);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_degenerate);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_min_overlap);
          if (value) { values[4] = 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 = 163; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        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_reference = ((PyObject*)values[0]);
    __pyx_v_max_error_rate = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_max_error_rate == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    if (values[2]) {
      __pyx_v_flags = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_flags = ((int)15);
    }
    if (values[3]) {
      __pyx_v_degenerate = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_degenerate == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_degenerate = ((int)0);
    }
    if (values[4]) {
      __pyx_v_min_overlap = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_min_overlap == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_min_overlap = ((int)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("trimxtreme._align.Aligner.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_reference), (&PyString_Type), 1, "reference", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_10trimxtreme_6_align_7Aligner___cinit__(((struct __pyx_obj_10trimxtreme_6_align_Aligner *)__pyx_v_self), __pyx_v_reference, __pyx_v_max_error_rate, __pyx_v_flags, __pyx_v_degenerate, __pyx_v_min_overlap);

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

static int __pyx_pf_10trimxtreme_6_align_7Aligner___cinit__(struct __pyx_obj_10trimxtreme_6_align_Aligner *__pyx_v_self, PyObject *__pyx_v_reference, double __pyx_v_max_error_rate, int __pyx_v_flags, int __pyx_v_degenerate, int __pyx_v_min_overlap) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "trimxtreme/_align.pyx":164
 * 
 * 	def __cinit__(self, str reference, double max_error_rate, int flags=SEMIGLOBAL, int degenerate=0, int min_overlap=1):
 * 		self.max_error_rate = max_error_rate             # <<<<<<<<<<<<<<
 * 		self.flags = flags
 * 		self.wildcard_ref = degenerate & ALLOW_WILDCARD_SEQ1
 */
  __pyx_v_self->max_error_rate = __pyx_v_max_error_rate;

  /* "trimxtreme/_align.pyx":165
 * 	def __cinit__(self, str reference, double max_error_rate, int flags=SEMIGLOBAL, int degenerate=0, int min_overlap=1):
 * 		self.max_error_rate = max_error_rate
 * 		self.flags = flags             # <<<<<<<<<<<<<<
 * 		self.wildcard_ref = degenerate & ALLOW_WILDCARD_SEQ1
 * 		self.wildcard_query = degenerate & ALLOW_WILDCARD_SEQ2
 */
  __pyx_v_self->flags = __pyx_v_flags;

  /* "trimxtreme/_align.pyx":166
 * 		self.max_error_rate = max_error_rate
 * 		self.flags = flags
 * 		self.wildcard_ref = degenerate & ALLOW_WILDCARD_SEQ1             # <<<<<<<<<<<<<<
 * 		self.wildcard_query = degenerate & ALLOW_WILDCARD_SEQ2
 * 		self.reference = reference
 */
  __pyx_v_self->wildcard_ref = (__pyx_v_degenerate & 1);

  /* "trimxtreme/_align.pyx":167
 * 		self.flags = flags
 * 		self.wildcard_ref = degenerate & ALLOW_WILDCARD_SEQ1
 * 		self.wildcard_query = degenerate & ALLOW_WILDCARD_SEQ2             # <<<<<<<<<<<<<<
 * 		self.reference = reference
 * 		if min_overlap < 1:
 */
  __pyx_v_self->wildcard_query = (__pyx_v_degenerate & 2);

  /* "trimxtreme/_align.pyx":168
 * 		self.wildcard_ref = degenerate & ALLOW_WILDCARD_SEQ1
 * 		self.wildcard_query = degenerate & ALLOW_WILDCARD_SEQ2
 * 		self.reference = reference             # <<<<<<<<<<<<<<
 * 		if min_overlap < 1:
 * 			raise ValueError("minimum overlap must be at least 1")
 */
  if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reference, __pyx_v_reference) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "trimxtreme/_align.pyx":169
 * 		self.wildcard_query = degenerate & ALLOW_WILDCARD_SEQ2
 * 		self.reference = reference
 * 		if min_overlap < 1:             # <<<<<<<<<<<<<<
 * 			raise ValueError("minimum overlap must be at least 1")
 * 		self.min_overlap = min_overlap
 */
  __pyx_t_1 = ((__pyx_v_min_overlap < 1) != 0);
  if (__pyx_t_1) {

    /* "trimxtreme/_align.pyx":170
 * 		self.reference = reference
 * 		if min_overlap < 1:
 * 			raise ValueError("minimum overlap must be at least 1")             # <<<<<<<<<<<<<<
 * 		self.min_overlap = min_overlap
 * 
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "trimxtreme/_align.pyx":171
 * 		if min_overlap < 1:
 * 			raise ValueError("minimum overlap must be at least 1")
 * 		self.min_overlap = min_overlap             # <<<<<<<<<<<<<<
 * 
 * 	property reference:
 */
  __pyx_v_self->min_overlap = __pyx_v_min_overlap;

  /* "trimxtreme/_align.pyx":163
 * 	cdef bytes _reference
 * 
 * 	def __cinit__(self, str reference, double max_error_rate, int flags=SEMIGLOBAL, int degenerate=0, int min_overlap=1):             # <<<<<<<<<<<<<<
 * 		self.max_error_rate = max_error_rate
 * 		self.flags = flags
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("trimxtreme._align.Aligner.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trimxtreme/_align.pyx":174
 * 
 * 	property reference:
 * 		def __get__(self):             # <<<<<<<<<<<<<<
 * 			return self._reference
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_10trimxtreme_6_align_7Aligner_9reference_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_10trimxtreme_6_align_7Aligner_9reference_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10trimxtreme_6_align_7Aligner_9reference___get__(((struct __pyx_obj_10trimxtreme_6_align_Aligner *)__pyx_v_self));

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

static PyObject *__pyx_pf_10trimxtreme_6_align_7Aligner_9reference___get__(struct __pyx_obj_10trimxtreme_6_align_Aligner *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "trimxtreme/_align.pyx":175
 * 	property reference:
 * 		def __get__(self):
 * 			return self._reference             # <<<<<<<<<<<<<<
 * 
 * 		def __set__(self, str reference):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_reference);
  __pyx_r = __pyx_v_self->_reference;
  goto __pyx_L0;

  /* "trimxtreme/_align.pyx":174
 * 
 * 	property reference:
 * 		def __get__(self):             # <<<<<<<<<<<<<<
 * 			return self._reference
 * 
 */

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

/* "trimxtreme/_align.pyx":177
 * 			return self._reference
 * 
 * 		def __set__(self, str reference):             # <<<<<<<<<<<<<<
 * 			mem = <_Entry*> PyMem_Realloc(self.column, (len(reference) + 1) * sizeof(_Entry))
 * 			if not mem:
 */

/* Python wrapper */
static int __pyx_pw_10trimxtreme_6_align_7Aligner_9reference_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_reference); /*proto*/
static int __pyx_pw_10trimxtreme_6_align_7Aligner_9reference_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_reference) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_reference), (&PyString_Type), 1, "reference", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_10trimxtreme_6_align_7Aligner_9reference_2__set__(((struct __pyx_obj_10trimxtreme_6_align_Aligner *)__pyx_v_self), ((PyObject*)__pyx_v_reference));

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

static int __pyx_pf_10trimxtreme_6_align_7Aligner_9reference_2__set__(struct __pyx_obj_10trimxtreme_6_align_Aligner *__pyx_v_self, PyObject *__pyx_v_reference) {
  __pyx_t_10trimxtreme_6_align__Entry *__pyx_v_mem;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "trimxtreme/_align.pyx":178
 * 
 * 		def __set__(self, str reference):
 * 			mem = <_Entry*> PyMem_Realloc(self.column, (len(reference) + 1) * sizeof(_Entry))             # <<<<<<<<<<<<<<
 * 			if not mem:
 * 				raise MemoryError()
 */
  __pyx_t_1 = PyObject_Length(__pyx_v_reference); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_mem = ((__pyx_t_10trimxtreme_6_align__Entry *)PyMem_Realloc(__pyx_v_self->column, ((__pyx_t_1 + 1) * (sizeof(__pyx_t_10trimxtreme_6_align__Entry)))));

  /* "trimxtreme/_align.pyx":179
 * 		def __set__(self, str reference):
 * 			mem = <_Entry*> PyMem_Realloc(self.column, (len(reference) + 1) * sizeof(_Entry))
 * 			if not mem:             # <<<<<<<<<<<<<<
 * 				raise MemoryError()
 * 			self.column = mem
 */
  __pyx_t_2 = ((!(__pyx_v_mem != 0)) != 0);
  if (__pyx_t_2) {

    /* "trimxtreme/_align.pyx":180
 * 			mem = <_Entry*> PyMem_Realloc(self.column, (len(reference) + 1) * sizeof(_Entry))
 * 			if not mem:
 * 				raise MemoryError()             # <<<<<<<<<<<<<<
 * 			self.column = mem
 * 			self._reference = reference.encode('ascii')
 */
    PyErr_NoMemory(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "trimxtreme/_align.pyx":181
 * 			if not mem:
 * 				raise MemoryError()
 * 			self.column = mem             # <<<<<<<<<<<<<<
 * 			self._reference = reference.encode('ascii')
 * 			self.m = len(reference)
 */
  __pyx_v_self->column = __pyx_v_mem;

  /* "trimxtreme/_align.pyx":182
 * 				raise MemoryError()
 * 			self.column = mem
 * 			self._reference = reference.encode('ascii')             # <<<<<<<<<<<<<<
 * 			self.m = len(reference)
 * 			if self.wildcard_ref:
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_reference, __pyx_n_s_encode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_GOTREF(__pyx_v_self->_reference);
  __Pyx_DECREF(__pyx_v_self->_reference);
  __pyx_v_self->_reference = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "trimxtreme/_align.pyx":183
 * 			self.column = mem
 * 			self._reference = reference.encode('ascii')
 * 			self.m = len(reference)             # <<<<<<<<<<<<<<
 * 			if self.wildcard_ref:
 * 				self._reference = self._reference.translate(IUPAC_TABLE)
 */
  __pyx_t_1 = PyObject_Length(__pyx_v_reference); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_self->m = __pyx_t_1;

  /* "trimxtreme/_align.pyx":184
 * 			self._reference = reference.encode('ascii')
 * 			self.m = len(reference)
 * 			if self.wildcard_ref:             # <<<<<<<<<<<<<<
 * 				self._reference = self._reference.translate(IUPAC_TABLE)
 * 			elif self.wildcard_query:
 */
  __pyx_t_2 = (__pyx_v_self->wildcard_ref != 0);
  if (__pyx_t_2) {

    /* "trimxtreme/_align.pyx":185
 * 			self.m = len(reference)
 * 			if self.wildcard_ref:
 * 				self._reference = self._reference.translate(IUPAC_TABLE)             # <<<<<<<<<<<<<<
 * 			elif self.wildcard_query:
 * 				self._reference = self._reference.translate(ACGT_TABLE)
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_reference, __pyx_n_s_translate); 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_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (!__pyx_t_5) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_10trimxtreme_6_align_IUPAC_TABLE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
      __Pyx_INCREF(__pyx_v_10trimxtreme_6_align_IUPAC_TABLE);
      PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_10trimxtreme_6_align_IUPAC_TABLE);
      __Pyx_GIVEREF(__pyx_v_10trimxtreme_6_align_IUPAC_TABLE);
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GIVEREF(__pyx_t_4);
    __Pyx_GOTREF(__pyx_v_self->_reference);
    __Pyx_DECREF(__pyx_v_self->_reference);
    __pyx_v_self->_reference = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;
    goto __pyx_L4;
  }

  /* "trimxtreme/_align.pyx":186
 * 			if self.wildcard_ref:
 * 				self._reference = self._reference.translate(IUPAC_TABLE)
 * 			elif self.wildcard_query:             # <<<<<<<<<<<<<<
 * 				self._reference = self._reference.translate(ACGT_TABLE)
 * 
 */
  __pyx_t_2 = (__pyx_v_self->wildcard_query != 0);
  if (__pyx_t_2) {

    /* "trimxtreme/_align.pyx":187
 * 				self._reference = self._reference.translate(IUPAC_TABLE)
 * 			elif self.wildcard_query:
 * 				self._reference = self._reference.translate(ACGT_TABLE)             # <<<<<<<<<<<<<<
 * 
 * 	def locate(self, str query):
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_reference, __pyx_n_s_translate); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (!__pyx_t_6) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_10trimxtreme_6_align_ACGT_TABLE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
      __Pyx_INCREF(__pyx_v_10trimxtreme_6_align_ACGT_TABLE);
      PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_10trimxtreme_6_align_ACGT_TABLE);
      __Pyx_GIVEREF(__pyx_v_10trimxtreme_6_align_ACGT_TABLE);
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GIVEREF(__pyx_t_4);
    __Pyx_GOTREF(__pyx_v_self->_reference);
    __Pyx_DECREF(__pyx_v_self->_reference);
    __pyx_v_self->_reference = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "trimxtreme/_align.pyx":177
 * 			return self._reference
 * 
 * 		def __set__(self, str reference):             # <<<<<<<<<<<<<<
 * 			mem = <_Entry*> PyMem_Realloc(self.column, (len(reference) + 1) * sizeof(_Entry))
 * 			if not mem:
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("trimxtreme._align.Aligner.reference.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trimxtreme/_align.pyx":189
 * 				self._reference = self._reference.translate(ACGT_TABLE)
 * 
 * 	def locate(self, str query):             # <<<<<<<<<<<<<<
 * 		"""
 * 		locate(query) -> (refstart, refstop, querystart, querystop, matches, errors)
 */

/* Python wrapper */
static PyObject *__pyx_pw_10trimxtreme_6_align_7Aligner_3locate(PyObject *__pyx_v_self, PyObject *__pyx_v_query); /*proto*/
static char __pyx_doc_10trimxtreme_6_align_7Aligner_2locate[] = "\n\t\tlocate(query) -> (refstart, refstop, querystart, querystop, matches, errors)\n\n\t\tFind the query within the reference associated with this aligner. The\n\t\tintervals (querystart, querystop) and (refstart, refstop) give the\n\t\tlocation of the match.\n\n\t\tThat is, the substrings query[querystart:querystop] and\n\t\tself.reference[refstart:refstop] were found to align best to each other,\n\t\twith the given number of matches and the given number of errors.\n\n\t\tThe alignment itself is not returned.\n\t\t";
static PyObject *__pyx_pw_10trimxtreme_6_align_7Aligner_3locate(PyObject *__pyx_v_self, PyObject *__pyx_v_query) {
  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("locate (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_query), (&PyString_Type), 1, "query", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_10trimxtreme_6_align_7Aligner_2locate(((struct __pyx_obj_10trimxtreme_6_align_Aligner *)__pyx_v_self), ((PyObject*)__pyx_v_query));

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

static PyObject *__pyx_pf_10trimxtreme_6_align_7Aligner_2locate(struct __pyx_obj_10trimxtreme_6_align_Aligner *__pyx_v_self, PyObject *__pyx_v_query) {
  char *__pyx_v_s1;
  PyObject *__pyx_v_query_bytes = 0;
  char *__pyx_v_s2;
  int __pyx_v_m;
  int __pyx_v_n;
  __pyx_t_10trimxtreme_6_align__Entry *__pyx_v_column;
  double __pyx_v_max_error_rate;
  int __pyx_v_start_in_ref;
  int __pyx_v_start_in_query;
  int __pyx_v_stop_in_ref;
  int __pyx_v_stop_in_query;
  int __pyx_v_compare_ascii;
  int __pyx_v_i;
  int __pyx_v_j;
  int __pyx_v_k;
  int __pyx_v_max_n;
  int __pyx_v_min_n;
  __pyx_t_10trimxtreme_6_align__Match __pyx_v_best;
  int __pyx_v_last;
  int __pyx_v_cost_diag;
  int __pyx_v_cost_deletion;
  int __pyx_v_cost_insertion;
  int __pyx_v_origin;
  int __pyx_v_cost;
  int __pyx_v_matches;
  int __pyx_v_length;
  int __pyx_v_characters_equal;
  __pyx_t_10trimxtreme_6_align__Entry __pyx_v_tmp_entry;
  long __pyx_v_first_i;
  int __pyx_v_start1;
  int __pyx_v_start2;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  char *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  __pyx_t_10trimxtreme_6_align__Entry *__pyx_t_6;
  double __pyx_t_7;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  long __pyx_t_14;
  long __pyx_t_15;
  int __pyx_t_16;
  long __pyx_t_17;
  PyObject *__pyx_t_18 = NULL;
  PyObject *__pyx_t_19 = NULL;
  PyObject *__pyx_t_20 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("locate", 0);

  /* "trimxtreme/_align.pyx":203
 * 		The alignment itself is not returned.
 * 		"""
 * 		cdef char* s1 = self._reference             # <<<<<<<<<<<<<<
 * 		cdef bytes query_bytes = query.encode('ascii')
 * 		cdef char* s2 = query_bytes
 */
  __pyx_t_1 = __Pyx_PyObject_AsString(__pyx_v_self->_reference); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_s1 = __pyx_t_1;

  /* "trimxtreme/_align.pyx":204
 * 		"""
 * 		cdef char* s1 = self._reference
 * 		cdef bytes query_bytes = query.encode('ascii')             # <<<<<<<<<<<<<<
 * 		cdef char* s2 = query_bytes
 * 		cdef int m = self.m
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_query, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_query_bytes = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "trimxtreme/_align.pyx":205
 * 		cdef char* s1 = self._reference
 * 		cdef bytes query_bytes = query.encode('ascii')
 * 		cdef char* s2 = query_bytes             # <<<<<<<<<<<<<<
 * 		cdef int m = self.m
 * 		cdef int n = len(query)
 */
  __pyx_t_1 = __Pyx_PyObject_AsString(__pyx_v_query_bytes); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_s2 = __pyx_t_1;

  /* "trimxtreme/_align.pyx":206
 * 		cdef bytes query_bytes = query.encode('ascii')
 * 		cdef char* s2 = query_bytes
 * 		cdef int m = self.m             # <<<<<<<<<<<<<<
 * 		cdef int n = len(query)
 * 		cdef _Entry* column = self.column
 */
  __pyx_t_4 = __pyx_v_self->m;
  __pyx_v_m = __pyx_t_4;

  /* "trimxtreme/_align.pyx":207
 * 		cdef char* s2 = query_bytes
 * 		cdef int m = self.m
 * 		cdef int n = len(query)             # <<<<<<<<<<<<<<
 * 		cdef _Entry* column = self.column
 * 		cdef double max_error_rate = self.max_error_rate
 */
  __pyx_t_5 = PyObject_Length(__pyx_v_query); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_n = __pyx_t_5;

  /* "trimxtreme/_align.pyx":208
 * 		cdef int m = self.m
 * 		cdef int n = len(query)
 * 		cdef _Entry* column = self.column             # <<<<<<<<<<<<<<
 * 		cdef double max_error_rate = self.max_error_rate
 * 		cdef bint start_in_ref = self.flags & START_WITHIN_SEQ1
 */
  __pyx_t_6 = __pyx_v_self->column;
  __pyx_v_column = __pyx_t_6;

  /* "trimxtreme/_align.pyx":209
 * 		cdef int n = len(query)
 * 		cdef _Entry* column = self.column
 * 		cdef double max_error_rate = self.max_error_rate             # <<<<<<<<<<<<<<
 * 		cdef bint start_in_ref = self.flags & START_WITHIN_SEQ1
 * 		cdef bint start_in_query = self.flags & START_WITHIN_SEQ2
 */
  __pyx_t_7 = __pyx_v_self->max_error_rate;
  __pyx_v_max_error_rate = __pyx_t_7;

  /* "trimxtreme/_align.pyx":210
 * 		cdef _Entry* column = self.column
 * 		cdef double max_error_rate = self.max_error_rate
 * 		cdef bint start_in_ref = self.flags & START_WITHIN_SEQ1             # <<<<<<<<<<<<<<
 * 		cdef bint start_in_query = self.flags & START_WITHIN_SEQ2
 * 		cdef bint stop_in_ref = self.flags & STOP_WITHIN_SEQ1
 */
  __pyx_v_start_in_ref = (__pyx_v_self->flags & 1);

  /* "trimxtreme/_align.pyx":211
 * 		cdef double max_error_rate = self.max_error_rate
 * 		cdef bint start_in_ref = self.flags & START_WITHIN_SEQ1
 * 		cdef bint start_in_query = self.flags & START_WITHIN_SEQ2             # <<<<<<<<<<<<<<
 * 		cdef bint stop_in_ref = self.flags & STOP_WITHIN_SEQ1
 * 		cdef bint stop_in_query = self.flags & STOP_WITHIN_SEQ2
 */
  __pyx_v_start_in_query = (__pyx_v_self->flags & 2);

  /* "trimxtreme/_align.pyx":212
 * 		cdef bint start_in_ref = self.flags & START_WITHIN_SEQ1
 * 		cdef bint start_in_query = self.flags & START_WITHIN_SEQ2
 * 		cdef bint stop_in_ref = self.flags & STOP_WITHIN_SEQ1             # <<<<<<<<<<<<<<
 * 		cdef bint stop_in_query = self.flags & STOP_WITHIN_SEQ2
 * 
 */
  __pyx_v_stop_in_ref = (__pyx_v_self->flags & 4);

  /* "trimxtreme/_align.pyx":213
 * 		cdef bint start_in_query = self.flags & START_WITHIN_SEQ2
 * 		cdef bint stop_in_ref = self.flags & STOP_WITHIN_SEQ1
 * 		cdef bint stop_in_query = self.flags & STOP_WITHIN_SEQ2             # <<<<<<<<<<<<<<
 * 
 * 		if self.wildcard_query:
 */
  __pyx_v_stop_in_query = (__pyx_v_self->flags & 8);

  /* "trimxtreme/_align.pyx":215
 * 		cdef bint stop_in_query = self.flags & STOP_WITHIN_SEQ2
 * 
 * 		if self.wildcard_query:             # <<<<<<<<<<<<<<
 * 			query_bytes = query_bytes.translate(IUPAC_TABLE)
 * 			s2 = query_bytes
 */
  __pyx_t_8 = (__pyx_v_self->wildcard_query != 0);
  if (__pyx_t_8) {

    /* "trimxtreme/_align.pyx":216
 * 
 * 		if self.wildcard_query:
 * 			query_bytes = query_bytes.translate(IUPAC_TABLE)             # <<<<<<<<<<<<<<
 * 			s2 = query_bytes
 * 		elif self.wildcard_ref:
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_query_bytes, __pyx_n_s_translate); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_9 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    if (!__pyx_t_9) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_10trimxtreme_6_align_IUPAC_TABLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
    } else {
      __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __Pyx_GIVEREF(__pyx_t_9); __pyx_t_9 = NULL;
      __Pyx_INCREF(__pyx_v_10trimxtreme_6_align_IUPAC_TABLE);
      PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_v_10trimxtreme_6_align_IUPAC_TABLE);
      __Pyx_GIVEREF(__pyx_v_10trimxtreme_6_align_IUPAC_TABLE);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_10, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF_SET(__pyx_v_query_bytes, ((PyObject*)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "trimxtreme/_align.pyx":217
 * 		if self.wildcard_query:
 * 			query_bytes = query_bytes.translate(IUPAC_TABLE)
 * 			s2 = query_bytes             # <<<<<<<<<<<<<<
 * 		elif self.wildcard_ref:
 * 			query_bytes = query_bytes.translate(ACGT_TABLE)
 */
    __pyx_t_1 = __Pyx_PyObject_AsString(__pyx_v_query_bytes); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_s2 = __pyx_t_1;
    goto __pyx_L3;
  }

  /* "trimxtreme/_align.pyx":218
 * 			query_bytes = query_bytes.translate(IUPAC_TABLE)
 * 			s2 = query_bytes
 * 		elif self.wildcard_ref:             # <<<<<<<<<<<<<<
 * 			query_bytes = query_bytes.translate(ACGT_TABLE)
 * 			s2 = query_bytes
 */
  __pyx_t_8 = (__pyx_v_self->wildcard_ref != 0);
  if (__pyx_t_8) {

    /* "trimxtreme/_align.pyx":219
 * 			s2 = query_bytes
 * 		elif self.wildcard_ref:
 * 			query_bytes = query_bytes.translate(ACGT_TABLE)             # <<<<<<<<<<<<<<
 * 			s2 = query_bytes
 * 		cdef bint compare_ascii = not (self.wildcard_query or self.wildcard_ref)
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_query_bytes, __pyx_n_s_translate); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_10 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    if (!__pyx_t_10) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_10trimxtreme_6_align_ACGT_TABLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
    } else {
      __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_10); __Pyx_GIVEREF(__pyx_t_10); __pyx_t_10 = NULL;
      __Pyx_INCREF(__pyx_v_10trimxtreme_6_align_ACGT_TABLE);
      PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_v_10trimxtreme_6_align_ACGT_TABLE);
      __Pyx_GIVEREF(__pyx_v_10trimxtreme_6_align_ACGT_TABLE);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF_SET(__pyx_v_query_bytes, ((PyObject*)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "trimxtreme/_align.pyx":220
 * 		elif self.wildcard_ref:
 * 			query_bytes = query_bytes.translate(ACGT_TABLE)
 * 			s2 = query_bytes             # <<<<<<<<<<<<<<
 * 		cdef bint compare_ascii = not (self.wildcard_query or self.wildcard_ref)
 * 		"""
 */
    __pyx_t_1 = __Pyx_PyObject_AsString(__pyx_v_query_bytes); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_s2 = __pyx_t_1;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "trimxtreme/_align.pyx":221
 * 			query_bytes = query_bytes.translate(ACGT_TABLE)
 * 			s2 = query_bytes
 * 		cdef bint compare_ascii = not (self.wildcard_query or self.wildcard_ref)             # <<<<<<<<<<<<<<
 * 		"""
 * 		DP Matrix:
 */
  __pyx_t_11 = (__pyx_v_self->wildcard_query != 0);
  if (!__pyx_t_11) {
  } else {
    __pyx_t_8 = __pyx_t_11;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_11 = (__pyx_v_self->wildcard_ref != 0);
  __pyx_t_8 = __pyx_t_11;
  __pyx_L4_bool_binop_done:;
  __pyx_v_compare_ascii = (!__pyx_t_8);

  /* "trimxtreme/_align.pyx":235
 * 
 * 		# maximum no. of errors
 * 		cdef int k = <int> (max_error_rate * m)             # <<<<<<<<<<<<<<
 * 
 * 		# Determine largest and smallest column we need to compute
 */
  __pyx_v_k = ((int)(__pyx_v_max_error_rate * __pyx_v_m));

  /* "trimxtreme/_align.pyx":238
 * 
 * 		# Determine largest and smallest column we need to compute
 * 		cdef int max_n = n             # <<<<<<<<<<<<<<
 * 		cdef int min_n = 0
 * 		if not start_in_query:
 */
  __pyx_v_max_n = __pyx_v_n;

  /* "trimxtreme/_align.pyx":239
 * 		# Determine largest and smallest column we need to compute
 * 		cdef int max_n = n
 * 		cdef int min_n = 0             # <<<<<<<<<<<<<<
 * 		if not start_in_query:
 * 			# costs can only get worse after column m
 */
  __pyx_v_min_n = 0;

  /* "trimxtreme/_align.pyx":240
 * 		cdef int max_n = n
 * 		cdef int min_n = 0
 * 		if not start_in_query:             # <<<<<<<<<<<<<<
 * 			# costs can only get worse after column m
 * 			max_n = min(n, m + k)
 */
  __pyx_t_8 = ((!(__pyx_v_start_in_query != 0)) != 0);
  if (__pyx_t_8) {

    /* "trimxtreme/_align.pyx":242
 * 		if not start_in_query:
 * 			# costs can only get worse after column m
 * 			max_n = min(n, m + k)             # <<<<<<<<<<<<<<
 * 		if not stop_in_query:
 * 			min_n = max(0, n - m - k)
 */
    __pyx_t_4 = (__pyx_v_m + __pyx_v_k);
    __pyx_t_12 = __pyx_v_n;
    if (((__pyx_t_4 < __pyx_t_12) != 0)) {
      __pyx_t_13 = __pyx_t_4;
    } else {
      __pyx_t_13 = __pyx_t_12;
    }
    __pyx_v_max_n = __pyx_t_13;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "trimxtreme/_align.pyx":243
 * 			# costs can only get worse after column m
 * 			max_n = min(n, m + k)
 * 		if not stop_in_query:             # <<<<<<<<<<<<<<
 * 			min_n = max(0, n - m - k)
 * 
 */
  __pyx_t_8 = ((!(__pyx_v_stop_in_query != 0)) != 0);
  if (__pyx_t_8) {

    /* "trimxtreme/_align.pyx":244
 * 			max_n = min(n, m + k)
 * 		if not stop_in_query:
 * 			min_n = max(0, n - m - k)             # <<<<<<<<<<<<<<
 * 
 * 		# Fill column min_n.
 */
    __pyx_t_13 = ((__pyx_v_n - __pyx_v_m) - __pyx_v_k);
    __pyx_t_14 = 0;
    if (((__pyx_t_13 > __pyx_t_14) != 0)) {
      __pyx_t_15 = __pyx_t_13;
    } else {
      __pyx_t_15 = __pyx_t_14;
    }
    __pyx_v_min_n = __pyx_t_15;
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "trimxtreme/_align.pyx":256
 * 		# TODO (later)
 * 		# fill out columns only until 'last'
 * 		if not start_in_ref and not start_in_query:             # <<<<<<<<<<<<<<
 * 			for i in range(0, m + 1):
 * 				column[i].matches = 0
 */
  __pyx_t_11 = ((!(__pyx_v_start_in_ref != 0)) != 0);
  if (__pyx_t_11) {
  } else {
    __pyx_t_8 = __pyx_t_11;
    goto __pyx_L9_bool_binop_done;
  }
  __pyx_t_11 = ((!(__pyx_v_start_in_query != 0)) != 0);
  __pyx_t_8 = __pyx_t_11;
  __pyx_L9_bool_binop_done:;
  if (__pyx_t_8) {

    /* "trimxtreme/_align.pyx":257
 * 		# fill out columns only until 'last'
 * 		if not start_in_ref and not start_in_query:
 * 			for i in range(0, m + 1):             # <<<<<<<<<<<<<<
 * 				column[i].matches = 0
 * 				column[i].cost = max(i, min_n)
 */
    __pyx_t_15 = (__pyx_v_m + 1);
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_15; __pyx_t_13+=1) {
      __pyx_v_i = __pyx_t_13;

      /* "trimxtreme/_align.pyx":258
 * 		if not start_in_ref and not start_in_query:
 * 			for i in range(0, m + 1):
 * 				column[i].matches = 0             # <<<<<<<<<<<<<<
 * 				column[i].cost = max(i, min_n)
 * 				column[i].origin = 0
 */
      (__pyx_v_column[__pyx_v_i]).matches = 0;

      /* "trimxtreme/_align.pyx":259
 * 			for i in range(0, m + 1):
 * 				column[i].matches = 0
 * 				column[i].cost = max(i, min_n)             # <<<<<<<<<<<<<<
 * 				column[i].origin = 0
 * 		elif start_in_ref and not start_in_query:
 */
      __pyx_t_4 = __pyx_v_min_n;
      __pyx_t_12 = __pyx_v_i;
      if (((__pyx_t_4 > __pyx_t_12) != 0)) {
        __pyx_t_16 = __pyx_t_4;
      } else {
        __pyx_t_16 = __pyx_t_12;
      }
      (__pyx_v_column[__pyx_v_i]).cost = __pyx_t_16;

      /* "trimxtreme/_align.pyx":260
 * 				column[i].matches = 0
 * 				column[i].cost = max(i, min_n)
 * 				column[i].origin = 0             # <<<<<<<<<<<<<<
 * 		elif start_in_ref and not start_in_query:
 * 			for i in range(0, m + 1):
 */
      (__pyx_v_column[__pyx_v_i]).origin = 0;
    }
    goto __pyx_L8;
  }

  /* "trimxtreme/_align.pyx":261
 * 				column[i].cost = max(i, min_n)
 * 				column[i].origin = 0
 * 		elif start_in_ref and not start_in_query:             # <<<<<<<<<<<<<<
 * 			for i in range(0, m + 1):
 * 				column[i].matches = 0
 */
  __pyx_t_11 = (__pyx_v_start_in_ref != 0);
  if (__pyx_t_11) {
  } else {
    __pyx_t_8 = __pyx_t_11;
    goto __pyx_L13_bool_binop_done;
  }
  __pyx_t_11 = ((!(__pyx_v_start_in_query != 0)) != 0);
  __pyx_t_8 = __pyx_t_11;
  __pyx_L13_bool_binop_done:;
  if (__pyx_t_8) {

    /* "trimxtreme/_align.pyx":262
 * 				column[i].origin = 0
 * 		elif start_in_ref and not start_in_query:
 * 			for i in range(0, m + 1):             # <<<<<<<<<<<<<<
 * 				column[i].matches = 0
 * 				column[i].cost = min_n
 */
    __pyx_t_15 = (__pyx_v_m + 1);
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_15; __pyx_t_13+=1) {
      __pyx_v_i = __pyx_t_13;

      /* "trimxtreme/_align.pyx":263
 * 		elif start_in_ref and not start_in_query:
 * 			for i in range(0, m + 1):
 * 				column[i].matches = 0             # <<<<<<<<<<<<<<
 * 				column[i].cost = min_n
 * 				column[i].origin = min(0, min_n - i)
 */
      (__pyx_v_column[__pyx_v_i]).matches = 0;

      /* "trimxtreme/_align.pyx":264
 * 			for i in range(0, m + 1):
 * 				column[i].matches = 0
 * 				column[i].cost = min_n             # <<<<<<<<<<<<<<
 * 				column[i].origin = min(0, min_n - i)
 * 		elif not start_in_ref and start_in_query:
 */
      (__pyx_v_column[__pyx_v_i]).cost = __pyx_v_min_n;

      /* "trimxtreme/_align.pyx":265
 * 				column[i].matches = 0
 * 				column[i].cost = min_n
 * 				column[i].origin = min(0, min_n - i)             # <<<<<<<<<<<<<<
 * 		elif not start_in_ref and start_in_query:
 * 			for i in range(0, m + 1):
 */
      __pyx_t_16 = (__pyx_v_min_n - __pyx_v_i);
      __pyx_t_14 = 0;
      if (((__pyx_t_16 < __pyx_t_14) != 0)) {
        __pyx_t_17 = __pyx_t_16;
      } else {
        __pyx_t_17 = __pyx_t_14;
      }
      (__pyx_v_column[__pyx_v_i]).origin = __pyx_t_17;
    }
    goto __pyx_L8;
  }

  /* "trimxtreme/_align.pyx":266
 * 				column[i].cost = min_n
 * 				column[i].origin = min(0, min_n - i)
 * 		elif not start_in_ref and start_in_query:             # <<<<<<<<<<<<<<
 * 			for i in range(0, m + 1):
 * 				column[i].matches = 0
 */
  __pyx_t_11 = ((!(__pyx_v_start_in_ref != 0)) != 0);
  if (__pyx_t_11) {
  } else {
    __pyx_t_8 = __pyx_t_11;
    goto __pyx_L17_bool_binop_done;
  }
  __pyx_t_11 = (__pyx_v_start_in_query != 0);
  __pyx_t_8 = __pyx_t_11;
  __pyx_L17_bool_binop_done:;
  if (__pyx_t_8) {

    /* "trimxtreme/_align.pyx":267
 * 				column[i].origin = min(0, min_n - i)
 * 		elif not start_in_ref and start_in_query:
 * 			for i in range(0, m + 1):             # <<<<<<<<<<<<<<
 * 				column[i].matches = 0
 * 				column[i].cost = i
 */
    __pyx_t_15 = (__pyx_v_m + 1);
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_15; __pyx_t_13+=1) {
      __pyx_v_i = __pyx_t_13;

      /* "trimxtreme/_align.pyx":268
 * 		elif not start_in_ref and start_in_query:
 * 			for i in range(0, m + 1):
 * 				column[i].matches = 0             # <<<<<<<<<<<<<<
 * 				column[i].cost = i
 * 				column[i].origin = max(0, min_n - i)
 */
      (__pyx_v_column[__pyx_v_i]).matches = 0;

      /* "trimxtreme/_align.pyx":269
 * 			for i in range(0, m + 1):
 * 				column[i].matches = 0
 * 				column[i].cost = i             # <<<<<<<<<<<<<<
 * 				column[i].origin = max(0, min_n - i)
 * 		else:
 */
      (__pyx_v_column[__pyx_v_i]).cost = __pyx_v_i;

      /* "trimxtreme/_align.pyx":270
 * 				column[i].matches = 0
 * 				column[i].cost = i
 * 				column[i].origin = max(0, min_n - i)             # <<<<<<<<<<<<<<
 * 		else:
 * 			for i in range(0, m + 1):
 */
      __pyx_t_16 = (__pyx_v_min_n - __pyx_v_i);
      __pyx_t_17 = 0;
      if (((__pyx_t_16 > __pyx_t_17) != 0)) {
        __pyx_t_14 = __pyx_t_16;
      } else {
        __pyx_t_14 = __pyx_t_17;
      }
      (__pyx_v_column[__pyx_v_i]).origin = __pyx_t_14;
    }
    goto __pyx_L8;
  }
  /*else*/ {

    /* "trimxtreme/_align.pyx":272
 * 				column[i].origin = max(0, min_n - i)
 * 		else:
 * 			for i in range(0, m + 1):             # <<<<<<<<<<<<<<
 * 				column[i].matches = 0
 * 				column[i].cost = min(i, min_n)
 */
    __pyx_t_15 = (__pyx_v_m + 1);
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_15; __pyx_t_13+=1) {
      __pyx_v_i = __pyx_t_13;

      /* "trimxtreme/_align.pyx":273
 * 		else:
 * 			for i in range(0, m + 1):
 * 				column[i].matches = 0             # <<<<<<<<<<<<<<
 * 				column[i].cost = min(i, min_n)
 * 				column[i].origin = min_n - i
 */
      (__pyx_v_column[__pyx_v_i]).matches = 0;

      /* "trimxtreme/_align.pyx":274
 * 			for i in range(0, m + 1):
 * 				column[i].matches = 0
 * 				column[i].cost = min(i, min_n)             # <<<<<<<<<<<<<<
 * 				column[i].origin = min_n - i
 * 
 */
      __pyx_t_16 = __pyx_v_min_n;
      __pyx_t_4 = __pyx_v_i;
      if (((__pyx_t_16 < __pyx_t_4) != 0)) {
        __pyx_t_12 = __pyx_t_16;
      } else {
        __pyx_t_12 = __pyx_t_4;
      }
      (__pyx_v_column[__pyx_v_i]).cost = __pyx_t_12;

      /* "trimxtreme/_align.pyx":275
 * 				column[i].matches = 0
 * 				column[i].cost = min(i, min_n)
 * 				column[i].origin = min_n - i             # <<<<<<<<<<<<<<
 * 
 * 		cdef _Match best
 */
      (__pyx_v_column[__pyx_v_i]).origin = (__pyx_v_min_n - __pyx_v_i);
    }
  }
  __pyx_L8:;

  /* "trimxtreme/_align.pyx":278
 * 
 * 		cdef _Match best
 * 		best.ref_stop = m             # <<<<<<<<<<<<<<
 * 		best.query_stop = n
 * 		best.cost = m + n
 */
  __pyx_v_best.ref_stop = __pyx_v_m;

  /* "trimxtreme/_align.pyx":279
 * 		cdef _Match best
 * 		best.ref_stop = m
 * 		best.query_stop = n             # <<<<<<<<<<<<<<
 * 		best.cost = m + n
 * 		best.origin = 0
 */
  __pyx_v_best.query_stop = __pyx_v_n;

  /* "trimxtreme/_align.pyx":280
 * 		best.ref_stop = m
 * 		best.query_stop = n
 * 		best.cost = m + n             # <<<<<<<<<<<<<<
 * 		best.origin = 0
 * 		best.matches = 0
 */
  __pyx_v_best.cost = (__pyx_v_m + __pyx_v_n);

  /* "trimxtreme/_align.pyx":281
 * 		best.query_stop = n
 * 		best.cost = m + n
 * 		best.origin = 0             # <<<<<<<<<<<<<<
 * 		best.matches = 0
 * 
 */
  __pyx_v_best.origin = 0;

  /* "trimxtreme/_align.pyx":282
 * 		best.cost = m + n
 * 		best.origin = 0
 * 		best.matches = 0             # <<<<<<<<<<<<<<
 * 
 * 		# Ukkonen's trick: index of the last cell that is less than k.
 */
  __pyx_v_best.matches = 0;

  /* "trimxtreme/_align.pyx":285
 * 
 * 		# Ukkonen's trick: index of the last cell that is less than k.
 * 		cdef int last = k + 1             # <<<<<<<<<<<<<<
 * 		if start_in_ref:
 * 			last = m
 */
  __pyx_v_last = (__pyx_v_k + 1);

  /* "trimxtreme/_align.pyx":286
 * 		# Ukkonen's trick: index of the last cell that is less than k.
 * 		cdef int last = k + 1
 * 		if start_in_ref:             # <<<<<<<<<<<<<<
 * 			last = m
 * 
 */
  __pyx_t_8 = (__pyx_v_start_in_ref != 0);
  if (__pyx_t_8) {

    /* "trimxtreme/_align.pyx":287
 * 		cdef int last = k + 1
 * 		if start_in_ref:
 * 			last = m             # <<<<<<<<<<<<<<
 * 
 * 		cdef int cost_diag
 */
    __pyx_v_last = __pyx_v_m;
    goto __pyx_L23;
  }
  __pyx_L23:;

  /* "trimxtreme/_align.pyx":298
 * 
 * 		# iterate over columns
 * 		for j in range(min_n + 1, max_n + 1):             # <<<<<<<<<<<<<<
 * 			# remember first entry
 * 			tmp_entry = column[0]
 */
  __pyx_t_15 = (__pyx_v_max_n + 1);
  for (__pyx_t_13 = (__pyx_v_min_n + 1); __pyx_t_13 < __pyx_t_15; __pyx_t_13+=1) {
    __pyx_v_j = __pyx_t_13;

    /* "trimxtreme/_align.pyx":300
 * 		for j in range(min_n + 1, max_n + 1):
 * 			# remember first entry
 * 			tmp_entry = column[0]             # <<<<<<<<<<<<<<
 * 
 * 			# fill in first entry in this column
 */
    __pyx_v_tmp_entry = (__pyx_v_column[0]);

    /* "trimxtreme/_align.pyx":303
 * 
 * 			# fill in first entry in this column
 * 			if start_in_query:             # <<<<<<<<<<<<<<
 * 				column[0].origin = j
 * 			else:
 */
    __pyx_t_8 = (__pyx_v_start_in_query != 0);
    if (__pyx_t_8) {

      /* "trimxtreme/_align.pyx":304
 * 			# fill in first entry in this column
 * 			if start_in_query:
 * 				column[0].origin = j             # <<<<<<<<<<<<<<
 * 			else:
 * 				column[0].cost = j * INSERTION_COST
 */
      (__pyx_v_column[0]).origin = __pyx_v_j;
      goto __pyx_L26;
    }
    /*else*/ {

      /* "trimxtreme/_align.pyx":306
 * 				column[0].origin = j
 * 			else:
 * 				column[0].cost = j * INSERTION_COST             # <<<<<<<<<<<<<<
 * 			for i in range(1, last + 1):
 * 				if compare_ascii:
 */
      (__pyx_v_column[0]).cost = (__pyx_v_j * 1);
    }
    __pyx_L26:;

    /* "trimxtreme/_align.pyx":307
 * 			else:
 * 				column[0].cost = j * INSERTION_COST
 * 			for i in range(1, last + 1):             # <<<<<<<<<<<<<<
 * 				if compare_ascii:
 * 					characters_equal = (s1[i-1] == s2[j-1])
 */
    __pyx_t_14 = (__pyx_v_last + 1);
    for (__pyx_t_12 = 1; __pyx_t_12 < __pyx_t_14; __pyx_t_12+=1) {
      __pyx_v_i = __pyx_t_12;

      /* "trimxtreme/_align.pyx":308
 * 				column[0].cost = j * INSERTION_COST
 * 			for i in range(1, last + 1):
 * 				if compare_ascii:             # <<<<<<<<<<<<<<
 * 					characters_equal = (s1[i-1] == s2[j-1])
 * 				else:
 */
      __pyx_t_8 = (__pyx_v_compare_ascii != 0);
      if (__pyx_t_8) {

        /* "trimxtreme/_align.pyx":309
 * 			for i in range(1, last + 1):
 * 				if compare_ascii:
 * 					characters_equal = (s1[i-1] == s2[j-1])             # <<<<<<<<<<<<<<
 * 				else:
 * 					characters_equal = (s1[i-1] & s2[j-1]) != 0
 */
        __pyx_v_characters_equal = ((__pyx_v_s1[(__pyx_v_i - 1)]) == (__pyx_v_s2[(__pyx_v_j - 1)]));
        goto __pyx_L29;
      }
      /*else*/ {

        /* "trimxtreme/_align.pyx":311
 * 					characters_equal = (s1[i-1] == s2[j-1])
 * 				else:
 * 					characters_equal = (s1[i-1] & s2[j-1]) != 0             # <<<<<<<<<<<<<<
 * 				if characters_equal:
 * 					# Characters match: This cannot be an indel.
 */
        __pyx_v_characters_equal = (((__pyx_v_s1[(__pyx_v_i - 1)]) & (__pyx_v_s2[(__pyx_v_j - 1)])) != 0);
      }
      __pyx_L29:;

      /* "trimxtreme/_align.pyx":312
 * 				else:
 * 					characters_equal = (s1[i-1] & s2[j-1]) != 0
 * 				if characters_equal:             # <<<<<<<<<<<<<<
 * 					# Characters match: This cannot be an indel.
 * 					cost = tmp_entry.cost
 */
      __pyx_t_8 = (__pyx_v_characters_equal != 0);
      if (__pyx_t_8) {

        /* "trimxtreme/_align.pyx":314
 * 				if characters_equal:
 * 					# Characters match: This cannot be an indel.
 * 					cost = tmp_entry.cost             # <<<<<<<<<<<<<<
 * 					origin = tmp_entry.origin
 * 					matches = tmp_entry.matches + 1
 */
        __pyx_t_16 = __pyx_v_tmp_entry.cost;
        __pyx_v_cost = __pyx_t_16;

        /* "trimxtreme/_align.pyx":315
 * 					# Characters match: This cannot be an indel.
 * 					cost = tmp_entry.cost
 * 					origin = tmp_entry.origin             # <<<<<<<<<<<<<<
 * 					matches = tmp_entry.matches + 1
 * 				else:
 */
        __pyx_t_16 = __pyx_v_tmp_entry.origin;
        __pyx_v_origin = __pyx_t_16;

        /* "trimxtreme/_align.pyx":316
 * 					cost = tmp_entry.cost
 * 					origin = tmp_entry.origin
 * 					matches = tmp_entry.matches + 1             # <<<<<<<<<<<<<<
 * 				else:
 * 					# Characters do not match.
 */
        __pyx_v_matches = (__pyx_v_tmp_entry.matches + 1);
        goto __pyx_L30;
      }
      /*else*/ {

        /* "trimxtreme/_align.pyx":319
 * 				else:
 * 					# Characters do not match.
 * 					cost_diag = tmp_entry.cost + 1             # <<<<<<<<<<<<<<
 * 					cost_deletion = column[i].cost + DELETION_COST
 * 					cost_insertion = column[i-1].cost + INSERTION_COST
 */
        __pyx_v_cost_diag = (__pyx_v_tmp_entry.cost + 1);

        /* "trimxtreme/_align.pyx":320
 * 					# Characters do not match.
 * 					cost_diag = tmp_entry.cost + 1
 * 					cost_deletion = column[i].cost + DELETION_COST             # <<<<<<<<<<<<<<
 * 					cost_insertion = column[i-1].cost + INSERTION_COST
 * 
 */
        __pyx_v_cost_deletion = ((__pyx_v_column[__pyx_v_i]).cost + 1);

        /* "trimxtreme/_align.pyx":321
 * 					cost_diag = tmp_entry.cost + 1
 * 					cost_deletion = column[i].cost + DELETION_COST
 * 					cost_insertion = column[i-1].cost + INSERTION_COST             # <<<<<<<<<<<<<<
 * 
 * 					if cost_diag <= cost_deletion and cost_diag <= cost_insertion:
 */
        __pyx_v_cost_insertion = ((__pyx_v_column[(__pyx_v_i - 1)]).cost + 1);

        /* "trimxtreme/_align.pyx":323
 * 					cost_insertion = column[i-1].cost + INSERTION_COST
 * 
 * 					if cost_diag <= cost_deletion and cost_diag <= cost_insertion:             # <<<<<<<<<<<<<<
 * 						# MISMATCH
 * 						cost = cost_diag
 */
        __pyx_t_11 = ((__pyx_v_cost_diag <= __pyx_v_cost_deletion) != 0);
        if (__pyx_t_11) {
        } else {
          __pyx_t_8 = __pyx_t_11;
          goto __pyx_L32_bool_binop_done;
        }
        __pyx_t_11 = ((__pyx_v_cost_diag <= __pyx_v_cost_insertion) != 0);
        __pyx_t_8 = __pyx_t_11;
        __pyx_L32_bool_binop_done:;
        if (__pyx_t_8) {

          /* "trimxtreme/_align.pyx":325
 * 					if cost_diag <= cost_deletion and cost_diag <= cost_insertion:
 * 						# MISMATCH
 * 						cost = cost_diag             # <<<<<<<<<<<<<<
 * 						origin = tmp_entry.origin
 * 						matches = tmp_entry.matches
 */
          __pyx_v_cost = __pyx_v_cost_diag;

          /* "trimxtreme/_align.pyx":326
 * 						# MISMATCH
 * 						cost = cost_diag
 * 						origin = tmp_entry.origin             # <<<<<<<<<<<<<<
 * 						matches = tmp_entry.matches
 * 					elif cost_insertion <= cost_deletion:
 */
          __pyx_t_16 = __pyx_v_tmp_entry.origin;
          __pyx_v_origin = __pyx_t_16;

          /* "trimxtreme/_align.pyx":327
 * 						cost = cost_diag
 * 						origin = tmp_entry.origin
 * 						matches = tmp_entry.matches             # <<<<<<<<<<<<<<
 * 					elif cost_insertion <= cost_deletion:
 * 						# INSERTION
 */
          __pyx_t_16 = __pyx_v_tmp_entry.matches;
          __pyx_v_matches = __pyx_t_16;
          goto __pyx_L31;
        }

        /* "trimxtreme/_align.pyx":328
 * 						origin = tmp_entry.origin
 * 						matches = tmp_entry.matches
 * 					elif cost_insertion <= cost_deletion:             # <<<<<<<<<<<<<<
 * 						# INSERTION
 * 						cost = cost_insertion
 */
        __pyx_t_8 = ((__pyx_v_cost_insertion <= __pyx_v_cost_deletion) != 0);
        if (__pyx_t_8) {

          /* "trimxtreme/_align.pyx":330
 * 					elif cost_insertion <= cost_deletion:
 * 						# INSERTION
 * 						cost = cost_insertion             # <<<<<<<<<<<<<<
 * 						origin = column[i-1].origin
 * 						matches = column[i-1].matches
 */
          __pyx_v_cost = __pyx_v_cost_insertion;

          /* "trimxtreme/_align.pyx":331
 * 						# INSERTION
 * 						cost = cost_insertion
 * 						origin = column[i-1].origin             # <<<<<<<<<<<<<<
 * 						matches = column[i-1].matches
 * 					else:
 */
          __pyx_t_16 = (__pyx_v_column[(__pyx_v_i - 1)]).origin;
          __pyx_v_origin = __pyx_t_16;

          /* "trimxtreme/_align.pyx":332
 * 						cost = cost_insertion
 * 						origin = column[i-1].origin
 * 						matches = column[i-1].matches             # <<<<<<<<<<<<<<
 * 					else:
 * 						# DELETION
 */
          __pyx_t_16 = (__pyx_v_column[(__pyx_v_i - 1)]).matches;
          __pyx_v_matches = __pyx_t_16;
          goto __pyx_L31;
        }
        /*else*/ {

          /* "trimxtreme/_align.pyx":335
 * 					else:
 * 						# DELETION
 * 						cost = cost_deletion             # <<<<<<<<<<<<<<
 * 						origin = column[i].origin
 * 						matches = column[i].matches
 */
          __pyx_v_cost = __pyx_v_cost_deletion;

          /* "trimxtreme/_align.pyx":336
 * 						# DELETION
 * 						cost = cost_deletion
 * 						origin = column[i].origin             # <<<<<<<<<<<<<<
 * 						matches = column[i].matches
 * 
 */
          __pyx_t_16 = (__pyx_v_column[__pyx_v_i]).origin;
          __pyx_v_origin = __pyx_t_16;

          /* "trimxtreme/_align.pyx":337
 * 						cost = cost_deletion
 * 						origin = column[i].origin
 * 						matches = column[i].matches             # <<<<<<<<<<<<<<
 * 
 * 				# remember current cell for next iteration
 */
          __pyx_t_16 = (__pyx_v_column[__pyx_v_i]).matches;
          __pyx_v_matches = __pyx_t_16;
        }
        __pyx_L31:;
      }
      __pyx_L30:;

      /* "trimxtreme/_align.pyx":340
 * 
 * 				# remember current cell for next iteration
 * 				tmp_entry = column[i]             # <<<<<<<<<<<<<<
 * 
 * 				column[i].cost = cost
 */
      __pyx_v_tmp_entry = (__pyx_v_column[__pyx_v_i]);

      /* "trimxtreme/_align.pyx":342
 * 				tmp_entry = column[i]
 * 
 * 				column[i].cost = cost             # <<<<<<<<<<<<<<
 * 				column[i].origin = origin
 * 				column[i].matches = matches
 */
      (__pyx_v_column[__pyx_v_i]).cost = __pyx_v_cost;

      /* "trimxtreme/_align.pyx":343
 * 
 * 				column[i].cost = cost
 * 				column[i].origin = origin             # <<<<<<<<<<<<<<
 * 				column[i].matches = matches
 * 			while last >= 0 and column[last].cost > k:
 */
      (__pyx_v_column[__pyx_v_i]).origin = __pyx_v_origin;

      /* "trimxtreme/_align.pyx":344
 * 				column[i].cost = cost
 * 				column[i].origin = origin
 * 				column[i].matches = matches             # <<<<<<<<<<<<<<
 * 			while last >= 0 and column[last].cost > k:
 * 				last -= 1
 */
      (__pyx_v_column[__pyx_v_i]).matches = __pyx_v_matches;
    }

    /* "trimxtreme/_align.pyx":345
 * 				column[i].origin = origin
 * 				column[i].matches = matches
 * 			while last >= 0 and column[last].cost > k:             # <<<<<<<<<<<<<<
 * 				last -= 1
 * 			# last can be -1 here, but will be incremented next.
 */
    while (1) {
      __pyx_t_11 = ((__pyx_v_last >= 0) != 0);
      if (__pyx_t_11) {
      } else {
        __pyx_t_8 = __pyx_t_11;
        goto __pyx_L36_bool_binop_done;
      }
      __pyx_t_11 = (((__pyx_v_column[__pyx_v_last]).cost > __pyx_v_k) != 0);
      __pyx_t_8 = __pyx_t_11;
      __pyx_L36_bool_binop_done:;
      if (!__pyx_t_8) break;

      /* "trimxtreme/_align.pyx":346
 * 				column[i].matches = matches
 * 			while last >= 0 and column[last].cost > k:
 * 				last -= 1             # <<<<<<<<<<<<<<
 * 			# last can be -1 here, but will be incremented next.
 * 			# TODO if last is -1, can we stop searching?
 */
      __pyx_v_last = (__pyx_v_last - 1);
    }

    /* "trimxtreme/_align.pyx":349
 * 			# last can be -1 here, but will be incremented next.
 * 			# TODO if last is -1, can we stop searching?
 * 			if last < m:             # <<<<<<<<<<<<<<
 * 				last += 1
 * 			elif stop_in_query:
 */
    __pyx_t_8 = ((__pyx_v_last < __pyx_v_m) != 0);
    if (__pyx_t_8) {

      /* "trimxtreme/_align.pyx":350
 * 			# TODO if last is -1, can we stop searching?
 * 			if last < m:
 * 				last += 1             # <<<<<<<<<<<<<<
 * 			elif stop_in_query:
 * 				# Found a match. If requested, find best match in last row.
 */
      __pyx_v_last = (__pyx_v_last + 1);
      goto __pyx_L38;
    }

    /* "trimxtreme/_align.pyx":351
 * 			if last < m:
 * 				last += 1
 * 			elif stop_in_query:             # <<<<<<<<<<<<<<
 * 				# Found a match. If requested, find best match in last row.
 * 				# length of the aligned part of the reference
 */
    __pyx_t_8 = (__pyx_v_stop_in_query != 0);
    if (__pyx_t_8) {

      /* "trimxtreme/_align.pyx":354
 * 				# Found a match. If requested, find best match in last row.
 * 				# length of the aligned part of the reference
 * 				length = m + min(column[m].origin, 0)             # <<<<<<<<<<<<<<
 * 				cost = column[m].cost
 * 				matches = column[m].matches
 */
      __pyx_t_14 = 0;
      __pyx_t_12 = (__pyx_v_column[__pyx_v_m]).origin;
      if (((__pyx_t_14 < __pyx_t_12) != 0)) {
        __pyx_t_17 = __pyx_t_14;
      } else {
        __pyx_t_17 = __pyx_t_12;
      }
      __pyx_v_length = (__pyx_v_m + __pyx_t_17);

      /* "trimxtreme/_align.pyx":355
 * 				# length of the aligned part of the reference
 * 				length = m + min(column[m].origin, 0)
 * 				cost = column[m].cost             # <<<<<<<<<<<<<<
 * 				matches = column[m].matches
 * 				if length >= self.min_overlap and cost <= length * max_error_rate and (matches > best.matches or (matches == best.matches and cost < best.cost)):
 */
      __pyx_t_12 = (__pyx_v_column[__pyx_v_m]).cost;
      __pyx_v_cost = __pyx_t_12;

      /* "trimxtreme/_align.pyx":356
 * 				length = m + min(column[m].origin, 0)
 * 				cost = column[m].cost
 * 				matches = column[m].matches             # <<<<<<<<<<<<<<
 * 				if length >= self.min_overlap and cost <= length * max_error_rate and (matches > best.matches or (matches == best.matches and cost < best.cost)):
 * 					# update
 */
      __pyx_t_12 = (__pyx_v_column[__pyx_v_m]).matches;
      __pyx_v_matches = __pyx_t_12;

      /* "trimxtreme/_align.pyx":357
 * 				cost = column[m].cost
 * 				matches = column[m].matches
 * 				if length >= self.min_overlap and cost <= length * max_error_rate and (matches > best.matches or (matches == best.matches and cost < best.cost)):             # <<<<<<<<<<<<<<
 * 					# update
 * 					best.matches = matches
 */
      __pyx_t_11 = ((__pyx_v_length >= __pyx_v_self->min_overlap) != 0);
      if (__pyx_t_11) {
      } else {
        __pyx_t_8 = __pyx_t_11;
        goto __pyx_L40_bool_binop_done;
      }
      __pyx_t_11 = ((__pyx_v_cost <= (__pyx_v_length * __pyx_v_max_error_rate)) != 0);
      if (__pyx_t_11) {
      } else {
        __pyx_t_8 = __pyx_t_11;
        goto __pyx_L40_bool_binop_done;
      }
      __pyx_t_11 = ((__pyx_v_matches > __pyx_v_best.matches) != 0);
      if (!__pyx_t_11) {
      } else {
        __pyx_t_8 = __pyx_t_11;
        goto __pyx_L40_bool_binop_done;
      }
      __pyx_t_11 = ((__pyx_v_matches == __pyx_v_best.matches) != 0);
      if (__pyx_t_11) {
      } else {
        __pyx_t_8 = __pyx_t_11;
        goto __pyx_L40_bool_binop_done;
      }
      __pyx_t_11 = ((__pyx_v_cost < __pyx_v_best.cost) != 0);
      __pyx_t_8 = __pyx_t_11;
      __pyx_L40_bool_binop_done:;
      if (__pyx_t_8) {

        /* "trimxtreme/_align.pyx":359
 * 				if length >= self.min_overlap and cost <= length * max_error_rate and (matches > best.matches or (matches == best.matches and cost < best.cost)):
 * 					# update
 * 					best.matches = matches             # <<<<<<<<<<<<<<
 * 					best.cost = cost
 * 					best.origin = column[m].origin
 */
        __pyx_v_best.matches = __pyx_v_matches;

        /* "trimxtreme/_align.pyx":360
 * 					# update
 * 					best.matches = matches
 * 					best.cost = cost             # <<<<<<<<<<<<<<
 * 					best.origin = column[m].origin
 * 					best.ref_stop = m
 */
        __pyx_v_best.cost = __pyx_v_cost;

        /* "trimxtreme/_align.pyx":361
 * 					best.matches = matches
 * 					best.cost = cost
 * 					best.origin = column[m].origin             # <<<<<<<<<<<<<<
 * 					best.ref_stop = m
 * 					best.query_stop = j
 */
        __pyx_t_12 = (__pyx_v_column[__pyx_v_m]).origin;
        __pyx_v_best.origin = __pyx_t_12;

        /* "trimxtreme/_align.pyx":362
 * 					best.cost = cost
 * 					best.origin = column[m].origin
 * 					best.ref_stop = m             # <<<<<<<<<<<<<<
 * 					best.query_stop = j
 * 					if cost == 0 and matches == m:
 */
        __pyx_v_best.ref_stop = __pyx_v_m;

        /* "trimxtreme/_align.pyx":363
 * 					best.origin = column[m].origin
 * 					best.ref_stop = m
 * 					best.query_stop = j             # <<<<<<<<<<<<<<
 * 					if cost == 0 and matches == m:
 * 						# exact match, stop early
 */
        __pyx_v_best.query_stop = __pyx_v_j;

        /* "trimxtreme/_align.pyx":364
 * 					best.ref_stop = m
 * 					best.query_stop = j
 * 					if cost == 0 and matches == m:             # <<<<<<<<<<<<<<
 * 						# exact match, stop early
 * 						break
 */
        __pyx_t_11 = ((__pyx_v_cost == 0) != 0);
        if (__pyx_t_11) {
        } else {
          __pyx_t_8 = __pyx_t_11;
          goto __pyx_L46_bool_binop_done;
        }
        __pyx_t_11 = ((__pyx_v_matches == __pyx_v_m) != 0);
        __pyx_t_8 = __pyx_t_11;
        __pyx_L46_bool_binop_done:;
        if (__pyx_t_8) {

          /* "trimxtreme/_align.pyx":366
 * 					if cost == 0 and matches == m:
 * 						# exact match, stop early
 * 						break             # <<<<<<<<<<<<<<
 * 			# column finished
 * 
 */
          goto __pyx_L25_break;
        }
        goto __pyx_L39;
      }
      __pyx_L39:;
      goto __pyx_L38;
    }
    __pyx_L38:;
  }
  __pyx_L25_break:;

  /* "trimxtreme/_align.pyx":369
 * 			# column finished
 * 
 * 		if max_n == n:             # <<<<<<<<<<<<<<
 * 			first_i = 0 if stop_in_ref else m
 * 			# search in last column # TODO last?
 */
  __pyx_t_8 = ((__pyx_v_max_n == __pyx_v_n) != 0);
  if (__pyx_t_8) {

    /* "trimxtreme/_align.pyx":370
 * 
 * 		if max_n == n:
 * 			first_i = 0 if stop_in_ref else m             # <<<<<<<<<<<<<<
 * 			# search in last column # TODO last?
 * 			for i in range(first_i, m+1):
 */
    if ((__pyx_v_stop_in_ref != 0)) {
      __pyx_t_15 = 0;
    } else {
      __pyx_t_15 = __pyx_v_m;
    }
    __pyx_v_first_i = __pyx_t_15;

    /* "trimxtreme/_align.pyx":372
 * 			first_i = 0 if stop_in_ref else m
 * 			# search in last column # TODO last?
 * 			for i in range(first_i, m+1):             # <<<<<<<<<<<<<<
 * 				length = i + min(column[i].origin, 0)
 * 				cost = column[i].cost
 */
    __pyx_t_15 = (__pyx_v_m + 1);
    for (__pyx_t_13 = __pyx_v_first_i; __pyx_t_13 < __pyx_t_15; __pyx_t_13+=1) {
      __pyx_v_i = __pyx_t_13;

      /* "trimxtreme/_align.pyx":373
 * 			# search in last column # TODO last?
 * 			for i in range(first_i, m+1):
 * 				length = i + min(column[i].origin, 0)             # <<<<<<<<<<<<<<
 * 				cost = column[i].cost
 * 				matches = column[i].matches
 */
      __pyx_t_17 = 0;
      __pyx_t_12 = (__pyx_v_column[__pyx_v_i]).origin;
      if (((__pyx_t_17 < __pyx_t_12) != 0)) {
        __pyx_t_14 = __pyx_t_17;
      } else {
        __pyx_t_14 = __pyx_t_12;
      }
      __pyx_v_length = (__pyx_v_i + __pyx_t_14);

      /* "trimxtreme/_align.pyx":374
 * 			for i in range(first_i, m+1):
 * 				length = i + min(column[i].origin, 0)
 * 				cost = column[i].cost             # <<<<<<<<<<<<<<
 * 				matches = column[i].matches
 * 				if length >= self.min_overlap and cost <= length * max_error_rate and (matches > best.matches or (matches == best.matches and cost < best.cost)):
 */
      __pyx_t_12 = (__pyx_v_column[__pyx_v_i]).cost;
      __pyx_v_cost = __pyx_t_12;

      /* "trimxtreme/_align.pyx":375
 * 				length = i + min(column[i].origin, 0)
 * 				cost = column[i].cost
 * 				matches = column[i].matches             # <<<<<<<<<<<<<<
 * 				if length >= self.min_overlap and cost <= length * max_error_rate and (matches > best.matches or (matches == best.matches and cost < best.cost)):
 * 					# update best
 */
      __pyx_t_12 = (__pyx_v_column[__pyx_v_i]).matches;
      __pyx_v_matches = __pyx_t_12;

      /* "trimxtreme/_align.pyx":376
 * 				cost = column[i].cost
 * 				matches = column[i].matches
 * 				if length >= self.min_overlap and cost <= length * max_error_rate and (matches > best.matches or (matches == best.matches and cost < best.cost)):             # <<<<<<<<<<<<<<
 * 					# update best
 * 					best.matches = matches
 */
      __pyx_t_11 = ((__pyx_v_length >= __pyx_v_self->min_overlap) != 0);
      if (__pyx_t_11) {
      } else {
        __pyx_t_8 = __pyx_t_11;
        goto __pyx_L52_bool_binop_done;
      }
      __pyx_t_11 = ((__pyx_v_cost <= (__pyx_v_length * __pyx_v_max_error_rate)) != 0);
      if (__pyx_t_11) {
      } else {
        __pyx_t_8 = __pyx_t_11;
        goto __pyx_L52_bool_binop_done;
      }
      __pyx_t_11 = ((__pyx_v_matches > __pyx_v_best.matches) != 0);
      if (!__pyx_t_11) {
      } else {
        __pyx_t_8 = __pyx_t_11;
        goto __pyx_L52_bool_binop_done;
      }
      __pyx_t_11 = ((__pyx_v_matches == __pyx_v_best.matches) != 0);
      if (__pyx_t_11) {
      } else {
        __pyx_t_8 = __pyx_t_11;
        goto __pyx_L52_bool_binop_done;
      }
      __pyx_t_11 = ((__pyx_v_cost < __pyx_v_best.cost) != 0);
      __pyx_t_8 = __pyx_t_11;
      __pyx_L52_bool_binop_done:;
      if (__pyx_t_8) {

        /* "trimxtreme/_align.pyx":378
 * 				if length >= self.min_overlap and cost <= length * max_error_rate and (matches > best.matches or (matches == best.matches and cost < best.cost)):
 * 					# update best
 * 					best.matches = matches             # <<<<<<<<<<<<<<
 * 					best.cost = cost
 * 					best.origin = column[i].origin
 */
        __pyx_v_best.matches = __pyx_v_matches;

        /* "trimxtreme/_align.pyx":379
 * 					# update best
 * 					best.matches = matches
 * 					best.cost = cost             # <<<<<<<<<<<<<<
 * 					best.origin = column[i].origin
 * 					best.ref_stop = i
 */
        __pyx_v_best.cost = __pyx_v_cost;

        /* "trimxtreme/_align.pyx":380
 * 					best.matches = matches
 * 					best.cost = cost
 * 					best.origin = column[i].origin             # <<<<<<<<<<<<<<
 * 					best.ref_stop = i
 * 					best.query_stop = n
 */
        __pyx_t_12 = (__pyx_v_column[__pyx_v_i]).origin;
        __pyx_v_best.origin = __pyx_t_12;

        /* "trimxtreme/_align.pyx":381
 * 					best.cost = cost
 * 					best.origin = column[i].origin
 * 					best.ref_stop = i             # <<<<<<<<<<<<<<
 * 					best.query_stop = n
 * 
 */
        __pyx_v_best.ref_stop = __pyx_v_i;

        /* "trimxtreme/_align.pyx":382
 * 					best.origin = column[i].origin
 * 					best.ref_stop = i
 * 					best.query_stop = n             # <<<<<<<<<<<<<<
 * 
 * 		if best.cost == m + n:
 */
        __pyx_v_best.query_stop = __pyx_v_n;
        goto __pyx_L51;
      }
      __pyx_L51:;
    }
    goto __pyx_L48;
  }
  __pyx_L48:;

  /* "trimxtreme/_align.pyx":384
 * 					best.query_stop = n
 * 
 * 		if best.cost == m + n:             # <<<<<<<<<<<<<<
 * 			# best.cost was initialized with this value.
 * 			# If it is unchanged, no alignment was found that has
 */
  __pyx_t_8 = ((__pyx_v_best.cost == (__pyx_v_m + __pyx_v_n)) != 0);
  if (__pyx_t_8) {

    /* "trimxtreme/_align.pyx":388
 * 			# If it is unchanged, no alignment was found that has
 * 			# an error rate within the allowed range.
 * 			return None             # <<<<<<<<<<<<<<
 * 
 * 		cdef int start1, start2
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "trimxtreme/_align.pyx":391
 * 
 * 		cdef int start1, start2
 * 		if best.origin >= 0:             # <<<<<<<<<<<<<<
 * 			start1 = 0
 * 			start2 = best.origin
 */
  __pyx_t_8 = ((__pyx_v_best.origin >= 0) != 0);
  if (__pyx_t_8) {

    /* "trimxtreme/_align.pyx":392
 * 		cdef int start1, start2
 * 		if best.origin >= 0:
 * 			start1 = 0             # <<<<<<<<<<<<<<
 * 			start2 = best.origin
 * 		else:
 */
    __pyx_v_start1 = 0;

    /* "trimxtreme/_align.pyx":393
 * 		if best.origin >= 0:
 * 			start1 = 0
 * 			start2 = best.origin             # <<<<<<<<<<<<<<
 * 		else:
 * 			start1 = -best.origin
 */
    __pyx_t_13 = __pyx_v_best.origin;
    __pyx_v_start2 = __pyx_t_13;
    goto __pyx_L58;
  }
  /*else*/ {

    /* "trimxtreme/_align.pyx":395
 * 			start2 = best.origin
 * 		else:
 * 			start1 = -best.origin             # <<<<<<<<<<<<<<
 * 			start2 = 0
 * 
 */
    __pyx_v_start1 = (-__pyx_v_best.origin);

    /* "trimxtreme/_align.pyx":396
 * 		else:
 * 			start1 = -best.origin
 * 			start2 = 0             # <<<<<<<<<<<<<<
 * 
 * 		assert best.ref_stop - start1 > 0  # Do not return empty alignments.
 */
    __pyx_v_start2 = 0;
  }
  __pyx_L58:;

  /* "trimxtreme/_align.pyx":398
 * 			start2 = 0
 * 
 * 		assert best.ref_stop - start1 > 0  # Do not return empty alignments.             # <<<<<<<<<<<<<<
 * 		return (start1, best.ref_stop, start2, best.query_stop, best.matches, best.cost)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!(((__pyx_v_best.ref_stop - __pyx_v_start1) > 0) != 0))) {
      PyErr_SetNone(PyExc_AssertionError);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  #endif

  /* "trimxtreme/_align.pyx":399
 * 
 * 		assert best.ref_stop - start1 > 0  # Do not return empty alignments.
 * 		return (start1, best.ref_stop, start2, best.query_stop, best.matches, best.cost)             # <<<<<<<<<<<<<<
 * 
 * 	def __dealloc__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_start1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_best.ref_stop); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_start2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_best.query_stop); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_best.matches); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_18);
  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_best.cost); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_19);
  __pyx_t_20 = PyTuple_New(6); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_20);
  PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_20, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_20, 2, __pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_20, 3, __pyx_t_10);
  __Pyx_GIVEREF(__pyx_t_10);
  PyTuple_SET_ITEM(__pyx_t_20, 4, __pyx_t_18);
  __Pyx_GIVEREF(__pyx_t_18);
  PyTuple_SET_ITEM(__pyx_t_20, 5, __pyx_t_19);
  __Pyx_GIVEREF(__pyx_t_19);
  __pyx_t_3 = 0;
  __pyx_t_2 = 0;
  __pyx_t_9 = 0;
  __pyx_t_10 = 0;
  __pyx_t_18 = 0;
  __pyx_t_19 = 0;
  __pyx_r = __pyx_t_20;
  __pyx_t_20 = 0;
  goto __pyx_L0;

  /* "trimxtreme/_align.pyx":189
 * 				self._reference = self._reference.translate(ACGT_TABLE)
 * 
 * 	def locate(self, str query):             # <<<<<<<<<<<<<<
 * 		"""
 * 		locate(query) -> (refstart, refstop, querystart, querystop, matches, errors)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_18);
  __Pyx_XDECREF(__pyx_t_19);
  __Pyx_XDECREF(__pyx_t_20);
  __Pyx_AddTraceback("trimxtreme._align.Aligner.locate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_query_bytes);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trimxtreme/_align.pyx":401
 * 		return (start1, best.ref_stop, start2, best.query_stop, best.matches, best.cost)
 * 
 * 	def __dealloc__(self):             # <<<<<<<<<<<<<<
 * 		PyMem_Free(self.column)
 * 
 */

/* Python wrapper */
static void __pyx_pw_10trimxtreme_6_align_7Aligner_5__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_10trimxtreme_6_align_7Aligner_5__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_10trimxtreme_6_align_7Aligner_4__dealloc__(((struct __pyx_obj_10trimxtreme_6_align_Aligner *)__pyx_v_self));

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

static void __pyx_pf_10trimxtreme_6_align_7Aligner_4__dealloc__(struct __pyx_obj_10trimxtreme_6_align_Aligner *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "trimxtreme/_align.pyx":402
 * 
 * 	def __dealloc__(self):
 * 		PyMem_Free(self.column)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  PyMem_Free(__pyx_v_self->column);

  /* "trimxtreme/_align.pyx":401
 * 		return (start1, best.ref_stop, start2, best.query_stop, best.matches, best.cost)
 * 
 * 	def __dealloc__(self):             # <<<<<<<<<<<<<<
 * 		PyMem_Free(self.column)
 * 
 */

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

/* "trimxtreme/_align.pyx":405
 * 
 * 
 * def locate(str reference, str query, double max_error_rate, int flags=SEMIGLOBAL, int degenerate=0, int min_overlap=1):             # <<<<<<<<<<<<<<
 * 	aligner = Aligner(reference, max_error_rate, flags, degenerate, min_overlap)
 * 	return aligner.locate(query)
 */

/* Python wrapper */
static PyObject *__pyx_pw_10trimxtreme_6_align_5locate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_10trimxtreme_6_align_5locate = {"locate", (PyCFunction)__pyx_pw_10trimxtreme_6_align_5locate, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_10trimxtreme_6_align_5locate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_reference = 0;
  PyObject *__pyx_v_query = 0;
  double __pyx_v_max_error_rate;
  int __pyx_v_flags;
  int __pyx_v_degenerate;
  int __pyx_v_min_overlap;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("locate (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_reference,&__pyx_n_s_query,&__pyx_n_s_max_error_rate,&__pyx_n_s_flags,&__pyx_n_s_degenerate,&__pyx_n_s_min_overlap,0};
    PyObject* values[6] = {0,0,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  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        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_reference)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_query)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("locate", 0, 3, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_max_error_rate)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("locate", 0, 3, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_flags);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_degenerate);
          if (value) { values[4] = value; kw_args--; }
        }
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_min_overlap);
          if (value) { values[5] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "locate") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 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_reference = ((PyObject*)values[0]);
    __pyx_v_query = ((PyObject*)values[1]);
    __pyx_v_max_error_rate = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_max_error_rate == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    if (values[3]) {
      __pyx_v_flags = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_flags = ((int)15);
    }
    if (values[4]) {
      __pyx_v_degenerate = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_degenerate == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_degenerate = ((int)0);
    }
    if (values[5]) {
      __pyx_v_min_overlap = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_min_overlap == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_min_overlap = ((int)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("locate", 0, 3, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("trimxtreme._align.locate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_reference), (&PyString_Type), 1, "reference", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_query), (&PyString_Type), 1, "query", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_10trimxtreme_6_align_4locate(__pyx_self, __pyx_v_reference, __pyx_v_query, __pyx_v_max_error_rate, __pyx_v_flags, __pyx_v_degenerate, __pyx_v_min_overlap);

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

static PyObject *__pyx_pf_10trimxtreme_6_align_4locate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_reference, PyObject *__pyx_v_query, double __pyx_v_max_error_rate, int __pyx_v_flags, int __pyx_v_degenerate, int __pyx_v_min_overlap) {
  struct __pyx_obj_10trimxtreme_6_align_Aligner *__pyx_v_aligner = NULL;
  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;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("locate", 0);

  /* "trimxtreme/_align.pyx":406
 * 
 * def locate(str reference, str query, double max_error_rate, int flags=SEMIGLOBAL, int degenerate=0, int min_overlap=1):
 * 	aligner = Aligner(reference, max_error_rate, flags, degenerate, min_overlap)             # <<<<<<<<<<<<<<
 * 	return aligner.locate(query)
 * 
 */
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_max_error_rate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_degenerate); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_min_overlap); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_reference);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_reference);
  __Pyx_GIVEREF(__pyx_v_reference);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_5, 4, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_10trimxtreme_6_align_Aligner)), __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_aligner = ((struct __pyx_obj_10trimxtreme_6_align_Aligner *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "trimxtreme/_align.pyx":407
 * def locate(str reference, str query, double max_error_rate, int flags=SEMIGLOBAL, int degenerate=0, int min_overlap=1):
 * 	aligner = Aligner(reference, max_error_rate, flags, degenerate, min_overlap)
 * 	return aligner.locate(query)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_aligner), __pyx_n_s_locate); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  if (!__pyx_t_3) {
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_query); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
  } else {
    __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __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 = NULL;
    __Pyx_INCREF(__pyx_v_query);
    PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_v_query);
    __Pyx_GIVEREF(__pyx_v_query);
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "trimxtreme/_align.pyx":405
 * 
 * 
 * def locate(str reference, str query, double max_error_rate, int flags=SEMIGLOBAL, int degenerate=0, int min_overlap=1):             # <<<<<<<<<<<<<<
 * 	aligner = Aligner(reference, max_error_rate, flags, degenerate, min_overlap)
 * 	return aligner.locate(query)
 */

  /* 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_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("trimxtreme._align.locate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_aligner);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trimxtreme/_align.pyx":410
 * 
 * 
 * def compare_prefixes(str ref, str query, int degenerate=0):             # <<<<<<<<<<<<<<
 * 	"""
 * 	Find out whether one string is the prefix of the other one, allowing
 */

/* Python wrapper */
static PyObject *__pyx_pw_10trimxtreme_6_align_7compare_prefixes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_10trimxtreme_6_align_6compare_prefixes[] = "\n\tFind out whether one string is the prefix of the other one, allowing\n\tIUPAC wildcards if the appropriate bit is set in the degenerate flag\n\tparameter.\n\n\tThis is used to find an anchored 5' adapter (type 'FRONT') in the 'no indels' mode.\n\tThis is very simple as only the number of errors needs to be counted.\n\n\tThis function returns a tuple compatible with what Aligner.locate outputs.\n\t";
static PyMethodDef __pyx_mdef_10trimxtreme_6_align_7compare_prefixes = {"compare_prefixes", (PyCFunction)__pyx_pw_10trimxtreme_6_align_7compare_prefixes, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10trimxtreme_6_align_6compare_prefixes};
static PyObject *__pyx_pw_10trimxtreme_6_align_7compare_prefixes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_ref = 0;
  PyObject *__pyx_v_query = 0;
  int __pyx_v_degenerate;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("compare_prefixes (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ref,&__pyx_n_s_query,&__pyx_n_s_degenerate,0};
    PyObject* values[3] = {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  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_ref)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_query)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("compare_prefixes", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_degenerate);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "compare_prefixes") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_ref = ((PyObject*)values[0]);
    __pyx_v_query = ((PyObject*)values[1]);
    if (values[2]) {
      __pyx_v_degenerate = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_degenerate == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_degenerate = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("compare_prefixes", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("trimxtreme._align.compare_prefixes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ref), (&PyString_Type), 1, "ref", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_query), (&PyString_Type), 1, "query", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_10trimxtreme_6_align_6compare_prefixes(__pyx_self, __pyx_v_ref, __pyx_v_query, __pyx_v_degenerate);

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

static PyObject *__pyx_pf_10trimxtreme_6_align_6compare_prefixes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_ref, PyObject *__pyx_v_query, int __pyx_v_degenerate) {
  int __pyx_v_m;
  int __pyx_v_n;
  PyObject *__pyx_v_query_bytes = 0;
  PyObject *__pyx_v_ref_bytes = 0;
  char *__pyx_v_r_ptr;
  char *__pyx_v_q_ptr;
  int __pyx_v_wildcard_ref;
  int __pyx_v_wildcard_query;
  int __pyx_v_length;
  int __pyx_v_i;
  int __pyx_v_matches;
  int __pyx_v_compare_ascii;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  char *__pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("compare_prefixes", 0);

  /* "trimxtreme/_align.pyx":421
 * 	This function returns a tuple compatible with what Aligner.locate outputs.
 * 	"""
 * 	cdef int m = len(ref)             # <<<<<<<<<<<<<<
 * 	cdef int n = len(query)
 * 	cdef bytes query_bytes = query.encode('ascii')
 */
  __pyx_t_1 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_m = __pyx_t_1;

  /* "trimxtreme/_align.pyx":422
 * 	"""
 * 	cdef int m = len(ref)
 * 	cdef int n = len(query)             # <<<<<<<<<<<<<<
 * 	cdef bytes query_bytes = query.encode('ascii')
 * 	cdef bytes ref_bytes = ref.encode('ascii')
 */
  __pyx_t_1 = PyObject_Length(__pyx_v_query); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_n = __pyx_t_1;

  /* "trimxtreme/_align.pyx":423
 * 	cdef int m = len(ref)
 * 	cdef int n = len(query)
 * 	cdef bytes query_bytes = query.encode('ascii')             # <<<<<<<<<<<<<<
 * 	cdef bytes ref_bytes = ref.encode('ascii')
 * 	cdef char* r_ptr
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_query, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_query_bytes = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "trimxtreme/_align.pyx":424
 * 	cdef int n = len(query)
 * 	cdef bytes query_bytes = query.encode('ascii')
 * 	cdef bytes ref_bytes = ref.encode('ascii')             # <<<<<<<<<<<<<<
 * 	cdef char* r_ptr
 * 	cdef char* q_ptr
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_ref, __pyx_n_s_encode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(PyBytes_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_2)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_ref_bytes = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "trimxtreme/_align.pyx":427
 * 	cdef char* r_ptr
 * 	cdef char* q_ptr
 * 	cdef bint wildcard_ref = degenerate & ALLOW_WILDCARD_SEQ1             # <<<<<<<<<<<<<<
 * 	cdef bint wildcard_query = degenerate & ALLOW_WILDCARD_SEQ2
 * 	cdef int length = min(m, n)
 */
  __pyx_v_wildcard_ref = (__pyx_v_degenerate & 1);

  /* "trimxtreme/_align.pyx":428
 * 	cdef char* q_ptr
 * 	cdef bint wildcard_ref = degenerate & ALLOW_WILDCARD_SEQ1
 * 	cdef bint wildcard_query = degenerate & ALLOW_WILDCARD_SEQ2             # <<<<<<<<<<<<<<
 * 	cdef int length = min(m, n)
 * 	cdef int i, matches = 0
 */
  __pyx_v_wildcard_query = (__pyx_v_degenerate & 2);

  /* "trimxtreme/_align.pyx":429
 * 	cdef bint wildcard_ref = degenerate & ALLOW_WILDCARD_SEQ1
 * 	cdef bint wildcard_query = degenerate & ALLOW_WILDCARD_SEQ2
 * 	cdef int length = min(m, n)             # <<<<<<<<<<<<<<
 * 	cdef int i, matches = 0
 * 	cdef bint compare_ascii = False
 */
  __pyx_t_4 = __pyx_v_n;
  __pyx_t_5 = __pyx_v_m;
  if (((__pyx_t_4 < __pyx_t_5) != 0)) {
    __pyx_t_6 = __pyx_t_4;
  } else {
    __pyx_t_6 = __pyx_t_5;
  }
  __pyx_v_length = __pyx_t_6;

  /* "trimxtreme/_align.pyx":430
 * 	cdef bint wildcard_query = degenerate & ALLOW_WILDCARD_SEQ2
 * 	cdef int length = min(m, n)
 * 	cdef int i, matches = 0             # <<<<<<<<<<<<<<
 * 	cdef bint compare_ascii = False
 * 
 */
  __pyx_v_matches = 0;

  /* "trimxtreme/_align.pyx":431
 * 	cdef int length = min(m, n)
 * 	cdef int i, matches = 0
 * 	cdef bint compare_ascii = False             # <<<<<<<<<<<<<<
 * 
 * 	if wildcard_ref:
 */
  __pyx_v_compare_ascii = 0;

  /* "trimxtreme/_align.pyx":433
 * 	cdef bint compare_ascii = False
 * 
 * 	if wildcard_ref:             # <<<<<<<<<<<<<<
 * 		ref_bytes = ref_bytes.translate(IUPAC_TABLE)
 * 	elif wildcard_query:
 */
  __pyx_t_7 = (__pyx_v_wildcard_ref != 0);
  if (__pyx_t_7) {

    /* "trimxtreme/_align.pyx":434
 * 
 * 	if wildcard_ref:
 * 		ref_bytes = ref_bytes.translate(IUPAC_TABLE)             # <<<<<<<<<<<<<<
 * 	elif wildcard_query:
 * 		ref_bytes = ref_bytes.translate(ACGT_TABLE)
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_ref_bytes, __pyx_n_s_translate); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (!__pyx_t_8) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_10trimxtreme_6_align_IUPAC_TABLE); 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);
    } else {
      __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __pyx_t_8 = NULL;
      __Pyx_INCREF(__pyx_v_10trimxtreme_6_align_IUPAC_TABLE);
      PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_v_10trimxtreme_6_align_IUPAC_TABLE);
      __Pyx_GIVEREF(__pyx_v_10trimxtreme_6_align_IUPAC_TABLE);
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_9, 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_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (!(likely(PyBytes_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_2)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF_SET(__pyx_v_ref_bytes, ((PyObject*)__pyx_t_2));
    __pyx_t_2 = 0;
    goto __pyx_L3;
  }

  /* "trimxtreme/_align.pyx":435
 * 	if wildcard_ref:
 * 		ref_bytes = ref_bytes.translate(IUPAC_TABLE)
 * 	elif wildcard_query:             # <<<<<<<<<<<<<<
 * 		ref_bytes = ref_bytes.translate(ACGT_TABLE)
 * 	else:
 */
  __pyx_t_7 = (__pyx_v_wildcard_query != 0);
  if (__pyx_t_7) {

    /* "trimxtreme/_align.pyx":436
 * 		ref_bytes = ref_bytes.translate(IUPAC_TABLE)
 * 	elif wildcard_query:
 * 		ref_bytes = ref_bytes.translate(ACGT_TABLE)             # <<<<<<<<<<<<<<
 * 	else:
 * 		compare_ascii = True
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_ref_bytes, __pyx_n_s_translate); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_9 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (!__pyx_t_9) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_10trimxtreme_6_align_ACGT_TABLE); 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);
    } else {
      __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9); __Pyx_GIVEREF(__pyx_t_9); __pyx_t_9 = NULL;
      __Pyx_INCREF(__pyx_v_10trimxtreme_6_align_ACGT_TABLE);
      PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_v_10trimxtreme_6_align_ACGT_TABLE);
      __Pyx_GIVEREF(__pyx_v_10trimxtreme_6_align_ACGT_TABLE);
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); 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_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (!(likely(PyBytes_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_2)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF_SET(__pyx_v_ref_bytes, ((PyObject*)__pyx_t_2));
    __pyx_t_2 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "trimxtreme/_align.pyx":438
 * 		ref_bytes = ref_bytes.translate(ACGT_TABLE)
 * 	else:
 * 		compare_ascii = True             # <<<<<<<<<<<<<<
 * 	if wildcard_query:
 * 		query_bytes = query_bytes.translate(IUPAC_TABLE)
 */
    __pyx_v_compare_ascii = 1;
  }
  __pyx_L3:;

  /* "trimxtreme/_align.pyx":439
 * 	else:
 * 		compare_ascii = True
 * 	if wildcard_query:             # <<<<<<<<<<<<<<
 * 		query_bytes = query_bytes.translate(IUPAC_TABLE)
 * 	elif wildcard_ref:
 */
  __pyx_t_7 = (__pyx_v_wildcard_query != 0);
  if (__pyx_t_7) {

    /* "trimxtreme/_align.pyx":440
 * 		compare_ascii = True
 * 	if wildcard_query:
 * 		query_bytes = query_bytes.translate(IUPAC_TABLE)             # <<<<<<<<<<<<<<
 * 	elif wildcard_ref:
 * 		query_bytes = query_bytes.translate(ACGT_TABLE)
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_query_bytes, __pyx_n_s_translate); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (!__pyx_t_8) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_10trimxtreme_6_align_IUPAC_TABLE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
    } else {
      __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __pyx_t_8 = NULL;
      __Pyx_INCREF(__pyx_v_10trimxtreme_6_align_IUPAC_TABLE);
      PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_v_10trimxtreme_6_align_IUPAC_TABLE);
      __Pyx_GIVEREF(__pyx_v_10trimxtreme_6_align_IUPAC_TABLE);
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (!(likely(PyBytes_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_2)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF_SET(__pyx_v_query_bytes, ((PyObject*)__pyx_t_2));
    __pyx_t_2 = 0;
    goto __pyx_L4;
  }

  /* "trimxtreme/_align.pyx":441
 * 	if wildcard_query:
 * 		query_bytes = query_bytes.translate(IUPAC_TABLE)
 * 	elif wildcard_ref:             # <<<<<<<<<<<<<<
 * 		query_bytes = query_bytes.translate(ACGT_TABLE)
 * 
 */
  __pyx_t_7 = (__pyx_v_wildcard_ref != 0);
  if (__pyx_t_7) {

    /* "trimxtreme/_align.pyx":442
 * 		query_bytes = query_bytes.translate(IUPAC_TABLE)
 * 	elif wildcard_ref:
 * 		query_bytes = query_bytes.translate(ACGT_TABLE)             # <<<<<<<<<<<<<<
 * 
 * 	if compare_ascii:
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_query_bytes, __pyx_n_s_translate); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_9 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (!__pyx_t_9) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_10trimxtreme_6_align_ACGT_TABLE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
    } else {
      __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9); __Pyx_GIVEREF(__pyx_t_9); __pyx_t_9 = NULL;
      __Pyx_INCREF(__pyx_v_10trimxtreme_6_align_ACGT_TABLE);
      PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_v_10trimxtreme_6_align_ACGT_TABLE);
      __Pyx_GIVEREF(__pyx_v_10trimxtreme_6_align_ACGT_TABLE);
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (!(likely(PyBytes_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_2)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF_SET(__pyx_v_query_bytes, ((PyObject*)__pyx_t_2));
    __pyx_t_2 = 0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "trimxtreme/_align.pyx":444
 * 		query_bytes = query_bytes.translate(ACGT_TABLE)
 * 
 * 	if compare_ascii:             # <<<<<<<<<<<<<<
 * 		for i in range(length):
 * 			if ref[i] == query[i]:
 */
  __pyx_t_7 = (__pyx_v_compare_ascii != 0);
  if (__pyx_t_7) {

    /* "trimxtreme/_align.pyx":445
 * 
 * 	if compare_ascii:
 * 		for i in range(length):             # <<<<<<<<<<<<<<
 * 			if ref[i] == query[i]:
 * 				matches += 1
 */
    __pyx_t_6 = __pyx_v_length;
    for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_6; __pyx_t_4+=1) {
      __pyx_v_i = __pyx_t_4;

      /* "trimxtreme/_align.pyx":446
 * 	if compare_ascii:
 * 		for i in range(length):
 * 			if ref[i] == query[i]:             # <<<<<<<<<<<<<<
 * 				matches += 1
 * 	else:
 */
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_ref, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_query, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_8 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (__pyx_t_7) {

        /* "trimxtreme/_align.pyx":447
 * 		for i in range(length):
 * 			if ref[i] == query[i]:
 * 				matches += 1             # <<<<<<<<<<<<<<
 * 	else:
 * 		r_ptr = ref_bytes
 */
        __pyx_v_matches = (__pyx_v_matches + 1);
        goto __pyx_L8;
      }
      __pyx_L8:;
    }
    goto __pyx_L5;
  }
  /*else*/ {

    /* "trimxtreme/_align.pyx":449
 * 				matches += 1
 * 	else:
 * 		r_ptr = ref_bytes             # <<<<<<<<<<<<<<
 * 		q_ptr = query_bytes
 * 		for i in range(length):
 */
    __pyx_t_10 = __Pyx_PyObject_AsString(__pyx_v_ref_bytes); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_r_ptr = __pyx_t_10;

    /* "trimxtreme/_align.pyx":450
 * 	else:
 * 		r_ptr = ref_bytes
 * 		q_ptr = query_bytes             # <<<<<<<<<<<<<<
 * 		for i in range(length):
 * 			if (r_ptr[i] & q_ptr[i]) != 0:
 */
    __pyx_t_10 = __Pyx_PyObject_AsString(__pyx_v_query_bytes); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_q_ptr = __pyx_t_10;

    /* "trimxtreme/_align.pyx":451
 * 		r_ptr = ref_bytes
 * 		q_ptr = query_bytes
 * 		for i in range(length):             # <<<<<<<<<<<<<<
 * 			if (r_ptr[i] & q_ptr[i]) != 0:
 * 				matches += 1
 */
    __pyx_t_6 = __pyx_v_length;
    for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_6; __pyx_t_4+=1) {
      __pyx_v_i = __pyx_t_4;

      /* "trimxtreme/_align.pyx":452
 * 		q_ptr = query_bytes
 * 		for i in range(length):
 * 			if (r_ptr[i] & q_ptr[i]) != 0:             # <<<<<<<<<<<<<<
 * 				matches += 1
 * 
 */
      __pyx_t_7 = ((((__pyx_v_r_ptr[__pyx_v_i]) & (__pyx_v_q_ptr[__pyx_v_i])) != 0) != 0);
      if (__pyx_t_7) {

        /* "trimxtreme/_align.pyx":453
 * 		for i in range(length):
 * 			if (r_ptr[i] & q_ptr[i]) != 0:
 * 				matches += 1             # <<<<<<<<<<<<<<
 * 
 * 	# length - matches = no. of errors
 */
        __pyx_v_matches = (__pyx_v_matches + 1);
        goto __pyx_L11;
      }
      __pyx_L11:;
    }
  }
  __pyx_L5:;

  /* "trimxtreme/_align.pyx":456
 * 
 * 	# length - matches = no. of errors
 * 	return (0, length, 0, length, matches, length - matches)             # <<<<<<<<<<<<<<
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_length); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_length); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_matches); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_9 = __Pyx_PyInt_From_int((__pyx_v_length - __pyx_v_matches)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_11 = PyTuple_New(6); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_8);
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_11, 3, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_11, 4, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_11, 5, __pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_9);
  __pyx_t_8 = 0;
  __pyx_t_3 = 0;
  __pyx_t_2 = 0;
  __pyx_t_9 = 0;
  __pyx_r = __pyx_t_11;
  __pyx_t_11 = 0;
  goto __pyx_L0;

  /* "trimxtreme/_align.pyx":410
 * 
 * 
 * def compare_prefixes(str ref, str query, int degenerate=0):             # <<<<<<<<<<<<<<
 * 	"""
 * 	Find out whether one string is the prefix of the other one, allowing
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("trimxtreme._align.compare_prefixes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_query_bytes);
  __Pyx_XDECREF(__pyx_v_ref_bytes);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_tp_new_10trimxtreme_6_align_Aligner(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_10trimxtreme_6_align_Aligner *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_10trimxtreme_6_align_Aligner *)o);
  p->_reference = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_10trimxtreme_6_align_7Aligner_1__cinit__(o, a, k) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_10trimxtreme_6_align_Aligner(PyObject *o) {
  struct __pyx_obj_10trimxtreme_6_align_Aligner *p = (struct __pyx_obj_10trimxtreme_6_align_Aligner *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_10trimxtreme_6_align_7Aligner_5__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->_reference);
  (*Py_TYPE(o)->tp_free)(o);
}

static PyObject *__pyx_getprop_10trimxtreme_6_align_7Aligner_reference(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_10trimxtreme_6_align_7Aligner_9reference_1__get__(o);
}

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

static PyMethodDef __pyx_methods_10trimxtreme_6_align_Aligner[] = {
  {"locate", (PyCFunction)__pyx_pw_10trimxtreme_6_align_7Aligner_3locate, METH_O, __pyx_doc_10trimxtreme_6_align_7Aligner_2locate},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_10trimxtreme_6_align_Aligner[] = {
  {(char *)"reference", __pyx_getprop_10trimxtreme_6_align_7Aligner_reference, __pyx_setprop_10trimxtreme_6_align_7Aligner_reference, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_10trimxtreme_6_align_Aligner = {
  PyVarObject_HEAD_INIT(0, 0)
  "trimxtreme._align.Aligner", /*tp_name*/
  sizeof(struct __pyx_obj_10trimxtreme_6_align_Aligner), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_10trimxtreme_6_align_Aligner, /*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, /*tp_flags*/
  "\n\tTODO documentation still uses s1 (reference) and s2 (query).\n\n\tLocate one string within another by computing an optimal semiglobal\n\talignment between string1 and string2.\n\n\tThe alignment uses unit costs, which means that mismatches, insertions and deletions are\n\tcounted as one error.\n\n\tflags is a bitwise 'or' of the allowed flags.\n\tTo allow skipping of a prefix of string1 at no cost, set the\n\tSTART_WITHIN_SEQ1 flag.\n\tTo allow skipping of a prefix of string2 at no cost, set the\n\tSTART_WITHIN_SEQ2 flag.\n\tIf both are set, a prefix of string1 or of string1 is skipped,\n\tnever both.\n\tSimilarly, set STOP_WITHIN_SEQ1 and STOP_WITHIN_SEQ2 to\n\tallow skipping of suffixes of string1 or string2. Again, when both\n\tflags are set, never suffixes in both strings are skipped.\n\tIf all flags are set, this results in standard semiglobal alignment.\n\n\tThe skipped parts are described with two intervals (start1, stop1),\n\t(start2, stop2).\n\n\tFor example, an optimal semiglobal alignment of SISSI and MISSISSIPPI looks like this:\n\n\t---SISSI---\n\tMISSISSIPPI\n\n\tstart1, stop1 = 0, 5\n\tstart2, stop2 = 3, 8\n\t(with zero errors)\n\n\tThe aligned parts are string1[start1:stop1] and string2[start2:stop2].\n\n\tThe error rate is: errors / length where length is (stop1 - start1).\n\n\tAn optimal alignment fulfills all of these criteria:\n\n\t- its error_rate is at most max_error_rate\n\t- Among those alignments with error_rate <= max_error_rate, the alignment contains\n\t  a maximal number of matches (there is no alignment with more matches).\n\t- If there are multiple alignments with the same no. of matches, then one that\n\t  has minimal no. of errors is chosen.\n\t- If there are still multiple candidates, choose the alignment that starts at the\n\t  leftmost position within the read.\n\n\tThe alignment itself is not returned, only the tuple\n\t(start1, stop1, start2, stop2, matches, errors), where the first four fields have the\n\tmeaning as described, matches is the number of matches and errors is the number of\n\terrors in the alignment.\n\n\tIt is always the case that at least one of start1 and start2 is zero.\n\n\tIUPAC wildcard characters can be allowed in the reference and the query\n\tby setting the appropriate bit in the 'degenerate' flag.\n\n\tIf neither flag is set, the full ASCII alphabet is used for comparison.\n\tIf any of the flags is set, all non-IUPAC characters in the sequences\n\tcompare as 'not equal'.\n\t", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_10trimxtreme_6_align_Aligner, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_10trimxtreme_6_align_Aligner, /*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_10trimxtreme_6_align_Aligner, /*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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyMethodDef __pyx_methods[] = {
  {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
    "_align",
    0, /* 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_kp_b_, __pyx_k_, sizeof(__pyx_k_), 0, 0, 0, 0},
  {&__pyx_n_s_A, __pyx_k_A, sizeof(__pyx_k_A), 0, 0, 1, 1},
  {&__pyx_n_s_B, __pyx_k_B, sizeof(__pyx_k_B), 0, 0, 1, 1},
  {&__pyx_n_s_C, __pyx_k_C, sizeof(__pyx_k_C), 0, 0, 1, 1},
  {&__pyx_n_s_D, __pyx_k_D, sizeof(__pyx_k_D), 0, 0, 1, 1},
  {&__pyx_n_s_G, __pyx_k_G, sizeof(__pyx_k_G), 0, 0, 1, 1},
  {&__pyx_n_s_H, __pyx_k_H, sizeof(__pyx_k_H), 0, 0, 1, 1},
  {&__pyx_n_s_K, __pyx_k_K, sizeof(__pyx_k_K), 0, 0, 1, 1},
  {&__pyx_n_s_M, __pyx_k_M, sizeof(__pyx_k_M), 0, 0, 1, 1},
  {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
  {&__pyx_n_s_N, __pyx_k_N, sizeof(__pyx_k_N), 0, 0, 1, 1},
  {&__pyx_n_s_R, __pyx_k_R, sizeof(__pyx_k_R), 0, 0, 1, 1},
  {&__pyx_n_s_S, __pyx_k_S, sizeof(__pyx_k_S), 0, 0, 1, 1},
  {&__pyx_n_s_T, __pyx_k_T, sizeof(__pyx_k_T), 0, 0, 1, 1},
  {&__pyx_n_s_U, __pyx_k_U, sizeof(__pyx_k_U), 0, 0, 1, 1},
  {&__pyx_n_s_V, __pyx_k_V, sizeof(__pyx_k_V), 0, 0, 1, 1},
  {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
  {&__pyx_n_s_W, __pyx_k_W, sizeof(__pyx_k_W), 0, 0, 1, 1},
  {&__pyx_n_s_X, __pyx_k_X, sizeof(__pyx_k_X), 0, 0, 1, 1},
  {&__pyx_n_s_Y, __pyx_k_Y, sizeof(__pyx_k_Y), 0, 0, 1, 1},
  {&__pyx_n_s_acgt_table, __pyx_k_acgt_table, sizeof(__pyx_k_acgt_table), 0, 0, 1, 1},
  {&__pyx_n_s_aligner, __pyx_k_aligner, sizeof(__pyx_k_aligner), 0, 0, 1, 1},
  {&__pyx_n_s_ascii, __pyx_k_ascii, sizeof(__pyx_k_ascii), 0, 0, 1, 1},
  {&__pyx_kp_s_bi_home_rocks_av_cegx_barcoding, __pyx_k_bi_home_rocks_av_cegx_barcoding, sizeof(__pyx_k_bi_home_rocks_av_cegx_barcoding), 0, 0, 1, 0},
  {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1},
  {&__pyx_n_s_compare_ascii, __pyx_k_compare_ascii, sizeof(__pyx_k_compare_ascii), 0, 0, 1, 1},
  {&__pyx_n_s_compare_prefixes, __pyx_k_compare_prefixes, sizeof(__pyx_k_compare_prefixes), 0, 0, 1, 1},
  {&__pyx_n_s_d, __pyx_k_d, sizeof(__pyx_k_d), 0, 0, 1, 1},
  {&__pyx_n_s_degenerate, __pyx_k_degenerate, sizeof(__pyx_k_degenerate), 0, 0, 1, 1},
  {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
  {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1},
  {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
  {&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1},
  {&__pyx_n_s_iupac_table, __pyx_k_iupac_table, sizeof(__pyx_k_iupac_table), 0, 0, 1, 1},
  {&__pyx_n_s_length, __pyx_k_length, sizeof(__pyx_k_length), 0, 0, 1, 1},
  {&__pyx_n_s_locate, __pyx_k_locate, sizeof(__pyx_k_locate), 0, 0, 1, 1},
  {&__pyx_n_s_lower, __pyx_k_lower, sizeof(__pyx_k_lower), 0, 0, 1, 1},
  {&__pyx_n_s_m, __pyx_k_m, sizeof(__pyx_k_m), 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_max_error_rate, __pyx_k_max_error_rate, sizeof(__pyx_k_max_error_rate), 0, 0, 1, 1},
  {&__pyx_n_s_min_overlap, __pyx_k_min_overlap, sizeof(__pyx_k_min_overlap), 0, 0, 1, 1},
  {&__pyx_kp_s_minimum_overlap_must_be_at_least, __pyx_k_minimum_overlap_must_be_at_least, sizeof(__pyx_k_minimum_overlap_must_be_at_least), 0, 0, 1, 0},
  {&__pyx_n_s_n, __pyx_k_n, sizeof(__pyx_k_n), 0, 0, 1, 1},
  {&__pyx_n_s_ord, __pyx_k_ord, sizeof(__pyx_k_ord), 0, 0, 1, 1},
  {&__pyx_n_s_q_ptr, __pyx_k_q_ptr, sizeof(__pyx_k_q_ptr), 0, 0, 1, 1},
  {&__pyx_n_s_query, __pyx_k_query, sizeof(__pyx_k_query), 0, 0, 1, 1},
  {&__pyx_n_s_query_bytes, __pyx_k_query_bytes, sizeof(__pyx_k_query_bytes), 0, 0, 1, 1},
  {&__pyx_n_s_r_ptr, __pyx_k_r_ptr, sizeof(__pyx_k_r_ptr), 0, 0, 1, 1},
  {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
  {&__pyx_n_s_ref, __pyx_k_ref, sizeof(__pyx_k_ref), 0, 0, 1, 1},
  {&__pyx_n_s_ref_bytes, __pyx_k_ref_bytes, sizeof(__pyx_k_ref_bytes), 0, 0, 1, 1},
  {&__pyx_n_s_reference, __pyx_k_reference, sizeof(__pyx_k_reference), 0, 0, 1, 1},
  {&__pyx_n_s_t, __pyx_k_t, sizeof(__pyx_k_t), 0, 0, 1, 1},
  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
  {&__pyx_n_s_translate, __pyx_k_translate, sizeof(__pyx_k_translate), 0, 0, 1, 1},
  {&__pyx_n_s_trimxtreme__align, __pyx_k_trimxtreme__align, sizeof(__pyx_k_trimxtreme__align), 0, 0, 1, 1},
  {&__pyx_n_s_v, __pyx_k_v, sizeof(__pyx_k_v), 0, 0, 1, 1},
  {&__pyx_n_s_wildcard_query, __pyx_k_wildcard_query, sizeof(__pyx_k_wildcard_query), 0, 0, 1, 1},
  {&__pyx_n_s_wildcard_ref, __pyx_k_wildcard_ref, sizeof(__pyx_k_wildcard_ref), 0, 0, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_ord = __Pyx_GetBuiltinName(__pyx_n_s_ord); if (!__pyx_builtin_ord) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __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 = 180; __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;}
  return 0;
  __pyx_L1_error:;
  return -1;
}

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

  /* "trimxtreme/_align.pyx":41
 * 	"""
 * 	d = dict(A=1, C=2, G=4, T=8, U=8)
 * 	t = bytearray(b'\0') * 256             # <<<<<<<<<<<<<<
 * 	for c, v in d.items():
 * 		t[ord(c)] = v
 */
  __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_b_); if (unlikely(!__pyx_tuple__2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__2);
  __Pyx_GIVEREF(__pyx_tuple__2);

  /* "trimxtreme/_align.pyx":81
 * 		N=A|C|G|T
 * 	)
 * 	t = bytearray(b'\0') * 256             # <<<<<<<<<<<<<<
 * 	for c, v in d.items():
 * 		t[ord(c)] = v
 */
  __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_b_); if (unlikely(!__pyx_tuple__3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__3);
  __Pyx_GIVEREF(__pyx_tuple__3);

  /* "trimxtreme/_align.pyx":170
 * 		self.reference = reference
 * 		if min_overlap < 1:
 * 			raise ValueError("minimum overlap must be at least 1")             # <<<<<<<<<<<<<<
 * 		self.min_overlap = min_overlap
 * 
 */
  __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_minimum_overlap_must_be_at_least); if (unlikely(!__pyx_tuple__4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__4);
  __Pyx_GIVEREF(__pyx_tuple__4);

  /* "trimxtreme/_align.pyx":182
 * 				raise MemoryError()
 * 			self.column = mem
 * 			self._reference = reference.encode('ascii')             # <<<<<<<<<<<<<<
 * 			self.m = len(reference)
 * 			if self.wildcard_ref:
 */
  __pyx_tuple__5 = PyTuple_Pack(1, __pyx_n_s_ascii); if (unlikely(!__pyx_tuple__5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__5);
  __Pyx_GIVEREF(__pyx_tuple__5);

  /* "trimxtreme/_align.pyx":204
 * 		"""
 * 		cdef char* s1 = self._reference
 * 		cdef bytes query_bytes = query.encode('ascii')             # <<<<<<<<<<<<<<
 * 		cdef char* s2 = query_bytes
 * 		cdef int m = self.m
 */
  __pyx_tuple__6 = PyTuple_Pack(1, __pyx_n_s_ascii); if (unlikely(!__pyx_tuple__6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__6);
  __Pyx_GIVEREF(__pyx_tuple__6);

  /* "trimxtreme/_align.pyx":423
 * 	cdef int m = len(ref)
 * 	cdef int n = len(query)
 * 	cdef bytes query_bytes = query.encode('ascii')             # <<<<<<<<<<<<<<
 * 	cdef bytes ref_bytes = ref.encode('ascii')
 * 	cdef char* r_ptr
 */
  __pyx_tuple__7 = PyTuple_Pack(1, __pyx_n_s_ascii); if (unlikely(!__pyx_tuple__7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__7);
  __Pyx_GIVEREF(__pyx_tuple__7);

  /* "trimxtreme/_align.pyx":424
 * 	cdef int n = len(query)
 * 	cdef bytes query_bytes = query.encode('ascii')
 * 	cdef bytes ref_bytes = ref.encode('ascii')             # <<<<<<<<<<<<<<
 * 	cdef char* r_ptr
 * 	cdef char* q_ptr
 */
  __pyx_tuple__8 = PyTuple_Pack(1, __pyx_n_s_ascii); if (unlikely(!__pyx_tuple__8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__8);
  __Pyx_GIVEREF(__pyx_tuple__8);

  /* "trimxtreme/_align.pyx":32
 * 
 * 
 * def _acgt_table():             # <<<<<<<<<<<<<<
 * 	"""
 * 	Return a translation table that maps A, C, G, T characters to the lower
 */
  __pyx_tuple__9 = PyTuple_Pack(4, __pyx_n_s_d, __pyx_n_s_t, __pyx_n_s_c, __pyx_n_s_v); if (unlikely(!__pyx_tuple__9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__9);
  __Pyx_GIVEREF(__pyx_tuple__9);
  __pyx_codeobj__10 = (PyObject*)__Pyx_PyCode_New(0, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__9, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_bi_home_rocks_av_cegx_barcoding, __pyx_n_s_acgt_table, 32, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "trimxtreme/_align.pyx":48
 * 
 * 
 * def _iupac_table():             # <<<<<<<<<<<<<<
 * 	"""
 * 	Return a translation table for IUPAC characters.
 */
  __pyx_tuple__11 = PyTuple_Pack(8, __pyx_n_s_A, __pyx_n_s_C, __pyx_n_s_G, __pyx_n_s_T, __pyx_n_s_d, __pyx_n_s_t, __pyx_n_s_c, __pyx_n_s_v); if (unlikely(!__pyx_tuple__11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__11);
  __Pyx_GIVEREF(__pyx_tuple__11);
  __pyx_codeobj__12 = (PyObject*)__Pyx_PyCode_New(0, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__11, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_bi_home_rocks_av_cegx_barcoding, __pyx_n_s_iupac_table, 48, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "trimxtreme/_align.pyx":405
 * 
 * 
 * def locate(str reference, str query, double max_error_rate, int flags=SEMIGLOBAL, int degenerate=0, int min_overlap=1):             # <<<<<<<<<<<<<<
 * 	aligner = Aligner(reference, max_error_rate, flags, degenerate, min_overlap)
 * 	return aligner.locate(query)
 */
  __pyx_tuple__13 = PyTuple_Pack(7, __pyx_n_s_reference, __pyx_n_s_query, __pyx_n_s_max_error_rate, __pyx_n_s_flags, __pyx_n_s_degenerate, __pyx_n_s_min_overlap, __pyx_n_s_aligner); if (unlikely(!__pyx_tuple__13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__13);
  __Pyx_GIVEREF(__pyx_tuple__13);
  __pyx_codeobj__14 = (PyObject*)__Pyx_PyCode_New(6, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__13, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_bi_home_rocks_av_cegx_barcoding, __pyx_n_s_locate, 405, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "trimxtreme/_align.pyx":410
 * 
 * 
 * def compare_prefixes(str ref, str query, int degenerate=0):             # <<<<<<<<<<<<<<
 * 	"""
 * 	Find out whether one string is the prefix of the other one, allowing
 */
  __pyx_tuple__15 = PyTuple_Pack(15, __pyx_n_s_ref, __pyx_n_s_query, __pyx_n_s_degenerate, __pyx_n_s_m, __pyx_n_s_n, __pyx_n_s_query_bytes, __pyx_n_s_ref_bytes, __pyx_n_s_r_ptr, __pyx_n_s_q_ptr, __pyx_n_s_wildcard_ref, __pyx_n_s_wildcard_query, __pyx_n_s_length, __pyx_n_s_i, __pyx_n_s_matches, __pyx_n_s_compare_ascii); if (unlikely(!__pyx_tuple__15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__15);
  __Pyx_GIVEREF(__pyx_tuple__15);
  __pyx_codeobj__16 = (PyObject*)__Pyx_PyCode_New(3, 0, 15, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__15, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_bi_home_rocks_av_cegx_barcoding, __pyx_n_s_compare_prefixes, 410, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __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;}
  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_int_8 = PyInt_FromLong(8); if (unlikely(!__pyx_int_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_int_256 = PyInt_FromLong(256); if (unlikely(!__pyx_int_256)) {__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_align(void); /*proto*/
PyMODINIT_FUNC init_align(void)
#else
PyMODINIT_FUNC PyInit__align(void); /*proto*/
PyMODINIT_FUNC PyInit__align(void)
#endif
{
  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_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__align(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("_align", __pyx_methods, 0, 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_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 (PyObject_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_trimxtreme___align) {
    if (PyObject_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, "trimxtreme._align")) {
      if (unlikely(PyDict_SetItemString(modules, "trimxtreme._align", __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 ---*/
  __pyx_v_10trimxtreme_6_align_ACGT_TABLE = ((PyObject*)Py_None); Py_INCREF(Py_None);
  __pyx_v_10trimxtreme_6_align_IUPAC_TABLE = ((PyObject*)Py_None); Py_INCREF(Py_None);
  /*--- Variable export code ---*/
  /*--- Function export code ---*/
  /*--- Type init code ---*/
  if (PyType_Ready(&__pyx_type_10trimxtreme_6_align_Aligner) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_10trimxtreme_6_align_Aligner.tp_print = 0;
  if (PyObject_SetAttrString(__pyx_m, "Aligner", (PyObject *)&__pyx_type_10trimxtreme_6_align_Aligner) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_10trimxtreme_6_align_Aligner = &__pyx_type_10trimxtreme_6_align_Aligner;
  /*--- Type import code ---*/
  /*--- Variable import code ---*/
  /*--- Function import code ---*/
  /*--- Execution code ---*/

  /* "trimxtreme/_align.pyx":32
 * 
 * 
 * def _acgt_table():             # <<<<<<<<<<<<<<
 * 	"""
 * 	Return a translation table that maps A, C, G, T characters to the lower
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10trimxtreme_6_align_1_acgt_table, NULL, __pyx_n_s_trimxtreme__align); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_acgt_table, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "trimxtreme/_align.pyx":48
 * 
 * 
 * def _iupac_table():             # <<<<<<<<<<<<<<
 * 	"""
 * 	Return a translation table for IUPAC characters.
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10trimxtreme_6_align_3_iupac_table, NULL, __pyx_n_s_trimxtreme__align); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_iupac_table, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "trimxtreme/_align.pyx":88
 * 
 * 
 * cdef bytes ACGT_TABLE = _acgt_table()             # <<<<<<<<<<<<<<
 * cdef bytes IUPAC_TABLE = _iupac_table()
 * 
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_acgt_table); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XGOTREF(__pyx_v_10trimxtreme_6_align_ACGT_TABLE);
  __Pyx_DECREF_SET(__pyx_v_10trimxtreme_6_align_ACGT_TABLE, ((PyObject*)__pyx_t_1));
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "trimxtreme/_align.pyx":89
 * 
 * cdef bytes ACGT_TABLE = _acgt_table()
 * cdef bytes IUPAC_TABLE = _iupac_table()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_iupac_table); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XGOTREF(__pyx_v_10trimxtreme_6_align_IUPAC_TABLE);
  __Pyx_DECREF_SET(__pyx_v_10trimxtreme_6_align_IUPAC_TABLE, ((PyObject*)__pyx_t_1));
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "trimxtreme/_align.pyx":405
 * 
 * 
 * def locate(str reference, str query, double max_error_rate, int flags=SEMIGLOBAL, int degenerate=0, int min_overlap=1):             # <<<<<<<<<<<<<<
 * 	aligner = Aligner(reference, max_error_rate, flags, degenerate, min_overlap)
 * 	return aligner.locate(query)
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10trimxtreme_6_align_5locate, NULL, __pyx_n_s_trimxtreme__align); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_locate, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "trimxtreme/_align.pyx":410
 * 
 * 
 * def compare_prefixes(str ref, str query, int degenerate=0):             # <<<<<<<<<<<<<<
 * 	"""
 * 	Find out whether one string is the prefix of the other one, allowing
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10trimxtreme_6_align_7compare_prefixes, NULL, __pyx_n_s_trimxtreme__align); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_compare_prefixes, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "trimxtreme/_align.pyx":1
 * from cpython.mem cimport PyMem_Malloc, PyMem_Free, PyMem_Realloc             # <<<<<<<<<<<<<<
 * 
 * DEF START_WITHIN_SEQ1 = 1
 */
  __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;

  /*--- Wrapped vars code ---*/

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  if (__pyx_m) {
    if (__pyx_d) {
      __Pyx_AddTraceback("init trimxtreme._align", __pyx_clineno, __pyx_lineno, __pyx_filename);
    }
    Py_DECREF(__pyx_m); __pyx_m = 0;
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init trimxtreme._align");
  }
  __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

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 (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
    result = (*call)(func, arg, kw);
    Py_LeaveRecursiveCall();
    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 PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
    PyObject *self, *result;
    PyCFunction cfunc;
    cfunc = PyCFunction_GET_FUNCTION(func);
    self = PyCFunction_GET_SELF(func);
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
    result = cfunc(self, arg);
    Py_LeaveRecursiveCall();
    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 PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *result;
    PyObject *args = PyTuple_New(1);
    if (unlikely(!args)) return NULL;
    Py_INCREF(arg);
    PyTuple_SET_ITEM(args, 0, arg);
    result = __Pyx_PyObject_Call(func, args, NULL);
    Py_DECREF(args);
    return result;
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
#ifdef __Pyx_CyFunction_USED
    if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
#else
    if (likely(PyCFunction_Check(func))) {
#endif
        if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
            return __Pyx_PyObject_CallMethO(func, arg);
        }
    }
    return __Pyx__PyObject_CallOneArg(func, arg);
}
#else
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject* args = PyTuple_Pack(1, arg);
    return (likely(args)) ? __Pyx_PyObject_Call(func, args, NULL) : NULL;
}
#endif

static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
    PyObject *method, *result = NULL;
    method = __Pyx_PyObject_GetAttrStr(obj, method_name);
    if (unlikely(!method)) goto bad;
#if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyMethod_Check(method))) {
        PyObject *self = PyMethod_GET_SELF(method);
        if (likely(self)) {
            PyObject *args;
            PyObject *function = PyMethod_GET_FUNCTION(method);
            args = PyTuple_New(2);
            if (unlikely(!args)) goto bad;
            Py_INCREF(self);
            PyTuple_SET_ITEM(args, 0, self);
            Py_INCREF(arg);
            PyTuple_SET_ITEM(args, 1, arg);
            Py_INCREF(function);
            Py_DECREF(method); method = NULL;
            result = __Pyx_PyObject_Call(function, args, NULL);
            Py_DECREF(args);
            Py_DECREF(function);
            return result;
        }
    }
#endif
    result = __Pyx_PyObject_CallOneArg(method, arg);
bad:
    Py_XDECREF(method);
    return result;
}

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 void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
    PyErr_Format(PyExc_ValueError,
                 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
}

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 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 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;
}

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
#ifdef __Pyx_CyFunction_USED
    if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
#else
    if (likely(PyCFunction_Check(func))) {
#endif
        if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
            return __Pyx_PyObject_CallMethO(func, NULL);
        }
    }
    return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
}
#endif

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_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_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 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 (PyType_Check(type)) {
#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;
        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;
        }
    }
    __Pyx_ErrRestore(type, value, tb);
    return;
raise_error:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}
#else
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) {
#if CYTHON_COMPILING_IN_PYPY
        PyObject *tmp_type, *tmp_value, *tmp_tb;
        PyErr_Fetch(tmp_type, tmp_value, tmp_tb);
        Py_INCREF(tb);
        PyErr_Restore(tmp_type, tmp_value, tb);
        Py_XDECREF(tmp_tb);
#else
        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);
        }
#endif
    }
bad:
    Py_XDECREF(owned_instance);
    return;
}
#endif

static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
    PyObject *r;
    if (!j) return NULL;
    r = PyObject_GetItem(o, j);
    Py_DECREF(j);
    return r;
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck) {
#if CYTHON_COMPILING_IN_CPYTHON
    if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o);
    if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
        PyObject *r = PyList_GET_ITEM(o, i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck) {
#if CYTHON_COMPILING_IN_CPYTHON
    if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o);
    if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
        PyObject *r = PyTuple_GET_ITEM(o, i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
                                                     int is_list, int wraparound, int boundscheck) {
#if CYTHON_COMPILING_IN_CPYTHON
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
        if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) {
            PyObject *r = PyList_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    }
    else if (PyTuple_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
        if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
            PyObject *r = PyTuple_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    } else {
        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
        if (likely(m && m->sq_item)) {
            if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
                Py_ssize_t l = m->sq_length(o);
                if (likely(l >= 0)) {
                    i += l;
                } else {
                    if (PyErr_ExceptionMatches(PyExc_OverflowError))
                        PyErr_Clear();
                    else
                        return NULL;
                }
            }
            return m->sq_item(o, i);
        }
    }
#else
    if (is_list || PySequence_Check(o)) {
        return PySequence_GetItem(o, i);
    }
#endif
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
}

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

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, (size_t)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,
        0,
        0,
        0,
        0,
        __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,
        __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;
    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_frame = PyFrame_New(
        PyThreadState_GET(), /*PyThreadState *tstate,*/
        py_code,             /*PyCodeObject *code,*/
        __pyx_d,      /*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);
}

#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)       \
    {                                                                     \
        func_type value = func_value;                                     \
        if (sizeof(target_type) < sizeof(func_type)) {                    \
            if (unlikely(value != (func_type) (target_type) value)) {     \
                func_type zero = 0;                                       \
                if (is_unsigned && unlikely(value < zero))                \
                    goto raise_neg_overflow;                              \
                else                                                      \
                    goto raise_overflow;                                  \
            }                                                             \
        }                                                                 \
        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 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(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            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
            switch (Py_SIZE(x)) {
                case  0: return 0;
                case  1: __PYX_VERIFY_RETURN_INT(int, digit, ((PyLongObject*)x)->ob_digit[0]);
            }
 #endif
#endif
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
            if (sizeof(int) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT(int, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(int) <= sizeof(unsigned long long)) {
                __PYX_VERIFY_RETURN_INT(int, unsigned long long, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            switch (Py_SIZE(x)) {
                case  0: return 0;
                case  1: __PYX_VERIFY_RETURN_INT(int,  digit, +(((PyLongObject*)x)->ob_digit[0]));
                case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
            }
 #endif
#endif
            if (sizeof(int) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT(int, long, PyLong_AsLong(x))
            } else if (sizeof(int) <= sizeof(long long)) {
                __PYX_VERIFY_RETURN_INT(int, long long, PyLong_AsLongLong(x))
            }
        }
        {
#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;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to int");
    return (int) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to int");
    return (int) -1;
}

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);
    }
}

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 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(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            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
            switch (Py_SIZE(x)) {
                case  0: return 0;
                case  1: __PYX_VERIFY_RETURN_INT(long, digit, ((PyLongObject*)x)->ob_digit[0]);
            }
 #endif
#endif
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
            if (sizeof(long) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT(long, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(long) <= sizeof(unsigned long long)) {
                __PYX_VERIFY_RETURN_INT(long, unsigned long long, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            switch (Py_SIZE(x)) {
                case  0: return 0;
                case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +(((PyLongObject*)x)->ob_digit[0]));
                case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
            }
 #endif
#endif
            if (sizeof(long) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT(long, long, PyLong_AsLong(x))
            } else if (sizeof(long) <= sizeof(long long)) {
                __PYX_VERIFY_RETURN_INT(long, long long, PyLong_AsLongLong(x))
            }
        }
        {
#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;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to long");
    return (long) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to long");
    return (long) -1;
}

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);
        return PyErr_WarnEx(NULL, message, 1);
    }
    return 0;
}

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
        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(const char* c_str) {
    return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)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
        *length = PyBytes_GET_SIZE(defenc);
        return defenc_c;
#else
        if (__Pyx_PyUnicode_READY(o) == -1) return NULL;
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
        if (PyUnicode_IS_ASCII(o)) {
            *length = PyUnicode_GET_LENGTH(o);
            return PyUnicode_AsUTF8(o);
        } else {
            PyUnicode_AsASCIIString(o);
            return NULL;
        }
#else
        return PyUnicode_AsUTF8AndSize(o, length);
#endif
#endif
    } else
#endif
#if !CYTHON_COMPILING_IN_PYPY
    if (PyByteArray_Check(o)) {
        *length = PyByteArray_GET_SIZE(o);
        return PyByteArray_AS_STRING(o);
    } else
#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;
}
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
    return PyLong_AsSsize_t(b);
  }
  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) {
    return PyInt_FromSize_t(ival);
}


#endif /* Py_PYTHON_H */
