/* Generated by Cython 0.11.1 on Thu Oct  8 10:28:02 2009 */

#define PY_SSIZE_T_CLEAN
#include "Python.h"
#include "structmember.h"
#ifndef Py_PYTHON_H
    #error Python headers needed to compile C extensions, please install development version of Python.
#endif
#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif
#ifndef DL_EXPORT
  #define DL_EXPORT(t) t
#endif
#if PY_VERSION_HEX < 0x02040000
  #define METH_COEXIST 0
  #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type)
#endif
#if PY_VERSION_HEX < 0x02050000
  typedef int Py_ssize_t;
  #define PY_SSIZE_T_MAX INT_MAX
  #define PY_SSIZE_T_MIN INT_MIN
  #define PY_FORMAT_SIZE_T ""
  #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
  #define PyInt_AsSsize_t(o)   PyInt_AsLong(o)
  #define PyNumber_Index(o)    PyNumber_Int(o)
  #define PyIndex_Check(o)     PyNumber_Check(o)
#endif
#if PY_VERSION_HEX < 0x02060000
  #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
  #define Py_TYPE(ob)   (((PyObject*)(ob))->ob_type)
  #define Py_SIZE(ob)   (((PyVarObject*)(ob))->ob_size)
  #define PyVarObject_HEAD_INIT(type, size) \
          PyObject_HEAD_INIT(type) size,
  #define PyType_Modified(t)

  typedef struct {
       void *buf;
       PyObject *obj;
       Py_ssize_t len;
       Py_ssize_t itemsize;
       int readonly;
       int ndim;
       char *format;
       Py_ssize_t *shape;
       Py_ssize_t *strides;
       Py_ssize_t *suboffsets;
       void *internal;
  } Py_buffer;

  #define PyBUF_SIMPLE 0
  #define PyBUF_WRITABLE 0x0001
  #define PyBUF_FORMAT 0x0004
  #define PyBUF_ND 0x0008
  #define PyBUF_STRIDES (0x0010 | PyBUF_ND)
  #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
  #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
  #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
  #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)

#endif
#if PY_MAJOR_VERSION < 3
  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
#else
  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
#endif
#if PY_MAJOR_VERSION >= 3
  #define Py_TPFLAGS_CHECKTYPES 0
  #define Py_TPFLAGS_HAVE_INDEX 0
#endif
#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBaseString_Type            PyUnicode_Type
  #define PyString_Type                PyBytes_Type
  #define PyString_CheckExact          PyBytes_CheckExact
  #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 __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
#else
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
  #define PyBytes_Type                 PyString_Type
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyMethod_New(func, self, klass) PyInstanceMethod_New(func)
#endif
#if !defined(WIN32) && !defined(MS_WINDOWS)
  #ifndef __stdcall
    #define __stdcall
  #endif
  #ifndef __cdecl
    #define __cdecl
  #endif
#else
  #define _USE_MATH_DEFINES
#endif
#if PY_VERSION_HEX < 0x02050000
  #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),((char *)(n)))
  #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
  #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),((char *)(n)))
#else
  #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),(n))
  #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
  #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),(n))
#endif
#if PY_VERSION_HEX < 0x02050000
  #define __Pyx_NAMESTR(n) ((char *)(n))
  #define __Pyx_DOCSTR(n)  ((char *)(n))
#else
  #define __Pyx_NAMESTR(n) (n)
  #define __Pyx_DOCSTR(n)  (n)
#endif
#ifdef __cplusplus
#define __PYX_EXTERN_C extern "C"
#else
#define __PYX_EXTERN_C extern
#endif
#include <math.h>
#define __PYX_HAVE_API__nwalign
#include "stdlib.h"
#include "numpy/arrayobject.h"


#ifdef __GNUC__
#define INLINE __inline__
#elif _WIN32
#define INLINE __inline
#else
#define INLINE 
#endif

typedef struct {PyObject **p; char *s; long n; char is_unicode; char intern; char is_identifier;} __Pyx_StringTabEntry; /*proto*/



static int __pyx_skip_dispatch = 0;


/* Type Conversion Predeclarations */

#if PY_MAJOR_VERSION < 3
#define __Pyx_PyBytes_FromString          PyString_FromString
#define __Pyx_PyBytes_FromStringAndSize   PyString_FromStringAndSize
#define __Pyx_PyBytes_AsString            PyString_AsString
#else
#define __Pyx_PyBytes_FromString          PyBytes_FromString
#define __Pyx_PyBytes_FromStringAndSize   PyBytes_FromStringAndSize
#define __Pyx_PyBytes_AsString            PyBytes_AsString
#endif

#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
static INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);

#if !defined(T_PYSSIZET)
#if PY_VERSION_HEX < 0x02050000
#define T_PYSSIZET T_INT
#elif !defined(T_LONGLONG)
#define T_PYSSIZET \
        ((sizeof(Py_ssize_t) == sizeof(int))  ? T_INT  : \
        ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : -1))
#else
#define T_PYSSIZET \
        ((sizeof(Py_ssize_t) == sizeof(int))          ? T_INT      : \
        ((sizeof(Py_ssize_t) == sizeof(long))         ? T_LONG     : \
        ((sizeof(Py_ssize_t) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1)))
#endif
#endif

#if !defined(T_SIZET)
#if !defined(T_ULONGLONG)
#define T_SIZET \
        ((sizeof(size_t) == sizeof(unsigned int))  ? T_UINT  : \
        ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : -1))
#else
#define T_SIZET \
        ((sizeof(size_t) == sizeof(unsigned int))          ? T_UINT      : \
        ((sizeof(size_t) == sizeof(unsigned long))         ? T_ULONG     : \
        ((sizeof(size_t) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1)))
#endif
#endif

static INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
static INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);

#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))


#ifdef __GNUC__
/* Test for GCC > 2.95 */
#if __GNUC__ > 2 ||               (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) 
#define likely(x)   __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)
#else /* __GNUC__ > 2 ... */
#define likely(x)   (x)
#define unlikely(x) (x)
#endif /* __GNUC__ > 2 ... */
#else /* __GNUC__ */
#define likely(x)   (x)
#define unlikely(x) (x)
#endif /* __GNUC__ */
    
static PyObject *__pyx_m;
static PyObject *__pyx_b;
static PyObject *__pyx_empty_tuple;
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;

static char __pyx_mdoc[] = "\n------------------------------------------------------------------------------\nnwalign: fast `cython`_  - `Needleman-Wunsch`_ alignment\n------------------------------------------------------------------------------\n\n.. _`Needleman-Wunsch`: http://en.wikipedia.org/wiki/Needleman-Wunsch_algorithm \n.. _`scoring matrix`: http://en.wikipedia.org/wiki/Substitution_matrix\n.. _`cython`: http://cython.org\n\nThis module provides a python module and a command-line interface to do global-\nsequence alignment using the `Needleman-Wunsch` algorithm. It uses `cython`_ \nand numpy for speed.\n\nExample Command-Line Usage \n==========================\n\n\nthe nwalign executable is installed to the PATH by setuptools::\n\n    $ nwalign alphabet alpet\n    alphabet\n    alp---et\n\nspecify an alignment `scoring matrix`_ ::\n\n    $ nwalign --matrix /usr/share/ncbi/data/BLOSUM62 EEAEE EEEEG\n    EEAEE-\n    EE-EEG\n\n\nUsage as a python module\n========================\n::\n\n    >>> import nwalign as nw\n    >>> nw.global_align(\"CEELECANTH\", \"PELICAN\", matrix='PAM250')\n    ('CEELECANTH', '-PELICA--N')\n\n\nthe matrix is specified as the full path to an `scoring matrix`_ as\nis distributed with the NCBI toolset.\n";

#ifdef 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* (*NewContext)(const char*, int, const char*);
  void (*FinishContext)(void**);
} __Pyx_RefnannyAPIStruct;
static __Pyx_RefnannyAPIStruct *__Pyx_Refnanny = NULL;
#define __Pyx_ImportRefcountAPI(name)   (__Pyx_RefnannyAPIStruct *) PyCObject_Import((char *)name, (char *)"RefnannyAPI")
#define __Pyx_INCREF(r) __Pyx_Refnanny->INCREF(__pyx_refchk, (PyObject *)(r), __LINE__)
#define __Pyx_DECREF(r) __Pyx_Refnanny->DECREF(__pyx_refchk, (PyObject *)(r), __LINE__)
#define __Pyx_GOTREF(r) __Pyx_Refnanny->GOTREF(__pyx_refchk, (PyObject *)(r), __LINE__)
#define __Pyx_GIVEREF(r) __Pyx_Refnanny->GIVEREF(__pyx_refchk, (PyObject *)(r), __LINE__)
#define __Pyx_XDECREF(r) if((r) == NULL) ; else __Pyx_DECREF(r)
#define __Pyx_SetupRefcountContext(name)   void* __pyx_refchk = __Pyx_Refnanny->NewContext((name), __LINE__, __FILE__)
#define __Pyx_FinishRefcountContext()   __Pyx_Refnanny->FinishContext(&__pyx_refchk)
#else
#define __Pyx_INCREF(r) Py_INCREF(r)
#define __Pyx_DECREF(r) Py_DECREF(r)
#define __Pyx_GOTREF(r)
#define __Pyx_GIVEREF(r)
#define __Pyx_XDECREF(r) Py_XDECREF(r)
#define __Pyx_SetupRefcountContext(name)
#define __Pyx_FinishRefcountContext()
#endif /* CYTHON_REFNANNY */
#define __Pyx_XGIVEREF(r) if((r) == NULL) ; else __Pyx_GIVEREF(r)
#define __Pyx_XGOTREF(r) if((r) == NULL) ; else __Pyx_GOTREF(r)


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


#define __Pyx_GetItemInt_List(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \
                                                    __Pyx_GetItemInt_List_Fast(o, i, size <= sizeof(long)) : \
                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))

static INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, int fits_long) {
    if (likely(o != Py_None)) {
        if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
            PyObject *r = PyList_GET_ITEM(o, i);
            Py_INCREF(r);
            return r;
        }
        else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) {
            PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i);
            Py_INCREF(r);
            return r;
        }
    }
    return __Pyx_GetItemInt_Generic(o, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i));
}

#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \
                                                    __Pyx_GetItemInt_Tuple_Fast(o, i, size <= sizeof(long)) : \
                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))

static INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, int fits_long) {
    if (likely(o != Py_None)) {
        if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
            PyObject *r = PyTuple_GET_ITEM(o, i);
            Py_INCREF(r);
            return r;
        }
        else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) {
            PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i);
            Py_INCREF(r);
            return r;
        }
    }
    return __Pyx_GetItemInt_Generic(o, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i));
}


#define __Pyx_GetItemInt(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \
                                                    __Pyx_GetItemInt_Fast(o, i, size <= sizeof(long)) : \
                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))

static INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int fits_long) {
    PyObject *r;
    if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) {
        r = PyList_GET_ITEM(o, i);
        Py_INCREF(r);
    }
    else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
        r = PyTuple_GET_ITEM(o, i);
        Py_INCREF(r);
    }
    else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) {
        r = PySequence_GetItem(o, i);
    }
    else {
        r = __Pyx_GetItemInt_Generic(o, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i));
    }
    return r;
}

static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/
static INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info);
static INLINE void __Pyx_ZeroBuffer(Py_buffer* buf); /*proto*/
static INLINE const char* __Pyx_ConsumeWhitespace(const char* ts); /*proto*/
static void __Pyx_BufferNdimError(Py_buffer* buffer, int expected_ndim); /*proto*/
static const char* __Pyx_DescribeTokenInFormatString(const char* ts); /*proto*/
static const char* __Pyx_CheckTypestring_nn___pyx_t_7nwalign_DTYPE_INT(const char* ts); /*proto*/

static int __Pyx_GetBuffer_nn___pyx_t_7nwalign_DTYPE_INT(PyObject* obj, Py_buffer* buf, int flags, int nd, int cast); /*proto*/

static void __Pyx_RaiseBufferFallbackError(void); /*proto*/
#define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1)

static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
static const char* __Pyx_CheckTypestring_nn___pyx_t_7nwalign_DTYPE_BOOL(const char* ts); /*proto*/

static int __Pyx_GetBuffer_nn___pyx_t_7nwalign_DTYPE_BOOL(PyObject* obj, Py_buffer* buf, int flags, int nd, int cast); /*proto*/
static const char* __Pyx_CheckTypestring_nn___pyx_t_7nwalign_DTYPE_UINT(const char* ts); /*proto*/

static int __Pyx_GetBuffer_nn___pyx_t_7nwalign_DTYPE_UINT(PyObject* obj, Py_buffer* buf, int flags, int nd, int cast); /*proto*/

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

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

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

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

static INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
#if PY_MAJOR_VERSION < 3
static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
static void __Pyx_ReleaseBuffer(Py_buffer *view);
#else
#define __Pyx_GetBuffer PyObject_GetBuffer
#define __Pyx_ReleaseBuffer PyBuffer_Release
#endif

Py_ssize_t __Pyx_zeros[] = {0, 0};
Py_ssize_t __Pyx_minusones[] = {-1, -1};

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/

static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/

static INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);

static INLINE void __Pyx_RaiseTooManyValuesError(void);

static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/
static int __Pyx_EndUnpack(PyObject *); /*proto*/

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

static int __Pyx_Print(PyObject *, int); /*proto*/
#if PY_MAJOR_VERSION >= 3
static PyObject* __pyx_print = 0;
static PyObject* __pyx_print_kwargs = 0;
#endif

static int __Pyx_PrintOne(PyObject *o); /*proto*/

static INLINE int __Pyx_StrEq(const char *, const char *); /*proto*/

static INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);

static INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);

static INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *);

static INLINE char __Pyx_PyInt_AsChar(PyObject *);

static INLINE short __Pyx_PyInt_AsShort(PyObject *);

static INLINE int __Pyx_PyInt_AsInt(PyObject *);

static INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *);

static INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *);

static INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *);

static INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *);

static INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *);

static INLINE long __Pyx_PyInt_AsLong(PyObject *);

static INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *);

static INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);

static INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);

static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size);  /*proto*/

static PyObject *__Pyx_ImportModule(const char *name); /*proto*/

static void __Pyx_AddTraceback(const char *funcname); /*proto*/

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

/* Type declarations */

typedef npy_int8 __pyx_t_5numpy_int8_t;

typedef npy_int16 __pyx_t_5numpy_int16_t;

typedef npy_int32 __pyx_t_5numpy_int32_t;

typedef npy_int64 __pyx_t_5numpy_int64_t;

typedef npy_uint8 __pyx_t_5numpy_uint8_t;

typedef npy_uint16 __pyx_t_5numpy_uint16_t;

typedef npy_uint32 __pyx_t_5numpy_uint32_t;

typedef npy_uint64 __pyx_t_5numpy_uint64_t;

typedef npy_float32 __pyx_t_5numpy_float32_t;

typedef npy_float64 __pyx_t_5numpy_float64_t;

typedef npy_long __pyx_t_5numpy_int_t;

typedef npy_longlong __pyx_t_5numpy_long_t;

typedef npy_ulong __pyx_t_5numpy_uint_t;

typedef npy_ulonglong __pyx_t_5numpy_ulong_t;

typedef npy_double __pyx_t_5numpy_float_t;

typedef npy_double __pyx_t_5numpy_double_t;

typedef npy_longdouble __pyx_t_5numpy_longdouble_t;

typedef npy_cfloat __pyx_t_5numpy_cfloat_t;

typedef npy_cdouble __pyx_t_5numpy_cdouble_t;

typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;

typedef __pyx_t_5numpy_int_t __pyx_t_7nwalign_DTYPE_INT;

typedef __pyx_t_5numpy_uint_t __pyx_t_7nwalign_DTYPE_UINT;

typedef __pyx_t_5numpy_int8_t __pyx_t_7nwalign_DTYPE_BOOL;

/* "/opt/src/bpbio/nwalign/nwalign.pyx":121
 * 
 * @cython.boundscheck(False)
 * cpdef global_align(object _seqj, object _seqi, int gap=-1, int match=1, int mismatch=-1, int gap_init=-1, object matrix=None):             # <<<<<<<<<<<<<<
 *     """
 *     perform a global sequence alignment (needleman-wunsch) on seq and and 2. using
 */

struct __pyx_opt_args_7nwalign_global_align {
  int __pyx_n;
  int gap;
  int match;
  int mismatch;
  int gap_init;
  PyObject *matrix;
};
/* Module declarations from python_buffer */

/* Module declarations from stdlib */

/* Module declarations from numpy */

/* Module declarations from numpy */

static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
static INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *); /*proto*/
/* Module declarations from cython */

/* Module declarations from nwalign */

static size_t __pyx_v_7nwalign_UP;
static size_t __pyx_v_7nwalign_LEFT;
static size_t __pyx_v_7nwalign_DIAG;
static size_t __pyx_v_7nwalign_NONE;
static INLINE int __pyx_f_7nwalign_imax2(int, int); /*proto*/
static INLINE size_t __pyx_f_7nwalign_strpos(char *, char); /*proto*/
static PyObject *__pyx_f_7nwalign_global_align(PyObject *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_7nwalign_global_align *__pyx_optional_args); /*proto*/

const char *__pyx_modulename = "nwalign";

/* Implementation of nwalign */
static PyObject *__pyx_int_1;
static PyObject *__pyx_int_neg_1;
static char __pyx_k_global_align[] = "global_align";
static PyObject *__pyx_kp_global_align;
static char __pyx_k_path[] = "path";
static PyObject *__pyx_kp_path;
static char __pyx_k__seqj[] = "_seqj";
static PyObject *__pyx_kp__seqj;
static char __pyx_k__seqi[] = "_seqi";
static PyObject *__pyx_kp__seqi;
static char __pyx_k_gap[] = "gap";
static PyObject *__pyx_kp_gap;
static char __pyx_k_match[] = "match";
static PyObject *__pyx_kp_match;
static char __pyx_k_mismatch[] = "mismatch";
static PyObject *__pyx_kp_mismatch;
static char __pyx_k_gap_init[] = "gap_init";
static PyObject *__pyx_kp_gap_init;
static char __pyx_k_matrix[] = "matrix";
static PyObject *__pyx_kp_matrix;
static char __pyx_k_numpy[] = "numpy";
static PyObject *__pyx_kp_numpy;
static char __pyx_k_np[] = "np";
static PyObject *__pyx_kp_np;
static char __pyx_k_sys[] = "sys";
static PyObject *__pyx_kp_sys;
static char __pyx_k_23[] = "os.path";
static PyObject *__pyx_kp_23;
static char __pyx_k_os[] = "os";
static PyObject *__pyx_kp_os;
static char __pyx_k_24[] = "BLOSUM62";
static PyObject *__pyx_kp_24;
static char __pyx_k_MATRIX[] = "MATRIX";
static PyObject *__pyx_kp_MATRIX;
static char __pyx_k_open[] = "open";
static PyObject *__pyx_kp_open;
static char __pyx_k_readline[] = "readline";
static PyObject *__pyx_kp_readline;
static char __pyx_k_strip[] = "strip";
static PyObject *__pyx_kp_strip;
static char __pyx_k_split[] = "split";
static PyObject *__pyx_kp_split;
static char __pyx_k_dtype[] = "dtype";
static PyObject *__pyx_kp_dtype;
static char __pyx_k_int[] = "int";
static PyObject *__pyx_kp_int;
static char __pyx_k_range[] = "range";
static PyObject *__pyx_kp_range;
static char __pyx_k_join[] = "join";
static PyObject *__pyx_kp_join;
static char __pyx_k_zeros[] = "zeros";
static PyObject *__pyx_kp_zeros;
static char __pyx_k_29[] = "int8";
static PyObject *__pyx_kp_29;
static char __pyx_k_uint[] = "uint";
static PyObject *__pyx_kp_uint;
static char __pyx_k_read_matrix[] = "read_matrix";
static PyObject *__pyx_kp_read_matrix;
static char __pyx_k_arange[] = "arange";
static PyObject *__pyx_kp_arange;
static char __pyx_k_stderr[] = "stderr";
static PyObject *__pyx_kp_stderr;
static char __pyx_k_write[] = "write";
static PyObject *__pyx_kp_write;
static char __pyx_k_Exception[] = "Exception";
static PyObject *__pyx_kp_Exception;
static char __pyx_k_optparse[] = "optparse";
static PyObject *__pyx_kp_optparse;
static char __pyx_k_OptionParser[] = "OptionParser";
static PyObject *__pyx_kp_OptionParser;
static char __pyx_k_usage[] = "usage";
static PyObject *__pyx_kp_usage;
static char __pyx_k_add_option[] = "add_option";
static PyObject *__pyx_kp_add_option;
static char __pyx_k_dest[] = "dest";
static PyObject *__pyx_kp_dest;
static char __pyx_k_40[] = "gap";
static PyObject *__pyx_kp_40;
static char __pyx_k_help[] = "help";
static PyObject *__pyx_kp_help;
static char __pyx_k_type[] = "type";
static PyObject *__pyx_kp_type;
static char __pyx_k_42[] = "int";
static PyObject *__pyx_kp_42;
static char __pyx_k_default[] = "default";
static PyObject *__pyx_kp_default;
static char __pyx_k_44[] = "gap_init";
static PyObject *__pyx_kp_44;
static char __pyx_k_46[] = "int";
static PyObject *__pyx_kp_46;
static char __pyx_k_48[] = "match";
static PyObject *__pyx_kp_48;
static char __pyx_k_50[] = "int";
static PyObject *__pyx_kp_50;
static char __pyx_k_52[] = "mismatch";
static PyObject *__pyx_kp_52;
static char __pyx_k_54[] = "int";
static PyObject *__pyx_kp_54;
static char __pyx_k_56[] = "matrix";
static PyObject *__pyx_kp_56;
static char __pyx_k_parse_args[] = "parse_args";
static PyObject *__pyx_kp_parse_args;
static char __pyx_k_exit[] = "exit";
static PyObject *__pyx_kp_exit;
static char __pyx_k_print_help[] = "print_help";
static PyObject *__pyx_kp_print_help;
static PyObject *__pyx_builtin_open;
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_Exception;
static PyObject *__pyx_kp_25;
static PyObject *__pyx_kp_26;
static PyObject *__pyx_kp_27;
static PyObject *__pyx_kp_28;
static char __pyx_k_25[] = "#";
static char __pyx_k_26[] = " ";
static char __pyx_k_27[] = " ";
static char __pyx_k_28[] = "";
static PyObject *__pyx_kp_30;
static PyObject *__pyx_kp_31;
static PyObject *__pyx_kp_32;
static PyObject *__pyx_kp_33;
static PyObject *__pyx_kp_34;
static PyObject *__pyx_kp_35;
static PyObject *__pyx_kp_36;
static PyObject *__pyx_kp_37;
static char __pyx_k_30[] = "'";
static char __pyx_k_31[] = "' from: ";
static char __pyx_k_32[] = " not in scoring matrix\n";
static char __pyx_k_33[] = "'";
static char __pyx_k_34[] = "' from: ";
static char __pyx_k_35[] = " not in scoring matrix\n";
static char __pyx_k_36[] = "using score of score of 0\n";
static char __pyx_k_37[] = "wtf!";
static PyObject *__pyx_kp_38;
static PyObject *__pyx_kp_39;
static PyObject *__pyx_kp_41;
static PyObject *__pyx_kp_43;
static PyObject *__pyx_kp_45;
static PyObject *__pyx_kp_47;
static PyObject *__pyx_kp_49;
static PyObject *__pyx_kp_51;
static PyObject *__pyx_kp_53;
static PyObject *__pyx_kp_55;
static PyObject *__pyx_kp_57;
static PyObject *__pyx_kp_58;
static char __pyx_k_38[] = "\n    %prog [options] seq1 seq2 \n    ";
static char __pyx_k_39[] = "--gap";
static char __pyx_k_41[] = "gap extend penalty (must be integer <= 0)";
static char __pyx_k_43[] = "--gap_init";
static char __pyx_k_45[] = "gap start penalty (must be integer <= 0)";
static char __pyx_k_47[] = "--match";
static char __pyx_k_49[] = "match score (must be integer > 0)";
static char __pyx_k_51[] = "--mismatch";
static char __pyx_k_53[] = "gap penalty (must be integer < 0)";
static char __pyx_k_55[] = "--matrix";
static char __pyx_k_57[] = "scoring matrix in ncbi/data/ format,                                      if not specificied, match/mismatch are used";
static char __pyx_k_58[] = "\n";
static char __pyx_k___getbuffer__[] = "__getbuffer__";
static PyObject *__pyx_kp___getbuffer__;
static char __pyx_k___releasebuffer__[] = "__releasebuffer__";
static PyObject *__pyx_kp___releasebuffer__;
static char __pyx_k_info[] = "info";
static PyObject *__pyx_kp_info;
static char __pyx_k_flags[] = "flags";
static PyObject *__pyx_kp_flags;
static char __pyx_k_ValueError[] = "ValueError";
static PyObject *__pyx_kp_ValueError;
static char __pyx_k_itervalues[] = "itervalues";
static PyObject *__pyx_kp_itervalues;
static char __pyx_k_RuntimeError[] = "RuntimeError";
static PyObject *__pyx_kp_RuntimeError;
static PyObject *__pyx_kp_1;
static PyObject *__pyx_kp_2;
static PyObject *__pyx_kp_20;
static PyObject *__pyx_builtin_ValueError;
static PyObject *__pyx_builtin_RuntimeError;
static char __pyx_k_1[] = "ndarray is not C contiguous";
static char __pyx_k_2[] = "ndarray is not Fortran contiguous";
static char __pyx_k_3[] = "b";
static char __pyx_k_4[] = "B";
static char __pyx_k_5[] = "h";
static char __pyx_k_6[] = "H";
static char __pyx_k_7[] = "i";
static char __pyx_k_8[] = "I";
static char __pyx_k_9[] = "l";
static char __pyx_k_10[] = "L";
static char __pyx_k_11[] = "q";
static char __pyx_k_12[] = "Q";
static char __pyx_k_13[] = "f";
static char __pyx_k_14[] = "d";
static char __pyx_k_15[] = "g";
static char __pyx_k_16[] = "Zf";
static char __pyx_k_17[] = "Zd";
static char __pyx_k_18[] = "Zg";
static char __pyx_k_19[] = "O";
static char __pyx_k_20[] = "unknown dtype code in numpy.pxd (%d)";
static PyObject *__pyx_kp_21;
static PyObject *__pyx_kp_22;
static char __pyx_k_21[] = "Format string allocated too short.";
static char __pyx_k_22[] = "unknown dtype code in numpy.pxd (%d)";

/* "/opt/src/bpbio/nwalign/nwalign.pyx":70
 * MATRIX = ['BLOSUM62']
 * 
 * cdef inline int imax2(int a, int b):             # <<<<<<<<<<<<<<
 *     if a >= b: return a
 *     return b
 */

static INLINE int __pyx_f_7nwalign_imax2(int __pyx_v_a, int __pyx_v_b) {
  int __pyx_r;
  int __pyx_t_1;
  __Pyx_SetupRefcountContext("imax2");

  /* "/opt/src/bpbio/nwalign/nwalign.pyx":71
 * 
 * cdef inline int imax2(int a, int b):
 *     if a >= b: return a             # <<<<<<<<<<<<<<
 *     return b
 * 
 */
  __pyx_t_1 = (__pyx_v_a >= __pyx_v_b);
  if (__pyx_t_1) {
    __pyx_r = __pyx_v_a;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/opt/src/bpbio/nwalign/nwalign.pyx":72
 * cdef inline int imax2(int a, int b):
 *     if a >= b: return a
 *     return b             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_b;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_FinishRefcountContext();
  return __pyx_r;
}

/* "/opt/src/bpbio/nwalign/nwalign.pyx":76
 * 
 * @cython.boundscheck(False)
 * def read_matrix(path):             # <<<<<<<<<<<<<<
 *     cdef np.ndarray[DTYPE_INT, ndim=2] a
 *     cdef size_t ai = 0, i
 */

static PyObject *__pyx_pf_7nwalign_read_matrix(PyObject *__pyx_self, PyObject *__pyx_v_path); /*proto*/
static PyObject *__pyx_pf_7nwalign_read_matrix(PyObject *__pyx_self, PyObject *__pyx_v_path) {
  PyArrayObject *__pyx_v_a;
  size_t __pyx_v_ai;
  size_t __pyx_v_i;
  int __pyx_v_v;
  PyObject *__pyx_v_fh;
  PyObject *__pyx_v_headers;
  PyObject *__pyx_v_line;
  Py_buffer __pyx_bstruct_a;
  Py_ssize_t __pyx_bstride_0_a = 0;
  Py_ssize_t __pyx_bstride_1_a = 0;
  Py_ssize_t __pyx_bshape_0_a = 0;
  Py_ssize_t __pyx_bshape_1_a = 0;
  PyObject *__pyx_v_x;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyArrayObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  size_t __pyx_t_12;
  size_t __pyx_t_13;
  size_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  __Pyx_SetupRefcountContext("read_matrix");
  __pyx_self = __pyx_self;
  __pyx_v_a = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_fh = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_headers = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_line = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_x = Py_None; __Pyx_INCREF(Py_None);
  __pyx_bstruct_a.buf = NULL;

  /* "/opt/src/bpbio/nwalign/nwalign.pyx":78
 * def read_matrix(path):
 *     cdef np.ndarray[DTYPE_INT, ndim=2] a
 *     cdef size_t ai = 0, i             # <<<<<<<<<<<<<<
 *     cdef int v
 * 
 */
  __pyx_v_ai = 0;

  /* "/opt/src/bpbio/nwalign/nwalign.pyx":91
 *     #    return h, a
 * 
 *     fh = open(path)             # <<<<<<<<<<<<<<
 *     headers = None
 *     while headers is None:
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_path);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_path);
  __Pyx_GIVEREF(__pyx_v_path);
  __pyx_t_2 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_v_fh);
  __pyx_v_fh = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "/opt/src/bpbio/nwalign/nwalign.pyx":92
 * 
 *     fh = open(path)
 *     headers = None             # <<<<<<<<<<<<<<
 *     while headers is None:
 *         line = fh.readline().strip()
 */
  __Pyx_INCREF(Py_None);
  __Pyx_DECREF(__pyx_v_headers);
  __pyx_v_headers = Py_None;

  /* "/opt/src/bpbio/nwalign/nwalign.pyx":93
 *     fh = open(path)
 *     headers = None
 *     while headers is None:             # <<<<<<<<<<<<<<
 *         line = fh.readline().strip()
 *         if line[0] == '#': continue
 */
  while (1) {
    __pyx_t_3 = (__pyx_v_headers == Py_None);
    if (!__pyx_t_3) break;

    /* "/opt/src/bpbio/nwalign/nwalign.pyx":94
 *     headers = None
 *     while headers is None:
 *         line = fh.readline().strip()             # <<<<<<<<<<<<<<
 *         if line[0] == '#': continue
 *         headers = [x for x in line.split(' ') if x]
 */
    __pyx_t_2 = PyObject_GetAttr(__pyx_v_fh, __pyx_kp_readline); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_kp_strip); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_v_line);
    __pyx_v_line = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "/opt/src/bpbio/nwalign/nwalign.pyx":95
 *     while headers is None:
 *         line = fh.readline().strip()
 *         if line[0] == '#': continue             # <<<<<<<<<<<<<<
 *         headers = [x for x in line.split(' ') if x]
 * 
 */
    __pyx_1 = __Pyx_GetItemInt(__pyx_v_line, 0, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_1);
    __pyx_t_1 = PyObject_RichCompare(__pyx_1, __pyx_kp_25, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_3) {
      goto __pyx_L5_continue;
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "/opt/src/bpbio/nwalign/nwalign.pyx":96
 *         line = fh.readline().strip()
 *         if line[0] == '#': continue
 *         headers = [x for x in line.split(' ') if x]             # <<<<<<<<<<<<<<
 * 
 *     line = fh.readline()
 */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __pyx_t_2 = PyObject_GetAttr(__pyx_v_line, __pyx_kp_split); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
    __Pyx_INCREF(__pyx_kp_26);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_26);
    __Pyx_GIVEREF(__pyx_kp_26);
    __pyx_t_6 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    if (PyList_CheckExact(__pyx_t_6) || PyTuple_CheckExact(__pyx_t_6)) {
      __pyx_t_4 = 0; __pyx_t_5 = __pyx_t_6; __Pyx_INCREF(__pyx_t_5);
    } else {
      __pyx_t_4 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    for (;;) {
      if (likely(PyList_CheckExact(__pyx_t_5))) {
        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_5)) break;
        __pyx_t_6 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++;
      } else if (likely(PyTuple_CheckExact(__pyx_t_5))) {
        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
        __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++;
      } else {
        __pyx_t_6 = PyIter_Next(__pyx_t_5);
        if (!__pyx_t_6) {
          if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          break;
        }
        __Pyx_GOTREF(__pyx_t_6);
      }
      __Pyx_DECREF(__pyx_v_x);
      __pyx_v_x = __pyx_t_6;
      __pyx_t_6 = 0;
      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_x); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (__pyx_t_3) {
        __pyx_t_7 = PyList_Append(__pyx_t_1, (PyObject*)__pyx_v_x); if (unlikely(__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L10;
      }
      __pyx_L10:;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_INCREF(((PyObject *)__pyx_t_1));
    __Pyx_DECREF(__pyx_v_headers);
    __pyx_v_headers = ((PyObject *)__pyx_t_1);
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __pyx_L5_continue:;
  }

  /* "/opt/src/bpbio/nwalign/nwalign.pyx":98
 *         headers = [x for x in line.split(' ') if x]
 * 
 *     line = fh.readline()             # <<<<<<<<<<<<<<
 *     a = np.ndarray((len(headers), len(headers)), dtype=np.int)
 * 
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_fh, __pyx_kp_readline); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_v_line);
  __pyx_v_line = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "/opt/src/bpbio/nwalign/nwalign.pyx":99
 * 
 *     line = fh.readline()
 *     a = np.ndarray((len(headers), len(headers)), dtype=np.int)             # <<<<<<<<<<<<<<
 * 
 *     while line:
 */
  __pyx_t_4 = PyObject_Length(__pyx_v_headers); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = PyObject_Length(__pyx_v_headers); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_6));
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_5 = 0;
  __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_6));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
  __pyx_t_6 = 0;
  __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_1));
  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_2);
  __pyx_t_6 = PyObject_GetAttr(__pyx_2, __pyx_kp_int); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_2); __pyx_2 = 0;
  if (PyDict_SetItem(__pyx_1, __pyx_kp_dtype, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_5numpy_ndarray)), ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0;
  if (!(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_8 = ((PyArrayObject *)__pyx_t_6);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_a);
  __pyx_t_7 = __Pyx_GetBuffer_nn___pyx_t_7nwalign_DTYPE_INT((PyObject*)__pyx_t_8, &__pyx_bstruct_a, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0);
  if (unlikely(__pyx_t_7 < 0)) {
    PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
    if (unlikely(__Pyx_GetBuffer_nn___pyx_t_7nwalign_DTYPE_INT((PyObject*)__pyx_v_a, &__pyx_bstruct_a, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0) == -1)) {
      Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11);
      __Pyx_RaiseBufferFallbackError();
    } else {
      PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
    }
  }
  __pyx_bstride_0_a = __pyx_bstruct_a.strides[0]; __pyx_bstride_1_a = __pyx_bstruct_a.strides[1];
  __pyx_bshape_0_a = __pyx_bstruct_a.shape[0]; __pyx_bshape_1_a = __pyx_bstruct_a.shape[1];
  if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_8 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_v_a));
  __pyx_v_a = ((PyArrayObject *)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "/opt/src/bpbio/nwalign/nwalign.pyx":101
 *     a = np.ndarray((len(headers), len(headers)), dtype=np.int)
 * 
 *     while line:             # <<<<<<<<<<<<<<
 *         line = [int(x) for x in line[:-1].split(' ')[1:] if x]
 *         for i in range(len(line)):
 */
  while (1) {
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_line); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (!__pyx_t_3) break;

    /* "/opt/src/bpbio/nwalign/nwalign.pyx":102
 * 
 *     while line:
 *         line = [int(x) for x in line[:-1].split(' ')[1:] if x]             # <<<<<<<<<<<<<<
 *         for i in range(len(line)):
 *             v = line[i]
 */
    __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
    __pyx_2 = PySequence_GetSlice(__pyx_v_line, 0, -1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_2);
    __pyx_t_1 = PyObject_GetAttr(__pyx_2, __pyx_kp_split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_2); __pyx_2 = 0;
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
    __Pyx_INCREF(__pyx_kp_27);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_27);
    __Pyx_GIVEREF(__pyx_kp_27);
    __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __pyx_1 = PySequence_GetSlice(__pyx_t_2, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (PyList_CheckExact(__pyx_1) || PyTuple_CheckExact(__pyx_1)) {
      __pyx_t_4 = 0; __pyx_t_2 = __pyx_1; __Pyx_INCREF(__pyx_t_2);
    } else {
      __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
    for (;;) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
        __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_5); __pyx_t_4++;
      } else if (likely(PyTuple_CheckExact(__pyx_t_2))) {
        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_5); __pyx_t_4++;
      } else {
        __pyx_t_5 = PyIter_Next(__pyx_t_2);
        if (!__pyx_t_5) {
          if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          break;
        }
        __Pyx_GOTREF(__pyx_t_5);
      }
      __Pyx_DECREF(__pyx_v_x);
      __pyx_v_x = __pyx_t_5;
      __pyx_t_5 = 0;
      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_x); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (__pyx_t_3) {
        __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_5));
        __Pyx_INCREF(__pyx_v_x);
        PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_x);
        __Pyx_GIVEREF(__pyx_v_x);
        __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)&PyInt_Type)), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
        __pyx_t_7 = PyList_Append(__pyx_t_6, (PyObject*)__pyx_t_1); if (unlikely(__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L15;
      }
      __pyx_L15:;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_INCREF(((PyObject *)__pyx_t_6));
    __Pyx_DECREF(__pyx_v_line);
    __pyx_v_line = ((PyObject *)__pyx_t_6);
    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;

    /* "/opt/src/bpbio/nwalign/nwalign.pyx":103
 *     while line:
 *         line = [int(x) for x in line[:-1].split(' ')[1:] if x]
 *         for i in range(len(line)):             # <<<<<<<<<<<<<<
 *             v = line[i]
 *             a[ai, i] = v
 */
    __pyx_t_4 = PyObject_Length(__pyx_v_line); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_4; __pyx_t_12+=1) {
      __pyx_v_i = __pyx_t_12;

      /* "/opt/src/bpbio/nwalign/nwalign.pyx":104
 *         line = [int(x) for x in line[:-1].split(' ')[1:] if x]
 *         for i in range(len(line)):
 *             v = line[i]             # <<<<<<<<<<<<<<
 *             a[ai, i] = v
 *         ai += 1
 */
      __pyx_2 = __Pyx_GetItemInt(__pyx_v_line, __pyx_v_i, sizeof(size_t)+1, __Pyx_PyInt_FromSize_t); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_2);
      __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_2); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_2); __pyx_2 = 0;
      __pyx_v_v = __pyx_t_7;

      /* "/opt/src/bpbio/nwalign/nwalign.pyx":105
 *         for i in range(len(line)):
 *             v = line[i]
 *             a[ai, i] = v             # <<<<<<<<<<<<<<
 *         ai += 1
 *         line = fh.readline()
 */
      __pyx_t_13 = __pyx_v_ai;
      __pyx_t_14 = __pyx_v_i;
      *__Pyx_BufPtrStrided2d(__pyx_t_7nwalign_DTYPE_INT *, __pyx_bstruct_a.buf, __pyx_t_13, __pyx_bstride_0_a, __pyx_t_14, __pyx_bstride_1_a) = __pyx_v_v;
    }

    /* "/opt/src/bpbio/nwalign/nwalign.pyx":106
 *             v = line[i]
 *             a[ai, i] = v
 *         ai += 1             # <<<<<<<<<<<<<<
 *         line = fh.readline()
 *     assert ai == len(headers), (ai, len(headers))
 */
    __pyx_v_ai += 1;

    /* "/opt/src/bpbio/nwalign/nwalign.pyx":107
 *             a[ai, i] = v
 *         ai += 1
 *         line = fh.readline()             # <<<<<<<<<<<<<<
 *     assert ai == len(headers), (ai, len(headers))
 *     return "".join(headers), a
 */
    __pyx_t_6 = PyObject_GetAttr(__pyx_v_fh, __pyx_kp_readline); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_2 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_v_line);
    __pyx_v_line = __pyx_t_2;
    __pyx_t_2 = 0;
  }

  /* "/opt/src/bpbio/nwalign/nwalign.pyx":108
 *         ai += 1
 *         line = fh.readline()
 *     assert ai == len(headers), (ai, len(headers))             # <<<<<<<<<<<<<<
 *     return "".join(headers), a
 * 
 */
  #ifndef PYREX_WITHOUT_ASSERTIONS
  __pyx_t_4 = PyObject_Length(__pyx_v_headers); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!(__pyx_v_ai == __pyx_t_4))) {
    __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_ai); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_15 = PyObject_Length(__pyx_v_headers); if (unlikely(__pyx_t_15 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_6 = PyInt_FromSsize_t(__pyx_t_15); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    __pyx_t_2 = 0;
    __pyx_t_6 = 0;
    PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_t_1));
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif

  /* "/opt/src/bpbio/nwalign/nwalign.pyx":109
 *         line = fh.readline()
 *     assert ai == len(headers), (ai, len(headers))
 *     return "".join(headers), a             # <<<<<<<<<<<<<<
 * 
 * cdef inline size_t strpos(char *tstr, char check):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetAttr(__pyx_kp_28, __pyx_kp_join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_6));
  __Pyx_INCREF(__pyx_v_headers);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_headers);
  __Pyx_GIVEREF(__pyx_v_headers);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_6));
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_v_a));
  PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_v_a));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_a));
  __pyx_t_2 = 0;
  __pyx_r = ((PyObject *)__pyx_t_6);
  __pyx_t_6 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_1);
  __Pyx_XDECREF(__pyx_2);
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_a);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("nwalign.read_matrix");
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_a);
  __pyx_L2:;
  __Pyx_DECREF((PyObject *)__pyx_v_a);
  __Pyx_DECREF(__pyx_v_fh);
  __Pyx_DECREF(__pyx_v_headers);
  __Pyx_DECREF(__pyx_v_line);
  __Pyx_DECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_FinishRefcountContext();
  return __pyx_r;
}

/* "/opt/src/bpbio/nwalign/nwalign.pyx":111
 *     return "".join(headers), a
 * 
 * cdef inline size_t strpos(char *tstr, char check):             # <<<<<<<<<<<<<<
 *     cdef size_t i = 0
 *     cdef size_t slen = strlen(tstr)
 */

static INLINE size_t __pyx_f_7nwalign_strpos(char *__pyx_v_tstr, char __pyx_v_check) {
  size_t __pyx_v_i;
  size_t __pyx_v_slen;
  size_t __pyx_r;
  int __pyx_t_1;
  __Pyx_SetupRefcountContext("strpos");

  /* "/opt/src/bpbio/nwalign/nwalign.pyx":112
 * 
 * cdef inline size_t strpos(char *tstr, char check):
 *     cdef size_t i = 0             # <<<<<<<<<<<<<<
 *     cdef size_t slen = strlen(tstr)
 *     while i < slen:
 */
  __pyx_v_i = 0;

  /* "/opt/src/bpbio/nwalign/nwalign.pyx":113
 * cdef inline size_t strpos(char *tstr, char check):
 *     cdef size_t i = 0
 *     cdef size_t slen = strlen(tstr)             # <<<<<<<<<<<<<<
 *     while i < slen:
 *         if tstr[i] == check: return i
 */
  __pyx_v_slen = strlen(__pyx_v_tstr);

  /* "/opt/src/bpbio/nwalign/nwalign.pyx":114
 *     cdef size_t i = 0
 *     cdef size_t slen = strlen(tstr)
 *     while i < slen:             # <<<<<<<<<<<<<<
 *         if tstr[i] == check: return i
 *         i += 1
 */
  while (1) {
    __pyx_t_1 = (__pyx_v_i < __pyx_v_slen);
    if (!__pyx_t_1) break;

    /* "/opt/src/bpbio/nwalign/nwalign.pyx":115
 *     cdef size_t slen = strlen(tstr)
 *     while i < slen:
 *         if tstr[i] == check: return i             # <<<<<<<<<<<<<<
 *         i += 1
 *     return -1
 */
    __pyx_t_1 = ((__pyx_v_tstr[__pyx_v_i]) == __pyx_v_check);
    if (__pyx_t_1) {
      __pyx_r = __pyx_v_i;
      goto __pyx_L0;
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "/opt/src/bpbio/nwalign/nwalign.pyx":116
 *     while i < slen:
 *         if tstr[i] == check: return i
 *         i += 1             # <<<<<<<<<<<<<<
 *     return -1
 * 
 */
    __pyx_v_i += 1;
  }

  /* "/opt/src/bpbio/nwalign/nwalign.pyx":117
 *         if tstr[i] == check: return i
 *         i += 1
 *     return -1             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = -1;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_FinishRefcountContext();
  return __pyx_r;
}

/* "/opt/src/bpbio/nwalign/nwalign.pyx":121
 * 
 * @cython.boundscheck(False)
 * cpdef global_align(object _seqj, object _seqi, int gap=-1, int match=1, int mismatch=-1, int gap_init=-1, object matrix=None):             # <<<<<<<<<<<<<<
 *     """
 *     perform a global sequence alignment (needleman-wunsch) on seq and and 2. using
 */

static PyObject *__pyx_pf_7nwalign_global_align(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static  PyObject *__pyx_f_7nwalign_global_align(PyObject *__pyx_v__seqj, PyObject *__pyx_v__seqi, int __pyx_skip_dispatch, struct __pyx_opt_args_7nwalign_global_align *__pyx_optional_args) {
  int __pyx_v_gap = -1;
  int __pyx_v_match = 1;
  int __pyx_v_mismatch = -1;
  int __pyx_v_gap_init = -1;
  PyObject *__pyx_v_matrix = Py_None;
  char *__pyx_v_seqj;
  char *__pyx_v_seqi;
  size_t __pyx_v_max_j;
  size_t __pyx_v_max_i;
  size_t __pyx_v_i;
  size_t __pyx_v_j;
  size_t __pyx_v_seqlen;
  size_t __pyx_v_align_counter;
  size_t __pyx_v_p;
  int __pyx_v_diag_score;
  int __pyx_v_up_score;
  int __pyx_v_left_score;
  int __pyx_v_tscore;
  char *__pyx_v_align_j;
  char *__pyx_v_align_i;
  char *__pyx_v_sheader;
  char __pyx_v_ci;
  char __pyx_v_cj;
  size_t __pyx_v_ii;
  size_t __pyx_v_jj;
  PyObject *__pyx_v_ai;
  PyObject *__pyx_v_aj;
  int __pyx_v_zero;
  int __pyx_v_one;
  PyArrayObject *__pyx_v_agap = 0;
  PyArrayObject *__pyx_v_score = 0;
  PyArrayObject *__pyx_v_pointer = 0;
  PyArrayObject *__pyx_v_amatrix;
  PyObject *__pyx_v_pyheader;
  PyObject *__pyx_v_py_ci;
  PyObject *__pyx_v_py_cj;
  Py_buffer __pyx_bstruct_amatrix;
  Py_ssize_t __pyx_bstride_0_amatrix = 0;
  Py_ssize_t __pyx_bstride_1_amatrix = 0;
  Py_ssize_t __pyx_bshape_0_amatrix = 0;
  Py_ssize_t __pyx_bshape_1_amatrix = 0;
  Py_buffer __pyx_bstruct_pointer;
  Py_ssize_t __pyx_bstride_0_pointer = 0;
  Py_ssize_t __pyx_bstride_1_pointer = 0;
  Py_ssize_t __pyx_bshape_0_pointer = 0;
  Py_ssize_t __pyx_bshape_1_pointer = 0;
  Py_buffer __pyx_bstruct_score;
  Py_ssize_t __pyx_bstride_0_score = 0;
  Py_ssize_t __pyx_bstride_1_score = 0;
  Py_ssize_t __pyx_bshape_0_score = 0;
  Py_ssize_t __pyx_bshape_1_score = 0;
  Py_buffer __pyx_bstruct_agap;
  Py_ssize_t __pyx_bstride_0_agap = 0;
  Py_ssize_t __pyx_bstride_1_agap = 0;
  Py_ssize_t __pyx_bshape_0_agap = 0;
  Py_ssize_t __pyx_bshape_1_agap = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  int __pyx_4;
  char *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyArrayObject *__pyx_t_6 = NULL;
  PyArrayObject *__pyx_t_7 = NULL;
  PyArrayObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  PyArrayObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  size_t __pyx_t_15;
  size_t __pyx_t_16;
  size_t __pyx_t_17;
  size_t __pyx_t_18;
  size_t __pyx_t_19;
  size_t __pyx_t_20;
  size_t __pyx_t_21;
  size_t __pyx_t_22;
  size_t __pyx_t_23;
  size_t __pyx_t_24;
  int __pyx_t_25;
  PyObject *__pyx_t_26;
  size_t __pyx_t_27;
  size_t __pyx_t_28;
  size_t __pyx_t_29;
  size_t __pyx_t_30;
  size_t __pyx_t_31;
  size_t __pyx_t_32;
  size_t __pyx_t_33;
  size_t __pyx_t_34;
  size_t __pyx_t_35;
  size_t __pyx_t_36;
  size_t __pyx_t_37;
  size_t __pyx_t_38;
  size_t __pyx_t_39;
  size_t __pyx_t_40;
  size_t __pyx_t_41;
  size_t __pyx_t_42;
  size_t __pyx_t_43;
  size_t __pyx_t_44;
  size_t __pyx_t_45;
  size_t __pyx_t_46;
  size_t __pyx_t_47;
  size_t __pyx_t_48;
  size_t __pyx_t_49;
  size_t __pyx_t_50;
  size_t __pyx_t_51;
  size_t __pyx_t_52;
  size_t __pyx_t_53;
  size_t __pyx_t_54;
  size_t __pyx_t_55;
  size_t __pyx_t_56;
  size_t __pyx_t_57;
  size_t __pyx_t_58;
  size_t __pyx_t_59;
  size_t __pyx_t_60;
  __Pyx_SetupRefcountContext("global_align");
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_gap = __pyx_optional_args->gap;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_match = __pyx_optional_args->match;
        if (__pyx_optional_args->__pyx_n > 2) {
          __pyx_v_mismatch = __pyx_optional_args->mismatch;
          if (__pyx_optional_args->__pyx_n > 3) {
            __pyx_v_gap_init = __pyx_optional_args->gap_init;
            if (__pyx_optional_args->__pyx_n > 4) {
              __pyx_v_matrix = __pyx_optional_args->matrix;
            }
          }
        }
      }
    }
  }
  __pyx_v_amatrix = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_pyheader = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_py_ci = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_py_cj = Py_None; __Pyx_INCREF(Py_None);
  __pyx_bstruct_agap.buf = NULL;
  __pyx_bstruct_score.buf = NULL;
  __pyx_bstruct_pointer.buf = NULL;
  __pyx_bstruct_amatrix.buf = NULL;

  /* "/opt/src/bpbio/nwalign/nwalign.pyx":132
 * 
 *     """
 *     cdef char* seqj = _seqj             # <<<<<<<<<<<<<<
 *     cdef char* seqi = _seqi
 * 
 */
  __pyx_t_1 = __Pyx_PyBytes_AsString(__pyx_v__seqj); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_seqj = __pyx_t_1;

  /* "/opt/src/bpbio/nwalign/nwalign.pyx":133
 *     """
 *     cdef char* seqj = _seqj
 *     cdef char* seqi = _seqi             # <<<<<<<<<<<<<<
 * 
 *     cdef size_t max_j = strlen(seqj)
 */
  __pyx_t_1 = __Pyx_PyBytes_AsString(__pyx_v__seqi); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_seqi = __pyx_t_1;

  /* "/opt/src/bpbio/nwalign/nwalign.pyx":135
 *     cdef char* seqi = _seqi
 * 
 *     cdef size_t max_j = strlen(seqj)             # <<<<<<<<<<<<<<
 *     cdef size_t max_i = strlen(seqi)
 *     cdef size_t i, j, seqlen, align_counter = 0, p
 */
  __pyx_v_max_j = strlen(__pyx_v_seqj);

  /* "/opt/src/bpbio/nwalign/nwalign.pyx":136
 * 
 *     cdef size_t max_j = strlen(seqj)
 *     cdef size_t max_i = strlen(seqi)             # <<<<<<<<<<<<<<
 *     cdef size_t i, j, seqlen, align_counter = 0, p
 *     cdef int diag_score, up_score, left_score, tscore
 */
  __pyx_v_max_i = strlen(__pyx_v_seqi);

  /* "/opt/src/bpbio/nwalign/nwalign.pyx":137
 *     cdef size_t max_j = strlen(seqj)
 *     cdef size_t max_i = strlen(seqi)
 *     cdef size_t i, j, seqlen, align_counter = 0, p             # <<<<<<<<<<<<<<
 *     cdef int diag_score, up_score, left_score, tscore
 * 
 */
  __pyx_v_align_counter = 0;

  /* "/opt/src/bpbio/nwalign/nwalign.pyx":144
 *     cdef size_t ii, jj
 *     cdef PyObject *ai, *aj
 *     cdef int zero=0, one=1             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_v_zero = 0;
  __pyx_v_one = 1;

  /* "/opt/src/bpbio/nwalign/nwalign.pyx":147
 * 
 * 
 *     cdef np.ndarray[DTYPE_BOOL, ndim=2] agap = np.zeros((max_i + 1, max_j + 1), dtype=np.int8)             # <<<<<<<<<<<<<<
 *     cdef np.ndarray[DTYPE_INT, ndim=2] score = np.zeros((max_i + 1, max_j + 1), dtype=np.int)
 *     cdef np.ndarray[DTYPE_UINT, ndim=2] pointer = np.zeros((max_i + 1, max_j + 1), dtype=np.uint)
 */
  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_1, __pyx_kp_zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
  __pyx_t_3 = __Pyx_PyInt_FromSize_t((__pyx_v_max_i + 1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyInt_FromSize_t((__pyx_v_max_j + 1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_5));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
  __pyx_t_5 = 0;
  __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_1));
  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_2);
  __pyx_t_5 = PyObject_GetAttr(__pyx_2, __pyx_kp_29); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_2); __pyx_2 = 0;
  if (PyDict_SetItem(__pyx_1, __pyx_kp_dtype, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0;
  if (!(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
  if (unlikely(__Pyx_GetBuffer_nn___pyx_t_7nwalign_DTYPE_BOOL((PyObject*)__pyx_t_6, &__pyx_bstruct_agap, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0) == -1)) {
    __pyx_v_agap = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_agap.buf = NULL;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  } else {__pyx_bstride_0_agap = __pyx_bstruct_agap.strides[0]; __pyx_bstride_1_agap = __pyx_bstruct_agap.strides[1];
    __pyx_bshape_0_agap = __pyx_bstruct_agap.shape[0]; __pyx_bshape_1_agap = __pyx_bstruct_agap.shape[1];
  }
  __pyx_t_6 = 0;
  __pyx_v_agap = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "/opt/src/bpbio/nwalign/nwalign.pyx":148
 * 
 *     cdef np.ndarray[DTYPE_BOOL, ndim=2] agap = np.zeros((max_i + 1, max_j + 1), dtype=np.int8)
 *     cdef np.ndarray[DTYPE_INT, ndim=2] score = np.zeros((max_i + 1, max_j + 1), dtype=np.int)             # <<<<<<<<<<<<<<
 *     cdef np.ndarray[DTYPE_UINT, ndim=2] pointer = np.zeros((max_i + 1, max_j + 1), dtype=np.uint)
 *     cdef np.ndarray[DTYPE_INT, ndim=2] amatrix
 */
  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_2);
  __pyx_t_5 = PyObject_GetAttr(__pyx_2, __pyx_kp_zeros); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_2); __pyx_2 = 0;
  __pyx_t_4 = __Pyx_PyInt_FromSize_t((__pyx_v_max_i + 1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyInt_FromSize_t((__pyx_v_max_j + 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_4 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
  __pyx_t_3 = 0;
  __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_1));
  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_2);
  __pyx_t_3 = PyObject_GetAttr(__pyx_2, __pyx_kp_int); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_2); __pyx_2 = 0;
  if (PyDict_SetItem(__pyx_1, __pyx_kp_dtype, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_5, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0;
  if (!(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_7 = ((PyArrayObject *)__pyx_t_3);
  if (unlikely(__Pyx_GetBuffer_nn___pyx_t_7nwalign_DTYPE_INT((PyObject*)__pyx_t_7, &__pyx_bstruct_score, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0) == -1)) {
    __pyx_v_score = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_score.buf = NULL;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  } else {__pyx_bstride_0_score = __pyx_bstruct_score.strides[0]; __pyx_bstride_1_score = __pyx_bstruct_score.strides[1];
    __pyx_bshape_0_score = __pyx_bstruct_score.shape[0]; __pyx_bshape_1_score = __pyx_bstruct_score.shape[1];
  }
  __pyx_t_7 = 0;
  __pyx_v_score = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "/opt/src/bpbio/nwalign/nwalign.pyx":149
 *     cdef np.ndarray[DTYPE_BOOL, ndim=2] agap = np.zeros((max_i + 1, max_j + 1), dtype=np.int8)
 *     cdef np.ndarray[DTYPE_INT, ndim=2] score = np.zeros((max_i + 1, max_j + 1), dtype=np.int)
 *     cdef np.ndarray[DTYPE_UINT, ndim=2] pointer = np.zeros((max_i + 1, max_j + 1), dtype=np.uint)             # <<<<<<<<<<<<<<
 *     cdef np.ndarray[DTYPE_INT, ndim=2] amatrix
 * 
 */
  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_2);
  __pyx_t_3 = PyObject_GetAttr(__pyx_2, __pyx_kp_zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_2); __pyx_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_FromSize_t((__pyx_v_max_i + 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyInt_FromSize_t((__pyx_v_max_j + 1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_2 = 0;
  __pyx_t_5 = 0;
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_4));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
  __pyx_t_4 = 0;
  __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_1));
  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_2);
  __pyx_t_4 = PyObject_GetAttr(__pyx_2, __pyx_kp_uint); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_2); __pyx_2 = 0;
  if (PyDict_SetItem(__pyx_1, __pyx_kp_dtype, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0;
  if (!(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_8 = ((PyArrayObject *)__pyx_t_4);
  if (unlikely(__Pyx_GetBuffer_nn___pyx_t_7nwalign_DTYPE_UINT((PyObject*)__pyx_t_8, &__pyx_bstruct_pointer, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0) == -1)) {
    __pyx_v_pointer = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_pointer.buf = NULL;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  } else {__pyx_bstride_0_pointer = __pyx_bstruct_pointer.strides[0]; __pyx_bstride_1_pointer = __pyx_bstruct_pointer.strides[1];
    __pyx_bshape_0_pointer = __pyx_bstruct_pointer.shape[0]; __pyx_bshape_1_pointer = __pyx_bstruct_pointer.shape[1];
  }
  __pyx_t_8 = 0;
  __pyx_v_pointer = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "/opt/src/bpbio/nwalign/nwalign.pyx":154
 * 
 * 
 *     if matrix is not None:             # <<<<<<<<<<<<<<
 *         pyheader, amatrix = read_matrix(matrix)
 *         sheader = pyheader
 */
  __pyx_t_9 = (__pyx_v_matrix != Py_None);
  if (__pyx_t_9) {

    /* "/opt/src/bpbio/nwalign/nwalign.pyx":155
 * 
 *     if matrix is not None:
 *         pyheader, amatrix = read_matrix(matrix)             # <<<<<<<<<<<<<<
 *         sheader = pyheader
 * 
 */
    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_read_matrix); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_2);
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_INCREF(__pyx_v_matrix);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_matrix);
    __Pyx_GIVEREF(__pyx_v_matrix);
    __pyx_t_5 = PyObject_Call(__pyx_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_2); __pyx_2 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    if (PyTuple_CheckExact(__pyx_t_5) && likely(PyTuple_GET_SIZE(__pyx_t_5) == 2)) {
      PyObject* tuple = __pyx_t_5;
      __pyx_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2);
      __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3);
      if (!(__Pyx_TypeTest(__pyx_3, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_v_pyheader);
      __pyx_v_pyheader = __pyx_2;
      __pyx_2 = 0;
      __pyx_t_10 = ((PyArrayObject *)__pyx_3);
      __Pyx_SafeReleaseBuffer(&__pyx_bstruct_amatrix);
      __pyx_t_11 = __Pyx_GetBuffer_nn___pyx_t_7nwalign_DTYPE_INT((PyObject*)__pyx_t_10, &__pyx_bstruct_amatrix, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0);
      if (unlikely(__pyx_t_11 < 0)) {
        PyErr_Fetch(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
        if (unlikely(__Pyx_GetBuffer_nn___pyx_t_7nwalign_DTYPE_INT((PyObject*)__pyx_v_amatrix, &__pyx_bstruct_amatrix, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0) == -1)) {
          Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_14);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_12, __pyx_t_13, __pyx_t_14);
        }
      }
      __pyx_bstride_0_amatrix = __pyx_bstruct_amatrix.strides[0]; __pyx_bstride_1_amatrix = __pyx_bstruct_amatrix.strides[1];
      __pyx_bshape_0_amatrix = __pyx_bstruct_amatrix.shape[0]; __pyx_bshape_1_amatrix = __pyx_bstruct_amatrix.shape[1];
      if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_10 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_v_amatrix));
      __pyx_v_amatrix = ((PyArrayObject *)__pyx_3);
      __pyx_3 = 0;
    } else {
      __pyx_1 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_2);
      __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_3);
      if (!(__Pyx_TypeTest(__pyx_3, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
      __Pyx_DECREF(__pyx_v_pyheader);
      __pyx_v_pyheader = __pyx_2;
      __pyx_2 = 0;
      __pyx_t_10 = ((PyArrayObject *)__pyx_3);
      __Pyx_SafeReleaseBuffer(&__pyx_bstruct_amatrix);
      __pyx_t_11 = __Pyx_GetBuffer_nn___pyx_t_7nwalign_DTYPE_INT((PyObject*)__pyx_t_10, &__pyx_bstruct_amatrix, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0);
      if (unlikely(__pyx_t_11 < 0)) {
        PyErr_Fetch(&__pyx_t_14, &__pyx_t_13, &__pyx_t_12);
        if (unlikely(__Pyx_GetBuffer_nn___pyx_t_7nwalign_DTYPE_INT((PyObject*)__pyx_v_amatrix, &__pyx_bstruct_amatrix, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0) == -1)) {
          Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_12);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_14, __pyx_t_13, __pyx_t_12);
        }
      }
      __pyx_bstride_0_amatrix = __pyx_bstruct_amatrix.strides[0]; __pyx_bstride_1_amatrix = __pyx_bstruct_amatrix.strides[1];
      __pyx_bshape_0_amatrix = __pyx_bstruct_amatrix.shape[0]; __pyx_bshape_1_amatrix = __pyx_bstruct_amatrix.shape[1];
      if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_10 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_v_amatrix));
      __pyx_v_amatrix = ((PyArrayObject *)__pyx_3);
      __pyx_3 = 0;
    }

    /* "/opt/src/bpbio/nwalign/nwalign.pyx":156
 *     if matrix is not None:
 *         pyheader, amatrix = read_matrix(matrix)
 *         sheader = pyheader             # <<<<<<<<<<<<<<
 * 
 *     pointer[<size_t>0, <size_t>0] = NONE
 */
    __pyx_t_1 = __Pyx_PyBytes_AsString(__pyx_v_pyheader); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_sheader = __pyx_t_1;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/opt/src/bpbio/nwalign/nwalign.pyx":158
 *         sheader = pyheader
 * 
 *     pointer[<size_t>0, <size_t>0] = NONE             # <<<<<<<<<<<<<<
 *     score[<size_t>0, <size_t>0] = 0
 * 
 */
  __pyx_t_15 = ((size_t)0);
  __pyx_t_16 = ((size_t)0);
  *__Pyx_BufPtrStrided2d(__pyx_t_7nwalign_DTYPE_UINT *, __pyx_bstruct_pointer.buf, __pyx_t_15, __pyx_bstride_0_pointer, __pyx_t_16, __pyx_bstride_1_pointer) = __pyx_v_7nwalign_NONE;

  /* "/opt/src/bpbio/nwalign/nwalign.pyx":159
 * 
 *     pointer[<size_t>0, <size_t>0] = NONE
 *     score[<size_t>0, <size_t>0] = 0             # <<<<<<<<<<<<<<
 * 
 *     pointer[<size_t>0, <size_t>1:] = LEFT
 */
  __pyx_t_17 = ((size_t)0);
  __pyx_t_18 = ((size_t)0);
  *__Pyx_BufPtrStrided2d(__pyx_t_7nwalign_DTYPE_INT *, __pyx_bstruct_score.buf, __pyx_t_17, __pyx_bstride_0_score, __pyx_t_18, __pyx_bstride_1_score) = 0;

  /* "/opt/src/bpbio/nwalign/nwalign.pyx":161
 *     score[<size_t>0, <size_t>0] = 0
 * 
 *     pointer[<size_t>0, <size_t>1:] = LEFT             # <<<<<<<<<<<<<<
 *     pointer[<size_t>1:, <size_t>0] = UP
 * 
 */
  __pyx_t_5 = __Pyx_PyInt_FromSize_t(__pyx_v_7nwalign_LEFT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyInt_FromSize_t(((size_t)0)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyInt_FromSize_t(((size_t)1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_1 = PySlice_New(__pyx_t_3, Py_None, Py_None); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_1);
  __Pyx_GIVEREF(__pyx_1);
  __pyx_t_4 = 0;
  __pyx_1 = 0;
  if (PyObject_SetItem(((PyObject *)__pyx_v_pointer), ((PyObject *)__pyx_t_3), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "/opt/src/bpbio/nwalign/nwalign.pyx":162
 * 
 *     pointer[<size_t>0, <size_t>1:] = LEFT
 *     pointer[<size_t>1:, <size_t>0] = UP             # <<<<<<<<<<<<<<
 * 
 *     score[<size_t>0, <size_t>1:] = gap * np.arange(max_j, dtype=np.int)
 */
  __pyx_t_5 = __Pyx_PyInt_FromSize_t(__pyx_v_7nwalign_UP); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = __Pyx_PyInt_FromSize_t(((size_t)1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_2 = PySlice_New(__pyx_t_3, Py_None, Py_None); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyInt_FromSize_t(((size_t)0)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_2);
  __Pyx_GIVEREF(__pyx_2);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_2 = 0;
  __pyx_t_3 = 0;
  if (PyObject_SetItem(((PyObject *)__pyx_v_pointer), ((PyObject *)__pyx_t_4), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "/opt/src/bpbio/nwalign/nwalign.pyx":164
 *     pointer[<size_t>1:, <size_t>0] = UP
 * 
 *     score[<size_t>0, <size_t>1:] = gap * np.arange(max_j, dtype=np.int)             # <<<<<<<<<<<<<<
 *     score[<size_t>1:, <size_t>0] = gap * np.arange(max_i, dtype=np.int)
 * 
 */
  __pyx_t_5 = PyInt_FromLong(__pyx_v_gap); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_3);
  __pyx_t_4 = PyObject_GetAttr(__pyx_3, __pyx_kp_arange); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_3); __pyx_3 = 0;
  __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_max_j); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_1));
  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_2);
  __pyx_t_3 = PyObject_GetAttr(__pyx_2, __pyx_kp_int); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_2); __pyx_2 = 0;
  if (PyDict_SetItem(__pyx_1, __pyx_kp_dtype, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_4, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0;
  __pyx_t_2 = PyNumber_Multiply(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyInt_FromSize_t(((size_t)0)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyInt_FromSize_t(((size_t)1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_3 = PySlice_New(__pyx_t_5, Py_None, Py_None); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_3);
  __Pyx_GIVEREF(__pyx_3);
  __pyx_t_3 = 0;
  __pyx_3 = 0;
  if (PyObject_SetItem(((PyObject *)__pyx_v_score), ((PyObject *)__pyx_t_5), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/opt/src/bpbio/nwalign/nwalign.pyx":165
 * 
 *     score[<size_t>0, <size_t>1:] = gap * np.arange(max_j, dtype=np.int)
 *     score[<size_t>1:, <size_t>0] = gap * np.arange(max_i, dtype=np.int)             # <<<<<<<<<<<<<<
 * 
 *     agap[<size_t>0, <size_t>1:] = one
 */
  __pyx_t_2 = PyInt_FromLong(__pyx_v_gap); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_2);
  __pyx_t_5 = PyObject_GetAttr(__pyx_2, __pyx_kp_arange); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_2); __pyx_2 = 0;
  __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_max_i); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_1));
  __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_3);
  __pyx_t_3 = PyObject_GetAttr(__pyx_3, __pyx_kp_int); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_3); __pyx_3 = 0;
  if (PyDict_SetItem(__pyx_1, __pyx_kp_dtype, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_5, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0;
  __pyx_t_4 = PyNumber_Multiply(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __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_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyInt_FromSize_t(((size_t)1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_2 = PySlice_New(__pyx_t_3, Py_None, Py_None); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyInt_FromSize_t(((size_t)0)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_2);
  __Pyx_GIVEREF(__pyx_2);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_2 = 0;
  __pyx_t_3 = 0;
  if (PyObject_SetItem(((PyObject *)__pyx_v_score), ((PyObject *)__pyx_t_2), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/opt/src/bpbio/nwalign/nwalign.pyx":167
 *     score[<size_t>1:, <size_t>0] = gap * np.arange(max_i, dtype=np.int)
 * 
 *     agap[<size_t>0, <size_t>1:] = one             # <<<<<<<<<<<<<<
 *     agap[<size_t>1:, <size_t>0] = one
 *     agap[<size_t>0, <size_t>0] = zero
 */
  __pyx_t_4 = PyInt_FromLong(__pyx_v_one); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyInt_FromSize_t(((size_t)0)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_FromSize_t(((size_t)1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_3 = PySlice_New(__pyx_t_3, Py_None, Py_None); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_3);
  __Pyx_GIVEREF(__pyx_3);
  __pyx_t_2 = 0;
  __pyx_3 = 0;
  if (PyObject_SetItem(((PyObject *)__pyx_v_agap), ((PyObject *)__pyx_t_3), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/opt/src/bpbio/nwalign/nwalign.pyx":168
 * 
 *     agap[<size_t>0, <size_t>1:] = one
 *     agap[<size_t>1:, <size_t>0] = one             # <<<<<<<<<<<<<<
 *     agap[<size_t>0, <size_t>0] = zero
 * 
 */
  __pyx_t_4 = PyInt_FromLong(__pyx_v_one); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyInt_FromSize_t(((size_t)1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_1 = PySlice_New(__pyx_t_3, Py_None, Py_None); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyInt_FromSize_t(((size_t)0)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_1);
  __Pyx_GIVEREF(__pyx_1);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_1 = 0;
  __pyx_t_3 = 0;
  if (PyObject_SetItem(((PyObject *)__pyx_v_agap), ((PyObject *)__pyx_t_2), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/opt/src/bpbio/nwalign/nwalign.pyx":169
 *     agap[<size_t>0, <size_t>1:] = one
 *     agap[<size_t>1:, <size_t>0] = one
 *     agap[<size_t>0, <size_t>0] = zero             # <<<<<<<<<<<<<<
 * 
 *     for i in range(1, max_i + 1):
 */
  __pyx_t_19 = ((size_t)0);
  __pyx_t_20 = ((size_t)0);
  *__Pyx_BufPtrStrided2d(__pyx_t_7nwalign_DTYPE_BOOL *, __pyx_bstruct_agap.buf, __pyx_t_19, __pyx_bstride_0_agap, __pyx_t_20, __pyx_bstride_1_agap) = __pyx_v_zero;

  /* "/opt/src/bpbio/nwalign/nwalign.pyx":171
 *     agap[<size_t>0, <size_t>0] = zero
 * 
 *     for i in range(1, max_i + 1):             # <<<<<<<<<<<<<<
 *         ci = seqi[i - 1]
 *         for j in range(1, max_j + 1):
 */
  for (__pyx_t_21 = 1; __pyx_t_21 < (__pyx_v_max_i + 1); __pyx_t_21+=1) {
    __pyx_v_i = __pyx_t_21;

    /* "/opt/src/bpbio/nwalign/nwalign.pyx":172
 * 
 *     for i in range(1, max_i + 1):
 *         ci = seqi[i - 1]             # <<<<<<<<<<<<<<
 *         for j in range(1, max_j + 1):
 *             cj = seqj[j - 1]
 */
    __pyx_v_ci = (__pyx_v_seqi[(__pyx_v_i - 1)]);

    /* "/opt/src/bpbio/nwalign/nwalign.pyx":173
 *     for i in range(1, max_i + 1):
 *         ci = seqi[i - 1]
 *         for j in range(1, max_j + 1):             # <<<<<<<<<<<<<<
 *             cj = seqj[j - 1]
 * 
 */
    for (__pyx_t_22 = 1; __pyx_t_22 < (__pyx_v_max_j + 1); __pyx_t_22+=1) {
      __pyx_v_j = __pyx_t_22;

      /* "/opt/src/bpbio/nwalign/nwalign.pyx":174
 *         ci = seqi[i - 1]
 *         for j in range(1, max_j + 1):
 *             cj = seqj[j - 1]             # <<<<<<<<<<<<<<
 * 
 *             if matrix is None:
 */
      __pyx_v_cj = (__pyx_v_seqj[(__pyx_v_j - 1)]);

      /* "/opt/src/bpbio/nwalign/nwalign.pyx":176
 *             cj = seqj[j - 1]
 * 
 *             if matrix is None:             # <<<<<<<<<<<<<<
 *                 diag_score = score[i - 1, j - 1] + (cj == ci and match or mismatch)
 *             else:
 */
      __pyx_t_9 = (__pyx_v_matrix == Py_None);
      if (__pyx_t_9) {

        /* "/opt/src/bpbio/nwalign/nwalign.pyx":177
 * 
 *             if matrix is None:
 *                 diag_score = score[i - 1, j - 1] + (cj == ci and match or mismatch)             # <<<<<<<<<<<<<<
 *             else:
 *                 ii = strpos(sheader, ci)
 */
        __pyx_t_23 = (__pyx_v_i - 1);
        __pyx_t_24 = (__pyx_v_j - 1);
        if ((__pyx_v_cj == __pyx_v_ci)) {
          __pyx_t_9 = __pyx_v_match;
        } else {
          __pyx_t_9 = (__pyx_v_cj == __pyx_v_ci);
        }
        if (!__pyx_t_9) {
          __pyx_t_25 = __pyx_v_mismatch;
        } else {
          __pyx_t_25 = __pyx_t_9;
        }
        __pyx_v_diag_score = ((*__Pyx_BufPtrStrided2d(__pyx_t_7nwalign_DTYPE_INT *, __pyx_bstruct_score.buf, __pyx_t_23, __pyx_bstride_0_score, __pyx_t_24, __pyx_bstride_1_score)) + __pyx_t_25);
        goto __pyx_L8;
      }
      /*else*/ {

        /* "/opt/src/bpbio/nwalign/nwalign.pyx":179
 *                 diag_score = score[i - 1, j - 1] + (cj == ci and match or mismatch)
 *             else:
 *                 ii = strpos(sheader, ci)             # <<<<<<<<<<<<<<
 *                 jj = strpos(sheader, cj)
 *                 if ii == -1 or jj == -1:
 */
        __pyx_v_ii = __pyx_f_7nwalign_strpos(__pyx_v_sheader, __pyx_v_ci);

        /* "/opt/src/bpbio/nwalign/nwalign.pyx":180
 *             else:
 *                 ii = strpos(sheader, ci)
 *                 jj = strpos(sheader, cj)             # <<<<<<<<<<<<<<
 *                 if ii == -1 or jj == -1:
 *                     if ii == -1:
 */
        __pyx_v_jj = __pyx_f_7nwalign_strpos(__pyx_v_sheader, __pyx_v_cj);

        /* "/opt/src/bpbio/nwalign/nwalign.pyx":181
 *                 ii = strpos(sheader, ci)
 *                 jj = strpos(sheader, cj)
 *                 if ii == -1 or jj == -1:             # <<<<<<<<<<<<<<
 *                     if ii == -1:
 *                         py_ci = <object>PyString_FromStringAndSize(&ci, <size_t>1)
 */
        if (!(__pyx_v_ii == -1)) {
          __pyx_t_25 = (__pyx_v_jj == -1);
        } else {
          __pyx_t_25 = (__pyx_v_ii == -1);
        }
        if (__pyx_t_25) {

          /* "/opt/src/bpbio/nwalign/nwalign.pyx":182
 *                 jj = strpos(sheader, cj)
 *                 if ii == -1 or jj == -1:
 *                     if ii == -1:             # <<<<<<<<<<<<<<
 *                         py_ci = <object>PyString_FromStringAndSize(&ci, <size_t>1)
 *                         #raise Exception(py_ci + "from: " + seqi  + " not in scoring matrix")
 */
          __pyx_t_25 = (__pyx_v_ii == -1);
          if (__pyx_t_25) {

            /* "/opt/src/bpbio/nwalign/nwalign.pyx":183
 *                 if ii == -1 or jj == -1:
 *                     if ii == -1:
 *                         py_ci = <object>PyString_FromStringAndSize(&ci, <size_t>1)             # <<<<<<<<<<<<<<
 *                         #raise Exception(py_ci + "from: " + seqi  + " not in scoring matrix")
 *                         sys.stderr.write("'" + py_ci + "' from: " + seqi  + " not in scoring matrix\n")
 */
            __pyx_t_26 = PyString_FromStringAndSize((&__pyx_v_ci), ((size_t)1));
            __Pyx_INCREF(((PyObject *)__pyx_t_26));
            __Pyx_DECREF(__pyx_v_py_ci);
            __pyx_v_py_ci = ((PyObject *)__pyx_t_26);

            /* "/opt/src/bpbio/nwalign/nwalign.pyx":185
 *                         py_ci = <object>PyString_FromStringAndSize(&ci, <size_t>1)
 *                         #raise Exception(py_ci + "from: " + seqi  + " not in scoring matrix")
 *                         sys.stderr.write("'" + py_ci + "' from: " + seqi  + " not in scoring matrix\n")             # <<<<<<<<<<<<<<
 *                     if jj == -1:
 *                         py_cj = <object>PyString_FromStringAndSize(&cj, <size_t>1)
 */
            __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_sys); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_2);
            __pyx_t_4 = PyObject_GetAttr(__pyx_2, __pyx_kp_stderr); 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_2); __pyx_2 = 0;
            __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_kp_write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            __pyx_t_4 = PyNumber_Add(__pyx_kp_30, __pyx_v_py_ci); 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_t_3 = PyNumber_Add(__pyx_t_4, __pyx_kp_31); 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_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_seqi); 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_t_5 = PyNumber_Add(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_5);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            __pyx_t_4 = PyNumber_Add(__pyx_t_5, __pyx_kp_32); 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_5); __pyx_t_5 = 0;
            __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(((PyObject *)__pyx_t_5));
            PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
            __Pyx_GIVEREF(__pyx_t_4);
            __pyx_t_4 = 0;
            __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_5), 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_2); __pyx_t_2 = 0;
            __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            goto __pyx_L10;
          }
          __pyx_L10:;

          /* "/opt/src/bpbio/nwalign/nwalign.pyx":186
 *                         #raise Exception(py_ci + "from: " + seqi  + " not in scoring matrix")
 *                         sys.stderr.write("'" + py_ci + "' from: " + seqi  + " not in scoring matrix\n")
 *                     if jj == -1:             # <<<<<<<<<<<<<<
 *                         py_cj = <object>PyString_FromStringAndSize(&cj, <size_t>1)
 *                         #raise Exception(py_cj + "from: " + seqj + " not in scoring matrix")
 */
          __pyx_t_25 = (__pyx_v_jj == -1);
          if (__pyx_t_25) {

            /* "/opt/src/bpbio/nwalign/nwalign.pyx":187
 *                         sys.stderr.write("'" + py_ci + "' from: " + seqi  + " not in scoring matrix\n")
 *                     if jj == -1:
 *                         py_cj = <object>PyString_FromStringAndSize(&cj, <size_t>1)             # <<<<<<<<<<<<<<
 *                         #raise Exception(py_cj + "from: " + seqj + " not in scoring matrix")
 *                         sys.stderr.write("'" + py_cj + "' from: " + seqj + " not in scoring matrix\n")
 */
            __pyx_t_26 = PyString_FromStringAndSize((&__pyx_v_cj), ((size_t)1));
            __Pyx_INCREF(((PyObject *)__pyx_t_26));
            __Pyx_DECREF(__pyx_v_py_cj);
            __pyx_v_py_cj = ((PyObject *)__pyx_t_26);

            /* "/opt/src/bpbio/nwalign/nwalign.pyx":189
 *                         py_cj = <object>PyString_FromStringAndSize(&cj, <size_t>1)
 *                         #raise Exception(py_cj + "from: " + seqj + " not in scoring matrix")
 *                         sys.stderr.write("'" + py_cj + "' from: " + seqj + " not in scoring matrix\n")             # <<<<<<<<<<<<<<
 *                     sys.stderr.write("using score of score of 0\n")
 *                     tscore = 0
 */
            __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_kp_sys); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_3);
            __pyx_t_4 = PyObject_GetAttr(__pyx_3, __pyx_kp_stderr); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_DECREF(__pyx_3); __pyx_3 = 0;
            __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_kp_write); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_5);
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            __pyx_t_4 = PyNumber_Add(__pyx_kp_33, __pyx_v_py_cj); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_4);
            __pyx_t_2 = PyNumber_Add(__pyx_t_4, __pyx_kp_34); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_seqj); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_4);
            __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            __pyx_t_4 = PyNumber_Add(__pyx_t_3, __pyx_kp_35); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(((PyObject *)__pyx_t_3));
            PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
            __Pyx_GIVEREF(__pyx_t_4);
            __pyx_t_4 = 0;
            __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
            __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            goto __pyx_L11;
          }
          __pyx_L11:;

          /* "/opt/src/bpbio/nwalign/nwalign.pyx":190
 *                         #raise Exception(py_cj + "from: " + seqj + " not in scoring matrix")
 *                         sys.stderr.write("'" + py_cj + "' from: " + seqj + " not in scoring matrix\n")
 *                     sys.stderr.write("using score of score of 0\n")             # <<<<<<<<<<<<<<
 *                     tscore = 0
 *                 else:
 */
          __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_sys); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_1);
          __pyx_t_4 = PyObject_GetAttr(__pyx_1, __pyx_kp_stderr); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
          __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_kp_write); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(((PyObject *)__pyx_t_4));
          __Pyx_INCREF(__pyx_kp_36);
          PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_36);
          __Pyx_GIVEREF(__pyx_kp_36);
          __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

          /* "/opt/src/bpbio/nwalign/nwalign.pyx":191
 *                         sys.stderr.write("'" + py_cj + "' from: " + seqj + " not in scoring matrix\n")
 *                     sys.stderr.write("using score of score of 0\n")
 *                     tscore = 0             # <<<<<<<<<<<<<<
 *                 else:
 *                     tscore = amatrix[ii, jj]
 */
          __pyx_v_tscore = 0;
          goto __pyx_L9;
        }
        /*else*/ {

          /* "/opt/src/bpbio/nwalign/nwalign.pyx":193
 *                     tscore = 0
 *                 else:
 *                     tscore = amatrix[ii, jj]             # <<<<<<<<<<<<<<
 * 
 *                 diag_score = score[i - 1, j - 1] + tscore
 */
          __pyx_t_27 = __pyx_v_ii;
          __pyx_t_28 = __pyx_v_jj;
          __pyx_v_tscore = (*__Pyx_BufPtrStrided2d(__pyx_t_7nwalign_DTYPE_INT *, __pyx_bstruct_amatrix.buf, __pyx_t_27, __pyx_bstride_0_amatrix, __pyx_t_28, __pyx_bstride_1_amatrix));
        }
        __pyx_L9:;

        /* "/opt/src/bpbio/nwalign/nwalign.pyx":195
 *                     tscore = amatrix[ii, jj]
 * 
 *                 diag_score = score[i - 1, j - 1] + tscore             # <<<<<<<<<<<<<<
 * 
 *             up_score = score[i - 1, j] + (gap if agap[i - 1, j] == one else gap_init)
 */
        __pyx_t_29 = (__pyx_v_i - 1);
        __pyx_t_30 = (__pyx_v_j - 1);
        __pyx_v_diag_score = ((*__Pyx_BufPtrStrided2d(__pyx_t_7nwalign_DTYPE_INT *, __pyx_bstruct_score.buf, __pyx_t_29, __pyx_bstride_0_score, __pyx_t_30, __pyx_bstride_1_score)) + __pyx_v_tscore);
      }
      __pyx_L8:;

      /* "/opt/src/bpbio/nwalign/nwalign.pyx":197
 *                 diag_score = score[i - 1, j - 1] + tscore
 * 
 *             up_score = score[i - 1, j] + (gap if agap[i - 1, j] == one else gap_init)             # <<<<<<<<<<<<<<
 *             left_score   = score[i, j - 1] + (gap if agap[i, j - 1] == one else gap_init)
 * 
 */
      __pyx_t_31 = (__pyx_v_i - 1);
      __pyx_t_32 = __pyx_v_j;
      __pyx_t_33 = (__pyx_v_i - 1);
      __pyx_t_34 = __pyx_v_j;
      if (((*__Pyx_BufPtrStrided2d(__pyx_t_7nwalign_DTYPE_BOOL *, __pyx_bstruct_agap.buf, __pyx_t_33, __pyx_bstride_0_agap, __pyx_t_34, __pyx_bstride_1_agap)) == __pyx_v_one)) {
        __pyx_4 = __pyx_v_gap;
      } else {
        __pyx_4 = __pyx_v_gap_init;
      }
      __pyx_v_up_score = ((*__Pyx_BufPtrStrided2d(__pyx_t_7nwalign_DTYPE_INT *, __pyx_bstruct_score.buf, __pyx_t_31, __pyx_bstride_0_score, __pyx_t_32, __pyx_bstride_1_score)) + __pyx_4);

      /* "/opt/src/bpbio/nwalign/nwalign.pyx":198
 * 
 *             up_score = score[i - 1, j] + (gap if agap[i - 1, j] == one else gap_init)
 *             left_score   = score[i, j - 1] + (gap if agap[i, j - 1] == one else gap_init)             # <<<<<<<<<<<<<<
 * 
 *             if diag_score >= up_score:
 */
      __pyx_t_35 = __pyx_v_i;
      __pyx_t_36 = (__pyx_v_j - 1);
      __pyx_t_37 = __pyx_v_i;
      __pyx_t_38 = (__pyx_v_j - 1);
      if (((*__Pyx_BufPtrStrided2d(__pyx_t_7nwalign_DTYPE_BOOL *, __pyx_bstruct_agap.buf, __pyx_t_37, __pyx_bstride_0_agap, __pyx_t_38, __pyx_bstride_1_agap)) == __pyx_v_one)) {
        __pyx_4 = __pyx_v_gap;
      } else {
        __pyx_4 = __pyx_v_gap_init;
      }
      __pyx_v_left_score = ((*__Pyx_BufPtrStrided2d(__pyx_t_7nwalign_DTYPE_INT *, __pyx_bstruct_score.buf, __pyx_t_35, __pyx_bstride_0_score, __pyx_t_36, __pyx_bstride_1_score)) + __pyx_4);

      /* "/opt/src/bpbio/nwalign/nwalign.pyx":200
 *             left_score   = score[i, j - 1] + (gap if agap[i, j - 1] == one else gap_init)
 * 
 *             if diag_score >= up_score:             # <<<<<<<<<<<<<<
 *                 if diag_score >= left_score:
 *                     score[i, j] = diag_score
 */
      __pyx_t_25 = (__pyx_v_diag_score >= __pyx_v_up_score);
      if (__pyx_t_25) {

        /* "/opt/src/bpbio/nwalign/nwalign.pyx":201
 * 
 *             if diag_score >= up_score:
 *                 if diag_score >= left_score:             # <<<<<<<<<<<<<<
 *                     score[i, j] = diag_score
 *                     pointer[i, j] = DIAG
 */
        __pyx_t_25 = (__pyx_v_diag_score >= __pyx_v_left_score);
        if (__pyx_t_25) {

          /* "/opt/src/bpbio/nwalign/nwalign.pyx":202
 *             if diag_score >= up_score:
 *                 if diag_score >= left_score:
 *                     score[i, j] = diag_score             # <<<<<<<<<<<<<<
 *                     pointer[i, j] = DIAG
 *                     agap[i, j] = zero
 */
          __pyx_t_39 = __pyx_v_i;
          __pyx_t_40 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_7nwalign_DTYPE_INT *, __pyx_bstruct_score.buf, __pyx_t_39, __pyx_bstride_0_score, __pyx_t_40, __pyx_bstride_1_score) = __pyx_v_diag_score;

          /* "/opt/src/bpbio/nwalign/nwalign.pyx":203
 *                 if diag_score >= left_score:
 *                     score[i, j] = diag_score
 *                     pointer[i, j] = DIAG             # <<<<<<<<<<<<<<
 *                     agap[i, j] = zero
 *                 else:
 */
          __pyx_t_41 = __pyx_v_i;
          __pyx_t_42 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_7nwalign_DTYPE_UINT *, __pyx_bstruct_pointer.buf, __pyx_t_41, __pyx_bstride_0_pointer, __pyx_t_42, __pyx_bstride_1_pointer) = __pyx_v_7nwalign_DIAG;

          /* "/opt/src/bpbio/nwalign/nwalign.pyx":204
 *                     score[i, j] = diag_score
 *                     pointer[i, j] = DIAG
 *                     agap[i, j] = zero             # <<<<<<<<<<<<<<
 *                 else:
 *                     score[i, j] = left_score
 */
          __pyx_t_43 = __pyx_v_i;
          __pyx_t_44 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_7nwalign_DTYPE_BOOL *, __pyx_bstruct_agap.buf, __pyx_t_43, __pyx_bstride_0_agap, __pyx_t_44, __pyx_bstride_1_agap) = __pyx_v_zero;
          goto __pyx_L13;
        }
        /*else*/ {

          /* "/opt/src/bpbio/nwalign/nwalign.pyx":206
 *                     agap[i, j] = zero
 *                 else:
 *                     score[i, j] = left_score             # <<<<<<<<<<<<<<
 *                     pointer[i, j] = LEFT
 *                     agap[i, j] = one
 */
          __pyx_t_45 = __pyx_v_i;
          __pyx_t_46 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_7nwalign_DTYPE_INT *, __pyx_bstruct_score.buf, __pyx_t_45, __pyx_bstride_0_score, __pyx_t_46, __pyx_bstride_1_score) = __pyx_v_left_score;

          /* "/opt/src/bpbio/nwalign/nwalign.pyx":207
 *                 else:
 *                     score[i, j] = left_score
 *                     pointer[i, j] = LEFT             # <<<<<<<<<<<<<<
 *                     agap[i, j] = one
 *             else:
 */
          __pyx_t_47 = __pyx_v_i;
          __pyx_t_48 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_7nwalign_DTYPE_UINT *, __pyx_bstruct_pointer.buf, __pyx_t_47, __pyx_bstride_0_pointer, __pyx_t_48, __pyx_bstride_1_pointer) = __pyx_v_7nwalign_LEFT;

          /* "/opt/src/bpbio/nwalign/nwalign.pyx":208
 *                     score[i, j] = left_score
 *                     pointer[i, j] = LEFT
 *                     agap[i, j] = one             # <<<<<<<<<<<<<<
 *             else:
 *                 agap[i, j] = one
 */
          __pyx_t_49 = __pyx_v_i;
          __pyx_t_50 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_7nwalign_DTYPE_BOOL *, __pyx_bstruct_agap.buf, __pyx_t_49, __pyx_bstride_0_agap, __pyx_t_50, __pyx_bstride_1_agap) = __pyx_v_one;
        }
        __pyx_L13:;
        goto __pyx_L12;
      }
      /*else*/ {

        /* "/opt/src/bpbio/nwalign/nwalign.pyx":210
 *                     agap[i, j] = one
 *             else:
 *                 agap[i, j] = one             # <<<<<<<<<<<<<<
 *                 if up_score > left_score:
 *                     score[i, j]  = up_score
 */
        __pyx_t_51 = __pyx_v_i;
        __pyx_t_52 = __pyx_v_j;
        *__Pyx_BufPtrStrided2d(__pyx_t_7nwalign_DTYPE_BOOL *, __pyx_bstruct_agap.buf, __pyx_t_51, __pyx_bstride_0_agap, __pyx_t_52, __pyx_bstride_1_agap) = __pyx_v_one;

        /* "/opt/src/bpbio/nwalign/nwalign.pyx":211
 *             else:
 *                 agap[i, j] = one
 *                 if up_score > left_score:             # <<<<<<<<<<<<<<
 *                     score[i, j]  = up_score
 *                     pointer[i, j] = UP
 */
        __pyx_t_25 = (__pyx_v_up_score > __pyx_v_left_score);
        if (__pyx_t_25) {

          /* "/opt/src/bpbio/nwalign/nwalign.pyx":212
 *                 agap[i, j] = one
 *                 if up_score > left_score:
 *                     score[i, j]  = up_score             # <<<<<<<<<<<<<<
 *                     pointer[i, j] = UP
 *                 else:
 */
          __pyx_t_53 = __pyx_v_i;
          __pyx_t_54 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_7nwalign_DTYPE_INT *, __pyx_bstruct_score.buf, __pyx_t_53, __pyx_bstride_0_score, __pyx_t_54, __pyx_bstride_1_score) = __pyx_v_up_score;

          /* "/opt/src/bpbio/nwalign/nwalign.pyx":213
 *                 if up_score > left_score:
 *                     score[i, j]  = up_score
 *                     pointer[i, j] = UP             # <<<<<<<<<<<<<<
 *                 else:
 *                     score[i, j]   = left_score
 */
          __pyx_t_55 = __pyx_v_i;
          __pyx_t_56 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_7nwalign_DTYPE_UINT *, __pyx_bstruct_pointer.buf, __pyx_t_55, __pyx_bstride_0_pointer, __pyx_t_56, __pyx_bstride_1_pointer) = __pyx_v_7nwalign_UP;
          goto __pyx_L14;
        }
        /*else*/ {

          /* "/opt/src/bpbio/nwalign/nwalign.pyx":215
 *                     pointer[i, j] = UP
 *                 else:
 *                     score[i, j]   = left_score             # <<<<<<<<<<<<<<
 *                     pointer[i, j] = LEFT
 * 
 */
          __pyx_t_57 = __pyx_v_i;
          __pyx_t_58 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_7nwalign_DTYPE_INT *, __pyx_bstruct_score.buf, __pyx_t_57, __pyx_bstride_0_score, __pyx_t_58, __pyx_bstride_1_score) = __pyx_v_left_score;

          /* "/opt/src/bpbio/nwalign/nwalign.pyx":216
 *                 else:
 *                     score[i, j]   = left_score
 *                     pointer[i, j] = LEFT             # <<<<<<<<<<<<<<
 * 
 *     seqlen = max_i + max_j
 */
          __pyx_t_59 = __pyx_v_i;
          __pyx_t_60 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_7nwalign_DTYPE_UINT *, __pyx_bstruct_pointer.buf, __pyx_t_59, __pyx_bstride_0_pointer, __pyx_t_60, __pyx_bstride_1_pointer) = __pyx_v_7nwalign_LEFT;
        }
        __pyx_L14:;
      }
      __pyx_L12:;
    }
  }

  /* "/opt/src/bpbio/nwalign/nwalign.pyx":218
 *                     pointer[i, j] = LEFT
 * 
 *     seqlen = max_i + max_j             # <<<<<<<<<<<<<<
 *     ai = PyString_FromStringAndSize(NULL, seqlen)
 *     aj = PyString_FromStringAndSize(NULL, seqlen)
 */
  __pyx_v_seqlen = (__pyx_v_max_i + __pyx_v_max_j);

  /* "/opt/src/bpbio/nwalign/nwalign.pyx":219
 * 
 *     seqlen = max_i + max_j
 *     ai = PyString_FromStringAndSize(NULL, seqlen)             # <<<<<<<<<<<<<<
 *     aj = PyString_FromStringAndSize(NULL, seqlen)
 * 
 */
  __pyx_v_ai = PyString_FromStringAndSize(NULL, __pyx_v_seqlen);

  /* "/opt/src/bpbio/nwalign/nwalign.pyx":220
 *     seqlen = max_i + max_j
 *     ai = PyString_FromStringAndSize(NULL, seqlen)
 *     aj = PyString_FromStringAndSize(NULL, seqlen)             # <<<<<<<<<<<<<<
 * 
 *     # had to use this and PyObject instead of assigning directly...
 */
  __pyx_v_aj = PyString_FromStringAndSize(NULL, __pyx_v_seqlen);

  /* "/opt/src/bpbio/nwalign/nwalign.pyx":223
 * 
 *     # had to use this and PyObject instead of assigning directly...
 *     align_j = PyString_AS_STRING(aj)             # <<<<<<<<<<<<<<
 *     align_i = PyString_AS_STRING(ai)
 * 
 */
  __pyx_v_align_j = PyString_AS_STRING(__pyx_v_aj);

  /* "/opt/src/bpbio/nwalign/nwalign.pyx":224
 *     # had to use this and PyObject instead of assigning directly...
 *     align_j = PyString_AS_STRING(aj)
 *     align_i = PyString_AS_STRING(ai)             # <<<<<<<<<<<<<<
 * 
 *     while True:
 */
  __pyx_v_align_i = PyString_AS_STRING(__pyx_v_ai);

  /* "/opt/src/bpbio/nwalign/nwalign.pyx":226
 *     align_i = PyString_AS_STRING(ai)
 * 
 *     while True:             # <<<<<<<<<<<<<<
 *         p = pointer[i, j]
 *         if p == NONE: break
 */
  while (1) {
    __pyx_t_25 = 1;
    if (!__pyx_t_25) break;

    /* "/opt/src/bpbio/nwalign/nwalign.pyx":227
 * 
 *     while True:
 *         p = pointer[i, j]             # <<<<<<<<<<<<<<
 *         if p == NONE: break
 *         if p == DIAG:
 */
    __pyx_t_21 = __pyx_v_i;
    __pyx_t_22 = __pyx_v_j;
    __pyx_v_p = (*__Pyx_BufPtrStrided2d(__pyx_t_7nwalign_DTYPE_UINT *, __pyx_bstruct_pointer.buf, __pyx_t_21, __pyx_bstride_0_pointer, __pyx_t_22, __pyx_bstride_1_pointer));

    /* "/opt/src/bpbio/nwalign/nwalign.pyx":228
 *     while True:
 *         p = pointer[i, j]
 *         if p == NONE: break             # <<<<<<<<<<<<<<
 *         if p == DIAG:
 *             i -= 1
 */
    __pyx_t_25 = (__pyx_v_p == __pyx_v_7nwalign_NONE);
    if (__pyx_t_25) {
      goto __pyx_L16_break;
      goto __pyx_L17;
    }
    __pyx_L17:;

    /* "/opt/src/bpbio/nwalign/nwalign.pyx":229
 *         p = pointer[i, j]
 *         if p == NONE: break
 *         if p == DIAG:             # <<<<<<<<<<<<<<
 *             i -= 1
 *             j -= 1
 */
    __pyx_t_25 = (__pyx_v_p == __pyx_v_7nwalign_DIAG);
    if (__pyx_t_25) {

      /* "/opt/src/bpbio/nwalign/nwalign.pyx":230
 *         if p == NONE: break
 *         if p == DIAG:
 *             i -= 1             # <<<<<<<<<<<<<<
 *             j -= 1
 *             align_j[align_counter] = seqj[j]
 */
      __pyx_v_i -= 1;

      /* "/opt/src/bpbio/nwalign/nwalign.pyx":231
 *         if p == DIAG:
 *             i -= 1
 *             j -= 1             # <<<<<<<<<<<<<<
 *             align_j[align_counter] = seqj[j]
 *             align_i[align_counter] = seqi[i]
 */
      __pyx_v_j -= 1;

      /* "/opt/src/bpbio/nwalign/nwalign.pyx":232
 *             i -= 1
 *             j -= 1
 *             align_j[align_counter] = seqj[j]             # <<<<<<<<<<<<<<
 *             align_i[align_counter] = seqi[i]
 *         elif p == LEFT:
 */
      (__pyx_v_align_j[__pyx_v_align_counter]) = (__pyx_v_seqj[__pyx_v_j]);

      /* "/opt/src/bpbio/nwalign/nwalign.pyx":233
 *             j -= 1
 *             align_j[align_counter] = seqj[j]
 *             align_i[align_counter] = seqi[i]             # <<<<<<<<<<<<<<
 *         elif p == LEFT:
 *             j -= 1
 */
      (__pyx_v_align_i[__pyx_v_align_counter]) = (__pyx_v_seqi[__pyx_v_i]);
      goto __pyx_L18;
    }

    /* "/opt/src/bpbio/nwalign/nwalign.pyx":234
 *             align_j[align_counter] = seqj[j]
 *             align_i[align_counter] = seqi[i]
 *         elif p == LEFT:             # <<<<<<<<<<<<<<
 *             j -= 1
 *             align_j[align_counter] = seqj[j]
 */
    __pyx_t_25 = (__pyx_v_p == __pyx_v_7nwalign_LEFT);
    if (__pyx_t_25) {

      /* "/opt/src/bpbio/nwalign/nwalign.pyx":235
 *             align_i[align_counter] = seqi[i]
 *         elif p == LEFT:
 *             j -= 1             # <<<<<<<<<<<<<<
 *             align_j[align_counter] = seqj[j]
 *             align_i[align_counter] = c"-"
 */
      __pyx_v_j -= 1;

      /* "/opt/src/bpbio/nwalign/nwalign.pyx":236
 *         elif p == LEFT:
 *             j -= 1
 *             align_j[align_counter] = seqj[j]             # <<<<<<<<<<<<<<
 *             align_i[align_counter] = c"-"
 *         elif p == UP:
 */
      (__pyx_v_align_j[__pyx_v_align_counter]) = (__pyx_v_seqj[__pyx_v_j]);

      /* "/opt/src/bpbio/nwalign/nwalign.pyx":237
 *             j -= 1
 *             align_j[align_counter] = seqj[j]
 *             align_i[align_counter] = c"-"             # <<<<<<<<<<<<<<
 *         elif p == UP:
 *             i -= 1
 */
      (__pyx_v_align_i[__pyx_v_align_counter]) = '-';
      goto __pyx_L18;
    }

    /* "/opt/src/bpbio/nwalign/nwalign.pyx":238
 *             align_j[align_counter] = seqj[j]
 *             align_i[align_counter] = c"-"
 *         elif p == UP:             # <<<<<<<<<<<<<<
 *             i -= 1
 *             align_j[align_counter] = c"-"
 */
    __pyx_t_25 = (__pyx_v_p == __pyx_v_7nwalign_UP);
    if (__pyx_t_25) {

      /* "/opt/src/bpbio/nwalign/nwalign.pyx":239
 *             align_i[align_counter] = c"-"
 *         elif p == UP:
 *             i -= 1             # <<<<<<<<<<<<<<
 *             align_j[align_counter] = c"-"
 *             align_i[align_counter] = seqi[i]
 */
      __pyx_v_i -= 1;

      /* "/opt/src/bpbio/nwalign/nwalign.pyx":240
 *         elif p == UP:
 *             i -= 1
 *             align_j[align_counter] = c"-"             # <<<<<<<<<<<<<<
 *             align_i[align_counter] = seqi[i]
 *         else:
 */
      (__pyx_v_align_j[__pyx_v_align_counter]) = '-';

      /* "/opt/src/bpbio/nwalign/nwalign.pyx":241
 *             i -= 1
 *             align_j[align_counter] = c"-"
 *             align_i[align_counter] = seqi[i]             # <<<<<<<<<<<<<<
 *         else:
 *             raise Exception('wtf!')
 */
      (__pyx_v_align_i[__pyx_v_align_counter]) = (__pyx_v_seqi[__pyx_v_i]);
      goto __pyx_L18;
    }
    /*else*/ {

      /* "/opt/src/bpbio/nwalign/nwalign.pyx":243
 *             align_i[align_counter] = seqi[i]
 *         else:
 *             raise Exception('wtf!')             # <<<<<<<<<<<<<<
 *         align_counter += 1
 * 
 */
      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
      __Pyx_INCREF(__pyx_kp_37);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_37);
      __Pyx_GIVEREF(__pyx_kp_37);
      __pyx_t_4 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
      __Pyx_Raise(__pyx_t_4, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_L18:;

    /* "/opt/src/bpbio/nwalign/nwalign.pyx":244
 *         else:
 *             raise Exception('wtf!')
 *         align_counter += 1             # <<<<<<<<<<<<<<
 * 
 *     _PyString_Resize(&aj, align_counter)
 */
    __pyx_v_align_counter += 1;
  }
  __pyx_L16_break:;

  /* "/opt/src/bpbio/nwalign/nwalign.pyx":246
 *         align_counter += 1
 * 
 *     _PyString_Resize(&aj, align_counter)             # <<<<<<<<<<<<<<
 *     _PyString_Resize(&ai, align_counter)
 *     return (<object>aj)[::-1], (<object>ai)[::-1]
 */
  _PyString_Resize((&__pyx_v_aj), __pyx_v_align_counter);

  /* "/opt/src/bpbio/nwalign/nwalign.pyx":247
 * 
 *     _PyString_Resize(&aj, align_counter)
 *     _PyString_Resize(&ai, align_counter)             # <<<<<<<<<<<<<<
 *     return (<object>aj)[::-1], (<object>ai)[::-1]
 * 
 */
  _PyString_Resize((&__pyx_v_ai), __pyx_v_align_counter);

  /* "/opt/src/bpbio/nwalign/nwalign.pyx":248
 *     _PyString_Resize(&aj, align_counter)
 *     _PyString_Resize(&ai, align_counter)
 *     return (<object>aj)[::-1], (<object>ai)[::-1]             # <<<<<<<<<<<<<<
 * 
 * def main():
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_2 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_2);
  __pyx_3 = PyObject_GetItem(((PyObject *)__pyx_v_aj), __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_3);
  __Pyx_DECREF(__pyx_2); __pyx_2 = 0;
  __pyx_1 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_1);
  __pyx_2 = PyObject_GetItem(((PyObject *)__pyx_v_ai), __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_2);
  __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_3);
  __Pyx_GIVEREF(__pyx_3);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_2);
  __Pyx_GIVEREF(__pyx_2);
  __pyx_3 = 0;
  __pyx_2 = 0;
  __pyx_r = ((PyObject *)__pyx_t_4);
  __pyx_t_4 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_1);
  __Pyx_XDECREF(__pyx_2);
  __Pyx_XDECREF(__pyx_3);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_amatrix);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_pointer);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_score);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_agap);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("nwalign.global_align");
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_amatrix);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_pointer);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_score);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_agap);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_agap);
  __Pyx_XDECREF((PyObject *)__pyx_v_score);
  __Pyx_XDECREF((PyObject *)__pyx_v_pointer);
  __Pyx_DECREF((PyObject *)__pyx_v_amatrix);
  __Pyx_DECREF(__pyx_v_pyheader);
  __Pyx_DECREF(__pyx_v_py_ci);
  __Pyx_DECREF(__pyx_v_py_cj);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_FinishRefcountContext();
  return __pyx_r;
}

/* "/opt/src/bpbio/nwalign/nwalign.pyx":121
 * 
 * @cython.boundscheck(False)
 * cpdef global_align(object _seqj, object _seqi, int gap=-1, int match=1, int mismatch=-1, int gap_init=-1, object matrix=None):             # <<<<<<<<<<<<<<
 *     """
 *     perform a global sequence alignment (needleman-wunsch) on seq and and 2. using
 */

static PyObject *__pyx_pf_7nwalign_global_align(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7nwalign_global_align[] = "\n    perform a global sequence alignment (needleman-wunsch) on seq and and 2. using\n    the matrix for nucleotide transition from matrix if available.\n    where matrix is of the format provided in the ncbi/data directory.\n\n    >>> from nwalign import global_align\n    >>> global_align('COELANCANTH', 'PELICAN')\n    ('COELANCANTH', '-PEL-ICAN--')\n\n    ";
static PyObject *__pyx_pf_7nwalign_global_align(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v__seqj = 0;
  PyObject *__pyx_v__seqi = 0;
  int __pyx_v_gap;
  int __pyx_v_match;
  int __pyx_v_mismatch;
  int __pyx_v_gap_init;
  PyObject *__pyx_v_matrix = 0;
  PyObject *__pyx_r = NULL;
  struct __pyx_opt_args_7nwalign_global_align __pyx_1;
  PyObject *__pyx_t_1 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_kp__seqj,&__pyx_kp__seqi,&__pyx_kp_gap,&__pyx_kp_match,&__pyx_kp_mismatch,&__pyx_kp_gap_init,&__pyx_kp_matrix,0};
  __Pyx_SetupRefcountContext("global_align");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[7] = {0,0,0,0,0,0,0};
    values[6] = Py_None;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      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;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp__seqj);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp__seqi);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("global_align", 0, 2, 7, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_gap);
        if (unlikely(value)) { values[2] = value; kw_args--; }
      }
      case  3:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_match);
        if (unlikely(value)) { values[3] = value; kw_args--; }
      }
      case  4:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_mismatch);
        if (unlikely(value)) { values[4] = value; kw_args--; }
      }
      case  5:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_gap_init);
        if (unlikely(value)) { values[5] = value; kw_args--; }
      }
      case  6:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_matrix);
        if (unlikely(value)) { values[6] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "global_align") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v__seqj = values[0];
    __pyx_v__seqi = values[1];
    if (values[2]) {
      __pyx_v_gap = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_gap == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_gap = -1;
    }
    if (values[3]) {
      __pyx_v_match = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_match == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_match = 1;
    }
    if (values[4]) {
      __pyx_v_mismatch = __Pyx_PyInt_AsInt(values[4]); if (unlikely((__pyx_v_mismatch == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_mismatch = -1;
    }
    if (values[5]) {
      __pyx_v_gap_init = __Pyx_PyInt_AsInt(values[5]); if (unlikely((__pyx_v_gap_init == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_gap_init = -1;
    }
    __pyx_v_matrix = values[6];
  } else {
    __pyx_v_gap = -1;
    __pyx_v_match = 1;
    __pyx_v_mismatch = -1;
    __pyx_v_gap_init = -1;
    __pyx_v_matrix = Py_None;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  7:
      __pyx_v_matrix = PyTuple_GET_ITEM(__pyx_args, 6);
      case  6:
      __pyx_v_gap_init = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 5)); if (unlikely((__pyx_v_gap_init == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      case  5:
      __pyx_v_mismatch = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 4)); if (unlikely((__pyx_v_mismatch == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      case  4:
      __pyx_v_match = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely((__pyx_v_match == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      case  3:
      __pyx_v_gap = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_gap == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      case  2:
      __pyx_v__seqi = PyTuple_GET_ITEM(__pyx_args, 1);
      __pyx_v__seqj = PyTuple_GET_ITEM(__pyx_args, 0);
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("global_align", 0, 2, 7, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("nwalign.global_align");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_XDECREF(__pyx_r);
  __pyx_1.__pyx_n = 5;
  __pyx_1.gap = __pyx_v_gap;
  __pyx_1.match = __pyx_v_match;
  __pyx_1.mismatch = __pyx_v_mismatch;
  __pyx_1.gap_init = __pyx_v_gap_init;
  __pyx_1.matrix = __pyx_v_matrix;
  __pyx_t_1 = __pyx_f_7nwalign_global_align(__pyx_v__seqj, __pyx_v__seqi, 0, &__pyx_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("nwalign.global_align");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_FinishRefcountContext();
  return __pyx_r;
}

/* "/opt/src/bpbio/nwalign/nwalign.pyx":250
 *     return (<object>aj)[::-1], (<object>ai)[::-1]
 * 
 * def main():             # <<<<<<<<<<<<<<
 *     import optparse
 *     parser = optparse.OptionParser(usage="""
 */

static PyObject *__pyx_pf_7nwalign_main(PyObject *__pyx_self, PyObject *unused); /*proto*/
static PyObject *__pyx_pf_7nwalign_main(PyObject *__pyx_self, PyObject *unused) {
  PyObject *__pyx_v_optparse;
  PyObject *__pyx_v_parser;
  PyObject *__pyx_v_options;
  PyObject *__pyx_v_args;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  struct __pyx_opt_args_7nwalign_global_align __pyx_4;
  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;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_t_12;
  __Pyx_SetupRefcountContext("main");
  __pyx_self = __pyx_self;
  __pyx_v_optparse = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_parser = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_options = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_args = Py_None; __Pyx_INCREF(Py_None);

  /* "/opt/src/bpbio/nwalign/nwalign.pyx":251
 * 
 * def main():
 *     import optparse             # <<<<<<<<<<<<<<
 *     parser = optparse.OptionParser(usage="""
 *     %prog [options] seq1 seq2
 */
  __pyx_1 = __Pyx_Import(__pyx_kp_optparse, 0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_1);
  __Pyx_DECREF(__pyx_v_optparse);
  __pyx_v_optparse = __pyx_1;
  __pyx_1 = 0;

  /* "/opt/src/bpbio/nwalign/nwalign.pyx":252
 * def main():
 *     import optparse
 *     parser = optparse.OptionParser(usage="""             # <<<<<<<<<<<<<<
 *     %prog [options] seq1 seq2
 *     """)
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_optparse, __pyx_kp_OptionParser); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_1));
  if (PyDict_SetItem(__pyx_1, __pyx_kp_usage, __pyx_kp_38) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0;
  __Pyx_DECREF(__pyx_v_parser);
  __pyx_v_parser = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "/opt/src/bpbio/nwalign/nwalign.pyx":255
 *     %prog [options] seq1 seq2
 *     """)
 *     parser.add_option("--gap", dest="gap", help="gap extend penalty (must be integer <= 0)", type="int", default=-1)             # <<<<<<<<<<<<<<
 *     parser.add_option("--gap_init", dest="gap_init", help="gap start penalty (must be integer <= 0)", type="int", default=-1)
 *     parser.add_option("--match", dest="match", help="match score (must be integer > 0)", type="int", default=1)
 */
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_parser, __pyx_kp_add_option); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_kp_39);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_39);
  __Pyx_GIVEREF(__pyx_kp_39);
  __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_1));
  if (PyDict_SetItem(__pyx_1, __pyx_kp_dest, __pyx_kp_40) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_1, __pyx_kp_help, __pyx_kp_41) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_1, __pyx_kp_type, __pyx_kp_42) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_1, __pyx_kp_default, __pyx_int_neg_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/opt/src/bpbio/nwalign/nwalign.pyx":256
 *     """)
 *     parser.add_option("--gap", dest="gap", help="gap extend penalty (must be integer <= 0)", type="int", default=-1)
 *     parser.add_option("--gap_init", dest="gap_init", help="gap start penalty (must be integer <= 0)", type="int", default=-1)             # <<<<<<<<<<<<<<
 *     parser.add_option("--match", dest="match", help="match score (must be integer > 0)", type="int", default=1)
 *     parser.add_option("--mismatch", dest="mismatch", help="gap penalty (must be integer < 0)", type="int", default=-1)
 */
  __pyx_t_3 = PyObject_GetAttr(__pyx_v_parser, __pyx_kp_add_option); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_kp_43);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_43);
  __Pyx_GIVEREF(__pyx_kp_43);
  __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_1));
  if (PyDict_SetItem(__pyx_1, __pyx_kp_dest, __pyx_kp_44) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_1, __pyx_kp_help, __pyx_kp_45) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_1, __pyx_kp_type, __pyx_kp_46) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_1, __pyx_kp_default, __pyx_int_neg_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/opt/src/bpbio/nwalign/nwalign.pyx":257
 *     parser.add_option("--gap", dest="gap", help="gap extend penalty (must be integer <= 0)", type="int", default=-1)
 *     parser.add_option("--gap_init", dest="gap_init", help="gap start penalty (must be integer <= 0)", type="int", default=-1)
 *     parser.add_option("--match", dest="match", help="match score (must be integer > 0)", type="int", default=1)             # <<<<<<<<<<<<<<
 *     parser.add_option("--mismatch", dest="mismatch", help="gap penalty (must be integer < 0)", type="int", default=-1)
 *     parser.add_option("--matrix", dest="matrix", help="scoring matrix in ncbi/data/ format,\
 */
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_parser, __pyx_kp_add_option); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_kp_47);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_47);
  __Pyx_GIVEREF(__pyx_kp_47);
  __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_1));
  if (PyDict_SetItem(__pyx_1, __pyx_kp_dest, __pyx_kp_48) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_1, __pyx_kp_help, __pyx_kp_49) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_1, __pyx_kp_type, __pyx_kp_50) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_1, __pyx_kp_default, __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/opt/src/bpbio/nwalign/nwalign.pyx":258
 *     parser.add_option("--gap_init", dest="gap_init", help="gap start penalty (must be integer <= 0)", type="int", default=-1)
 *     parser.add_option("--match", dest="match", help="match score (must be integer > 0)", type="int", default=1)
 *     parser.add_option("--mismatch", dest="mismatch", help="gap penalty (must be integer < 0)", type="int", default=-1)             # <<<<<<<<<<<<<<
 *     parser.add_option("--matrix", dest="matrix", help="scoring matrix in ncbi/data/ format,\
 *                                       if not specificied, match/mismatch are used", default=None)
 */
  __pyx_t_3 = PyObject_GetAttr(__pyx_v_parser, __pyx_kp_add_option); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_kp_51);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_51);
  __Pyx_GIVEREF(__pyx_kp_51);
  __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_1));
  if (PyDict_SetItem(__pyx_1, __pyx_kp_dest, __pyx_kp_52) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_1, __pyx_kp_help, __pyx_kp_53) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_1, __pyx_kp_type, __pyx_kp_54) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_1, __pyx_kp_default, __pyx_int_neg_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/opt/src/bpbio/nwalign/nwalign.pyx":259
 *     parser.add_option("--match", dest="match", help="match score (must be integer > 0)", type="int", default=1)
 *     parser.add_option("--mismatch", dest="mismatch", help="gap penalty (must be integer < 0)", type="int", default=-1)
 *     parser.add_option("--matrix", dest="matrix", help="scoring matrix in ncbi/data/ format,\             # <<<<<<<<<<<<<<
 *                                       if not specificied, match/mismatch are used", default=None)
 * 
 */
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_parser, __pyx_kp_add_option); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_kp_55);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_55);
  __Pyx_GIVEREF(__pyx_kp_55);
  __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_1));
  if (PyDict_SetItem(__pyx_1, __pyx_kp_dest, __pyx_kp_56) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_1, __pyx_kp_help, __pyx_kp_57) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/opt/src/bpbio/nwalign/nwalign.pyx":260
 *     parser.add_option("--mismatch", dest="mismatch", help="gap penalty (must be integer < 0)", type="int", default=-1)
 *     parser.add_option("--matrix", dest="matrix", help="scoring matrix in ncbi/data/ format,\
 *                                       if not specificied, match/mismatch are used", default=None)             # <<<<<<<<<<<<<<
 * 
 *     try:
 */
  if (PyDict_SetItem(__pyx_1, __pyx_kp_default, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/opt/src/bpbio/nwalign/nwalign.pyx":262
 *                                       if not specificied, match/mismatch are used", default=None)
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         options, args = parser.parse_args()
 *     except:
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/opt/src/bpbio/nwalign/nwalign.pyx":263
 * 
 *     try:
 *         options, args = parser.parse_args()             # <<<<<<<<<<<<<<
 *     except:
 *         sys.exit(parser.print_help())
 */
      __pyx_t_3 = PyObject_GetAttr(__pyx_v_parser, __pyx_kp_parse_args); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (PyTuple_CheckExact(__pyx_t_1) && likely(PyTuple_GET_SIZE(__pyx_t_1) == 2)) {
        PyObject* tuple = __pyx_t_1;
        __pyx_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2);
        __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_v_options);
        __pyx_v_options = __pyx_2;
        __pyx_2 = 0;
        __Pyx_DECREF(__pyx_v_args);
        __pyx_v_args = __pyx_3;
        __pyx_3 = 0;
      } else {
        __pyx_1 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
        __Pyx_GOTREF(__pyx_1);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
        __Pyx_GOTREF(__pyx_2);
        __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
        __Pyx_GOTREF(__pyx_3);
        if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
        __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
        __Pyx_DECREF(__pyx_v_options);
        __pyx_v_options = __pyx_2;
        __pyx_2 = 0;
        __Pyx_DECREF(__pyx_v_args);
        __pyx_v_args = __pyx_3;
        __pyx_3 = 0;
      }
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L12_try_end;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_1); __pyx_1 = 0;
    __Pyx_XDECREF(__pyx_2); __pyx_2 = 0;
    __Pyx_XDECREF(__pyx_3); __pyx_3 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "/opt/src/bpbio/nwalign/nwalign.pyx":264
 *     try:
 *         options, args = parser.parse_args()
 *     except:             # <<<<<<<<<<<<<<
 *         sys.exit(parser.print_help())
 * 
 */
    /*except:*/ {
      __Pyx_AddTraceback("nwalign.main");
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_2);

      /* "/opt/src/bpbio/nwalign/nwalign.pyx":265
 *         options, args = parser.parse_args()
 *     except:
 *         sys.exit(parser.print_help())             # <<<<<<<<<<<<<<
 * 
 *     if len(args) != 2:
 */
      __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_sys); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_1);
      __pyx_t_4 = PyObject_GetAttr(__pyx_1, __pyx_kp_exit); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
      __pyx_t_5 = PyObject_GetAttr(__pyx_v_parser, __pyx_kp_print_help); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L6_exception_handled;
    }
    __pyx_L7_except_error:;
    __Pyx_XDECREF(__pyx_save_exc_type);
    __Pyx_XDECREF(__pyx_save_exc_value);
    __Pyx_XDECREF(__pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L6_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L12_try_end:;
  }

  /* "/opt/src/bpbio/nwalign/nwalign.pyx":267
 *         sys.exit(parser.print_help())
 * 
 *     if len(args) != 2:             # <<<<<<<<<<<<<<
 *         sys.exit(parser.print_help())
 *     print "\n".join(global_align(args[0], args[1], options.gap, options.match, options.mismatch, options.gap_init, options.matrix))
 */
  __pyx_t_7 = PyObject_Length(__pyx_v_args); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_8 = (__pyx_t_7 != 2);
  if (__pyx_t_8) {

    /* "/opt/src/bpbio/nwalign/nwalign.pyx":268
 * 
 *     if len(args) != 2:
 *         sys.exit(parser.print_help())             # <<<<<<<<<<<<<<
 *     print "\n".join(global_align(args[0], args[1], options.gap, options.match, options.mismatch, options.gap_init, options.matrix))
 * 
 */
    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_sys); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_2);
    __pyx_t_2 = PyObject_GetAttr(__pyx_2, __pyx_kp_exit); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_2); __pyx_2 = 0;
    __pyx_t_3 = PyObject_GetAttr(__pyx_v_parser, __pyx_kp_print_help); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L15;
  }
  __pyx_L15:;

  /* "/opt/src/bpbio/nwalign/nwalign.pyx":269
 *     if len(args) != 2:
 *         sys.exit(parser.print_help())
 *     print "\n".join(global_align(args[0], args[1], options.gap, options.match, options.mismatch, options.gap_init, options.matrix))             # <<<<<<<<<<<<<<
 * 
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_kp_58, __pyx_kp_join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_3 = __Pyx_GetItemInt(__pyx_v_args, 0, sizeof(long), PyInt_FromLong); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_3);
  __pyx_1 = __Pyx_GetItemInt(__pyx_v_args, 1, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_1);
  __pyx_t_3 = PyObject_GetAttr(__pyx_v_options, __pyx_kp_gap); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_GetAttr(__pyx_v_options, __pyx_kp_match); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_GetAttr(__pyx_v_options, __pyx_kp_mismatch); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_11 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_GetAttr(__pyx_v_options, __pyx_kp_gap_init); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_12 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_GetAttr(__pyx_v_options, __pyx_kp_matrix); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_4.__pyx_n = 5;
  __pyx_4.gap = __pyx_t_9;
  __pyx_4.match = __pyx_t_10;
  __pyx_4.mismatch = __pyx_t_11;
  __pyx_4.gap_init = __pyx_t_12;
  __pyx_4.matrix = __pyx_t_3;
  __pyx_t_2 = __pyx_f_7nwalign_global_align(__pyx_3, __pyx_1, 0, &__pyx_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_3); __pyx_3 = 0;
  __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  if (__Pyx_PrintOne(__pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_1);
  __Pyx_XDECREF(__pyx_2);
  __Pyx_XDECREF(__pyx_3);
  __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_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("nwalign.main");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_optparse);
  __Pyx_DECREF(__pyx_v_parser);
  __Pyx_DECREF(__pyx_v_options);
  __Pyx_DECREF(__pyx_v_args);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_FinishRefcountContext();
  return __pyx_r;
}

/* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":50
 *         # experimental exception made for __getbuffer__ and __releasebuffer__
 *         # -- the details of this may change.
 *         def __getbuffer__(ndarray self, Py_buffer* info, int flags):             # <<<<<<<<<<<<<<
 *             # This implementation of getbuffer is geared towards Cython
 *             # requirements, and does not yet fullfill the PEP.
 */

static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  int __pyx_v_copy_shape;
  int __pyx_v_i;
  int __pyx_v_ndim;
  int __pyx_v_t;
  char *__pyx_v_f;
  PyArray_Descr *__pyx_v_descr = 0;
  int __pyx_v_hasfields;
  int __pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  char *__pyx_t_5;
  __Pyx_SetupRefcountContext("__getbuffer__");
  if (__pyx_v_info == NULL) return 0;
  __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(__pyx_v_info->obj);

  /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":56
 *             # of flags
 *             cdef int copy_shape, i, ndim
 *             ndim = PyArray_NDIM(self)             # <<<<<<<<<<<<<<
 * 
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 */
  __pyx_v_ndim = PyArray_NDIM(((PyArrayObject *)__pyx_v_self));

  /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":58
 *             ndim = PyArray_NDIM(self)
 * 
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
 *                 copy_shape = 1
 *             else:
 */
  __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t)));
  if (__pyx_t_1) {

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":59
 * 
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 *                 copy_shape = 1             # <<<<<<<<<<<<<<
 *             else:
 *                 copy_shape = 0
 */
    __pyx_v_copy_shape = 1;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":61
 *                 copy_shape = 1
 *             else:
 *                 copy_shape = 0             # <<<<<<<<<<<<<<
 * 
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
 */
    __pyx_v_copy_shape = 0;
  }
  __pyx_L5:;

  /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":63
 *                 copy_shape = 0
 * 
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)             # <<<<<<<<<<<<<<
 *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
 *                 raise ValueError("ndarray is not C contiguous")
 */
  if (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS)) {

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":64
 * 
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):             # <<<<<<<<<<<<<<
 *                 raise ValueError("ndarray is not C contiguous")
 * 
 */
    __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS));
  } else {
    __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS);
  }
  if (__pyx_t_1) {

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":65
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
 *                 raise ValueError("ndarray is not C contiguous")             # <<<<<<<<<<<<<<
 * 
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 */
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __Pyx_INCREF(__pyx_kp_1);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_1);
    __Pyx_GIVEREF(__pyx_kp_1);
    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":67
 *                 raise ValueError("ndarray is not C contiguous")
 * 
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)             # <<<<<<<<<<<<<<
 *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
 *                 raise ValueError("ndarray is not Fortran contiguous")
 */
  if (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS)) {

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":68
 * 
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):             # <<<<<<<<<<<<<<
 *                 raise ValueError("ndarray is not Fortran contiguous")
 * 
 */
    __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_F_CONTIGUOUS));
  } else {
    __pyx_t_1 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS);
  }
  if (__pyx_t_1) {

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":69
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
 *                 raise ValueError("ndarray is not Fortran contiguous")             # <<<<<<<<<<<<<<
 * 
 *             info.buf = PyArray_DATA(self)
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_INCREF(__pyx_kp_2);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_2);
    __Pyx_GIVEREF(__pyx_kp_2);
    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":71
 *                 raise ValueError("ndarray is not Fortran contiguous")
 * 
 *             info.buf = PyArray_DATA(self)             # <<<<<<<<<<<<<<
 *             info.ndim = ndim
 *             if copy_shape:
 */
  __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_v_self));

  /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":72
 * 
 *             info.buf = PyArray_DATA(self)
 *             info.ndim = ndim             # <<<<<<<<<<<<<<
 *             if copy_shape:
 *                 # Allocate new buffer for strides and shape info. This is allocated
 */
  __pyx_v_info->ndim = __pyx_v_ndim;

  /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":73
 *             info.buf = PyArray_DATA(self)
 *             info.ndim = ndim
 *             if copy_shape:             # <<<<<<<<<<<<<<
 *                 # Allocate new buffer for strides and shape info. This is allocated
 *                 # as one block, strides first.
 */
  __pyx_t_4 = __pyx_v_copy_shape;
  if (__pyx_t_4) {

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":76
 *                 # Allocate new buffer for strides and shape info. This is allocated
 *                 # as one block, strides first.
 *                 info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2)             # <<<<<<<<<<<<<<
 *                 info.shape = info.strides + ndim
 *                 for i in range(ndim):
 */
    __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * __pyx_v_ndim) * 2)));

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":77
 *                 # as one block, strides first.
 *                 info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2)
 *                 info.shape = info.strides + ndim             # <<<<<<<<<<<<<<
 *                 for i in range(ndim):
 *                     info.strides[i] = PyArray_STRIDES(self)[i]
 */
    __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim);

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":78
 *                 info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2)
 *                 info.shape = info.strides + ndim
 *                 for i in range(ndim):             # <<<<<<<<<<<<<<
 *                     info.strides[i] = PyArray_STRIDES(self)[i]
 *                     info.shape[i] = PyArray_DIMS(self)[i]
 */
    for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_v_ndim; __pyx_t_4+=1) {
      __pyx_v_i = __pyx_t_4;

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":79
 *                 info.shape = info.strides + ndim
 *                 for i in range(ndim):
 *                     info.strides[i] = PyArray_STRIDES(self)[i]             # <<<<<<<<<<<<<<
 *                     info.shape[i] = PyArray_DIMS(self)[i]
 *             else:
 */
      (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]);

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":80
 *                 for i in range(ndim):
 *                     info.strides[i] = PyArray_STRIDES(self)[i]
 *                     info.shape[i] = PyArray_DIMS(self)[i]             # <<<<<<<<<<<<<<
 *             else:
 *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
 */
      (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]);
    }
    goto __pyx_L8;
  }
  /*else*/ {

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":82
 *                     info.shape[i] = PyArray_DIMS(self)[i]
 *             else:
 *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)             # <<<<<<<<<<<<<<
 *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
 *             info.suboffsets = NULL
 */
    __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_v_self)));

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":83
 *             else:
 *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
 *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)             # <<<<<<<<<<<<<<
 *             info.suboffsets = NULL
 *             info.itemsize = PyArray_ITEMSIZE(self)
 */
    __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(((PyArrayObject *)__pyx_v_self)));
  }
  __pyx_L8:;

  /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":84
 *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
 *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
 *             info.suboffsets = NULL             # <<<<<<<<<<<<<<
 *             info.itemsize = PyArray_ITEMSIZE(self)
 *             info.readonly = not PyArray_ISWRITEABLE(self)
 */
  __pyx_v_info->suboffsets = NULL;

  /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":85
 *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
 *             info.suboffsets = NULL
 *             info.itemsize = PyArray_ITEMSIZE(self)             # <<<<<<<<<<<<<<
 *             info.readonly = not PyArray_ISWRITEABLE(self)
 * 
 */
  __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_v_self));

  /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":86
 *             info.suboffsets = NULL
 *             info.itemsize = PyArray_ITEMSIZE(self)
 *             info.readonly = not PyArray_ISWRITEABLE(self)             # <<<<<<<<<<<<<<
 * 
 *             cdef int t
 */
  __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self)));

  /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":89
 * 
 *             cdef int t
 *             cdef char* f = NULL             # <<<<<<<<<<<<<<
 *             cdef dtype descr = self.descr
 *             cdef list stack
 */
  __pyx_v_f = NULL;

  /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":90
 *             cdef int t
 *             cdef char* f = NULL
 *             cdef dtype descr = self.descr             # <<<<<<<<<<<<<<
 *             cdef list stack
 * 
 */
  __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr));
  __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr;

  /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":93
 *             cdef list stack
 * 
 *             cdef bint hasfields = PyDataType_HASFIELDS(descr)             # <<<<<<<<<<<<<<
 * 
 *             # Ugly hack warning:
 */
  __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr);

  /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":103
 *             # functions).
 * 
 *             if not hasfields and not copy_shape:             # <<<<<<<<<<<<<<
 *                 # do not call releasebuffer
 *                 info.obj = None
 */
  if ((!__pyx_v_hasfields)) {
    __pyx_t_1 = (!__pyx_v_copy_shape);
  } else {
    __pyx_t_1 = (!__pyx_v_hasfields);
  }
  if (__pyx_t_1) {

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":105
 *             if not hasfields and not copy_shape:
 *                 # do not call releasebuffer
 *                 info.obj = None             # <<<<<<<<<<<<<<
 *             else:
 *                 # need to call releasebuffer
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj);
    __pyx_v_info->obj = Py_None;
    goto __pyx_L11;
  }
  /*else*/ {

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":108
 *             else:
 *                 # need to call releasebuffer
 *                 info.obj = self             # <<<<<<<<<<<<<<
 * 
 *             if not hasfields:
 */
    __Pyx_INCREF(__pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj);
    __pyx_v_info->obj = __pyx_v_self;
  }
  __pyx_L11:;

  /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":110
 *                 info.obj = self
 * 
 *             if not hasfields:             # <<<<<<<<<<<<<<
 *                 t = descr.type_num
 *                 if   t == NPY_BYTE:        f = "b"
 */
  __pyx_t_1 = (!__pyx_v_hasfields);
  if (__pyx_t_1) {

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":111
 * 
 *             if not hasfields:
 *                 t = descr.type_num             # <<<<<<<<<<<<<<
 *                 if   t == NPY_BYTE:        f = "b"
 *                 elif t == NPY_UBYTE:       f = "B"
 */
    __pyx_v_t = __pyx_v_descr->type_num;

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":112
 *             if not hasfields:
 *                 t = descr.type_num
 *                 if   t == NPY_BYTE:        f = "b"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_UBYTE:       f = "B"
 *                 elif t == NPY_SHORT:       f = "h"
 */
    switch (__pyx_v_t) {
      case NPY_BYTE:
      __pyx_v_f = __pyx_k_3;
      break;

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":113
 *                 t = descr.type_num
 *                 if   t == NPY_BYTE:        f = "b"
 *                 elif t == NPY_UBYTE:       f = "B"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_SHORT:       f = "h"
 *                 elif t == NPY_USHORT:      f = "H"
 */
      case NPY_UBYTE:
      __pyx_v_f = __pyx_k_4;
      break;

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":114
 *                 if   t == NPY_BYTE:        f = "b"
 *                 elif t == NPY_UBYTE:       f = "B"
 *                 elif t == NPY_SHORT:       f = "h"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_USHORT:      f = "H"
 *                 elif t == NPY_INT:         f = "i"
 */
      case NPY_SHORT:
      __pyx_v_f = __pyx_k_5;
      break;

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":115
 *                 elif t == NPY_UBYTE:       f = "B"
 *                 elif t == NPY_SHORT:       f = "h"
 *                 elif t == NPY_USHORT:      f = "H"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_INT:         f = "i"
 *                 elif t == NPY_UINT:        f = "I"
 */
      case NPY_USHORT:
      __pyx_v_f = __pyx_k_6;
      break;

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":116
 *                 elif t == NPY_SHORT:       f = "h"
 *                 elif t == NPY_USHORT:      f = "H"
 *                 elif t == NPY_INT:         f = "i"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_UINT:        f = "I"
 *                 elif t == NPY_LONG:        f = "l"
 */
      case NPY_INT:
      __pyx_v_f = __pyx_k_7;
      break;

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":117
 *                 elif t == NPY_USHORT:      f = "H"
 *                 elif t == NPY_INT:         f = "i"
 *                 elif t == NPY_UINT:        f = "I"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_LONG:        f = "l"
 *                 elif t == NPY_ULONG:       f = "L"
 */
      case NPY_UINT:
      __pyx_v_f = __pyx_k_8;
      break;

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":118
 *                 elif t == NPY_INT:         f = "i"
 *                 elif t == NPY_UINT:        f = "I"
 *                 elif t == NPY_LONG:        f = "l"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_ULONG:       f = "L"
 *                 elif t == NPY_LONGLONG:    f = "q"
 */
      case NPY_LONG:
      __pyx_v_f = __pyx_k_9;
      break;

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":119
 *                 elif t == NPY_UINT:        f = "I"
 *                 elif t == NPY_LONG:        f = "l"
 *                 elif t == NPY_ULONG:       f = "L"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_LONGLONG:    f = "q"
 *                 elif t == NPY_ULONGLONG:   f = "Q"
 */
      case NPY_ULONG:
      __pyx_v_f = __pyx_k_10;
      break;

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":120
 *                 elif t == NPY_LONG:        f = "l"
 *                 elif t == NPY_ULONG:       f = "L"
 *                 elif t == NPY_LONGLONG:    f = "q"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_ULONGLONG:   f = "Q"
 *                 elif t == NPY_FLOAT:       f = "f"
 */
      case NPY_LONGLONG:
      __pyx_v_f = __pyx_k_11;
      break;

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":121
 *                 elif t == NPY_ULONG:       f = "L"
 *                 elif t == NPY_LONGLONG:    f = "q"
 *                 elif t == NPY_ULONGLONG:   f = "Q"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_FLOAT:       f = "f"
 *                 elif t == NPY_DOUBLE:      f = "d"
 */
      case NPY_ULONGLONG:
      __pyx_v_f = __pyx_k_12;
      break;

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":122
 *                 elif t == NPY_LONGLONG:    f = "q"
 *                 elif t == NPY_ULONGLONG:   f = "Q"
 *                 elif t == NPY_FLOAT:       f = "f"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_DOUBLE:      f = "d"
 *                 elif t == NPY_LONGDOUBLE:  f = "g"
 */
      case NPY_FLOAT:
      __pyx_v_f = __pyx_k_13;
      break;

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":123
 *                 elif t == NPY_ULONGLONG:   f = "Q"
 *                 elif t == NPY_FLOAT:       f = "f"
 *                 elif t == NPY_DOUBLE:      f = "d"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_LONGDOUBLE:  f = "g"
 *                 elif t == NPY_CFLOAT:      f = "Zf"
 */
      case NPY_DOUBLE:
      __pyx_v_f = __pyx_k_14;
      break;

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":124
 *                 elif t == NPY_FLOAT:       f = "f"
 *                 elif t == NPY_DOUBLE:      f = "d"
 *                 elif t == NPY_LONGDOUBLE:  f = "g"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_CFLOAT:      f = "Zf"
 *                 elif t == NPY_CDOUBLE:     f = "Zd"
 */
      case NPY_LONGDOUBLE:
      __pyx_v_f = __pyx_k_15;
      break;

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":125
 *                 elif t == NPY_DOUBLE:      f = "d"
 *                 elif t == NPY_LONGDOUBLE:  f = "g"
 *                 elif t == NPY_CFLOAT:      f = "Zf"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_CDOUBLE:     f = "Zd"
 *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
 */
      case NPY_CFLOAT:
      __pyx_v_f = __pyx_k_16;
      break;

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":126
 *                 elif t == NPY_LONGDOUBLE:  f = "g"
 *                 elif t == NPY_CFLOAT:      f = "Zf"
 *                 elif t == NPY_CDOUBLE:     f = "Zd"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
 *                 elif t == NPY_OBJECT:      f = "O"
 */
      case NPY_CDOUBLE:
      __pyx_v_f = __pyx_k_17;
      break;

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":127
 *                 elif t == NPY_CFLOAT:      f = "Zf"
 *                 elif t == NPY_CDOUBLE:     f = "Zd"
 *                 elif t == NPY_CLONGDOUBLE: f = "Zg"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_OBJECT:      f = "O"
 *                 else:
 */
      case NPY_CLONGDOUBLE:
      __pyx_v_f = __pyx_k_18;
      break;

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":128
 *                 elif t == NPY_CDOUBLE:     f = "Zd"
 *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
 *                 elif t == NPY_OBJECT:      f = "O"             # <<<<<<<<<<<<<<
 *                 else:
 *                     raise ValueError("unknown dtype code in numpy.pxd (%d)" % t)
 */
      case NPY_OBJECT:
      __pyx_v_f = __pyx_k_19;
      break;
      default:

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":130
 *                 elif t == NPY_OBJECT:      f = "O"
 *                 else:
 *                     raise ValueError("unknown dtype code in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
 *                 info.format = f
 *                 return
 */
      __pyx_t_2 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyNumber_Remainder(__pyx_kp_20, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      __Pyx_Raise(__pyx_t_3, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      break;
    }

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":131
 *                 else:
 *                     raise ValueError("unknown dtype code in numpy.pxd (%d)" % t)
 *                 info.format = f             # <<<<<<<<<<<<<<
 *                 return
 *             else:
 */
    __pyx_v_info->format = __pyx_v_f;

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":132
 *                     raise ValueError("unknown dtype code in numpy.pxd (%d)" % t)
 *                 info.format = f
 *                 return             # <<<<<<<<<<<<<<
 *             else:
 *                 info.format = <char*>stdlib.malloc(255) # static size
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L12;
  }
  /*else*/ {

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":134
 *                 return
 *             else:
 *                 info.format = <char*>stdlib.malloc(255) # static size             # <<<<<<<<<<<<<<
 *                 f = _util_dtypestring(descr, info.format, info.format + 255)
 *                 f[0] = 0 # Terminate format string
 */
    __pyx_v_info->format = ((char *)malloc(255));

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":135
 *             else:
 *                 info.format = <char*>stdlib.malloc(255) # static size
 *                 f = _util_dtypestring(descr, info.format, info.format + 255)             # <<<<<<<<<<<<<<
 *                 f[0] = 0 # Terminate format string
 * 
 */
    __pyx_t_5 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, __pyx_v_info->format, (__pyx_v_info->format + 255)); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_f = __pyx_t_5;

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":136
 *                 info.format = <char*>stdlib.malloc(255) # static size
 *                 f = _util_dtypestring(descr, info.format, info.format + 255)
 *                 f[0] = 0 # Terminate format string             # <<<<<<<<<<<<<<
 * 
 *         def __releasebuffer__(ndarray self, Py_buffer* info):
 */
    (__pyx_v_f[0]) = 0;
  }
  __pyx_L12:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("numpy.ndarray.__getbuffer__");
  __pyx_r = -1;
  __Pyx_GOTREF(__pyx_v_info->obj);
  __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  if (__pyx_v_info->obj == Py_None) {
    __Pyx_GOTREF(Py_None);
    __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL;
  }
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_descr);
  __Pyx_FinishRefcountContext();
  return __pyx_r;
}

/* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":138
 *                 f[0] = 0 # Terminate format string
 * 
 *         def __releasebuffer__(ndarray self, Py_buffer* info):             # <<<<<<<<<<<<<<
 *             if PyArray_HASFIELDS(self):
 *                 stdlib.free(info.format)
 */

static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_SetupRefcountContext("__releasebuffer__");

  /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":139
 * 
 *         def __releasebuffer__(ndarray self, Py_buffer* info):
 *             if PyArray_HASFIELDS(self):             # <<<<<<<<<<<<<<
 *                 stdlib.free(info.format)
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 */
  __pyx_t_1 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_v_self));
  if (__pyx_t_1) {

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":140
 *         def __releasebuffer__(ndarray self, Py_buffer* info):
 *             if PyArray_HASFIELDS(self):
 *                 stdlib.free(info.format)             # <<<<<<<<<<<<<<
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 *                 stdlib.free(info.strides)
 */
    free(__pyx_v_info->format);
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":141
 *             if PyArray_HASFIELDS(self):
 *                 stdlib.free(info.format)
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
 *                 stdlib.free(info.strides)
 *                 # info.shape was stored after info.strides in the same block
 */
  __pyx_t_2 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t)));
  if (__pyx_t_2) {

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":142
 *                 stdlib.free(info.format)
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 *                 stdlib.free(info.strides)             # <<<<<<<<<<<<<<
 *                 # info.shape was stored after info.strides in the same block
 * 
 */
    free(__pyx_v_info->strides);
    goto __pyx_L6;
  }
  __pyx_L6:;

  __Pyx_FinishRefcountContext();
}

/* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":248
 * 
 * 
 * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end) except NULL:             # <<<<<<<<<<<<<<
 *     # Recursive utility function used in __getbuffer__ to get format
 *     # string. The new location in the format string is returned.
 */

static INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end) {
  PyArray_Descr *__pyx_v_child;
  PyObject *__pyx_v_i;
  PyObject *__pyx_v_t;
  char *__pyx_r;
  PyObject *__pyx_1 = 0;
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  char *__pyx_t_6;
  __Pyx_SetupRefcountContext("_util_dtypestring");
  __pyx_v_child = ((PyArray_Descr *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_i = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_t = Py_None; __Pyx_INCREF(Py_None);

  /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":254
 *     cdef dtype child
 *     cdef tuple i
 *     for i in descr.fields.itervalues():             # <<<<<<<<<<<<<<
 *         child = i[0]
 *         if not PyDataType_HASFIELDS(child):
 */
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_descr->fields, __pyx_kp_itervalues); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) {
    __pyx_t_1 = 0; __pyx_t_2 = __pyx_t_3; __Pyx_INCREF(__pyx_t_2);
  } else {
    __pyx_t_1 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  for (;;) {
    if (likely(PyList_CheckExact(__pyx_t_2))) {
      if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_2)) break;
      __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++;
    } else if (likely(PyTuple_CheckExact(__pyx_t_2))) {
      if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
      __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++;
    } else {
      __pyx_t_3 = PyIter_Next(__pyx_t_2);
      if (!__pyx_t_3) {
        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    if (!(likely(PyTuple_CheckExact(__pyx_t_3)) || (__pyx_t_3) == Py_None || (PyErr_Format(PyExc_TypeError, "Expected tuple, got %s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_v_i));
    __pyx_v_i = ((PyObject *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":255
 *     cdef tuple i
 *     for i in descr.fields.itervalues():
 *         child = i[0]             # <<<<<<<<<<<<<<
 *         if not PyDataType_HASFIELDS(child):
 *             t = child.type_num
 */
    __pyx_1 = __Pyx_GetItemInt_Tuple(((PyObject *)__pyx_v_i), 0, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_1);
    if (!(__Pyx_TypeTest(__pyx_1, __pyx_ptype_5numpy_dtype))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_v_child));
    __pyx_v_child = ((PyArray_Descr *)__pyx_1);
    __pyx_1 = 0;

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":256
 *     for i in descr.fields.itervalues():
 *         child = i[0]
 *         if not PyDataType_HASFIELDS(child):             # <<<<<<<<<<<<<<
 *             t = child.type_num
 *             if end - f < 15: # this should leave room for "T{" and "}" as well
 */
    __pyx_t_4 = (!PyDataType_HASFIELDS(__pyx_v_child));
    if (__pyx_t_4) {

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":257
 *         child = i[0]
 *         if not PyDataType_HASFIELDS(child):
 *             t = child.type_num             # <<<<<<<<<<<<<<
 *             if end - f < 15: # this should leave room for "T{" and "}" as well
 *                 raise RuntimeError("Format string allocated too short.")
 */
      __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_v_t);
      __pyx_v_t = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":258
 *         if not PyDataType_HASFIELDS(child):
 *             t = child.type_num
 *             if end - f < 15: # this should leave room for "T{" and "}" as well             # <<<<<<<<<<<<<<
 *                 raise RuntimeError("Format string allocated too short.")
 * 
 */
      __pyx_t_4 = ((__pyx_v_end - __pyx_v_f) < 15);
      if (__pyx_t_4) {

        /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":259
 *             t = child.type_num
 *             if end - f < 15: # this should leave room for "T{" and "}" as well
 *                 raise RuntimeError("Format string allocated too short.")             # <<<<<<<<<<<<<<
 * 
 *             # Until ticket #99 is fixed, use integers to avoid warnings
 */
        __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_3));
        __Pyx_INCREF(__pyx_kp_21);
        PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_21);
        __Pyx_GIVEREF(__pyx_kp_21);
        __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
        __Pyx_Raise(__pyx_t_5, 0, 0);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        {__pyx_filename = __pyx_f[1]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L6;
      }
      __pyx_L6:;

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":262
 * 
 *             # Until ticket #99 is fixed, use integers to avoid warnings
 *             if   t == NPY_BYTE:        f[0] =  98 #"b"             # <<<<<<<<<<<<<<
 *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"
 */
      __pyx_t_5 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_4) {
        (__pyx_v_f[0]) = 98;
        goto __pyx_L7;
      }

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":263
 *             # Until ticket #99 is fixed, use integers to avoid warnings
 *             if   t == NPY_BYTE:        f[0] =  98 #"b"
 *             elif t == NPY_UBYTE:       f[0] =  66 #"B"             # <<<<<<<<<<<<<<
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"
 */
      __pyx_t_3 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_4) {
        (__pyx_v_f[0]) = 66;
        goto __pyx_L7;
      }

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":264
 *             if   t == NPY_BYTE:        f[0] =  98 #"b"
 *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"             # <<<<<<<<<<<<<<
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"
 *             elif t == NPY_INT:         f[0] = 105 #"i"
 */
      __pyx_t_5 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_4) {
        (__pyx_v_f[0]) = 104;
        goto __pyx_L7;
      }

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":265
 *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"             # <<<<<<<<<<<<<<
 *             elif t == NPY_INT:         f[0] = 105 #"i"
 *             elif t == NPY_UINT:        f[0] =  73 #"I"
 */
      __pyx_t_3 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_4) {
        (__pyx_v_f[0]) = 72;
        goto __pyx_L7;
      }

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":266
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"
 *             elif t == NPY_INT:         f[0] = 105 #"i"             # <<<<<<<<<<<<<<
 *             elif t == NPY_UINT:        f[0] =  73 #"I"
 *             elif t == NPY_LONG:        f[0] = 108 #"l"
 */
      __pyx_t_5 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_4) {
        (__pyx_v_f[0]) = 105;
        goto __pyx_L7;
      }

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":267
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"
 *             elif t == NPY_INT:         f[0] = 105 #"i"
 *             elif t == NPY_UINT:        f[0] =  73 #"I"             # <<<<<<<<<<<<<<
 *             elif t == NPY_LONG:        f[0] = 108 #"l"
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"
 */
      __pyx_t_3 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_4) {
        (__pyx_v_f[0]) = 73;
        goto __pyx_L7;
      }

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":268
 *             elif t == NPY_INT:         f[0] = 105 #"i"
 *             elif t == NPY_UINT:        f[0] =  73 #"I"
 *             elif t == NPY_LONG:        f[0] = 108 #"l"             # <<<<<<<<<<<<<<
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
 */
      __pyx_t_5 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_4) {
        (__pyx_v_f[0]) = 108;
        goto __pyx_L7;
      }

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":269
 *             elif t == NPY_UINT:        f[0] =  73 #"I"
 *             elif t == NPY_LONG:        f[0] = 108 #"l"
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"             # <<<<<<<<<<<<<<
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
 */
      __pyx_t_3 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_4) {
        (__pyx_v_f[0]) = 76;
        goto __pyx_L7;
      }

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":270
 *             elif t == NPY_LONG:        f[0] = 108 #"l"
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"             # <<<<<<<<<<<<<<
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
 */
      __pyx_t_5 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_4) {
        (__pyx_v_f[0]) = 113;
        goto __pyx_L7;
      }

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":271
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"             # <<<<<<<<<<<<<<
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
 */
      __pyx_t_3 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_4) {
        (__pyx_v_f[0]) = 81;
        goto __pyx_L7;
      }

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":272
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"             # <<<<<<<<<<<<<<
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
 */
      __pyx_t_5 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_4) {
        (__pyx_v_f[0]) = 102;
        goto __pyx_L7;
      }

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":273
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"             # <<<<<<<<<<<<<<
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1
 */
      __pyx_t_3 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_4) {
        (__pyx_v_f[0]) = 100;
        goto __pyx_L7;
      }

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":274
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"             # <<<<<<<<<<<<<<
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1
 */
      __pyx_t_5 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_4) {
        (__pyx_v_f[0]) = 103;
        goto __pyx_L7;
      }

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":275
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1             # <<<<<<<<<<<<<<
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1
 *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1
 */
      __pyx_t_3 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_4) {
        (__pyx_v_f[0]) = 90;
        (__pyx_v_f[1]) = 102;
        __pyx_v_f += 1;
        goto __pyx_L7;
      }

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":276
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1             # <<<<<<<<<<<<<<
 *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1
 *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
 */
      __pyx_t_5 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_4) {
        (__pyx_v_f[0]) = 90;
        (__pyx_v_f[1]) = 100;
        __pyx_v_f += 1;
        goto __pyx_L7;
      }

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":277
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1
 *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1             # <<<<<<<<<<<<<<
 *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
 *             else:
 */
      __pyx_t_3 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_4) {
        (__pyx_v_f[0]) = 90;
        (__pyx_v_f[1]) = 103;
        __pyx_v_f += 1;
        goto __pyx_L7;
      }

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":278
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1
 *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1
 *             elif t == NPY_OBJECT:      f[0] = 79 #"O"             # <<<<<<<<<<<<<<
 *             else:
 *                 raise ValueError("unknown dtype code in numpy.pxd (%d)" % t)
 */
      __pyx_t_5 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_4) {
        (__pyx_v_f[0]) = 79;
        goto __pyx_L7;
      }
      /*else*/ {

        /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":280
 *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
 *             else:
 *                 raise ValueError("unknown dtype code in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
 *             f += 1
 *         else:
 */
        __pyx_t_3 = PyNumber_Remainder(__pyx_kp_22, __pyx_v_t); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_5));
        PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
        __Pyx_Raise(__pyx_t_3, 0, 0);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        {__pyx_filename = __pyx_f[1]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_L7:;

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":281
 *             else:
 *                 raise ValueError("unknown dtype code in numpy.pxd (%d)" % t)
 *             f += 1             # <<<<<<<<<<<<<<
 *         else:
 *             f[0] = 84 #"T"
 */
      __pyx_v_f += 1;
      goto __pyx_L5;
    }
    /*else*/ {

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":283
 *             f += 1
 *         else:
 *             f[0] = 84 #"T"             # <<<<<<<<<<<<<<
 *             f[1] = 123 #"{"
 *             f += 2
 */
      (__pyx_v_f[0]) = 84;

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":284
 *         else:
 *             f[0] = 84 #"T"
 *             f[1] = 123 #"{"             # <<<<<<<<<<<<<<
 *             f += 2
 *             f = _util_dtypestring(child, f, end)
 */
      (__pyx_v_f[1]) = 123;

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":285
 *             f[0] = 84 #"T"
 *             f[1] = 123 #"{"
 *             f += 2             # <<<<<<<<<<<<<<
 *             f = _util_dtypestring(child, f, end)
 *             f[0] = 125 #"}"
 */
      __pyx_v_f += 2;

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":286
 *             f[1] = 123 #"{"
 *             f += 2
 *             f = _util_dtypestring(child, f, end)             # <<<<<<<<<<<<<<
 *             f[0] = 125 #"}"
 *             f += 1
 */
      __pyx_t_6 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_f = __pyx_t_6;

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":287
 *             f += 2
 *             f = _util_dtypestring(child, f, end)
 *             f[0] = 125 #"}"             # <<<<<<<<<<<<<<
 *             f += 1
 *     return f
 */
      (__pyx_v_f[0]) = 125;

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":288
 *             f = _util_dtypestring(child, f, end)
 *             f[0] = 125 #"}"
 *             f += 1             # <<<<<<<<<<<<<<
 *     return f
 * 
 */
      __pyx_v_f += 1;
    }
    __pyx_L5:;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":289
 *             f[0] = 125 #"}"
 *             f += 1
 *     return f             # <<<<<<<<<<<<<<
 * 
 */
  __pyx_r = __pyx_v_f;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("numpy._util_dtypestring");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_child);
  __Pyx_DECREF(__pyx_v_i);
  __Pyx_DECREF(__pyx_v_t);
  __Pyx_FinishRefcountContext();
  return __pyx_r;
}

static struct PyMethodDef __pyx_methods[] = {
  {__Pyx_NAMESTR("read_matrix"), (PyCFunction)__pyx_pf_7nwalign_read_matrix, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("global_align"), (PyCFunction)__pyx_pf_7nwalign_global_align, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7nwalign_global_align)},
  {__Pyx_NAMESTR("main"), (PyCFunction)__pyx_pf_7nwalign_main, METH_NOARGS, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static void __pyx_init_filenames(void); /*proto*/

#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef __pyx_moduledef = {
    PyModuleDef_HEAD_INIT,
    __Pyx_NAMESTR("nwalign"),
    __Pyx_DOCSTR(__pyx_mdoc), /* 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_global_align, __pyx_k_global_align, sizeof(__pyx_k_global_align), 1, 1, 1},
  {&__pyx_kp_path, __pyx_k_path, sizeof(__pyx_k_path), 1, 1, 1},
  {&__pyx_kp__seqj, __pyx_k__seqj, sizeof(__pyx_k__seqj), 1, 1, 1},
  {&__pyx_kp__seqi, __pyx_k__seqi, sizeof(__pyx_k__seqi), 1, 1, 1},
  {&__pyx_kp_gap, __pyx_k_gap, sizeof(__pyx_k_gap), 1, 1, 1},
  {&__pyx_kp_match, __pyx_k_match, sizeof(__pyx_k_match), 1, 1, 1},
  {&__pyx_kp_mismatch, __pyx_k_mismatch, sizeof(__pyx_k_mismatch), 1, 1, 1},
  {&__pyx_kp_gap_init, __pyx_k_gap_init, sizeof(__pyx_k_gap_init), 1, 1, 1},
  {&__pyx_kp_matrix, __pyx_k_matrix, sizeof(__pyx_k_matrix), 1, 1, 1},
  {&__pyx_kp_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 1, 1, 1},
  {&__pyx_kp_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 1, 1},
  {&__pyx_kp_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 1, 1, 1},
  {&__pyx_kp_23, __pyx_k_23, sizeof(__pyx_k_23), 1, 1, 1},
  {&__pyx_kp_os, __pyx_k_os, sizeof(__pyx_k_os), 0, 1, 1},
  {&__pyx_kp_24, __pyx_k_24, sizeof(__pyx_k_24), 0, 1, 0},
  {&__pyx_kp_MATRIX, __pyx_k_MATRIX, sizeof(__pyx_k_MATRIX), 1, 1, 1},
  {&__pyx_kp_open, __pyx_k_open, sizeof(__pyx_k_open), 1, 1, 1},
  {&__pyx_kp_readline, __pyx_k_readline, sizeof(__pyx_k_readline), 1, 1, 1},
  {&__pyx_kp_strip, __pyx_k_strip, sizeof(__pyx_k_strip), 1, 1, 1},
  {&__pyx_kp_split, __pyx_k_split, sizeof(__pyx_k_split), 1, 1, 1},
  {&__pyx_kp_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 1, 1, 1},
  {&__pyx_kp_int, __pyx_k_int, sizeof(__pyx_k_int), 1, 1, 1},
  {&__pyx_kp_range, __pyx_k_range, sizeof(__pyx_k_range), 1, 1, 1},
  {&__pyx_kp_join, __pyx_k_join, sizeof(__pyx_k_join), 1, 1, 1},
  {&__pyx_kp_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 1, 1, 1},
  {&__pyx_kp_29, __pyx_k_29, sizeof(__pyx_k_29), 1, 1, 1},
  {&__pyx_kp_uint, __pyx_k_uint, sizeof(__pyx_k_uint), 1, 1, 1},
  {&__pyx_kp_read_matrix, __pyx_k_read_matrix, sizeof(__pyx_k_read_matrix), 1, 1, 1},
  {&__pyx_kp_arange, __pyx_k_arange, sizeof(__pyx_k_arange), 1, 1, 1},
  {&__pyx_kp_stderr, __pyx_k_stderr, sizeof(__pyx_k_stderr), 1, 1, 1},
  {&__pyx_kp_write, __pyx_k_write, sizeof(__pyx_k_write), 1, 1, 1},
  {&__pyx_kp_Exception, __pyx_k_Exception, sizeof(__pyx_k_Exception), 1, 1, 1},
  {&__pyx_kp_optparse, __pyx_k_optparse, sizeof(__pyx_k_optparse), 1, 1, 1},
  {&__pyx_kp_OptionParser, __pyx_k_OptionParser, sizeof(__pyx_k_OptionParser), 1, 1, 1},
  {&__pyx_kp_usage, __pyx_k_usage, sizeof(__pyx_k_usage), 1, 1, 1},
  {&__pyx_kp_add_option, __pyx_k_add_option, sizeof(__pyx_k_add_option), 1, 1, 1},
  {&__pyx_kp_dest, __pyx_k_dest, sizeof(__pyx_k_dest), 1, 1, 1},
  {&__pyx_kp_40, __pyx_k_40, sizeof(__pyx_k_40), 0, 1, 0},
  {&__pyx_kp_help, __pyx_k_help, sizeof(__pyx_k_help), 1, 1, 1},
  {&__pyx_kp_type, __pyx_k_type, sizeof(__pyx_k_type), 1, 1, 1},
  {&__pyx_kp_42, __pyx_k_42, sizeof(__pyx_k_42), 0, 1, 0},
  {&__pyx_kp_default, __pyx_k_default, sizeof(__pyx_k_default), 1, 1, 1},
  {&__pyx_kp_44, __pyx_k_44, sizeof(__pyx_k_44), 0, 1, 0},
  {&__pyx_kp_46, __pyx_k_46, sizeof(__pyx_k_46), 0, 1, 0},
  {&__pyx_kp_48, __pyx_k_48, sizeof(__pyx_k_48), 0, 1, 0},
  {&__pyx_kp_50, __pyx_k_50, sizeof(__pyx_k_50), 0, 1, 0},
  {&__pyx_kp_52, __pyx_k_52, sizeof(__pyx_k_52), 0, 1, 0},
  {&__pyx_kp_54, __pyx_k_54, sizeof(__pyx_k_54), 0, 1, 0},
  {&__pyx_kp_56, __pyx_k_56, sizeof(__pyx_k_56), 0, 1, 0},
  {&__pyx_kp_parse_args, __pyx_k_parse_args, sizeof(__pyx_k_parse_args), 1, 1, 1},
  {&__pyx_kp_exit, __pyx_k_exit, sizeof(__pyx_k_exit), 1, 1, 1},
  {&__pyx_kp_print_help, __pyx_k_print_help, sizeof(__pyx_k_print_help), 1, 1, 1},
  {&__pyx_kp_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 0, 0},
  {&__pyx_kp_26, __pyx_k_26, sizeof(__pyx_k_26), 0, 0, 0},
  {&__pyx_kp_27, __pyx_k_27, sizeof(__pyx_k_27), 0, 0, 0},
  {&__pyx_kp_28, __pyx_k_28, sizeof(__pyx_k_28), 0, 0, 0},
  {&__pyx_kp_30, __pyx_k_30, sizeof(__pyx_k_30), 0, 0, 0},
  {&__pyx_kp_31, __pyx_k_31, sizeof(__pyx_k_31), 0, 0, 0},
  {&__pyx_kp_32, __pyx_k_32, sizeof(__pyx_k_32), 0, 0, 0},
  {&__pyx_kp_33, __pyx_k_33, sizeof(__pyx_k_33), 0, 0, 0},
  {&__pyx_kp_34, __pyx_k_34, sizeof(__pyx_k_34), 0, 0, 0},
  {&__pyx_kp_35, __pyx_k_35, sizeof(__pyx_k_35), 0, 0, 0},
  {&__pyx_kp_36, __pyx_k_36, sizeof(__pyx_k_36), 0, 0, 0},
  {&__pyx_kp_37, __pyx_k_37, sizeof(__pyx_k_37), 0, 0, 0},
  {&__pyx_kp_38, __pyx_k_38, sizeof(__pyx_k_38), 0, 0, 0},
  {&__pyx_kp_39, __pyx_k_39, sizeof(__pyx_k_39), 0, 0, 0},
  {&__pyx_kp_41, __pyx_k_41, sizeof(__pyx_k_41), 0, 0, 0},
  {&__pyx_kp_43, __pyx_k_43, sizeof(__pyx_k_43), 0, 0, 0},
  {&__pyx_kp_45, __pyx_k_45, sizeof(__pyx_k_45), 0, 0, 0},
  {&__pyx_kp_47, __pyx_k_47, sizeof(__pyx_k_47), 0, 0, 0},
  {&__pyx_kp_49, __pyx_k_49, sizeof(__pyx_k_49), 0, 0, 0},
  {&__pyx_kp_51, __pyx_k_51, sizeof(__pyx_k_51), 0, 0, 0},
  {&__pyx_kp_53, __pyx_k_53, sizeof(__pyx_k_53), 0, 0, 0},
  {&__pyx_kp_55, __pyx_k_55, sizeof(__pyx_k_55), 0, 0, 0},
  {&__pyx_kp_57, __pyx_k_57, sizeof(__pyx_k_57), 0, 0, 0},
  {&__pyx_kp_58, __pyx_k_58, sizeof(__pyx_k_58), 0, 0, 0},
  {&__pyx_kp___getbuffer__, __pyx_k___getbuffer__, sizeof(__pyx_k___getbuffer__), 1, 1, 1},
  {&__pyx_kp___releasebuffer__, __pyx_k___releasebuffer__, sizeof(__pyx_k___releasebuffer__), 1, 1, 1},
  {&__pyx_kp_info, __pyx_k_info, sizeof(__pyx_k_info), 1, 1, 1},
  {&__pyx_kp_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 1, 1, 1},
  {&__pyx_kp_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 1, 1, 1},
  {&__pyx_kp_itervalues, __pyx_k_itervalues, sizeof(__pyx_k_itervalues), 1, 1, 1},
  {&__pyx_kp_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 1, 1, 1},
  {&__pyx_kp_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 0},
  {&__pyx_kp_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 0},
  {&__pyx_kp_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 0, 0},
  {&__pyx_kp_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 0},
  {&__pyx_kp_22, __pyx_k_22, sizeof(__pyx_k_22), 0, 0, 0},
  {0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_open = __Pyx_GetName(__pyx_b, __pyx_kp_open); if (!__pyx_builtin_open) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_kp_range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_Exception = __Pyx_GetName(__pyx_b, __pyx_kp_Exception); if (!__pyx_builtin_Exception) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_kp_ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_kp_RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  return 0;
  __pyx_L1_error:;
  return -1;
}

static int __Pyx_InitGlobals(void) {
  __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_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  return 0;
  __pyx_L1_error:;
  return -1;
}

#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC initnwalign(void); /*proto*/
PyMODINIT_FUNC initnwalign(void)
#else
PyMODINIT_FUNC PyInit_nwalign(void); /*proto*/
PyMODINIT_FUNC PyInit_nwalign(void)
#endif
{
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_t_1 = NULL;
  #ifdef CYTHON_REFNANNY
  void* __pyx_refchk = NULL;
  __Pyx_Refnanny = __Pyx_ImportRefcountAPI("refnanny");
  if (!__Pyx_Refnanny) {
      PyErr_Clear();
      __Pyx_Refnanny = __Pyx_ImportRefcountAPI("Cython.Runtime.refnanny");
      if (!__Pyx_Refnanny)
          Py_FatalError("failed to import refnanny module");
  }
  __pyx_refchk = __Pyx_Refnanny->NewContext("PyMODINIT_FUNC PyInit_nwalign(void)", __LINE__, __FILE__);
  #endif
  __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;}
  /*--- Library function declarations ---*/
  __pyx_init_filenames();
  /*--- 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
  /*--- 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;}
  /*--- Module creation code ---*/
  #if PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4(__Pyx_NAMESTR("nwalign"), __pyx_methods, __pyx_mdoc, 0, PYTHON_API_VERSION);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  #if PY_MAJOR_VERSION < 3
  Py_INCREF(__pyx_m);
  #endif
  __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME));
  if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  /*--- Builtin init code ---*/
  if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_skip_dispatch = 0;
  /*--- Global init code ---*/
  /*--- Function export code ---*/
  /*--- Type init code ---*/
  /*--- Type import code ---*/
  __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr)); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject)); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Function import code ---*/
  /*--- Execution code ---*/

  /* "/opt/src/bpbio/nwalign/nwalign.pyx":43
 * is distributed with the NCBI toolset.
 * """
 * import numpy as np             # <<<<<<<<<<<<<<
 * cimport numpy as np
 * 
 */
  __pyx_1 = __Pyx_Import(__pyx_kp_numpy, 0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_kp_np, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_1); __pyx_1 = 0;

  /* "/opt/src/bpbio/nwalign/nwalign.pyx":48
 * 
 * cimport cython
 * import sys             # <<<<<<<<<<<<<<
 * import os.path
 * 
 */
  __pyx_1 = __Pyx_Import(__pyx_kp_sys, 0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_kp_sys, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_1); __pyx_1 = 0;

  /* "/opt/src/bpbio/nwalign/nwalign.pyx":49
 * cimport cython
 * import sys
 * import os.path             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_1 = __Pyx_Import(__pyx_kp_23, 0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_kp_os, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_1); __pyx_1 = 0;

  /* "/opt/src/bpbio/nwalign/nwalign.pyx":66
 * ctypedef np.int8_t DTYPE_BOOL
 * 
 * cdef size_t UP = 0, LEFT = 1, DIAG = 2, NONE = 3             # <<<<<<<<<<<<<<
 * 
 * MATRIX = ['BLOSUM62']
 */
  __pyx_v_7nwalign_UP = 0;
  __pyx_v_7nwalign_LEFT = 1;
  __pyx_v_7nwalign_DIAG = 2;
  __pyx_v_7nwalign_NONE = 3;

  /* "/opt/src/bpbio/nwalign/nwalign.pyx":68
 * cdef size_t UP = 0, LEFT = 1, DIAG = 2, NONE = 3
 * 
 * MATRIX = ['BLOSUM62']             # <<<<<<<<<<<<<<
 * 
 * cdef inline int imax2(int a, int b):
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_kp_24);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_kp_24);
  __Pyx_GIVEREF(__pyx_kp_24);
  if (PyObject_SetAttr(__pyx_m, __pyx_kp_MATRIX, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;

  /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.1-py2.6-linux-x86_64.egg/Cython/Includes/stdlib.pxd":2
 * 
 * cdef extern from "stdlib.h" nogil:             # <<<<<<<<<<<<<<
 *     void free(void *ptr)
 *     void *malloc(size_t size)
 */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_1);
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("nwalign");
  Py_DECREF(__pyx_m); __pyx_m = 0;
  __pyx_L0:;
  __Pyx_FinishRefcountContext();
  #if PY_MAJOR_VERSION < 3
  return;
  #else
  return __pyx_m;
  #endif
}

static const char *__pyx_filenames[] = {
  "nwalign.pyx",
  "numpy.pxd",
};

/* Runtime support code */

static void __pyx_init_filenames(void) {
  __pyx_f = __pyx_filenames;
}


static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
    if (!type) {
        PyErr_Format(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (obj == Py_None || PyObject_TypeCheck(obj, type))
        return 1;
    PyErr_Format(PyExc_TypeError, "Cannot convert %s to %s",
        Py_TYPE(obj)->tp_name, type->tp_name);
    return 0;
}

static INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
  if (info->buf == NULL) return;
  if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL;
  __Pyx_ReleaseBuffer(info);
}

static INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) {
  buf->buf = NULL;
  buf->obj = NULL;
  buf->strides = __Pyx_zeros;
  buf->shape = __Pyx_zeros;
  buf->suboffsets = __Pyx_minusones;
}

static INLINE const char* __Pyx_ConsumeWhitespace(const char* ts) {
  while (1) {
    switch (*ts) {
      case '@':
      case 10:
      case 13:
      case ' ':
        ++ts;
        break;
      case '=':
      case '<':
      case '>':
      case '!':
        PyErr_SetString(PyExc_ValueError, "Buffer acquisition error: Only native byte order, size and alignment supported.");
        return NULL;               
      default:
        return ts;
    }
  }
}

static void __Pyx_BufferNdimError(Py_buffer* buffer, int expected_ndim) {
  PyErr_Format(PyExc_ValueError,
               "Buffer has wrong number of dimensions (expected %d, got %d)",
               expected_ndim, buffer->ndim);
}

static const char* __Pyx_DescribeTokenInFormatString(const char* ts) {
  switch (*ts) {
    case 'b': return "char";
    case 'B': return "unsigned char";
    case 'h': return "short";
    case 'H': return "unsigned short";
    case 'i': return "int";
    case 'I': return "unsigned int";
    case 'l': return "long";
    case 'L': return "unsigned long";
    case 'q': return "long long";
    case 'Q': return "unsigned long long";
    case 'f': return "float";
    case 'd': return "double";
    case 'g': return "long double";
    case 'Z': switch (*(ts+1)) {
        case 'f': return "complex float";
        case 'd': return "complex double";
        case 'g': return "complex long double";
        default: return "unparseable format string";
    }
    case 'T': return "a struct";
    case 'O': return "Python object";
    case 'P': return "a pointer";
    default: return "unparseable format string";
  }
}

static const char* __Pyx_CheckTypestring_nn___pyx_t_7nwalign_DTYPE_INT(const char* ts) {
  int ok;
  ts = __Pyx_ConsumeWhitespace(ts); if (!ts) return NULL;
  if (*ts == '1') ++ts;
  switch (*ts) {
    case 'b': ok = (sizeof(__pyx_t_7nwalign_DTYPE_INT) == sizeof(char) && (__pyx_t_7nwalign_DTYPE_INT)-1 < 0); break;
    case 'h': ok = (sizeof(__pyx_t_7nwalign_DTYPE_INT) == sizeof(short) && (__pyx_t_7nwalign_DTYPE_INT)-1 < 0); break;
    case 'i': ok = (sizeof(__pyx_t_7nwalign_DTYPE_INT) == sizeof(int) && (__pyx_t_7nwalign_DTYPE_INT)-1 < 0); break;
    case 'l': ok = (sizeof(__pyx_t_7nwalign_DTYPE_INT) == sizeof(long) && (__pyx_t_7nwalign_DTYPE_INT)-1 < 0); break;
    case 'q': ok = (sizeof(__pyx_t_7nwalign_DTYPE_INT) == sizeof(long long) && (__pyx_t_7nwalign_DTYPE_INT)-1 < 0); break;
    default: ok = 0;
  }
  if (!(ok)) {
    PyErr_Format(PyExc_ValueError, "Buffer dtype mismatch (expected nwalign.DTYPE_INT, got %s)", __Pyx_DescribeTokenInFormatString(ts));
    return NULL;
  }
  ++ts;
  return ts;
}

static int __Pyx_GetBuffer_nn___pyx_t_7nwalign_DTYPE_INT(PyObject* obj, Py_buffer* buf, int flags, int nd, int cast) {
  const char* ts;
  if (obj == Py_None) {
    __Pyx_ZeroBuffer(buf);
    return 0;
  }
  buf->buf = NULL;
  if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail;
  if (buf->ndim != nd) {
    __Pyx_BufferNdimError(buf, nd);
    goto fail;
  }
  if (!cast) {
    ts = buf->format;
    ts = __Pyx_ConsumeWhitespace(ts);
    if (!ts) goto fail;
    ts = __Pyx_CheckTypestring_nn___pyx_t_7nwalign_DTYPE_INT(ts);
    if (!ts) goto fail;
    ts = __Pyx_ConsumeWhitespace(ts);
    if (!ts) goto fail;
    if (*ts != 0) {
      PyErr_Format(PyExc_ValueError,
        "Buffer dtype mismatch (expected end, got %s)",
        __Pyx_DescribeTokenInFormatString(ts));
      goto fail;
    }
  } else {
    if (buf->itemsize != sizeof(__pyx_t_7nwalign_DTYPE_INT)) {
      PyErr_SetString(PyExc_ValueError,
        "Attempted cast of buffer to datatype of different size.");
      goto fail;
    }
  }
  if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
  return 0;
fail:;
  __Pyx_ZeroBuffer(buf);
  return -1;
}
static void __Pyx_RaiseBufferFallbackError(void) {
  PyErr_Format(PyExc_ValueError,
     "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!");
}


static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();

#if PY_MAJOR_VERSION >= 3
    /* Note: this is a temporary work-around to prevent crashes in Python 3.0 */
    if ((tstate->exc_type != NULL) & (tstate->exc_type != Py_None)) {
        tmp_type = tstate->exc_type;
        tmp_value = tstate->exc_value;
        tmp_tb = tstate->exc_traceback;
        PyErr_NormalizeException(&type, &value, &tb);
        PyErr_NormalizeException(&tmp_type, &tmp_value, &tmp_tb);
        tstate->exc_type = 0;
        tstate->exc_value = 0;
        tstate->exc_traceback = 0;
        PyException_SetContext(value, tmp_value);
        Py_DECREF(tmp_type);
        Py_XDECREF(tmp_tb);
    }
#endif

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

static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
    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;
}

static const char* __Pyx_CheckTypestring_nn___pyx_t_7nwalign_DTYPE_BOOL(const char* ts) {
  int ok;
  ts = __Pyx_ConsumeWhitespace(ts); if (!ts) return NULL;
  if (*ts == '1') ++ts;
  switch (*ts) {
    case 'b': ok = (sizeof(__pyx_t_7nwalign_DTYPE_BOOL) == sizeof(char) && (__pyx_t_7nwalign_DTYPE_BOOL)-1 < 0); break;
    case 'h': ok = (sizeof(__pyx_t_7nwalign_DTYPE_BOOL) == sizeof(short) && (__pyx_t_7nwalign_DTYPE_BOOL)-1 < 0); break;
    case 'i': ok = (sizeof(__pyx_t_7nwalign_DTYPE_BOOL) == sizeof(int) && (__pyx_t_7nwalign_DTYPE_BOOL)-1 < 0); break;
    case 'l': ok = (sizeof(__pyx_t_7nwalign_DTYPE_BOOL) == sizeof(long) && (__pyx_t_7nwalign_DTYPE_BOOL)-1 < 0); break;
    case 'q': ok = (sizeof(__pyx_t_7nwalign_DTYPE_BOOL) == sizeof(long long) && (__pyx_t_7nwalign_DTYPE_BOOL)-1 < 0); break;
    default: ok = 0;
  }
  if (!(ok)) {
    PyErr_Format(PyExc_ValueError, "Buffer dtype mismatch (expected nwalign.DTYPE_BOOL, got %s)", __Pyx_DescribeTokenInFormatString(ts));
    return NULL;
  }
  ++ts;
  return ts;
}

static int __Pyx_GetBuffer_nn___pyx_t_7nwalign_DTYPE_BOOL(PyObject* obj, Py_buffer* buf, int flags, int nd, int cast) {
  const char* ts;
  if (obj == Py_None) {
    __Pyx_ZeroBuffer(buf);
    return 0;
  }
  buf->buf = NULL;
  if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail;
  if (buf->ndim != nd) {
    __Pyx_BufferNdimError(buf, nd);
    goto fail;
  }
  if (!cast) {
    ts = buf->format;
    ts = __Pyx_ConsumeWhitespace(ts);
    if (!ts) goto fail;
    ts = __Pyx_CheckTypestring_nn___pyx_t_7nwalign_DTYPE_BOOL(ts);
    if (!ts) goto fail;
    ts = __Pyx_ConsumeWhitespace(ts);
    if (!ts) goto fail;
    if (*ts != 0) {
      PyErr_Format(PyExc_ValueError,
        "Buffer dtype mismatch (expected end, got %s)",
        __Pyx_DescribeTokenInFormatString(ts));
      goto fail;
    }
  } else {
    if (buf->itemsize != sizeof(__pyx_t_7nwalign_DTYPE_BOOL)) {
      PyErr_SetString(PyExc_ValueError,
        "Attempted cast of buffer to datatype of different size.");
      goto fail;
    }
  }
  if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
  return 0;
fail:;
  __Pyx_ZeroBuffer(buf);
  return -1;
}static const char* __Pyx_CheckTypestring_nn___pyx_t_7nwalign_DTYPE_UINT(const char* ts) {
  int ok;
  ts = __Pyx_ConsumeWhitespace(ts); if (!ts) return NULL;
  if (*ts == '1') ++ts;
  switch (*ts) {
    case 'B': ok = (sizeof(__pyx_t_7nwalign_DTYPE_UINT) == sizeof(unsigned char) && (__pyx_t_7nwalign_DTYPE_UINT)-1 > 0); break;
    case 'H': ok = (sizeof(__pyx_t_7nwalign_DTYPE_UINT) == sizeof(unsigned short) && (__pyx_t_7nwalign_DTYPE_UINT)-1 > 0); break;
    case 'I': ok = (sizeof(__pyx_t_7nwalign_DTYPE_UINT) == sizeof(unsigned int) && (__pyx_t_7nwalign_DTYPE_UINT)-1 > 0); break;
    case 'L': ok = (sizeof(__pyx_t_7nwalign_DTYPE_UINT) == sizeof(unsigned long) && (__pyx_t_7nwalign_DTYPE_UINT)-1 > 0); break;
    case 'Q': ok = (sizeof(__pyx_t_7nwalign_DTYPE_UINT) == sizeof(unsigned long long) && (__pyx_t_7nwalign_DTYPE_UINT)-1 > 0); break;
    default: ok = 0;
  }
  if (!(ok)) {
    PyErr_Format(PyExc_ValueError, "Buffer dtype mismatch (expected nwalign.DTYPE_UINT, got %s)", __Pyx_DescribeTokenInFormatString(ts));
    return NULL;
  }
  ++ts;
  return ts;
}

static int __Pyx_GetBuffer_nn___pyx_t_7nwalign_DTYPE_UINT(PyObject* obj, Py_buffer* buf, int flags, int nd, int cast) {
  const char* ts;
  if (obj == Py_None) {
    __Pyx_ZeroBuffer(buf);
    return 0;
  }
  buf->buf = NULL;
  if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail;
  if (buf->ndim != nd) {
    __Pyx_BufferNdimError(buf, nd);
    goto fail;
  }
  if (!cast) {
    ts = buf->format;
    ts = __Pyx_ConsumeWhitespace(ts);
    if (!ts) goto fail;
    ts = __Pyx_CheckTypestring_nn___pyx_t_7nwalign_DTYPE_UINT(ts);
    if (!ts) goto fail;
    ts = __Pyx_ConsumeWhitespace(ts);
    if (!ts) goto fail;
    if (*ts != 0) {
      PyErr_Format(PyExc_ValueError,
        "Buffer dtype mismatch (expected end, got %s)",
        __Pyx_DescribeTokenInFormatString(ts));
      goto fail;
    }
  } else {
    if (buf->itemsize != sizeof(__pyx_t_7nwalign_DTYPE_UINT)) {
      PyErr_SetString(PyExc_ValueError,
        "Attempted cast of buffer to datatype of different size.");
      goto fail;
    }
  }
  if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
  return 0;
fail:;
  __Pyx_ZeroBuffer(buf);
  return -1;
}
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_AS_STRING(kw_name));
        #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 *number, *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";
    }
    number = (num_expected == 1) ? "" : "s";
    PyErr_Format(PyExc_TypeError,
        #if PY_VERSION_HEX < 0x02050000
            "%s() takes %s %d positional argument%s (%d given)",
        #else
            "%s() takes %s %zd positional argument%s (%zd given)",
        #endif
        func_name, more_or_less, num_expected, number, num_found);
}

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;
        } else {
            #if PY_MAJOR_VERSION < 3
            if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) {
            #else
            if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) {
            #endif
                goto invalid_keyword_type;
            } else {
                for (name = first_kw_arg; *name; name++) {
                    #if PY_MAJOR_VERSION >= 3
                    if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
                        PyUnicode_Compare(**name, key) == 0) break;
                    #else
                    if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
                        _PyString_Eq(**name, key)) break;
                    #endif
                }
                if (*name) {
                    values[name-argnames] = value;
                } else {
                    /* unexpected keyword found */
                    for (name=argnames; name != first_kw_arg; name++) {
                        if (**name == key) goto arg_passed_twice;
                        #if PY_MAJOR_VERSION >= 3
                        if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
                            PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice;
                        #else
                        if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
                            _PyString_Eq(**name, key)) goto arg_passed_twice;
                        #endif
                    }
                    if (kwds2) {
                        if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
                    } else {
                        goto invalid_keyword;
                    }
                }
            }
        }
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, **name);
    goto bad;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%s() keywords must be strings", function_name);
    goto bad;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%s() got an unexpected keyword argument '%s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
bad:
    return -1;
}

static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    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;
    PyErr_NormalizeException(type, value, tb);
    if (PyErr_Occurred())
        goto bad;
    Py_INCREF(*type);
    Py_INCREF(*value);
    Py_INCREF(*tb);
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = *type;
    tstate->exc_value = *value;
    tstate->exc_traceback = *tb;
    /* Make sure tstate is in a consistent state when we XDECREF
    these objects (XDECREF may run arbitrary code). */
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
    return 0;
bad:
    Py_XDECREF(*type);
    Py_XDECREF(*value);
    Py_XDECREF(*tb);
    return -1;
}


static INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) {
    PyThreadState *tstate = PyThreadState_GET();
    *type = tstate->exc_type;
    *value = tstate->exc_value;
    *tb = tstate->exc_traceback;
    Py_XINCREF(*type);
    Py_XINCREF(*value);
    Py_XINCREF(*tb);
}

static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = type;
    tstate->exc_value = value;
    tstate->exc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
}

#if PY_MAJOR_VERSION < 3
static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
  #if PY_VERSION_HEX >= 0x02060000
  if (Py_TYPE(obj)->tp_flags & Py_TPFLAGS_HAVE_NEWBUFFER)
      return PyObject_GetBuffer(obj, view, flags);
  #endif
  if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pf_5numpy_7ndarray___getbuffer__(obj, view, flags);
  else {
  PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
  return -1;
    }
}

static void __Pyx_ReleaseBuffer(Py_buffer *view) {
  PyObject* obj = view->obj;
  if (obj) {
if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) __pyx_pf_5numpy_7ndarray___releasebuffer__(obj, view);
    Py_DECREF(obj);
    view->obj = NULL;
  }
}

#endif

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) {
    PyObject *__import__ = 0;
    PyObject *empty_list = 0;
    PyObject *module = 0;
    PyObject *global_dict = 0;
    PyObject *empty_dict = 0;
    PyObject *list;
    __import__ = __Pyx_GetAttrString(__pyx_b, "__import__");
    if (!__import__)
        goto bad;
    if (from_list)
        list = from_list;
    else {
        empty_list = PyList_New(0);
        if (!empty_list)
            goto bad;
        list = empty_list;
    }
    global_dict = PyModule_GetDict(__pyx_m);
    if (!global_dict)
        goto bad;
    empty_dict = PyDict_New();
    if (!empty_dict)
        goto bad;
    module = PyObject_CallFunctionObjArgs(__import__,
        name, global_dict, empty_dict, list, NULL);
bad:
    Py_XDECREF(empty_list);
    Py_XDECREF(__import__);
    Py_XDECREF(empty_dict);
    return module;
}

static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
    PyObject *result;
    result = PyObject_GetAttr(dict, name);
    if (!result)
        PyErr_SetObject(PyExc_NameError, name);
    return result;
}

static INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
    PyErr_Format(PyExc_ValueError,
        #if PY_VERSION_HEX < 0x02050000
                 "need more than %d value%s to unpack", (int)index,
        #else
                 "need more than %zd value%s to unpack", index,
        #endif
                 (index == 1) ? "" : "s");
}

static INLINE void __Pyx_RaiseTooManyValuesError(void) {
    PyErr_SetString(PyExc_ValueError, "too many values to unpack");
}

static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) {
    PyObject *item;
    if (!(item = PyIter_Next(iter))) {
        if (!PyErr_Occurred()) {
            __Pyx_RaiseNeedMoreValuesError(index);
        }
    }
    return item;
}

static int __Pyx_EndUnpack(PyObject *iter) {
    PyObject *item;
    if ((item = PyIter_Next(iter))) {
        Py_DECREF(item);
        __Pyx_RaiseTooManyValuesError();
        return -1;
    }
    else if (!PyErr_Occurred())
        return 0;
    else
        return -1;
}

static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
    Py_XINCREF(type);
    Py_XINCREF(value);
    Py_XINCREF(tb);
    /* First, check the traceback argument, replacing None with NULL. */
    if (tb == Py_None) {
        Py_DECREF(tb);
        tb = 0;
    }
    else if (tb != NULL && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto raise_error;
    }
    /* Next, replace a missing value with None */
    if (value == NULL) {
        value = Py_None;
        Py_INCREF(value);
    }
    #if PY_VERSION_HEX < 0x02050000
    if (!PyClass_Check(type))
    #else
    if (!PyType_Check(type))
    #endif
    {
        /* Raising an instance.  The value should be a dummy. */
        if (value != Py_None) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto raise_error;
        }
        /* Normalize to raise <class>, <instance> */
        Py_DECREF(value);
        value = type;
        #if PY_VERSION_HEX < 0x02050000
            if (PyInstance_Check(type)) {
                type = (PyObject*) ((PyInstanceObject*)type)->in_class;
                Py_INCREF(type);
            }
            else {
                type = 0;
                PyErr_SetString(PyExc_TypeError,
                    "raise: exception must be an old-style class or instance");
                goto raise_error;
            }
        #else
            type = (PyObject*) Py_TYPE(type);
            Py_INCREF(type);
            if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
                PyErr_SetString(PyExc_TypeError,
                    "raise: exception class must be a subclass of BaseException");
                goto raise_error;
            }
        #endif
    }
    __Pyx_ErrRestore(type, value, tb);
    return;
raise_error:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}

#if PY_MAJOR_VERSION < 3
static PyObject *__Pyx_GetStdout(void) {
    PyObject *f = PySys_GetObject((char *)"stdout");
    if (!f) {
        PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout");
    }
    return f;
}

static int __Pyx_Print(PyObject *arg_tuple, int newline) {
    PyObject *f;
    PyObject* v;
    int i;

    if (!(f = __Pyx_GetStdout()))
        return -1;
    for (i=0; i < PyTuple_GET_SIZE(arg_tuple); i++) {
        if (PyFile_SoftSpace(f, 1)) {
            if (PyFile_WriteString(" ", f) < 0)
                return -1;
        }
        v = PyTuple_GET_ITEM(arg_tuple, i);
        if (PyFile_WriteObject(v, f, Py_PRINT_RAW) < 0)
            return -1;
        if (PyString_Check(v)) {
            char *s = PyString_AsString(v);
            Py_ssize_t len = PyString_Size(v);
            if (len > 0 &&
                isspace(Py_CHARMASK(s[len-1])) &&
                s[len-1] != ' ')
                    PyFile_SoftSpace(f, 0);
        }
    }
    if (newline) {
        if (PyFile_WriteString("\n", f) < 0)
            return -1;
        PyFile_SoftSpace(f, 0);
    }
    return 0;
}

#else /* Python 3 has a print function */

static int __Pyx_Print(PyObject *arg_tuple, int newline) {
    PyObject* kwargs = 0;
    PyObject* result = 0;
    PyObject* end_string;
    if (!__pyx_print) {
        __pyx_print = __Pyx_GetAttrString(__pyx_b, "print");
        if (!__pyx_print)
            return -1;
    }
    if (!newline) {
        if (!__pyx_print_kwargs) {
            __pyx_print_kwargs = PyDict_New();
            if (!__pyx_print_kwargs)
                return -1;
            end_string = PyUnicode_FromStringAndSize(" ", 1);
            if (!end_string)
                return -1;
            if (PyDict_SetItemString(__pyx_print_kwargs, "end", end_string) < 0) {
                Py_DECREF(end_string);
                return -1;
            }
            Py_DECREF(end_string);
        }
        kwargs = __pyx_print_kwargs;
    }
    result = PyObject_Call(__pyx_print, arg_tuple, kwargs);
    if (!result)
        return -1;
    Py_DECREF(result);
    return 0;
}

#endif

#if PY_MAJOR_VERSION < 3

static int __Pyx_PrintOne(PyObject *o) {
    PyObject *f;
    if (!(f = __Pyx_GetStdout()))
        return -1;
    if (PyFile_SoftSpace(f, 0)) {
        if (PyFile_WriteString(" ", f) < 0)
            return -1;
    }
    if (PyFile_WriteObject(o, f, Py_PRINT_RAW) < 0)
        return -1;
    if (PyFile_WriteString("\n", f) < 0)
        return -1;
    return 0;
    /* the line below is just to avoid compiler
     * compiler warnings about unused functions */
    return __Pyx_Print(NULL, 0);
}

#else /* Python 3 has a print function */

static int __Pyx_PrintOne(PyObject *o) {
    int res;
    PyObject* arg_tuple = PyTuple_New(1);
    if (unlikely(!arg_tuple))
        return -1;
    Py_INCREF(o);
    PyTuple_SET_ITEM(arg_tuple, 0, o);
    res = __Pyx_Print(arg_tuple, 1);
    Py_DECREF(arg_tuple);
    return res;
}

#endif

static INLINE int __Pyx_StrEq(const char *s1, const char *s2) {
     while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; }
     return *s1 == *s2;
}

static INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) {
    if (sizeof(unsigned char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned char)val)) {
            if (unlikely(val == -1 && PyErr_Occurred()))
                return (unsigned char)-1;
            if (unlikely(val < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to unsigned char");
                return (unsigned char)-1;
            }
            PyErr_SetString(PyExc_OverflowError,
                           "value too large to convert to unsigned char");
            return (unsigned char)-1;
        }
        return (unsigned char)val;
    }
    return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x);
}

static INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) {
    if (sizeof(unsigned short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned short)val)) {
            if (unlikely(val == -1 && PyErr_Occurred()))
                return (unsigned short)-1;
            if (unlikely(val < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to unsigned short");
                return (unsigned short)-1;
            }
            PyErr_SetString(PyExc_OverflowError,
                           "value too large to convert to unsigned short");
            return (unsigned short)-1;
        }
        return (unsigned short)val;
    }
    return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x);
}

static INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) {
    if (sizeof(unsigned int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned int)val)) {
            if (unlikely(val == -1 && PyErr_Occurred()))
                return (unsigned int)-1;
            if (unlikely(val < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to unsigned int");
                return (unsigned int)-1;
            }
            PyErr_SetString(PyExc_OverflowError,
                           "value too large to convert to unsigned int");
            return (unsigned int)-1;
        }
        return (unsigned int)val;
    }
    return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x);
}

static INLINE char __Pyx_PyInt_AsChar(PyObject* x) {
    if (sizeof(char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(char)val)) {
            if (unlikely(val == -1 && PyErr_Occurred()))
                return (char)-1;
            PyErr_SetString(PyExc_OverflowError,
                           "value too large to convert to char");
            return (char)-1;
        }
        return (char)val;
    }
    return (char)__Pyx_PyInt_AsLong(x);
}

static INLINE short __Pyx_PyInt_AsShort(PyObject* x) {
    if (sizeof(short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(short)val)) {
            if (unlikely(val == -1 && PyErr_Occurred()))
                return (short)-1;
            PyErr_SetString(PyExc_OverflowError,
                           "value too large to convert to short");
            return (short)-1;
        }
        return (short)val;
    }
    return (short)__Pyx_PyInt_AsLong(x);
}

static INLINE int __Pyx_PyInt_AsInt(PyObject* x) {
    if (sizeof(int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(int)val)) {
            if (unlikely(val == -1 && PyErr_Occurred()))
                return (int)-1;
            PyErr_SetString(PyExc_OverflowError,
                           "value too large to convert to int");
            return (int)-1;
        }
        return (int)val;
    }
    return (int)__Pyx_PyInt_AsLong(x);
}

static INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) {
    if (sizeof(signed char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed char)val)) {
            if (unlikely(val == -1 && PyErr_Occurred()))
                return (signed char)-1;
            PyErr_SetString(PyExc_OverflowError,
                           "value too large to convert to signed char");
            return (signed char)-1;
        }
        return (signed char)val;
    }
    return (signed char)__Pyx_PyInt_AsSignedLong(x);
}

static INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) {
    if (sizeof(signed short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed short)val)) {
            if (unlikely(val == -1 && PyErr_Occurred()))
                return (signed short)-1;
            PyErr_SetString(PyExc_OverflowError,
                           "value too large to convert to signed short");
            return (signed short)-1;
        }
        return (signed short)val;
    }
    return (signed short)__Pyx_PyInt_AsSignedLong(x);
}

static INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) {
    if (sizeof(signed int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed int)val)) {
            if (unlikely(val == -1 && PyErr_Occurred()))
                return (signed int)-1;
            PyErr_SetString(PyExc_OverflowError,
                           "value too large to convert to signed int");
            return (signed int)-1;
        }
        return (signed int)val;
    }
    return (signed int)__Pyx_PyInt_AsSignedLong(x);
}

static INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_CheckExact(x) || PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to unsigned long");
            return (unsigned long)-1;
        }
        return (unsigned long)val;
    } else
#endif
    if (likely(PyLong_CheckExact(x) || PyLong_Check(x))) {
        if (unlikely(Py_SIZE(x) < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to unsigned long");
            return (unsigned long)-1;
        }
        return PyLong_AsUnsignedLong(x);
    } else {
        unsigned long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (unsigned long)-1;
        val = __Pyx_PyInt_AsUnsignedLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_CheckExact(x) || PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to unsigned PY_LONG_LONG");
            return (unsigned PY_LONG_LONG)-1;
        }
        return (unsigned PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_CheckExact(x) || PyLong_Check(x))) {
        if (unlikely(Py_SIZE(x) < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to unsigned PY_LONG_LONG");
            return (unsigned PY_LONG_LONG)-1;
        }
        return PyLong_AsUnsignedLongLong(x);
    } else {
        unsigned PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (unsigned PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsUnsignedLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_CheckExact(x) || PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        return (long)val;
    } else
#endif
    if (likely(PyLong_CheckExact(x) || PyLong_Check(x))) {
        return PyLong_AsLong(x);
    } else {
        long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (long)-1;
        val = __Pyx_PyInt_AsLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_CheckExact(x) || PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        return (PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_CheckExact(x) || PyLong_Check(x))) {
        return PyLong_AsLongLong(x);
    } else {
        PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_CheckExact(x) || PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        return (signed long)val;
    } else
#endif
    if (likely(PyLong_CheckExact(x) || PyLong_Check(x))) {
        return PyLong_AsLong(x);
    } else {
        signed long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (signed long)-1;
        val = __Pyx_PyInt_AsSignedLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) {
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_CheckExact(x) || PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        return (signed PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_CheckExact(x) || PyLong_Check(x))) {
        return PyLong_AsLongLong(x);
    } else {
        signed PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (signed PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsSignedLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

#ifndef __PYX_HAVE_RT_ImportType
#define __PYX_HAVE_RT_ImportType
static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
    long size)
{
    PyObject *py_module = 0;
    PyObject *result = 0;
    PyObject *py_name = 0;

    py_module = __Pyx_ImportModule(module_name);
    if (!py_module)
        goto bad;
    #if PY_MAJOR_VERSION < 3
    py_name = PyString_FromString(class_name);
    #else
    py_name = PyUnicode_FromString(class_name);
    #endif
    if (!py_name)
        goto bad;
    result = PyObject_GetAttr(py_module, py_name);
    Py_DECREF(py_name);
    py_name = 0;
    Py_DECREF(py_module);
    py_module = 0;
    if (!result)
        goto bad;
    if (!PyType_Check(result)) {
        PyErr_Format(PyExc_TypeError, 
            "%s.%s is not a type object",
            module_name, class_name);
        goto bad;
    }
    if (((PyTypeObject *)result)->tp_basicsize != size) {
        PyErr_Format(PyExc_ValueError, 
            "%s.%s does not appear to be the correct type object",
            module_name, class_name);
        goto bad;
    }
    return (PyTypeObject *)result;
bad:
    Py_XDECREF(py_module);
    Py_XDECREF(result);
    return 0;
}
#endif

#ifndef __PYX_HAVE_RT_ImportModule
#define __PYX_HAVE_RT_ImportModule
static PyObject *__Pyx_ImportModule(const char *name) {
    PyObject *py_name = 0;
    PyObject *py_module = 0;

    #if PY_MAJOR_VERSION < 3
    py_name = PyString_FromString(name);
    #else
    py_name = PyUnicode_FromString(name);
    #endif
    if (!py_name)
        goto bad;
    py_module = PyImport_Import(py_name);
    Py_DECREF(py_name);
    return py_module;
bad:
    Py_XDECREF(py_name);
    return 0;
}
#endif

#include "compile.h"
#include "frameobject.h"
#include "traceback.h"

static void __Pyx_AddTraceback(const char *funcname) {
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    PyObject *py_globals = 0;
    PyObject *empty_string = 0;
    PyCodeObject *py_code = 0;
    PyFrameObject *py_frame = 0;

    #if PY_MAJOR_VERSION < 3
    py_srcfile = PyString_FromString(__pyx_filename);
    #else
    py_srcfile = PyUnicode_FromString(__pyx_filename);
    #endif
    if (!py_srcfile) goto bad;
    if (__pyx_clineno) {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
        #else
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
        #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_globals = PyModule_GetDict(__pyx_m);
    if (!py_globals) goto bad;
    #if PY_MAJOR_VERSION < 3
    empty_string = PyString_FromStringAndSize("", 0);
    #else
    empty_string = PyBytes_FromStringAndSize("", 0);
    #endif
    if (!empty_string) goto bad;
    py_code = PyCode_New(
        0,            /*int argcount,*/
        #if PY_MAJOR_VERSION >= 3
        0,            /*int kwonlyargcount,*/
        #endif
        0,            /*int nlocals,*/
        0,            /*int stacksize,*/
        0,            /*int flags,*/
        empty_string, /*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,*/
        __pyx_lineno,   /*int firstlineno,*/
        empty_string  /*PyObject *lnotab*/
    );
    if (!py_code) goto bad;
    py_frame = PyFrame_New(
        PyThreadState_GET(), /*PyThreadState *tstate,*/
        py_code,             /*PyCodeObject *code,*/
        py_globals,          /*PyObject *globals,*/
        0                    /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    py_frame->f_lineno = __pyx_lineno;
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
    Py_XDECREF(empty_string);
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
    while (t->p) {
        #if PY_MAJOR_VERSION < 3
        if (t->is_unicode && (!t->is_identifier)) {
            *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
        } else if (t->intern) {
            *t->p = PyString_InternFromString(t->s);
        } else {
            *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
        }
        #else  /* Python 3+ has unicode identifiers */
        if (t->is_identifier || (t->is_unicode && t->intern)) {
            *t->p = PyUnicode_InternFromString(t->s);
        } else if (t->is_unicode) {
            *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;
}

/* Type Conversion Functions */

static INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
   if (x == Py_True) return 1;
   else if ((x == Py_False) | (x == Py_None)) return 0;
   else return PyObject_IsTrue(x);
}

static INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
  PyNumberMethods *m;
  const char *name = NULL;
  PyObject *res = NULL;
#if PY_VERSION_HEX < 0x03000000
  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_VERSION_HEX < 0x03000000
  if (m && m->nb_long) {
    name = "long";
    res = PyNumber_Long(x);
  }
  else if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Int(x);
  }
#else
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Long(x);
  }
#endif
  if (res) {
#if PY_VERSION_HEX < 0x03000000
    if (!PyInt_Check(res) && !PyLong_Check(res)) {
#else
    if (!PyLong_Check(res)) {
#endif
      PyErr_Format(PyExc_TypeError,
                   "__%s__ returned non-%s (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 INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  Py_ssize_t ival;
  PyObject* x = PyNumber_Index(b);
  if (!x) return -1;
  ival = PyInt_AsSsize_t(x);
  Py_DECREF(x);
  return ival;
}

static INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
#if PY_VERSION_HEX < 0x02050000
   if (ival <= LONG_MAX)
       return PyInt_FromLong((long)ival);
   else {
       unsigned char *bytes = (unsigned char *) &ival;
       int one = 1; int little = (int)*(unsigned char*)&one;
       return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0);
   }
#else
   return PyInt_FromSize_t(ival);
#endif
}

static INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) {
   unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x);
   if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) {
       return (size_t)-1;
   } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
       PyErr_SetString(PyExc_OverflowError,
                       "value too large to convert to size_t");
       return (size_t)-1;
   }
   return (size_t)val;
}


