/* Generated by Cython 0.29.32 */

/* BEGIN: Cython Metadata
{
    "distutils": {
        "depends": [
            "/opt/hostedtoolcache/Python/3.7.15/x64/lib/python3.7/site-packages/pysam/htslib_util.h",
            "/opt/hostedtoolcache/Python/3.7.15/x64/lib/python3.7/site-packages/pysam/include/htslib/htslib/bgzf.h",
            "/opt/hostedtoolcache/Python/3.7.15/x64/lib/python3.7/site-packages/pysam/include/htslib/htslib/cram.h",
            "/opt/hostedtoolcache/Python/3.7.15/x64/lib/python3.7/site-packages/pysam/include/htslib/htslib/faidx.h",
            "/opt/hostedtoolcache/Python/3.7.15/x64/lib/python3.7/site-packages/pysam/include/htslib/htslib/hfile.h",
            "/opt/hostedtoolcache/Python/3.7.15/x64/lib/python3.7/site-packages/pysam/include/htslib/htslib/hts.h",
            "/opt/hostedtoolcache/Python/3.7.15/x64/lib/python3.7/site-packages/pysam/include/htslib/htslib/kstring.h",
            "/opt/hostedtoolcache/Python/3.7.15/x64/lib/python3.7/site-packages/pysam/include/htslib/htslib/sam.h",
            "/opt/hostedtoolcache/Python/3.7.15/x64/lib/python3.7/site-packages/pysam/include/htslib/htslib/tbx.h",
            "/opt/hostedtoolcache/Python/3.7.15/x64/lib/python3.7/site-packages/pysam/include/htslib/htslib/vcf.h",
            "/opt/hostedtoolcache/Python/3.7.15/x64/lib/python3.7/site-packages/pysam/include/htslib/htslib/vcfutils.h",
            "/opt/hostedtoolcache/Python/3.7.15/x64/lib/python3.7/site-packages/pysam/pysam_stream.h"
        ],
        "extra_compile_args": [
            "-Wno-unused-function"
        ],
        "include_dirs": [
            "/opt/hostedtoolcache/Python/3.7.15/x64/lib/python3.7/site-packages/pysam",
            "/opt/hostedtoolcache/Python/3.7.15/x64/lib/python3.7/site-packages/pysam/include/htslib",
            "/opt/hostedtoolcache/Python/3.7.15/x64/lib/python3.7/site-packages/pysam/include/samtools"
        ],
        "name": "aldy.indelpost.pileup",
        "sources": [
            "aldy/indelpost/pileup.pyx"
        ]
    },
    "module_name": "aldy.indelpost.pileup"
}
END: Cython Metadata */

#ifndef PY_SSIZE_T_CLEAN
#define PY_SSIZE_T_CLEAN
#endif /* PY_SSIZE_T_CLEAN */
#include "Python.h"
#ifndef Py_PYTHON_H
    #error Python headers needed to compile C extensions, please install development version of Python.
#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
    #error Cython requires Python 2.6+ or Python 3.3+.
#else
#define CYTHON_ABI "0_29_32"
#define CYTHON_HEX_VERSION 0x001D20F0
#define CYTHON_FUTURE_DIVISION 1
#include <stddef.h>
#ifndef offsetof
  #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif
#if !defined(WIN32) && !defined(MS_WINDOWS)
  #ifndef __stdcall
    #define __stdcall
  #endif
  #ifndef __cdecl
    #define __cdecl
  #endif
  #ifndef __fastcall
    #define __fastcall
  #endif
#endif
#ifndef DL_IMPORT
  #define DL_IMPORT(t) t
#endif
#ifndef DL_EXPORT
  #define DL_EXPORT(t) t
#endif
#define __PYX_COMMA ,
#ifndef HAVE_LONG_LONG
  #if PY_VERSION_HEX >= 0x02070000
    #define HAVE_LONG_LONG
  #endif
#endif
#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif
#ifndef Py_HUGE_VAL
  #define Py_HUGE_VAL HUGE_VAL
#endif
#ifdef PYPY_VERSION
  #define CYTHON_COMPILING_IN_PYPY 1
  #define CYTHON_COMPILING_IN_PYSTON 0
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #define CYTHON_COMPILING_IN_NOGIL 0
  #undef CYTHON_USE_TYPE_SLOTS
  #define CYTHON_USE_TYPE_SLOTS 0
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #if PY_VERSION_HEX < 0x03050000
    #undef CYTHON_USE_ASYNC_SLOTS
    #define CYTHON_USE_ASYNC_SLOTS 0
  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
    #define CYTHON_USE_ASYNC_SLOTS 1
  #endif
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #undef CYTHON_USE_UNICODE_INTERNALS
  #define CYTHON_USE_UNICODE_INTERNALS 0
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #undef CYTHON_AVOID_BORROWED_REFS
  #define CYTHON_AVOID_BORROWED_REFS 1
  #undef CYTHON_ASSUME_SAFE_MACROS
  #define CYTHON_ASSUME_SAFE_MACROS 0
  #undef CYTHON_UNPACK_METHODS
  #define CYTHON_UNPACK_METHODS 0
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #undef CYTHON_PEP489_MULTI_PHASE_INIT
  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  #undef CYTHON_USE_TP_FINALIZE
  #define CYTHON_USE_TP_FINALIZE 0
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 0
  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
    #define CYTHON_UPDATE_DESCRIPTOR_DOC (PYPY_VERSION_HEX >= 0x07030900)
  #endif
#elif defined(PYSTON_VERSION)
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_PYSTON 1
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #define CYTHON_COMPILING_IN_NOGIL 0
  #ifndef CYTHON_USE_TYPE_SLOTS
    #define CYTHON_USE_TYPE_SLOTS 1
  #endif
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #undef CYTHON_USE_ASYNC_SLOTS
  #define CYTHON_USE_ASYNC_SLOTS 0
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #ifndef CYTHON_USE_UNICODE_INTERNALS
    #define CYTHON_USE_UNICODE_INTERNALS 1
  #endif
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_ASSUME_SAFE_MACROS
    #define CYTHON_ASSUME_SAFE_MACROS 1
  #endif
  #ifndef CYTHON_UNPACK_METHODS
    #define CYTHON_UNPACK_METHODS 1
  #endif
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #undef CYTHON_PEP489_MULTI_PHASE_INIT
  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  #undef CYTHON_USE_TP_FINALIZE
  #define CYTHON_USE_TP_FINALIZE 0
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 0
  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
    #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
  #endif
#elif defined(PY_NOGIL)
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_PYSTON 0
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #define CYTHON_COMPILING_IN_NOGIL 1
  #ifndef CYTHON_USE_TYPE_SLOTS
    #define CYTHON_USE_TYPE_SLOTS 1
  #endif
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #ifndef CYTHON_USE_ASYNC_SLOTS
    #define CYTHON_USE_ASYNC_SLOTS 1
  #endif
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #ifndef CYTHON_USE_UNICODE_INTERNALS
    #define CYTHON_USE_UNICODE_INTERNALS 1
  #endif
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_ASSUME_SAFE_MACROS
    #define CYTHON_ASSUME_SAFE_MACROS 1
  #endif
  #ifndef CYTHON_UNPACK_METHODS
    #define CYTHON_UNPACK_METHODS 1
  #endif
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
    #define CYTHON_PEP489_MULTI_PHASE_INIT 1
  #endif
  #ifndef CYTHON_USE_TP_FINALIZE
    #define CYTHON_USE_TP_FINALIZE 1
  #endif
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 0
#else
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_PYSTON 0
  #define CYTHON_COMPILING_IN_CPYTHON 1
  #define CYTHON_COMPILING_IN_NOGIL 0
  #ifndef CYTHON_USE_TYPE_SLOTS
    #define CYTHON_USE_TYPE_SLOTS 1
  #endif
  #if PY_VERSION_HEX < 0x02070000
    #undef CYTHON_USE_PYTYPE_LOOKUP
    #define CYTHON_USE_PYTYPE_LOOKUP 0
  #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
    #define CYTHON_USE_PYTYPE_LOOKUP 1
  #endif
  #if PY_MAJOR_VERSION < 3
    #undef CYTHON_USE_ASYNC_SLOTS
    #define CYTHON_USE_ASYNC_SLOTS 0
  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
    #define CYTHON_USE_ASYNC_SLOTS 1
  #endif
  #if PY_VERSION_HEX < 0x02070000
    #undef CYTHON_USE_PYLONG_INTERNALS
    #define CYTHON_USE_PYLONG_INTERNALS 0
  #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
    #define CYTHON_USE_PYLONG_INTERNALS 1
  #endif
  #ifndef CYTHON_USE_PYLIST_INTERNALS
    #define CYTHON_USE_PYLIST_INTERNALS 1
  #endif
  #ifndef CYTHON_USE_UNICODE_INTERNALS
    #define CYTHON_USE_UNICODE_INTERNALS 1
  #endif
  #if PY_VERSION_HEX < 0x030300F0 || PY_VERSION_HEX >= 0x030B00A2
    #undef CYTHON_USE_UNICODE_WRITER
    #define CYTHON_USE_UNICODE_WRITER 0
  #elif !defined(CYTHON_USE_UNICODE_WRITER)
    #define CYTHON_USE_UNICODE_WRITER 1
  #endif
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_ASSUME_SAFE_MACROS
    #define CYTHON_ASSUME_SAFE_MACROS 1
  #endif
  #ifndef CYTHON_UNPACK_METHODS
    #define CYTHON_UNPACK_METHODS 1
  #endif
  #if PY_VERSION_HEX >= 0x030B00A4
    #undef CYTHON_FAST_THREAD_STATE
    #define CYTHON_FAST_THREAD_STATE 0
  #elif !defined(CYTHON_FAST_THREAD_STATE)
    #define CYTHON_FAST_THREAD_STATE 1
  #endif
  #ifndef CYTHON_FAST_PYCALL
    #define CYTHON_FAST_PYCALL (PY_VERSION_HEX < 0x030A0000)
  #endif
  #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
    #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
  #endif
  #ifndef CYTHON_USE_TP_FINALIZE
    #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
  #endif
  #ifndef CYTHON_USE_DICT_VERSIONS
    #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
  #endif
  #if PY_VERSION_HEX >= 0x030B00A4
    #undef CYTHON_USE_EXC_INFO_STACK
    #define CYTHON_USE_EXC_INFO_STACK 0
  #elif !defined(CYTHON_USE_EXC_INFO_STACK)
    #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
  #endif
  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
    #define CYTHON_UPDATE_DESCRIPTOR_DOC 1
  #endif
#endif
#if !defined(CYTHON_FAST_PYCCALL)
#define CYTHON_FAST_PYCCALL  (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
#endif
#if CYTHON_USE_PYLONG_INTERNALS
  #if PY_MAJOR_VERSION < 3
    #include "longintrepr.h"
  #endif
  #undef SHIFT
  #undef BASE
  #undef MASK
  #ifdef SIZEOF_VOID_P
    enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
  #endif
#endif
#ifndef __has_attribute
  #define __has_attribute(x) 0
#endif
#ifndef __has_cpp_attribute
  #define __has_cpp_attribute(x) 0
#endif
#ifndef CYTHON_RESTRICT
  #if defined(__GNUC__)
    #define CYTHON_RESTRICT __restrict__
  #elif defined(_MSC_VER) && _MSC_VER >= 1400
    #define CYTHON_RESTRICT __restrict
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_RESTRICT restrict
  #else
    #define CYTHON_RESTRICT
  #endif
#endif
#ifndef CYTHON_UNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#     define CYTHON_UNUSED __attribute__ ((__unused__))
#   else
#     define CYTHON_UNUSED
#   endif
# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
#   define CYTHON_UNUSED __attribute__ ((__unused__))
# else
#   define CYTHON_UNUSED
# endif
#endif
#ifndef CYTHON_MAYBE_UNUSED_VAR
#  if defined(__cplusplus)
     template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
#  else
#    define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
#  endif
#endif
#ifndef CYTHON_NCP_UNUSED
# if CYTHON_COMPILING_IN_CPYTHON
#  define CYTHON_NCP_UNUSED
# else
#  define CYTHON_NCP_UNUSED CYTHON_UNUSED
# endif
#endif
#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
#ifdef _MSC_VER
    #ifndef _MSC_STDINT_H_
        #if _MSC_VER < 1300
           typedef unsigned char     uint8_t;
           typedef unsigned int      uint32_t;
        #else
           typedef unsigned __int8   uint8_t;
           typedef unsigned __int32  uint32_t;
        #endif
    #endif
#else
   #include <stdint.h>
#endif
#ifndef CYTHON_FALLTHROUGH
  #if defined(__cplusplus) && __cplusplus >= 201103L
    #if __has_cpp_attribute(fallthrough)
      #define CYTHON_FALLTHROUGH [[fallthrough]]
    #elif __has_cpp_attribute(clang::fallthrough)
      #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
    #elif __has_cpp_attribute(gnu::fallthrough)
      #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
    #endif
  #endif
  #ifndef CYTHON_FALLTHROUGH
    #if __has_attribute(fallthrough)
      #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
    #else
      #define CYTHON_FALLTHROUGH
    #endif
  #endif
  #if defined(__clang__ ) && defined(__apple_build_version__)
    #if __apple_build_version__ < 7000000
      #undef  CYTHON_FALLTHROUGH
      #define CYTHON_FALLTHROUGH
    #endif
  #endif
#endif

#ifndef CYTHON_INLINE
  #if defined(__clang__)
    #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
  #elif defined(__GNUC__)
    #define CYTHON_INLINE __inline__
  #elif defined(_MSC_VER)
    #define CYTHON_INLINE __inline
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_INLINE inline
  #else
    #define CYTHON_INLINE
  #endif
#endif

#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
  #define Py_OptimizeFlag 0
#endif
#define __PYX_BUILD_PY_SSIZE_T "n"
#define CYTHON_FORMAT_SSIZE_T "z"
#if PY_MAJOR_VERSION < 3
  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  #define __Pyx_DefaultClassType PyClass_Type
#else
  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
  #define __Pyx_DefaultClassType PyType_Type
#if PY_VERSION_HEX >= 0x030B00A1
    static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int k, int l, int s, int f,
                                                    PyObject *code, PyObject *c, PyObject* n, PyObject *v,
                                                    PyObject *fv, PyObject *cell, PyObject* fn,
                                                    PyObject *name, int fline, PyObject *lnos) {
        PyObject *kwds=NULL, *argcount=NULL, *posonlyargcount=NULL, *kwonlyargcount=NULL;
        PyObject *nlocals=NULL, *stacksize=NULL, *flags=NULL, *replace=NULL, *call_result=NULL, *empty=NULL;
        const char *fn_cstr=NULL;
        const char *name_cstr=NULL;
        PyCodeObject* co=NULL;
        PyObject *type, *value, *traceback;
        PyErr_Fetch(&type, &value, &traceback);
        if (!(kwds=PyDict_New())) goto end;
        if (!(argcount=PyLong_FromLong(a))) goto end;
        if (PyDict_SetItemString(kwds, "co_argcount", argcount) != 0) goto end;
        if (!(posonlyargcount=PyLong_FromLong(0))) goto end;
        if (PyDict_SetItemString(kwds, "co_posonlyargcount", posonlyargcount) != 0) goto end;
        if (!(kwonlyargcount=PyLong_FromLong(k))) goto end;
        if (PyDict_SetItemString(kwds, "co_kwonlyargcount", kwonlyargcount) != 0) goto end;
        if (!(nlocals=PyLong_FromLong(l))) goto end;
        if (PyDict_SetItemString(kwds, "co_nlocals", nlocals) != 0) goto end;
        if (!(stacksize=PyLong_FromLong(s))) goto end;
        if (PyDict_SetItemString(kwds, "co_stacksize", stacksize) != 0) goto end;
        if (!(flags=PyLong_FromLong(f))) goto end;
        if (PyDict_SetItemString(kwds, "co_flags", flags) != 0) goto end;
        if (PyDict_SetItemString(kwds, "co_code", code) != 0) goto end;
        if (PyDict_SetItemString(kwds, "co_consts", c) != 0) goto end;
        if (PyDict_SetItemString(kwds, "co_names", n) != 0) goto end;
        if (PyDict_SetItemString(kwds, "co_varnames", v) != 0) goto end;
        if (PyDict_SetItemString(kwds, "co_freevars", fv) != 0) goto end;
        if (PyDict_SetItemString(kwds, "co_cellvars", cell) != 0) goto end;
        if (PyDict_SetItemString(kwds, "co_linetable", lnos) != 0) goto end;
        if (!(fn_cstr=PyUnicode_AsUTF8AndSize(fn, NULL))) goto end;
        if (!(name_cstr=PyUnicode_AsUTF8AndSize(name, NULL))) goto end;
        if (!(co = PyCode_NewEmpty(fn_cstr, name_cstr, fline))) goto end;
        if (!(replace = PyObject_GetAttrString((PyObject*)co, "replace"))) goto cleanup_code_too;
        if (!(empty = PyTuple_New(0))) goto cleanup_code_too; // unfortunately __pyx_empty_tuple isn't available here
        if (!(call_result = PyObject_Call(replace, empty, kwds))) goto cleanup_code_too;
        Py_XDECREF((PyObject*)co);
        co = (PyCodeObject*)call_result;
        call_result = NULL;
        if (0) {
            cleanup_code_too:
            Py_XDECREF((PyObject*)co);
            co = NULL;
        }
        end:
        Py_XDECREF(kwds);
        Py_XDECREF(argcount);
        Py_XDECREF(posonlyargcount);
        Py_XDECREF(kwonlyargcount);
        Py_XDECREF(nlocals);
        Py_XDECREF(stacksize);
        Py_XDECREF(replace);
        Py_XDECREF(call_result);
        Py_XDECREF(empty);
        if (type) {
            PyErr_Restore(type, value, traceback);
        }
        return co;
    }
#else
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#endif
  #define __Pyx_DefaultClassType PyType_Type
#endif
#ifndef Py_TPFLAGS_CHECKTYPES
  #define Py_TPFLAGS_CHECKTYPES 0
#endif
#ifndef Py_TPFLAGS_HAVE_INDEX
  #define Py_TPFLAGS_HAVE_INDEX 0
#endif
#ifndef Py_TPFLAGS_HAVE_NEWBUFFER
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
#ifndef Py_TPFLAGS_HAVE_FINALIZE
  #define Py_TPFLAGS_HAVE_FINALIZE 0
#endif
#ifndef METH_STACKLESS
  #define METH_STACKLESS 0
#endif
#if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
  #ifndef METH_FASTCALL
     #define METH_FASTCALL 0x80
  #endif
  typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
  typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
                                                          Py_ssize_t nargs, PyObject *kwnames);
#else
  #define __Pyx_PyCFunctionFast _PyCFunctionFast
  #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
#endif
#if CYTHON_FAST_PYCCALL
#define __Pyx_PyFastCFunction_Check(func)\
    ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
#else
#define __Pyx_PyFastCFunction_Check(func) 0
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
  #define PyObject_Malloc(s)   PyMem_Malloc(s)
  #define PyObject_Free(p)     PyMem_Free(p)
  #define PyObject_Realloc(p)  PyMem_Realloc(p)
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
  #define PyMem_RawMalloc(n)           PyMem_Malloc(n)
  #define PyMem_RawRealloc(p, n)       PyMem_Realloc(p, n)
  #define PyMem_RawFree(p)             PyMem_Free(p)
#endif
#if CYTHON_COMPILING_IN_PYSTON
  #define __Pyx_PyCode_HasFreeVars(co)  PyCode_HasFreeVars(co)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
#else
  #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
#endif
#if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
  #define __Pyx_PyThreadState_Current PyThreadState_GET()
#elif PY_VERSION_HEX >= 0x03060000
  #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
#elif PY_VERSION_HEX >= 0x03000000
  #define __Pyx_PyThreadState_Current PyThreadState_GET()
#else
  #define __Pyx_PyThreadState_Current _PyThreadState_Current
#endif
#if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
#include "pythread.h"
#define Py_tss_NEEDS_INIT 0
typedef int Py_tss_t;
static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
  *key = PyThread_create_key();
  return 0;
}
static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
  Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
  *key = Py_tss_NEEDS_INIT;
  return key;
}
static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
  PyObject_Free(key);
}
static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
  return *key != Py_tss_NEEDS_INIT;
}
static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
  PyThread_delete_key(*key);
  *key = Py_tss_NEEDS_INIT;
}
static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
  return PyThread_set_key_value(*key, value);
}
static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
  return PyThread_get_key_value(*key);
}
#endif
#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
#define __Pyx_PyDict_NewPresized(n)  ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
#else
#define __Pyx_PyDict_NewPresized(n)  PyDict_New()
#endif
#if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
#else
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
#define __Pyx_PyDict_GetItemStr(dict, name)  _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
#else
#define __Pyx_PyDict_GetItemStr(dict, name)  PyDict_GetItem(dict, name)
#endif
#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
  #define CYTHON_PEP393_ENABLED 1
  #if defined(PyUnicode_IS_READY)
  #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
                                              0 : _PyUnicode_Ready((PyObject *)(op)))
  #else
  #define __Pyx_PyUnicode_READY(op)       (0)
  #endif
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   PyUnicode_MAX_CHAR_VALUE(u)
  #define __Pyx_PyUnicode_KIND(u)         PyUnicode_KIND(u)
  #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
  #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
  #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  PyUnicode_WRITE(k, d, i, ch)
  #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE)
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length))
  #else
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
  #endif
  #else
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_LENGTH(u))
  #endif
#else
  #define CYTHON_PEP393_ENABLED 0
  #define PyUnicode_1BYTE_KIND  1
  #define PyUnicode_2BYTE_KIND  2
  #define PyUnicode_4BYTE_KIND  4
  #define __Pyx_PyUnicode_READY(op)       (0)
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
  #define __Pyx_PyUnicode_KIND(u)         (sizeof(Py_UNICODE))
  #define __Pyx_PyUnicode_DATA(u)         ((void*)PyUnicode_AS_UNICODE(u))
  #define __Pyx_PyUnicode_READ(k, d, i)   ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
  #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_SIZE(u))
#endif
#if CYTHON_COMPILING_IN_PYPY
  #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
#else
  #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
      PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
  #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
  #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
  #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
#endif
#define __Pyx_PyString_FormatSafe(a, b)   ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
#define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyString_Format(a, b)  PyUnicode_Format(a, b)
#else
  #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
#endif
#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
  #define PyObject_ASCII(o)            PyObject_Repr(o)
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBaseString_Type            PyUnicode_Type
  #define PyStringObject               PyUnicodeObject
  #define PyString_Type                PyUnicode_Type
  #define PyString_Check               PyUnicode_Check
  #define PyString_CheckExact          PyUnicode_CheckExact
#ifndef PyObject_Unicode
  #define PyObject_Unicode             PyObject_Str
#endif
#endif
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
#else
  #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
  #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
#endif
#ifndef PySet_CheckExact
  #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
#endif
#if PY_VERSION_HEX >= 0x030900A4
  #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
  #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
#else
  #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
  #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
#endif
#if CYTHON_ASSUME_SAFE_MACROS
  #define __Pyx_PySequence_SIZE(seq)  Py_SIZE(seq)
#else
  #define __Pyx_PySequence_SIZE(seq)  PySequence_Size(seq)
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyIntObject                  PyLongObject
  #define PyInt_Type                   PyLong_Type
  #define PyInt_Check(op)              PyLong_Check(op)
  #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
  #define PyInt_FromString             PyLong_FromString
  #define PyInt_FromUnicode            PyLong_FromUnicode
  #define PyInt_FromLong               PyLong_FromLong
  #define PyInt_FromSize_t             PyLong_FromSize_t
  #define PyInt_FromSsize_t            PyLong_FromSsize_t
  #define PyInt_AsLong                 PyLong_AsLong
  #define PyInt_AS_LONG                PyLong_AS_LONG
  #define PyInt_AsSsize_t              PyLong_AsSsize_t
  #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
  #define PyNumber_Int                 PyNumber_Long
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBoolObject                 PyLongObject
#endif
#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
  #ifndef PyUnicode_InternFromString
    #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
  #endif
#endif
#if PY_VERSION_HEX < 0x030200A4
  typedef long Py_hash_t;
  #define __Pyx_PyInt_FromHash_t PyInt_FromLong
  #define __Pyx_PyInt_AsHash_t   __Pyx_PyIndex_AsHash_t
#else
  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
  #define __Pyx_PyInt_AsHash_t   __Pyx_PyIndex_AsSsize_t
#endif
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func))
#else
  #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
#endif
#if CYTHON_USE_ASYNC_SLOTS
  #if PY_VERSION_HEX >= 0x030500B1
    #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
    #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
  #else
    #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
  #endif
#else
  #define __Pyx_PyType_AsAsync(obj) NULL
#endif
#ifndef __Pyx_PyAsyncMethodsStruct
    typedef struct {
        unaryfunc am_await;
        unaryfunc am_aiter;
        unaryfunc am_anext;
    } __Pyx_PyAsyncMethodsStruct;
#endif

#if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)
  #if !defined(_USE_MATH_DEFINES)
    #define _USE_MATH_DEFINES
  #endif
#endif
#include <math.h>
#ifdef NAN
#define __PYX_NAN() ((float) NAN)
#else
static CYTHON_INLINE float __PYX_NAN() {
  float value;
  memset(&value, 0xFF, sizeof(value));
  return value;
}
#endif
#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
#define __Pyx_truncl trunc
#else
#define __Pyx_truncl truncl
#endif

#define __PYX_MARK_ERR_POS(f_index, lineno) \
    { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
#define __PYX_ERR(f_index, lineno, Ln_error) \
    { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }

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

#define __PYX_HAVE__aldy__indelpost__pileup
#define __PYX_HAVE_API__aldy__indelpost__pileup
/* Early includes */
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include "pythread.h"
#include <sys/types.h>
#include "stdarg.h"
#include "htslib/kstring.h"
#include "htslib_util.h"
#include "htslib/hfile.h"
#include "htslib/bgzf.h"
#include "htslib/hts.h"
#include "htslib/sam.h"
#include "htslib/faidx.h"
#include "htslib/tbx.h"
#include "htslib/vcf.h"
#include "htslib/vcfutils.h"
#include "htslib/cram.h"
#include "pysam_stream.h"
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
#define CYTHON_WITHOUT_ASSERTIONS
#endif

typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
                const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;

#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
#define __PYX_DEFAULT_STRING_ENCODING ""
#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#define __Pyx_uchar_cast(c) ((unsigned char)c)
#define __Pyx_long_cast(x) ((long)x)
#define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (\
    (sizeof(type) < sizeof(Py_ssize_t))  ||\
    (sizeof(type) > sizeof(Py_ssize_t) &&\
          likely(v < (type)PY_SSIZE_T_MAX ||\
                 v == (type)PY_SSIZE_T_MAX)  &&\
          (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
                                v == (type)PY_SSIZE_T_MIN)))  ||\
    (sizeof(type) == sizeof(Py_ssize_t) &&\
          (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
                               v == (type)PY_SSIZE_T_MAX)))  )
static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
    return (size_t) i < (size_t) limit;
}
#if defined (__cplusplus) && __cplusplus >= 201103L
    #include <cstdlib>
    #define __Pyx_sst_abs(value) std::abs(value)
#elif SIZEOF_INT >= SIZEOF_SIZE_T
    #define __Pyx_sst_abs(value) abs(value)
#elif SIZEOF_LONG >= SIZEOF_SIZE_T
    #define __Pyx_sst_abs(value) labs(value)
#elif defined (_MSC_VER)
    #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define __Pyx_sst_abs(value) llabs(value)
#elif defined (__GNUC__)
    #define __Pyx_sst_abs(value) __builtin_llabs(value)
#else
    #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
#endif
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
#define __Pyx_PyBytes_FromString        PyBytes_FromString
#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
#if PY_MAJOR_VERSION < 3
    #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#else
    #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
#endif
#define __Pyx_PyBytes_AsWritableString(s)     ((char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AS_STRING(s))
#define __Pyx_PyObject_AsWritableString(s)    ((char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsSString(s)    ((const signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsUString(s)    ((const unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
#define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
#define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
#define __Pyx_PyStr_FromCString(s)     __Pyx_PyStr_FromString((const char*)s)
#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
    const Py_UNICODE *u_end = u;
    while (*u_end++) ;
    return (size_t)(u_end - u - 1);
}
#define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
#define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
#define __Pyx_PySequence_Tuple(obj)\
    (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*);
#if CYTHON_ASSUME_SAFE_MACROS
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
#else
#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
#endif
#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
#else
#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
#endif
#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
static int __Pyx_sys_getdefaultencoding_not_ascii;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
    PyObject* sys;
    PyObject* default_encoding = NULL;
    PyObject* ascii_chars_u = NULL;
    PyObject* ascii_chars_b = NULL;
    const char* default_encoding_c;
    sys = PyImport_ImportModule("sys");
    if (!sys) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
    Py_DECREF(sys);
    if (!default_encoding) goto bad;
    default_encoding_c = PyBytes_AsString(default_encoding);
    if (!default_encoding_c) goto bad;
    if (strcmp(default_encoding_c, "ascii") == 0) {
        __Pyx_sys_getdefaultencoding_not_ascii = 0;
    } else {
        char ascii_chars[128];
        int c;
        for (c = 0; c < 128; c++) {
            ascii_chars[c] = c;
        }
        __Pyx_sys_getdefaultencoding_not_ascii = 1;
        ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
        if (!ascii_chars_u) goto bad;
        ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
        if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
            PyErr_Format(
                PyExc_ValueError,
                "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
                default_encoding_c);
            goto bad;
        }
        Py_DECREF(ascii_chars_u);
        Py_DECREF(ascii_chars_b);
    }
    Py_DECREF(default_encoding);
    return 0;
bad:
    Py_XDECREF(default_encoding);
    Py_XDECREF(ascii_chars_u);
    Py_XDECREF(ascii_chars_b);
    return -1;
}
#endif
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
#else
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
static char* __PYX_DEFAULT_STRING_ENCODING;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
    PyObject* sys;
    PyObject* default_encoding = NULL;
    char* default_encoding_c;
    sys = PyImport_ImportModule("sys");
    if (!sys) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
    Py_DECREF(sys);
    if (!default_encoding) goto bad;
    default_encoding_c = PyBytes_AsString(default_encoding);
    if (!default_encoding_c) goto bad;
    __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
    if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
    strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
    Py_DECREF(default_encoding);
    return 0;
bad:
    Py_XDECREF(default_encoding);
    return -1;
}
#endif
#endif


/* Test for GCC > 2.95 */
#if defined(__GNUC__)     && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
  #define likely(x)   __builtin_expect(!!(x), 1)
  #define unlikely(x) __builtin_expect(!!(x), 0)
#else /* !__GNUC__ or GCC < 2.95 */
  #define likely(x)   (x)
  #define unlikely(x) (x)
#endif /* __GNUC__ */
static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }

static PyObject *__pyx_m = NULL;
static PyObject *__pyx_d;
static PyObject *__pyx_b;
static PyObject *__pyx_cython_runtime = NULL;
static PyObject *__pyx_empty_tuple;
static PyObject *__pyx_empty_bytes;
static PyObject *__pyx_empty_unicode;
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[] = {
  "aldy/indelpost/pileup.pyx",
  "array.pxd",
  "type.pxd",
  "bool.pxd",
  "complex.pxd",
  "libchtslib.pxd",
  "libcfaidx.pxd",
  "libcbcf.pxd",
  "aldy/indelpost/variant.pxd",
  "aldy/indelpost/local_reference.pxd",
  "libcalignedsegment.pxd",
  "libcalignmentfile.pxd",
};

/*--- Type declarations ---*/
#ifndef _ARRAYARRAY_H
struct arrayobject;
typedef struct arrayobject arrayobject;
#endif
struct __pyx_obj_5pysam_10libchtslib_HTSFile;
struct __pyx_obj_5pysam_9libcfaidx_FastaFile;
struct __pyx_obj_5pysam_9libcfaidx_FastqProxy;
struct __pyx_obj_5pysam_9libcfaidx_FastxRecord;
struct __pyx_obj_5pysam_9libcfaidx_FastxFile;
struct __pyx_obj_5pysam_9libcfaidx_FastqFile;
struct __pyx_obj_5pysam_9libcfaidx_Fastafile;
struct __pyx_obj_5pysam_7libcbcf_VariantHeader;
struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord;
struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecords;
struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs;
struct __pyx_obj_5pysam_7libcbcf_VariantHeaderSamples;
struct __pyx_obj_5pysam_7libcbcf_VariantContig;
struct __pyx_obj_5pysam_7libcbcf_VariantMetadata;
struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata;
struct __pyx_obj_5pysam_7libcbcf_VariantRecord;
struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter;
struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat;
struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo;
struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples;
struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample;
struct __pyx_obj_5pysam_7libcbcf_BaseIndex;
struct __pyx_obj_5pysam_7libcbcf_BCFIndex;
struct __pyx_obj_5pysam_7libcbcf_TabixIndex;
struct __pyx_obj_5pysam_7libcbcf_BaseIterator;
struct __pyx_obj_5pysam_7libcbcf_BCFIterator;
struct __pyx_obj_5pysam_7libcbcf_TabixIterator;
struct __pyx_obj_5pysam_7libcbcf_VariantFile;
struct __pyx_obj_4aldy_9indelpost_7variant_NullVariant;
struct __pyx_obj_4aldy_9indelpost_7variant_Variant;
struct __pyx_obj_4aldy_9indelpost_15local_reference_UnsplicedLocalReference;
struct __pyx_obj_5pysam_18libcalignedsegment_AlignedSegment;
struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn;
struct __pyx_obj_5pysam_18libcalignedsegment_PileupRead;
struct __pyx_obj_5pysam_17libcalignmentfile_AlignmentHeader;
struct __pyx_obj_5pysam_17libcalignmentfile_AlignmentFile;
struct __pyx_obj_5pysam_17libcalignmentfile_IteratorRow;
struct __pyx_obj_5pysam_17libcalignmentfile_IteratorRowRegion;
struct __pyx_obj_5pysam_17libcalignmentfile_IteratorRowHead;
struct __pyx_obj_5pysam_17libcalignmentfile_IteratorRowAll;
struct __pyx_obj_5pysam_17libcalignmentfile_IteratorRowAllRefs;
struct __pyx_obj_5pysam_17libcalignmentfile_IteratorRowSelection;
struct __pyx_obj_5pysam_17libcalignmentfile_IteratorColumn;
struct __pyx_obj_5pysam_17libcalignmentfile_IteratorColumnRegion;
struct __pyx_obj_5pysam_17libcalignmentfile_IteratorColumnAllRefs;
struct __pyx_obj_5pysam_17libcalignmentfile_IteratorColumnAll;
struct __pyx_obj_5pysam_17libcalignmentfile_IndexedReads;
struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct____pyx_f_4aldy_9indelpost_6pileup_make_pileup;
struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_1_genexpr;
struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_2___pyx_f_4aldy_9indelpost_6pileup_dictize_read;
struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_3_genexpr;
struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_4_genexpr;
struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_5_retarget;
struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_6_update_pileup;
struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_7_genexpr;
struct __pyx_opt_args_5pysam_9libcfaidx_10FastqProxy_get_quality_array;
struct __pyx_opt_args_5pysam_9libcfaidx_11FastxRecord_get_quality_array;

/* "pysam/libcfaidx.pxd":49
 *     cdef cython.str to_string(self)
 *     cdef cython.str tostring(self)
 *     cpdef array.array get_quality_array(self, int offset=*)             # <<<<<<<<<<<<<<
 * 
 * 
 */
struct __pyx_opt_args_5pysam_9libcfaidx_10FastqProxy_get_quality_array {
  int __pyx_n;
  int offset;
};

/* "pysam/libcfaidx.pxd":59
 *     cdef cython.str to_string(self)
 *     cdef cython.str tostring(self)
 *     cpdef array.array get_quality_array(self, int offset=*)             # <<<<<<<<<<<<<<
 * 
 * cdef class FastxFile:
 */
struct __pyx_opt_args_5pysam_9libcfaidx_11FastxRecord_get_quality_array {
  int __pyx_n;
  int offset;
};
struct __pyx_opt_args_5pysam_18libcalignedsegment_14AlignedSegment_set_tag;
struct __pyx_opt_args_5pysam_18libcalignedsegment_14AlignedSegment_get_tag;
struct __pyx_opt_args_5pysam_18libcalignedsegment_14AlignedSegment_tostring;

/* "pysam/libcalignedsegment.pxd":30
 * 
 * from pysam.libcalignmentfile cimport AlignmentFile, AlignmentHeader
 * ctypedef AlignmentFile AlignmentFile_t             # <<<<<<<<<<<<<<
 * 
 * 
 */
typedef struct __pyx_obj_5pysam_17libcalignmentfile_AlignmentFile *__pyx_t_5pysam_18libcalignedsegment_AlignmentFile_t;

/* "pysam/libcalignedsegment.pxd":50
 *     # add an alignment tag with value to the AlignedSegment
 *     # an existing tag of the same name will be replaced.
 *     cpdef set_tag(self, tag, value, value_type=?, replace=?)             # <<<<<<<<<<<<<<
 * 
 *     # get an alignment tag from the AlignedSegment
 */
struct __pyx_opt_args_5pysam_18libcalignedsegment_14AlignedSegment_set_tag {
  int __pyx_n;
  PyObject *value_type;
  PyObject *replace;
};

/* "pysam/libcalignedsegment.pxd":53
 * 
 *     # get an alignment tag from the AlignedSegment
 *     cpdef get_tag(self, tag, with_value_type=?)             # <<<<<<<<<<<<<<
 * 
 *     # return true if tag exists
 */
struct __pyx_opt_args_5pysam_18libcalignedsegment_14AlignedSegment_get_tag {
  int __pyx_n;
  PyObject *with_value_type;
};

/* "pysam/libcalignedsegment.pxd":62
 * 
 *     # returns a valid sam alignment string (deprecated)
 *     cpdef tostring(self, htsfile=*)             # <<<<<<<<<<<<<<
 * 
 * 
 */
struct __pyx_opt_args_5pysam_18libcalignedsegment_14AlignedSegment_tostring {
  int __pyx_n;
  PyObject *htsfile;
};
struct __pyx_t_5pysam_17libcalignmentfile___iterdata;
typedef struct __pyx_t_5pysam_17libcalignmentfile___iterdata __pyx_t_5pysam_17libcalignmentfile___iterdata;
struct __pyx_opt_args_5pysam_17libcalignmentfile_14IteratorColumn__setup_iterator;

/* "pysam/libcalignmentfile.pxd":24
 * # Utility types
 * 
 * ctypedef struct __iterdata:             # <<<<<<<<<<<<<<
 *     htsFile * htsfile
 *     bam_hdr_t * header
 */
struct __pyx_t_5pysam_17libcalignmentfile___iterdata {
  htsFile *htsfile;
  bam_hdr_t *header;
  hts_itr_t *iter;
  faidx_t *fastafile;
  int tid;
  char *seq;
  int seq_len;
  int min_mapping_quality;
  int flag_require;
  int flag_filter;
  int compute_baq;
  int redo_baq;
  int ignore_orphans;
  int adjust_capq_threshold;
};

/* "pysam/libcalignmentfile.pxd":120
 *     cdef int cnext(self)
 *     cdef char * get_sequence(self)
 *     cdef _setup_iterator(self,             # <<<<<<<<<<<<<<
 *                          int tid,
 *                          int start,
 */
struct __pyx_opt_args_5pysam_17libcalignmentfile_14IteratorColumn__setup_iterator {
  int __pyx_n;
  int multiple_iterators;
};

/* "pysam/libchtslib.pxd":2680
 * 
 * 
 * cdef class HTSFile(object):             # <<<<<<<<<<<<<<
 *     cdef          htsFile *htsfile       # pointer to htsFile structure
 *     cdef          int64_t start_offset   # BGZF offset of first record
 */
struct __pyx_obj_5pysam_10libchtslib_HTSFile {
  PyObject_HEAD
  struct __pyx_vtabstruct_5pysam_10libchtslib_HTSFile *__pyx_vtab;
  htsFile *htsfile;
  int64_t start_offset;
  PyObject *filename;
  PyObject *mode;
  PyObject *threads;
  PyObject *index_filename;
  int is_stream;
  int is_remote;
  int duplicate_filehandle;
};


/* "pysam/libcfaidx.pxd":37
 *                     int * dret)
 * 
 * cdef class FastaFile:             # <<<<<<<<<<<<<<
 *     cdef bint is_remote
 *     cdef object _filename, _references, _lengths, reference2length
 */
struct __pyx_obj_5pysam_9libcfaidx_FastaFile {
  PyObject_HEAD
  struct __pyx_vtabstruct_5pysam_9libcfaidx_FastaFile *__pyx_vtab;
  int is_remote;
  PyObject *_filename;
  PyObject *_references;
  PyObject *_lengths;
  PyObject *reference2length;
  faidx_t *fastafile;
};


/* "pysam/libcfaidx.pxd":45
 * 
 * 
 * cdef class FastqProxy:             # <<<<<<<<<<<<<<
 *     cdef kseq_t * _delegate
 *     cdef cython.str to_string(self)
 */
struct __pyx_obj_5pysam_9libcfaidx_FastqProxy {
  PyObject_HEAD
  struct __pyx_vtabstruct_5pysam_9libcfaidx_FastqProxy *__pyx_vtab;
  kseq_t *_delegate;
};


/* "pysam/libcfaidx.pxd":52
 * 
 * 
 * cdef class FastxRecord:             # <<<<<<<<<<<<<<
 *     """
 *     Python container for pysam.libcfaidx.FastqProxy with persistence.
 */
struct __pyx_obj_5pysam_9libcfaidx_FastxRecord {
  PyObject_HEAD
  struct __pyx_vtabstruct_5pysam_9libcfaidx_FastxRecord *__pyx_vtab;
  PyObject *comment;
  PyObject *quality;
  PyObject *sequence;
  PyObject *name;
};


/* "pysam/libcfaidx.pxd":61
 *     cpdef array.array get_quality_array(self, int offset=*)
 * 
 * cdef class FastxFile:             # <<<<<<<<<<<<<<
 *     cdef object _filename
 *     cdef BGZF * fastqfile
 */
struct __pyx_obj_5pysam_9libcfaidx_FastxFile {
  PyObject_HEAD
  struct __pyx_vtabstruct_5pysam_9libcfaidx_FastxFile *__pyx_vtab;
  PyObject *_filename;
  BGZF *fastqfile;
  kseq_t *entry;
  int persist;
  int is_remote;
};


/* "pysam/libcfaidx.pxd":73
 * 
 * # Compatibility Layer for pysam 0.8.1
 * cdef class FastqFile(FastxFile):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_5pysam_9libcfaidx_FastqFile {
  struct __pyx_obj_5pysam_9libcfaidx_FastxFile __pyx_base;
};


/* "pysam/libcfaidx.pxd":78
 * 
 * # Compatibility Layer for pysam < 0.8
 * cdef class Fastafile(FastaFile):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_5pysam_9libcfaidx_Fastafile {
  struct __pyx_obj_5pysam_9libcfaidx_FastaFile __pyx_base;
};


/* "pysam/libcbcf.pxd":38
 * 
 * 
 * cdef class VariantHeader(object):             # <<<<<<<<<<<<<<
 *     cdef bcf_hdr_t *ptr
 * 
 */
struct __pyx_obj_5pysam_7libcbcf_VariantHeader {
  PyObject_HEAD
  struct __pyx_vtabstruct_5pysam_7libcbcf_VariantHeader *__pyx_vtab;
  bcf_hdr_t *ptr;
};


/* "pysam/libcbcf.pxd":46
 * 
 * 
 * cdef class VariantHeaderRecord(object):             # <<<<<<<<<<<<<<
 *     cdef readonly VariantHeader header
 *     cdef bcf_hrec_t *ptr
 */
struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord {
  PyObject_HEAD
  struct __pyx_obj_5pysam_7libcbcf_VariantHeader *header;
  bcf_hrec_t *ptr;
};


/* "pysam/libcbcf.pxd":51
 * 
 * 
 * cdef class VariantHeaderRecords(object):             # <<<<<<<<<<<<<<
 *     cdef readonly VariantHeader header
 * 
 */
struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecords {
  PyObject_HEAD
  struct __pyx_obj_5pysam_7libcbcf_VariantHeader *header;
};


/* "pysam/libcbcf.pxd":55
 * 
 * 
 * cdef class VariantHeaderContigs(object):             # <<<<<<<<<<<<<<
 *     cdef readonly VariantHeader header
 * 
 */
struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs {
  PyObject_HEAD
  struct __pyx_obj_5pysam_7libcbcf_VariantHeader *header;
};


/* "pysam/libcbcf.pxd":59
 * 
 * 
 * cdef class VariantHeaderSamples(object):             # <<<<<<<<<<<<<<
 *     cdef readonly VariantHeader header
 * 
 */
struct __pyx_obj_5pysam_7libcbcf_VariantHeaderSamples {
  PyObject_HEAD
  struct __pyx_obj_5pysam_7libcbcf_VariantHeader *header;
};


/* "pysam/libcbcf.pxd":63
 * 
 * 
 * cdef class VariantContig(object):             # <<<<<<<<<<<<<<
 *     cdef readonly VariantHeader header
 *     cdef int id
 */
struct __pyx_obj_5pysam_7libcbcf_VariantContig {
  PyObject_HEAD
  struct __pyx_obj_5pysam_7libcbcf_VariantHeader *header;
  int id;
};


/* "pysam/libcbcf.pxd":68
 * 
 * 
 * cdef class VariantMetadata(object):             # <<<<<<<<<<<<<<
 *     cdef readonly VariantHeader header
 *     cdef int type
 */
struct __pyx_obj_5pysam_7libcbcf_VariantMetadata {
  PyObject_HEAD
  struct __pyx_obj_5pysam_7libcbcf_VariantHeader *header;
  int type;
  int id;
};


/* "pysam/libcbcf.pxd":74
 * 
 * 
 * cdef class VariantHeaderMetadata(object):             # <<<<<<<<<<<<<<
 *     cdef readonly VariantHeader header
 *     cdef int32_t type
 */
struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata {
  PyObject_HEAD
  struct __pyx_obj_5pysam_7libcbcf_VariantHeader *header;
  int32_t type;
};


/* "pysam/libcbcf.pxd":79
 * 
 * 
 * cdef class VariantRecord(object):             # <<<<<<<<<<<<<<
 *     cdef readonly VariantHeader header
 *     cdef bcf1_t *ptr
 */
struct __pyx_obj_5pysam_7libcbcf_VariantRecord {
  PyObject_HEAD
  struct __pyx_obj_5pysam_7libcbcf_VariantHeader *header;
  bcf1_t *ptr;
};


/* "pysam/libcbcf.pxd":84
 * 
 * 
 * cdef class VariantRecordFilter(object):             # <<<<<<<<<<<<<<
 *     cdef VariantRecord record
 * 
 */
struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter {
  PyObject_HEAD
  struct __pyx_obj_5pysam_7libcbcf_VariantRecord *record;
};


/* "pysam/libcbcf.pxd":88
 * 
 * 
 * cdef class VariantRecordFormat(object):             # <<<<<<<<<<<<<<
 *     cdef VariantRecord record
 * 
 */
struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat {
  PyObject_HEAD
  struct __pyx_obj_5pysam_7libcbcf_VariantRecord *record;
};


/* "pysam/libcbcf.pxd":92
 * 
 * 
 * cdef class VariantRecordInfo(object):             # <<<<<<<<<<<<<<
 *     cdef VariantRecord record
 * 
 */
struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo {
  PyObject_HEAD
  struct __pyx_obj_5pysam_7libcbcf_VariantRecord *record;
};


/* "pysam/libcbcf.pxd":96
 * 
 * 
 * cdef class VariantRecordSamples(object):             # <<<<<<<<<<<<<<
 *     cdef VariantRecord record
 * 
 */
struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples {
  PyObject_HEAD
  struct __pyx_obj_5pysam_7libcbcf_VariantRecord *record;
};


/* "pysam/libcbcf.pxd":100
 * 
 * 
 * cdef class VariantRecordSample(object):             # <<<<<<<<<<<<<<
 *     cdef VariantRecord record
 *     cdef readonly int32_t index
 */
struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample {
  PyObject_HEAD
  struct __pyx_obj_5pysam_7libcbcf_VariantRecord *record;
  int32_t index;
};


/* "pysam/libcbcf.pxd":105
 * 
 * 
 * cdef class BaseIndex(object):             # <<<<<<<<<<<<<<
 *     cdef tuple refs
 *     cdef dict refmap
 */
struct __pyx_obj_5pysam_7libcbcf_BaseIndex {
  PyObject_HEAD
  PyObject *refs;
  PyObject *refmap;
};


/* "pysam/libcbcf.pxd":110
 * 
 * 
 * cdef class BCFIndex(BaseIndex):             # <<<<<<<<<<<<<<
 *     cdef readonly VariantHeader header
 *     cdef hts_idx_t *ptr
 */
struct __pyx_obj_5pysam_7libcbcf_BCFIndex {
  struct __pyx_obj_5pysam_7libcbcf_BaseIndex __pyx_base;
  struct __pyx_obj_5pysam_7libcbcf_VariantHeader *header;
  hts_idx_t *ptr;
};


/* "pysam/libcbcf.pxd":115
 * 
 * 
 * cdef class TabixIndex(BaseIndex):             # <<<<<<<<<<<<<<
 *     cdef tbx_t *ptr
 * 
 */
struct __pyx_obj_5pysam_7libcbcf_TabixIndex {
  struct __pyx_obj_5pysam_7libcbcf_BaseIndex __pyx_base;
  tbx_t *ptr;
};


/* "pysam/libcbcf.pxd":119
 * 
 * 
 * cdef class BaseIterator(object):             # <<<<<<<<<<<<<<
 *     cdef VariantFile bcf
 *     cdef hts_itr_t  *iter
 */
struct __pyx_obj_5pysam_7libcbcf_BaseIterator {
  PyObject_HEAD
  struct __pyx_obj_5pysam_7libcbcf_VariantFile *bcf;
  hts_itr_t *iter;
};


/* "pysam/libcbcf.pxd":124
 * 
 * 
 * cdef class BCFIterator(BaseIterator):             # <<<<<<<<<<<<<<
 *     cdef BCFIndex index
 * 
 */
struct __pyx_obj_5pysam_7libcbcf_BCFIterator {
  struct __pyx_obj_5pysam_7libcbcf_BaseIterator __pyx_base;
  struct __pyx_obj_5pysam_7libcbcf_BCFIndex *index;
};


/* "pysam/libcbcf.pxd":128
 * 
 * 
 * cdef class TabixIterator(BaseIterator):             # <<<<<<<<<<<<<<
 *     cdef TabixIndex index
 *     cdef kstring_t line_buffer
 */
struct __pyx_obj_5pysam_7libcbcf_TabixIterator {
  struct __pyx_obj_5pysam_7libcbcf_BaseIterator __pyx_base;
  struct __pyx_obj_5pysam_7libcbcf_TabixIndex *index;
  kstring_t line_buffer;
};


/* "pysam/libcbcf.pxd":133
 * 
 * 
 * cdef class VariantFile(HTSFile):             # <<<<<<<<<<<<<<
 *     cdef readonly VariantHeader  header
 *     cdef readonly BaseIndex      index
 */
struct __pyx_obj_5pysam_7libcbcf_VariantFile {
  struct __pyx_obj_5pysam_10libchtslib_HTSFile __pyx_base;
  struct __pyx_obj_5pysam_7libcbcf_VariantHeader *header;
  struct __pyx_obj_5pysam_7libcbcf_BaseIndex *index;
  int drop_samples;
  int is_reading;
  int header_written;
};


/* "variant.pxd":6
 * from pysam.libcbcf cimport VariantRecord, VariantFile
 * 
 * cdef class NullVariant:             # <<<<<<<<<<<<<<
 *     cdef readonly str chrom
 *     cdef readonly str ref, alt
 */
struct __pyx_obj_4aldy_9indelpost_7variant_NullVariant {
  PyObject_HEAD
  PyObject *chrom;
  PyObject *ref;
  PyObject *alt;
  int pos;
  struct __pyx_obj_5pysam_9libcfaidx_FastaFile *reference;
};


/* "variant.pxd":13
 * 
 * 
 * cdef class Variant:             # <<<<<<<<<<<<<<
 *     cdef public str chrom, ref, alt,
 *     cdef public int pos
 */
struct __pyx_obj_4aldy_9indelpost_7variant_Variant {
  PyObject_HEAD
  struct __pyx_vtabstruct_4aldy_9indelpost_7variant_Variant *__pyx_vtab;
  PyObject *chrom;
  PyObject *ref;
  PyObject *alt;
  int pos;
  struct __pyx_obj_5pysam_9libcfaidx_FastaFile *reference;
  PyObject *_chrom;
  struct __pyx_obj_5pysam_7libcbcf_VariantFile *vcf;
  struct __pyx_obj_5pysam_7libcbcf_VariantRecord *rec;
  struct __pyx_obj_5pysam_7libcbcf_VariantRecord *hit;
};


/* "local_reference.pxd":4
 * 
 * 
 * cdef class UnsplicedLocalReference:             # <<<<<<<<<<<<<<
 *     cdef:
 *         str chrom, ref, alt, unspliced_local_reference
 */
struct __pyx_obj_4aldy_9indelpost_15local_reference_UnsplicedLocalReference {
  PyObject_HEAD
  PyObject *chrom;
  PyObject *ref;
  PyObject *alt;
  PyObject *unspliced_local_reference;
  int pos;
  int window;
  int local_ref_start;
  int ref_len;
  struct __pyx_obj_5pysam_9libcfaidx_FastaFile *reference;
  int left_len;
};


/* "pysam/libcalignedsegment.pxd":34
 * 
 * # Note: need to declare all C fields and methods here
 * cdef class AlignedSegment:             # <<<<<<<<<<<<<<
 * 
 *     # object that this AlignedSegment represents
 */
struct __pyx_obj_5pysam_18libcalignedsegment_AlignedSegment {
  PyObject_HEAD
  struct __pyx_vtabstruct_5pysam_18libcalignedsegment_AlignedSegment *__pyx_vtab;
  bam1_t *_delegate;
  struct __pyx_obj_5pysam_17libcalignmentfile_AlignmentHeader *header;
  PyObject *cache_query_qualities;
  PyObject *cache_query_alignment_qualities;
  PyObject *cache_query_sequence;
  PyObject *cache_query_alignment_sequence;
};


/* "pysam/libcalignedsegment.pxd":65
 * 
 * 
 * cdef class PileupColumn:             # <<<<<<<<<<<<<<
 *     cdef const bam_pileup1_t ** plp
 *     cdef int tid
 */
struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn {
  PyObject_HEAD
  bam_pileup1_t const **plp;
  int tid;
  int pos;
  int n_pu;
  struct __pyx_obj_5pysam_17libcalignmentfile_AlignmentHeader *header;
  uint32_t min_base_quality;
  kstring_t buf;
  char *reference_sequence;
};


/* "pysam/libcalignedsegment.pxd":75
 *     cdef char * reference_sequence
 * 
 * cdef class PileupRead:             # <<<<<<<<<<<<<<
 *     cdef int32_t  _qpos
 *     cdef AlignedSegment _alignment
 */
struct __pyx_obj_5pysam_18libcalignedsegment_PileupRead {
  PyObject_HEAD
  int32_t _qpos;
  struct __pyx_obj_5pysam_18libcalignedsegment_AlignedSegment *_alignment;
  int _indel;
  int _level;
  uint32_t _is_del;
  uint32_t _is_head;
  uint32_t _is_tail;
  uint32_t _is_refskip;
};


/* "pysam/libcalignmentfile.pxd":41
 * 
 * 
 * cdef class AlignmentHeader(object):             # <<<<<<<<<<<<<<
 *     cdef bam_hdr_t *ptr
 * 
 */
struct __pyx_obj_5pysam_17libcalignmentfile_AlignmentHeader {
  PyObject_HEAD
  bam_hdr_t *ptr;
};


/* "pysam/libcalignmentfile.pxd":44
 *     cdef bam_hdr_t *ptr
 * 
 * cdef class AlignmentFile(HTSFile):             # <<<<<<<<<<<<<<
 *     cdef readonly object reference_filename
 *     cdef readonly AlignmentHeader header
 */
struct __pyx_obj_5pysam_17libcalignmentfile_AlignmentFile {
  struct __pyx_obj_5pysam_10libchtslib_HTSFile __pyx_base;
  PyObject *reference_filename;
  struct __pyx_obj_5pysam_17libcalignmentfile_AlignmentHeader *header;
  hts_idx_t *index;
  bam1_t *b;
};


/* "pysam/libcalignmentfile.pxd":61
 * 
 * 
 * cdef class IteratorRow:             # <<<<<<<<<<<<<<
 *     cdef int retval
 *     cdef bam1_t * b
 */
struct __pyx_obj_5pysam_17libcalignmentfile_IteratorRow {
  PyObject_HEAD
  int retval;
  bam1_t *b;
  struct __pyx_obj_5pysam_17libcalignmentfile_AlignmentFile *samfile;
  htsFile *htsfile;
  hts_idx_t *index;
  struct __pyx_obj_5pysam_17libcalignmentfile_AlignmentHeader *header;
  int owns_samfile;
};


/* "pysam/libcalignmentfile.pxd":71
 * 
 * 
 * cdef class IteratorRowRegion(IteratorRow):             # <<<<<<<<<<<<<<
 *     cdef hts_itr_t * iter
 *     cdef bam1_t * getCurrent(self)
 */
struct __pyx_obj_5pysam_17libcalignmentfile_IteratorRowRegion {
  struct __pyx_obj_5pysam_17libcalignmentfile_IteratorRow __pyx_base;
  struct __pyx_vtabstruct_5pysam_17libcalignmentfile_IteratorRowRegion *__pyx_vtab;
  hts_itr_t *iter;
};


/* "pysam/libcalignmentfile.pxd":77
 * 
 * 
 * cdef class IteratorRowHead(IteratorRow):             # <<<<<<<<<<<<<<
 *     cdef int max_rows
 *     cdef int current_row
 */
struct __pyx_obj_5pysam_17libcalignmentfile_IteratorRowHead {
  struct __pyx_obj_5pysam_17libcalignmentfile_IteratorRow __pyx_base;
  struct __pyx_vtabstruct_5pysam_17libcalignmentfile_IteratorRowHead *__pyx_vtab;
  int max_rows;
  int current_row;
};


/* "pysam/libcalignmentfile.pxd":84
 * 
 * 
 * cdef class IteratorRowAll(IteratorRow):             # <<<<<<<<<<<<<<
 *     cdef bam1_t * getCurrent(self)
 *     cdef int cnext(self)
 */
struct __pyx_obj_5pysam_17libcalignmentfile_IteratorRowAll {
  struct __pyx_obj_5pysam_17libcalignmentfile_IteratorRow __pyx_base;
  struct __pyx_vtabstruct_5pysam_17libcalignmentfile_IteratorRowAll *__pyx_vtab;
};


/* "pysam/libcalignmentfile.pxd":89
 * 
 * 
 * cdef class IteratorRowAllRefs(IteratorRow):             # <<<<<<<<<<<<<<
 *     cdef int         tid
 *     cdef IteratorRowRegion rowiter
 */
struct __pyx_obj_5pysam_17libcalignmentfile_IteratorRowAllRefs {
  struct __pyx_obj_5pysam_17libcalignmentfile_IteratorRow __pyx_base;
  int tid;
  struct __pyx_obj_5pysam_17libcalignmentfile_IteratorRowRegion *rowiter;
};


/* "pysam/libcalignmentfile.pxd":94
 * 
 * 
 * cdef class IteratorRowSelection(IteratorRow):             # <<<<<<<<<<<<<<
 *     cdef int current_pos
 *     cdef positions
 */
struct __pyx_obj_5pysam_17libcalignmentfile_IteratorRowSelection {
  struct __pyx_obj_5pysam_17libcalignmentfile_IteratorRow __pyx_base;
  struct __pyx_vtabstruct_5pysam_17libcalignmentfile_IteratorRowSelection *__pyx_vtab;
  int current_pos;
  PyObject *positions;
};


/* "pysam/libcalignmentfile.pxd":101
 * 
 * 
 * cdef class IteratorColumn:             # <<<<<<<<<<<<<<
 * 
 *     # result of the last plbuf_push
 */
struct __pyx_obj_5pysam_17libcalignmentfile_IteratorColumn {
  PyObject_HEAD
  struct __pyx_vtabstruct_5pysam_17libcalignmentfile_IteratorColumn *__pyx_vtab;
  struct __pyx_obj_5pysam_17libcalignmentfile_IteratorRowRegion *iter;
  int tid;
  int pos;
  int n_plp;
  uint32_t min_base_quality;
  bam_pileup1_t const *plp;
  bam_mplp_t pileup_iter;
  __pyx_t_5pysam_17libcalignmentfile___iterdata iterdata;
  struct __pyx_obj_5pysam_17libcalignmentfile_AlignmentFile *samfile;
  struct __pyx_obj_5pysam_9libcfaidx_FastaFile *fastafile;
  PyObject *stepper;
  int max_depth;
  int ignore_overlaps;
};


/* "pysam/libcalignmentfile.pxd":133
 * 
 * 
 * cdef class IteratorColumnRegion(IteratorColumn):             # <<<<<<<<<<<<<<
 *     cdef int start
 *     cdef int stop
 */
struct __pyx_obj_5pysam_17libcalignmentfile_IteratorColumnRegion {
  struct __pyx_obj_5pysam_17libcalignmentfile_IteratorColumn __pyx_base;
  int start;
  int stop;
  int truncate;
};


/* "pysam/libcalignmentfile.pxd":139
 * 
 * 
 * cdef class IteratorColumnAllRefs(IteratorColumn):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_5pysam_17libcalignmentfile_IteratorColumnAllRefs {
  struct __pyx_obj_5pysam_17libcalignmentfile_IteratorColumn __pyx_base;
};


/* "pysam/libcalignmentfile.pxd":143
 * 
 * 
 * cdef class IteratorColumnAll(IteratorColumn):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_5pysam_17libcalignmentfile_IteratorColumnAll {
  struct __pyx_obj_5pysam_17libcalignmentfile_IteratorColumn __pyx_base;
};


/* "pysam/libcalignmentfile.pxd":147
 * 
 * 
 * cdef class IndexedReads:             # <<<<<<<<<<<<<<
 *     cdef AlignmentFile samfile
 *     cdef htsFile * htsfile
 */
struct __pyx_obj_5pysam_17libcalignmentfile_IndexedReads {
  PyObject_HEAD
  struct __pyx_obj_5pysam_17libcalignmentfile_AlignmentFile *samfile;
  htsFile *htsfile;
  PyObject *index;
  int owns_samfile;
  struct __pyx_obj_5pysam_17libcalignmentfile_AlignmentHeader *header;
};


/* "aldy/indelpost/pileup.pyx":51
 * 
 * 
 * cdef tuple make_pileup(             # <<<<<<<<<<<<<<
 *     Variant target,
 *     AlignmentFile bam,
 */
struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct____pyx_f_4aldy_9indelpost_6pileup_make_pileup {
  PyObject_HEAD
  struct __pyx_obj_4aldy_9indelpost_7variant_Variant *__pyx_v_target;
};


/* "aldy/indelpost/pileup.pyx":67
 * 
 *     chrom, pos, reference = target.chrom, target.pos, target.reference
 *     rpos = max(v.pos for v in target.generate_equivalents())             # <<<<<<<<<<<<<<
 * 
 *     ref_len = reference.get_reference_length(chrom)
 */
struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_1_genexpr {
  PyObject_HEAD
  struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct____pyx_f_4aldy_9indelpost_6pileup_make_pileup *__pyx_outer_scope;
  PyObject *__pyx_v_v;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* "aldy/indelpost/pileup.pyx":156
 * 
 * 
 * cdef dict dictize_read(             # <<<<<<<<<<<<<<
 *     AlignedSegment read,
 *     str chrom,
 */
struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_2___pyx_f_4aldy_9indelpost_6pileup_dictize_read {
  PyObject_HEAD
  int __pyx_v_basequalthresh;
  PyObject *__pyx_v_cigar_list;
  PyObject *__pyx_v_read_qual;
};


/* "aldy/indelpost/pileup.pyx":178
 *     aln_end = read.reference_end  # do not add 1
 *     if aln_end is None:
 *         aln_end = aln_start + sum(int(c[:-1]) for c in cigar_list if c[-1] in ("M", "N", "D", "=", "X"))             # <<<<<<<<<<<<<<
 * 
 *     end_offset = int(cigar_list[-1][:-1]) if cigar_list[-1].endswith("S") else 0
 */
struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_3_genexpr {
  PyObject_HEAD
  struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_2___pyx_f_4aldy_9indelpost_6pileup_dictize_read *__pyx_outer_scope;
  PyObject *__pyx_v_c;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* "aldy/indelpost/pileup.pyx":212
 *     read_dict["low_qual_base_num"] = count_lowqual_non_ref_bases(read_seq, ref_seq, read_qual, cigar_list, basequalthresh)
 *     read_dict["is_end_dirty"] = is_end_dirty(read_qual, basequalthresh, pos, read_start, read_end, cigar_string)
 *     read_dict["is_dirty"] = sum(q <= basequalthresh for q in read_qual) / len(read_seq) > 0.15             # <<<<<<<<<<<<<<
 * 
 *     insertions, deletions = locate_indels(cigar_string, read_start)
 */
struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_4_genexpr {
  PyObject_HEAD
  struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_2___pyx_f_4aldy_9indelpost_6pileup_dictize_read *__pyx_outer_scope;
  PyObject *__pyx_v_q;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* "aldy/indelpost/pileup.pyx":577
 * 
 * 
 * def retarget(             # <<<<<<<<<<<<<<
 *     target,
 *     pileup,
 */
struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_5_retarget {
  PyObject_HEAD
  PyObject *__pyx_v_target;
};


/* "aldy/indelpost/pileup.pyx":1047
 * 
 * 
 * def update_pileup(             # <<<<<<<<<<<<<<
 *     pileup,
 *     new_target,
 */
struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_6_update_pileup {
  PyObject_HEAD
  PyObject *__pyx_v_new_target;
};


/* "aldy/indelpost/pileup.pyx":1059
 * ):
 * 
 *     rpos = max(v.pos for v in new_target.generate_equivalents())             # <<<<<<<<<<<<<<
 *     for read in pileup:
 * 
 */
struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_7_genexpr {
  PyObject_HEAD
  struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_6_update_pileup *__pyx_outer_scope;
  PyObject *__pyx_v_v;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};



/* "pysam/libchtslib.pxd":2680
 * 
 * 
 * cdef class HTSFile(object):             # <<<<<<<<<<<<<<
 *     cdef          htsFile *htsfile       # pointer to htsFile structure
 *     cdef          int64_t start_offset   # BGZF offset of first record
 */

struct __pyx_vtabstruct_5pysam_10libchtslib_HTSFile {
  htsFile *(*_open_htsfile)(struct __pyx_obj_5pysam_10libchtslib_HTSFile *);
};
static struct __pyx_vtabstruct_5pysam_10libchtslib_HTSFile *__pyx_vtabptr_5pysam_10libchtslib_HTSFile;


/* "pysam/libcfaidx.pxd":37
 *                     int * dret)
 * 
 * cdef class FastaFile:             # <<<<<<<<<<<<<<
 *     cdef bint is_remote
 *     cdef object _filename, _references, _lengths, reference2length
 */

struct __pyx_vtabstruct_5pysam_9libcfaidx_FastaFile {
  char *(*_fetch)(struct __pyx_obj_5pysam_9libcfaidx_FastaFile *, char *, int, int, int *);
};
static struct __pyx_vtabstruct_5pysam_9libcfaidx_FastaFile *__pyx_vtabptr_5pysam_9libcfaidx_FastaFile;


/* "pysam/libcfaidx.pxd":45
 * 
 * 
 * cdef class FastqProxy:             # <<<<<<<<<<<<<<
 *     cdef kseq_t * _delegate
 *     cdef cython.str to_string(self)
 */

struct __pyx_vtabstruct_5pysam_9libcfaidx_FastqProxy {
  PyObject *(*to_string)(struct __pyx_obj_5pysam_9libcfaidx_FastqProxy *);
  PyObject *(*tostring)(struct __pyx_obj_5pysam_9libcfaidx_FastqProxy *);
  arrayobject *(*get_quality_array)(struct __pyx_obj_5pysam_9libcfaidx_FastqProxy *, int __pyx_skip_dispatch, struct __pyx_opt_args_5pysam_9libcfaidx_10FastqProxy_get_quality_array *__pyx_optional_args);
};
static struct __pyx_vtabstruct_5pysam_9libcfaidx_FastqProxy *__pyx_vtabptr_5pysam_9libcfaidx_FastqProxy;


/* "pysam/libcfaidx.pxd":52
 * 
 * 
 * cdef class FastxRecord:             # <<<<<<<<<<<<<<
 *     """
 *     Python container for pysam.libcfaidx.FastqProxy with persistence.
 */

struct __pyx_vtabstruct_5pysam_9libcfaidx_FastxRecord {
  PyObject *(*to_string)(struct __pyx_obj_5pysam_9libcfaidx_FastxRecord *);
  PyObject *(*tostring)(struct __pyx_obj_5pysam_9libcfaidx_FastxRecord *);
  arrayobject *(*get_quality_array)(struct __pyx_obj_5pysam_9libcfaidx_FastxRecord *, int __pyx_skip_dispatch, struct __pyx_opt_args_5pysam_9libcfaidx_11FastxRecord_get_quality_array *__pyx_optional_args);
};
static struct __pyx_vtabstruct_5pysam_9libcfaidx_FastxRecord *__pyx_vtabptr_5pysam_9libcfaidx_FastxRecord;


/* "pysam/libcfaidx.pxd":61
 *     cpdef array.array get_quality_array(self, int offset=*)
 * 
 * cdef class FastxFile:             # <<<<<<<<<<<<<<
 *     cdef object _filename
 *     cdef BGZF * fastqfile
 */

struct __pyx_vtabstruct_5pysam_9libcfaidx_FastxFile {
  kseq_t *(*getCurrent)(struct __pyx_obj_5pysam_9libcfaidx_FastxFile *);
  int (*cnext)(struct __pyx_obj_5pysam_9libcfaidx_FastxFile *);
};
static struct __pyx_vtabstruct_5pysam_9libcfaidx_FastxFile *__pyx_vtabptr_5pysam_9libcfaidx_FastxFile;


/* "pysam/libcfaidx.pxd":73
 * 
 * # Compatibility Layer for pysam 0.8.1
 * cdef class FastqFile(FastxFile):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_5pysam_9libcfaidx_FastqFile {
  struct __pyx_vtabstruct_5pysam_9libcfaidx_FastxFile __pyx_base;
};
static struct __pyx_vtabstruct_5pysam_9libcfaidx_FastqFile *__pyx_vtabptr_5pysam_9libcfaidx_FastqFile;


/* "pysam/libcfaidx.pxd":78
 * 
 * # Compatibility Layer for pysam < 0.8
 * cdef class Fastafile(FastaFile):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_5pysam_9libcfaidx_Fastafile {
  struct __pyx_vtabstruct_5pysam_9libcfaidx_FastaFile __pyx_base;
};
static struct __pyx_vtabstruct_5pysam_9libcfaidx_Fastafile *__pyx_vtabptr_5pysam_9libcfaidx_Fastafile;


/* "pysam/libcbcf.pxd":38
 * 
 * 
 * cdef class VariantHeader(object):             # <<<<<<<<<<<<<<
 *     cdef bcf_hdr_t *ptr
 * 
 */

struct __pyx_vtabstruct_5pysam_7libcbcf_VariantHeader {
  PyObject *(*_add_sample)(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *, PyObject *);
  PyObject *(*_hdr_sync)(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *);
  PyObject *(*_subset_samples)(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *, PyObject *);
};
static struct __pyx_vtabstruct_5pysam_7libcbcf_VariantHeader *__pyx_vtabptr_5pysam_7libcbcf_VariantHeader;


/* "pysam/libcbcf.pxd":133
 * 
 * 
 * cdef class VariantFile(HTSFile):             # <<<<<<<<<<<<<<
 *     cdef readonly VariantHeader  header
 *     cdef readonly BaseIndex      index
 */

struct __pyx_vtabstruct_5pysam_7libcbcf_VariantFile {
  struct __pyx_vtabstruct_5pysam_10libchtslib_HTSFile __pyx_base;
  int (*write)(struct __pyx_obj_5pysam_7libcbcf_VariantFile *, struct __pyx_obj_5pysam_7libcbcf_VariantRecord *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_5pysam_7libcbcf_VariantFile *__pyx_vtabptr_5pysam_7libcbcf_VariantFile;


/* "variant.pxd":13
 * 
 * 
 * cdef class Variant:             # <<<<<<<<<<<<<<
 *     cdef public str chrom, ref, alt,
 *     cdef public int pos
 */

struct __pyx_vtabstruct_4aldy_9indelpost_7variant_Variant {
  PyObject *(*__pyx___validate)(struct __pyx_obj_4aldy_9indelpost_7variant_Variant *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_4aldy_9indelpost_7variant_Variant *__pyx_vtabptr_4aldy_9indelpost_7variant_Variant;


/* "pysam/libcalignedsegment.pxd":34
 * 
 * # Note: need to declare all C fields and methods here
 * cdef class AlignedSegment:             # <<<<<<<<<<<<<<
 * 
 *     # object that this AlignedSegment represents
 */

struct __pyx_vtabstruct_5pysam_18libcalignedsegment_AlignedSegment {
  PyObject *(*set_tag)(struct __pyx_obj_5pysam_18libcalignedsegment_AlignedSegment *, PyObject *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_5pysam_18libcalignedsegment_14AlignedSegment_set_tag *__pyx_optional_args);
  PyObject *(*get_tag)(struct __pyx_obj_5pysam_18libcalignedsegment_AlignedSegment *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_5pysam_18libcalignedsegment_14AlignedSegment_get_tag *__pyx_optional_args);
  PyObject *(*has_tag)(struct __pyx_obj_5pysam_18libcalignedsegment_AlignedSegment *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*to_string)(struct __pyx_obj_5pysam_18libcalignedsegment_AlignedSegment *, int __pyx_skip_dispatch);
  PyObject *(*tostring)(struct __pyx_obj_5pysam_18libcalignedsegment_AlignedSegment *, int __pyx_skip_dispatch, struct __pyx_opt_args_5pysam_18libcalignedsegment_14AlignedSegment_tostring *__pyx_optional_args);
};
static struct __pyx_vtabstruct_5pysam_18libcalignedsegment_AlignedSegment *__pyx_vtabptr_5pysam_18libcalignedsegment_AlignedSegment;


/* "pysam/libcalignmentfile.pxd":44
 *     cdef bam_hdr_t *ptr
 * 
 * cdef class AlignmentFile(HTSFile):             # <<<<<<<<<<<<<<
 *     cdef readonly object reference_filename
 *     cdef readonly AlignmentHeader header
 */

struct __pyx_vtabstruct_5pysam_17libcalignmentfile_AlignmentFile {
  struct __pyx_vtabstruct_5pysam_10libchtslib_HTSFile __pyx_base;
  bam1_t *(*getCurrent)(struct __pyx_obj_5pysam_17libcalignmentfile_AlignmentFile *);
  int (*cnext)(struct __pyx_obj_5pysam_17libcalignmentfile_AlignmentFile *);
  int (*write)(struct __pyx_obj_5pysam_17libcalignmentfile_AlignmentFile *, struct __pyx_obj_5pysam_18libcalignedsegment_AlignedSegment *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_5pysam_17libcalignmentfile_AlignmentFile *__pyx_vtabptr_5pysam_17libcalignmentfile_AlignmentFile;


/* "pysam/libcalignmentfile.pxd":71
 * 
 * 
 * cdef class IteratorRowRegion(IteratorRow):             # <<<<<<<<<<<<<<
 *     cdef hts_itr_t * iter
 *     cdef bam1_t * getCurrent(self)
 */

struct __pyx_vtabstruct_5pysam_17libcalignmentfile_IteratorRowRegion {
  bam1_t *(*getCurrent)(struct __pyx_obj_5pysam_17libcalignmentfile_IteratorRowRegion *);
  int (*cnext)(struct __pyx_obj_5pysam_17libcalignmentfile_IteratorRowRegion *);
};
static struct __pyx_vtabstruct_5pysam_17libcalignmentfile_IteratorRowRegion *__pyx_vtabptr_5pysam_17libcalignmentfile_IteratorRowRegion;


/* "pysam/libcalignmentfile.pxd":77
 * 
 * 
 * cdef class IteratorRowHead(IteratorRow):             # <<<<<<<<<<<<<<
 *     cdef int max_rows
 *     cdef int current_row
 */

struct __pyx_vtabstruct_5pysam_17libcalignmentfile_IteratorRowHead {
  bam1_t *(*getCurrent)(struct __pyx_obj_5pysam_17libcalignmentfile_IteratorRowHead *);
  int (*cnext)(struct __pyx_obj_5pysam_17libcalignmentfile_IteratorRowHead *);
};
static struct __pyx_vtabstruct_5pysam_17libcalignmentfile_IteratorRowHead *__pyx_vtabptr_5pysam_17libcalignmentfile_IteratorRowHead;


/* "pysam/libcalignmentfile.pxd":84
 * 
 * 
 * cdef class IteratorRowAll(IteratorRow):             # <<<<<<<<<<<<<<
 *     cdef bam1_t * getCurrent(self)
 *     cdef int cnext(self)
 */

struct __pyx_vtabstruct_5pysam_17libcalignmentfile_IteratorRowAll {
  bam1_t *(*getCurrent)(struct __pyx_obj_5pysam_17libcalignmentfile_IteratorRowAll *);
  int (*cnext)(struct __pyx_obj_5pysam_17libcalignmentfile_IteratorRowAll *);
};
static struct __pyx_vtabstruct_5pysam_17libcalignmentfile_IteratorRowAll *__pyx_vtabptr_5pysam_17libcalignmentfile_IteratorRowAll;


/* "pysam/libcalignmentfile.pxd":94
 * 
 * 
 * cdef class IteratorRowSelection(IteratorRow):             # <<<<<<<<<<<<<<
 *     cdef int current_pos
 *     cdef positions
 */

struct __pyx_vtabstruct_5pysam_17libcalignmentfile_IteratorRowSelection {
  bam1_t *(*getCurrent)(struct __pyx_obj_5pysam_17libcalignmentfile_IteratorRowSelection *);
  int (*cnext)(struct __pyx_obj_5pysam_17libcalignmentfile_IteratorRowSelection *);
};
static struct __pyx_vtabstruct_5pysam_17libcalignmentfile_IteratorRowSelection *__pyx_vtabptr_5pysam_17libcalignmentfile_IteratorRowSelection;


/* "pysam/libcalignmentfile.pxd":101
 * 
 * 
 * cdef class IteratorColumn:             # <<<<<<<<<<<<<<
 * 
 *     # result of the last plbuf_push
 */

struct __pyx_vtabstruct_5pysam_17libcalignmentfile_IteratorColumn {
  int (*cnext)(struct __pyx_obj_5pysam_17libcalignmentfile_IteratorColumn *);
  char *(*get_sequence)(struct __pyx_obj_5pysam_17libcalignmentfile_IteratorColumn *);
  PyObject *(*_setup_iterator)(struct __pyx_obj_5pysam_17libcalignmentfile_IteratorColumn *, int, int, int, struct __pyx_opt_args_5pysam_17libcalignmentfile_14IteratorColumn__setup_iterator *__pyx_optional_args);
  PyObject *(*_setup_raw_rest_iterator)(struct __pyx_obj_5pysam_17libcalignmentfile_IteratorColumn *);
  PyObject *(*reset)(struct __pyx_obj_5pysam_17libcalignmentfile_IteratorColumn *, PyObject *, PyObject *, PyObject *);
  PyObject *(*_free_pileup_iter)(struct __pyx_obj_5pysam_17libcalignmentfile_IteratorColumn *);
  char *(*getSequence)(struct __pyx_obj_5pysam_17libcalignmentfile_IteratorColumn *);
};
static struct __pyx_vtabstruct_5pysam_17libcalignmentfile_IteratorColumn *__pyx_vtabptr_5pysam_17libcalignmentfile_IteratorColumn;


/* "pysam/libcalignmentfile.pxd":133
 * 
 * 
 * cdef class IteratorColumnRegion(IteratorColumn):             # <<<<<<<<<<<<<<
 *     cdef int start
 *     cdef int stop
 */

struct __pyx_vtabstruct_5pysam_17libcalignmentfile_IteratorColumnRegion {
  struct __pyx_vtabstruct_5pysam_17libcalignmentfile_IteratorColumn __pyx_base;
};
static struct __pyx_vtabstruct_5pysam_17libcalignmentfile_IteratorColumnRegion *__pyx_vtabptr_5pysam_17libcalignmentfile_IteratorColumnRegion;


/* "pysam/libcalignmentfile.pxd":139
 * 
 * 
 * cdef class IteratorColumnAllRefs(IteratorColumn):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_5pysam_17libcalignmentfile_IteratorColumnAllRefs {
  struct __pyx_vtabstruct_5pysam_17libcalignmentfile_IteratorColumn __pyx_base;
};
static struct __pyx_vtabstruct_5pysam_17libcalignmentfile_IteratorColumnAllRefs *__pyx_vtabptr_5pysam_17libcalignmentfile_IteratorColumnAllRefs;


/* "pysam/libcalignmentfile.pxd":143
 * 
 * 
 * cdef class IteratorColumnAll(IteratorColumn):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_5pysam_17libcalignmentfile_IteratorColumnAll {
  struct __pyx_vtabstruct_5pysam_17libcalignmentfile_IteratorColumn __pyx_base;
};
static struct __pyx_vtabstruct_5pysam_17libcalignmentfile_IteratorColumnAll *__pyx_vtabptr_5pysam_17libcalignmentfile_IteratorColumnAll;

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

/* PyObjectGetAttrStr.proto */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
#else
#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
#endif

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

/* None.proto */
static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname);

/* PyFunctionFastCall.proto */
#if CYTHON_FAST_PYCALL
#define __Pyx_PyFunction_FastCall(func, args, nargs)\
    __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
#if 1 || PY_VERSION_HEX < 0x030600B1
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
#else
#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
#endif
#define __Pyx_BUILD_ASSERT_EXPR(cond)\
    (sizeof(char [1 - 2*!(cond)]) - 1)
#ifndef Py_MEMBER_SIZE
#define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
#endif
#if CYTHON_FAST_PYCALL
  static size_t __pyx_pyframe_localsplus_offset = 0;
  #include "frameobject.h"
#if PY_VERSION_HEX >= 0x030b00a6
  #ifndef Py_BUILD_CORE
    #define Py_BUILD_CORE 1
  #endif
  #include "internal/pycore_frame.h"
#endif
  #define __Pxy_PyFrame_Initialize_Offsets()\
    ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
     (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
  #define __Pyx_PyFrame_GetLocalsplus(frame)\
    (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
#endif // CYTHON_FAST_PYCALL
#endif

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

/* PyObjectCallMethO.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
#endif

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

/* PyCFunctionFastCall.proto */
#if CYTHON_FAST_PYCCALL
static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
#else
#define __Pyx_PyCFunction_FastCall(func, args, nargs)  (assert(0), NULL)
#endif

/* PyObjectCallOneArg.proto */
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);

/* PyObjectCall2Args.proto */
static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);

/* PySequenceContains.proto */
static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) {
    int result = PySequence_Contains(seq, item);
    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
}

/* unicode_tailmatch.proto */
static int __Pyx_PyUnicode_Tailmatch(
    PyObject* s, PyObject* substr, Py_ssize_t start, Py_ssize_t end, int direction);

/* PyDictVersioning.proto */
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
#define __PYX_DICT_VERSION_INIT  ((PY_UINT64_T) -1)
#define __PYX_GET_DICT_VERSION(dict)  (((PyDictObject*)(dict))->ma_version_tag)
#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
    (version_var) = __PYX_GET_DICT_VERSION(dict);\
    (cache_var) = (value);
#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
    static PY_UINT64_T __pyx_dict_version = 0;\
    static PyObject *__pyx_dict_cached_value = NULL;\
    if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
        (VAR) = __pyx_dict_cached_value;\
    } else {\
        (VAR) = __pyx_dict_cached_value = (LOOKUP);\
        __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
    }\
}
static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
#else
#define __PYX_GET_DICT_VERSION(dict)  (0)
#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP)  (VAR) = (LOOKUP);
#endif

/* GetModuleGlobalName.proto */
#if CYTHON_USE_DICT_VERSIONS
#define __Pyx_GetModuleGlobalName(var, name)  {\
    static PY_UINT64_T __pyx_dict_version = 0;\
    static PyObject *__pyx_dict_cached_value = NULL;\
    (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
        (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
        __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
}
#define __Pyx_GetModuleGlobalNameUncached(var, name)  {\
    PY_UINT64_T __pyx_dict_version;\
    PyObject *__pyx_dict_cached_value;\
    (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
}
static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
#else
#define __Pyx_GetModuleGlobalName(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
#define __Pyx_GetModuleGlobalNameUncached(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
#endif

/* ExtTypeTest.proto */
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);

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

/* RaiseArgTupleInvalid.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);

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

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

/* DictGetItem.proto */
#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
#define __Pyx_PyObject_Dict_GetItem(obj, name)\
    (likely(PyDict_CheckExact(obj)) ?\
     __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
#else
#define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
#define __Pyx_PyObject_Dict_GetItem(obj, name)  PyObject_GetItem(obj, name)
#endif

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

/* IncludeStringH.proto */
#include <string.h>

/* BytesEquals.proto */
static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);

/* UnicodeEquals.proto */
static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);

/* SliceObject.proto */
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(
        PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop,
        PyObject** py_start, PyObject** py_stop, PyObject** py_slice,
        int has_cstart, int has_cstop, int wraparound);

/* PyIntBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\
    (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
#endif

/* RaiseTooManyValuesToUnpack.proto */
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);

/* RaiseNeedMoreValuesToUnpack.proto */
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);

/* RaiseNoneIterError.proto */
static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);

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

/* PyObjectGetMethod.proto */
static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method);

/* PyObjectCallMethod1.proto */
static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg);

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

/* PyUnicodeContains.proto */
static CYTHON_INLINE int __Pyx_PyUnicode_ContainsTF(PyObject* substring, PyObject* text, int eq) {
    int result = PyUnicode_Contains(text, substring);
    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
}

/* GetItemIntUnicode.proto */
#define __Pyx_GetItemInt_Unicode(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_Unicode_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
    (PyErr_SetString(PyExc_IndexError, "string index out of range"), (Py_UCS4)-1))
static CYTHON_INLINE Py_UCS4 __Pyx_GetItemInt_Unicode_Fast(PyObject* ustring, Py_ssize_t i,
                                                           int wraparound, int boundscheck);

/* PyUnicode_Substring.proto */
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Substring(
            PyObject* text, Py_ssize_t start, Py_ssize_t stop);

/* PyThreadStateGet.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
#define __Pyx_PyThreadState_assign  __pyx_tstate = __Pyx_PyThreadState_Current;
#define __Pyx_PyErr_Occurred()  __pyx_tstate->curexc_type
#else
#define __Pyx_PyThreadState_declare
#define __Pyx_PyThreadState_assign
#define __Pyx_PyErr_Occurred()  PyErr_Occurred()
#endif

/* PyErrFetchRestore.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
#define __Pyx_ErrRestoreWithState(type, value, tb)  __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
#define __Pyx_ErrFetchWithState(type, value, tb)    __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
#define __Pyx_ErrRestore(type, value, tb)  __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
#define __Pyx_ErrFetch(type, value, tb)    __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
#else
#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
#endif
#else
#define __Pyx_PyErr_Clear() PyErr_Clear()
#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
#define __Pyx_ErrRestoreWithState(type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetchWithState(type, value, tb)  PyErr_Fetch(type, value, tb)
#define __Pyx_ErrRestoreInState(tstate, type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetchInState(tstate, type, value, tb)  PyErr_Fetch(type, value, tb)
#define __Pyx_ErrRestore(type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetch(type, value, tb)  PyErr_Fetch(type, value, tb)
#endif

/* WriteUnraisableException.proto */
static void __Pyx_WriteUnraisable(const char *name, int clineno,
                                  int lineno, const char *filename,
                                  int full_traceback, int nogil);

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

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

/* ObjectGetItem.proto */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
#else
#define __Pyx_PyObject_GetItem(obj, key)  PyObject_GetItem(obj, key)
#endif

/* PyIntBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyInt_SubtractObjC(op1, op2, intval, inplace, zerodivision_check)\
    (inplace ? PyNumber_InPlaceSubtract(op1, op2) : PyNumber_Subtract(op1, op2))
#endif

/* UnpackUnboundCMethod.proto */
typedef struct {
    PyObject *type;
    PyObject **method_name;
    PyCFunction func;
    PyObject *method;
    int flag;
} __Pyx_CachedCFunction;

/* CallUnboundCMethod1.proto */
static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg);
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg);
#else
#define __Pyx_CallUnboundCMethod1(cfunc, self, arg)  __Pyx__CallUnboundCMethod1(cfunc, self, arg)
#endif

/* PyIntCompare.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, long intval, long inplace);

/* py_abs.proto */
#if CYTHON_USE_PYLONG_INTERNALS
static PyObject *__Pyx_PyLong_AbsNeg(PyObject *num);
#define __Pyx_PyNumber_Absolute(x)\
    ((likely(PyLong_CheckExact(x))) ?\
         (likely(Py_SIZE(x) >= 0) ? (Py_INCREF(x), (x)) : __Pyx_PyLong_AbsNeg(x)) :\
         PyNumber_Absolute(x))
#else
#define __Pyx_PyNumber_Absolute(x)  PyNumber_Absolute(x)
#endif

/* CallUnboundCMethod0.proto */
static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self);
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_CallUnboundCMethod0(cfunc, self)\
    (likely((cfunc)->func) ?\
        (likely((cfunc)->flag == METH_NOARGS) ?  (*((cfunc)->func))(self, NULL) :\
         (PY_VERSION_HEX >= 0x030600B1 && likely((cfunc)->flag == METH_FASTCALL) ?\
            (PY_VERSION_HEX >= 0x030700A0 ?\
                (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0) :\
                (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0, NULL)) :\
          (PY_VERSION_HEX >= 0x030700A0 && (cfunc)->flag == (METH_FASTCALL | METH_KEYWORDS) ?\
            (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0, NULL) :\
            (likely((cfunc)->flag == (METH_VARARGS | METH_KEYWORDS)) ?  ((*(PyCFunctionWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, __pyx_empty_tuple, NULL)) :\
               ((cfunc)->flag == METH_VARARGS ?  (*((cfunc)->func))(self, __pyx_empty_tuple) :\
               __Pyx__CallUnboundCMethod0(cfunc, self)))))) :\
        __Pyx__CallUnboundCMethod0(cfunc, self))
#else
#define __Pyx_CallUnboundCMethod0(cfunc, self)  __Pyx__CallUnboundCMethod0(cfunc, self)
#endif

/* pyfrozenset_new.proto */
static CYTHON_INLINE PyObject* __Pyx_PyFrozenSet_New(PyObject* it);

/* PySetContains.proto */
static CYTHON_INLINE int __Pyx_PySet_ContainsTF(PyObject* key, PyObject* set, int eq);

/* PyIntBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_TrueDivideObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyInt_TrueDivideObjC(op1, op2, intval, inplace, zerodivision_check)\
    (inplace ? PyNumber_InPlaceTrueDivide(op1, op2) : PyNumber_TrueDivide(op1, op2))
#endif

/* set_iter.proto */
static CYTHON_INLINE PyObject* __Pyx_set_iterator(PyObject* iterable, int is_set,
                                                  Py_ssize_t* p_orig_length, int* p_source_is_set);
static CYTHON_INLINE int __Pyx_set_iter_next(
        PyObject* iter_obj, Py_ssize_t orig_length,
        Py_ssize_t* ppos, PyObject **value,
        int source_is_set);

/* FetchCommonType.proto */
static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);

/* CythonFunctionShared.proto */
#define __Pyx_CyFunction_USED 1
#define __Pyx_CYFUNCTION_STATICMETHOD  0x01
#define __Pyx_CYFUNCTION_CLASSMETHOD   0x02
#define __Pyx_CYFUNCTION_CCLASS        0x04
#define __Pyx_CyFunction_GetClosure(f)\
    (((__pyx_CyFunctionObject *) (f))->func_closure)
#define __Pyx_CyFunction_GetClassObj(f)\
    (((__pyx_CyFunctionObject *) (f))->func_classobj)
#define __Pyx_CyFunction_Defaults(type, f)\
    ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
    ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
typedef struct {
    PyCFunctionObject func;
#if PY_VERSION_HEX < 0x030500A0
    PyObject *func_weakreflist;
#endif
    PyObject *func_dict;
    PyObject *func_name;
    PyObject *func_qualname;
    PyObject *func_doc;
    PyObject *func_globals;
    PyObject *func_code;
    PyObject *func_closure;
    PyObject *func_classobj;
    void *defaults;
    int defaults_pyobjects;
    size_t defaults_size;  // used by FusedFunction for copying defaults
    int flags;
    PyObject *defaults_tuple;
    PyObject *defaults_kwdict;
    PyObject *(*defaults_getter)(PyObject *);
    PyObject *func_annotations;
} __pyx_CyFunctionObject;
static PyTypeObject *__pyx_CyFunctionType = 0;
#define __Pyx_CyFunction_Check(obj)  (__Pyx_TypeCheck(obj, __pyx_CyFunctionType))
static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml,
                                      int flags, PyObject* qualname,
                                      PyObject *self,
                                      PyObject *module, PyObject *globals,
                                      PyObject* code);
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
                                                         size_t size,
                                                         int pyobjects);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
                                                            PyObject *tuple);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
                                                             PyObject *dict);
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
                                                              PyObject *dict);
static int __pyx_CyFunction_init(void);

/* CythonFunction.proto */
static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml,
                                      int flags, PyObject* qualname,
                                      PyObject *closure,
                                      PyObject *module, PyObject *globals,
                                      PyObject* code);

/* GetTopmostException.proto */
#if CYTHON_USE_EXC_INFO_STACK
static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
#endif

/* SaveResetException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_ExceptionSave(type, value, tb)  __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#define __Pyx_ExceptionReset(type, value, tb)  __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
#else
#define __Pyx_ExceptionSave(type, value, tb)   PyErr_GetExcInfo(type, value, tb)
#define __Pyx_ExceptionReset(type, value, tb)  PyErr_SetExcInfo(type, value, tb)
#endif

/* GetException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_GetException(type, value, tb)  __Pyx__GetException(__pyx_tstate, type, value, tb)
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#else
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
#endif

/* PyObjectSetAttrStr.proto */
#if CYTHON_USE_TYPE_SLOTS
#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o, n, NULL)
static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value);
#else
#define __Pyx_PyObject_DelAttrStr(o,n)   PyObject_DelAttr(o,n)
#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
#endif

/* None.proto */
static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);

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

/* PyObject_GenericGetAttrNoDict.proto */
#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
#else
#define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
#endif

/* TypeImport.proto */
#ifndef __PYX_HAVE_RT_ImportType_proto
#define __PYX_HAVE_RT_ImportType_proto
enum __Pyx_ImportType_CheckSize {
   __Pyx_ImportType_CheckSize_Error = 0,
   __Pyx_ImportType_CheckSize_Warn = 1,
   __Pyx_ImportType_CheckSize_Ignore = 2
};
static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
#endif

/* GetVTable.proto */
static void* __Pyx_GetVtable(PyObject *dict);

/* Import.proto */
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);

/* ImportFrom.proto */
static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);

/* CLineInTraceback.proto */
#ifdef CYTHON_CLINE_IN_TRACEBACK
#define __Pyx_CLineForTraceback(tstate, c_line)  (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
#else
static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
#endif

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

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

/* ArrayAPI.proto */
#ifndef _ARRAYARRAY_H
#define _ARRAYARRAY_H
typedef struct arraydescr {
    int typecode;
    int itemsize;
    PyObject * (*getitem)(struct arrayobject *, Py_ssize_t);
    int (*setitem)(struct arrayobject *, Py_ssize_t, PyObject *);
#if PY_MAJOR_VERSION >= 3
    char *formats;
#endif
} arraydescr;
struct arrayobject {
    PyObject_HEAD
    Py_ssize_t ob_size;
    union {
        char *ob_item;
        float *as_floats;
        double *as_doubles;
        int *as_ints;
        unsigned int *as_uints;
        unsigned char *as_uchars;
        signed char *as_schars;
        char *as_chars;
        unsigned long *as_ulongs;
        long *as_longs;
#if PY_MAJOR_VERSION >= 3
        unsigned long long *as_ulonglongs;
        long long *as_longlongs;
#endif
        short *as_shorts;
        unsigned short *as_ushorts;
        Py_UNICODE *as_pyunicodes;
        void *as_voidptr;
    } data;
    Py_ssize_t allocated;
    struct arraydescr *ob_descr;
    PyObject *weakreflist;
#if PY_MAJOR_VERSION >= 3
        int ob_exports;
#endif
};
#ifndef NO_NEWARRAY_INLINE
static CYTHON_INLINE PyObject * newarrayobject(PyTypeObject *type, Py_ssize_t size,
    struct arraydescr *descr) {
    arrayobject *op;
    size_t nbytes;
    if (size < 0) {
        PyErr_BadInternalCall();
        return NULL;
    }
    nbytes = size * descr->itemsize;
    if (nbytes / descr->itemsize != (size_t)size) {
        return PyErr_NoMemory();
    }
    op = (arrayobject *) type->tp_alloc(type, 0);
    if (op == NULL) {
        return NULL;
    }
    op->ob_descr = descr;
    op->allocated = size;
    op->weakreflist = NULL;
    __Pyx_SET_SIZE(op, size);
    if (size <= 0) {
        op->data.ob_item = NULL;
    }
    else {
        op->data.ob_item = PyMem_NEW(char, nbytes);
        if (op->data.ob_item == NULL) {
            Py_DECREF(op);
            return PyErr_NoMemory();
        }
    }
    return (PyObject *) op;
}
#else
PyObject* newarrayobject(PyTypeObject *type, Py_ssize_t size,
    struct arraydescr *descr);
#endif
static CYTHON_INLINE int resize(arrayobject *self, Py_ssize_t n) {
    void *items = (void*) self->data.ob_item;
    PyMem_Resize(items, char, (size_t)(n * self->ob_descr->itemsize));
    if (items == NULL) {
        PyErr_NoMemory();
        return -1;
    }
    self->data.ob_item = (char*) items;
    __Pyx_SET_SIZE(self, n);
    self->allocated = n;
    return 0;
}
static CYTHON_INLINE int resize_smart(arrayobject *self, Py_ssize_t n) {
    void *items = (void*) self->data.ob_item;
    Py_ssize_t newsize;
    if (n < self->allocated && n*4 > self->allocated) {
        __Pyx_SET_SIZE(self, n);
        return 0;
    }
    newsize = n + (n / 2) + 1;
    if (newsize <= n) {
        PyErr_NoMemory();
        return -1;
    }
    PyMem_Resize(items, char, (size_t)(newsize * self->ob_descr->itemsize));
    if (items == NULL) {
        PyErr_NoMemory();
        return -1;
    }
    self->data.ob_item = (char*) items;
    __Pyx_SET_SIZE(self, n);
    self->allocated = newsize;
    return 0;
}
#endif

/* GCCDiagnostics.proto */
#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
#define __Pyx_HAS_GCC_DIAGNOSTIC
#endif

/* CIntFromPy.proto */
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);

/* CIntFromPy.proto */
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);

/* FastTypeChecks.proto */
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
#else
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
#endif
#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)

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

/* SwapException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_ExceptionSwap(type, value, tb)  __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#else
static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
#endif

/* CoroutineBase.proto */
typedef PyObject *(*__pyx_coroutine_body_t)(PyObject *, PyThreadState *, PyObject *);
#if CYTHON_USE_EXC_INFO_STACK
#define __Pyx_ExcInfoStruct  _PyErr_StackItem
#else
typedef struct {
    PyObject *exc_type;
    PyObject *exc_value;
    PyObject *exc_traceback;
} __Pyx_ExcInfoStruct;
#endif
typedef struct {
    PyObject_HEAD
    __pyx_coroutine_body_t body;
    PyObject *closure;
    __Pyx_ExcInfoStruct gi_exc_state;
    PyObject *gi_weakreflist;
    PyObject *classobj;
    PyObject *yieldfrom;
    PyObject *gi_name;
    PyObject *gi_qualname;
    PyObject *gi_modulename;
    PyObject *gi_code;
    PyObject *gi_frame;
    int resume_label;
    char is_running;
} __pyx_CoroutineObject;
static __pyx_CoroutineObject *__Pyx__Coroutine_New(
    PyTypeObject *type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
    PyObject *name, PyObject *qualname, PyObject *module_name);
static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
            __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
            PyObject *name, PyObject *qualname, PyObject *module_name);
static CYTHON_INLINE void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *self);
static int __Pyx_Coroutine_clear(PyObject *self);
static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value);
static PyObject *__Pyx_Coroutine_Close(PyObject *self);
static PyObject *__Pyx_Coroutine_Throw(PyObject *gen, PyObject *args);
#if CYTHON_USE_EXC_INFO_STACK
#define __Pyx_Coroutine_SwapException(self)
#define __Pyx_Coroutine_ResetAndClearException(self)  __Pyx_Coroutine_ExceptionClear(&(self)->gi_exc_state)
#else
#define __Pyx_Coroutine_SwapException(self) {\
    __Pyx_ExceptionSwap(&(self)->gi_exc_state.exc_type, &(self)->gi_exc_state.exc_value, &(self)->gi_exc_state.exc_traceback);\
    __Pyx_Coroutine_ResetFrameBackpointer(&(self)->gi_exc_state);\
    }
#define __Pyx_Coroutine_ResetAndClearException(self) {\
    __Pyx_ExceptionReset((self)->gi_exc_state.exc_type, (self)->gi_exc_state.exc_value, (self)->gi_exc_state.exc_traceback);\
    (self)->gi_exc_state.exc_type = (self)->gi_exc_state.exc_value = (self)->gi_exc_state.exc_traceback = NULL;\
    }
#endif
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
    __Pyx_PyGen__FetchStopIterationValue(__pyx_tstate, pvalue)
#else
#define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
    __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, pvalue)
#endif
static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *tstate, PyObject **pvalue);
static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state);

/* PatchModuleWithCoroutine.proto */
static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code);

/* PatchGeneratorABC.proto */
static int __Pyx_patch_abc(void);

/* Generator.proto */
#define __Pyx_Generator_USED
static PyTypeObject *__pyx_GeneratorType = 0;
#define __Pyx_Generator_CheckExact(obj) (Py_TYPE(obj) == __pyx_GeneratorType)
#define __Pyx_Generator_New(body, code, closure, name, qualname, module_name)\
    __Pyx__Coroutine_New(__pyx_GeneratorType, body, code, closure, name, qualname, module_name)
static PyObject *__Pyx_Generator_Next(PyObject *self);
static int __pyx_Generator_init(void);

/* CheckBinaryVersion.proto */
static int __Pyx_check_binary_version(void);

/* FunctionExport.proto */
static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig);

/* FunctionImport.proto */
static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig);

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


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

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

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

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

/* Module declarations from 'cython' */

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

/* Module declarations from '__builtin__' */

/* Module declarations from 'cpython.type' */
static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;

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

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

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

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

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

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

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

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

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

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

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

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

/* Module declarations from '__builtin__' */

/* Module declarations from 'cpython.bool' */
static PyTypeObject *__pyx_ptype_7cpython_4bool_bool = 0;

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

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

/* Module declarations from '__builtin__' */

/* Module declarations from 'cpython.complex' */
static PyTypeObject *__pyx_ptype_7cpython_7complex_complex = 0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/* Module declarations from 'cpython' */

/* Module declarations from 'array' */

/* Module declarations from 'cpython.array' */
static PyTypeObject *__pyx_ptype_7cpython_5array_array = 0;
static CYTHON_INLINE int __pyx_f_7cpython_5array_extend_buffer(arrayobject *, char *, Py_ssize_t); /*proto*/

/* Module declarations from 'posix.types' */

/* Module declarations from 'pysam.libchtslib' */
static PyTypeObject *__pyx_ptype_5pysam_10libchtslib_HTSFile = 0;

/* Module declarations from 'pysam.libcfaidx' */
static PyTypeObject *__pyx_ptype_5pysam_9libcfaidx_FastaFile = 0;
static PyTypeObject *__pyx_ptype_5pysam_9libcfaidx_FastqProxy = 0;
static PyTypeObject *__pyx_ptype_5pysam_9libcfaidx_FastxRecord = 0;
static PyTypeObject *__pyx_ptype_5pysam_9libcfaidx_FastxFile = 0;
static PyTypeObject *__pyx_ptype_5pysam_9libcfaidx_FastqFile = 0;
static PyTypeObject *__pyx_ptype_5pysam_9libcfaidx_Fastafile = 0;

/* Module declarations from 'pysam.libcbcf' */
static PyTypeObject *__pyx_ptype_5pysam_7libcbcf_VariantHeader = 0;
static PyTypeObject *__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord = 0;
static PyTypeObject *__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecords = 0;
static PyTypeObject *__pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs = 0;
static PyTypeObject *__pyx_ptype_5pysam_7libcbcf_VariantHeaderSamples = 0;
static PyTypeObject *__pyx_ptype_5pysam_7libcbcf_VariantContig = 0;
static PyTypeObject *__pyx_ptype_5pysam_7libcbcf_VariantMetadata = 0;
static PyTypeObject *__pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata = 0;
static PyTypeObject *__pyx_ptype_5pysam_7libcbcf_VariantRecord = 0;
static PyTypeObject *__pyx_ptype_5pysam_7libcbcf_VariantRecordFilter = 0;
static PyTypeObject *__pyx_ptype_5pysam_7libcbcf_VariantRecordFormat = 0;
static PyTypeObject *__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo = 0;
static PyTypeObject *__pyx_ptype_5pysam_7libcbcf_VariantRecordSamples = 0;
static PyTypeObject *__pyx_ptype_5pysam_7libcbcf_VariantRecordSample = 0;
static PyTypeObject *__pyx_ptype_5pysam_7libcbcf_BaseIndex = 0;
static PyTypeObject *__pyx_ptype_5pysam_7libcbcf_BCFIndex = 0;
static PyTypeObject *__pyx_ptype_5pysam_7libcbcf_TabixIndex = 0;
static PyTypeObject *__pyx_ptype_5pysam_7libcbcf_BaseIterator = 0;
static PyTypeObject *__pyx_ptype_5pysam_7libcbcf_BCFIterator = 0;
static PyTypeObject *__pyx_ptype_5pysam_7libcbcf_TabixIterator = 0;
static PyTypeObject *__pyx_ptype_5pysam_7libcbcf_VariantFile = 0;

/* Module declarations from 'aldy.indelpost.variant' */
static PyTypeObject *__pyx_ptype_4aldy_9indelpost_7variant_NullVariant = 0;
static PyTypeObject *__pyx_ptype_4aldy_9indelpost_7variant_Variant = 0;

/* Module declarations from 'aldy.indelpost.local_reference' */
static PyTypeObject *__pyx_ptype_4aldy_9indelpost_15local_reference_UnsplicedLocalReference = 0;

/* Module declarations from 'pysam.libcalignedsegment' */
static PyTypeObject *__pyx_ptype_5pysam_18libcalignedsegment_AlignedSegment = 0;
static PyTypeObject *__pyx_ptype_5pysam_18libcalignedsegment_PileupColumn = 0;
static PyTypeObject *__pyx_ptype_5pysam_18libcalignedsegment_PileupRead = 0;

/* Module declarations from 'pysam.libcalignmentfile' */
static PyTypeObject *__pyx_ptype_5pysam_17libcalignmentfile_AlignmentHeader = 0;
static PyTypeObject *__pyx_ptype_5pysam_17libcalignmentfile_AlignmentFile = 0;
static PyTypeObject *__pyx_ptype_5pysam_17libcalignmentfile_IteratorRow = 0;
static PyTypeObject *__pyx_ptype_5pysam_17libcalignmentfile_IteratorRowRegion = 0;
static PyTypeObject *__pyx_ptype_5pysam_17libcalignmentfile_IteratorRowHead = 0;
static PyTypeObject *__pyx_ptype_5pysam_17libcalignmentfile_IteratorRowAll = 0;
static PyTypeObject *__pyx_ptype_5pysam_17libcalignmentfile_IteratorRowAllRefs = 0;
static PyTypeObject *__pyx_ptype_5pysam_17libcalignmentfile_IteratorRowSelection = 0;
static PyTypeObject *__pyx_ptype_5pysam_17libcalignmentfile_IteratorColumn = 0;
static PyTypeObject *__pyx_ptype_5pysam_17libcalignmentfile_IteratorColumnRegion = 0;
static PyTypeObject *__pyx_ptype_5pysam_17libcalignmentfile_IteratorColumnAllRefs = 0;
static PyTypeObject *__pyx_ptype_5pysam_17libcalignmentfile_IteratorColumnAll = 0;
static PyTypeObject *__pyx_ptype_5pysam_17libcalignmentfile_IndexedReads = 0;

/* Module declarations from 'aldy.indelpost.utilities' */
static PyObject *(*__pyx_f_4aldy_9indelpost_9utilities_split)(PyObject *, PyObject *, int, int, int, int); /*proto*/
static PyObject *(*__pyx_f_4aldy_9indelpost_9utilities_locate_indels)(PyObject *, int); /*proto*/
static PyObject *(*__pyx_f_4aldy_9indelpost_9utilities_get_spliced_subreads)(PyObject *, int, int); /*proto*/
static int (*__pyx_f_4aldy_9indelpost_9utilities_count_lowqual_non_ref_bases)(PyObject *, PyObject *, arrayobject *, PyObject *, int); /*proto*/

/* Module declarations from 'aldy.indelpost.pileup' */
static PyTypeObject *__pyx_ptype_4aldy_9indelpost_6pileup___pyx_scope_struct____pyx_f_4aldy_9indelpost_6pileup_make_pileup = 0;
static PyTypeObject *__pyx_ptype_4aldy_9indelpost_6pileup___pyx_scope_struct_1_genexpr = 0;
static PyTypeObject *__pyx_ptype_4aldy_9indelpost_6pileup___pyx_scope_struct_2___pyx_f_4aldy_9indelpost_6pileup_dictize_read = 0;
static PyTypeObject *__pyx_ptype_4aldy_9indelpost_6pileup___pyx_scope_struct_3_genexpr = 0;
static PyTypeObject *__pyx_ptype_4aldy_9indelpost_6pileup___pyx_scope_struct_4_genexpr = 0;
static PyTypeObject *__pyx_ptype_4aldy_9indelpost_6pileup___pyx_scope_struct_5_retarget = 0;
static PyTypeObject *__pyx_ptype_4aldy_9indelpost_6pileup___pyx_scope_struct_6_update_pileup = 0;
static PyTypeObject *__pyx_ptype_4aldy_9indelpost_6pileup___pyx_scope_struct_7_genexpr = 0;
static PyObject *__pyx_f_4aldy_9indelpost_6pileup_fetch_reads(PyObject *, int, struct __pyx_obj_5pysam_17libcalignmentfile_AlignmentFile *, int, int, int); /*proto*/
static PyObject *__pyx_f_4aldy_9indelpost_6pileup_dictize_read(struct __pyx_obj_5pysam_18libcalignedsegment_AlignedSegment *, PyObject *, int, int, struct __pyx_obj_5pysam_9libcfaidx_FastaFile *, struct __pyx_obj_4aldy_9indelpost_15local_reference_UnsplicedLocalReference *, int); /*proto*/
static PyObject *__pyx_f_4aldy_9indelpost_6pileup_get_ref_seq(PyObject *, int, int, PyObject *, PyObject *, struct __pyx_obj_5pysam_9libcfaidx_FastaFile *, struct __pyx_obj_4aldy_9indelpost_15local_reference_UnsplicedLocalReference *); /*proto*/
static PyObject *__pyx_f_4aldy_9indelpost_6pileup_leftalign_indel_read(PyObject *, int, int, PyObject *, PyObject *, int, int, PyObject *, PyObject *, PyObject *, struct __pyx_obj_5pysam_9libcfaidx_FastaFile *); /*proto*/
static int __pyx_f_4aldy_9indelpost_6pileup_is_end_dirty(arrayobject *, int, int, int, int, PyObject *); /*proto*/
static PyObject *__pyx_f_4aldy_9indelpost_6pileup_parse_spliced_read(PyObject *, int, int, int, int); /*proto*/
#define __Pyx_MODULE_NAME "aldy.indelpost.pileup"
extern int __pyx_module_is_main_aldy__indelpost__pileup;
int __pyx_module_is_main_aldy__indelpost__pileup = 0;

/* Implementation of 'aldy.indelpost.pileup' */
static PyObject *__pyx_builtin_max;
static PyObject *__pyx_builtin_sum;
static PyObject *__pyx_builtin_min;
static PyObject *__pyx_builtin_zip;
static PyObject *__pyx_builtin_enumerate;
static PyObject *__pyx_builtin_MemoryError;
static const char __pyx_k_[] = "";
static const char __pyx_k_D[] = "D";
static const char __pyx_k_H[] = "H";
static const char __pyx_k_I[] = "I";
static const char __pyx_k_M[] = "M";
static const char __pyx_k_N[] = "N";
static const char __pyx_k_P[] = "P";
static const char __pyx_k_S[] = "S";
static const char __pyx_k_X[] = "X";
static const char __pyx_k_c[] = "c";
static const char __pyx_k_d[] = "d";
static const char __pyx_k_i[] = "i";
static const char __pyx_k_m[] = "m";
static const char __pyx_k_n[] = "n";
static const char __pyx_k_p[] = "p";
static const char __pyx_k__3[] = "=";
static const char __pyx_k__9[] = "-";
static const char __pyx_k_m1[] = "m1";
static const char __pyx_k_m2[] = "m2";
static const char __pyx_k_re[] = "re";
static const char __pyx_k_to[] = "to";
static const char __pyx_k__10[] = ":";
static const char __pyx_k_all[] = "all";
static const char __pyx_k_aln[] = "aln";
static const char __pyx_k_alt[] = "alt";
static const char __pyx_k_chr[] = "chr";
static const char __pyx_k_cum[] = "cum";
static const char __pyx_k_get[] = "get";
static const char __pyx_k_hit[] = "hit";
static const char __pyx_k_how[] = "how";
static const char __pyx_k_idx[] = "idx";
static const char __pyx_k_key[] = "key";
static const char __pyx_k_max[] = "max";
static const char __pyx_k_min[] = "min";
static const char __pyx_k_obj[] = "obj";
static const char __pyx_k_pos[] = "pos";
static const char __pyx_k_ref[] = "ref";
static const char __pyx_k_sum[] = "sum";
static const char __pyx_k_tmp[] = "tmp";
static const char __pyx_k_var[] = "var";
static const char __pyx_k_zip[] = "zip";
static const char __pyx_k_args[] = "args";
static const char __pyx_k_copy[] = "copy";
static const char __pyx_k_idx2[] = "idx2";
static const char __pyx_k_last[] = "last";
static const char __pyx_k_left[] = "left";
static const char __pyx_k_main[] = "__main__";
static const char __pyx_k_mapq[] = "mapq";
static const char __pyx_k_name[] = "__name__";
static const char __pyx_k_ptrn[] = "ptrn";
static const char __pyx_k_read[] = "read";
static const char __pyx_k_rpos[] = "rpos";
static const char __pyx_k_seed[] = "seed";
static const char __pyx_k_send[] = "send";
static const char __pyx_k_sort[] = "sort";
static const char __pyx_k_span[] = "span";
static const char __pyx_k_test[] = "__test__";
static const char __pyx_k_CIGAR[] = "CIGAR";
static const char __pyx_k_align[] = "align";
static const char __pyx_k_array[] = "array";
static const char __pyx_k_chrom[] = "chrom";
static const char __pyx_k_close[] = "close";
static const char __pyx_k_count[] = "count";
static const char __pyx_k_event[] = "event";
static const char __pyx_k_fetch[] = "fetch";
static const char __pyx_k_indel[] = "indel";
static const char __pyx_k_index[] = "index";
static const char __pyx_k_jndel[] = "jndel";
static const char __pyx_k_ratio[] = "ratio";
static const char __pyx_k_split[] = "split";
static const char __pyx_k_throw[] = "throw";
static const char __pyx_k_append[] = "append";
static const char __pyx_k_cutoff[] = "cutoff";
static const char __pyx_k_import[] = "__import__";
static const char __pyx_k_indels[] = "indels";
static const char __pyx_k_intron[] = "intron";
static const char __pyx_k_is_ins[] = "is_ins";
static const char __pyx_k_localn[] = "localn";
static const char __pyx_k_lt_len[] = "lt_len";
static const char __pyx_k_lt_ref[] = "lt_ref";
static const char __pyx_k_parsed[] = "parsed";
static const char __pyx_k_pileup[] = "pileup";
static const char __pyx_k_random[] = "random";
static const char __pyx_k_rt_ref[] = "rt_ref";
static const char __pyx_k_sample[] = "sample";
static const char __pyx_k_target[] = "target";
static const char __pyx_k_window[] = "window";
static const char __pyx_k_within[] = "within";
static const char __pyx_k_aligner[] = "aligner";
static const char __pyx_k_aln_end[] = "aln_end";
static const char __pyx_k_aln_len[] = "aln_len";
static const char __pyx_k_compile[] = "compile";
static const char __pyx_k_del_seq[] = "del_seq";
static const char __pyx_k_difflib[] = "difflib";
static const char __pyx_k_findall[] = "findall";
static const char __pyx_k_gap_cnt[] = "gap_cnt";
static const char __pyx_k_genexpr[] = "genexpr";
static const char __pyx_k_inplace[] = "inplace";
static const char __pyx_k_introns[] = "introns";
static const char __pyx_k_lt_qual[] = "lt_qual";
static const char __pyx_k_partial[] = "partial";
static const char __pyx_k_reduced[] = "reduced";
static const char __pyx_k_ref_seq[] = "ref_seq";
static const char __pyx_k_rt_qual[] = "rt_qual";
static const char __pyx_k_spl_end[] = "spl_end";
static const char __pyx_k_aligners[] = "aligners";
static const char __pyx_k_best_seq[] = "best_seq";
static const char __pyx_k_clip_len[] = "clip_len";
static const char __pyx_k_endswith[] = "endswith";
static const char __pyx_k_is_dirty[] = "is_dirty";
static const char __pyx_k_is_found[] = "is_found";
static const char __pyx_k_lt_cigar[] = "lt_cigar";
static const char __pyx_k_lt_flank[] = "lt_flank";
static const char __pyx_k_nofilter[] = "nofilter";
static const char __pyx_k_non_refs[] = "non_refs";
static const char __pyx_k_read_end[] = "read_end";
static const char __pyx_k_read_seq[] = "read_seq";
static const char __pyx_k_ref_alns[] = "ref_alns";
static const char __pyx_k_ref_seqs[] = "ref_seqs";
static const char __pyx_k_retarget[] = "retarget";
static const char __pyx_k_rt_cigar[] = "rt_cigar";
static const char __pyx_k_rt_flank[] = "rt_flank";
static const char __pyx_k_spl_span[] = "spl_span";
static const char __pyx_k_aln_start[] = "aln_start";
static const char __pyx_k_basequals[] = "basequals";
static const char __pyx_k_candidate[] = "candidate";
static const char __pyx_k_consensus[] = "consensus";
static const char __pyx_k_enumerate[] = "enumerate";
static const char __pyx_k_event_len[] = "event_len";
static const char __pyx_k_functools[] = "functools";
static const char __pyx_k_gappedaln[] = "gappedaln";
static const char __pyx_k_indel_seq[] = "indel_seq";
static const char __pyx_k_is_target[] = "is_target";
static const char __pyx_k_new_cigar[] = "new_cigar";
static const char __pyx_k_normalize[] = "normalize";
static const char __pyx_k_overhangs[] = "overhangs";
static const char __pyx_k_positions[] = "positions";
static const char __pyx_k_read_dict[] = "read_dict";
static const char __pyx_k_read_name[] = "read_name";
static const char __pyx_k_read_qual[] = "read_qual";
static const char __pyx_k_ref_flank[] = "ref_flank";
static const char __pyx_k_ref_start[] = "ref_start";
static const char __pyx_k_reference[] = "reference";
static const char __pyx_k_spl_spans[] = "spl_spans";
static const char __pyx_k_spl_start[] = "spl_start";
static const char __pyx_k_start_pos[] = "start_pos";
static const char __pyx_k_until_eof[] = "until_eof";
static const char __pyx_k_utilities[] = "utilities";
static const char __pyx_k_best_match[] = "best_match";
static const char __pyx_k_candidates[] = "candidates";
static const char __pyx_k_cigar_list[] = "cigar_list";
static const char __pyx_k_cigar_ptrn[] = "cigar_ptrn";
static const char __pyx_k_end_offset[] = "end_offset";
static const char __pyx_k_genome_aln[] = "genome_aln";
static const char __pyx_k_genome_ref[] = "genome_ref";
static const char __pyx_k_indel_type[] = "indel_type";
static const char __pyx_k_intron_end[] = "intron_end";
static const char __pyx_k_is_reverse[] = "is_reverse";
static const char __pyx_k_is_spliced[] = "is_spliced";
static const char __pyx_k_lt_clipped[] = "lt_clipped";
static const char __pyx_k_new_target[] = "new_target";
static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
static const char __pyx_k_query_name[] = "query_name";
static const char __pyx_k_read_start[] = "read_start";
static const char __pyx_k_ref_starts[] = "ref_starts";
static const char __pyx_k_references[] = "references";
static const char __pyx_k_rt_clipped[] = "rt_clipped";
static const char __pyx_k_target_len[] = "target_len";
static const char __pyx_k_target_pos[] = "target_pos";
static const char __pyx_k_target_seq[] = "target_seq";
static const char __pyx_k_this_event[] = "this_event";
static const char __pyx_k_window_len[] = "window_len";
static const char __pyx_k_MemoryError[] = "MemoryError";
static const char __pyx_k_cigarstring[] = "cigarstring";
static const char __pyx_k_complex_del[] = "complex_del";
static const char __pyx_k_complex_ins[] = "complex_ins";
static const char __pyx_k_current_pos[] = "current_pos";
static const char __pyx_k_flank_cigar[] = "flank_cigar";
static const char __pyx_k_get_ref_seq[] = "get_ref_seq";
static const char __pyx_k_intron_ptrn[] = "intron_ptrn";
static const char __pyx_k_is_covering[] = "is_covering";
static const char __pyx_k_is_overhang[] = "is_overhang";
static const char __pyx_k_left_adjust[] = "left_adjust";
static const char __pyx_k_lt_exon_end[] = "lt_exon_end";
static const char __pyx_k_lt_read_lim[] = "lt_read_lim";
static const char __pyx_k_match_score[] = "match_score";
static const char __pyx_k_most_common[] = "most_common";
static const char __pyx_k_realn_cigar[] = "realn_cigar";
static const char __pyx_k_rt_read_lim[] = "rt_read_lim";
static const char __pyx_k_splice_prtn[] = "splice_prtn";
static const char __pyx_k_splice_ptrn[] = "splice_ptrn";
static const char __pyx_k_splice_rate[] = "splice_rate";
static const char __pyx_k_split_cigar[] = "split_cigar";
static const char __pyx_k_target_type[] = "target_type";
static const char __pyx_k_0_9_MIDNSHPX[] = "[0-9]+[MIDNSHPX=]";
static const char __pyx_k_aligned_frac[] = "aligned_frac";
static const char __pyx_k_cigar_string[] = "cigar_string";
static const char __pyx_k_genome_cigar[] = "genome_cigar";
static const char __pyx_k_genome_score[] = "genome_score";
static const char __pyx_k_intron_ptrns[] = "intron_ptrns";
static const char __pyx_k_intron_start[] = "intron_start";
static const char __pyx_k_is_duplicate[] = "is_duplicate";
static const char __pyx_k_is_end_dirty[] = "is_end_dirty";
static const char __pyx_k_is_secondary[] = "is_secondary";
static const char __pyx_k_junction_aln[] = "junction_aln";
static const char __pyx_k_junction_ref[] = "junction_ref";
static const char __pyx_k_make_aligner[] = "make_aligner";
static const char __pyx_k_numeric_span[] = "numeric_span";
static const char __pyx_k_right_adjust[] = "right_adjust";
static const char __pyx_k_spl_span_lst[] = "spl_span_lst";
static const char __pyx_k_start_offset[] = "start_offset";
static const char __pyx_k_target_event[] = "target_event";
static const char __pyx_k_tmp_non_refs[] = "tmp_non_refs";
static const char __pyx_k_to_flat_list[] = "to_flat_list";
static const char __pyx_k_u_candidates[] = "u_candidates";
static const char __pyx_k_update_cigar[] = "update_cigar";
static const char __pyx_k_variant_type[] = "variant_type";
static const char __pyx_k_bypass_search[] = "bypass_search";
static const char __pyx_k_cigar_updated[] = "cigar_updated";
static const char __pyx_k_clipped_bases[] = "clipped_bases";
static const char __pyx_k_complex_flags[] = "complex_flags";
static const char __pyx_k_get_indel_seq[] = "_get_indel_seq";
static const char __pyx_k_is_gapped_aln[] = "is_gapped_aln";
static const char __pyx_k_is_junctional[] = "is_junctional";
static const char __pyx_k_lt_most_cigar[] = "lt_most_cigar";
static const char __pyx_k_mapq4retarget[] = "mapq4retarget";
static const char __pyx_k_optimal_score[] = "optimal_score";
static const char __pyx_k_read_callback[] = "read_callback";
static const char __pyx_k_reference_end[] = "reference_end";
static const char __pyx_k_rt_exon_start[] = "rt_exon_start";
static const char __pyx_k_rt_most_cigar[] = "rt_most_cigar";
static const char __pyx_k_trailing_clip[] = "trailing_clip";
static const char __pyx_k_unspl_loc_ref[] = "unspl_loc_ref";
static const char __pyx_k_update_pileup[] = "update_pileup";
static const char __pyx_k_basequalthresh[] = "basequalthresh";
static const char __pyx_k_candidate_seqs[] = "candidate_seqs";
static const char __pyx_k_cplx_candidate[] = "cplx_candidate";
static const char __pyx_k_findall_indels[] = "findall_indels";
static const char __pyx_k_genome_aligner[] = "genome_aligner";
static const char __pyx_k_genome_aln_pos[] = "genome_aln_pos";
static const char __pyx_k_intron_pattern[] = "intron_pattern";
static const char __pyx_k_is_worth_realn[] = "is_worth_realn";
static const char __pyx_k_junction_score[] = "junction_score";
static const char __pyx_k_query_sequence[] = "query_sequence";
static const char __pyx_k_realn_lt_cigar[] = "realn_lt_cigar";
static const char __pyx_k_realn_rt_cigar[] = "realn_rt_cigar";
static const char __pyx_k_retargetcutoff[] = "retargetcutoff";
static const char __pyx_k_splice_pattern[] = "splice_pattern";
static const char __pyx_k_trim_ref_flank[] = "trim_ref_flank";
static const char __pyx_k_SequenceMatcher[] = "SequenceMatcher";
static const char __pyx_k_candidate_reads[] = "candidate_reads";
static const char __pyx_k_check_overhangs[] = "check_overhangs";
static const char __pyx_k_mapping_quality[] = "mapping_quality";
static const char __pyx_k_query_qualities[] = "query_qualities";
static const char __pyx_k_read_end_thresh[] = "read_end_thresh";
static const char __pyx_k_reference_start[] = "reference_start";
static const char __pyx_k_skip_validation[] = "skip_validation";
static const char __pyx_k_aligned_read_len[] = "aligned_read_len";
static const char __pyx_k_consensus_refseq[] = "consensus_refseq";
static const char __pyx_k_covering_subread[] = "covering_subread";
static const char __pyx_k_gap_open_penalty[] = "gap_open_penalty";
static const char __pyx_k_is_reference_seq[] = "is_reference_seq";
static const char __pyx_k_is_within_intron[] = "is_within_intron";
static const char __pyx_k_junction_aligner[] = "junction_aligner";
static const char __pyx_k_mismatch_penalty[] = "mismatch_penalty";
static const char __pyx_k_update_read_info[] = "update_read_info";
static const char __pyx_k_complex_positions[] = "complex_positions";
static const char __pyx_k_get_close_matches[] = "get_close_matches";
static const char __pyx_k_low_qual_base_num[] = "low_qual_base_num";
static const char __pyx_k_orig_cigar_string[] = "orig_cigar_string";
static const char __pyx_k_overhang_aligners[] = "overhang_aligners";
static const char __pyx_k_candidate_aligners[] = "candidate_aligners";
static const char __pyx_k_candidate_ref_seqs[] = "candidate_ref_seqs";
static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
static const char __pyx_k_complex_candidates[] = "complex_candidates";
static const char __pyx_k_findall_mismatches[] = "findall_mismatches";
static const char __pyx_k_junctional_aligner[] = "junctional_aligner";
static const char __pyx_k_target_type_indels[] = "target_type_indels";
static const char __pyx_k_get_local_reference[] = "get_local_reference";
static const char __pyx_k_get_mapped_subreads[] = "get_mapped_subreads";
static const char __pyx_k_candidate_ref_starts[] = "candidate_ref_starts";
static const char __pyx_k_generate_equivalents[] = "generate_equivalents";
static const char __pyx_k_get_reference_length[] = "get_reference_length";
static const char __pyx_k_indels_within_intron[] = "indels_within_intron";
static const char __pyx_k_is_non_complex_indel[] = "is_non_complex_indel";
static const char __pyx_k_make_insertion_first[] = "make_insertion_first";
static const char __pyx_k_reduce_complex_indel[] = "_reduce_complex_indel";
static const char __pyx_k_aldy_indelpost_pileup[] = "aldy.indelpost.pileup";
static const char __pyx_k_find_by_normalization[] = "find_by_normalization";
static const char __pyx_k_gap_extension_penalty[] = "gap_extension_penalty";
static const char __pyx_k_update_read_positions[] = "update_read_positions";
static const char __pyx_k_indel_pos_in_this_read[] = "indel_pos_in_this_read";
static const char __pyx_k_non_spurious_overhangs[] = "non_spurious_overhangs";
static const char __pyx_k_retarget_locals_lambda[] = "retarget.<locals>.<lambda>";
static const char __pyx_k_is_non_spurious_overhang[] = "is_non_spurious_overhang";
static const char __pyx_k_aldy_indelpost_pileup_pyx[] = "aldy/indelpost/pileup.pyx";
static const char __pyx_k_filter_spurious_overhangs[] = "filter_spurious_overhangs";
static const char __pyx_k_make_pileup_locals_genexpr[] = "make_pileup.<locals>.genexpr";
static const char __pyx_k_dictize_read_locals_genexpr[] = "dictize_read.<locals>.genexpr";
static const char __pyx_k_require_exact_for_shiftable[] = "require_exact_for_shiftable";
static const char __pyx_k_generate_equivalents_private[] = "_generate_equivalents_private";
static const char __pyx_k_update_pileup_locals_genexpr[] = "update_pileup.<locals>.genexpr";
static PyObject *__pyx_kp_u_;
static PyObject *__pyx_kp_u_0_9_MIDNSHPX;
static PyObject *__pyx_n_s_CIGAR;
static PyObject *__pyx_n_u_D;
static PyObject *__pyx_n_u_H;
static PyObject *__pyx_n_u_I;
static PyObject *__pyx_n_u_M;
static PyObject *__pyx_n_s_MemoryError;
static PyObject *__pyx_n_u_N;
static PyObject *__pyx_n_u_P;
static PyObject *__pyx_n_u_S;
static PyObject *__pyx_n_s_SequenceMatcher;
static PyObject *__pyx_n_u_X;
static PyObject *__pyx_kp_u__10;
static PyObject *__pyx_kp_u__3;
static PyObject *__pyx_kp_u__9;
static PyObject *__pyx_n_s_aldy_indelpost_pileup;
static PyObject *__pyx_kp_s_aldy_indelpost_pileup_pyx;
static PyObject *__pyx_n_s_align;
static PyObject *__pyx_n_s_aligned_frac;
static PyObject *__pyx_n_s_aligned_read_len;
static PyObject *__pyx_n_s_aligner;
static PyObject *__pyx_n_s_aligners;
static PyObject *__pyx_n_u_all;
static PyObject *__pyx_n_s_aln;
static PyObject *__pyx_n_u_aln_end;
static PyObject *__pyx_n_s_aln_len;
static PyObject *__pyx_n_u_aln_start;
static PyObject *__pyx_n_s_alt;
static PyObject *__pyx_n_s_append;
static PyObject *__pyx_n_s_args;
static PyObject *__pyx_n_s_array;
static PyObject *__pyx_n_s_basequals;
static PyObject *__pyx_n_s_basequalthresh;
static PyObject *__pyx_n_s_best_match;
static PyObject *__pyx_n_s_best_seq;
static PyObject *__pyx_n_s_bypass_search;
static PyObject *__pyx_n_s_c;
static PyObject *__pyx_n_s_candidate;
static PyObject *__pyx_n_s_candidate_aligners;
static PyObject *__pyx_n_s_candidate_reads;
static PyObject *__pyx_n_s_candidate_ref_seqs;
static PyObject *__pyx_n_s_candidate_ref_starts;
static PyObject *__pyx_n_s_candidate_seqs;
static PyObject *__pyx_n_s_candidates;
static PyObject *__pyx_n_s_check_overhangs;
static PyObject *__pyx_n_u_chr;
static PyObject *__pyx_n_s_chrom;
static PyObject *__pyx_n_u_cigar_list;
static PyObject *__pyx_n_s_cigar_ptrn;
static PyObject *__pyx_n_u_cigar_string;
static PyObject *__pyx_n_u_cigar_updated;
static PyObject *__pyx_n_s_cigarstring;
static PyObject *__pyx_n_s_cline_in_traceback;
static PyObject *__pyx_n_s_clip_len;
static PyObject *__pyx_n_s_clipped_bases;
static PyObject *__pyx_n_s_close;
static PyObject *__pyx_n_s_compile;
static PyObject *__pyx_n_s_complex_candidates;
static PyObject *__pyx_n_s_complex_del;
static PyObject *__pyx_n_s_complex_flags;
static PyObject *__pyx_n_s_complex_ins;
static PyObject *__pyx_n_s_complex_positions;
static PyObject *__pyx_n_s_consensus;
static PyObject *__pyx_n_s_consensus_refseq;
static PyObject *__pyx_n_s_copy;
static PyObject *__pyx_n_s_count;
static PyObject *__pyx_n_s_covering_subread;
static PyObject *__pyx_n_u_covering_subread;
static PyObject *__pyx_n_s_cplx_candidate;
static PyObject *__pyx_n_s_cum;
static PyObject *__pyx_n_s_current_pos;
static PyObject *__pyx_n_s_cutoff;
static PyObject *__pyx_n_s_d;
static PyObject *__pyx_n_u_del_seq;
static PyObject *__pyx_n_s_dictize_read_locals_genexpr;
static PyObject *__pyx_n_s_difflib;
static PyObject *__pyx_n_u_end_offset;
static PyObject *__pyx_n_s_endswith;
static PyObject *__pyx_n_s_enumerate;
static PyObject *__pyx_n_s_event;
static PyObject *__pyx_n_s_event_len;
static PyObject *__pyx_n_s_fetch;
static PyObject *__pyx_n_s_filter_spurious_overhangs;
static PyObject *__pyx_n_s_find_by_normalization;
static PyObject *__pyx_n_s_findall;
static PyObject *__pyx_n_s_findall_indels;
static PyObject *__pyx_n_s_findall_mismatches;
static PyObject *__pyx_n_s_flank_cigar;
static PyObject *__pyx_n_s_functools;
static PyObject *__pyx_n_s_gap_cnt;
static PyObject *__pyx_n_s_gap_extension_penalty;
static PyObject *__pyx_n_s_gap_open_penalty;
static PyObject *__pyx_n_s_gappedaln;
static PyObject *__pyx_n_s_generate_equivalents;
static PyObject *__pyx_n_s_generate_equivalents_private;
static PyObject *__pyx_n_s_genexpr;
static PyObject *__pyx_n_s_genome_aligner;
static PyObject *__pyx_n_s_genome_aln;
static PyObject *__pyx_n_s_genome_aln_pos;
static PyObject *__pyx_n_s_genome_cigar;
static PyObject *__pyx_n_s_genome_ref;
static PyObject *__pyx_n_s_genome_score;
static PyObject *__pyx_n_s_get;
static PyObject *__pyx_n_s_get_close_matches;
static PyObject *__pyx_n_s_get_indel_seq;
static PyObject *__pyx_n_s_get_local_reference;
static PyObject *__pyx_n_s_get_mapped_subreads;
static PyObject *__pyx_n_s_get_ref_seq;
static PyObject *__pyx_n_s_get_reference_length;
static PyObject *__pyx_n_s_hit;
static PyObject *__pyx_n_s_how;
static PyObject *__pyx_n_s_i;
static PyObject *__pyx_n_s_idx;
static PyObject *__pyx_n_s_idx2;
static PyObject *__pyx_n_s_import;
static PyObject *__pyx_n_s_indel;
static PyObject *__pyx_n_s_indel_pos_in_this_read;
static PyObject *__pyx_n_s_indel_seq;
static PyObject *__pyx_n_u_indel_seq;
static PyObject *__pyx_n_u_indel_type;
static PyObject *__pyx_n_s_indels;
static PyObject *__pyx_n_s_indels_within_intron;
static PyObject *__pyx_n_s_index;
static PyObject *__pyx_n_s_inplace;
static PyObject *__pyx_n_s_intron;
static PyObject *__pyx_n_s_intron_end;
static PyObject *__pyx_n_u_intron_pattern;
static PyObject *__pyx_n_s_intron_ptrn;
static PyObject *__pyx_n_s_intron_ptrns;
static PyObject *__pyx_n_s_intron_start;
static PyObject *__pyx_n_s_introns;
static PyObject *__pyx_n_s_is_covering;
static PyObject *__pyx_n_u_is_covering;
static PyObject *__pyx_n_u_is_dirty;
static PyObject *__pyx_n_s_is_duplicate;
static PyObject *__pyx_n_u_is_end_dirty;
static PyObject *__pyx_n_s_is_found;
static PyObject *__pyx_n_s_is_gapped_aln;
static PyObject *__pyx_n_s_is_ins;
static PyObject *__pyx_n_s_is_junctional;
static PyObject *__pyx_n_s_is_non_complex_indel;
static PyObject *__pyx_n_s_is_non_spurious_overhang;
static PyObject *__pyx_n_s_is_overhang;
static PyObject *__pyx_n_u_is_reference_seq;
static PyObject *__pyx_n_s_is_reverse;
static PyObject *__pyx_n_u_is_reverse;
static PyObject *__pyx_n_s_is_secondary;
static PyObject *__pyx_n_s_is_spliced;
static PyObject *__pyx_n_u_is_spliced;
static PyObject *__pyx_n_u_is_target;
static PyObject *__pyx_n_s_is_within_intron;
static PyObject *__pyx_n_s_is_worth_realn;
static PyObject *__pyx_n_u_is_worth_realn;
static PyObject *__pyx_n_s_jndel;
static PyObject *__pyx_n_s_junction_aligner;
static PyObject *__pyx_n_s_junction_aln;
static PyObject *__pyx_n_s_junction_ref;
static PyObject *__pyx_n_s_junction_score;
static PyObject *__pyx_n_s_junctional_aligner;
static PyObject *__pyx_n_s_key;
static PyObject *__pyx_n_s_last;
static PyObject *__pyx_n_s_left;
static PyObject *__pyx_n_s_left_adjust;
static PyObject *__pyx_n_s_localn;
static PyObject *__pyx_n_u_low_qual_base_num;
static PyObject *__pyx_n_u_lt_cigar;
static PyObject *__pyx_n_u_lt_clipped;
static PyObject *__pyx_n_s_lt_exon_end;
static PyObject *__pyx_n_u_lt_flank;
static PyObject *__pyx_n_s_lt_len;
static PyObject *__pyx_n_s_lt_most_cigar;
static PyObject *__pyx_n_u_lt_qual;
static PyObject *__pyx_n_s_lt_read_lim;
static PyObject *__pyx_n_u_lt_ref;
static PyObject *__pyx_n_s_m;
static PyObject *__pyx_n_s_m1;
static PyObject *__pyx_n_s_m2;
static PyObject *__pyx_n_s_main;
static PyObject *__pyx_n_s_make_aligner;
static PyObject *__pyx_n_s_make_insertion_first;
static PyObject *__pyx_n_s_make_pileup_locals_genexpr;
static PyObject *__pyx_n_s_mapping_quality;
static PyObject *__pyx_n_u_mapq;
static PyObject *__pyx_n_s_mapq4retarget;
static PyObject *__pyx_n_s_match_score;
static PyObject *__pyx_n_s_max;
static PyObject *__pyx_n_s_min;
static PyObject *__pyx_n_s_mismatch_penalty;
static PyObject *__pyx_n_s_most_common;
static PyObject *__pyx_n_s_n;
static PyObject *__pyx_n_s_name;
static PyObject *__pyx_n_s_new_cigar;
static PyObject *__pyx_n_s_new_target;
static PyObject *__pyx_n_u_nofilter;
static PyObject *__pyx_n_s_non_refs;
static PyObject *__pyx_n_s_non_spurious_overhangs;
static PyObject *__pyx_n_s_normalize;
static PyObject *__pyx_n_s_numeric_span;
static PyObject *__pyx_n_s_obj;
static PyObject *__pyx_n_s_optimal_score;
static PyObject *__pyx_n_s_orig_cigar_string;
static PyObject *__pyx_n_s_overhang_aligners;
static PyObject *__pyx_n_s_overhangs;
static PyObject *__pyx_n_s_p;
static PyObject *__pyx_n_s_parsed;
static PyObject *__pyx_n_s_partial;
static PyObject *__pyx_n_s_pileup;
static PyObject *__pyx_n_s_pos;
static PyObject *__pyx_n_u_pos;
static PyObject *__pyx_n_s_positions;
static PyObject *__pyx_n_s_ptrn;
static PyObject *__pyx_n_s_pyx_vtable;
static PyObject *__pyx_n_s_query_name;
static PyObject *__pyx_n_s_query_qualities;
static PyObject *__pyx_n_s_query_sequence;
static PyObject *__pyx_n_s_random;
static PyObject *__pyx_n_s_ratio;
static PyObject *__pyx_n_s_re;
static PyObject *__pyx_n_s_read;
static PyObject *__pyx_n_u_read;
static PyObject *__pyx_n_s_read_callback;
static PyObject *__pyx_n_s_read_dict;
static PyObject *__pyx_n_s_read_end;
static PyObject *__pyx_n_u_read_end;
static PyObject *__pyx_n_s_read_end_thresh;
static PyObject *__pyx_n_u_read_name;
static PyObject *__pyx_n_u_read_qual;
static PyObject *__pyx_n_s_read_seq;
static PyObject *__pyx_n_u_read_seq;
static PyObject *__pyx_n_s_read_start;
static PyObject *__pyx_n_u_read_start;
static PyObject *__pyx_n_s_realn_cigar;
static PyObject *__pyx_n_s_realn_lt_cigar;
static PyObject *__pyx_n_s_realn_rt_cigar;
static PyObject *__pyx_n_s_reduce_complex_indel;
static PyObject *__pyx_n_s_reduced;
static PyObject *__pyx_n_s_ref;
static PyObject *__pyx_n_s_ref_alns;
static PyObject *__pyx_n_s_ref_flank;
static PyObject *__pyx_n_s_ref_seq;
static PyObject *__pyx_n_u_ref_seq;
static PyObject *__pyx_n_s_ref_seqs;
static PyObject *__pyx_n_s_ref_start;
static PyObject *__pyx_n_s_ref_starts;
static PyObject *__pyx_n_s_reference;
static PyObject *__pyx_n_s_reference_end;
static PyObject *__pyx_n_s_reference_start;
static PyObject *__pyx_n_s_references;
static PyObject *__pyx_n_s_require_exact_for_shiftable;
static PyObject *__pyx_n_s_retarget;
static PyObject *__pyx_n_s_retarget_locals_lambda;
static PyObject *__pyx_n_s_retargetcutoff;
static PyObject *__pyx_n_s_right_adjust;
static PyObject *__pyx_n_s_rpos;
static PyObject *__pyx_n_u_rt_cigar;
static PyObject *__pyx_n_u_rt_clipped;
static PyObject *__pyx_n_s_rt_exon_start;
static PyObject *__pyx_n_u_rt_flank;
static PyObject *__pyx_n_s_rt_most_cigar;
static PyObject *__pyx_n_u_rt_qual;
static PyObject *__pyx_n_s_rt_read_lim;
static PyObject *__pyx_n_u_rt_ref;
static PyObject *__pyx_n_s_sample;
static PyObject *__pyx_n_s_seed;
static PyObject *__pyx_n_s_send;
static PyObject *__pyx_n_s_skip_validation;
static PyObject *__pyx_n_s_sort;
static PyObject *__pyx_n_s_span;
static PyObject *__pyx_n_s_spl_end;
static PyObject *__pyx_n_s_spl_span;
static PyObject *__pyx_n_s_spl_span_lst;
static PyObject *__pyx_n_s_spl_spans;
static PyObject *__pyx_n_s_spl_start;
static PyObject *__pyx_n_u_splice_pattern;
static PyObject *__pyx_n_s_splice_prtn;
static PyObject *__pyx_n_s_splice_ptrn;
static PyObject *__pyx_n_s_splice_rate;
static PyObject *__pyx_n_s_split;
static PyObject *__pyx_n_s_split_cigar;
static PyObject *__pyx_n_u_start_offset;
static PyObject *__pyx_n_s_start_pos;
static PyObject *__pyx_n_s_sum;
static PyObject *__pyx_n_s_target;
static PyObject *__pyx_n_s_target_event;
static PyObject *__pyx_n_s_target_len;
static PyObject *__pyx_n_s_target_pos;
static PyObject *__pyx_n_s_target_seq;
static PyObject *__pyx_n_s_target_type;
static PyObject *__pyx_n_s_target_type_indels;
static PyObject *__pyx_n_s_test;
static PyObject *__pyx_n_s_this_event;
static PyObject *__pyx_n_s_throw;
static PyObject *__pyx_n_s_tmp;
static PyObject *__pyx_n_s_tmp_non_refs;
static PyObject *__pyx_n_s_to;
static PyObject *__pyx_n_s_to_flat_list;
static PyObject *__pyx_n_s_trailing_clip;
static PyObject *__pyx_n_s_trim_ref_flank;
static PyObject *__pyx_n_s_u_candidates;
static PyObject *__pyx_n_s_unspl_loc_ref;
static PyObject *__pyx_n_s_until_eof;
static PyObject *__pyx_n_s_update_cigar;
static PyObject *__pyx_n_s_update_pileup;
static PyObject *__pyx_n_s_update_pileup_locals_genexpr;
static PyObject *__pyx_n_s_update_read_info;
static PyObject *__pyx_n_s_update_read_positions;
static PyObject *__pyx_n_s_utilities;
static PyObject *__pyx_n_s_var;
static PyObject *__pyx_n_s_variant_type;
static PyObject *__pyx_n_s_window;
static PyObject *__pyx_n_s_window_len;
static PyObject *__pyx_n_s_within;
static PyObject *__pyx_n_s_zip;
static PyObject *__pyx_pf_4aldy_9indelpost_6pileup_11make_pileup_genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_4aldy_9indelpost_6pileup_is_within_intron(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_read, PyObject *__pyx_v_pos, PyObject *__pyx_v_window); /* proto */
static PyObject *__pyx_pf_4aldy_9indelpost_6pileup_12dictize_read_genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_4aldy_9indelpost_6pileup_12dictize_read_3genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_4aldy_9indelpost_6pileup_2check_overhangs(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pileup, PyObject *__pyx_v_splice_rate); /* proto */
static PyObject *__pyx_pf_4aldy_9indelpost_6pileup_4is_junctional(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_read); /* proto */
static PyObject *__pyx_pf_4aldy_9indelpost_6pileup_6is_overhang(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_read, PyObject *__pyx_v_intron_start, PyObject *__pyx_v_intron_end); /* proto */
static PyObject *__pyx_pf_4aldy_9indelpost_6pileup_8overhang_aligners(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_target, PyObject *__pyx_v_intron, PyObject *__pyx_v_match_score, PyObject *__pyx_v_mismatch_penalty); /* proto */
static PyObject *__pyx_pf_4aldy_9indelpost_6pileup_10filter_spurious_overhangs(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_target, PyObject *__pyx_v_intron, PyObject *__pyx_v_overhangs, PyObject *__pyx_v_match_score, PyObject *__pyx_v_mismatch_penalty, PyObject *__pyx_v_gap_open_penalty, PyObject *__pyx_v_gap_extension_penalty); /* proto */
static PyObject *__pyx_pf_4aldy_9indelpost_6pileup_12is_non_spurious_overhang(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_read, PyObject *__pyx_v_target, PyObject *__pyx_v_intron, PyObject *__pyx_v_genome_aligner, PyObject *__pyx_v_junction_aligner, PyObject *__pyx_v_match_score, CYTHON_UNUSED PyObject *__pyx_v_mismatch_penalty, PyObject *__pyx_v_gap_open_penalty, PyObject *__pyx_v_gap_extension_penalty); /* proto */
static PyObject *__pyx_lambda_funcdef_lambda3(PyObject *__pyx_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_4aldy_9indelpost_6pileup_14retarget(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_target, PyObject *__pyx_v_pileup, PyObject *__pyx_v_window, PyObject *__pyx_v_mapq4retarget, PyObject *__pyx_v_within, PyObject *__pyx_v_retargetcutoff, PyObject *__pyx_v_match_score, PyObject *__pyx_v_mismatch_penalty, PyObject *__pyx_v_gap_open_penalty, PyObject *__pyx_v_gap_extension_penalty, PyObject *__pyx_v_unspl_loc_ref, PyObject *__pyx_v_require_exact_for_shiftable); /* proto */
static PyObject *__pyx_pf_4aldy_9indelpost_6pileup_16update_read_info(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_read, PyObject *__pyx_v_candidate, PyObject *__pyx_v_is_gapped_aln, PyObject *__pyx_v_gap_open_penalty, PyObject *__pyx_v_gap_extension_penalty, PyObject *__pyx_v_aligner, PyObject *__pyx_v_ref_seq, PyObject *__pyx_v_ref_start); /* proto */
static PyObject *__pyx_pf_4aldy_9indelpost_6pileup_18trim_ref_flank(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_ref_flank, PyObject *__pyx_v_flank_cigar, PyObject *__pyx_v_left); /* proto */
static PyObject *__pyx_pf_4aldy_9indelpost_6pileup_20update_cigar(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_orig_cigar_string, PyObject *__pyx_v_realn_cigar, PyObject *__pyx_v_start_pos, PyObject *__pyx_v_splice_prtn, PyObject *__pyx_v_clipped_bases, PyObject *__pyx_v_left); /* proto */
static PyObject *__pyx_pf_4aldy_9indelpost_6pileup_22numeric_span(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_spl_span); /* proto */
static PyObject *__pyx_pf_4aldy_9indelpost_6pileup_24update_read_positions(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_read, PyObject *__pyx_v_target_pos); /* proto */
static PyObject *__pyx_pf_4aldy_9indelpost_6pileup_13update_pileup_genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_4aldy_9indelpost_6pileup_26update_pileup(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pileup, PyObject *__pyx_v_new_target, PyObject *__pyx_v_window, PyObject *__pyx_v_match_score, PyObject *__pyx_v_mismatch_penalty, PyObject *__pyx_v_gap_open_penalty, PyObject *__pyx_v_gap_extension_penalty, PyObject *__pyx_v_basequalthresh, PyObject *__pyx_v_bypass_search); /* proto */
static int __pyx_pf_7cpython_5array_5array___getbuffer__(arrayobject *__pyx_v_self, Py_buffer *__pyx_v_info, CYTHON_UNUSED int __pyx_v_flags); /* proto */
static void __pyx_pf_7cpython_5array_5array_2__releasebuffer__(CYTHON_UNUSED arrayobject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */
static PyObject *__pyx_tp_new_4aldy_9indelpost_6pileup___pyx_scope_struct____pyx_f_4aldy_9indelpost_6pileup_make_pileup(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4aldy_9indelpost_6pileup___pyx_scope_struct_1_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4aldy_9indelpost_6pileup___pyx_scope_struct_2___pyx_f_4aldy_9indelpost_6pileup_dictize_read(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4aldy_9indelpost_6pileup___pyx_scope_struct_3_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4aldy_9indelpost_6pileup___pyx_scope_struct_4_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4aldy_9indelpost_6pileup___pyx_scope_struct_5_retarget(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4aldy_9indelpost_6pileup___pyx_scope_struct_6_update_pileup(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4aldy_9indelpost_6pileup___pyx_scope_struct_7_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static __Pyx_CachedCFunction __pyx_umethod_PyList_Type_copy = {0, &__pyx_n_s_copy, 0, 0, 0};
static __Pyx_CachedCFunction __pyx_umethod_PyList_Type_count = {0, &__pyx_n_s_count, 0, 0, 0};
static __Pyx_CachedCFunction __pyx_umethod_PyList_Type_index = {0, &__pyx_n_s_index, 0, 0, 0};
static PyObject *__pyx_float_0_2;
static PyObject *__pyx_float_0_7;
static PyObject *__pyx_float_1_0;
static PyObject *__pyx_float_1_2;
static PyObject *__pyx_float_0_15;
static PyObject *__pyx_float_0_98;
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static PyObject *__pyx_int_2;
static PyObject *__pyx_int_3;
static PyObject *__pyx_int_4;
static PyObject *__pyx_int_6;
static PyObject *__pyx_int_50;
static PyObject *__pyx_int_100;
static PyObject *__pyx_int_123;
static PyObject *__pyx_int_neg_1;
static PyObject *__pyx_int_neg_3;
static PyObject *__pyx_slice__4;
static PyObject *__pyx_slice__5;
static PyObject *__pyx_slice__6;
static PyObject *__pyx_slice__7;
static PyObject *__pyx_slice__8;
static PyObject *__pyx_tuple__2;
static PyObject *__pyx_slice__14;
static PyObject *__pyx_tuple__11;
static PyObject *__pyx_tuple__12;
static PyObject *__pyx_tuple__13;
static PyObject *__pyx_tuple__15;
static PyObject *__pyx_tuple__16;
static PyObject *__pyx_tuple__17;
static PyObject *__pyx_tuple__19;
static PyObject *__pyx_tuple__21;
static PyObject *__pyx_tuple__23;
static PyObject *__pyx_tuple__25;
static PyObject *__pyx_tuple__27;
static PyObject *__pyx_tuple__29;
static PyObject *__pyx_tuple__31;
static PyObject *__pyx_tuple__33;
static PyObject *__pyx_tuple__35;
static PyObject *__pyx_tuple__37;
static PyObject *__pyx_tuple__39;
static PyObject *__pyx_tuple__41;
static PyObject *__pyx_tuple__43;
static PyObject *__pyx_codeobj__18;
static PyObject *__pyx_codeobj__20;
static PyObject *__pyx_codeobj__22;
static PyObject *__pyx_codeobj__24;
static PyObject *__pyx_codeobj__26;
static PyObject *__pyx_codeobj__28;
static PyObject *__pyx_codeobj__30;
static PyObject *__pyx_codeobj__32;
static PyObject *__pyx_codeobj__34;
static PyObject *__pyx_codeobj__36;
static PyObject *__pyx_codeobj__38;
static PyObject *__pyx_codeobj__40;
static PyObject *__pyx_codeobj__42;
static PyObject *__pyx_codeobj__44;
/* Late includes */
static PyObject *__pyx_gb_4aldy_9indelpost_6pileup_11make_pileup_2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "aldy/indelpost/pileup.pyx":67
 * 
 *     chrom, pos, reference = target.chrom, target.pos, target.reference
 *     rpos = max(v.pos for v in target.generate_equivalents())             # <<<<<<<<<<<<<<
 * 
 *     ref_len = reference.get_reference_length(chrom)
 */

static PyObject *__pyx_pf_4aldy_9indelpost_6pileup_11make_pileup_genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_1_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_1_genexpr *)__pyx_tp_new_4aldy_9indelpost_6pileup___pyx_scope_struct_1_genexpr(__pyx_ptype_4aldy_9indelpost_6pileup___pyx_scope_struct_1_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_1_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 67, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct____pyx_f_4aldy_9indelpost_6pileup_make_pileup *) __pyx_self;
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4aldy_9indelpost_6pileup_11make_pileup_2generator, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_make_pileup_locals_genexpr, __pyx_n_s_aldy_indelpost_pileup); if (unlikely(!gen)) __PYX_ERR(0, 67, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("aldy.indelpost.pileup.make_pileup.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_4aldy_9indelpost_6pileup_11make_pileup_2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_1_genexpr *__pyx_cur_scope = ((struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_1_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *(*__pyx_t_5)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 67, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_target)) { __Pyx_RaiseClosureNameError("target"); __PYX_ERR(0, 67, __pyx_L1_error) }
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_target), __pyx_n_s_generate_equivalents); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 67, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 67, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
  } else {
    __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 67, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 67, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_5)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 67, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 67, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 67, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 67, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_5(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 67, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_v);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_v, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_v, __pyx_n_s_pos); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 67, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    __Pyx_XGIVEREF(__pyx_t_2);
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_4;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_5;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_0;
    __pyx_cur_scope->__pyx_t_0 = 0;
    __Pyx_XGOTREF(__pyx_t_2);
    __pyx_t_4 = __pyx_cur_scope->__pyx_t_1;
    __pyx_t_5 = __pyx_cur_scope->__pyx_t_2;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 67, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "aldy/indelpost/pileup.pyx":51
 * 
 * 
 * cdef tuple make_pileup(             # <<<<<<<<<<<<<<
 *     Variant target,
 *     AlignmentFile bam,
 */

static PyObject *__pyx_f_4aldy_9indelpost_6pileup_make_pileup(struct __pyx_obj_4aldy_9indelpost_7variant_Variant *__pyx_v_target, struct __pyx_obj_5pysam_17libcalignmentfile_AlignmentFile *__pyx_v_bam, struct __pyx_obj_4aldy_9indelpost_15local_reference_UnsplicedLocalReference *__pyx_v_unspl_loc_ref, int __pyx_v_exclude_duplicates, int __pyx_v_window, int __pyx_v_downsamplethresh, int __pyx_v_basequalthresh) {
  struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct____pyx_f_4aldy_9indelpost_6pileup_make_pileup *__pyx_cur_scope;
  PyObject *__pyx_v_chrom = 0;
  int __pyx_v_pos;
  struct __pyx_obj_5pysam_9libcfaidx_FastaFile *__pyx_v_reference = 0;
  PyObject *__pyx_v_rpos = NULL;
  PyObject *__pyx_v_ref_len = NULL;
  PyObject *__pyx_v_chroms = NULL;
  PyObject *__pyx_v__chrom = NULL;
  PyObject *__pyx_v_pileup = NULL;
  PyObject *__pyx_v_call_back = NULL;
  PyObject *__pyx_v_orig_depth = NULL;
  PyObject *__pyx_v_orig_read_num = NULL;
  PyObject *__pyx_v_n_sample = NULL;
  PyObject *__pyx_v_sample_factor = NULL;
  PyObject *__pyx_gb_4aldy_9indelpost_6pileup_11make_pileup_2generator = 0;
  struct __pyx_obj_5pysam_18libcalignedsegment_AlignedSegment *__pyx_8genexpr1__pyx_v_seg = NULL;
  PyObject *__pyx_8genexpr2__pyx_v_read = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  Py_ssize_t __pyx_t_8;
  PyObject *(*__pyx_t_9)(PyObject *);
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("make_pileup", 0);
  __pyx_cur_scope = (struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct____pyx_f_4aldy_9indelpost_6pileup_make_pileup *)__pyx_tp_new_4aldy_9indelpost_6pileup___pyx_scope_struct____pyx_f_4aldy_9indelpost_6pileup_make_pileup(__pyx_ptype_4aldy_9indelpost_6pileup___pyx_scope_struct____pyx_f_4aldy_9indelpost_6pileup_make_pileup, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct____pyx_f_4aldy_9indelpost_6pileup_make_pileup *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 51, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_target = __pyx_v_target;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_target);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_target);

  /* "aldy/indelpost/pileup.pyx":66
 *     cdef dict read
 * 
 *     chrom, pos, reference = target.chrom, target.pos, target.reference             # <<<<<<<<<<<<<<
 *     rpos = max(v.pos for v in target.generate_equivalents())
 * 
 */
  __pyx_t_1 = __pyx_cur_scope->__pyx_v_target->chrom;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_cur_scope->__pyx_v_target->pos;
  __pyx_t_3 = ((PyObject *)__pyx_cur_scope->__pyx_v_target->reference);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_v_chrom = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_v_pos = __pyx_t_2;
  __pyx_v_reference = ((struct __pyx_obj_5pysam_9libcfaidx_FastaFile *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "aldy/indelpost/pileup.pyx":67
 * 
 *     chrom, pos, reference = target.chrom, target.pos, target.reference
 *     rpos = max(v.pos for v in target.generate_equivalents())             # <<<<<<<<<<<<<<
 * 
 *     ref_len = reference.get_reference_length(chrom)
 */
  __pyx_t_3 = __pyx_pf_4aldy_9indelpost_6pileup_11make_pileup_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 67, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_max, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 67, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_rpos = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "aldy/indelpost/pileup.pyx":69
 *     rpos = max(v.pos for v in target.generate_equivalents())
 * 
 *     ref_len = reference.get_reference_length(chrom)             # <<<<<<<<<<<<<<
 * 
 *     chroms = bam.references
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_reference), __pyx_n_s_get_reference_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 69, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_chrom) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_chrom);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_ref_len = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "aldy/indelpost/pileup.pyx":71
 *     ref_len = reference.get_reference_length(chrom)
 * 
 *     chroms = bam.references             # <<<<<<<<<<<<<<
 *     if chrom not in chroms:
 *         if chrom.startswith("chr"):
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_bam), __pyx_n_s_references); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 71, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_chroms = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "aldy/indelpost/pileup.pyx":72
 * 
 *     chroms = bam.references
 *     if chrom not in chroms:             # <<<<<<<<<<<<<<
 *         if chrom.startswith("chr"):
 *             _chrom = chrom.replace("chr","")
 */
  __pyx_t_5 = (__Pyx_PySequence_ContainsTF(__pyx_v_chrom, __pyx_v_chroms, Py_NE)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 72, __pyx_L1_error)
  __pyx_t_6 = (__pyx_t_5 != 0);
  if (__pyx_t_6) {

    /* "aldy/indelpost/pileup.pyx":73
 *     chroms = bam.references
 *     if chrom not in chroms:
 *         if chrom.startswith("chr"):             # <<<<<<<<<<<<<<
 *             _chrom = chrom.replace("chr","")
 *         else:
 */
    if (unlikely(__pyx_v_chrom == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "startswith");
      __PYX_ERR(0, 73, __pyx_L1_error)
    }
    __pyx_t_6 = __Pyx_PyUnicode_Tailmatch(__pyx_v_chrom, __pyx_n_u_chr, 0, PY_SSIZE_T_MAX, -1); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 73, __pyx_L1_error)
    if ((__pyx_t_6 != 0)) {

      /* "aldy/indelpost/pileup.pyx":74
 *     if chrom not in chroms:
 *         if chrom.startswith("chr"):
 *             _chrom = chrom.replace("chr","")             # <<<<<<<<<<<<<<
 *         else:
 *             _chrom = "chr" + chrom
 */
      if (unlikely(__pyx_v_chrom == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "replace");
        __PYX_ERR(0, 74, __pyx_L1_error)
      }
      __pyx_t_1 = PyUnicode_Replace(__pyx_v_chrom, __pyx_n_u_chr, __pyx_kp_u_, -1L); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 74, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v__chrom = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "aldy/indelpost/pileup.pyx":73
 *     chroms = bam.references
 *     if chrom not in chroms:
 *         if chrom.startswith("chr"):             # <<<<<<<<<<<<<<
 *             _chrom = chrom.replace("chr","")
 *         else:
 */
      goto __pyx_L4;
    }

    /* "aldy/indelpost/pileup.pyx":76
 *             _chrom = chrom.replace("chr","")
 *         else:
 *             _chrom = "chr" + chrom             # <<<<<<<<<<<<<<
 *     else:
 *         _chrom = chrom
 */
    /*else*/ {
      __pyx_t_1 = __Pyx_PyUnicode_ConcatSafe(__pyx_n_u_chr, __pyx_v_chrom); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 76, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v__chrom = __pyx_t_1;
      __pyx_t_1 = 0;
    }
    __pyx_L4:;

    /* "aldy/indelpost/pileup.pyx":72
 * 
 *     chroms = bam.references
 *     if chrom not in chroms:             # <<<<<<<<<<<<<<
 *         if chrom.startswith("chr"):
 *             _chrom = chrom.replace("chr","")
 */
    goto __pyx_L3;
  }

  /* "aldy/indelpost/pileup.pyx":78
 *             _chrom = "chr" + chrom
 *     else:
 *         _chrom = chrom             # <<<<<<<<<<<<<<
 * 
 *     pileup = fetch_reads(_chrom, pos, bam, ref_len, window, exclude_duplicates)
 */
  /*else*/ {
    __Pyx_INCREF(__pyx_v_chrom);
    __pyx_v__chrom = __pyx_v_chrom;
  }
  __pyx_L3:;

  /* "aldy/indelpost/pileup.pyx":80
 *         _chrom = chrom
 * 
 *     pileup = fetch_reads(_chrom, pos, bam, ref_len, window, exclude_duplicates)             # <<<<<<<<<<<<<<
 *     call_back = "all" if exclude_duplicates else "nofilter"
 *     orig_depth = bam.count(_chrom, pos - 1, pos, read_callback=call_back)
 */
  if (!(likely(PyUnicode_CheckExact(__pyx_v__chrom))||((__pyx_v__chrom) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_v__chrom)->tp_name), 0))) __PYX_ERR(0, 80, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_ref_len); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 80, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_4aldy_9indelpost_6pileup_fetch_reads(((PyObject*)__pyx_v__chrom), __pyx_v_pos, __pyx_v_bam, __pyx_t_2, __pyx_v_window, __pyx_v_exclude_duplicates); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 80, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_pileup = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "aldy/indelpost/pileup.pyx":81
 * 
 *     pileup = fetch_reads(_chrom, pos, bam, ref_len, window, exclude_duplicates)
 *     call_back = "all" if exclude_duplicates else "nofilter"             # <<<<<<<<<<<<<<
 *     orig_depth = bam.count(_chrom, pos - 1, pos, read_callback=call_back)
 *     orig_read_num = len(pileup)
 */
  if ((__pyx_v_exclude_duplicates != 0)) {
    __Pyx_INCREF(__pyx_n_u_all);
    __pyx_t_1 = __pyx_n_u_all;
  } else {
    __Pyx_INCREF(__pyx_n_u_nofilter);
    __pyx_t_1 = __pyx_n_u_nofilter;
  }
  __pyx_v_call_back = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "aldy/indelpost/pileup.pyx":82
 *     pileup = fetch_reads(_chrom, pos, bam, ref_len, window, exclude_duplicates)
 *     call_back = "all" if exclude_duplicates else "nofilter"
 *     orig_depth = bam.count(_chrom, pos - 1, pos, read_callback=call_back)             # <<<<<<<<<<<<<<
 *     orig_read_num = len(pileup)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_bam), __pyx_n_s_count); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 82, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyInt_From_long((__pyx_v_pos - 1)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 82, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_pos); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 82, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 82, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(__pyx_v__chrom);
  __Pyx_GIVEREF(__pyx_v__chrom);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v__chrom);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_4);
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 82, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_read_callback, __pyx_v_call_back) < 0) __PYX_ERR(0, 82, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_7, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 82, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_orig_depth = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "aldy/indelpost/pileup.pyx":83
 *     call_back = "all" if exclude_duplicates else "nofilter"
 *     orig_depth = bam.count(_chrom, pos - 1, pos, read_callback=call_back)
 *     orig_read_num = len(pileup)             # <<<<<<<<<<<<<<
 * 
 *     # downsampling
 */
  __pyx_t_8 = PyObject_Length(__pyx_v_pileup); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 83, __pyx_L1_error)
  __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 83, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_orig_read_num = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "aldy/indelpost/pileup.pyx":86
 * 
 *     # downsampling
 *     if orig_depth > downsamplethresh:             # <<<<<<<<<<<<<<
 *         random.seed(123)
 *         n_sample = int(orig_read_num * (downsamplethresh / orig_depth))
 */
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_downsamplethresh); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 86, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyObject_RichCompare(__pyx_v_orig_depth, __pyx_t_3, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 86, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 86, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_6) {

    /* "aldy/indelpost/pileup.pyx":87
 *     # downsampling
 *     if orig_depth > downsamplethresh:
 *         random.seed(123)             # <<<<<<<<<<<<<<
 *         n_sample = int(orig_read_num * (downsamplethresh / orig_depth))
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_random); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 87, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_seed); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 87, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_4 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_3, __pyx_int_123) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_int_123);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 87, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "aldy/indelpost/pileup.pyx":88
 *     if orig_depth > downsamplethresh:
 *         random.seed(123)
 *         n_sample = int(orig_read_num * (downsamplethresh / orig_depth))             # <<<<<<<<<<<<<<
 * 
 *         ### lower bounded by downsample thresh / 2
 */
    __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_downsamplethresh); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 88, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = __Pyx_PyNumber_Divide(__pyx_t_4, __pyx_v_orig_depth); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 88, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Multiply(__pyx_v_orig_read_num, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 88, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyNumber_Int(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 88, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_n_sample = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "aldy/indelpost/pileup.pyx":97
 *         ###          n_sample -> 1
 *         ###          over downsampled.
 *         if n_sample >= downsamplethresh / 2 > 0:             # <<<<<<<<<<<<<<
 *             pileup = random.sample(pileup,  n_sample)
 *             sample_factor = orig_read_num / len(pileup)
 */
    __pyx_t_7 = PyFloat_FromDouble((((double)__pyx_v_downsamplethresh) / 2.0)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 97, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_4 = PyObject_RichCompare(__pyx_v_n_sample, __pyx_t_7, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 97, __pyx_L1_error)
    if (__Pyx_PyObject_IsTrue(__pyx_t_4)) {
      __Pyx_DECREF(__pyx_t_4);
      __pyx_t_4 = PyObject_RichCompare(__pyx_t_7, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 97, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 97, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_6) {

      /* "aldy/indelpost/pileup.pyx":98
 *         ###          over downsampled.
 *         if n_sample >= downsamplethresh / 2 > 0:
 *             pileup = random.sample(pileup,  n_sample)             # <<<<<<<<<<<<<<
 *             sample_factor = orig_read_num / len(pileup)
 *         else:
 */
      __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_random); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 98, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_sample); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 98, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = NULL;
      __pyx_t_2 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
          __pyx_t_2 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_pileup, __pyx_v_n_sample};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_2, 2+__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 98, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_pileup, __pyx_v_n_sample};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_2, 2+__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 98, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      {
        __pyx_t_1 = PyTuple_New(2+__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 98, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        if (__pyx_t_7) {
          __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_7); __pyx_t_7 = NULL;
        }
        __Pyx_INCREF(__pyx_v_pileup);
        __Pyx_GIVEREF(__pyx_v_pileup);
        PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_2, __pyx_v_pileup);
        __Pyx_INCREF(__pyx_v_n_sample);
        __Pyx_GIVEREF(__pyx_v_n_sample);
        PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_2, __pyx_v_n_sample);
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 98, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF_SET(__pyx_v_pileup, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "aldy/indelpost/pileup.pyx":99
 *         if n_sample >= downsamplethresh / 2 > 0:
 *             pileup = random.sample(pileup,  n_sample)
 *             sample_factor = orig_read_num / len(pileup)             # <<<<<<<<<<<<<<
 *         else:
 *             sample_factor = 1.0
 */
      __pyx_t_8 = PyObject_Length(__pyx_v_pileup); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 99, __pyx_L1_error)
      __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 99, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_v_orig_read_num, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 99, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_sample_factor = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "aldy/indelpost/pileup.pyx":97
 *         ###          n_sample -> 1
 *         ###          over downsampled.
 *         if n_sample >= downsamplethresh / 2 > 0:             # <<<<<<<<<<<<<<
 *             pileup = random.sample(pileup,  n_sample)
 *             sample_factor = orig_read_num / len(pileup)
 */
      goto __pyx_L6;
    }

    /* "aldy/indelpost/pileup.pyx":101
 *             sample_factor = orig_read_num / len(pileup)
 *         else:
 *             sample_factor = 1.0             # <<<<<<<<<<<<<<
 *     else:
 *         sample_factor = 1.0
 */
    /*else*/ {
      __Pyx_INCREF(__pyx_float_1_0);
      __pyx_v_sample_factor = __pyx_float_1_0;
    }
    __pyx_L6:;

    /* "aldy/indelpost/pileup.pyx":86
 * 
 *     # downsampling
 *     if orig_depth > downsamplethresh:             # <<<<<<<<<<<<<<
 *         random.seed(123)
 *         n_sample = int(orig_read_num * (downsamplethresh / orig_depth))
 */
    goto __pyx_L5;
  }

  /* "aldy/indelpost/pileup.pyx":103
 *             sample_factor = 1.0
 *     else:
 *         sample_factor = 1.0             # <<<<<<<<<<<<<<
 * 
 *     pileup = [
 */
  /*else*/ {
    __Pyx_INCREF(__pyx_float_1_0);
    __pyx_v_sample_factor = __pyx_float_1_0;
  }
  __pyx_L5:;

  /* "aldy/indelpost/pileup.pyx":105
 *         sample_factor = 1.0
 * 
 *     pileup = [             # <<<<<<<<<<<<<<
 *         dictize_read(seg, chrom, pos, rpos, reference, unspl_loc_ref, basequalthresh) for seg in pileup
 *     ]
 */
  { /* enter inner scope */
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 105, __pyx_L9_error)
    __Pyx_GOTREF(__pyx_t_3);

    /* "aldy/indelpost/pileup.pyx":106
 * 
 *     pileup = [
 *         dictize_read(seg, chrom, pos, rpos, reference, unspl_loc_ref, basequalthresh) for seg in pileup             # <<<<<<<<<<<<<<
 *     ]
 * 
 */
    if (likely(PyList_CheckExact(__pyx_v_pileup)) || PyTuple_CheckExact(__pyx_v_pileup)) {
      __pyx_t_4 = __pyx_v_pileup; __Pyx_INCREF(__pyx_t_4); __pyx_t_8 = 0;
      __pyx_t_9 = NULL;
    } else {
      __pyx_t_8 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_pileup); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 106, __pyx_L9_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_9 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 106, __pyx_L9_error)
    }
    for (;;) {
      if (likely(!__pyx_t_9)) {
        if (likely(PyList_CheckExact(__pyx_t_4))) {
          if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_4)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 106, __pyx_L9_error)
          #else
          __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 106, __pyx_L9_error)
          __Pyx_GOTREF(__pyx_t_1);
          #endif
        } else {
          if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 106, __pyx_L9_error)
          #else
          __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 106, __pyx_L9_error)
          __Pyx_GOTREF(__pyx_t_1);
          #endif
        }
      } else {
        __pyx_t_1 = __pyx_t_9(__pyx_t_4);
        if (unlikely(!__pyx_t_1)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 106, __pyx_L9_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_1);
      }
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5pysam_18libcalignedsegment_AlignedSegment))))) __PYX_ERR(0, 106, __pyx_L9_error)
      __Pyx_XDECREF_SET(__pyx_8genexpr1__pyx_v_seg, ((struct __pyx_obj_5pysam_18libcalignedsegment_AlignedSegment *)__pyx_t_1));
      __pyx_t_1 = 0;
      __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_rpos); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 106, __pyx_L9_error)
      __pyx_t_1 = __pyx_f_4aldy_9indelpost_6pileup_dictize_read(__pyx_8genexpr1__pyx_v_seg, __pyx_v_chrom, __pyx_v_pos, __pyx_t_2, __pyx_v_reference, __pyx_v_unspl_loc_ref, __pyx_v_basequalthresh); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 106, __pyx_L9_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_1))) __PYX_ERR(0, 105, __pyx_L9_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF((PyObject *)__pyx_8genexpr1__pyx_v_seg); __pyx_8genexpr1__pyx_v_seg = 0;
    goto __pyx_L12_exit_scope;
    __pyx_L9_error:;
    __Pyx_XDECREF((PyObject *)__pyx_8genexpr1__pyx_v_seg); __pyx_8genexpr1__pyx_v_seg = 0;
    goto __pyx_L1_error;
    __pyx_L12_exit_scope:;
  } /* exit inner scope */
  __Pyx_DECREF_SET(__pyx_v_pileup, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "aldy/indelpost/pileup.pyx":109
 *     ]
 * 
 *     pileup = [read for read in pileup if not is_within_intron(read, pos, window)]             # <<<<<<<<<<<<<<
 * 
 *     return pileup, sample_factor
 */
  { /* enter inner scope */
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 109, __pyx_L15_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (likely(PyList_CheckExact(__pyx_v_pileup)) || PyTuple_CheckExact(__pyx_v_pileup)) {
      __pyx_t_4 = __pyx_v_pileup; __Pyx_INCREF(__pyx_t_4); __pyx_t_8 = 0;
      __pyx_t_9 = NULL;
    } else {
      __pyx_t_8 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_pileup); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 109, __pyx_L15_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_9 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 109, __pyx_L15_error)
    }
    for (;;) {
      if (likely(!__pyx_t_9)) {
        if (likely(PyList_CheckExact(__pyx_t_4))) {
          if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_4)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 109, __pyx_L15_error)
          #else
          __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 109, __pyx_L15_error)
          __Pyx_GOTREF(__pyx_t_1);
          #endif
        } else {
          if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 109, __pyx_L15_error)
          #else
          __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 109, __pyx_L15_error)
          __Pyx_GOTREF(__pyx_t_1);
          #endif
        }
      } else {
        __pyx_t_1 = __pyx_t_9(__pyx_t_4);
        if (unlikely(!__pyx_t_1)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 109, __pyx_L15_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_1);
      }
      if (!(likely(PyDict_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 109, __pyx_L15_error)
      __Pyx_XDECREF_SET(__pyx_8genexpr2__pyx_v_read, ((PyObject*)__pyx_t_1));
      __pyx_t_1 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_is_within_intron); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 109, __pyx_L15_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_pos); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 109, __pyx_L15_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_window); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 109, __pyx_L15_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_12 = NULL;
      __pyx_t_2 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_12)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_12);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
          __pyx_t_2 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[4] = {__pyx_t_12, __pyx_8genexpr2__pyx_v_read, __pyx_t_10, __pyx_t_11};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_2, 3+__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 109, __pyx_L15_error)
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[4] = {__pyx_t_12, __pyx_8genexpr2__pyx_v_read, __pyx_t_10, __pyx_t_11};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_2, 3+__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 109, __pyx_L15_error)
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      } else
      #endif
      {
        __pyx_t_13 = PyTuple_New(3+__pyx_t_2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 109, __pyx_L15_error)
        __Pyx_GOTREF(__pyx_t_13);
        if (__pyx_t_12) {
          __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_12); __pyx_t_12 = NULL;
        }
        __Pyx_INCREF(__pyx_8genexpr2__pyx_v_read);
        __Pyx_GIVEREF(__pyx_8genexpr2__pyx_v_read);
        PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_2, __pyx_8genexpr2__pyx_v_read);
        __Pyx_GIVEREF(__pyx_t_10);
        PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_2, __pyx_t_10);
        __Pyx_GIVEREF(__pyx_t_11);
        PyTuple_SET_ITEM(__pyx_t_13, 2+__pyx_t_2, __pyx_t_11);
        __pyx_t_10 = 0;
        __pyx_t_11 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_13, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 109, __pyx_L15_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      }
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 109, __pyx_L15_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_5 = ((!__pyx_t_6) != 0);
      if (__pyx_t_5) {
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_8genexpr2__pyx_v_read))) __PYX_ERR(0, 109, __pyx_L15_error)
      }
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_read); __pyx_8genexpr2__pyx_v_read = 0;
    goto __pyx_L19_exit_scope;
    __pyx_L15_error:;
    __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_read); __pyx_8genexpr2__pyx_v_read = 0;
    goto __pyx_L1_error;
    __pyx_L19_exit_scope:;
  } /* exit inner scope */
  __Pyx_DECREF_SET(__pyx_v_pileup, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "aldy/indelpost/pileup.pyx":111
 *     pileup = [read for read in pileup if not is_within_intron(read, pos, window)]
 * 
 *     return pileup, sample_factor             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 111, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_pileup);
  __Pyx_GIVEREF(__pyx_v_pileup);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_pileup);
  __Pyx_INCREF(__pyx_v_sample_factor);
  __Pyx_GIVEREF(__pyx_v_sample_factor);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_sample_factor);
  __pyx_r = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "aldy/indelpost/pileup.pyx":51
 * 
 * 
 * cdef tuple make_pileup(             # <<<<<<<<<<<<<<
 *     Variant target,
 *     AlignmentFile bam,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("aldy.indelpost.pileup.make_pileup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_chrom);
  __Pyx_XDECREF((PyObject *)__pyx_v_reference);
  __Pyx_XDECREF(__pyx_v_rpos);
  __Pyx_XDECREF(__pyx_v_ref_len);
  __Pyx_XDECREF(__pyx_v_chroms);
  __Pyx_XDECREF(__pyx_v__chrom);
  __Pyx_XDECREF(__pyx_v_pileup);
  __Pyx_XDECREF(__pyx_v_call_back);
  __Pyx_XDECREF(__pyx_v_orig_depth);
  __Pyx_XDECREF(__pyx_v_orig_read_num);
  __Pyx_XDECREF(__pyx_v_n_sample);
  __Pyx_XDECREF(__pyx_v_sample_factor);
  __Pyx_XDECREF(__pyx_gb_4aldy_9indelpost_6pileup_11make_pileup_2generator);
  __Pyx_XDECREF((PyObject *)__pyx_8genexpr1__pyx_v_seg);
  __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_read);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "aldy/indelpost/pileup.pyx":114
 * 
 * 
 * def is_within_intron(read, pos, window):             # <<<<<<<<<<<<<<
 *     intron = read["intron_pattern"]
 *     if intron == (0, 0):
 */

/* Python wrapper */
static PyObject *__pyx_pw_4aldy_9indelpost_6pileup_1is_within_intron(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_4aldy_9indelpost_6pileup_1is_within_intron = {"is_within_intron", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4aldy_9indelpost_6pileup_1is_within_intron, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4aldy_9indelpost_6pileup_1is_within_intron(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_read = 0;
  PyObject *__pyx_v_pos = 0;
  PyObject *__pyx_v_window = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_within_intron (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_read,&__pyx_n_s_pos,&__pyx_n_s_window,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_read)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pos)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("is_within_intron", 1, 3, 3, 1); __PYX_ERR(0, 114, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_window)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("is_within_intron", 1, 3, 3, 2); __PYX_ERR(0, 114, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "is_within_intron") < 0)) __PYX_ERR(0, 114, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_read = values[0];
    __pyx_v_pos = values[1];
    __pyx_v_window = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("is_within_intron", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 114, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("aldy.indelpost.pileup.is_within_intron", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4aldy_9indelpost_6pileup_is_within_intron(__pyx_self, __pyx_v_read, __pyx_v_pos, __pyx_v_window);

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

static PyObject *__pyx_pf_4aldy_9indelpost_6pileup_is_within_intron(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_read, PyObject *__pyx_v_pos, PyObject *__pyx_v_window) {
  PyObject *__pyx_v_intron = NULL;
  PyObject *__pyx_v_intron_start = NULL;
  PyObject *__pyx_v_intron_end = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("is_within_intron", 0);

  /* "aldy/indelpost/pileup.pyx":115
 * 
 * def is_within_intron(read, pos, window):
 *     intron = read["intron_pattern"]             # <<<<<<<<<<<<<<
 *     if intron == (0, 0):
 *         return False
 */
  __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_read, __pyx_n_u_intron_pattern); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 115, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_intron = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "aldy/indelpost/pileup.pyx":116
 * def is_within_intron(read, pos, window):
 *     intron = read["intron_pattern"]
 *     if intron == (0, 0):             # <<<<<<<<<<<<<<
 *         return False
 *     else:
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_intron, __pyx_tuple__2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 116, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 116, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "aldy/indelpost/pileup.pyx":117
 *     intron = read["intron_pattern"]
 *     if intron == (0, 0):
 *         return False             # <<<<<<<<<<<<<<
 *     else:
 *         intron_start, intron_end = intron[0], intron[1]
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;

    /* "aldy/indelpost/pileup.pyx":116
 * def is_within_intron(read, pos, window):
 *     intron = read["intron_pattern"]
 *     if intron == (0, 0):             # <<<<<<<<<<<<<<
 *         return False
 *     else:
 */
  }

  /* "aldy/indelpost/pileup.pyx":119
 *         return False
 *     else:
 *         intron_start, intron_end = intron[0], intron[1]             # <<<<<<<<<<<<<<
 *         if intron_start < pos - window and pos + window < intron_end:
 *             return True
 */
  /*else*/ {
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_intron, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 119, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_intron, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 119, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_intron_start = __pyx_t_1;
    __pyx_t_1 = 0;
    __pyx_v_intron_end = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "aldy/indelpost/pileup.pyx":120
 *     else:
 *         intron_start, intron_end = intron[0], intron[1]
 *         if intron_start < pos - window and pos + window < intron_end:             # <<<<<<<<<<<<<<
 *             return True
 *         else:
 */
    __pyx_t_3 = PyNumber_Subtract(__pyx_v_pos, __pyx_v_window); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 120, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyObject_RichCompare(__pyx_v_intron_start, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 120, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 120, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_4) {
    } else {
      __pyx_t_2 = __pyx_t_4;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_1 = PyNumber_Add(__pyx_v_pos, __pyx_v_window); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 120, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_v_intron_end, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 120, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 120, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_2 = __pyx_t_4;
    __pyx_L5_bool_binop_done:;
    if (__pyx_t_2) {

      /* "aldy/indelpost/pileup.pyx":121
 *         intron_start, intron_end = intron[0], intron[1]
 *         if intron_start < pos - window and pos + window < intron_end:
 *             return True             # <<<<<<<<<<<<<<
 *         else:
 *             return False
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_True);
      __pyx_r = Py_True;
      goto __pyx_L0;

      /* "aldy/indelpost/pileup.pyx":120
 *     else:
 *         intron_start, intron_end = intron[0], intron[1]
 *         if intron_start < pos - window and pos + window < intron_end:             # <<<<<<<<<<<<<<
 *             return True
 *         else:
 */
    }

    /* "aldy/indelpost/pileup.pyx":123
 *             return True
 *         else:
 *             return False             # <<<<<<<<<<<<<<
 * 
 * 
 */
    /*else*/ {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_False);
      __pyx_r = Py_False;
      goto __pyx_L0;
    }
  }

  /* "aldy/indelpost/pileup.pyx":114
 * 
 * 
 * def is_within_intron(read, pos, window):             # <<<<<<<<<<<<<<
 *     intron = read["intron_pattern"]
 *     if intron == (0, 0):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("aldy.indelpost.pileup.is_within_intron", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_intron);
  __Pyx_XDECREF(__pyx_v_intron_start);
  __Pyx_XDECREF(__pyx_v_intron_end);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "aldy/indelpost/pileup.pyx":126
 * 
 * 
 * cdef list fetch_reads(str chrom, int pos, AlignmentFile bam, int ref_len, int window, bint exclude_duplicates):             # <<<<<<<<<<<<<<
 * 
 *     cdef AlignedSegment read
 */

static PyObject *__pyx_f_4aldy_9indelpost_6pileup_fetch_reads(PyObject *__pyx_v_chrom, int __pyx_v_pos, struct __pyx_obj_5pysam_17libcalignmentfile_AlignmentFile *__pyx_v_bam, int __pyx_v_ref_len, int __pyx_v_window, int __pyx_v_exclude_duplicates) {
  PyObject *__pyx_v_all_reads = NULL;
  PyObject *__pyx_v_reads = NULL;
  struct __pyx_obj_5pysam_18libcalignedsegment_AlignedSegment *__pyx_8genexpr3__pyx_v_read = NULL;
  struct __pyx_obj_5pysam_18libcalignedsegment_AlignedSegment *__pyx_8genexpr4__pyx_v_read = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  long __pyx_t_3;
  long __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  PyObject *(*__pyx_t_10)(PyObject *);
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("fetch_reads", 0);

  /* "aldy/indelpost/pileup.pyx":130
 *     cdef AlignedSegment read
 * 
 *     pos = pos - 1  # convert to 0-based             # <<<<<<<<<<<<<<
 * 
 *     all_reads = bam.fetch(
 */
  __pyx_v_pos = (__pyx_v_pos - 1);

  /* "aldy/indelpost/pileup.pyx":132
 *     pos = pos - 1  # convert to 0-based
 * 
 *     all_reads = bam.fetch(             # <<<<<<<<<<<<<<
 *         chrom, max(0, pos - window), min(pos + 1 + window, ref_len), until_eof=True
 *     )
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_bam), __pyx_n_s_fetch); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 132, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "aldy/indelpost/pileup.pyx":133
 * 
 *     all_reads = bam.fetch(
 *         chrom, max(0, pos - window), min(pos + 1 + window, ref_len), until_eof=True             # <<<<<<<<<<<<<<
 *     )
 * 
 */
  __pyx_t_2 = (__pyx_v_pos - __pyx_v_window);
  __pyx_t_3 = 0;
  if (((__pyx_t_2 > __pyx_t_3) != 0)) {
    __pyx_t_4 = __pyx_t_2;
  } else {
    __pyx_t_4 = __pyx_t_3;
  }
  __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 133, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = __pyx_v_ref_len;
  __pyx_t_4 = ((__pyx_v_pos + 1) + __pyx_v_window);
  if (((__pyx_t_2 < __pyx_t_4) != 0)) {
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_4;
  }
  __pyx_t_6 = __Pyx_PyInt_From_long(__pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 133, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);

  /* "aldy/indelpost/pileup.pyx":132
 *     pos = pos - 1  # convert to 0-based
 * 
 *     all_reads = bam.fetch(             # <<<<<<<<<<<<<<
 *         chrom, max(0, pos - window), min(pos + 1 + window, ref_len), until_eof=True
 *     )
 */
  __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 132, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(__pyx_v_chrom);
  __Pyx_GIVEREF(__pyx_v_chrom);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_chrom);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_6);
  __pyx_t_5 = 0;
  __pyx_t_6 = 0;

  /* "aldy/indelpost/pileup.pyx":133
 * 
 *     all_reads = bam.fetch(
 *         chrom, max(0, pos - window), min(pos + 1 + window, ref_len), until_eof=True             # <<<<<<<<<<<<<<
 *     )
 * 
 */
  __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 133, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_until_eof, Py_True) < 0) __PYX_ERR(0, 133, __pyx_L1_error)

  /* "aldy/indelpost/pileup.pyx":132
 *     pos = pos - 1  # convert to 0-based
 * 
 *     all_reads = bam.fetch(             # <<<<<<<<<<<<<<
 *         chrom, max(0, pos - window), min(pos + 1 + window, ref_len), until_eof=True
 *     )
 */
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 132, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_v_all_reads = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "aldy/indelpost/pileup.pyx":136
 *     )
 * 
 *     if exclude_duplicates:             # <<<<<<<<<<<<<<
 *         reads = [
 *             read
 */
  __pyx_t_8 = (__pyx_v_exclude_duplicates != 0);
  if (__pyx_t_8) {

    /* "aldy/indelpost/pileup.pyx":137
 * 
 *     if exclude_duplicates:
 *         reads = [             # <<<<<<<<<<<<<<
 *             read
 *             for read in all_reads
 */
    { /* enter inner scope */
      __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 137, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_5);

      /* "aldy/indelpost/pileup.pyx":139
 *         reads = [
 *             read
 *             for read in all_reads             # <<<<<<<<<<<<<<
 *             if not read.is_duplicate
 *             and not read.is_secondary
 */
      if (likely(PyList_CheckExact(__pyx_v_all_reads)) || PyTuple_CheckExact(__pyx_v_all_reads)) {
        __pyx_t_6 = __pyx_v_all_reads; __Pyx_INCREF(__pyx_t_6); __pyx_t_9 = 0;
        __pyx_t_10 = NULL;
      } else {
        __pyx_t_9 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_all_reads); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 139, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_10 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 139, __pyx_L6_error)
      }
      for (;;) {
        if (likely(!__pyx_t_10)) {
          if (likely(PyList_CheckExact(__pyx_t_6))) {
            if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_6)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_7 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 139, __pyx_L6_error)
            #else
            __pyx_t_7 = PySequence_ITEM(__pyx_t_6, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 139, __pyx_L6_error)
            __Pyx_GOTREF(__pyx_t_7);
            #endif
          } else {
            if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 139, __pyx_L6_error)
            #else
            __pyx_t_7 = PySequence_ITEM(__pyx_t_6, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 139, __pyx_L6_error)
            __Pyx_GOTREF(__pyx_t_7);
            #endif
          }
        } else {
          __pyx_t_7 = __pyx_t_10(__pyx_t_6);
          if (unlikely(!__pyx_t_7)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(0, 139, __pyx_L6_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_7);
        }
        if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5pysam_18libcalignedsegment_AlignedSegment))))) __PYX_ERR(0, 139, __pyx_L6_error)
        __Pyx_XDECREF_SET(__pyx_8genexpr3__pyx_v_read, ((struct __pyx_obj_5pysam_18libcalignedsegment_AlignedSegment *)__pyx_t_7));
        __pyx_t_7 = 0;

        /* "aldy/indelpost/pileup.pyx":140
 *             read
 *             for read in all_reads
 *             if not read.is_duplicate             # <<<<<<<<<<<<<<
 *             and not read.is_secondary
 *             and read.cigarstring
 */
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_8genexpr3__pyx_v_read), __pyx_n_s_is_duplicate); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 140, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 140, __pyx_L6_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_12 = ((!__pyx_t_11) != 0);
        if (__pyx_t_12) {
        } else {
          __pyx_t_8 = __pyx_t_12;
          goto __pyx_L10_bool_binop_done;
        }

        /* "aldy/indelpost/pileup.pyx":141
 *             for read in all_reads
 *             if not read.is_duplicate
 *             and not read.is_secondary             # <<<<<<<<<<<<<<
 *             and read.cigarstring
 *             and read.reference_start
 */
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_8genexpr3__pyx_v_read), __pyx_n_s_is_secondary); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 141, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 141, __pyx_L6_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_11 = ((!__pyx_t_12) != 0);
        if (__pyx_t_11) {
        } else {
          __pyx_t_8 = __pyx_t_11;
          goto __pyx_L10_bool_binop_done;
        }

        /* "aldy/indelpost/pileup.pyx":142
 *             if not read.is_duplicate
 *             and not read.is_secondary
 *             and read.cigarstring             # <<<<<<<<<<<<<<
 *             and read.reference_start
 *         ]
 */
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_8genexpr3__pyx_v_read), __pyx_n_s_cigarstring); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 142, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 142, __pyx_L6_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (__pyx_t_11) {
        } else {
          __pyx_t_8 = __pyx_t_11;
          goto __pyx_L10_bool_binop_done;
        }

        /* "aldy/indelpost/pileup.pyx":143
 *             and not read.is_secondary
 *             and read.cigarstring
 *             and read.reference_start             # <<<<<<<<<<<<<<
 *         ]
 *     else:
 */
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_8genexpr3__pyx_v_read), __pyx_n_s_reference_start); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 143, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 143, __pyx_L6_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_8 = __pyx_t_11;
        __pyx_L10_bool_binop_done:;

        /* "aldy/indelpost/pileup.pyx":140
 *             read
 *             for read in all_reads
 *             if not read.is_duplicate             # <<<<<<<<<<<<<<
 *             and not read.is_secondary
 *             and read.cigarstring
 */
        if (__pyx_t_8) {

          /* "aldy/indelpost/pileup.pyx":138
 *     if exclude_duplicates:
 *         reads = [
 *             read             # <<<<<<<<<<<<<<
 *             for read in all_reads
 *             if not read.is_duplicate
 */
          if (unlikely(__Pyx_ListComp_Append(__pyx_t_5, (PyObject*)__pyx_8genexpr3__pyx_v_read))) __PYX_ERR(0, 137, __pyx_L6_error)

          /* "aldy/indelpost/pileup.pyx":140
 *             read
 *             for read in all_reads
 *             if not read.is_duplicate             # <<<<<<<<<<<<<<
 *             and not read.is_secondary
 *             and read.cigarstring
 */
        }

        /* "aldy/indelpost/pileup.pyx":139
 *         reads = [
 *             read
 *             for read in all_reads             # <<<<<<<<<<<<<<
 *             if not read.is_duplicate
 *             and not read.is_secondary
 */
      }
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF((PyObject *)__pyx_8genexpr3__pyx_v_read); __pyx_8genexpr3__pyx_v_read = 0;
      goto __pyx_L14_exit_scope;
      __pyx_L6_error:;
      __Pyx_XDECREF((PyObject *)__pyx_8genexpr3__pyx_v_read); __pyx_8genexpr3__pyx_v_read = 0;
      goto __pyx_L1_error;
      __pyx_L14_exit_scope:;
    } /* exit inner scope */
    __pyx_v_reads = ((PyObject*)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "aldy/indelpost/pileup.pyx":136
 *     )
 * 
 *     if exclude_duplicates:             # <<<<<<<<<<<<<<
 *         reads = [
 *             read
 */
    goto __pyx_L3;
  }

  /* "aldy/indelpost/pileup.pyx":146
 *         ]
 *     else:
 *         reads = [             # <<<<<<<<<<<<<<
 *             read
 *             for read in all_reads
 */
  /*else*/ {
    { /* enter inner scope */
      __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 146, __pyx_L17_error)
      __Pyx_GOTREF(__pyx_t_5);

      /* "aldy/indelpost/pileup.pyx":148
 *         reads = [
 *             read
 *             for read in all_reads             # <<<<<<<<<<<<<<
 *             if not read.is_secondary
 *             and read.cigarstring
 */
      if (likely(PyList_CheckExact(__pyx_v_all_reads)) || PyTuple_CheckExact(__pyx_v_all_reads)) {
        __pyx_t_6 = __pyx_v_all_reads; __Pyx_INCREF(__pyx_t_6); __pyx_t_9 = 0;
        __pyx_t_10 = NULL;
      } else {
        __pyx_t_9 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_all_reads); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 148, __pyx_L17_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_10 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 148, __pyx_L17_error)
      }
      for (;;) {
        if (likely(!__pyx_t_10)) {
          if (likely(PyList_CheckExact(__pyx_t_6))) {
            if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_6)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_7 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 148, __pyx_L17_error)
            #else
            __pyx_t_7 = PySequence_ITEM(__pyx_t_6, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 148, __pyx_L17_error)
            __Pyx_GOTREF(__pyx_t_7);
            #endif
          } else {
            if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 148, __pyx_L17_error)
            #else
            __pyx_t_7 = PySequence_ITEM(__pyx_t_6, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 148, __pyx_L17_error)
            __Pyx_GOTREF(__pyx_t_7);
            #endif
          }
        } else {
          __pyx_t_7 = __pyx_t_10(__pyx_t_6);
          if (unlikely(!__pyx_t_7)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(0, 148, __pyx_L17_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_7);
        }
        if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5pysam_18libcalignedsegment_AlignedSegment))))) __PYX_ERR(0, 148, __pyx_L17_error)
        __Pyx_XDECREF_SET(__pyx_8genexpr4__pyx_v_read, ((struct __pyx_obj_5pysam_18libcalignedsegment_AlignedSegment *)__pyx_t_7));
        __pyx_t_7 = 0;

        /* "aldy/indelpost/pileup.pyx":149
 *             read
 *             for read in all_reads
 *             if not read.is_secondary             # <<<<<<<<<<<<<<
 *             and read.cigarstring
 *         ]
 */
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_8genexpr4__pyx_v_read), __pyx_n_s_is_secondary); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 149, __pyx_L17_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 149, __pyx_L17_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_12 = ((!__pyx_t_11) != 0);
        if (__pyx_t_12) {
        } else {
          __pyx_t_8 = __pyx_t_12;
          goto __pyx_L21_bool_binop_done;
        }

        /* "aldy/indelpost/pileup.pyx":150
 *             for read in all_reads
 *             if not read.is_secondary
 *             and read.cigarstring             # <<<<<<<<<<<<<<
 *         ]
 * 
 */
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_8genexpr4__pyx_v_read), __pyx_n_s_cigarstring); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 150, __pyx_L17_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 150, __pyx_L17_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_8 = __pyx_t_12;
        __pyx_L21_bool_binop_done:;

        /* "aldy/indelpost/pileup.pyx":149
 *             read
 *             for read in all_reads
 *             if not read.is_secondary             # <<<<<<<<<<<<<<
 *             and read.cigarstring
 *         ]
 */
        if (__pyx_t_8) {

          /* "aldy/indelpost/pileup.pyx":147
 *     else:
 *         reads = [
 *             read             # <<<<<<<<<<<<<<
 *             for read in all_reads
 *             if not read.is_secondary
 */
          if (unlikely(__Pyx_ListComp_Append(__pyx_t_5, (PyObject*)__pyx_8genexpr4__pyx_v_read))) __PYX_ERR(0, 146, __pyx_L17_error)

          /* "aldy/indelpost/pileup.pyx":149
 *             read
 *             for read in all_reads
 *             if not read.is_secondary             # <<<<<<<<<<<<<<
 *             and read.cigarstring
 *         ]
 */
        }

        /* "aldy/indelpost/pileup.pyx":148
 *         reads = [
 *             read
 *             for read in all_reads             # <<<<<<<<<<<<<<
 *             if not read.is_secondary
 *             and read.cigarstring
 */
      }
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF((PyObject *)__pyx_8genexpr4__pyx_v_read); __pyx_8genexpr4__pyx_v_read = 0;
      goto __pyx_L23_exit_scope;
      __pyx_L17_error:;
      __Pyx_XDECREF((PyObject *)__pyx_8genexpr4__pyx_v_read); __pyx_8genexpr4__pyx_v_read = 0;
      goto __pyx_L1_error;
      __pyx_L23_exit_scope:;
    } /* exit inner scope */
    __pyx_v_reads = ((PyObject*)__pyx_t_5);
    __pyx_t_5 = 0;
  }
  __pyx_L3:;

  /* "aldy/indelpost/pileup.pyx":153
 *         ]
 * 
 *     return reads             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_reads);
  __pyx_r = __pyx_v_reads;
  goto __pyx_L0;

  /* "aldy/indelpost/pileup.pyx":126
 * 
 * 
 * cdef list fetch_reads(str chrom, int pos, AlignmentFile bam, int ref_len, int window, bint exclude_duplicates):             # <<<<<<<<<<<<<<
 * 
 *     cdef AlignedSegment read
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("aldy.indelpost.pileup.fetch_reads", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_all_reads);
  __Pyx_XDECREF(__pyx_v_reads);
  __Pyx_XDECREF((PyObject *)__pyx_8genexpr3__pyx_v_read);
  __Pyx_XDECREF((PyObject *)__pyx_8genexpr4__pyx_v_read);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_4aldy_9indelpost_6pileup_12dictize_read_2generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "aldy/indelpost/pileup.pyx":178
 *     aln_end = read.reference_end  # do not add 1
 *     if aln_end is None:
 *         aln_end = aln_start + sum(int(c[:-1]) for c in cigar_list if c[-1] in ("M", "N", "D", "=", "X"))             # <<<<<<<<<<<<<<
 * 
 *     end_offset = int(cigar_list[-1][:-1]) if cigar_list[-1].endswith("S") else 0
 */

static PyObject *__pyx_pf_4aldy_9indelpost_6pileup_12dictize_read_genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_3_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_3_genexpr *)__pyx_tp_new_4aldy_9indelpost_6pileup___pyx_scope_struct_3_genexpr(__pyx_ptype_4aldy_9indelpost_6pileup___pyx_scope_struct_3_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_3_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 178, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_2___pyx_f_4aldy_9indelpost_6pileup_dictize_read *) __pyx_self;
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4aldy_9indelpost_6pileup_12dictize_read_2generator1, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_dictize_read_locals_genexpr, __pyx_n_s_aldy_indelpost_pileup); if (unlikely(!gen)) __PYX_ERR(0, 178, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("aldy.indelpost.pileup.dictize_read.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_4aldy_9indelpost_6pileup_12dictize_read_2generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_3_genexpr *__pyx_cur_scope = ((struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_3_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L12_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 178, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_cigar_list)) { __Pyx_RaiseClosureNameError("cigar_list"); __PYX_ERR(0, 178, __pyx_L1_error) }
  if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_cigar_list)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_cigar_list)) {
    __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_cigar_list; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_cigar_list); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 178, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 178, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 178, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 178, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 178, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 178, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 178, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_c);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_c, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_c, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 178, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_n_u_M, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 178, __pyx_L1_error)
    if (!__pyx_t_6) {
    } else {
      __pyx_t_5 = __pyx_t_6;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_n_u_N, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 178, __pyx_L1_error)
    if (!__pyx_t_6) {
    } else {
      __pyx_t_5 = __pyx_t_6;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_n_u_D, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 178, __pyx_L1_error)
    if (!__pyx_t_6) {
    } else {
      __pyx_t_5 = __pyx_t_6;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_kp_u__3, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 178, __pyx_L1_error)
    if (!__pyx_t_6) {
    } else {
      __pyx_t_5 = __pyx_t_6;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_n_u_X, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 178, __pyx_L1_error)
    __pyx_t_5 = __pyx_t_6;
    __pyx_L7_bool_binop_done:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_6 = (__pyx_t_5 != 0);
    if (__pyx_t_6) {
      __pyx_t_4 = __Pyx_PyObject_GetSlice(__pyx_cur_scope->__pyx_v_c, 0, -1L, NULL, NULL, &__pyx_slice__4, 0, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 178, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_7 = __Pyx_PyNumber_Int(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 178, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_r = __pyx_t_7;
      __pyx_t_7 = 0;
      __Pyx_XGIVEREF(__pyx_t_1);
      __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
      __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
      __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, yielding value */
      __pyx_generator->resume_label = 1;
      return __pyx_r;
      __pyx_L12_resume_from_yield:;
      __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
      __pyx_cur_scope->__pyx_t_0 = 0;
      __Pyx_XGOTREF(__pyx_t_1);
      __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
      __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 178, __pyx_L1_error)
    }
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_4aldy_9indelpost_6pileup_12dictize_read_5generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "aldy/indelpost/pileup.pyx":212
 *     read_dict["low_qual_base_num"] = count_lowqual_non_ref_bases(read_seq, ref_seq, read_qual, cigar_list, basequalthresh)
 *     read_dict["is_end_dirty"] = is_end_dirty(read_qual, basequalthresh, pos, read_start, read_end, cigar_string)
 *     read_dict["is_dirty"] = sum(q <= basequalthresh for q in read_qual) / len(read_seq) > 0.15             # <<<<<<<<<<<<<<
 * 
 *     insertions, deletions = locate_indels(cigar_string, read_start)
 */

static PyObject *__pyx_pf_4aldy_9indelpost_6pileup_12dictize_read_3genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_4_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_4_genexpr *)__pyx_tp_new_4aldy_9indelpost_6pileup___pyx_scope_struct_4_genexpr(__pyx_ptype_4aldy_9indelpost_6pileup___pyx_scope_struct_4_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_4_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 212, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_2___pyx_f_4aldy_9indelpost_6pileup_dictize_read *) __pyx_self;
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4aldy_9indelpost_6pileup_12dictize_read_5generator2, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_dictize_read_locals_genexpr, __pyx_n_s_aldy_indelpost_pileup); if (unlikely(!gen)) __PYX_ERR(0, 212, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("aldy.indelpost.pileup.dictize_read.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_4aldy_9indelpost_6pileup_12dictize_read_5generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_4_genexpr *__pyx_cur_scope = ((struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_4_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 212, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_read_qual)) { __Pyx_RaiseClosureNameError("read_qual"); __PYX_ERR(0, 212, __pyx_L1_error) }
  if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_read_qual)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_read_qual)) {
    __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_read_qual; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_read_qual); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 212, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 212, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 212, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 212, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 212, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 212, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 212, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_q);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_q, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_basequalthresh); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 212, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_q, __pyx_t_4, Py_LE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 212, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    __Pyx_XGIVEREF(__pyx_t_1);
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
    __pyx_cur_scope->__pyx_t_0 = 0;
    __Pyx_XGOTREF(__pyx_t_1);
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
    __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 212, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "aldy/indelpost/pileup.pyx":156
 * 
 * 
 * cdef dict dictize_read(             # <<<<<<<<<<<<<<
 *     AlignedSegment read,
 *     str chrom,
 */

static PyObject *__pyx_f_4aldy_9indelpost_6pileup_dictize_read(struct __pyx_obj_5pysam_18libcalignedsegment_AlignedSegment *__pyx_v_read, PyObject *__pyx_v_chrom, int __pyx_v_pos, int __pyx_v_rpos, struct __pyx_obj_5pysam_9libcfaidx_FastaFile *__pyx_v_reference, struct __pyx_obj_4aldy_9indelpost_15local_reference_UnsplicedLocalReference *__pyx_v_unspl_loc_ref, int __pyx_v_basequalthresh) {
  struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_2___pyx_f_4aldy_9indelpost_6pileup_dictize_read *__pyx_cur_scope;
  PyObject *__pyx_v_ins = 0;
  PyObject *__pyx_v_deln = 0;
  PyObject *__pyx_v_cigar_string = NULL;
  PyObject *__pyx_v_aln_start = NULL;
  PyObject *__pyx_v_start_offset = NULL;
  PyObject *__pyx_v_read_start = NULL;
  PyObject *__pyx_v_aln_end = NULL;
  PyObject *__pyx_v_end_offset = NULL;
  PyObject *__pyx_v_read_end = NULL;
  PyObject *__pyx_v_read_seq = NULL;
  PyObject *__pyx_v_ref_seq = NULL;
  PyObject *__pyx_v_read_dict = NULL;
  PyObject *__pyx_v_insertions = NULL;
  PyObject *__pyx_v_deletions = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_indels = NULL;
  PyObject *__pyx_v_is_covering = NULL;
  PyObject *__pyx_v_covering_subread = NULL;
  PyObject *__pyx_v_is_spliced = NULL;
  PyObject *__pyx_v_splice_ptrn = NULL;
  PyObject *__pyx_v_intron_ptrn = NULL;
  PyObject *__pyx_gb_4aldy_9indelpost_6pileup_12dictize_read_2generator1 = 0;
  PyObject *__pyx_gb_4aldy_9indelpost_6pileup_12dictize_read_5generator2 = 0;
  PyObject *__pyx_8genexpr7__pyx_v_ins = NULL;
  PyObject *__pyx_8genexpr8__pyx_v_deln = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  PyObject *(*__pyx_t_10)(PyObject *);
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("dictize_read", 0);
  __pyx_cur_scope = (struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_2___pyx_f_4aldy_9indelpost_6pileup_dictize_read *)__pyx_tp_new_4aldy_9indelpost_6pileup___pyx_scope_struct_2___pyx_f_4aldy_9indelpost_6pileup_dictize_read(__pyx_ptype_4aldy_9indelpost_6pileup___pyx_scope_struct_2___pyx_f_4aldy_9indelpost_6pileup_dictize_read, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_2___pyx_f_4aldy_9indelpost_6pileup_dictize_read *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 156, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_basequalthresh = __pyx_v_basequalthresh;

  /* "aldy/indelpost/pileup.pyx":168
 *     cdef tuple ins, deln
 * 
 *     cigar_string = read.cigarstring             # <<<<<<<<<<<<<<
 *     cigar_list = cigar_ptrn.findall(cigar_string)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_read), __pyx_n_s_cigarstring); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 168, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_cigar_string = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "aldy/indelpost/pileup.pyx":169
 * 
 *     cigar_string = read.cigarstring
 *     cigar_list = cigar_ptrn.findall(cigar_string)             # <<<<<<<<<<<<<<
 * 
 *     # adjust read start/end if starts or ends with softclipping
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_cigar_ptrn); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 169, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_findall); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 169, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_cigar_string) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_cigar_string);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 169, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_cur_scope->__pyx_v_cigar_list = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "aldy/indelpost/pileup.pyx":172
 * 
 *     # adjust read start/end if starts or ends with softclipping
 *     aln_start = read.reference_start + 1             # <<<<<<<<<<<<<<
 *     start_offset = int(cigar_list[0][:-1]) if cigar_list[0].endswith("S") else 0
 *     read_start = aln_start - start_offset
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_read), __pyx_n_s_reference_start); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 172, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_t_1, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 172, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_aln_start = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "aldy/indelpost/pileup.pyx":173
 *     # adjust read start/end if starts or ends with softclipping
 *     aln_start = read.reference_start + 1
 *     start_offset = int(cigar_list[0][:-1]) if cigar_list[0].endswith("S") else 0             # <<<<<<<<<<<<<<
 *     read_start = aln_start - start_offset
 * 
 */
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_cigar_list, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 173, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_endswith); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 173, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_2, __pyx_n_u_S) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_n_u_S);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 173, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 173, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_5) {
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_cigar_list, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 173, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyObject_GetSlice(__pyx_t_1, 0, -1L, NULL, NULL, &__pyx_slice__4, 0, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 173, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyNumber_Int(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 173, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_3 = __pyx_t_1;
    __pyx_t_1 = 0;
  } else {
    __Pyx_INCREF(__pyx_int_0);
    __pyx_t_3 = __pyx_int_0;
  }
  __pyx_v_start_offset = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "aldy/indelpost/pileup.pyx":174
 *     aln_start = read.reference_start + 1
 *     start_offset = int(cigar_list[0][:-1]) if cigar_list[0].endswith("S") else 0
 *     read_start = aln_start - start_offset             # <<<<<<<<<<<<<<
 * 
 *     aln_end = read.reference_end  # do not add 1
 */
  __pyx_t_3 = PyNumber_Subtract(__pyx_v_aln_start, __pyx_v_start_offset); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 174, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_read_start = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "aldy/indelpost/pileup.pyx":176
 *     read_start = aln_start - start_offset
 * 
 *     aln_end = read.reference_end  # do not add 1             # <<<<<<<<<<<<<<
 *     if aln_end is None:
 *         aln_end = aln_start + sum(int(c[:-1]) for c in cigar_list if c[-1] in ("M", "N", "D", "=", "X"))
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_read), __pyx_n_s_reference_end); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 176, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_aln_end = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "aldy/indelpost/pileup.pyx":177
 * 
 *     aln_end = read.reference_end  # do not add 1
 *     if aln_end is None:             # <<<<<<<<<<<<<<
 *         aln_end = aln_start + sum(int(c[:-1]) for c in cigar_list if c[-1] in ("M", "N", "D", "=", "X"))
 * 
 */
  __pyx_t_5 = (__pyx_v_aln_end == Py_None);
  __pyx_t_6 = (__pyx_t_5 != 0);
  if (__pyx_t_6) {

    /* "aldy/indelpost/pileup.pyx":178
 *     aln_end = read.reference_end  # do not add 1
 *     if aln_end is None:
 *         aln_end = aln_start + sum(int(c[:-1]) for c in cigar_list if c[-1] in ("M", "N", "D", "=", "X"))             # <<<<<<<<<<<<<<
 * 
 *     end_offset = int(cigar_list[-1][:-1]) if cigar_list[-1].endswith("S") else 0
 */
    __pyx_t_3 = __pyx_pf_4aldy_9indelpost_6pileup_12dictize_read_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 178, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_sum, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 178, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Add(__pyx_v_aln_start, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 178, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_aln_end, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "aldy/indelpost/pileup.pyx":177
 * 
 *     aln_end = read.reference_end  # do not add 1
 *     if aln_end is None:             # <<<<<<<<<<<<<<
 *         aln_end = aln_start + sum(int(c[:-1]) for c in cigar_list if c[-1] in ("M", "N", "D", "=", "X"))
 * 
 */
  }

  /* "aldy/indelpost/pileup.pyx":180
 *         aln_end = aln_start + sum(int(c[:-1]) for c in cigar_list if c[-1] in ("M", "N", "D", "=", "X"))
 * 
 *     end_offset = int(cigar_list[-1][:-1]) if cigar_list[-1].endswith("S") else 0             # <<<<<<<<<<<<<<
 * 
 *     read_end = aln_end + end_offset
 */
  __pyx_t_4 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_cigar_list, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 180, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_endswith); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 180, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_n_u_S) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_n_u_S);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 180, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 180, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_6) {
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_cigar_list, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 180, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_t_1, 0, -1L, NULL, NULL, &__pyx_slice__4, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 180, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyNumber_Int(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 180, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_3 = __pyx_t_1;
    __pyx_t_1 = 0;
  } else {
    __Pyx_INCREF(__pyx_int_0);
    __pyx_t_3 = __pyx_int_0;
  }
  __pyx_v_end_offset = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "aldy/indelpost/pileup.pyx":182
 *     end_offset = int(cigar_list[-1][:-1]) if cigar_list[-1].endswith("S") else 0
 * 
 *     read_end = aln_end + end_offset             # <<<<<<<<<<<<<<
 * 
 *     read_seq = read.query_sequence
 */
  __pyx_t_3 = PyNumber_Add(__pyx_v_aln_end, __pyx_v_end_offset); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_read_end = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "aldy/indelpost/pileup.pyx":184
 *     read_end = aln_end + end_offset
 * 
 *     read_seq = read.query_sequence             # <<<<<<<<<<<<<<
 *     read_qual = read.query_qualities
 *     ref_seq = get_ref_seq(chrom, aln_start, aln_end, cigar_string, cigar_list, reference, unspl_loc_ref)
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_read), __pyx_n_s_query_sequence); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 184, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_read_seq = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "aldy/indelpost/pileup.pyx":185
 * 
 *     read_seq = read.query_sequence
 *     read_qual = read.query_qualities             # <<<<<<<<<<<<<<
 *     ref_seq = get_ref_seq(chrom, aln_start, aln_end, cigar_string, cigar_list, reference, unspl_loc_ref)
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_read), __pyx_n_s_query_qualities); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 185, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_cur_scope->__pyx_v_read_qual = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "aldy/indelpost/pileup.pyx":186
 *     read_seq = read.query_sequence
 *     read_qual = read.query_qualities
 *     ref_seq = get_ref_seq(chrom, aln_start, aln_end, cigar_string, cigar_list, reference, unspl_loc_ref)             # <<<<<<<<<<<<<<
 * 
 *     read_dict = {
 */
  __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_v_aln_start); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 186, __pyx_L1_error)
  __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_v_aln_end); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 186, __pyx_L1_error)
  if (!(likely(PyUnicode_CheckExact(__pyx_v_cigar_string))||((__pyx_v_cigar_string) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_v_cigar_string)->tp_name), 0))) __PYX_ERR(0, 186, __pyx_L1_error)
  if (!(likely(PyList_CheckExact(__pyx_cur_scope->__pyx_v_cigar_list))||((__pyx_cur_scope->__pyx_v_cigar_list) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_cur_scope->__pyx_v_cigar_list)->tp_name), 0))) __PYX_ERR(0, 186, __pyx_L1_error)
  __pyx_t_3 = __pyx_cur_scope->__pyx_v_cigar_list;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_1 = __pyx_f_4aldy_9indelpost_6pileup_get_ref_seq(__pyx_v_chrom, __pyx_t_7, __pyx_t_8, ((PyObject*)__pyx_v_cigar_string), ((PyObject*)__pyx_t_3), __pyx_v_reference, __pyx_v_unspl_loc_ref); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 186, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_ref_seq = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "aldy/indelpost/pileup.pyx":189
 * 
 *     read_dict = {
 *         "read": read,             # <<<<<<<<<<<<<<
 *         "read_seq": read_seq,
 *         "read_qual": read_qual,
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(18); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 189, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_read, ((PyObject *)__pyx_v_read)) < 0) __PYX_ERR(0, 189, __pyx_L1_error)

  /* "aldy/indelpost/pileup.pyx":190
 *     read_dict = {
 *         "read": read,
 *         "read_seq": read_seq,             # <<<<<<<<<<<<<<
 *         "read_qual": read_qual,
 *         "ref_seq": ref_seq,
 */
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_read_seq, __pyx_v_read_seq) < 0) __PYX_ERR(0, 189, __pyx_L1_error)

  /* "aldy/indelpost/pileup.pyx":191
 *         "read": read,
 *         "read_seq": read_seq,
 *         "read_qual": read_qual,             # <<<<<<<<<<<<<<
 *         "ref_seq": ref_seq,
 *         "is_reverse": read.is_reverse,
 */
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_read_qual, __pyx_cur_scope->__pyx_v_read_qual) < 0) __PYX_ERR(0, 189, __pyx_L1_error)

  /* "aldy/indelpost/pileup.pyx":192
 *         "read_seq": read_seq,
 *         "read_qual": read_qual,
 *         "ref_seq": ref_seq,             # <<<<<<<<<<<<<<
 *         "is_reverse": read.is_reverse,
 *         "read_name": read.query_name,
 */
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_ref_seq, __pyx_v_ref_seq) < 0) __PYX_ERR(0, 189, __pyx_L1_error)

  /* "aldy/indelpost/pileup.pyx":193
 *         "read_qual": read_qual,
 *         "ref_seq": ref_seq,
 *         "is_reverse": read.is_reverse,             # <<<<<<<<<<<<<<
 *         "read_name": read.query_name,
 *         "mapq": read.mapping_quality,
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_read), __pyx_n_s_is_reverse); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 193, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_is_reverse, __pyx_t_3) < 0) __PYX_ERR(0, 189, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "aldy/indelpost/pileup.pyx":194
 *         "ref_seq": ref_seq,
 *         "is_reverse": read.is_reverse,
 *         "read_name": read.query_name,             # <<<<<<<<<<<<<<
 *         "mapq": read.mapping_quality,
 *         "start_offset": start_offset,
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_read), __pyx_n_s_query_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 194, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_read_name, __pyx_t_3) < 0) __PYX_ERR(0, 189, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "aldy/indelpost/pileup.pyx":195
 *         "is_reverse": read.is_reverse,
 *         "read_name": read.query_name,
 *         "mapq": read.mapping_quality,             # <<<<<<<<<<<<<<
 *         "start_offset": start_offset,
 *         "aln_start": aln_start,
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_read), __pyx_n_s_mapping_quality); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_mapq, __pyx_t_3) < 0) __PYX_ERR(0, 189, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "aldy/indelpost/pileup.pyx":196
 *         "read_name": read.query_name,
 *         "mapq": read.mapping_quality,
 *         "start_offset": start_offset,             # <<<<<<<<<<<<<<
 *         "aln_start": aln_start,
 *         "read_start": read_start,
 */
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_start_offset, __pyx_v_start_offset) < 0) __PYX_ERR(0, 189, __pyx_L1_error)

  /* "aldy/indelpost/pileup.pyx":197
 *         "mapq": read.mapping_quality,
 *         "start_offset": start_offset,
 *         "aln_start": aln_start,             # <<<<<<<<<<<<<<
 *         "read_start": read_start,
 *         "end_offset": end_offset,
 */
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_aln_start, __pyx_v_aln_start) < 0) __PYX_ERR(0, 189, __pyx_L1_error)

  /* "aldy/indelpost/pileup.pyx":198
 *         "start_offset": start_offset,
 *         "aln_start": aln_start,
 *         "read_start": read_start,             # <<<<<<<<<<<<<<
 *         "end_offset": end_offset,
 *         "aln_end": aln_end,
 */
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_read_start, __pyx_v_read_start) < 0) __PYX_ERR(0, 189, __pyx_L1_error)

  /* "aldy/indelpost/pileup.pyx":199
 *         "aln_start": aln_start,
 *         "read_start": read_start,
 *         "end_offset": end_offset,             # <<<<<<<<<<<<<<
 *         "aln_end": aln_end,
 *         "read_end": read_end,
 */
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_end_offset, __pyx_v_end_offset) < 0) __PYX_ERR(0, 189, __pyx_L1_error)

  /* "aldy/indelpost/pileup.pyx":200
 *         "read_start": read_start,
 *         "end_offset": end_offset,
 *         "aln_end": aln_end,             # <<<<<<<<<<<<<<
 *         "read_end": read_end,
 *         "cigar_string": cigar_string,
 */
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_aln_end, __pyx_v_aln_end) < 0) __PYX_ERR(0, 189, __pyx_L1_error)

  /* "aldy/indelpost/pileup.pyx":201
 *         "end_offset": end_offset,
 *         "aln_end": aln_end,
 *         "read_end": read_end,             # <<<<<<<<<<<<<<
 *         "cigar_string": cigar_string,
 *         "cigar_list": cigar_list,
 */
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_read_end, __pyx_v_read_end) < 0) __PYX_ERR(0, 189, __pyx_L1_error)

  /* "aldy/indelpost/pileup.pyx":202
 *         "aln_end": aln_end,
 *         "read_end": read_end,
 *         "cigar_string": cigar_string,             # <<<<<<<<<<<<<<
 *         "cigar_list": cigar_list,
 *         "is_reference_seq": (read_seq == ref_seq),
 */
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_cigar_string, __pyx_v_cigar_string) < 0) __PYX_ERR(0, 189, __pyx_L1_error)

  /* "aldy/indelpost/pileup.pyx":203
 *         "read_end": read_end,
 *         "cigar_string": cigar_string,
 *         "cigar_list": cigar_list,             # <<<<<<<<<<<<<<
 *         "is_reference_seq": (read_seq == ref_seq),
 *         "I": [],
 */
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_cigar_list, __pyx_cur_scope->__pyx_v_cigar_list) < 0) __PYX_ERR(0, 189, __pyx_L1_error)

  /* "aldy/indelpost/pileup.pyx":204
 *         "cigar_string": cigar_string,
 *         "cigar_list": cigar_list,
 *         "is_reference_seq": (read_seq == ref_seq),             # <<<<<<<<<<<<<<
 *         "I": [],
 *         "D": [],
 */
  __pyx_t_3 = PyObject_RichCompare(__pyx_v_read_seq, __pyx_v_ref_seq, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 204, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_is_reference_seq, __pyx_t_3) < 0) __PYX_ERR(0, 189, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "aldy/indelpost/pileup.pyx":205
 *         "cigar_list": cigar_list,
 *         "is_reference_seq": (read_seq == ref_seq),
 *         "I": [],             # <<<<<<<<<<<<<<
 *         "D": [],
 *     }
 */
  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 205, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_I, __pyx_t_3) < 0) __PYX_ERR(0, 189, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "aldy/indelpost/pileup.pyx":206
 *         "is_reference_seq": (read_seq == ref_seq),
 *         "I": [],
 *         "D": [],             # <<<<<<<<<<<<<<
 *     }
 * 
 */
  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 206, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_D, __pyx_t_3) < 0) __PYX_ERR(0, 189, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_read_dict = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "aldy/indelpost/pileup.pyx":210
 * 
 *     # base qual check
 *     read_dict["low_qual_base_num"] = count_lowqual_non_ref_bases(read_seq, ref_seq, read_qual, cigar_list, basequalthresh)             # <<<<<<<<<<<<<<
 *     read_dict["is_end_dirty"] = is_end_dirty(read_qual, basequalthresh, pos, read_start, read_end, cigar_string)
 *     read_dict["is_dirty"] = sum(q <= basequalthresh for q in read_qual) / len(read_seq) > 0.15
 */
  if (!(likely(PyUnicode_CheckExact(__pyx_v_read_seq))||((__pyx_v_read_seq) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_v_read_seq)->tp_name), 0))) __PYX_ERR(0, 210, __pyx_L1_error)
  if (!(likely(((__pyx_cur_scope->__pyx_v_read_qual) == Py_None) || likely(__Pyx_TypeTest(__pyx_cur_scope->__pyx_v_read_qual, __pyx_ptype_7cpython_5array_array))))) __PYX_ERR(0, 210, __pyx_L1_error)
  __pyx_t_1 = __pyx_cur_scope->__pyx_v_read_qual;
  __Pyx_INCREF(__pyx_t_1);
  if (!(likely(PyList_CheckExact(__pyx_cur_scope->__pyx_v_cigar_list))||((__pyx_cur_scope->__pyx_v_cigar_list) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_cur_scope->__pyx_v_cigar_list)->tp_name), 0))) __PYX_ERR(0, 210, __pyx_L1_error)
  __pyx_t_3 = __pyx_cur_scope->__pyx_v_cigar_list;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_f_4aldy_9indelpost_9utilities_count_lowqual_non_ref_bases(((PyObject*)__pyx_v_read_seq), __pyx_v_ref_seq, ((arrayobject *)__pyx_t_1), ((PyObject*)__pyx_t_3), __pyx_cur_scope->__pyx_v_basequalthresh)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 210, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(PyDict_SetItem(__pyx_v_read_dict, __pyx_n_u_low_qual_base_num, __pyx_t_2) < 0)) __PYX_ERR(0, 210, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "aldy/indelpost/pileup.pyx":211
 *     # base qual check
 *     read_dict["low_qual_base_num"] = count_lowqual_non_ref_bases(read_seq, ref_seq, read_qual, cigar_list, basequalthresh)
 *     read_dict["is_end_dirty"] = is_end_dirty(read_qual, basequalthresh, pos, read_start, read_end, cigar_string)             # <<<<<<<<<<<<<<
 *     read_dict["is_dirty"] = sum(q <= basequalthresh for q in read_qual) / len(read_seq) > 0.15
 * 
 */
  if (!(likely(((__pyx_cur_scope->__pyx_v_read_qual) == Py_None) || likely(__Pyx_TypeTest(__pyx_cur_scope->__pyx_v_read_qual, __pyx_ptype_7cpython_5array_array))))) __PYX_ERR(0, 211, __pyx_L1_error)
  __pyx_t_2 = __pyx_cur_scope->__pyx_v_read_qual;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_v_read_start); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 211, __pyx_L1_error)
  __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_v_read_end); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 211, __pyx_L1_error)
  if (!(likely(PyUnicode_CheckExact(__pyx_v_cigar_string))||((__pyx_v_cigar_string) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_v_cigar_string)->tp_name), 0))) __PYX_ERR(0, 211, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_f_4aldy_9indelpost_6pileup_is_end_dirty(((arrayobject *)__pyx_t_2), __pyx_cur_scope->__pyx_v_basequalthresh, __pyx_v_pos, __pyx_t_8, __pyx_t_7, ((PyObject*)__pyx_v_cigar_string))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 211, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(PyDict_SetItem(__pyx_v_read_dict, __pyx_n_u_is_end_dirty, __pyx_t_3) < 0)) __PYX_ERR(0, 211, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "aldy/indelpost/pileup.pyx":212
 *     read_dict["low_qual_base_num"] = count_lowqual_non_ref_bases(read_seq, ref_seq, read_qual, cigar_list, basequalthresh)
 *     read_dict["is_end_dirty"] = is_end_dirty(read_qual, basequalthresh, pos, read_start, read_end, cigar_string)
 *     read_dict["is_dirty"] = sum(q <= basequalthresh for q in read_qual) / len(read_seq) > 0.15             # <<<<<<<<<<<<<<
 * 
 *     insertions, deletions = locate_indels(cigar_string, read_start)
 */
  __pyx_t_3 = __pyx_pf_4aldy_9indelpost_6pileup_12dictize_read_3genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 212, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_sum, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 212, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_9 = PyObject_Length(__pyx_v_read_seq); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 212, __pyx_L1_error)
  __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 212, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 212, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_float_0_15, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 212, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(PyDict_SetItem(__pyx_v_read_dict, __pyx_n_u_is_dirty, __pyx_t_3) < 0)) __PYX_ERR(0, 212, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "aldy/indelpost/pileup.pyx":214
 *     read_dict["is_dirty"] = sum(q <= basequalthresh for q in read_qual) / len(read_seq) > 0.15
 * 
 *     insertions, deletions = locate_indels(cigar_string, read_start)             # <<<<<<<<<<<<<<
 * 
 *     for ins in insertions:
 */
  if (!(likely(PyUnicode_CheckExact(__pyx_v_cigar_string))||((__pyx_v_cigar_string) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_v_cigar_string)->tp_name), 0))) __PYX_ERR(0, 214, __pyx_L1_error)
  __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_v_read_start); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 214, __pyx_L1_error)
  __pyx_t_3 = __pyx_f_4aldy_9indelpost_9utilities_locate_indels(((PyObject*)__pyx_v_cigar_string), __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 214, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (likely(__pyx_t_3 != Py_None)) {
    PyObject* sequence = __pyx_t_3;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 214, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_2);
    #else
    __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 214, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 214, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    #endif
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 214, __pyx_L1_error)
  }
  __pyx_v_insertions = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_deletions = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "aldy/indelpost/pileup.pyx":216
 *     insertions, deletions = locate_indels(cigar_string, read_start)
 * 
 *     for ins in insertions:             # <<<<<<<<<<<<<<
 *         read_dict["I"].append(
 *             leftalign_indel_read(
 */
  if (likely(PyList_CheckExact(__pyx_v_insertions)) || PyTuple_CheckExact(__pyx_v_insertions)) {
    __pyx_t_3 = __pyx_v_insertions; __Pyx_INCREF(__pyx_t_3); __pyx_t_9 = 0;
    __pyx_t_10 = NULL;
  } else {
    __pyx_t_9 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_insertions); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 216, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_10 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 216, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_10)) {
      if (likely(PyList_CheckExact(__pyx_t_3))) {
        if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_9); __Pyx_INCREF(__pyx_t_2); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 216, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 216, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      } else {
        if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_9); __Pyx_INCREF(__pyx_t_2); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 216, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 216, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      }
    } else {
      __pyx_t_2 = __pyx_t_10(__pyx_t_3);
      if (unlikely(!__pyx_t_2)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 216, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    if (!(likely(PyTuple_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 216, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_ins, ((PyObject*)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "aldy/indelpost/pileup.pyx":217
 * 
 *     for ins in insertions:
 *         read_dict["I"].append(             # <<<<<<<<<<<<<<
 *             leftalign_indel_read(
 *                 chrom,
 */
    __pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_v_read_dict, __pyx_n_u_I); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 217, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);

    /* "aldy/indelpost/pileup.pyx":220
 *             leftalign_indel_read(
 *                 chrom,
 *                 ins[0],             # <<<<<<<<<<<<<<
 *                 ins[1],
 *                 "I",
 */
    if (unlikely(__pyx_v_ins == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 220, __pyx_L1_error)
    }
    __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v_ins, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 220, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 220, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "aldy/indelpost/pileup.pyx":221
 *                 chrom,
 *                 ins[0],
 *                 ins[1],             # <<<<<<<<<<<<<<
 *                 "I",
 *                 cigar_string,
 */
    if (unlikely(__pyx_v_ins == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 221, __pyx_L1_error)
    }
    __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v_ins, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 221, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 221, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "aldy/indelpost/pileup.pyx":223
 *                 ins[1],
 *                 "I",
 *                 cigar_string,             # <<<<<<<<<<<<<<
 *                 read_start,
 *                 aln_start,
 */
    if (!(likely(PyUnicode_CheckExact(__pyx_v_cigar_string))||((__pyx_v_cigar_string) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_v_cigar_string)->tp_name), 0))) __PYX_ERR(0, 223, __pyx_L1_error)

    /* "aldy/indelpost/pileup.pyx":224
 *                 "I",
 *                 cigar_string,
 *                 read_start,             # <<<<<<<<<<<<<<
 *                 aln_start,
 *                 read_seq,
 */
    __pyx_t_11 = __Pyx_PyInt_As_int(__pyx_v_read_start); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 224, __pyx_L1_error)

    /* "aldy/indelpost/pileup.pyx":225
 *                 cigar_string,
 *                 read_start,
 *                 aln_start,             # <<<<<<<<<<<<<<
 *                 read_seq,
 *                 ref_seq,
 */
    __pyx_t_12 = __Pyx_PyInt_As_int(__pyx_v_aln_start); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 225, __pyx_L1_error)

    /* "aldy/indelpost/pileup.pyx":226
 *                 read_start,
 *                 aln_start,
 *                 read_seq,             # <<<<<<<<<<<<<<
 *                 ref_seq,
 *                 read_qual,
 */
    if (!(likely(PyUnicode_CheckExact(__pyx_v_read_seq))||((__pyx_v_read_seq) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_v_read_seq)->tp_name), 0))) __PYX_ERR(0, 226, __pyx_L1_error)

    /* "aldy/indelpost/pileup.pyx":228
 *                 read_seq,
 *                 ref_seq,
 *                 read_qual,             # <<<<<<<<<<<<<<
 *                 reference,
 *             )
 */
    __pyx_t_1 = __pyx_cur_scope->__pyx_v_read_qual;
    __Pyx_INCREF(__pyx_t_1);

    /* "aldy/indelpost/pileup.pyx":218
 *     for ins in insertions:
 *         read_dict["I"].append(
 *             leftalign_indel_read(             # <<<<<<<<<<<<<<
 *                 chrom,
 *                 ins[0],
 */
    __pyx_t_4 = __pyx_f_4aldy_9indelpost_6pileup_leftalign_indel_read(__pyx_v_chrom, __pyx_t_7, __pyx_t_8, __pyx_n_u_I, ((PyObject*)__pyx_v_cigar_string), __pyx_t_11, __pyx_t_12, ((PyObject*)__pyx_v_read_seq), __pyx_v_ref_seq, __pyx_t_1, __pyx_v_reference); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 218, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "aldy/indelpost/pileup.pyx":217
 * 
 *     for ins in insertions:
 *         read_dict["I"].append(             # <<<<<<<<<<<<<<
 *             leftalign_indel_read(
 *                 chrom,
 */
    __pyx_t_13 = __Pyx_PyObject_Append(__pyx_t_2, __pyx_t_4); if (unlikely(__pyx_t_13 == ((int)-1))) __PYX_ERR(0, 217, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "aldy/indelpost/pileup.pyx":216
 *     insertions, deletions = locate_indels(cigar_string, read_start)
 * 
 *     for ins in insertions:             # <<<<<<<<<<<<<<
 *         read_dict["I"].append(
 *             leftalign_indel_read(
 */
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "aldy/indelpost/pileup.pyx":233
 *         )
 * 
 *     for deln in deletions:             # <<<<<<<<<<<<<<
 *         read_dict["D"].append(
 *             leftalign_indel_read(
 */
  if (likely(PyList_CheckExact(__pyx_v_deletions)) || PyTuple_CheckExact(__pyx_v_deletions)) {
    __pyx_t_3 = __pyx_v_deletions; __Pyx_INCREF(__pyx_t_3); __pyx_t_9 = 0;
    __pyx_t_10 = NULL;
  } else {
    __pyx_t_9 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_deletions); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 233, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_10 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 233, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_10)) {
      if (likely(PyList_CheckExact(__pyx_t_3))) {
        if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_9); __Pyx_INCREF(__pyx_t_4); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 233, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 233, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_9); __Pyx_INCREF(__pyx_t_4); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 233, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 233, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_10(__pyx_t_3);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 233, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    if (!(likely(PyTuple_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(0, 233, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_deln, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "aldy/indelpost/pileup.pyx":234
 * 
 *     for deln in deletions:
 *         read_dict["D"].append(             # <<<<<<<<<<<<<<
 *             leftalign_indel_read(
 *                 chrom,
 */
    __pyx_t_4 = __Pyx_PyDict_GetItem(__pyx_v_read_dict, __pyx_n_u_D); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 234, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);

    /* "aldy/indelpost/pileup.pyx":237
 *             leftalign_indel_read(
 *                 chrom,
 *                 deln[0],             # <<<<<<<<<<<<<<
 *                 deln[1],
 *                 "D",
 */
    if (unlikely(__pyx_v_deln == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 237, __pyx_L1_error)
    }
    __pyx_t_2 = __Pyx_GetItemInt_Tuple(__pyx_v_deln, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 237, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_12 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 237, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "aldy/indelpost/pileup.pyx":238
 *                 chrom,
 *                 deln[0],
 *                 deln[1],             # <<<<<<<<<<<<<<
 *                 "D",
 *                 cigar_string,
 */
    if (unlikely(__pyx_v_deln == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 238, __pyx_L1_error)
    }
    __pyx_t_2 = __Pyx_GetItemInt_Tuple(__pyx_v_deln, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 238, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_11 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 238, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "aldy/indelpost/pileup.pyx":240
 *                 deln[1],
 *                 "D",
 *                 cigar_string,             # <<<<<<<<<<<<<<
 *                 read_start,
 *                 aln_start,
 */
    if (!(likely(PyUnicode_CheckExact(__pyx_v_cigar_string))||((__pyx_v_cigar_string) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_v_cigar_string)->tp_name), 0))) __PYX_ERR(0, 240, __pyx_L1_error)

    /* "aldy/indelpost/pileup.pyx":241
 *                 "D",
 *                 cigar_string,
 *                 read_start,             # <<<<<<<<<<<<<<
 *                 aln_start,
 *                 read_seq,
 */
    __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_v_read_start); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 241, __pyx_L1_error)

    /* "aldy/indelpost/pileup.pyx":242
 *                 cigar_string,
 *                 read_start,
 *                 aln_start,             # <<<<<<<<<<<<<<
 *                 read_seq,
 *                 ref_seq,
 */
    __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_v_aln_start); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 242, __pyx_L1_error)

    /* "aldy/indelpost/pileup.pyx":243
 *                 read_start,
 *                 aln_start,
 *                 read_seq,             # <<<<<<<<<<<<<<
 *                 ref_seq,
 *                 read_qual,
 */
    if (!(likely(PyUnicode_CheckExact(__pyx_v_read_seq))||((__pyx_v_read_seq) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_v_read_seq)->tp_name), 0))) __PYX_ERR(0, 243, __pyx_L1_error)

    /* "aldy/indelpost/pileup.pyx":245
 *                 read_seq,
 *                 ref_seq,
 *                 read_qual,             # <<<<<<<<<<<<<<
 *                 reference,
 *             )
 */
    __pyx_t_2 = __pyx_cur_scope->__pyx_v_read_qual;
    __Pyx_INCREF(__pyx_t_2);

    /* "aldy/indelpost/pileup.pyx":235
 *     for deln in deletions:
 *         read_dict["D"].append(
 *             leftalign_indel_read(             # <<<<<<<<<<<<<<
 *                 chrom,
 *                 deln[0],
 */
    __pyx_t_1 = __pyx_f_4aldy_9indelpost_6pileup_leftalign_indel_read(__pyx_v_chrom, __pyx_t_12, __pyx_t_11, __pyx_n_u_D, ((PyObject*)__pyx_v_cigar_string), __pyx_t_8, __pyx_t_7, ((PyObject*)__pyx_v_read_seq), __pyx_v_ref_seq, __pyx_t_2, __pyx_v_reference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 235, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "aldy/indelpost/pileup.pyx":234
 * 
 *     for deln in deletions:
 *         read_dict["D"].append(             # <<<<<<<<<<<<<<
 *             leftalign_indel_read(
 *                 chrom,
 */
    __pyx_t_13 = __Pyx_PyObject_Append(__pyx_t_4, __pyx_t_1); if (unlikely(__pyx_t_13 == ((int)-1))) __PYX_ERR(0, 234, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "aldy/indelpost/pileup.pyx":233
 *         )
 * 
 *     for deln in deletions:             # <<<<<<<<<<<<<<
 *         read_dict["D"].append(
 *             leftalign_indel_read(
 */
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "aldy/indelpost/pileup.pyx":250
 *         )
 * 
 *     indels = [ins[-1] for ins in read_dict["I"]] + [deln[-1] for deln in read_dict["D"]]             # <<<<<<<<<<<<<<
 * 
 *     (
 */
  { /* enter inner scope */
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 250, __pyx_L10_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_read_dict, __pyx_n_u_I); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 250, __pyx_L10_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
      __pyx_t_4 = __pyx_t_1; __Pyx_INCREF(__pyx_t_4); __pyx_t_9 = 0;
      __pyx_t_10 = NULL;
    } else {
      __pyx_t_9 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 250, __pyx_L10_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_10 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 250, __pyx_L10_error)
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    for (;;) {
      if (likely(!__pyx_t_10)) {
        if (likely(PyList_CheckExact(__pyx_t_4))) {
          if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_4)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_9); __Pyx_INCREF(__pyx_t_1); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 250, __pyx_L10_error)
          #else
          __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 250, __pyx_L10_error)
          __Pyx_GOTREF(__pyx_t_1);
          #endif
        } else {
          if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_9); __Pyx_INCREF(__pyx_t_1); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 250, __pyx_L10_error)
          #else
          __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 250, __pyx_L10_error)
          __Pyx_GOTREF(__pyx_t_1);
          #endif
        }
      } else {
        __pyx_t_1 = __pyx_t_10(__pyx_t_4);
        if (unlikely(!__pyx_t_1)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 250, __pyx_L10_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_1);
      }
      if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 250, __pyx_L10_error)
      __Pyx_XDECREF_SET(__pyx_8genexpr7__pyx_v_ins, ((PyObject*)__pyx_t_1));
      __pyx_t_1 = 0;
      if (unlikely(__pyx_8genexpr7__pyx_v_ins == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 250, __pyx_L10_error)
      }
      __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_8genexpr7__pyx_v_ins, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 250, __pyx_L10_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_1))) __PYX_ERR(0, 250, __pyx_L10_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_8genexpr7__pyx_v_ins); __pyx_8genexpr7__pyx_v_ins = 0;
    goto __pyx_L13_exit_scope;
    __pyx_L10_error:;
    __Pyx_XDECREF(__pyx_8genexpr7__pyx_v_ins); __pyx_8genexpr7__pyx_v_ins = 0;
    goto __pyx_L1_error;
    __pyx_L13_exit_scope:;
  } /* exit inner scope */
  { /* enter inner scope */
    __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 250, __pyx_L16_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_read_dict, __pyx_n_u_D); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 250, __pyx_L16_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
      __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_9 = 0;
      __pyx_t_10 = NULL;
    } else {
      __pyx_t_9 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 250, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_10 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 250, __pyx_L16_error)
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    for (;;) {
      if (likely(!__pyx_t_10)) {
        if (likely(PyList_CheckExact(__pyx_t_2))) {
          if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_2)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_9); __Pyx_INCREF(__pyx_t_1); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 250, __pyx_L16_error)
          #else
          __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 250, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_1);
          #endif
        } else {
          if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_9); __Pyx_INCREF(__pyx_t_1); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 250, __pyx_L16_error)
          #else
          __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 250, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_1);
          #endif
        }
      } else {
        __pyx_t_1 = __pyx_t_10(__pyx_t_2);
        if (unlikely(!__pyx_t_1)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 250, __pyx_L16_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_1);
      }
      if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 250, __pyx_L16_error)
      __Pyx_XDECREF_SET(__pyx_8genexpr8__pyx_v_deln, ((PyObject*)__pyx_t_1));
      __pyx_t_1 = 0;
      if (unlikely(__pyx_8genexpr8__pyx_v_deln == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 250, __pyx_L16_error)
      }
      __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_8genexpr8__pyx_v_deln, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 250, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_t_1))) __PYX_ERR(0, 250, __pyx_L16_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_8genexpr8__pyx_v_deln); __pyx_8genexpr8__pyx_v_deln = 0;
    goto __pyx_L19_exit_scope;
    __pyx_L16_error:;
    __Pyx_XDECREF(__pyx_8genexpr8__pyx_v_deln); __pyx_8genexpr8__pyx_v_deln = 0;
    goto __pyx_L1_error;
    __pyx_L19_exit_scope:;
  } /* exit inner scope */
  __pyx_t_2 = PyNumber_Add(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 250, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_indels = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "aldy/indelpost/pileup.pyx":258
 *         splice_ptrn,
 *         intron_ptrn,
 *     ) = parse_spliced_read(cigar_string, read_start, read_end, pos, rpos)             # <<<<<<<<<<<<<<
 * 
 *     read_dict["is_covering"] = is_covering
 */
  if (!(likely(PyUnicode_CheckExact(__pyx_v_cigar_string))||((__pyx_v_cigar_string) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_v_cigar_string)->tp_name), 0))) __PYX_ERR(0, 258, __pyx_L1_error)
  __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_v_read_start); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 258, __pyx_L1_error)
  __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_v_read_end); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 258, __pyx_L1_error)
  __pyx_t_2 = __pyx_f_4aldy_9indelpost_6pileup_parse_spliced_read(((PyObject*)__pyx_v_cigar_string), __pyx_t_7, __pyx_t_8, __pyx_v_pos, __pyx_v_rpos); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 258, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (likely(__pyx_t_2 != Py_None)) {
    PyObject* sequence = __pyx_t_2;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 5)) {
      if (size > 5) __Pyx_RaiseTooManyValuesError(5);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 253, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    __pyx_t_1 = PyTuple_GET_ITEM(sequence, 2); 
    __pyx_t_14 = PyTuple_GET_ITEM(sequence, 3); 
    __pyx_t_15 = PyTuple_GET_ITEM(sequence, 4); 
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_14);
    __Pyx_INCREF(__pyx_t_15);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[5] = {&__pyx_t_4,&__pyx_t_3,&__pyx_t_1,&__pyx_t_14,&__pyx_t_15};
      for (i=0; i < 5; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 253, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 253, __pyx_L1_error)
  }

  /* "aldy/indelpost/pileup.pyx":253
 * 
 *     (
 *         is_covering,             # <<<<<<<<<<<<<<
 *         covering_subread,
 *         is_spliced,
 */
  __pyx_v_is_covering = __pyx_t_4;
  __pyx_t_4 = 0;
  __pyx_v_covering_subread = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_is_spliced = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_splice_ptrn = __pyx_t_14;
  __pyx_t_14 = 0;
  __pyx_v_intron_ptrn = __pyx_t_15;
  __pyx_t_15 = 0;

  /* "aldy/indelpost/pileup.pyx":260
 *     ) = parse_spliced_read(cigar_string, read_start, read_end, pos, rpos)
 * 
 *     read_dict["is_covering"] = is_covering             # <<<<<<<<<<<<<<
 *     read_dict["covering_subread"] = covering_subread
 *     read_dict["is_spliced"] = is_spliced
 */
  if (unlikely(PyDict_SetItem(__pyx_v_read_dict, __pyx_n_u_is_covering, __pyx_v_is_covering) < 0)) __PYX_ERR(0, 260, __pyx_L1_error)

  /* "aldy/indelpost/pileup.pyx":261
 * 
 *     read_dict["is_covering"] = is_covering
 *     read_dict["covering_subread"] = covering_subread             # <<<<<<<<<<<<<<
 *     read_dict["is_spliced"] = is_spliced
 *     read_dict["splice_pattern"] = splice_ptrn
 */
  if (unlikely(PyDict_SetItem(__pyx_v_read_dict, __pyx_n_u_covering_subread, __pyx_v_covering_subread) < 0)) __PYX_ERR(0, 261, __pyx_L1_error)

  /* "aldy/indelpost/pileup.pyx":262
 *     read_dict["is_covering"] = is_covering
 *     read_dict["covering_subread"] = covering_subread
 *     read_dict["is_spliced"] = is_spliced             # <<<<<<<<<<<<<<
 *     read_dict["splice_pattern"] = splice_ptrn
 *     read_dict["intron_pattern"] = intron_ptrn
 */
  if (unlikely(PyDict_SetItem(__pyx_v_read_dict, __pyx_n_u_is_spliced, __pyx_v_is_spliced) < 0)) __PYX_ERR(0, 262, __pyx_L1_error)

  /* "aldy/indelpost/pileup.pyx":263
 *     read_dict["covering_subread"] = covering_subread
 *     read_dict["is_spliced"] = is_spliced
 *     read_dict["splice_pattern"] = splice_ptrn             # <<<<<<<<<<<<<<
 *     read_dict["intron_pattern"] = intron_ptrn
 * 
 */
  if (unlikely(PyDict_SetItem(__pyx_v_read_dict, __pyx_n_u_splice_pattern, __pyx_v_splice_ptrn) < 0)) __PYX_ERR(0, 263, __pyx_L1_error)

  /* "aldy/indelpost/pileup.pyx":264
 *     read_dict["is_spliced"] = is_spliced
 *     read_dict["splice_pattern"] = splice_ptrn
 *     read_dict["intron_pattern"] = intron_ptrn             # <<<<<<<<<<<<<<
 * 
 *     return read_dict
 */
  if (unlikely(PyDict_SetItem(__pyx_v_read_dict, __pyx_n_u_intron_pattern, __pyx_v_intron_ptrn) < 0)) __PYX_ERR(0, 264, __pyx_L1_error)

  /* "aldy/indelpost/pileup.pyx":266
 *     read_dict["intron_pattern"] = intron_ptrn
 * 
 *     return read_dict             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_read_dict);
  __pyx_r = __pyx_v_read_dict;
  goto __pyx_L0;

  /* "aldy/indelpost/pileup.pyx":156
 * 
 * 
 * cdef dict dictize_read(             # <<<<<<<<<<<<<<
 *     AlignedSegment read,
 *     str chrom,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_AddTraceback("aldy.indelpost.pileup.dictize_read", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ins);
  __Pyx_XDECREF(__pyx_v_deln);
  __Pyx_XDECREF(__pyx_v_cigar_string);
  __Pyx_XDECREF(__pyx_v_aln_start);
  __Pyx_XDECREF(__pyx_v_start_offset);
  __Pyx_XDECREF(__pyx_v_read_start);
  __Pyx_XDECREF(__pyx_v_aln_end);
  __Pyx_XDECREF(__pyx_v_end_offset);
  __Pyx_XDECREF(__pyx_v_read_end);
  __Pyx_XDECREF(__pyx_v_read_seq);
  __Pyx_XDECREF(__pyx_v_ref_seq);
  __Pyx_XDECREF(__pyx_v_read_dict);
  __Pyx_XDECREF(__pyx_v_insertions);
  __Pyx_XDECREF(__pyx_v_deletions);
  __Pyx_XDECREF(__pyx_v_indels);
  __Pyx_XDECREF(__pyx_v_is_covering);
  __Pyx_XDECREF(__pyx_v_covering_subread);
  __Pyx_XDECREF(__pyx_v_is_spliced);
  __Pyx_XDECREF(__pyx_v_splice_ptrn);
  __Pyx_XDECREF(__pyx_v_intron_ptrn);
  __Pyx_XDECREF(__pyx_gb_4aldy_9indelpost_6pileup_12dictize_read_2generator1);
  __Pyx_XDECREF(__pyx_gb_4aldy_9indelpost_6pileup_12dictize_read_5generator2);
  __Pyx_XDECREF(__pyx_8genexpr7__pyx_v_ins);
  __Pyx_XDECREF(__pyx_8genexpr8__pyx_v_deln);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "aldy/indelpost/pileup.pyx":269
 * 
 * 
 * cdef str get_ref_seq(             # <<<<<<<<<<<<<<
 *     str chrom,
 *     int aln_start,
 */

static PyObject *__pyx_f_4aldy_9indelpost_6pileup_get_ref_seq(PyObject *__pyx_v_chrom, int __pyx_v_aln_start, int __pyx_v_aln_end, PyObject *__pyx_v_cigar_string, PyObject *__pyx_v_cigar_list, struct __pyx_obj_5pysam_9libcfaidx_FastaFile *__pyx_v_reference, struct __pyx_obj_4aldy_9indelpost_15local_reference_UnsplicedLocalReference *__pyx_v_unspl_loc_ref) {
  int __pyx_v_current_pos;
  PyObject *__pyx_v_ref_seq = 0;
  PyObject *__pyx_v_event = 0;
  PyObject *__pyx_v_cigar = 0;
  int __pyx_v_event_len;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  Py_ssize_t __pyx_t_10;
  Py_UCS4 __pyx_t_11;
  int __pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_ref_seq", 0);

  /* "aldy/indelpost/pileup.pyx":278
 *     UnsplicedLocalReference unspl_loc_ref,
 * ):
 *     cdef int current_pos = aln_start - 1             # <<<<<<<<<<<<<<
 * 
 *     if not "N" in cigar_string:
 */
  __pyx_v_current_pos = (__pyx_v_aln_start - 1);

  /* "aldy/indelpost/pileup.pyx":280
 *     cdef int current_pos = aln_start - 1
 * 
 *     if not "N" in cigar_string:             # <<<<<<<<<<<<<<
 *         #reference.fetch(chrom, current_pos, aln_end)
 *         return unspl_loc_ref.get_ref_seq(current_pos, aln_end)
 */
  if (unlikely(__pyx_v_cigar_string == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 280, __pyx_L1_error)
  }
  __pyx_t_1 = (__Pyx_PyUnicode_ContainsTF(__pyx_n_u_N, __pyx_v_cigar_string, Py_NE)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 280, __pyx_L1_error)
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "aldy/indelpost/pileup.pyx":282
 *     if not "N" in cigar_string:
 *         #reference.fetch(chrom, current_pos, aln_end)
 *         return unspl_loc_ref.get_ref_seq(current_pos, aln_end)             # <<<<<<<<<<<<<<
 * 
 *     cdef str ref_seq = ""
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_unspl_loc_ref), __pyx_n_s_get_ref_seq); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 282, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_current_pos); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 282, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_aln_end); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 282, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_5, __pyx_t_6};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 282, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_5, __pyx_t_6};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 282, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    {
      __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 282, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      if (__pyx_t_7) {
        __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_6);
      __pyx_t_5 = 0;
      __pyx_t_6 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 282, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (!(likely(PyUnicode_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(0, 282, __pyx_L1_error)
    __pyx_r = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "aldy/indelpost/pileup.pyx":280
 *     cdef int current_pos = aln_start - 1
 * 
 *     if not "N" in cigar_string:             # <<<<<<<<<<<<<<
 *         #reference.fetch(chrom, current_pos, aln_end)
 *         return unspl_loc_ref.get_ref_seq(current_pos, aln_end)
 */
  }

  /* "aldy/indelpost/pileup.pyx":284
 *         return unspl_loc_ref.get_ref_seq(current_pos, aln_end)
 * 
 *     cdef str ref_seq = ""             # <<<<<<<<<<<<<<
 *     cdef str event, cigar
 *     cdef int event_len
 */
  __Pyx_INCREF(__pyx_kp_u_);
  __pyx_v_ref_seq = __pyx_kp_u_;

  /* "aldy/indelpost/pileup.pyx":288
 *     cdef int event_len
 * 
 *     for cigar in cigar_list:             # <<<<<<<<<<<<<<
 *         event, event_len = cigar[-1], int(cigar[:-1])
 *         if event == "M" or event == "D":
 */
  if (unlikely(__pyx_v_cigar_list == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 288, __pyx_L1_error)
  }
  __pyx_t_3 = __pyx_v_cigar_list; __Pyx_INCREF(__pyx_t_3); __pyx_t_10 = 0;
  for (;;) {
    if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_3)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_4); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 288, __pyx_L1_error)
    #else
    __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 288, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    if (!(likely(PyUnicode_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(0, 288, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_cigar, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "aldy/indelpost/pileup.pyx":289
 * 
 *     for cigar in cigar_list:
 *         event, event_len = cigar[-1], int(cigar[:-1])             # <<<<<<<<<<<<<<
 *         if event == "M" or event == "D":
 *             ref_seq += reference.fetch(chrom, current_pos, current_pos + event_len)
 */
    __pyx_t_11 = __Pyx_GetItemInt_Unicode(__pyx_v_cigar, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_11 == (Py_UCS4)-1)) __PYX_ERR(0, 289, __pyx_L1_error)
    __pyx_t_4 = PyUnicode_FromOrdinal(__pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 289, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (!(likely(PyUnicode_CheckExact(__pyx_t_4))||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(0, 289, __pyx_L1_error)
    if (unlikely(__pyx_v_cigar == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 289, __pyx_L1_error)
    }
    __pyx_t_9 = __Pyx_PyUnicode_Substring(__pyx_v_cigar, 0, -1L); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 289, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_6 = __Pyx_PyNumber_Int(__pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 289, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_6); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 289, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF_SET(__pyx_v_event, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;
    __pyx_v_event_len = __pyx_t_8;

    /* "aldy/indelpost/pileup.pyx":290
 *     for cigar in cigar_list:
 *         event, event_len = cigar[-1], int(cigar[:-1])
 *         if event == "M" or event == "D":             # <<<<<<<<<<<<<<
 *             ref_seq += reference.fetch(chrom, current_pos, current_pos + event_len)
 *             current_pos += event_len
 */
    __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_event, __pyx_n_u_M, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 290, __pyx_L1_error)
    __pyx_t_12 = (__pyx_t_1 != 0);
    if (!__pyx_t_12) {
    } else {
      __pyx_t_2 = __pyx_t_12;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_12 = (__Pyx_PyUnicode_Equals(__pyx_v_event, __pyx_n_u_D, Py_EQ)); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 290, __pyx_L1_error)
    __pyx_t_1 = (__pyx_t_12 != 0);
    __pyx_t_2 = __pyx_t_1;
    __pyx_L7_bool_binop_done:;
    if (__pyx_t_2) {

      /* "aldy/indelpost/pileup.pyx":291
 *         event, event_len = cigar[-1], int(cigar[:-1])
 *         if event == "M" or event == "D":
 *             ref_seq += reference.fetch(chrom, current_pos, current_pos + event_len)             # <<<<<<<<<<<<<<
 *             current_pos += event_len
 *         elif event in ("I", "S", "H", "P"):
 */
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_reference), __pyx_n_s_fetch); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 291, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_current_pos); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 291, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_5 = __Pyx_PyInt_From_int((__pyx_v_current_pos + __pyx_v_event_len)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 291, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_7 = NULL;
      __pyx_t_8 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
          __pyx_t_8 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_v_chrom, __pyx_t_9, __pyx_t_5};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 291, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_v_chrom, __pyx_t_9, __pyx_t_5};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 291, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      } else
      #endif
      {
        __pyx_t_13 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 291, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        if (__pyx_t_7) {
          __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_7); __pyx_t_7 = NULL;
        }
        __Pyx_INCREF(__pyx_v_chrom);
        __Pyx_GIVEREF(__pyx_v_chrom);
        PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_8, __pyx_v_chrom);
        __Pyx_GIVEREF(__pyx_t_9);
        PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_8, __pyx_t_9);
        __Pyx_GIVEREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_13, 2+__pyx_t_8, __pyx_t_5);
        __pyx_t_9 = 0;
        __pyx_t_5 = 0;
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_13, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 291, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      }
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyNumber_InPlaceAdd(__pyx_v_ref_seq, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 291, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (!(likely(PyUnicode_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_6)->tp_name), 0))) __PYX_ERR(0, 291, __pyx_L1_error)
      __Pyx_DECREF_SET(__pyx_v_ref_seq, ((PyObject*)__pyx_t_6));
      __pyx_t_6 = 0;

      /* "aldy/indelpost/pileup.pyx":292
 *         if event == "M" or event == "D":
 *             ref_seq += reference.fetch(chrom, current_pos, current_pos + event_len)
 *             current_pos += event_len             # <<<<<<<<<<<<<<
 *         elif event in ("I", "S", "H", "P"):
 *             pass
 */
      __pyx_v_current_pos = (__pyx_v_current_pos + __pyx_v_event_len);

      /* "aldy/indelpost/pileup.pyx":290
 *     for cigar in cigar_list:
 *         event, event_len = cigar[-1], int(cigar[:-1])
 *         if event == "M" or event == "D":             # <<<<<<<<<<<<<<
 *             ref_seq += reference.fetch(chrom, current_pos, current_pos + event_len)
 *             current_pos += event_len
 */
      goto __pyx_L6;
    }

    /* "aldy/indelpost/pileup.pyx":293
 *             ref_seq += reference.fetch(chrom, current_pos, current_pos + event_len)
 *             current_pos += event_len
 *         elif event in ("I", "S", "H", "P"):             # <<<<<<<<<<<<<<
 *             pass
 *         else:
 */
    __Pyx_INCREF(__pyx_v_event);
    __pyx_t_14 = __pyx_v_event;
    __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_t_14, __pyx_n_u_I, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 293, __pyx_L1_error)
    __pyx_t_12 = (__pyx_t_1 != 0);
    if (!__pyx_t_12) {
    } else {
      __pyx_t_2 = __pyx_t_12;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_12 = (__Pyx_PyUnicode_Equals(__pyx_t_14, __pyx_n_u_S, Py_EQ)); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 293, __pyx_L1_error)
    __pyx_t_1 = (__pyx_t_12 != 0);
    if (!__pyx_t_1) {
    } else {
      __pyx_t_2 = __pyx_t_1;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_t_14, __pyx_n_u_H, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 293, __pyx_L1_error)
    __pyx_t_12 = (__pyx_t_1 != 0);
    if (!__pyx_t_12) {
    } else {
      __pyx_t_2 = __pyx_t_12;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_12 = (__Pyx_PyUnicode_Equals(__pyx_t_14, __pyx_n_u_P, Py_EQ)); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 293, __pyx_L1_error)
    __pyx_t_1 = (__pyx_t_12 != 0);
    __pyx_t_2 = __pyx_t_1;
    __pyx_L9_bool_binop_done:;
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {
      goto __pyx_L6;
    }

    /* "aldy/indelpost/pileup.pyx":296
 *             pass
 *         else:
 *             current_pos += event_len             # <<<<<<<<<<<<<<
 * 
 *     return ref_seq
 */
    /*else*/ {
      __pyx_v_current_pos = (__pyx_v_current_pos + __pyx_v_event_len);
    }
    __pyx_L6:;

    /* "aldy/indelpost/pileup.pyx":288
 *     cdef int event_len
 * 
 *     for cigar in cigar_list:             # <<<<<<<<<<<<<<
 *         event, event_len = cigar[-1], int(cigar[:-1])
 *         if event == "M" or event == "D":
 */
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "aldy/indelpost/pileup.pyx":298
 *             current_pos += event_len
 * 
 *     return ref_seq             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_ref_seq);
  __pyx_r = __pyx_v_ref_seq;
  goto __pyx_L0;

  /* "aldy/indelpost/pileup.pyx":269
 * 
 * 
 * cdef str get_ref_seq(             # <<<<<<<<<<<<<<
 *     str chrom,
 *     int aln_start,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_AddTraceback("aldy.indelpost.pileup.get_ref_seq", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ref_seq);
  __Pyx_XDECREF(__pyx_v_event);
  __Pyx_XDECREF(__pyx_v_cigar);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "aldy/indelpost/pileup.pyx":301
 * 
 * 
 * cdef tuple leftalign_indel_read(             # <<<<<<<<<<<<<<
 *     str chrom,
 *     int pos,
 */

static PyObject *__pyx_f_4aldy_9indelpost_6pileup_leftalign_indel_read(PyObject *__pyx_v_chrom, int __pyx_v_pos, int __pyx_v_indel_len, PyObject *__pyx_v_indel_type, PyObject *__pyx_v_cigar_string, int __pyx_v_read_start, int __pyx_v_aln_start, PyObject *__pyx_v_read_seq, PyObject *__pyx_v_ref_seq, PyObject *__pyx_v_read_qual, struct __pyx_obj_5pysam_9libcfaidx_FastaFile *__pyx_v_reference) {
  PyObject *__pyx_v_lt_flank = NULL;
  PyObject *__pyx_v_rt_flank = NULL;
  PyObject *__pyx_v_lt_ref = NULL;
  PyObject *__pyx_v_rt_ref = NULL;
  PyObject *__pyx_v_lt_qual = NULL;
  PyObject *__pyx_v_rt_qual = NULL;
  PyObject *__pyx_v_padding_base = NULL;
  PyObject *__pyx_v_indel_seq = NULL;
  struct __pyx_obj_4aldy_9indelpost_7variant_Variant *__pyx_v_var = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("leftalign_indel_read", 0);

  /* "aldy/indelpost/pileup.pyx":314
 *     FastaFile reference,
 * ):
 *     lt_flank, rt_flank = split(             # <<<<<<<<<<<<<<
 *         read_seq, cigar_string, pos, read_start, is_for_ref=False, reverse=False
 *     )
 */
  __pyx_t_1 = __pyx_f_4aldy_9indelpost_9utilities_split(__pyx_v_read_seq, __pyx_v_cigar_string, __pyx_v_pos, __pyx_v_read_start, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 314, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(__pyx_t_1 != Py_None)) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 314, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 314, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 314, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 314, __pyx_L1_error)
  }
  __pyx_v_lt_flank = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_rt_flank = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "aldy/indelpost/pileup.pyx":317
 *         read_seq, cigar_string, pos, read_start, is_for_ref=False, reverse=False
 *     )
 *     lt_ref, rt_ref = split(             # <<<<<<<<<<<<<<
 *         ref_seq, cigar_string, pos, aln_start, is_for_ref=True, reverse=False
 *     )
 */
  __pyx_t_1 = __pyx_f_4aldy_9indelpost_9utilities_split(__pyx_v_ref_seq, __pyx_v_cigar_string, __pyx_v_pos, __pyx_v_aln_start, 1, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 317, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(__pyx_t_1 != Py_None)) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 317, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    #else
    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 317, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 317, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 317, __pyx_L1_error)
  }
  __pyx_v_lt_ref = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_rt_ref = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "aldy/indelpost/pileup.pyx":320
 *         ref_seq, cigar_string, pos, aln_start, is_for_ref=True, reverse=False
 *     )
 *     lt_qual, rt_qual = split(             # <<<<<<<<<<<<<<
 *         read_qual, cigar_string, pos, read_start, is_for_ref=False, reverse=False
 *     )
 */
  __pyx_t_1 = __pyx_f_4aldy_9indelpost_9utilities_split(__pyx_v_read_qual, __pyx_v_cigar_string, __pyx_v_pos, __pyx_v_read_start, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 320, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(__pyx_t_1 != Py_None)) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 320, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 320, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 320, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 320, __pyx_L1_error)
  }
  __pyx_v_lt_qual = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_rt_qual = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "aldy/indelpost/pileup.pyx":324
 *     )
 * 
 *     padding_base = reference.fetch(chrom, pos - 1, pos) if "N" in cigar_string or not lt_ref else lt_ref[-1]             # <<<<<<<<<<<<<<
 *     if indel_type == "I":
 *         indel_seq = rt_flank[:indel_len]
 */
  if (unlikely(__pyx_v_cigar_string == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 324, __pyx_L1_error)
  }
  __pyx_t_5 = (__Pyx_PyUnicode_ContainsTF(__pyx_n_u_N, __pyx_v_cigar_string, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 324, __pyx_L1_error)
  __pyx_t_6 = (__pyx_t_5 != 0);
  if (!__pyx_t_6) {
  } else {
    __pyx_t_4 = __pyx_t_6;
    goto __pyx_L3_bool_binop_done;
  }
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_lt_ref); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 324, __pyx_L1_error)
  __pyx_t_5 = ((!__pyx_t_6) != 0);
  __pyx_t_4 = __pyx_t_5;
  __pyx_L3_bool_binop_done:;
  if (__pyx_t_4) {
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_reference), __pyx_n_s_fetch); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 324, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = __Pyx_PyInt_From_long((__pyx_v_pos - 1)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 324, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_pos); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 324, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = NULL;
    __pyx_t_10 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_10 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[4] = {__pyx_t_9, __pyx_v_chrom, __pyx_t_7, __pyx_t_8};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_10, 3+__pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 324, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[4] = {__pyx_t_9, __pyx_v_chrom, __pyx_t_7, __pyx_t_8};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_10, 3+__pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 324, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    } else
    #endif
    {
      __pyx_t_11 = PyTuple_New(3+__pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 324, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      if (__pyx_t_9) {
        __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9); __pyx_t_9 = NULL;
      }
      __Pyx_INCREF(__pyx_v_chrom);
      __Pyx_GIVEREF(__pyx_v_chrom);
      PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_10, __pyx_v_chrom);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_10, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_11, 2+__pyx_t_10, __pyx_t_8);
      __pyx_t_7 = 0;
      __pyx_t_8 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 324, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
  } else {
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_lt_ref, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 324, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
  }
  __pyx_v_padding_base = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "aldy/indelpost/pileup.pyx":325
 * 
 *     padding_base = reference.fetch(chrom, pos - 1, pos) if "N" in cigar_string or not lt_ref else lt_ref[-1]
 *     if indel_type == "I":             # <<<<<<<<<<<<<<
 *         indel_seq = rt_flank[:indel_len]
 *         rt_flank = rt_flank[indel_len:]
 */
  __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_v_indel_type, __pyx_n_u_I, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 325, __pyx_L1_error)
  __pyx_t_5 = (__pyx_t_4 != 0);
  if (__pyx_t_5) {

    /* "aldy/indelpost/pileup.pyx":326
 *     padding_base = reference.fetch(chrom, pos - 1, pos) if "N" in cigar_string or not lt_ref else lt_ref[-1]
 *     if indel_type == "I":
 *         indel_seq = rt_flank[:indel_len]             # <<<<<<<<<<<<<<
 *         rt_flank = rt_flank[indel_len:]
 *         rt_qual = rt_qual[indel_len:]
 */
    __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_rt_flank, 0, __pyx_v_indel_len, NULL, NULL, NULL, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 326, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_indel_seq = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "aldy/indelpost/pileup.pyx":327
 *     if indel_type == "I":
 *         indel_seq = rt_flank[:indel_len]
 *         rt_flank = rt_flank[indel_len:]             # <<<<<<<<<<<<<<
 *         rt_qual = rt_qual[indel_len:]
 *         var = Variant(chrom, pos, padding_base, padding_base + indel_seq, reference, skip_validation=True)
 */
    __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_rt_flank, __pyx_v_indel_len, 0, NULL, NULL, NULL, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 327, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_rt_flank, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "aldy/indelpost/pileup.pyx":328
 *         indel_seq = rt_flank[:indel_len]
 *         rt_flank = rt_flank[indel_len:]
 *         rt_qual = rt_qual[indel_len:]             # <<<<<<<<<<<<<<
 *         var = Variant(chrom, pos, padding_base, padding_base + indel_seq, reference, skip_validation=True)
 *     else:
 */
    __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_rt_qual, __pyx_v_indel_len, 0, NULL, NULL, NULL, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 328, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_rt_qual, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "aldy/indelpost/pileup.pyx":329
 *         rt_flank = rt_flank[indel_len:]
 *         rt_qual = rt_qual[indel_len:]
 *         var = Variant(chrom, pos, padding_base, padding_base + indel_seq, reference, skip_validation=True)             # <<<<<<<<<<<<<<
 *     else:
 *         indel_seq = rt_ref[:indel_len]
 */
    __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_pos); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 329, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyNumber_Add(__pyx_v_padding_base, __pyx_v_indel_seq); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 329, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 329, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_chrom);
    __Pyx_GIVEREF(__pyx_v_chrom);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_chrom);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
    __Pyx_INCREF(__pyx_v_padding_base);
    __Pyx_GIVEREF(__pyx_v_padding_base);
    PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_padding_base);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_3);
    __Pyx_INCREF(((PyObject *)__pyx_v_reference));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_reference));
    PyTuple_SET_ITEM(__pyx_t_2, 4, ((PyObject *)__pyx_v_reference));
    __pyx_t_1 = 0;
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 329, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_skip_validation, Py_True) < 0) __PYX_ERR(0, 329, __pyx_L1_error)
    __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4aldy_9indelpost_7variant_Variant), __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 329, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_var = ((struct __pyx_obj_4aldy_9indelpost_7variant_Variant *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "aldy/indelpost/pileup.pyx":325
 * 
 *     padding_base = reference.fetch(chrom, pos - 1, pos) if "N" in cigar_string or not lt_ref else lt_ref[-1]
 *     if indel_type == "I":             # <<<<<<<<<<<<<<
 *         indel_seq = rt_flank[:indel_len]
 *         rt_flank = rt_flank[indel_len:]
 */
    goto __pyx_L5;
  }

  /* "aldy/indelpost/pileup.pyx":331
 *         var = Variant(chrom, pos, padding_base, padding_base + indel_seq, reference, skip_validation=True)
 *     else:
 *         indel_seq = rt_ref[:indel_len]             # <<<<<<<<<<<<<<
 *         rt_ref = rt_ref[indel_len:]
 *         var = Variant(chrom, pos, padding_base + indel_seq, padding_base, reference, skip_validation=True)
 */
  /*else*/ {
    __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_rt_ref, 0, __pyx_v_indel_len, NULL, NULL, NULL, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 331, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_indel_seq = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "aldy/indelpost/pileup.pyx":332
 *     else:
 *         indel_seq = rt_ref[:indel_len]
 *         rt_ref = rt_ref[indel_len:]             # <<<<<<<<<<<<<<
 *         var = Variant(chrom, pos, padding_base + indel_seq, padding_base, reference, skip_validation=True)
 * 
 */
    __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_rt_ref, __pyx_v_indel_len, 0, NULL, NULL, NULL, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 332, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_rt_ref, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "aldy/indelpost/pileup.pyx":333
 *         indel_seq = rt_ref[:indel_len]
 *         rt_ref = rt_ref[indel_len:]
 *         var = Variant(chrom, pos, padding_base + indel_seq, padding_base, reference, skip_validation=True)             # <<<<<<<<<<<<<<
 * 
 *     return pos, lt_flank, indel_seq, rt_flank, lt_ref, rt_ref, lt_qual, rt_qual, var
 */
    __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_pos); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 333, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyNumber_Add(__pyx_v_padding_base, __pyx_v_indel_seq); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 333, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 333, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_chrom);
    __Pyx_GIVEREF(__pyx_v_chrom);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_chrom);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_3);
    __Pyx_INCREF(__pyx_v_padding_base);
    __Pyx_GIVEREF(__pyx_v_padding_base);
    PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_padding_base);
    __Pyx_INCREF(((PyObject *)__pyx_v_reference));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_reference));
    PyTuple_SET_ITEM(__pyx_t_2, 4, ((PyObject *)__pyx_v_reference));
    __pyx_t_1 = 0;
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 333, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_skip_validation, Py_True) < 0) __PYX_ERR(0, 333, __pyx_L1_error)
    __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4aldy_9indelpost_7variant_Variant), __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 333, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_var = ((struct __pyx_obj_4aldy_9indelpost_7variant_Variant *)__pyx_t_1);
    __pyx_t_1 = 0;
  }
  __pyx_L5:;

  /* "aldy/indelpost/pileup.pyx":335
 *         var = Variant(chrom, pos, padding_base + indel_seq, padding_base, reference, skip_validation=True)
 * 
 *     return pos, lt_flank, indel_seq, rt_flank, lt_ref, rt_ref, lt_qual, rt_qual, var             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_pos); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 335, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 335, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_INCREF(__pyx_v_lt_flank);
  __Pyx_GIVEREF(__pyx_v_lt_flank);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_lt_flank);
  __Pyx_INCREF(__pyx_v_indel_seq);
  __Pyx_GIVEREF(__pyx_v_indel_seq);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_indel_seq);
  __Pyx_INCREF(__pyx_v_rt_flank);
  __Pyx_GIVEREF(__pyx_v_rt_flank);
  PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_v_rt_flank);
  __Pyx_INCREF(__pyx_v_lt_ref);
  __Pyx_GIVEREF(__pyx_v_lt_ref);
  PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_v_lt_ref);
  __Pyx_INCREF(__pyx_v_rt_ref);
  __Pyx_GIVEREF(__pyx_v_rt_ref);
  PyTuple_SET_ITEM(__pyx_t_3, 5, __pyx_v_rt_ref);
  __Pyx_INCREF(__pyx_v_lt_qual);
  __Pyx_GIVEREF(__pyx_v_lt_qual);
  PyTuple_SET_ITEM(__pyx_t_3, 6, __pyx_v_lt_qual);
  __Pyx_INCREF(__pyx_v_rt_qual);
  __Pyx_GIVEREF(__pyx_v_rt_qual);
  PyTuple_SET_ITEM(__pyx_t_3, 7, __pyx_v_rt_qual);
  __Pyx_INCREF(((PyObject *)__pyx_v_var));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_var));
  PyTuple_SET_ITEM(__pyx_t_3, 8, ((PyObject *)__pyx_v_var));
  __pyx_t_1 = 0;
  __pyx_r = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "aldy/indelpost/pileup.pyx":301
 * 
 * 
 * cdef tuple leftalign_indel_read(             # <<<<<<<<<<<<<<
 *     str chrom,
 *     int pos,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("aldy.indelpost.pileup.leftalign_indel_read", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_lt_flank);
  __Pyx_XDECREF(__pyx_v_rt_flank);
  __Pyx_XDECREF(__pyx_v_lt_ref);
  __Pyx_XDECREF(__pyx_v_rt_ref);
  __Pyx_XDECREF(__pyx_v_lt_qual);
  __Pyx_XDECREF(__pyx_v_rt_qual);
  __Pyx_XDECREF(__pyx_v_padding_base);
  __Pyx_XDECREF(__pyx_v_indel_seq);
  __Pyx_XDECREF((PyObject *)__pyx_v_var);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "aldy/indelpost/pileup.pyx":338
 * 
 * 
 * cdef bint is_end_dirty(array.array read_qual, int basequalthresh, int pos, int read_start, int read_end, str cigar_string):             # <<<<<<<<<<<<<<
 *     cdef int dist_to_left_end = pos - read_start
 *     cdef int dist_to_right_end = read_end - pos
 */

static int __pyx_f_4aldy_9indelpost_6pileup_is_end_dirty(arrayobject *__pyx_v_read_qual, int __pyx_v_basequalthresh, int __pyx_v_pos, int __pyx_v_read_start, int __pyx_v_read_end, PyObject *__pyx_v_cigar_string) {
  int __pyx_v_dist_to_left_end;
  int __pyx_v_dist_to_right_end;
  int __pyx_v_is_lefty;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("is_end_dirty", 0);

  /* "aldy/indelpost/pileup.pyx":339
 * 
 * cdef bint is_end_dirty(array.array read_qual, int basequalthresh, int pos, int read_start, int read_end, str cigar_string):
 *     cdef int dist_to_left_end = pos - read_start             # <<<<<<<<<<<<<<
 *     cdef int dist_to_right_end = read_end - pos
 *     cdef bint is_lefty
 */
  __pyx_v_dist_to_left_end = (__pyx_v_pos - __pyx_v_read_start);

  /* "aldy/indelpost/pileup.pyx":340
 * cdef bint is_end_dirty(array.array read_qual, int basequalthresh, int pos, int read_start, int read_end, str cigar_string):
 *     cdef int dist_to_left_end = pos - read_start
 *     cdef int dist_to_right_end = read_end - pos             # <<<<<<<<<<<<<<
 *     cdef bint is_lefty
 * 
 */
  __pyx_v_dist_to_right_end = (__pyx_v_read_end - __pyx_v_pos);

  /* "aldy/indelpost/pileup.pyx":343
 *     cdef bint is_lefty
 * 
 *     if dist_to_left_end < 0:             # <<<<<<<<<<<<<<
 *         is_lefty = True
 *     elif dist_to_right_end < 0:
 */
  __pyx_t_1 = ((__pyx_v_dist_to_left_end < 0) != 0);
  if (__pyx_t_1) {

    /* "aldy/indelpost/pileup.pyx":344
 * 
 *     if dist_to_left_end < 0:
 *         is_lefty = True             # <<<<<<<<<<<<<<
 *     elif dist_to_right_end < 0:
 *         is_lefty = False
 */
    __pyx_v_is_lefty = 1;

    /* "aldy/indelpost/pileup.pyx":343
 *     cdef bint is_lefty
 * 
 *     if dist_to_left_end < 0:             # <<<<<<<<<<<<<<
 *         is_lefty = True
 *     elif dist_to_right_end < 0:
 */
    goto __pyx_L3;
  }

  /* "aldy/indelpost/pileup.pyx":345
 *     if dist_to_left_end < 0:
 *         is_lefty = True
 *     elif dist_to_right_end < 0:             # <<<<<<<<<<<<<<
 *         is_lefty = False
 *     else:
 */
  __pyx_t_1 = ((__pyx_v_dist_to_right_end < 0) != 0);
  if (__pyx_t_1) {

    /* "aldy/indelpost/pileup.pyx":346
 *         is_lefty = True
 *     elif dist_to_right_end < 0:
 *         is_lefty = False             # <<<<<<<<<<<<<<
 *     else:
 *         is_lefty = (dist_to_left_end <= dist_to_right_end)
 */
    __pyx_v_is_lefty = 0;

    /* "aldy/indelpost/pileup.pyx":345
 *     if dist_to_left_end < 0:
 *         is_lefty = True
 *     elif dist_to_right_end < 0:             # <<<<<<<<<<<<<<
 *         is_lefty = False
 *     else:
 */
    goto __pyx_L3;
  }

  /* "aldy/indelpost/pileup.pyx":348
 *         is_lefty = False
 *     else:
 *         is_lefty = (dist_to_left_end <= dist_to_right_end)             # <<<<<<<<<<<<<<
 * 
 *     if cigar_string.count("N") > 1:
 */
  /*else*/ {
    __pyx_v_is_lefty = (__pyx_v_dist_to_left_end <= __pyx_v_dist_to_right_end);
  }
  __pyx_L3:;

  /* "aldy/indelpost/pileup.pyx":350
 *         is_lefty = (dist_to_left_end <= dist_to_right_end)
 * 
 *     if cigar_string.count("N") > 1:             # <<<<<<<<<<<<<<
 *         return False
 *     else:
 */
  if (unlikely(__pyx_v_cigar_string == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "count");
    __PYX_ERR(0, 350, __pyx_L1_error)
  }
  __pyx_t_2 = PyUnicode_Count(__pyx_v_cigar_string, __pyx_n_u_N, 0, PY_SSIZE_T_MAX); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 350, __pyx_L1_error)
  __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 350, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_int_1, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 350, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 350, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_1) {

    /* "aldy/indelpost/pileup.pyx":351
 * 
 *     if cigar_string.count("N") > 1:
 *         return False             # <<<<<<<<<<<<<<
 *     else:
 *         if is_lefty:
 */
    __pyx_r = 0;
    goto __pyx_L0;

    /* "aldy/indelpost/pileup.pyx":350
 *         is_lefty = (dist_to_left_end <= dist_to_right_end)
 * 
 *     if cigar_string.count("N") > 1:             # <<<<<<<<<<<<<<
 *         return False
 *     else:
 */
  }

  /* "aldy/indelpost/pileup.pyx":353
 *         return False
 *     else:
 *         if is_lefty:             # <<<<<<<<<<<<<<
 *             return min(read_qual[: 3]) < basequalthresh
 *         else:
 */
  /*else*/ {
    __pyx_t_1 = (__pyx_v_is_lefty != 0);
    if (__pyx_t_1) {

      /* "aldy/indelpost/pileup.pyx":354
 *     else:
 *         if is_lefty:
 *             return min(read_qual[: 3]) < basequalthresh             # <<<<<<<<<<<<<<
 *         else:
 *             return min(read_qual[-3 :]) < basequalthresh
 */
      __pyx_t_4 = __Pyx_PyObject_GetSlice(((PyObject *)__pyx_v_read_qual), 0, 3, NULL, NULL, &__pyx_slice__5, 0, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 354, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_min, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 354, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_basequalthresh); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 354, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 354, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 354, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_r = __pyx_t_1;
      goto __pyx_L0;

      /* "aldy/indelpost/pileup.pyx":353
 *         return False
 *     else:
 *         if is_lefty:             # <<<<<<<<<<<<<<
 *             return min(read_qual[: 3]) < basequalthresh
 *         else:
 */
    }

    /* "aldy/indelpost/pileup.pyx":356
 *             return min(read_qual[: 3]) < basequalthresh
 *         else:
 *             return min(read_qual[-3 :]) < basequalthresh             # <<<<<<<<<<<<<<
 * 
 * 
 */
    /*else*/ {
      __pyx_t_5 = __Pyx_PyObject_GetSlice(((PyObject *)__pyx_v_read_qual), -3L, 0, NULL, NULL, &__pyx_slice__6, 1, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 356, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_min, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 356, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_basequalthresh); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 356, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_t_4, __pyx_t_5, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 356, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 356, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_1;
      goto __pyx_L0;
    }
  }

  /* "aldy/indelpost/pileup.pyx":338
 * 
 * 
 * cdef bint is_end_dirty(array.array read_qual, int basequalthresh, int pos, int read_start, int read_end, str cigar_string):             # <<<<<<<<<<<<<<
 *     cdef int dist_to_left_end = pos - read_start
 *     cdef int dist_to_right_end = read_end - pos
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_WriteUnraisable("aldy.indelpost.pileup.is_end_dirty", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "aldy/indelpost/pileup.pyx":359
 * 
 * 
 * cdef str leftalign_cigar(str cigarstring, Variant target, int read_start):             # <<<<<<<<<<<<<<
 *     target.normalize(inplace=True)
 * 
 */

static PyObject *__pyx_f_4aldy_9indelpost_6pileup_leftalign_cigar(PyObject *__pyx_v_cigarstring, struct __pyx_obj_4aldy_9indelpost_7variant_Variant *__pyx_v_target, int __pyx_v_read_start) {
  int __pyx_v_pos;
  PyObject *__pyx_v_lt_cigar_lst = NULL;
  PyObject *__pyx_v_rt_cigar_lst = NULL;
  PyObject *__pyx_v_tmp0 = NULL;
  PyObject *__pyx_v_tmp1 = NULL;
  PyObject *__pyx_v_tmp2 = NULL;
  PyObject *__pyx_v_new_cigar = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  Py_ssize_t __pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("leftalign_cigar", 0);

  /* "aldy/indelpost/pileup.pyx":360
 * 
 * cdef str leftalign_cigar(str cigarstring, Variant target, int read_start):
 *     target.normalize(inplace=True)             # <<<<<<<<<<<<<<
 * 
 *     pos = target.pos
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_target), __pyx_n_s_normalize); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 360, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 360, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_inplace, Py_True) < 0) __PYX_ERR(0, 360, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 360, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "aldy/indelpost/pileup.pyx":362
 *     target.normalize(inplace=True)
 * 
 *     pos = target.pos             # <<<<<<<<<<<<<<
 * 
 *     lt_cigar_lst, rt_cigar_lst = split_cigar(cigarstring, pos, read_start)
 */
  __pyx_t_4 = __pyx_v_target->pos;
  __pyx_v_pos = __pyx_t_4;

  /* "aldy/indelpost/pileup.pyx":364
 *     pos = target.pos
 * 
 *     lt_cigar_lst, rt_cigar_lst = split_cigar(cigarstring, pos, read_start)             # <<<<<<<<<<<<<<
 * 
 *     if len(rt_cigar_lst) < 3:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_split_cigar); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_pos); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_read_start); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_v_cigarstring, __pyx_t_1, __pyx_t_5};
    __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 364, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_v_cigarstring, __pyx_t_1, __pyx_t_5};
    __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 364, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 364, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_INCREF(__pyx_v_cigarstring);
    __Pyx_GIVEREF(__pyx_v_cigarstring);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_4, __pyx_v_cigarstring);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_4, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_4, __pyx_t_5);
    __pyx_t_1 = 0;
    __pyx_t_5 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 364, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
    PyObject* sequence = __pyx_t_3;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 364, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_7 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_7);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 364, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 364, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    #endif
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_5 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 364, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_8 = Py_TYPE(__pyx_t_5)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_8(__pyx_t_5); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_7 = __pyx_t_8(__pyx_t_5); if (unlikely(!__pyx_t_7)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_7);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_5), 2) < 0) __PYX_ERR(0, 364, __pyx_L1_error)
    __pyx_t_8 = NULL;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_8 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 364, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_lt_cigar_lst = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_rt_cigar_lst = __pyx_t_7;
  __pyx_t_7 = 0;

  /* "aldy/indelpost/pileup.pyx":366
 *     lt_cigar_lst, rt_cigar_lst = split_cigar(cigarstring, pos, read_start)
 * 
 *     if len(rt_cigar_lst) < 3:             # <<<<<<<<<<<<<<
 *         return cigarstring
 * 
 */
  __pyx_t_9 = PyObject_Length(__pyx_v_rt_cigar_lst); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 366, __pyx_L1_error)
  __pyx_t_10 = ((__pyx_t_9 < 3) != 0);
  if (__pyx_t_10) {

    /* "aldy/indelpost/pileup.pyx":367
 * 
 *     if len(rt_cigar_lst) < 3:
 *         return cigarstring             # <<<<<<<<<<<<<<
 * 
 *     tmp0, tmp1, tmp2 = rt_cigar_lst[0], rt_cigar_lst[1], rt_cigar_lst[2]
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_cigarstring);
    __pyx_r = __pyx_v_cigarstring;
    goto __pyx_L0;

    /* "aldy/indelpost/pileup.pyx":366
 *     lt_cigar_lst, rt_cigar_lst = split_cigar(cigarstring, pos, read_start)
 * 
 *     if len(rt_cigar_lst) < 3:             # <<<<<<<<<<<<<<
 *         return cigarstring
 * 
 */
  }

  /* "aldy/indelpost/pileup.pyx":369
 *         return cigarstring
 * 
 *     tmp0, tmp1, tmp2 = rt_cigar_lst[0], rt_cigar_lst[1], rt_cigar_lst[2]             # <<<<<<<<<<<<<<
 *     if "M" in tmp0 and "M" in tmp2:
 *         tmp0, tmp2 = int(tmp0[:-1]), int(tmp2[:-1])
 */
  __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_rt_cigar_lst, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 369, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_rt_cigar_lst, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 369, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_rt_cigar_lst, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 369, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_tmp0 = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_tmp1 = __pyx_t_7;
  __pyx_t_7 = 0;
  __pyx_v_tmp2 = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "aldy/indelpost/pileup.pyx":370
 * 
 *     tmp0, tmp1, tmp2 = rt_cigar_lst[0], rt_cigar_lst[1], rt_cigar_lst[2]
 *     if "M" in tmp0 and "M" in tmp2:             # <<<<<<<<<<<<<<
 *         tmp0, tmp2 = int(tmp0[:-1]), int(tmp2[:-1])
 *     else:
 */
  __pyx_t_11 = (__Pyx_PySequence_ContainsTF(__pyx_n_u_M, __pyx_v_tmp0, Py_EQ)); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 370, __pyx_L1_error)
  __pyx_t_12 = (__pyx_t_11 != 0);
  if (__pyx_t_12) {
  } else {
    __pyx_t_10 = __pyx_t_12;
    goto __pyx_L7_bool_binop_done;
  }
  __pyx_t_12 = (__Pyx_PySequence_ContainsTF(__pyx_n_u_M, __pyx_v_tmp2, Py_EQ)); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 370, __pyx_L1_error)
  __pyx_t_11 = (__pyx_t_12 != 0);
  __pyx_t_10 = __pyx_t_11;
  __pyx_L7_bool_binop_done:;
  if (__pyx_t_10) {

    /* "aldy/indelpost/pileup.pyx":371
 *     tmp0, tmp1, tmp2 = rt_cigar_lst[0], rt_cigar_lst[1], rt_cigar_lst[2]
 *     if "M" in tmp0 and "M" in tmp2:
 *         tmp0, tmp2 = int(tmp0[:-1]), int(tmp2[:-1])             # <<<<<<<<<<<<<<
 *     else:
 *         return cigarstring
 */
    __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_tmp0, 0, -1L, NULL, NULL, &__pyx_slice__4, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 371, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = __Pyx_PyNumber_Int(__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 371, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_tmp2, 0, -1L, NULL, NULL, &__pyx_slice__4, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 371, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyNumber_Int(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 371, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF_SET(__pyx_v_tmp0, __pyx_t_7);
    __pyx_t_7 = 0;
    __Pyx_DECREF_SET(__pyx_v_tmp2, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "aldy/indelpost/pileup.pyx":370
 * 
 *     tmp0, tmp1, tmp2 = rt_cigar_lst[0], rt_cigar_lst[1], rt_cigar_lst[2]
 *     if "M" in tmp0 and "M" in tmp2:             # <<<<<<<<<<<<<<
 *         tmp0, tmp2 = int(tmp0[:-1]), int(tmp2[:-1])
 *     else:
 */
    goto __pyx_L6;
  }

  /* "aldy/indelpost/pileup.pyx":373
 *         tmp0, tmp2 = int(tmp0[:-1]), int(tmp2[:-1])
 *     else:
 *         return cigarstring             # <<<<<<<<<<<<<<
 * 
 *     new_cigar = tmp1 + str(tmp0 + tmp2) + "M" + "".join(rt_cigar_lst[3:])
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_cigarstring);
    __pyx_r = __pyx_v_cigarstring;
    goto __pyx_L0;
  }
  __pyx_L6:;

  /* "aldy/indelpost/pileup.pyx":375
 *         return cigarstring
 * 
 *     new_cigar = tmp1 + str(tmp0 + tmp2) + "M" + "".join(rt_cigar_lst[3:])             # <<<<<<<<<<<<<<
 * 
 *     return "".join(lt_cigar_lst) + new_cigar
 */
  __pyx_t_3 = PyNumber_Add(__pyx_v_tmp0, __pyx_v_tmp2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 375, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 375, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Add(__pyx_v_tmp1, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 375, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = PyNumber_Add(__pyx_t_3, __pyx_n_u_M); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 375, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_rt_cigar_lst, 3, 0, NULL, NULL, &__pyx_slice__7, 1, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 375, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyUnicode_Join(__pyx_kp_u_, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 375, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Add(__pyx_t_7, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 375, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_new_cigar = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "aldy/indelpost/pileup.pyx":377
 *     new_cigar = tmp1 + str(tmp0 + tmp2) + "M" + "".join(rt_cigar_lst[3:])
 * 
 *     return "".join(lt_cigar_lst) + new_cigar             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyUnicode_Join(__pyx_kp_u_, __pyx_v_lt_cigar_lst); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 377, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyNumber_Add(__pyx_t_3, __pyx_v_new_cigar); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 377, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(PyUnicode_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 377, __pyx_L1_error)
  __pyx_r = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "aldy/indelpost/pileup.pyx":359
 * 
 * 
 * cdef str leftalign_cigar(str cigarstring, Variant target, int read_start):             # <<<<<<<<<<<<<<
 *     target.normalize(inplace=True)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("aldy.indelpost.pileup.leftalign_cigar", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_lt_cigar_lst);
  __Pyx_XDECREF(__pyx_v_rt_cigar_lst);
  __Pyx_XDECREF(__pyx_v_tmp0);
  __Pyx_XDECREF(__pyx_v_tmp1);
  __Pyx_XDECREF(__pyx_v_tmp2);
  __Pyx_XDECREF(__pyx_v_new_cigar);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "aldy/indelpost/pileup.pyx":380
 * 
 * 
 * cdef tuple parse_spliced_read(str cigar_string, int read_start, int read_end, int pos, int rpos):             # <<<<<<<<<<<<<<
 *     spliced_subreads = get_spliced_subreads(cigar_string, read_start, read_end)
 * 
 */

static PyObject *__pyx_f_4aldy_9indelpost_6pileup_parse_spliced_read(PyObject *__pyx_v_cigar_string, int __pyx_v_read_start, int __pyx_v_read_end, int __pyx_v_pos, int __pyx_v_rpos) {
  PyObject *__pyx_v_spliced_subreads = NULL;
  int __pyx_v_is_covering;
  PyObject *__pyx_v_covering_subread = NULL;
  PyObject *__pyx_v_subread = NULL;
  PyObject *__pyx_v_intron_ptrn = NULL;
  int __pyx_v_is_spliced;
  PyObject *__pyx_v_lt_ptrn = NULL;
  PyObject *__pyx_v_rt_ptrn = NULL;
  PyObject *__pyx_v_positions = NULL;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_start = NULL;
  PyObject *__pyx_v_end = NULL;
  PyObject *__pyx_v_splice_ptrn = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("parse_spliced_read", 0);

  /* "aldy/indelpost/pileup.pyx":381
 * 
 * cdef tuple parse_spliced_read(str cigar_string, int read_start, int read_end, int pos, int rpos):
 *     spliced_subreads = get_spliced_subreads(cigar_string, read_start, read_end)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4aldy_9indelpost_9utilities_get_spliced_subreads(__pyx_v_cigar_string, __pyx_v_read_start, __pyx_v_read_end); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 381, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_spliced_subreads = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "aldy/indelpost/pileup.pyx":384
 * 
 * 
 *     is_covering = False             # <<<<<<<<<<<<<<
 *     covering_subread = None
 *     for subread in spliced_subreads:
 */
  __pyx_v_is_covering = 0;

  /* "aldy/indelpost/pileup.pyx":385
 * 
 *     is_covering = False
 *     covering_subread = None             # <<<<<<<<<<<<<<
 *     for subread in spliced_subreads:
 *         if subread[0] <= pos <= subread[1]:
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_covering_subread = ((PyObject*)Py_None);

  /* "aldy/indelpost/pileup.pyx":386
 *     is_covering = False
 *     covering_subread = None
 *     for subread in spliced_subreads:             # <<<<<<<<<<<<<<
 *         if subread[0] <= pos <= subread[1]:
 *             is_covering = True
 */
  if (unlikely(__pyx_v_spliced_subreads == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 386, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_v_spliced_subreads; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 386, __pyx_L1_error)
    #else
    __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 386, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_subread, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "aldy/indelpost/pileup.pyx":387
 *     covering_subread = None
 *     for subread in spliced_subreads:
 *         if subread[0] <= pos <= subread[1]:             # <<<<<<<<<<<<<<
 *             is_covering = True
 *             covering_subread = tuple(subread)
 */
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_subread, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 387, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_pos); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 387, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_t_4, Py_LE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 387, __pyx_L1_error)
    if (__Pyx_PyObject_IsTrue(__pyx_t_5)) {
      __Pyx_DECREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_subread, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 387, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_t_6, Py_LE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 387, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 387, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_7) {

      /* "aldy/indelpost/pileup.pyx":388
 *     for subread in spliced_subreads:
 *         if subread[0] <= pos <= subread[1]:
 *             is_covering = True             # <<<<<<<<<<<<<<
 *             covering_subread = tuple(subread)
 *         elif subread[0] <= rpos <= subread[1]:
 */
      __pyx_v_is_covering = 1;

      /* "aldy/indelpost/pileup.pyx":389
 *         if subread[0] <= pos <= subread[1]:
 *             is_covering = True
 *             covering_subread = tuple(subread)             # <<<<<<<<<<<<<<
 *         elif subread[0] <= rpos <= subread[1]:
 *             is_covering = True
 */
      __pyx_t_5 = __Pyx_PySequence_Tuple(__pyx_v_subread); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 389, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF_SET(__pyx_v_covering_subread, ((PyObject*)__pyx_t_5));
      __pyx_t_5 = 0;

      /* "aldy/indelpost/pileup.pyx":387
 *     covering_subread = None
 *     for subread in spliced_subreads:
 *         if subread[0] <= pos <= subread[1]:             # <<<<<<<<<<<<<<
 *             is_covering = True
 *             covering_subread = tuple(subread)
 */
      goto __pyx_L5;
    }

    /* "aldy/indelpost/pileup.pyx":390
 *             is_covering = True
 *             covering_subread = tuple(subread)
 *         elif subread[0] <= rpos <= subread[1]:             # <<<<<<<<<<<<<<
 *             is_covering = True
 *             covering_subread = tuple(subread)
 */
    __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_subread, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 390, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_rpos); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 390, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_t_4, Py_LE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 390, __pyx_L1_error)
    if (__Pyx_PyObject_IsTrue(__pyx_t_3)) {
      __Pyx_DECREF(__pyx_t_3);
      __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_subread, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 390, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_3 = PyObject_RichCompare(__pyx_t_4, __pyx_t_6, Py_LE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 390, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 390, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_7) {

      /* "aldy/indelpost/pileup.pyx":391
 *             covering_subread = tuple(subread)
 *         elif subread[0] <= rpos <= subread[1]:
 *             is_covering = True             # <<<<<<<<<<<<<<
 *             covering_subread = tuple(subread)
 *             pos = rpos
 */
      __pyx_v_is_covering = 1;

      /* "aldy/indelpost/pileup.pyx":392
 *         elif subread[0] <= rpos <= subread[1]:
 *             is_covering = True
 *             covering_subread = tuple(subread)             # <<<<<<<<<<<<<<
 *             pos = rpos
 * 
 */
      __pyx_t_3 = __Pyx_PySequence_Tuple(__pyx_v_subread); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 392, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_covering_subread, ((PyObject*)__pyx_t_3));
      __pyx_t_3 = 0;

      /* "aldy/indelpost/pileup.pyx":393
 *             is_covering = True
 *             covering_subread = tuple(subread)
 *             pos = rpos             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __pyx_v_pos = __pyx_v_rpos;

      /* "aldy/indelpost/pileup.pyx":390
 *             is_covering = True
 *             covering_subread = tuple(subread)
 *         elif subread[0] <= rpos <= subread[1]:             # <<<<<<<<<<<<<<
 *             is_covering = True
 *             covering_subread = tuple(subread)
 */
    }
    __pyx_L5:;

    /* "aldy/indelpost/pileup.pyx":386
 *     is_covering = False
 *     covering_subread = None
 *     for subread in spliced_subreads:             # <<<<<<<<<<<<<<
 *         if subread[0] <= pos <= subread[1]:
 *             is_covering = True
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "aldy/indelpost/pileup.pyx":396
 * 
 * 
 *     intron_ptrn = (0, 0)             # <<<<<<<<<<<<<<
 *     if len(spliced_subreads) > 1:
 *         is_spliced = True
 */
  __Pyx_INCREF(__pyx_tuple__2);
  __pyx_v_intron_ptrn = __pyx_tuple__2;

  /* "aldy/indelpost/pileup.pyx":397
 * 
 *     intron_ptrn = (0, 0)
 *     if len(spliced_subreads) > 1:             # <<<<<<<<<<<<<<
 *         is_spliced = True
 * 
 */
  if (unlikely(__pyx_v_spliced_subreads == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 397, __pyx_L1_error)
  }
  __pyx_t_2 = PyList_GET_SIZE(__pyx_v_spliced_subreads); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 397, __pyx_L1_error)
  __pyx_t_7 = ((__pyx_t_2 > 1) != 0);
  if (__pyx_t_7) {

    /* "aldy/indelpost/pileup.pyx":398
 *     intron_ptrn = (0, 0)
 *     if len(spliced_subreads) > 1:
 *         is_spliced = True             # <<<<<<<<<<<<<<
 * 
 *         lt_ptrn, rt_ptrn = "", ""
 */
    __pyx_v_is_spliced = 1;

    /* "aldy/indelpost/pileup.pyx":400
 *         is_spliced = True
 * 
 *         lt_ptrn, rt_ptrn = "", ""             # <<<<<<<<<<<<<<
 *         positions = to_flat_list(spliced_subreads)
 *         positions = positions[1:-1]
 */
    __pyx_t_1 = __pyx_kp_u_;
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_3 = __pyx_kp_u_;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_v_lt_ptrn = __pyx_t_1;
    __pyx_t_1 = 0;
    __pyx_v_rt_ptrn = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "aldy/indelpost/pileup.pyx":401
 * 
 *         lt_ptrn, rt_ptrn = "", ""
 *         positions = to_flat_list(spliced_subreads)             # <<<<<<<<<<<<<<
 *         positions = positions[1:-1]
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_to_flat_list); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 401, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_spliced_subreads) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_spliced_subreads);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 401, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_positions = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "aldy/indelpost/pileup.pyx":402
 *         lt_ptrn, rt_ptrn = "", ""
 *         positions = to_flat_list(spliced_subreads)
 *         positions = positions[1:-1]             # <<<<<<<<<<<<<<
 * 
 *         i = 0
 */
    __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_positions, 1, -1L, NULL, NULL, &__pyx_slice__8, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 402, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_positions, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "aldy/indelpost/pileup.pyx":404
 *         positions = positions[1:-1]
 * 
 *         i = 0             # <<<<<<<<<<<<<<
 *         while i < len(positions):
 *             start = positions[i] + 1
 */
    __Pyx_INCREF(__pyx_int_0);
    __pyx_v_i = __pyx_int_0;

    /* "aldy/indelpost/pileup.pyx":405
 * 
 *         i = 0
 *         while i < len(positions):             # <<<<<<<<<<<<<<
 *             start = positions[i] + 1
 *             end = positions[i + 1] - 1
 */
    while (1) {
      __pyx_t_2 = PyObject_Length(__pyx_v_positions); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 405, __pyx_L1_error)
      __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 405, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = PyObject_RichCompare(__pyx_v_i, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 405, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 405, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (!__pyx_t_7) break;

      /* "aldy/indelpost/pileup.pyx":406
 *         i = 0
 *         while i < len(positions):
 *             start = positions[i] + 1             # <<<<<<<<<<<<<<
 *             end = positions[i + 1] - 1
 * 
 */
      __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_positions, __pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 406, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_t_1, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 406, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF_SET(__pyx_v_start, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "aldy/indelpost/pileup.pyx":407
 *         while i < len(positions):
 *             start = positions[i] + 1
 *             end = positions[i + 1] - 1             # <<<<<<<<<<<<<<
 * 
 *             if end < pos:
 */
      __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_v_i, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 407, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_positions, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 407, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyInt_SubtractObjC(__pyx_t_1, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 407, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF_SET(__pyx_v_end, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "aldy/indelpost/pileup.pyx":409
 *             end = positions[i + 1] - 1
 * 
 *             if end < pos:             # <<<<<<<<<<<<<<
 *                 if not lt_ptrn:
 *                     lt_ptrn += str(start) + "-" + str(end)
 */
      __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_pos); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 409, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = PyObject_RichCompare(__pyx_v_end, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 409, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 409, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__pyx_t_7) {

        /* "aldy/indelpost/pileup.pyx":410
 * 
 *             if end < pos:
 *                 if not lt_ptrn:             # <<<<<<<<<<<<<<
 *                     lt_ptrn += str(start) + "-" + str(end)
 *                 else:
 */
        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_lt_ptrn); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 410, __pyx_L1_error)
        __pyx_t_8 = ((!__pyx_t_7) != 0);
        if (__pyx_t_8) {

          /* "aldy/indelpost/pileup.pyx":411
 *             if end < pos:
 *                 if not lt_ptrn:
 *                     lt_ptrn += str(start) + "-" + str(end)             # <<<<<<<<<<<<<<
 *                 else:
 *                     lt_ptrn += ":" + str(start) + "-" + str(end)
 */
          __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_start); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 411, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_3 = __Pyx_PyUnicode_Concat(__pyx_t_1, __pyx_kp_u__9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 411, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_end); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 411, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 411, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_lt_ptrn, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 411, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF_SET(__pyx_v_lt_ptrn, __pyx_t_1);
          __pyx_t_1 = 0;

          /* "aldy/indelpost/pileup.pyx":410
 * 
 *             if end < pos:
 *                 if not lt_ptrn:             # <<<<<<<<<<<<<<
 *                     lt_ptrn += str(start) + "-" + str(end)
 *                 else:
 */
          goto __pyx_L10;
        }

        /* "aldy/indelpost/pileup.pyx":413
 *                     lt_ptrn += str(start) + "-" + str(end)
 *                 else:
 *                     lt_ptrn += ":" + str(start) + "-" + str(end)             # <<<<<<<<<<<<<<
 * 
 *             elif pos < start - 1:
 */
        /*else*/ {
          __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_start); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 413, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_kp_u__10, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 413, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = __Pyx_PyUnicode_Concat(__pyx_t_4, __pyx_kp_u__9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 413, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_end); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 413, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_3 = __Pyx_PyUnicode_Concat(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 413, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_lt_ptrn, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 413, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF_SET(__pyx_v_lt_ptrn, __pyx_t_4);
          __pyx_t_4 = 0;
        }
        __pyx_L10:;

        /* "aldy/indelpost/pileup.pyx":409
 *             end = positions[i + 1] - 1
 * 
 *             if end < pos:             # <<<<<<<<<<<<<<
 *                 if not lt_ptrn:
 *                     lt_ptrn += str(start) + "-" + str(end)
 */
        goto __pyx_L9;
      }

      /* "aldy/indelpost/pileup.pyx":415
 *                     lt_ptrn += ":" + str(start) + "-" + str(end)
 * 
 *             elif pos < start - 1:             # <<<<<<<<<<<<<<
 *                 if not rt_ptrn:
 *                     rt_ptrn += str(start) + "-" + str(end)
 */
      __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_pos); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 415, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = __Pyx_PyInt_SubtractObjC(__pyx_v_start, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 415, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 415, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 415, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__pyx_t_8) {

        /* "aldy/indelpost/pileup.pyx":416
 * 
 *             elif pos < start - 1:
 *                 if not rt_ptrn:             # <<<<<<<<<<<<<<
 *                     rt_ptrn += str(start) + "-" + str(end)
 *                 else:
 */
        __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_rt_ptrn); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 416, __pyx_L1_error)
        __pyx_t_7 = ((!__pyx_t_8) != 0);
        if (__pyx_t_7) {

          /* "aldy/indelpost/pileup.pyx":417
 *             elif pos < start - 1:
 *                 if not rt_ptrn:
 *                     rt_ptrn += str(start) + "-" + str(end)             # <<<<<<<<<<<<<<
 *                 else:
 *                     rt_ptrn += ":" + str(start) + "-" + str(end)
 */
          __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_start); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 417, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_3 = __Pyx_PyUnicode_Concat(__pyx_t_1, __pyx_kp_u__9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 417, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_end); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 417, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 417, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_rt_ptrn, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 417, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF_SET(__pyx_v_rt_ptrn, __pyx_t_1);
          __pyx_t_1 = 0;

          /* "aldy/indelpost/pileup.pyx":416
 * 
 *             elif pos < start - 1:
 *                 if not rt_ptrn:             # <<<<<<<<<<<<<<
 *                     rt_ptrn += str(start) + "-" + str(end)
 *                 else:
 */
          goto __pyx_L11;
        }

        /* "aldy/indelpost/pileup.pyx":419
 *                     rt_ptrn += str(start) + "-" + str(end)
 *                 else:
 *                     rt_ptrn += ":" + str(start) + "-" + str(end)             # <<<<<<<<<<<<<<
 * 
 *             # overhang reads
 */
        /*else*/ {
          __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_start); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 419, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_kp_u__10, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 419, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = __Pyx_PyUnicode_Concat(__pyx_t_4, __pyx_kp_u__9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 419, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_end); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 419, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_3 = __Pyx_PyUnicode_Concat(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 419, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_rt_ptrn, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 419, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF_SET(__pyx_v_rt_ptrn, __pyx_t_4);
          __pyx_t_4 = 0;
        }
        __pyx_L11:;

        /* "aldy/indelpost/pileup.pyx":415
 *                     lt_ptrn += ":" + str(start) + "-" + str(end)
 * 
 *             elif pos < start - 1:             # <<<<<<<<<<<<<<
 *                 if not rt_ptrn:
 *                     rt_ptrn += str(start) + "-" + str(end)
 */
      }
      __pyx_L9:;

      /* "aldy/indelpost/pileup.pyx":422
 * 
 *             # overhang reads
 *             if start - 4 <= pos <= end:             # <<<<<<<<<<<<<<
 *                 intron_ptrn = (start, end)
 * 
 */
      __pyx_t_4 = __Pyx_PyInt_SubtractObjC(__pyx_v_start, __pyx_int_4, 4, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 422, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_pos); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 422, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 422, __pyx_L1_error)
      if (__Pyx_PyObject_IsTrue(__pyx_t_1)) {
        __Pyx_DECREF(__pyx_t_1);
        __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_v_end, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 422, __pyx_L1_error)
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 422, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__pyx_t_7) {

        /* "aldy/indelpost/pileup.pyx":423
 *             # overhang reads
 *             if start - 4 <= pos <= end:
 *                 intron_ptrn = (start, end)             # <<<<<<<<<<<<<<
 * 
 *             i += 2
 */
        __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 423, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_INCREF(__pyx_v_start);
        __Pyx_GIVEREF(__pyx_v_start);
        PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_start);
        __Pyx_INCREF(__pyx_v_end);
        __Pyx_GIVEREF(__pyx_v_end);
        PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_end);
        __Pyx_DECREF_SET(__pyx_v_intron_ptrn, __pyx_t_1);
        __pyx_t_1 = 0;

        /* "aldy/indelpost/pileup.pyx":422
 * 
 *             # overhang reads
 *             if start - 4 <= pos <= end:             # <<<<<<<<<<<<<<
 *                 intron_ptrn = (start, end)
 * 
 */
      }

      /* "aldy/indelpost/pileup.pyx":425
 *                 intron_ptrn = (start, end)
 * 
 *             i += 2             # <<<<<<<<<<<<<<
 * 
 *         splice_ptrn = (lt_ptrn, rt_ptrn)
 */
      __pyx_t_1 = __Pyx_PyInt_AddObjC(__pyx_v_i, __pyx_int_2, 2, 1, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 425, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF_SET(__pyx_v_i, __pyx_t_1);
      __pyx_t_1 = 0;
    }

    /* "aldy/indelpost/pileup.pyx":427
 *             i += 2
 * 
 *         splice_ptrn = (lt_ptrn, rt_ptrn)             # <<<<<<<<<<<<<<
 *     else:
 *         is_spliced = False
 */
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 427, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v_lt_ptrn);
    __Pyx_GIVEREF(__pyx_v_lt_ptrn);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_lt_ptrn);
    __Pyx_INCREF(__pyx_v_rt_ptrn);
    __Pyx_GIVEREF(__pyx_v_rt_ptrn);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_rt_ptrn);
    __pyx_v_splice_ptrn = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "aldy/indelpost/pileup.pyx":397
 * 
 *     intron_ptrn = (0, 0)
 *     if len(spliced_subreads) > 1:             # <<<<<<<<<<<<<<
 *         is_spliced = True
 * 
 */
    goto __pyx_L6;
  }

  /* "aldy/indelpost/pileup.pyx":429
 *         splice_ptrn = (lt_ptrn, rt_ptrn)
 *     else:
 *         is_spliced = False             # <<<<<<<<<<<<<<
 *         splice_ptrn = ("", "")
 * 
 */
  /*else*/ {
    __pyx_v_is_spliced = 0;

    /* "aldy/indelpost/pileup.pyx":430
 *     else:
 *         is_spliced = False
 *         splice_ptrn = ("", "")             # <<<<<<<<<<<<<<
 * 
 *     return is_covering, covering_subread, is_spliced, splice_ptrn, intron_ptrn
 */
    __Pyx_INCREF(__pyx_tuple__11);
    __pyx_v_splice_ptrn = __pyx_tuple__11;
  }
  __pyx_L6:;

  /* "aldy/indelpost/pileup.pyx":432
 *         splice_ptrn = ("", "")
 * 
 *     return is_covering, covering_subread, is_spliced, splice_ptrn, intron_ptrn             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_is_covering); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 432, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_v_is_spliced); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 432, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 432, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  __Pyx_INCREF(__pyx_v_covering_subread);
  __Pyx_GIVEREF(__pyx_v_covering_subread);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_covering_subread);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
  __Pyx_INCREF(__pyx_v_splice_ptrn);
  __Pyx_GIVEREF(__pyx_v_splice_ptrn);
  PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v_splice_ptrn);
  __Pyx_INCREF(__pyx_v_intron_ptrn);
  __Pyx_GIVEREF(__pyx_v_intron_ptrn);
  PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_v_intron_ptrn);
  __pyx_t_1 = 0;
  __pyx_t_3 = 0;
  __pyx_r = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "aldy/indelpost/pileup.pyx":380
 * 
 * 
 * cdef tuple parse_spliced_read(str cigar_string, int read_start, int read_end, int pos, int rpos):             # <<<<<<<<<<<<<<
 *     spliced_subreads = get_spliced_subreads(cigar_string, read_start, read_end)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("aldy.indelpost.pileup.parse_spliced_read", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_spliced_subreads);
  __Pyx_XDECREF(__pyx_v_covering_subread);
  __Pyx_XDECREF(__pyx_v_subread);
  __Pyx_XDECREF(__pyx_v_intron_ptrn);
  __Pyx_XDECREF(__pyx_v_lt_ptrn);
  __Pyx_XDECREF(__pyx_v_rt_ptrn);
  __Pyx_XDECREF(__pyx_v_positions);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_start);
  __Pyx_XDECREF(__pyx_v_end);
  __Pyx_XDECREF(__pyx_v_splice_ptrn);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "aldy/indelpost/pileup.pyx":435
 * 
 * 
 * def check_overhangs(pileup, splice_rate=0.2):             # <<<<<<<<<<<<<<
 * 
 *     intron_ptrns = [read["intron_pattern"] for read in pileup if is_junctional(read)]
 */

/* Python wrapper */
static PyObject *__pyx_pw_4aldy_9indelpost_6pileup_3check_overhangs(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_4aldy_9indelpost_6pileup_3check_overhangs = {"check_overhangs", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4aldy_9indelpost_6pileup_3check_overhangs, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4aldy_9indelpost_6pileup_3check_overhangs(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_pileup = 0;
  PyObject *__pyx_v_splice_rate = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("check_overhangs (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pileup,&__pyx_n_s_splice_rate,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)__pyx_float_0_2);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pileup)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_splice_rate);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "check_overhangs") < 0)) __PYX_ERR(0, 435, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_pileup = values[0];
    __pyx_v_splice_rate = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("check_overhangs", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 435, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("aldy.indelpost.pileup.check_overhangs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4aldy_9indelpost_6pileup_2check_overhangs(__pyx_self, __pyx_v_pileup, __pyx_v_splice_rate);

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

static PyObject *__pyx_pf_4aldy_9indelpost_6pileup_2check_overhangs(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pileup, PyObject *__pyx_v_splice_rate) {
  PyObject *__pyx_v_intron_ptrns = NULL;
  PyObject *__pyx_v_introns = NULL;
  PyObject *__pyx_v_intron = NULL;
  PyObject *__pyx_v_intron_start = NULL;
  PyObject *__pyx_v_intron_end = NULL;
  PyObject *__pyx_v_overhangs = NULL;
  PyObject *__pyx_8genexpr9__pyx_v_read = NULL;
  PyObject *__pyx_9genexpr10__pyx_v_ptrn = NULL;
  PyObject *__pyx_9genexpr11__pyx_v_read = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("check_overhangs", 0);

  /* "aldy/indelpost/pileup.pyx":437
 * def check_overhangs(pileup, splice_rate=0.2):
 * 
 *     intron_ptrns = [read["intron_pattern"] for read in pileup if is_junctional(read)]             # <<<<<<<<<<<<<<
 *     introns = [ptrn for ptrn in intron_ptrns if ptrn != (0, 0)]
 *     if not introns:
 */
  { /* enter inner scope */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 437, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (likely(PyList_CheckExact(__pyx_v_pileup)) || PyTuple_CheckExact(__pyx_v_pileup)) {
      __pyx_t_2 = __pyx_v_pileup; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
      __pyx_t_4 = NULL;
    } else {
      __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_pileup); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 437, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 437, __pyx_L5_error)
    }
    for (;;) {
      if (likely(!__pyx_t_4)) {
        if (likely(PyList_CheckExact(__pyx_t_2))) {
          if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 437, __pyx_L5_error)
          #else
          __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 437, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_5);
          #endif
        } else {
          if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 437, __pyx_L5_error)
          #else
          __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 437, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_5);
          #endif
        }
      } else {
        __pyx_t_5 = __pyx_t_4(__pyx_t_2);
        if (unlikely(!__pyx_t_5)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 437, __pyx_L5_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_5);
      }
      __Pyx_XDECREF_SET(__pyx_8genexpr9__pyx_v_read, __pyx_t_5);
      __pyx_t_5 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_is_junctional); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 437, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
        }
      }
      __pyx_t_5 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_8genexpr9__pyx_v_read) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_8genexpr9__pyx_v_read);
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 437, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 437, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_8) {
        __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_8genexpr9__pyx_v_read, __pyx_n_u_intron_pattern); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 437, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_5);
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 437, __pyx_L5_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_8genexpr9__pyx_v_read); __pyx_8genexpr9__pyx_v_read = 0;
    goto __pyx_L9_exit_scope;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_8genexpr9__pyx_v_read); __pyx_8genexpr9__pyx_v_read = 0;
    goto __pyx_L1_error;
    __pyx_L9_exit_scope:;
  } /* exit inner scope */
  __pyx_v_intron_ptrns = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "aldy/indelpost/pileup.pyx":438
 * 
 *     intron_ptrns = [read["intron_pattern"] for read in pileup if is_junctional(read)]
 *     introns = [ptrn for ptrn in intron_ptrns if ptrn != (0, 0)]             # <<<<<<<<<<<<<<
 *     if not introns:
 *         return None
 */
  { /* enter inner scope */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 438, __pyx_L12_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __pyx_v_intron_ptrns; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    for (;;) {
      if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 438, __pyx_L12_error)
      #else
      __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 438, __pyx_L12_error)
      __Pyx_GOTREF(__pyx_t_5);
      #endif
      __Pyx_XDECREF_SET(__pyx_9genexpr10__pyx_v_ptrn, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_5 = PyObject_RichCompare(__pyx_9genexpr10__pyx_v_ptrn, __pyx_tuple__2, Py_NE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 438, __pyx_L12_error)
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 438, __pyx_L12_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_8) {
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_9genexpr10__pyx_v_ptrn))) __PYX_ERR(0, 438, __pyx_L12_error)
      }
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_9genexpr10__pyx_v_ptrn); __pyx_9genexpr10__pyx_v_ptrn = 0;
    goto __pyx_L16_exit_scope;
    __pyx_L12_error:;
    __Pyx_XDECREF(__pyx_9genexpr10__pyx_v_ptrn); __pyx_9genexpr10__pyx_v_ptrn = 0;
    goto __pyx_L1_error;
    __pyx_L16_exit_scope:;
  } /* exit inner scope */
  __pyx_v_introns = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "aldy/indelpost/pileup.pyx":439
 *     intron_ptrns = [read["intron_pattern"] for read in pileup if is_junctional(read)]
 *     introns = [ptrn for ptrn in intron_ptrns if ptrn != (0, 0)]
 *     if not introns:             # <<<<<<<<<<<<<<
 *         return None
 *     else:
 */
  __pyx_t_8 = (PyList_GET_SIZE(__pyx_v_introns) != 0);
  __pyx_t_9 = ((!__pyx_t_8) != 0);
  if (__pyx_t_9) {

    /* "aldy/indelpost/pileup.pyx":440
 *     introns = [ptrn for ptrn in intron_ptrns if ptrn != (0, 0)]
 *     if not introns:
 *         return None             # <<<<<<<<<<<<<<
 *     else:
 *         intron = most_common(introns)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "aldy/indelpost/pileup.pyx":439
 *     intron_ptrns = [read["intron_pattern"] for read in pileup if is_junctional(read)]
 *     introns = [ptrn for ptrn in intron_ptrns if ptrn != (0, 0)]
 *     if not introns:             # <<<<<<<<<<<<<<
 *         return None
 *     else:
 */
  }

  /* "aldy/indelpost/pileup.pyx":442
 *         return None
 *     else:
 *         intron = most_common(introns)             # <<<<<<<<<<<<<<
 *         if intron_ptrns.count(intron) / len(intron_ptrns) < splice_rate:
 *             return None
 */
  /*else*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_most_common); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 442, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_v_introns) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_introns);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 442, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_intron = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "aldy/indelpost/pileup.pyx":443
 *     else:
 *         intron = most_common(introns)
 *         if intron_ptrns.count(intron) / len(intron_ptrns) < splice_rate:             # <<<<<<<<<<<<<<
 *             return None
 * 
 */
    __pyx_t_1 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyList_Type_count, __pyx_v_intron_ptrns, __pyx_v_intron); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 443, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyList_GET_SIZE(__pyx_v_intron_ptrns); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 443, __pyx_L1_error)
    __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 443, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 443, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_RichCompare(__pyx_t_5, __pyx_v_splice_rate, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 443, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 443, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_9) {

      /* "aldy/indelpost/pileup.pyx":444
 *         intron = most_common(introns)
 *         if intron_ptrns.count(intron) / len(intron_ptrns) < splice_rate:
 *             return None             # <<<<<<<<<<<<<<
 * 
 *     intron_start, intron_end = intron[0], intron[1]
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;

      /* "aldy/indelpost/pileup.pyx":443
 *     else:
 *         intron = most_common(introns)
 *         if intron_ptrns.count(intron) / len(intron_ptrns) < splice_rate:             # <<<<<<<<<<<<<<
 *             return None
 * 
 */
    }
  }

  /* "aldy/indelpost/pileup.pyx":446
 *             return None
 * 
 *     intron_start, intron_end = intron[0], intron[1]             # <<<<<<<<<<<<<<
 *     overhangs = [read for read in pileup if is_overhang(read, intron_start, intron_end)]
 *     if overhangs:
 */
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_intron, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 446, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_intron, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 446, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_v_intron_start = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_intron_end = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "aldy/indelpost/pileup.pyx":447
 * 
 *     intron_start, intron_end = intron[0], intron[1]
 *     overhangs = [read for read in pileup if is_overhang(read, intron_start, intron_end)]             # <<<<<<<<<<<<<<
 *     if overhangs:
 *         return intron, overhangs
 */
  { /* enter inner scope */
    __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 447, __pyx_L21_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (likely(PyList_CheckExact(__pyx_v_pileup)) || PyTuple_CheckExact(__pyx_v_pileup)) {
      __pyx_t_2 = __pyx_v_pileup; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
      __pyx_t_4 = NULL;
    } else {
      __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_pileup); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 447, __pyx_L21_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 447, __pyx_L21_error)
    }
    for (;;) {
      if (likely(!__pyx_t_4)) {
        if (likely(PyList_CheckExact(__pyx_t_2))) {
          if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 447, __pyx_L21_error)
          #else
          __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 447, __pyx_L21_error)
          __Pyx_GOTREF(__pyx_t_1);
          #endif
        } else {
          if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 447, __pyx_L21_error)
          #else
          __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 447, __pyx_L21_error)
          __Pyx_GOTREF(__pyx_t_1);
          #endif
        }
      } else {
        __pyx_t_1 = __pyx_t_4(__pyx_t_2);
        if (unlikely(!__pyx_t_1)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 447, __pyx_L21_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_XDECREF_SET(__pyx_9genexpr11__pyx_v_read, __pyx_t_1);
      __pyx_t_1 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_is_overhang); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 447, __pyx_L21_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = NULL;
      __pyx_t_10 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
          __pyx_t_10 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_9genexpr11__pyx_v_read, __pyx_v_intron_start, __pyx_v_intron_end};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_10, 3+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 447, __pyx_L21_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_9genexpr11__pyx_v_read, __pyx_v_intron_start, __pyx_v_intron_end};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_10, 3+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 447, __pyx_L21_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else
      #endif
      {
        __pyx_t_11 = PyTuple_New(3+__pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 447, __pyx_L21_error)
        __Pyx_GOTREF(__pyx_t_11);
        if (__pyx_t_7) {
          __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_7); __pyx_t_7 = NULL;
        }
        __Pyx_INCREF(__pyx_9genexpr11__pyx_v_read);
        __Pyx_GIVEREF(__pyx_9genexpr11__pyx_v_read);
        PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_10, __pyx_9genexpr11__pyx_v_read);
        __Pyx_INCREF(__pyx_v_intron_start);
        __Pyx_GIVEREF(__pyx_v_intron_start);
        PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_10, __pyx_v_intron_start);
        __Pyx_INCREF(__pyx_v_intron_end);
        __Pyx_GIVEREF(__pyx_v_intron_end);
        PyTuple_SET_ITEM(__pyx_t_11, 2+__pyx_t_10, __pyx_v_intron_end);
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_11, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 447, __pyx_L21_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      }
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 447, __pyx_L21_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__pyx_t_9) {
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_5, (PyObject*)__pyx_9genexpr11__pyx_v_read))) __PYX_ERR(0, 447, __pyx_L21_error)
      }
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_9genexpr11__pyx_v_read); __pyx_9genexpr11__pyx_v_read = 0;
    goto __pyx_L25_exit_scope;
    __pyx_L21_error:;
    __Pyx_XDECREF(__pyx_9genexpr11__pyx_v_read); __pyx_9genexpr11__pyx_v_read = 0;
    goto __pyx_L1_error;
    __pyx_L25_exit_scope:;
  } /* exit inner scope */
  __pyx_v_overhangs = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "aldy/indelpost/pileup.pyx":448
 *     intron_start, intron_end = intron[0], intron[1]
 *     overhangs = [read for read in pileup if is_overhang(read, intron_start, intron_end)]
 *     if overhangs:             # <<<<<<<<<<<<<<
 *         return intron, overhangs
 *     else:
 */
  __pyx_t_9 = (PyList_GET_SIZE(__pyx_v_overhangs) != 0);
  if (__pyx_t_9) {

    /* "aldy/indelpost/pileup.pyx":449
 *     overhangs = [read for read in pileup if is_overhang(read, intron_start, intron_end)]
 *     if overhangs:
 *         return intron, overhangs             # <<<<<<<<<<<<<<
 *     else:
 *         return None
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 449, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_intron);
    __Pyx_GIVEREF(__pyx_v_intron);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_intron);
    __Pyx_INCREF(__pyx_v_overhangs);
    __Pyx_GIVEREF(__pyx_v_overhangs);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_overhangs);
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "aldy/indelpost/pileup.pyx":448
 *     intron_start, intron_end = intron[0], intron[1]
 *     overhangs = [read for read in pileup if is_overhang(read, intron_start, intron_end)]
 *     if overhangs:             # <<<<<<<<<<<<<<
 *         return intron, overhangs
 *     else:
 */
  }

  /* "aldy/indelpost/pileup.pyx":451
 *         return intron, overhangs
 *     else:
 *         return None             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "aldy/indelpost/pileup.pyx":435
 * 
 * 
 * def check_overhangs(pileup, splice_rate=0.2):             # <<<<<<<<<<<<<<
 * 
 *     intron_ptrns = [read["intron_pattern"] for read in pileup if is_junctional(read)]
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("aldy.indelpost.pileup.check_overhangs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_intron_ptrns);
  __Pyx_XDECREF(__pyx_v_introns);
  __Pyx_XDECREF(__pyx_v_intron);
  __Pyx_XDECREF(__pyx_v_intron_start);
  __Pyx_XDECREF(__pyx_v_intron_end);
  __Pyx_XDECREF(__pyx_v_overhangs);
  __Pyx_XDECREF(__pyx_8genexpr9__pyx_v_read);
  __Pyx_XDECREF(__pyx_9genexpr10__pyx_v_ptrn);
  __Pyx_XDECREF(__pyx_9genexpr11__pyx_v_read);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "aldy/indelpost/pileup.pyx":454
 * 
 * 
 * def is_junctional(read):             # <<<<<<<<<<<<<<
 *     if read["intron_pattern"] == (0, 0):
 *         return read["is_covering"]
 */

/* Python wrapper */
static PyObject *__pyx_pw_4aldy_9indelpost_6pileup_5is_junctional(PyObject *__pyx_self, PyObject *__pyx_v_read); /*proto*/
static PyMethodDef __pyx_mdef_4aldy_9indelpost_6pileup_5is_junctional = {"is_junctional", (PyCFunction)__pyx_pw_4aldy_9indelpost_6pileup_5is_junctional, METH_O, 0};
static PyObject *__pyx_pw_4aldy_9indelpost_6pileup_5is_junctional(PyObject *__pyx_self, PyObject *__pyx_v_read) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_junctional (wrapper)", 0);
  __pyx_r = __pyx_pf_4aldy_9indelpost_6pileup_4is_junctional(__pyx_self, ((PyObject *)__pyx_v_read));

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

static PyObject *__pyx_pf_4aldy_9indelpost_6pileup_4is_junctional(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_read) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("is_junctional", 0);

  /* "aldy/indelpost/pileup.pyx":455
 * 
 * def is_junctional(read):
 *     if read["intron_pattern"] == (0, 0):             # <<<<<<<<<<<<<<
 *         return read["is_covering"]
 *     else:
 */
  __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_read, __pyx_n_u_intron_pattern); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 455, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_tuple__2, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 455, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 455, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "aldy/indelpost/pileup.pyx":456
 * def is_junctional(read):
 *     if read["intron_pattern"] == (0, 0):
 *         return read["is_covering"]             # <<<<<<<<<<<<<<
 *     else:
 *         return True
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_read, __pyx_n_u_is_covering); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 456, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "aldy/indelpost/pileup.pyx":455
 * 
 * def is_junctional(read):
 *     if read["intron_pattern"] == (0, 0):             # <<<<<<<<<<<<<<
 *         return read["is_covering"]
 *     else:
 */
  }

  /* "aldy/indelpost/pileup.pyx":458
 *         return read["is_covering"]
 *     else:
 *         return True             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;
  }

  /* "aldy/indelpost/pileup.pyx":454
 * 
 * 
 * def is_junctional(read):             # <<<<<<<<<<<<<<
 *     if read["intron_pattern"] == (0, 0):
 *         return read["is_covering"]
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("aldy.indelpost.pileup.is_junctional", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "aldy/indelpost/pileup.pyx":461
 * 
 * 
 * def is_overhang(read, intron_start, intron_end):             # <<<<<<<<<<<<<<
 *     covering_subread = read["covering_subread"]
 *     if not covering_subread:
 */

/* Python wrapper */
static PyObject *__pyx_pw_4aldy_9indelpost_6pileup_7is_overhang(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_4aldy_9indelpost_6pileup_7is_overhang = {"is_overhang", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4aldy_9indelpost_6pileup_7is_overhang, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4aldy_9indelpost_6pileup_7is_overhang(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_read = 0;
  PyObject *__pyx_v_intron_start = 0;
  PyObject *__pyx_v_intron_end = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_overhang (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_read,&__pyx_n_s_intron_start,&__pyx_n_s_intron_end,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_read)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_intron_start)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("is_overhang", 1, 3, 3, 1); __PYX_ERR(0, 461, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_intron_end)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("is_overhang", 1, 3, 3, 2); __PYX_ERR(0, 461, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "is_overhang") < 0)) __PYX_ERR(0, 461, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_read = values[0];
    __pyx_v_intron_start = values[1];
    __pyx_v_intron_end = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("is_overhang", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 461, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("aldy.indelpost.pileup.is_overhang", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4aldy_9indelpost_6pileup_6is_overhang(__pyx_self, __pyx_v_read, __pyx_v_intron_start, __pyx_v_intron_end);

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

static PyObject *__pyx_pf_4aldy_9indelpost_6pileup_6is_overhang(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_read, PyObject *__pyx_v_intron_start, PyObject *__pyx_v_intron_end) {
  PyObject *__pyx_v_covering_subread = NULL;
  PyObject *__pyx_v_lt_read_lim = NULL;
  PyObject *__pyx_v_rt_read_lim = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("is_overhang", 0);

  /* "aldy/indelpost/pileup.pyx":462
 * 
 * def is_overhang(read, intron_start, intron_end):
 *     covering_subread = read["covering_subread"]             # <<<<<<<<<<<<<<
 *     if not covering_subread:
 *         return False
 */
  __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_read, __pyx_n_u_covering_subread); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 462, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_covering_subread = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "aldy/indelpost/pileup.pyx":463
 * def is_overhang(read, intron_start, intron_end):
 *     covering_subread = read["covering_subread"]
 *     if not covering_subread:             # <<<<<<<<<<<<<<
 *         return False
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_covering_subread); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 463, __pyx_L1_error)
  __pyx_t_3 = ((!__pyx_t_2) != 0);
  if (__pyx_t_3) {

    /* "aldy/indelpost/pileup.pyx":464
 *     covering_subread = read["covering_subread"]
 *     if not covering_subread:
 *         return False             # <<<<<<<<<<<<<<
 * 
 *     lt_read_lim = max(covering_subread[0], read["aln_start"])
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;

    /* "aldy/indelpost/pileup.pyx":463
 * def is_overhang(read, intron_start, intron_end):
 *     covering_subread = read["covering_subread"]
 *     if not covering_subread:             # <<<<<<<<<<<<<<
 *         return False
 * 
 */
  }

  /* "aldy/indelpost/pileup.pyx":466
 *         return False
 * 
 *     lt_read_lim = max(covering_subread[0], read["aln_start"])             # <<<<<<<<<<<<<<
 *     rt_read_lim = min(covering_subread[1], read["aln_end"])
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_read, __pyx_n_u_aln_start); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 466, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_covering_subread, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 466, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = PyObject_RichCompare(__pyx_t_1, __pyx_t_4, Py_GT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 466, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 466, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (__pyx_t_3) {
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_5 = __pyx_t_1;
  } else {
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_5 = __pyx_t_4;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __pyx_t_5;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_lt_read_lim = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "aldy/indelpost/pileup.pyx":467
 * 
 *     lt_read_lim = max(covering_subread[0], read["aln_start"])
 *     rt_read_lim = min(covering_subread[1], read["aln_end"])             # <<<<<<<<<<<<<<
 * 
 *     if lt_read_lim < intron_start and rt_read_lim < intron_end:
 */
  __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_read, __pyx_n_u_aln_end); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 467, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_covering_subread, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 467, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyObject_RichCompare(__pyx_t_1, __pyx_t_5, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 467, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 467, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (__pyx_t_3) {
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_4 = __pyx_t_1;
  } else {
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_4 = __pyx_t_5;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __pyx_t_4;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_rt_read_lim = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "aldy/indelpost/pileup.pyx":469
 *     rt_read_lim = min(covering_subread[1], read["aln_end"])
 * 
 *     if lt_read_lim < intron_start and rt_read_lim < intron_end:             # <<<<<<<<<<<<<<
 *         return True
 *     elif intron_start < lt_read_lim and intron_end < rt_read_lim:
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_lt_read_lim, __pyx_v_intron_start, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 469, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 469, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {
  } else {
    __pyx_t_3 = __pyx_t_2;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_rt_read_lim, __pyx_v_intron_end, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 469, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 469, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __pyx_t_2;
  __pyx_L5_bool_binop_done:;
  if (__pyx_t_3) {

    /* "aldy/indelpost/pileup.pyx":470
 * 
 *     if lt_read_lim < intron_start and rt_read_lim < intron_end:
 *         return True             # <<<<<<<<<<<<<<
 *     elif intron_start < lt_read_lim and intron_end < rt_read_lim:
 *         return True
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;

    /* "aldy/indelpost/pileup.pyx":469
 *     rt_read_lim = min(covering_subread[1], read["aln_end"])
 * 
 *     if lt_read_lim < intron_start and rt_read_lim < intron_end:             # <<<<<<<<<<<<<<
 *         return True
 *     elif intron_start < lt_read_lim and intron_end < rt_read_lim:
 */
  }

  /* "aldy/indelpost/pileup.pyx":471
 *     if lt_read_lim < intron_start and rt_read_lim < intron_end:
 *         return True
 *     elif intron_start < lt_read_lim and intron_end < rt_read_lim:             # <<<<<<<<<<<<<<
 *         return True
 *     else:
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_intron_start, __pyx_v_lt_read_lim, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 471, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 471, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {
  } else {
    __pyx_t_3 = __pyx_t_2;
    goto __pyx_L7_bool_binop_done;
  }
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_intron_end, __pyx_v_rt_read_lim, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 471, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 471, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __pyx_t_2;
  __pyx_L7_bool_binop_done:;
  if (__pyx_t_3) {

    /* "aldy/indelpost/pileup.pyx":472
 *         return True
 *     elif intron_start < lt_read_lim and intron_end < rt_read_lim:
 *         return True             # <<<<<<<<<<<<<<
 *     else:
 *         return False
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;

    /* "aldy/indelpost/pileup.pyx":471
 *     if lt_read_lim < intron_start and rt_read_lim < intron_end:
 *         return True
 *     elif intron_start < lt_read_lim and intron_end < rt_read_lim:             # <<<<<<<<<<<<<<
 *         return True
 *     else:
 */
  }

  /* "aldy/indelpost/pileup.pyx":474
 *         return True
 *     else:
 *         return False             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;
  }

  /* "aldy/indelpost/pileup.pyx":461
 * 
 * 
 * def is_overhang(read, intron_start, intron_end):             # <<<<<<<<<<<<<<
 *     covering_subread = read["covering_subread"]
 *     if not covering_subread:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("aldy.indelpost.pileup.is_overhang", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_covering_subread);
  __Pyx_XDECREF(__pyx_v_lt_read_lim);
  __Pyx_XDECREF(__pyx_v_rt_read_lim);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "aldy/indelpost/pileup.pyx":477
 * 
 * 
 * def overhang_aligners(target, intron, match_score, mismatch_penalty):             # <<<<<<<<<<<<<<
 *     genome_ref = target.reference.fetch(
 *         target.chrom, target.pos - 100, target.pos + 100
 */

/* Python wrapper */
static PyObject *__pyx_pw_4aldy_9indelpost_6pileup_9overhang_aligners(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_4aldy_9indelpost_6pileup_9overhang_aligners = {"overhang_aligners", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4aldy_9indelpost_6pileup_9overhang_aligners, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4aldy_9indelpost_6pileup_9overhang_aligners(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_target = 0;
  PyObject *__pyx_v_intron = 0;
  PyObject *__pyx_v_match_score = 0;
  PyObject *__pyx_v_mismatch_penalty = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("overhang_aligners (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_target,&__pyx_n_s_intron,&__pyx_n_s_match_score,&__pyx_n_s_mismatch_penalty,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_target)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_intron)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("overhang_aligners", 1, 4, 4, 1); __PYX_ERR(0, 477, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_match_score)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("overhang_aligners", 1, 4, 4, 2); __PYX_ERR(0, 477, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mismatch_penalty)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("overhang_aligners", 1, 4, 4, 3); __PYX_ERR(0, 477, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "overhang_aligners") < 0)) __PYX_ERR(0, 477, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_target = values[0];
    __pyx_v_intron = values[1];
    __pyx_v_match_score = values[2];
    __pyx_v_mismatch_penalty = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("overhang_aligners", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 477, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("aldy.indelpost.pileup.overhang_aligners", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4aldy_9indelpost_6pileup_8overhang_aligners(__pyx_self, __pyx_v_target, __pyx_v_intron, __pyx_v_match_score, __pyx_v_mismatch_penalty);

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

static PyObject *__pyx_pf_4aldy_9indelpost_6pileup_8overhang_aligners(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_target, PyObject *__pyx_v_intron, PyObject *__pyx_v_match_score, PyObject *__pyx_v_mismatch_penalty) {
  PyObject *__pyx_v_genome_ref = NULL;
  PyObject *__pyx_v_genome_aligner = NULL;
  PyObject *__pyx_v_lt_exon_end = NULL;
  PyObject *__pyx_v_rt_exon_start = NULL;
  PyObject *__pyx_v_junction_ref = NULL;
  PyObject *__pyx_v_junction_aligner = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("overhang_aligners", 0);

  /* "aldy/indelpost/pileup.pyx":478
 * 
 * def overhang_aligners(target, intron, match_score, mismatch_penalty):
 *     genome_ref = target.reference.fetch(             # <<<<<<<<<<<<<<
 *         target.chrom, target.pos - 100, target.pos + 100
 *     )
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_target, __pyx_n_s_reference); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 478, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_fetch); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 478, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "aldy/indelpost/pileup.pyx":479
 * def overhang_aligners(target, intron, match_score, mismatch_penalty):
 *     genome_ref = target.reference.fetch(
 *         target.chrom, target.pos - 100, target.pos + 100             # <<<<<<<<<<<<<<
 *     )
 *     genome_aligner = make_aligner(genome_ref, match_score, mismatch_penalty)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_target, __pyx_n_s_chrom); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 479, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_target, __pyx_n_s_pos); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 479, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyInt_SubtractObjC(__pyx_t_4, __pyx_int_100, 0x64, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 479, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_target, __pyx_n_s_pos); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 479, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = __Pyx_PyInt_AddObjC(__pyx_t_4, __pyx_int_100, 0x64, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 479, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_t_2, __pyx_t_5, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 478, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_t_2, __pyx_t_5, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 478, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  {
    __pyx_t_8 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 478, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_t_6);
    __pyx_t_2 = 0;
    __pyx_t_5 = 0;
    __pyx_t_6 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 478, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_genome_ref = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "aldy/indelpost/pileup.pyx":481
 *         target.chrom, target.pos - 100, target.pos + 100
 *     )
 *     genome_aligner = make_aligner(genome_ref, match_score, mismatch_penalty)             # <<<<<<<<<<<<<<
 * 
 *     lt_exon_end, rt_exon_start = intron[0] - 1, intron[1]
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_make_aligner); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 481, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_8 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_v_genome_ref, __pyx_v_match_score, __pyx_v_mismatch_penalty};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 481, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_v_genome_ref, __pyx_v_match_score, __pyx_v_mismatch_penalty};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 481, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 481, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_8) {
      __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8); __pyx_t_8 = NULL;
    }
    __Pyx_INCREF(__pyx_v_genome_ref);
    __Pyx_GIVEREF(__pyx_v_genome_ref);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_7, __pyx_v_genome_ref);
    __Pyx_INCREF(__pyx_v_match_score);
    __Pyx_GIVEREF(__pyx_v_match_score);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_7, __pyx_v_match_score);
    __Pyx_INCREF(__pyx_v_mismatch_penalty);
    __Pyx_GIVEREF(__pyx_v_mismatch_penalty);
    PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_7, __pyx_v_mismatch_penalty);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 481, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_genome_aligner = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "aldy/indelpost/pileup.pyx":483
 *     genome_aligner = make_aligner(genome_ref, match_score, mismatch_penalty)
 * 
 *     lt_exon_end, rt_exon_start = intron[0] - 1, intron[1]             # <<<<<<<<<<<<<<
 * 
 *     junction_ref = target.reference.fetch(
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_intron, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 483, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyInt_SubtractObjC(__pyx_t_1, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 483, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_intron, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 483, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_lt_exon_end = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_rt_exon_start = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "aldy/indelpost/pileup.pyx":485
 *     lt_exon_end, rt_exon_start = intron[0] - 1, intron[1]
 * 
 *     junction_ref = target.reference.fetch(             # <<<<<<<<<<<<<<
 *         target.chrom, lt_exon_end - 100, lt_exon_end
 *     ) + target.reference.fetch(target.chrom, rt_exon_start, rt_exon_start + 100)
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_target, __pyx_n_s_reference); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 485, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_fetch); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 485, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "aldy/indelpost/pileup.pyx":486
 * 
 *     junction_ref = target.reference.fetch(
 *         target.chrom, lt_exon_end - 100, lt_exon_end             # <<<<<<<<<<<<<<
 *     ) + target.reference.fetch(target.chrom, rt_exon_start, rt_exon_start + 100)
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_target, __pyx_n_s_chrom); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 486, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_8 = __Pyx_PyInt_SubtractObjC(__pyx_v_lt_exon_end, __pyx_int_100, 0x64, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 486, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_5 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_6)) {
    PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_t_3, __pyx_t_8, __pyx_v_lt_exon_end};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 485, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
    PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_t_3, __pyx_t_8, __pyx_v_lt_exon_end};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 485, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  } else
  #endif
  {
    __pyx_t_2 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 485, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_7, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_7, __pyx_t_8);
    __Pyx_INCREF(__pyx_v_lt_exon_end);
    __Pyx_GIVEREF(__pyx_v_lt_exon_end);
    PyTuple_SET_ITEM(__pyx_t_2, 2+__pyx_t_7, __pyx_v_lt_exon_end);
    __pyx_t_3 = 0;
    __pyx_t_8 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 485, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "aldy/indelpost/pileup.pyx":487
 *     junction_ref = target.reference.fetch(
 *         target.chrom, lt_exon_end - 100, lt_exon_end
 *     ) + target.reference.fetch(target.chrom, rt_exon_start, rt_exon_start + 100)             # <<<<<<<<<<<<<<
 * 
 *     junction_aligner = make_aligner(junction_ref, match_score, mismatch_penalty)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_target, __pyx_n_s_reference); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 487, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_fetch); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 487, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_target, __pyx_n_s_chrom); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 487, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_v_rt_exon_start, __pyx_int_100, 0x64, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 487, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_8)) {
    PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_t_2, __pyx_v_rt_exon_start, __pyx_t_3};
    __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 487, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
    PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_t_2, __pyx_v_rt_exon_start, __pyx_t_3};
    __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 487, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  {
    __pyx_t_4 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 487, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_7, __pyx_t_2);
    __Pyx_INCREF(__pyx_v_rt_exon_start);
    __Pyx_GIVEREF(__pyx_v_rt_exon_start);
    PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_7, __pyx_v_rt_exon_start);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 2+__pyx_t_7, __pyx_t_3);
    __pyx_t_2 = 0;
    __pyx_t_3 = 0;
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_4, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 487, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyNumber_Add(__pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 487, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_v_junction_ref = __pyx_t_8;
  __pyx_t_8 = 0;

  /* "aldy/indelpost/pileup.pyx":489
 *     ) + target.reference.fetch(target.chrom, rt_exon_start, rt_exon_start + 100)
 * 
 *     junction_aligner = make_aligner(junction_ref, match_score, mismatch_penalty)             # <<<<<<<<<<<<<<
 * 
 *     return genome_aligner, junction_aligner
 */
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_make_aligner); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 489, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_6)) {
    PyObject *__pyx_temp[4] = {__pyx_t_1, __pyx_v_junction_ref, __pyx_v_match_score, __pyx_v_mismatch_penalty};
    __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 489, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GOTREF(__pyx_t_8);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
    PyObject *__pyx_temp[4] = {__pyx_t_1, __pyx_v_junction_ref, __pyx_v_match_score, __pyx_v_mismatch_penalty};
    __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 489, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GOTREF(__pyx_t_8);
  } else
  #endif
  {
    __pyx_t_4 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 489, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (__pyx_t_1) {
      __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); __pyx_t_1 = NULL;
    }
    __Pyx_INCREF(__pyx_v_junction_ref);
    __Pyx_GIVEREF(__pyx_v_junction_ref);
    PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_7, __pyx_v_junction_ref);
    __Pyx_INCREF(__pyx_v_match_score);
    __Pyx_GIVEREF(__pyx_v_match_score);
    PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_7, __pyx_v_match_score);
    __Pyx_INCREF(__pyx_v_mismatch_penalty);
    __Pyx_GIVEREF(__pyx_v_mismatch_penalty);
    PyTuple_SET_ITEM(__pyx_t_4, 2+__pyx_t_7, __pyx_v_mismatch_penalty);
    __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_4, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 489, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_v_junction_aligner = __pyx_t_8;
  __pyx_t_8 = 0;

  /* "aldy/indelpost/pileup.pyx":491
 *     junction_aligner = make_aligner(junction_ref, match_score, mismatch_penalty)
 * 
 *     return genome_aligner, junction_aligner             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 491, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(__pyx_v_genome_aligner);
  __Pyx_GIVEREF(__pyx_v_genome_aligner);
  PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_genome_aligner);
  __Pyx_INCREF(__pyx_v_junction_aligner);
  __Pyx_GIVEREF(__pyx_v_junction_aligner);
  PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_junction_aligner);
  __pyx_r = __pyx_t_8;
  __pyx_t_8 = 0;
  goto __pyx_L0;

  /* "aldy/indelpost/pileup.pyx":477
 * 
 * 
 * def overhang_aligners(target, intron, match_score, mismatch_penalty):             # <<<<<<<<<<<<<<
 *     genome_ref = target.reference.fetch(
 *         target.chrom, target.pos - 100, target.pos + 100
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("aldy.indelpost.pileup.overhang_aligners", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_genome_ref);
  __Pyx_XDECREF(__pyx_v_genome_aligner);
  __Pyx_XDECREF(__pyx_v_lt_exon_end);
  __Pyx_XDECREF(__pyx_v_rt_exon_start);
  __Pyx_XDECREF(__pyx_v_junction_ref);
  __Pyx_XDECREF(__pyx_v_junction_aligner);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "aldy/indelpost/pileup.pyx":494
 * 
 * 
 * def filter_spurious_overhangs(             # <<<<<<<<<<<<<<
 *     target,
 *     intron,
 */

/* Python wrapper */
static PyObject *__pyx_pw_4aldy_9indelpost_6pileup_11filter_spurious_overhangs(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_4aldy_9indelpost_6pileup_11filter_spurious_overhangs = {"filter_spurious_overhangs", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4aldy_9indelpost_6pileup_11filter_spurious_overhangs, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4aldy_9indelpost_6pileup_11filter_spurious_overhangs(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_target = 0;
  PyObject *__pyx_v_intron = 0;
  PyObject *__pyx_v_overhangs = 0;
  PyObject *__pyx_v_match_score = 0;
  PyObject *__pyx_v_mismatch_penalty = 0;
  PyObject *__pyx_v_gap_open_penalty = 0;
  PyObject *__pyx_v_gap_extension_penalty = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("filter_spurious_overhangs (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_target,&__pyx_n_s_intron,&__pyx_n_s_overhangs,&__pyx_n_s_match_score,&__pyx_n_s_mismatch_penalty,&__pyx_n_s_gap_open_penalty,&__pyx_n_s_gap_extension_penalty,0};
    PyObject* values[7] = {0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_target)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_intron)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("filter_spurious_overhangs", 1, 7, 7, 1); __PYX_ERR(0, 494, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_overhangs)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("filter_spurious_overhangs", 1, 7, 7, 2); __PYX_ERR(0, 494, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_match_score)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("filter_spurious_overhangs", 1, 7, 7, 3); __PYX_ERR(0, 494, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mismatch_penalty)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("filter_spurious_overhangs", 1, 7, 7, 4); __PYX_ERR(0, 494, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gap_open_penalty)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("filter_spurious_overhangs", 1, 7, 7, 5); __PYX_ERR(0, 494, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gap_extension_penalty)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("filter_spurious_overhangs", 1, 7, 7, 6); __PYX_ERR(0, 494, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "filter_spurious_overhangs") < 0)) __PYX_ERR(0, 494, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
    }
    __pyx_v_target = values[0];
    __pyx_v_intron = values[1];
    __pyx_v_overhangs = values[2];
    __pyx_v_match_score = values[3];
    __pyx_v_mismatch_penalty = values[4];
    __pyx_v_gap_open_penalty = values[5];
    __pyx_v_gap_extension_penalty = values[6];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("filter_spurious_overhangs", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 494, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("aldy.indelpost.pileup.filter_spurious_overhangs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4aldy_9indelpost_6pileup_10filter_spurious_overhangs(__pyx_self, __pyx_v_target, __pyx_v_intron, __pyx_v_overhangs, __pyx_v_match_score, __pyx_v_mismatch_penalty, __pyx_v_gap_open_penalty, __pyx_v_gap_extension_penalty);

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

static PyObject *__pyx_pf_4aldy_9indelpost_6pileup_10filter_spurious_overhangs(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_target, PyObject *__pyx_v_intron, PyObject *__pyx_v_overhangs, PyObject *__pyx_v_match_score, PyObject *__pyx_v_mismatch_penalty, PyObject *__pyx_v_gap_open_penalty, PyObject *__pyx_v_gap_extension_penalty) {
  PyObject *__pyx_v_genome_aligner = NULL;
  PyObject *__pyx_v_junctional_aligner = NULL;
  PyObject *__pyx_v_non_spurious_overhangs = NULL;
  PyObject *__pyx_9genexpr12__pyx_v_read = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *(*__pyx_t_6)(PyObject *);
  Py_ssize_t __pyx_t_7;
  PyObject *(*__pyx_t_8)(PyObject *);
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("filter_spurious_overhangs", 0);

  /* "aldy/indelpost/pileup.pyx":504
 * ):
 * 
 *     genome_aligner, junctional_aligner = overhang_aligners(             # <<<<<<<<<<<<<<
 *         target, intron, match_score, mismatch_penalty
 *     )
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_overhang_aligners); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 504, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "aldy/indelpost/pileup.pyx":505
 * 
 *     genome_aligner, junctional_aligner = overhang_aligners(
 *         target, intron, match_score, mismatch_penalty             # <<<<<<<<<<<<<<
 *     )
 *     non_spurious_overhangs = [
 */
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_3, __pyx_v_target, __pyx_v_intron, __pyx_v_match_score, __pyx_v_mismatch_penalty};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 4+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 504, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_3, __pyx_v_target, __pyx_v_intron, __pyx_v_match_score, __pyx_v_mismatch_penalty};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 4+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 504, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(4+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 504, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_v_target);
    __Pyx_GIVEREF(__pyx_v_target);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_target);
    __Pyx_INCREF(__pyx_v_intron);
    __Pyx_GIVEREF(__pyx_v_intron);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_intron);
    __Pyx_INCREF(__pyx_v_match_score);
    __Pyx_GIVEREF(__pyx_v_match_score);
    PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_v_match_score);
    __Pyx_INCREF(__pyx_v_mismatch_penalty);
    __Pyx_GIVEREF(__pyx_v_mismatch_penalty);
    PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_4, __pyx_v_mismatch_penalty);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 504, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 504, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_5);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 504, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 504, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 504, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_6 = Py_TYPE(__pyx_t_3)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_6(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_5 = __pyx_t_6(__pyx_t_3); if (unlikely(!__pyx_t_5)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_3), 2) < 0) __PYX_ERR(0, 504, __pyx_L1_error)
    __pyx_t_6 = NULL;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_6 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 504, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }

  /* "aldy/indelpost/pileup.pyx":504
 * ):
 * 
 *     genome_aligner, junctional_aligner = overhang_aligners(             # <<<<<<<<<<<<<<
 *         target, intron, match_score, mismatch_penalty
 *     )
 */
  __pyx_v_genome_aligner = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_junctional_aligner = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "aldy/indelpost/pileup.pyx":507
 *         target, intron, match_score, mismatch_penalty
 *     )
 *     non_spurious_overhangs = [             # <<<<<<<<<<<<<<
 *         read
 *         for read in overhangs
 */
  { /* enter inner scope */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 507, __pyx_L7_error)
    __Pyx_GOTREF(__pyx_t_1);

    /* "aldy/indelpost/pileup.pyx":509
 *     non_spurious_overhangs = [
 *         read
 *         for read in overhangs             # <<<<<<<<<<<<<<
 *         if not read["is_reference_seq"]
 *         and is_non_spurious_overhang(
 */
    if (likely(PyList_CheckExact(__pyx_v_overhangs)) || PyTuple_CheckExact(__pyx_v_overhangs)) {
      __pyx_t_5 = __pyx_v_overhangs; __Pyx_INCREF(__pyx_t_5); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
    } else {
      __pyx_t_7 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_overhangs); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 509, __pyx_L7_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_8 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 509, __pyx_L7_error)
    }
    for (;;) {
      if (likely(!__pyx_t_8)) {
        if (likely(PyList_CheckExact(__pyx_t_5))) {
          if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_5)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 509, __pyx_L7_error)
          #else
          __pyx_t_2 = PySequence_ITEM(__pyx_t_5, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 509, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        } else {
          if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 509, __pyx_L7_error)
          #else
          __pyx_t_2 = PySequence_ITEM(__pyx_t_5, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 509, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        }
      } else {
        __pyx_t_2 = __pyx_t_8(__pyx_t_5);
        if (unlikely(!__pyx_t_2)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 509, __pyx_L7_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_XDECREF_SET(__pyx_9genexpr12__pyx_v_read, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "aldy/indelpost/pileup.pyx":510
 *         read
 *         for read in overhangs
 *         if not read["is_reference_seq"]             # <<<<<<<<<<<<<<
 *         and is_non_spurious_overhang(
 *             read,
 */
      __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_9genexpr12__pyx_v_read, __pyx_n_u_is_reference_seq); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 510, __pyx_L7_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 510, __pyx_L7_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_11 = ((!__pyx_t_10) != 0);
      if (__pyx_t_11) {
      } else {
        __pyx_t_9 = __pyx_t_11;
        goto __pyx_L11_bool_binop_done;
      }

      /* "aldy/indelpost/pileup.pyx":511
 *         for read in overhangs
 *         if not read["is_reference_seq"]
 *         and is_non_spurious_overhang(             # <<<<<<<<<<<<<<
 *             read,
 *             target,
 */
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_is_non_spurious_overhang); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 511, __pyx_L7_error)
      __Pyx_GOTREF(__pyx_t_3);

      /* "aldy/indelpost/pileup.pyx":520
 *             mismatch_penalty,
 *             gap_open_penalty,
 *             gap_extension_penalty,             # <<<<<<<<<<<<<<
 *         )
 *     ]
 */
      __pyx_t_12 = NULL;
      __pyx_t_4 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_12)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_12);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
          __pyx_t_4 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[10] = {__pyx_t_12, __pyx_9genexpr12__pyx_v_read, __pyx_v_target, __pyx_v_intron, __pyx_v_genome_aligner, __pyx_v_junctional_aligner, __pyx_v_match_score, __pyx_v_mismatch_penalty, __pyx_v_gap_open_penalty, __pyx_v_gap_extension_penalty};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 9+__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 511, __pyx_L7_error)
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[10] = {__pyx_t_12, __pyx_9genexpr12__pyx_v_read, __pyx_v_target, __pyx_v_intron, __pyx_v_genome_aligner, __pyx_v_junctional_aligner, __pyx_v_match_score, __pyx_v_mismatch_penalty, __pyx_v_gap_open_penalty, __pyx_v_gap_extension_penalty};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 9+__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 511, __pyx_L7_error)
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else
      #endif
      {
        __pyx_t_13 = PyTuple_New(9+__pyx_t_4); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 511, __pyx_L7_error)
        __Pyx_GOTREF(__pyx_t_13);
        if (__pyx_t_12) {
          __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_12); __pyx_t_12 = NULL;
        }
        __Pyx_INCREF(__pyx_9genexpr12__pyx_v_read);
        __Pyx_GIVEREF(__pyx_9genexpr12__pyx_v_read);
        PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_4, __pyx_9genexpr12__pyx_v_read);
        __Pyx_INCREF(__pyx_v_target);
        __Pyx_GIVEREF(__pyx_v_target);
        PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_4, __pyx_v_target);
        __Pyx_INCREF(__pyx_v_intron);
        __Pyx_GIVEREF(__pyx_v_intron);
        PyTuple_SET_ITEM(__pyx_t_13, 2+__pyx_t_4, __pyx_v_intron);
        __Pyx_INCREF(__pyx_v_genome_aligner);
        __Pyx_GIVEREF(__pyx_v_genome_aligner);
        PyTuple_SET_ITEM(__pyx_t_13, 3+__pyx_t_4, __pyx_v_genome_aligner);
        __Pyx_INCREF(__pyx_v_junctional_aligner);
        __Pyx_GIVEREF(__pyx_v_junctional_aligner);
        PyTuple_SET_ITEM(__pyx_t_13, 4+__pyx_t_4, __pyx_v_junctional_aligner);
        __Pyx_INCREF(__pyx_v_match_score);
        __Pyx_GIVEREF(__pyx_v_match_score);
        PyTuple_SET_ITEM(__pyx_t_13, 5+__pyx_t_4, __pyx_v_match_score);
        __Pyx_INCREF(__pyx_v_mismatch_penalty);
        __Pyx_GIVEREF(__pyx_v_mismatch_penalty);
        PyTuple_SET_ITEM(__pyx_t_13, 6+__pyx_t_4, __pyx_v_mismatch_penalty);
        __Pyx_INCREF(__pyx_v_gap_open_penalty);
        __Pyx_GIVEREF(__pyx_v_gap_open_penalty);
        PyTuple_SET_ITEM(__pyx_t_13, 7+__pyx_t_4, __pyx_v_gap_open_penalty);
        __Pyx_INCREF(__pyx_v_gap_extension_penalty);
        __Pyx_GIVEREF(__pyx_v_gap_extension_penalty);
        PyTuple_SET_ITEM(__pyx_t_13, 8+__pyx_t_4, __pyx_v_gap_extension_penalty);
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_13, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 511, __pyx_L7_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "aldy/indelpost/pileup.pyx":511
 *         for read in overhangs
 *         if not read["is_reference_seq"]
 *         and is_non_spurious_overhang(             # <<<<<<<<<<<<<<
 *             read,
 *             target,
 */
      __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 511, __pyx_L7_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_9 = __pyx_t_11;
      __pyx_L11_bool_binop_done:;

      /* "aldy/indelpost/pileup.pyx":510
 *         read
 *         for read in overhangs
 *         if not read["is_reference_seq"]             # <<<<<<<<<<<<<<
 *         and is_non_spurious_overhang(
 *             read,
 */
      if (__pyx_t_9) {

        /* "aldy/indelpost/pileup.pyx":508
 *     )
 *     non_spurious_overhangs = [
 *         read             # <<<<<<<<<<<<<<
 *         for read in overhangs
 *         if not read["is_reference_seq"]
 */
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_9genexpr12__pyx_v_read))) __PYX_ERR(0, 507, __pyx_L7_error)

        /* "aldy/indelpost/pileup.pyx":510
 *         read
 *         for read in overhangs
 *         if not read["is_reference_seq"]             # <<<<<<<<<<<<<<
 *         and is_non_spurious_overhang(
 *             read,
 */
      }

      /* "aldy/indelpost/pileup.pyx":509
 *     non_spurious_overhangs = [
 *         read
 *         for read in overhangs             # <<<<<<<<<<<<<<
 *         if not read["is_reference_seq"]
 *         and is_non_spurious_overhang(
 */
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_9genexpr12__pyx_v_read); __pyx_9genexpr12__pyx_v_read = 0;
    goto __pyx_L13_exit_scope;
    __pyx_L7_error:;
    __Pyx_XDECREF(__pyx_9genexpr12__pyx_v_read); __pyx_9genexpr12__pyx_v_read = 0;
    goto __pyx_L1_error;
    __pyx_L13_exit_scope:;
  } /* exit inner scope */
  __pyx_v_non_spurious_overhangs = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "aldy/indelpost/pileup.pyx":524
 *     ]
 * 
 *     return non_spurious_overhangs             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_non_spurious_overhangs);
  __pyx_r = __pyx_v_non_spurious_overhangs;
  goto __pyx_L0;

  /* "aldy/indelpost/pileup.pyx":494
 * 
 * 
 * def filter_spurious_overhangs(             # <<<<<<<<<<<<<<
 *     target,
 *     intron,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("aldy.indelpost.pileup.filter_spurious_overhangs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_genome_aligner);
  __Pyx_XDECREF(__pyx_v_junctional_aligner);
  __Pyx_XDECREF(__pyx_v_non_spurious_overhangs);
  __Pyx_XDECREF(__pyx_9genexpr12__pyx_v_read);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "aldy/indelpost/pileup.pyx":527
 * 
 * 
 * def is_non_spurious_overhang(             # <<<<<<<<<<<<<<
 *     read,
 *     target,
 */

/* Python wrapper */
static PyObject *__pyx_pw_4aldy_9indelpost_6pileup_13is_non_spurious_overhang(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_4aldy_9indelpost_6pileup_13is_non_spurious_overhang = {"is_non_spurious_overhang", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4aldy_9indelpost_6pileup_13is_non_spurious_overhang, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4aldy_9indelpost_6pileup_13is_non_spurious_overhang(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_read = 0;
  PyObject *__pyx_v_target = 0;
  PyObject *__pyx_v_intron = 0;
  PyObject *__pyx_v_genome_aligner = 0;
  PyObject *__pyx_v_junction_aligner = 0;
  PyObject *__pyx_v_match_score = 0;
  CYTHON_UNUSED PyObject *__pyx_v_mismatch_penalty = 0;
  PyObject *__pyx_v_gap_open_penalty = 0;
  PyObject *__pyx_v_gap_extension_penalty = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_non_spurious_overhang (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_read,&__pyx_n_s_target,&__pyx_n_s_intron,&__pyx_n_s_genome_aligner,&__pyx_n_s_junction_aligner,&__pyx_n_s_match_score,&__pyx_n_s_mismatch_penalty,&__pyx_n_s_gap_open_penalty,&__pyx_n_s_gap_extension_penalty,0};
    PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_read)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_target)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("is_non_spurious_overhang", 1, 9, 9, 1); __PYX_ERR(0, 527, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_intron)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("is_non_spurious_overhang", 1, 9, 9, 2); __PYX_ERR(0, 527, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_genome_aligner)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("is_non_spurious_overhang", 1, 9, 9, 3); __PYX_ERR(0, 527, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_junction_aligner)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("is_non_spurious_overhang", 1, 9, 9, 4); __PYX_ERR(0, 527, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_match_score)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("is_non_spurious_overhang", 1, 9, 9, 5); __PYX_ERR(0, 527, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mismatch_penalty)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("is_non_spurious_overhang", 1, 9, 9, 6); __PYX_ERR(0, 527, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gap_open_penalty)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("is_non_spurious_overhang", 1, 9, 9, 7); __PYX_ERR(0, 527, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gap_extension_penalty)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("is_non_spurious_overhang", 1, 9, 9, 8); __PYX_ERR(0, 527, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "is_non_spurious_overhang") < 0)) __PYX_ERR(0, 527, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 9) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
    }
    __pyx_v_read = values[0];
    __pyx_v_target = values[1];
    __pyx_v_intron = values[2];
    __pyx_v_genome_aligner = values[3];
    __pyx_v_junction_aligner = values[4];
    __pyx_v_match_score = values[5];
    __pyx_v_mismatch_penalty = values[6];
    __pyx_v_gap_open_penalty = values[7];
    __pyx_v_gap_extension_penalty = values[8];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("is_non_spurious_overhang", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 527, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("aldy.indelpost.pileup.is_non_spurious_overhang", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4aldy_9indelpost_6pileup_12is_non_spurious_overhang(__pyx_self, __pyx_v_read, __pyx_v_target, __pyx_v_intron, __pyx_v_genome_aligner, __pyx_v_junction_aligner, __pyx_v_match_score, __pyx_v_mismatch_penalty, __pyx_v_gap_open_penalty, __pyx_v_gap_extension_penalty);

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

static PyObject *__pyx_pf_4aldy_9indelpost_6pileup_12is_non_spurious_overhang(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_read, PyObject *__pyx_v_target, PyObject *__pyx_v_intron, PyObject *__pyx_v_genome_aligner, PyObject *__pyx_v_junction_aligner, PyObject *__pyx_v_match_score, CYTHON_UNUSED PyObject *__pyx_v_mismatch_penalty, PyObject *__pyx_v_gap_open_penalty, PyObject *__pyx_v_gap_extension_penalty) {
  PyObject *__pyx_v_read_seq = NULL;
  PyObject *__pyx_v_genome_aln = NULL;
  PyObject *__pyx_v_junction_aln = NULL;
  PyObject *__pyx_v_genome_score = NULL;
  PyObject *__pyx_v_junction_score = NULL;
  PyObject *__pyx_v_genome_cigar = NULL;
  PyObject *__pyx_v_gap_cnt = NULL;
  PyObject *__pyx_v_aln_len = NULL;
  PyObject *__pyx_v_lt_exon_end = NULL;
  PyObject *__pyx_v_rt_exon_start = NULL;
  PyObject *__pyx_v_indels_within_intron = NULL;
  PyObject *__pyx_9genexpr13__pyx_v_var = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  PyObject *(*__pyx_t_9)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("is_non_spurious_overhang", 0);
  __Pyx_INCREF(__pyx_v_read);

  /* "aldy/indelpost/pileup.pyx":538
 *     gap_extension_penalty,
 * ):
 *     read_seq = read["read_seq"]             # <<<<<<<<<<<<<<
 * 
 *     genome_aln = align(
 */
  __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_read, __pyx_n_u_read_seq); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 538, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_read_seq = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "aldy/indelpost/pileup.pyx":540
 *     read_seq = read["read_seq"]
 * 
 *     genome_aln = align(             # <<<<<<<<<<<<<<
 *         genome_aligner, read_seq, gap_open_penalty, gap_extension_penalty
 *     )
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_align); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 540, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "aldy/indelpost/pileup.pyx":541
 * 
 *     genome_aln = align(
 *         genome_aligner, read_seq, gap_open_penalty, gap_extension_penalty             # <<<<<<<<<<<<<<
 *     )
 *     junction_aln = align(
 */
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_3, __pyx_v_genome_aligner, __pyx_v_read_seq, __pyx_v_gap_open_penalty, __pyx_v_gap_extension_penalty};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 4+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 540, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_3, __pyx_v_genome_aligner, __pyx_v_read_seq, __pyx_v_gap_open_penalty, __pyx_v_gap_extension_penalty};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 4+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 540, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(4+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 540, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_v_genome_aligner);
    __Pyx_GIVEREF(__pyx_v_genome_aligner);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_genome_aligner);
    __Pyx_INCREF(__pyx_v_read_seq);
    __Pyx_GIVEREF(__pyx_v_read_seq);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_read_seq);
    __Pyx_INCREF(__pyx_v_gap_open_penalty);
    __Pyx_GIVEREF(__pyx_v_gap_open_penalty);
    PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_v_gap_open_penalty);
    __Pyx_INCREF(__pyx_v_gap_extension_penalty);
    __Pyx_GIVEREF(__pyx_v_gap_extension_penalty);
    PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_4, __pyx_v_gap_extension_penalty);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 540, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_genome_aln = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "aldy/indelpost/pileup.pyx":543
 *         genome_aligner, read_seq, gap_open_penalty, gap_extension_penalty
 *     )
 *     junction_aln = align(             # <<<<<<<<<<<<<<
 *         junction_aligner, read_seq, gap_open_penalty, gap_extension_penalty
 *     )
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_align); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 543, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "aldy/indelpost/pileup.pyx":544
 *     )
 *     junction_aln = align(
 *         junction_aligner, read_seq, gap_open_penalty, gap_extension_penalty             # <<<<<<<<<<<<<<
 *     )
 * 
 */
  __pyx_t_5 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_5, __pyx_v_junction_aligner, __pyx_v_read_seq, __pyx_v_gap_open_penalty, __pyx_v_gap_extension_penalty};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 4+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 543, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_5, __pyx_v_junction_aligner, __pyx_v_read_seq, __pyx_v_gap_open_penalty, __pyx_v_gap_extension_penalty};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 4+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 543, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_3 = PyTuple_New(4+__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 543, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_INCREF(__pyx_v_junction_aligner);
    __Pyx_GIVEREF(__pyx_v_junction_aligner);
    PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_4, __pyx_v_junction_aligner);
    __Pyx_INCREF(__pyx_v_read_seq);
    __Pyx_GIVEREF(__pyx_v_read_seq);
    PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_4, __pyx_v_read_seq);
    __Pyx_INCREF(__pyx_v_gap_open_penalty);
    __Pyx_GIVEREF(__pyx_v_gap_open_penalty);
    PyTuple_SET_ITEM(__pyx_t_3, 2+__pyx_t_4, __pyx_v_gap_open_penalty);
    __Pyx_INCREF(__pyx_v_gap_extension_penalty);
    __Pyx_GIVEREF(__pyx_v_gap_extension_penalty);
    PyTuple_SET_ITEM(__pyx_t_3, 3+__pyx_t_4, __pyx_v_gap_extension_penalty);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 543, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_junction_aln = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "aldy/indelpost/pileup.pyx":547
 *     )
 * 
 *     genome_score = genome_aln.optimal_score             # <<<<<<<<<<<<<<
 *     junction_score = junction_aln.optimal_score
 *     if genome_score <= junction_score:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_genome_aln, __pyx_n_s_optimal_score); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 547, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_genome_score = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "aldy/indelpost/pileup.pyx":548
 * 
 *     genome_score = genome_aln.optimal_score
 *     junction_score = junction_aln.optimal_score             # <<<<<<<<<<<<<<
 *     if genome_score <= junction_score:
 *         return False
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_junction_aln, __pyx_n_s_optimal_score); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 548, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_junction_score = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "aldy/indelpost/pileup.pyx":549
 *     genome_score = genome_aln.optimal_score
 *     junction_score = junction_aln.optimal_score
 *     if genome_score <= junction_score:             # <<<<<<<<<<<<<<
 *         return False
 * 
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_genome_score, __pyx_v_junction_score, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 549, __pyx_L1_error)
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 549, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_6) {

    /* "aldy/indelpost/pileup.pyx":550
 *     junction_score = junction_aln.optimal_score
 *     if genome_score <= junction_score:
 *         return False             # <<<<<<<<<<<<<<
 * 
 *     genome_cigar = make_insertion_first(genome_aln.CIGAR)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;

    /* "aldy/indelpost/pileup.pyx":549
 *     genome_score = genome_aln.optimal_score
 *     junction_score = junction_aln.optimal_score
 *     if genome_score <= junction_score:             # <<<<<<<<<<<<<<
 *         return False
 * 
 */
  }

  /* "aldy/indelpost/pileup.pyx":552
 *         return False
 * 
 *     genome_cigar = make_insertion_first(genome_aln.CIGAR)             # <<<<<<<<<<<<<<
 *     gap_cnt = genome_cigar.count("I") + genome_cigar.count("D")
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_make_insertion_first); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 552, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_genome_aln, __pyx_n_s_CIGAR); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 552, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 552, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_genome_cigar = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "aldy/indelpost/pileup.pyx":553
 * 
 *     genome_cigar = make_insertion_first(genome_aln.CIGAR)
 *     gap_cnt = genome_cigar.count("I") + genome_cigar.count("D")             # <<<<<<<<<<<<<<
 * 
 *     if gap_cnt > 3:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_genome_cigar, __pyx_n_s_count); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 553, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_n_u_I) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_n_u_I);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 553, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_genome_cigar, __pyx_n_s_count); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 553, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_n_u_D) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_n_u_D);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 553, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 553, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_gap_cnt = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "aldy/indelpost/pileup.pyx":555
 *     gap_cnt = genome_cigar.count("I") + genome_cigar.count("D")
 * 
 *     if gap_cnt > 3:             # <<<<<<<<<<<<<<
 *         return False
 *     elif 1 < gap_cnt <= 3:
 */
  __pyx_t_3 = PyObject_RichCompare(__pyx_v_gap_cnt, __pyx_int_3, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 555, __pyx_L1_error)
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 555, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_6) {

    /* "aldy/indelpost/pileup.pyx":556
 * 
 *     if gap_cnt > 3:
 *         return False             # <<<<<<<<<<<<<<
 *     elif 1 < gap_cnt <= 3:
 *         if genome_score / junction_score < 1.2 or genome_score < match_score * 50:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;

    /* "aldy/indelpost/pileup.pyx":555
 *     gap_cnt = genome_cigar.count("I") + genome_cigar.count("D")
 * 
 *     if gap_cnt > 3:             # <<<<<<<<<<<<<<
 *         return False
 *     elif 1 < gap_cnt <= 3:
 */
  }

  /* "aldy/indelpost/pileup.pyx":557
 *     if gap_cnt > 3:
 *         return False
 *     elif 1 < gap_cnt <= 3:             # <<<<<<<<<<<<<<
 *         if genome_score / junction_score < 1.2 or genome_score < match_score * 50:
 *             return False
 */
  __pyx_t_3 = PyObject_RichCompare(__pyx_int_1, __pyx_v_gap_cnt, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 557, __pyx_L1_error)
  if (__Pyx_PyObject_IsTrue(__pyx_t_3)) {
    __Pyx_DECREF(__pyx_t_3);
    __pyx_t_3 = PyObject_RichCompare(__pyx_v_gap_cnt, __pyx_int_3, Py_LE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 557, __pyx_L1_error)
  }
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 557, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_6) {

    /* "aldy/indelpost/pileup.pyx":558
 *         return False
 *     elif 1 < gap_cnt <= 3:
 *         if genome_score / junction_score < 1.2 or genome_score < match_score * 50:             # <<<<<<<<<<<<<<
 *             return False
 *     elif gap_cnt == 0:
 */
    __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_v_genome_score, __pyx_v_junction_score); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 558, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, __pyx_float_1_2, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 558, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 558, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!__pyx_t_7) {
    } else {
      __pyx_t_6 = __pyx_t_7;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_2 = PyNumber_Multiply(__pyx_v_match_score, __pyx_int_50); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 558, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyObject_RichCompare(__pyx_v_genome_score, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 558, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 558, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_6 = __pyx_t_7;
    __pyx_L6_bool_binop_done:;
    if (__pyx_t_6) {

      /* "aldy/indelpost/pileup.pyx":559
 *     elif 1 < gap_cnt <= 3:
 *         if genome_score / junction_score < 1.2 or genome_score < match_score * 50:
 *             return False             # <<<<<<<<<<<<<<
 *     elif gap_cnt == 0:
 *         aln_len = genome_aln.read_end - genome_aln.read_start + 1
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_False);
      __pyx_r = Py_False;
      goto __pyx_L0;

      /* "aldy/indelpost/pileup.pyx":558
 *         return False
 *     elif 1 < gap_cnt <= 3:
 *         if genome_score / junction_score < 1.2 or genome_score < match_score * 50:             # <<<<<<<<<<<<<<
 *             return False
 *     elif gap_cnt == 0:
 */
    }

    /* "aldy/indelpost/pileup.pyx":557
 *     if gap_cnt > 3:
 *         return False
 *     elif 1 < gap_cnt <= 3:             # <<<<<<<<<<<<<<
 *         if genome_score / junction_score < 1.2 or genome_score < match_score * 50:
 *             return False
 */
    goto __pyx_L4;
  }

  /* "aldy/indelpost/pileup.pyx":560
 *         if genome_score / junction_score < 1.2 or genome_score < match_score * 50:
 *             return False
 *     elif gap_cnt == 0:             # <<<<<<<<<<<<<<
 *         aln_len = genome_aln.read_end - genome_aln.read_start + 1
 *         if aln_len / len(read_seq) > 0.98:
 */
  __pyx_t_3 = __Pyx_PyInt_EqObjC(__pyx_v_gap_cnt, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 560, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 560, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_6) {

    /* "aldy/indelpost/pileup.pyx":561
 *             return False
 *     elif gap_cnt == 0:
 *         aln_len = genome_aln.read_end - genome_aln.read_start + 1             # <<<<<<<<<<<<<<
 *         if aln_len / len(read_seq) > 0.98:
 *             return False
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_genome_aln, __pyx_n_s_read_end); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 561, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_genome_aln, __pyx_n_s_read_start); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 561, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PyNumber_Subtract(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 561, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyInt_AddObjC(__pyx_t_1, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 561, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_aln_len = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "aldy/indelpost/pileup.pyx":562
 *     elif gap_cnt == 0:
 *         aln_len = genome_aln.read_end - genome_aln.read_start + 1
 *         if aln_len / len(read_seq) > 0.98:             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
    __pyx_t_8 = PyObject_Length(__pyx_v_read_seq); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 562, __pyx_L1_error)
    __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 562, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_v_aln_len, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 562, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_float_0_98, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 562, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 562, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_6) {

      /* "aldy/indelpost/pileup.pyx":563
 *         aln_len = genome_aln.read_end - genome_aln.read_start + 1
 *         if aln_len / len(read_seq) > 0.98:
 *             return False             # <<<<<<<<<<<<<<
 * 
 *     lt_exon_end, rt_exon_start = intron[0] - 1, intron[1]
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_False);
      __pyx_r = Py_False;
      goto __pyx_L0;

      /* "aldy/indelpost/pileup.pyx":562
 *     elif gap_cnt == 0:
 *         aln_len = genome_aln.read_end - genome_aln.read_start + 1
 *         if aln_len / len(read_seq) > 0.98:             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
    }

    /* "aldy/indelpost/pileup.pyx":560
 *         if genome_score / junction_score < 1.2 or genome_score < match_score * 50:
 *             return False
 *     elif gap_cnt == 0:             # <<<<<<<<<<<<<<
 *         aln_len = genome_aln.read_end - genome_aln.read_start + 1
 *         if aln_len / len(read_seq) > 0.98:
 */
  }
  __pyx_L4:;

  /* "aldy/indelpost/pileup.pyx":565
 *             return False
 * 
 *     lt_exon_end, rt_exon_start = intron[0] - 1, intron[1]             # <<<<<<<<<<<<<<
 *     indels_within_intron = [
 *         lt_exon_end < var[-1].pos < rt_exon_start for var in read["D"] and read["I"]
 */
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_intron, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 565, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyInt_SubtractObjC(__pyx_t_2, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 565, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_intron, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 565, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_lt_exon_end = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_rt_exon_start = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "aldy/indelpost/pileup.pyx":566
 * 
 *     lt_exon_end, rt_exon_start = intron[0] - 1, intron[1]
 *     indels_within_intron = [             # <<<<<<<<<<<<<<
 *         lt_exon_end < var[-1].pos < rt_exon_start for var in read["D"] and read["I"]
 *     ]
 */
  { /* enter inner scope */
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 566, __pyx_L11_error)
    __Pyx_GOTREF(__pyx_t_2);

    /* "aldy/indelpost/pileup.pyx":567
 *     lt_exon_end, rt_exon_start = intron[0] - 1, intron[1]
 *     indels_within_intron = [
 *         lt_exon_end < var[-1].pos < rt_exon_start for var in read["D"] and read["I"]             # <<<<<<<<<<<<<<
 *     ]
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_v_read, __pyx_n_u_D); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 567, __pyx_L11_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 567, __pyx_L11_error)
    if (__pyx_t_6) {
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      __Pyx_INCREF(__pyx_t_3);
      __pyx_t_1 = __pyx_t_3;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L14_bool_binop_done;
    }
    __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_v_read, __pyx_n_u_I); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 567, __pyx_L11_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_1 = __pyx_t_3;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_L14_bool_binop_done:;
    if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
      __pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3); __pyx_t_8 = 0;
      __pyx_t_9 = NULL;
    } else {
      __pyx_t_8 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 567, __pyx_L11_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_9 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 567, __pyx_L11_error)
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    for (;;) {
      if (likely(!__pyx_t_9)) {
        if (likely(PyList_CheckExact(__pyx_t_3))) {
          if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_3)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 567, __pyx_L11_error)
          #else
          __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 567, __pyx_L11_error)
          __Pyx_GOTREF(__pyx_t_1);
          #endif
        } else {
          if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 567, __pyx_L11_error)
          #else
          __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 567, __pyx_L11_error)
          __Pyx_GOTREF(__pyx_t_1);
          #endif
        }
      } else {
        __pyx_t_1 = __pyx_t_9(__pyx_t_3);
        if (unlikely(!__pyx_t_1)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 567, __pyx_L11_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_XDECREF_SET(__pyx_9genexpr13__pyx_v_var, __pyx_t_1);
      __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_GetItemInt(__pyx_9genexpr13__pyx_v_var, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 567, __pyx_L11_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_pos); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 567, __pyx_L11_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyObject_RichCompare(__pyx_v_lt_exon_end, __pyx_t_5, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 567, __pyx_L11_error)
      if (__Pyx_PyObject_IsTrue(__pyx_t_1)) {
        __Pyx_DECREF(__pyx_t_1);
        __pyx_t_1 = PyObject_RichCompare(__pyx_t_5, __pyx_v_rt_exon_start, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 567, __pyx_L11_error)
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_1))) __PYX_ERR(0, 566, __pyx_L11_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_9genexpr13__pyx_v_var); __pyx_9genexpr13__pyx_v_var = 0;
    goto __pyx_L16_exit_scope;
    __pyx_L11_error:;
    __Pyx_XDECREF(__pyx_9genexpr13__pyx_v_var); __pyx_9genexpr13__pyx_v_var = 0;
    goto __pyx_L1_error;
    __pyx_L16_exit_scope:;
  } /* exit inner scope */
  __pyx_v_indels_within_intron = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "aldy/indelpost/pileup.pyx":570
 *     ]
 * 
 *     if indels_within_intron:             # <<<<<<<<<<<<<<
 *         return True
 * 
 */
  __pyx_t_6 = (PyList_GET_SIZE(__pyx_v_indels_within_intron) != 0);
  if (__pyx_t_6) {

    /* "aldy/indelpost/pileup.pyx":571
 * 
 *     if indels_within_intron:
 *         return True             # <<<<<<<<<<<<<<
 * 
 *     read = findall_mismatches(read)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;

    /* "aldy/indelpost/pileup.pyx":570
 *     ]
 * 
 *     if indels_within_intron:             # <<<<<<<<<<<<<<
 *         return True
 * 
 */
  }

  /* "aldy/indelpost/pileup.pyx":573
 *         return True
 * 
 *     read = findall_mismatches(read)             # <<<<<<<<<<<<<<
 *     return is_worth_realn(read, target)
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_findall_mismatches); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 573, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_1, __pyx_v_read) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_read);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 573, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF_SET(__pyx_v_read, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "aldy/indelpost/pileup.pyx":574
 * 
 *     read = findall_mismatches(read)
 *     return is_worth_realn(read, target)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_is_worth_realn); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 574, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_v_read, __pyx_v_target};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 574, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_v_read, __pyx_v_target};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 574, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 574, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_1) {
      __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); __pyx_t_1 = NULL;
    }
    __Pyx_INCREF(__pyx_v_read);
    __Pyx_GIVEREF(__pyx_v_read);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_read);
    __Pyx_INCREF(__pyx_v_target);
    __Pyx_GIVEREF(__pyx_v_target);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_target);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 574, __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_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "aldy/indelpost/pileup.pyx":527
 * 
 * 
 * def is_non_spurious_overhang(             # <<<<<<<<<<<<<<
 *     read,
 *     target,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("aldy.indelpost.pileup.is_non_spurious_overhang", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_read_seq);
  __Pyx_XDECREF(__pyx_v_genome_aln);
  __Pyx_XDECREF(__pyx_v_junction_aln);
  __Pyx_XDECREF(__pyx_v_genome_score);
  __Pyx_XDECREF(__pyx_v_junction_score);
  __Pyx_XDECREF(__pyx_v_genome_cigar);
  __Pyx_XDECREF(__pyx_v_gap_cnt);
  __Pyx_XDECREF(__pyx_v_aln_len);
  __Pyx_XDECREF(__pyx_v_lt_exon_end);
  __Pyx_XDECREF(__pyx_v_rt_exon_start);
  __Pyx_XDECREF(__pyx_v_indels_within_intron);
  __Pyx_XDECREF(__pyx_9genexpr13__pyx_v_var);
  __Pyx_XDECREF(__pyx_v_read);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "aldy/indelpost/pileup.pyx":577
 * 
 * 
 * def retarget(             # <<<<<<<<<<<<<<
 *     target,
 *     pileup,
 */

/* Python wrapper */
static PyObject *__pyx_pw_4aldy_9indelpost_6pileup_15retarget(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_4aldy_9indelpost_6pileup_15retarget = {"retarget", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4aldy_9indelpost_6pileup_15retarget, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4aldy_9indelpost_6pileup_15retarget(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_target = 0;
  PyObject *__pyx_v_pileup = 0;
  PyObject *__pyx_v_window = 0;
  PyObject *__pyx_v_mapq4retarget = 0;
  PyObject *__pyx_v_within = 0;
  PyObject *__pyx_v_retargetcutoff = 0;
  PyObject *__pyx_v_match_score = 0;
  PyObject *__pyx_v_mismatch_penalty = 0;
  PyObject *__pyx_v_gap_open_penalty = 0;
  PyObject *__pyx_v_gap_extension_penalty = 0;
  PyObject *__pyx_v_unspl_loc_ref = 0;
  PyObject *__pyx_v_require_exact_for_shiftable = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("retarget (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_target,&__pyx_n_s_pileup,&__pyx_n_s_window,&__pyx_n_s_mapq4retarget,&__pyx_n_s_within,&__pyx_n_s_retargetcutoff,&__pyx_n_s_match_score,&__pyx_n_s_mismatch_penalty,&__pyx_n_s_gap_open_penalty,&__pyx_n_s_gap_extension_penalty,&__pyx_n_s_unspl_loc_ref,&__pyx_n_s_require_exact_for_shiftable,0};
    PyObject* values[12] = {0,0,0,0,0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_target)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pileup)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("retarget", 1, 12, 12, 1); __PYX_ERR(0, 577, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_window)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("retarget", 1, 12, 12, 2); __PYX_ERR(0, 577, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mapq4retarget)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("retarget", 1, 12, 12, 3); __PYX_ERR(0, 577, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_within)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("retarget", 1, 12, 12, 4); __PYX_ERR(0, 577, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_retargetcutoff)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("retarget", 1, 12, 12, 5); __PYX_ERR(0, 577, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_match_score)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("retarget", 1, 12, 12, 6); __PYX_ERR(0, 577, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mismatch_penalty)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("retarget", 1, 12, 12, 7); __PYX_ERR(0, 577, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gap_open_penalty)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("retarget", 1, 12, 12, 8); __PYX_ERR(0, 577, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gap_extension_penalty)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("retarget", 1, 12, 12, 9); __PYX_ERR(0, 577, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_unspl_loc_ref)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("retarget", 1, 12, 12, 10); __PYX_ERR(0, 577, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 11:
        if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_require_exact_for_shiftable)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("retarget", 1, 12, 12, 11); __PYX_ERR(0, 577, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "retarget") < 0)) __PYX_ERR(0, 577, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 12) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
      values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
      values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
      values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
    }
    __pyx_v_target = values[0];
    __pyx_v_pileup = values[1];
    __pyx_v_window = values[2];
    __pyx_v_mapq4retarget = values[3];
    __pyx_v_within = values[4];
    __pyx_v_retargetcutoff = values[5];
    __pyx_v_match_score = values[6];
    __pyx_v_mismatch_penalty = values[7];
    __pyx_v_gap_open_penalty = values[8];
    __pyx_v_gap_extension_penalty = values[9];
    __pyx_v_unspl_loc_ref = values[10];
    __pyx_v_require_exact_for_shiftable = values[11];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("retarget", 1, 12, 12, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 577, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("aldy.indelpost.pileup.retarget", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4aldy_9indelpost_6pileup_14retarget(__pyx_self, __pyx_v_target, __pyx_v_pileup, __pyx_v_window, __pyx_v_mapq4retarget, __pyx_v_within, __pyx_v_retargetcutoff, __pyx_v_match_score, __pyx_v_mismatch_penalty, __pyx_v_gap_open_penalty, __pyx_v_gap_extension_penalty, __pyx_v_unspl_loc_ref, __pyx_v_require_exact_for_shiftable);

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

/* "aldy/indelpost/pileup.pyx":733
 * 
 *     u_candidates = to_flat_list([var._generate_equivalents_private() for var in set(candidates)])
 *     u_candidates.sort(key=lambda x: abs(x.pos - target.pos))             # <<<<<<<<<<<<<<
 *     candidate_seqs = [var._get_indel_seq(how=target_type) for var in u_candidates]
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4aldy_9indelpost_6pileup_8retarget_lambda3(PyObject *__pyx_self, PyObject *__pyx_v_x); /*proto*/
static PyMethodDef __pyx_mdef_4aldy_9indelpost_6pileup_8retarget_lambda3 = {"lambda3", (PyCFunction)__pyx_pw_4aldy_9indelpost_6pileup_8retarget_lambda3, METH_O, 0};
static PyObject *__pyx_pw_4aldy_9indelpost_6pileup_8retarget_lambda3(PyObject *__pyx_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lambda3 (wrapper)", 0);
  __pyx_r = __pyx_lambda_funcdef_lambda3(__pyx_self, ((PyObject *)__pyx_v_x));

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

static PyObject *__pyx_lambda_funcdef_lambda3(PyObject *__pyx_self, PyObject *__pyx_v_x) {
  struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_5_retarget *__pyx_cur_scope;
  struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_5_retarget *__pyx_outer_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("lambda3", 0);
  __pyx_outer_scope = (struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_5_retarget *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_x, __pyx_n_s_pos); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 733, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (unlikely(!__pyx_cur_scope->__pyx_v_target)) { __Pyx_RaiseClosureNameError("target"); __PYX_ERR(0, 733, __pyx_L1_error) }
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_target, __pyx_n_s_pos); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 733, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyNumber_Subtract(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 733, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyNumber_Absolute(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 733, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("aldy.indelpost.pileup.retarget.lambda3", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "aldy/indelpost/pileup.pyx":577
 * 
 * 
 * def retarget(             # <<<<<<<<<<<<<<
 *     target,
 *     pileup,
 */

static PyObject *__pyx_pf_4aldy_9indelpost_6pileup_14retarget(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_target, PyObject *__pyx_v_pileup, PyObject *__pyx_v_window, PyObject *__pyx_v_mapq4retarget, PyObject *__pyx_v_within, PyObject *__pyx_v_retargetcutoff, PyObject *__pyx_v_match_score, PyObject *__pyx_v_mismatch_penalty, PyObject *__pyx_v_gap_open_penalty, PyObject *__pyx_v_gap_extension_penalty, PyObject *__pyx_v_unspl_loc_ref, PyObject *__pyx_v_require_exact_for_shiftable) {
  struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_5_retarget *__pyx_cur_scope;
  CYTHON_UNUSED PyObject *__pyx_v_target_seq = NULL;
  PyObject *__pyx_v_target_type = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_target_pos = NULL;
  PyObject *__pyx_v_non_refs = NULL;
  PyObject *__pyx_v_cutoff = NULL;
  PyObject *__pyx_v_tmp_non_refs = NULL;
  PyObject *__pyx_v_ref_starts = NULL;
  PyObject *__pyx_v_ref_alns = NULL;
  PyObject *__pyx_v_ref_seqs = NULL;
  PyObject *__pyx_v_aligners = NULL;
  PyObject *__pyx_v_read = NULL;
  PyObject *__pyx_v_ref_seq = NULL;
  PyObject *__pyx_v_lt_len = NULL;
  PyObject *__pyx_v_aligner = NULL;
  PyObject *__pyx_v_complex_flags = NULL;
  PyObject *__pyx_v_candidates = NULL;
  PyObject *__pyx_v_candidate_reads = NULL;
  PyObject *__pyx_v_candidate_ref_seqs = NULL;
  PyObject *__pyx_v_candidate_ref_starts = NULL;
  PyObject *__pyx_v_candidate_aligners = NULL;
  PyObject *__pyx_v_aln = NULL;
  PyObject *__pyx_v_ref_start = NULL;
  PyObject *__pyx_v_genome_aln_pos = NULL;
  PyObject *__pyx_v_aligned_read_len = NULL;
  PyObject *__pyx_v_window_len = NULL;
  PyObject *__pyx_v_aligned_frac = NULL;
  PyObject *__pyx_v_gap_cnt = NULL;
  PyObject *__pyx_v_indels = NULL;
  PyObject *__pyx_v_positions = NULL;
  PyObject *__pyx_v_complex_positions = NULL;
  PyObject *__pyx_v_target_type_indels = NULL;
  PyObject *__pyx_v_indel = NULL;
  PyObject *__pyx_v_complex_del = NULL;
  PyObject *__pyx_v_complex_ins = NULL;
  PyObject *__pyx_v_ref = NULL;
  PyObject *__pyx_v_alt = NULL;
  struct __pyx_obj_4aldy_9indelpost_7variant_Variant *__pyx_v_var = NULL;
  double __pyx_v_read_end_thresh;
  PyObject *__pyx_v_u_candidates = NULL;
  PyObject *__pyx_v_candidate_seqs = NULL;
  PyObject *__pyx_v_best_match = NULL;
  PyObject *__pyx_v_best_seq = NULL;
  PyObject *__pyx_v_idx = NULL;
  PyObject *__pyx_v_hit = NULL;
  PyObject *__pyx_v_idx2 = NULL;
  PyObject *__pyx_v_candidate = NULL;
  PyObject *__pyx_v_complex_candidates = NULL;
  PyObject *__pyx_v_cplx_candidate = NULL;
  PyObject *__pyx_v_reduced = NULL;
  PyObject *__pyx_9genexpr14__pyx_v_read_dict = NULL;
  PyObject *__pyx_9genexpr15__pyx_v_read_dict = NULL;
  PyObject *__pyx_9genexpr16__pyx_v_read_dict = NULL;
  PyObject *__pyx_9genexpr17__pyx_v_read_dict = NULL;
  PyObject *__pyx_9genexpr18__pyx_v_d = NULL;
  PyObject *__pyx_9genexpr19__pyx_v_p = NULL;
  PyObject *__pyx_9genexpr20__pyx_v_indel = NULL;
  PyObject *__pyx_9genexpr21__pyx_v_jndel = NULL;
  PyObject *__pyx_9genexpr22__pyx_v_jndel = NULL;
  PyObject *__pyx_9genexpr23__pyx_v_var = NULL;
  PyObject *__pyx_9genexpr24__pyx_v_var = NULL;
  PyObject *__pyx_9genexpr25__pyx_v_i = NULL;
  PyObject *__pyx_9genexpr25__pyx_v_var = NULL;
  PyObject *__pyx_9genexpr26__pyx_v_var = NULL;
  PyObject *__pyx_9genexpr27__pyx_v_i = NULL;
  PyObject *__pyx_9genexpr27__pyx_v_var = NULL;
  PyObject *__pyx_9genexpr28__pyx_v_i = NULL;
  PyObject *__pyx_9genexpr29__pyx_v_i = NULL;
  PyObject *__pyx_9genexpr30__pyx_v_i = NULL;
  PyObject *__pyx_9genexpr31__pyx_v_i = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  PyObject *(*__pyx_t_6)(PyObject *);
  int __pyx_t_7;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *(*__pyx_t_13)(PyObject *);
  int __pyx_t_14;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  Py_ssize_t __pyx_t_17;
  PyObject *(*__pyx_t_18)(PyObject *);
  Py_ssize_t __pyx_t_19;
  long __pyx_t_20;
  double __pyx_t_21;
  double __pyx_t_22;
  int __pyx_t_23;
  PyObject *__pyx_t_24 = NULL;
  PyObject *__pyx_t_25 = NULL;
  PyObject *__pyx_t_26 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("retarget", 0);
  __pyx_cur_scope = (struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_5_retarget *)__pyx_tp_new_4aldy_9indelpost_6pileup___pyx_scope_struct_5_retarget(__pyx_ptype_4aldy_9indelpost_6pileup___pyx_scope_struct_5_retarget, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_5_retarget *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 577, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_target = __pyx_v_target;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_target);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_target);
  __Pyx_INCREF(__pyx_v_window);
  __Pyx_INCREF(__pyx_v_match_score);

  /* "aldy/indelpost/pileup.pyx":591
 *     require_exact_for_shiftable,
 * ):
 *     target_seq, target_type, target_pos  = target.indel_seq, target.variant_type, target.pos             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_target, __pyx_n_s_indel_seq); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 591, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_target, __pyx_n_s_variant_type); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 591, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_target, __pyx_n_s_pos); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 591, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_target_seq = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_target_type = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_target_pos = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "aldy/indelpost/pileup.pyx":594
 * 
 * 
 *     if target.is_ins:             # <<<<<<<<<<<<<<
 *         non_refs = [
 *             read_dict
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_target, __pyx_n_s_is_ins); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 594, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 594, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_4) {

    /* "aldy/indelpost/pileup.pyx":595
 * 
 *     if target.is_ins:
 *         non_refs = [             # <<<<<<<<<<<<<<
 *             read_dict
 *             for read_dict in pileup
 */
    { /* enter inner scope */
      __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 595, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_3);

      /* "aldy/indelpost/pileup.pyx":597
 *         non_refs = [
 *             read_dict
 *             for read_dict in pileup             # <<<<<<<<<<<<<<
 *             if not read_dict["is_reference_seq"]
 *             and read_dict["is_covering"]
 */
      if (likely(PyList_CheckExact(__pyx_v_pileup)) || PyTuple_CheckExact(__pyx_v_pileup)) {
        __pyx_t_2 = __pyx_v_pileup; __Pyx_INCREF(__pyx_t_2); __pyx_t_5 = 0;
        __pyx_t_6 = NULL;
      } else {
        __pyx_t_5 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_pileup); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 597, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_6 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 597, __pyx_L6_error)
      }
      for (;;) {
        if (likely(!__pyx_t_6)) {
          if (likely(PyList_CheckExact(__pyx_t_2))) {
            if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_2)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 597, __pyx_L6_error)
            #else
            __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 597, __pyx_L6_error)
            __Pyx_GOTREF(__pyx_t_1);
            #endif
          } else {
            if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 597, __pyx_L6_error)
            #else
            __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 597, __pyx_L6_error)
            __Pyx_GOTREF(__pyx_t_1);
            #endif
          }
        } else {
          __pyx_t_1 = __pyx_t_6(__pyx_t_2);
          if (unlikely(!__pyx_t_1)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(0, 597, __pyx_L6_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_1);
        }
        __Pyx_XDECREF_SET(__pyx_9genexpr14__pyx_v_read_dict, __pyx_t_1);
        __pyx_t_1 = 0;

        /* "aldy/indelpost/pileup.pyx":598
 *             read_dict
 *             for read_dict in pileup
 *             if not read_dict["is_reference_seq"]             # <<<<<<<<<<<<<<
 *             and read_dict["is_covering"]
 *             and read_dict["mapq"] > mapq4retarget
 */
        __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_9genexpr14__pyx_v_read_dict, __pyx_n_u_is_reference_seq); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 598, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 598, __pyx_L6_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_8 = ((!__pyx_t_7) != 0);
        if (__pyx_t_8) {
        } else {
          __pyx_t_4 = __pyx_t_8;
          goto __pyx_L10_bool_binop_done;
        }

        /* "aldy/indelpost/pileup.pyx":599
 *             for read_dict in pileup
 *             if not read_dict["is_reference_seq"]
 *             and read_dict["is_covering"]             # <<<<<<<<<<<<<<
 *             and read_dict["mapq"] > mapq4retarget
 *         ]
 */
        __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_9genexpr14__pyx_v_read_dict, __pyx_n_u_is_covering); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 599, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 599, __pyx_L6_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (__pyx_t_8) {
        } else {
          __pyx_t_4 = __pyx_t_8;
          goto __pyx_L10_bool_binop_done;
        }

        /* "aldy/indelpost/pileup.pyx":600
 *             if not read_dict["is_reference_seq"]
 *             and read_dict["is_covering"]
 *             and read_dict["mapq"] > mapq4retarget             # <<<<<<<<<<<<<<
 *         ]
 *     else:
 */
        __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_9genexpr14__pyx_v_read_dict, __pyx_n_u_mapq); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 600, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_9 = PyObject_RichCompare(__pyx_t_1, __pyx_v_mapq4retarget, Py_GT); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 600, __pyx_L6_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 600, __pyx_L6_error)
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_4 = __pyx_t_8;
        __pyx_L10_bool_binop_done:;

        /* "aldy/indelpost/pileup.pyx":598
 *             read_dict
 *             for read_dict in pileup
 *             if not read_dict["is_reference_seq"]             # <<<<<<<<<<<<<<
 *             and read_dict["is_covering"]
 *             and read_dict["mapq"] > mapq4retarget
 */
        if (__pyx_t_4) {

          /* "aldy/indelpost/pileup.pyx":596
 *     if target.is_ins:
 *         non_refs = [
 *             read_dict             # <<<<<<<<<<<<<<
 *             for read_dict in pileup
 *             if not read_dict["is_reference_seq"]
 */
          if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_9genexpr14__pyx_v_read_dict))) __PYX_ERR(0, 595, __pyx_L6_error)

          /* "aldy/indelpost/pileup.pyx":598
 *             read_dict
 *             for read_dict in pileup
 *             if not read_dict["is_reference_seq"]             # <<<<<<<<<<<<<<
 *             and read_dict["is_covering"]
 *             and read_dict["mapq"] > mapq4retarget
 */
        }

        /* "aldy/indelpost/pileup.pyx":597
 *         non_refs = [
 *             read_dict
 *             for read_dict in pileup             # <<<<<<<<<<<<<<
 *             if not read_dict["is_reference_seq"]
 *             and read_dict["is_covering"]
 */
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_9genexpr14__pyx_v_read_dict); __pyx_9genexpr14__pyx_v_read_dict = 0;
      goto __pyx_L13_exit_scope;
      __pyx_L6_error:;
      __Pyx_XDECREF(__pyx_9genexpr14__pyx_v_read_dict); __pyx_9genexpr14__pyx_v_read_dict = 0;
      goto __pyx_L1_error;
      __pyx_L13_exit_scope:;
    } /* exit inner scope */
    __pyx_v_non_refs = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "aldy/indelpost/pileup.pyx":594
 * 
 * 
 *     if target.is_ins:             # <<<<<<<<<<<<<<
 *         non_refs = [
 *             read_dict
 */
    goto __pyx_L3;
  }

  /* "aldy/indelpost/pileup.pyx":603
 *         ]
 *     else:
 *         non_refs = [             # <<<<<<<<<<<<<<
 *             read_dict
 *             for read_dict in pileup
 */
  /*else*/ {
    { /* enter inner scope */
      __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 603, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_3);

      /* "aldy/indelpost/pileup.pyx":605
 *         non_refs = [
 *             read_dict
 *             for read_dict in pileup             # <<<<<<<<<<<<<<
 *             if not read_dict["is_reference_seq"]
 *             and read_dict["mapq"] > mapq4retarget
 */
      if (likely(PyList_CheckExact(__pyx_v_pileup)) || PyTuple_CheckExact(__pyx_v_pileup)) {
        __pyx_t_2 = __pyx_v_pileup; __Pyx_INCREF(__pyx_t_2); __pyx_t_5 = 0;
        __pyx_t_6 = NULL;
      } else {
        __pyx_t_5 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_pileup); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 605, __pyx_L16_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_6 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 605, __pyx_L16_error)
      }
      for (;;) {
        if (likely(!__pyx_t_6)) {
          if (likely(PyList_CheckExact(__pyx_t_2))) {
            if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_2)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_9 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_9); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 605, __pyx_L16_error)
            #else
            __pyx_t_9 = PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 605, __pyx_L16_error)
            __Pyx_GOTREF(__pyx_t_9);
            #endif
          } else {
            if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_9); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 605, __pyx_L16_error)
            #else
            __pyx_t_9 = PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 605, __pyx_L16_error)
            __Pyx_GOTREF(__pyx_t_9);
            #endif
          }
        } else {
          __pyx_t_9 = __pyx_t_6(__pyx_t_2);
          if (unlikely(!__pyx_t_9)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(0, 605, __pyx_L16_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_9);
        }
        __Pyx_XDECREF_SET(__pyx_9genexpr15__pyx_v_read_dict, __pyx_t_9);
        __pyx_t_9 = 0;

        /* "aldy/indelpost/pileup.pyx":606
 *             read_dict
 *             for read_dict in pileup
 *             if not read_dict["is_reference_seq"]             # <<<<<<<<<<<<<<
 *             and read_dict["mapq"] > mapq4retarget
 *         ]
 */
        __pyx_t_9 = __Pyx_PyObject_Dict_GetItem(__pyx_9genexpr15__pyx_v_read_dict, __pyx_n_u_is_reference_seq); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 606, __pyx_L16_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 606, __pyx_L16_error)
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_7 = ((!__pyx_t_8) != 0);
        if (__pyx_t_7) {
        } else {
          __pyx_t_4 = __pyx_t_7;
          goto __pyx_L20_bool_binop_done;
        }

        /* "aldy/indelpost/pileup.pyx":607
 *             for read_dict in pileup
 *             if not read_dict["is_reference_seq"]
 *             and read_dict["mapq"] > mapq4retarget             # <<<<<<<<<<<<<<
 *         ]
 * 
 */
        __pyx_t_9 = __Pyx_PyObject_Dict_GetItem(__pyx_9genexpr15__pyx_v_read_dict, __pyx_n_u_mapq); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 607, __pyx_L16_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_1 = PyObject_RichCompare(__pyx_t_9, __pyx_v_mapq4retarget, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 607, __pyx_L16_error)
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 607, __pyx_L16_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_4 = __pyx_t_7;
        __pyx_L20_bool_binop_done:;

        /* "aldy/indelpost/pileup.pyx":606
 *             read_dict
 *             for read_dict in pileup
 *             if not read_dict["is_reference_seq"]             # <<<<<<<<<<<<<<
 *             and read_dict["mapq"] > mapq4retarget
 *         ]
 */
        if (__pyx_t_4) {

          /* "aldy/indelpost/pileup.pyx":604
 *     else:
 *         non_refs = [
 *             read_dict             # <<<<<<<<<<<<<<
 *             for read_dict in pileup
 *             if not read_dict["is_reference_seq"]
 */
          if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_9genexpr15__pyx_v_read_dict))) __PYX_ERR(0, 603, __pyx_L16_error)

          /* "aldy/indelpost/pileup.pyx":606
 *             read_dict
 *             for read_dict in pileup
 *             if not read_dict["is_reference_seq"]             # <<<<<<<<<<<<<<
 *             and read_dict["mapq"] > mapq4retarget
 *         ]
 */
        }

        /* "aldy/indelpost/pileup.pyx":605
 *         non_refs = [
 *             read_dict
 *             for read_dict in pileup             # <<<<<<<<<<<<<<
 *             if not read_dict["is_reference_seq"]
 *             and read_dict["mapq"] > mapq4retarget
 */
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_9genexpr15__pyx_v_read_dict); __pyx_9genexpr15__pyx_v_read_dict = 0;
      goto __pyx_L22_exit_scope;
      __pyx_L16_error:;
      __Pyx_XDECREF(__pyx_9genexpr15__pyx_v_read_dict); __pyx_9genexpr15__pyx_v_read_dict = 0;
      goto __pyx_L1_error;
      __pyx_L22_exit_scope:;
    } /* exit inner scope */
    __pyx_v_non_refs = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;
  }
  __pyx_L3:;

  /* "aldy/indelpost/pileup.pyx":610
 *         ]
 * 
 *     if not non_refs:             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
  __pyx_t_4 = (PyList_GET_SIZE(__pyx_v_non_refs) != 0);
  __pyx_t_7 = ((!__pyx_t_4) != 0);
  if (__pyx_t_7) {

    /* "aldy/indelpost/pileup.pyx":611
 * 
 *     if not non_refs:
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     # cutoff auto_adjustment
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "aldy/indelpost/pileup.pyx":610
 *         ]
 * 
 *     if not non_refs:             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
  }

  /* "aldy/indelpost/pileup.pyx":614
 * 
 *     # cutoff auto_adjustment
 *     if len(target.indel_seq) < 3:             # <<<<<<<<<<<<<<
 *         cutoff = 1.0
 *     else:
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_target, __pyx_n_s_indel_seq); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 614, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 614, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_7 = ((__pyx_t_5 < 3) != 0);
  if (__pyx_t_7) {

    /* "aldy/indelpost/pileup.pyx":615
 *     # cutoff auto_adjustment
 *     if len(target.indel_seq) < 3:
 *         cutoff = 1.0             # <<<<<<<<<<<<<<
 *     else:
 *         cutoff = retargetcutoff
 */
    __Pyx_INCREF(__pyx_float_1_0);
    __pyx_v_cutoff = __pyx_float_1_0;

    /* "aldy/indelpost/pileup.pyx":614
 * 
 *     # cutoff auto_adjustment
 *     if len(target.indel_seq) < 3:             # <<<<<<<<<<<<<<
 *         cutoff = 1.0
 *     else:
 */
    goto __pyx_L24;
  }

  /* "aldy/indelpost/pileup.pyx":617
 *         cutoff = 1.0
 *     else:
 *         cutoff = retargetcutoff             # <<<<<<<<<<<<<<
 * 
 *     #best_matches = None
 */
  /*else*/ {
    __Pyx_INCREF(__pyx_v_retargetcutoff);
    __pyx_v_cutoff = __pyx_v_retargetcutoff;
  }
  __pyx_L24:;

  /* "aldy/indelpost/pileup.pyx":624
 *     #    is_gapped_aln = False
 * 
 *     tmp_non_refs = non_refs.copy()             # <<<<<<<<<<<<<<
 * 
 *     non_refs = [
 */
  __pyx_t_3 = __Pyx_CallUnboundCMethod0(&__pyx_umethod_PyList_Type_copy, __pyx_v_non_refs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 624, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_tmp_non_refs = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "aldy/indelpost/pileup.pyx":626
 *     tmp_non_refs = non_refs.copy()
 * 
 *     non_refs = [             # <<<<<<<<<<<<<<
 *         read_dict
 *         for read_dict
 */
  { /* enter inner scope */
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 626, __pyx_L27_error)
    __Pyx_GOTREF(__pyx_t_3);

    /* "aldy/indelpost/pileup.pyx":629
 *         read_dict
 *         for read_dict
 *         in non_refs             # <<<<<<<<<<<<<<
 *         if read_dict["low_qual_base_num"] < 6
 *         and not read_dict["is_dirty"]
 */
    __pyx_t_2 = __pyx_v_non_refs; __Pyx_INCREF(__pyx_t_2); __pyx_t_5 = 0;
    for (;;) {
      if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_2)) break;
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 629, __pyx_L27_error)
      #else
      __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 629, __pyx_L27_error)
      __Pyx_GOTREF(__pyx_t_1);
      #endif
      __Pyx_XDECREF_SET(__pyx_9genexpr16__pyx_v_read_dict, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "aldy/indelpost/pileup.pyx":630
 *         for read_dict
 *         in non_refs
 *         if read_dict["low_qual_base_num"] < 6             # <<<<<<<<<<<<<<
 *         and not read_dict["is_dirty"]
 *         and not read_dict["is_end_dirty"]
 */
      __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_9genexpr16__pyx_v_read_dict, __pyx_n_u_low_qual_base_num); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 630, __pyx_L27_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_9 = PyObject_RichCompare(__pyx_t_1, __pyx_int_6, Py_LT); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 630, __pyx_L27_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 630, __pyx_L27_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (__pyx_t_4) {
      } else {
        __pyx_t_7 = __pyx_t_4;
        goto __pyx_L31_bool_binop_done;
      }

      /* "aldy/indelpost/pileup.pyx":631
 *         in non_refs
 *         if read_dict["low_qual_base_num"] < 6
 *         and not read_dict["is_dirty"]             # <<<<<<<<<<<<<<
 *         and not read_dict["is_end_dirty"]
 *         and read_dict.get("is_worth_realn", True)
 */
      __pyx_t_9 = __Pyx_PyObject_Dict_GetItem(__pyx_9genexpr16__pyx_v_read_dict, __pyx_n_u_is_dirty); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 631, __pyx_L27_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 631, __pyx_L27_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_8 = ((!__pyx_t_4) != 0);
      if (__pyx_t_8) {
      } else {
        __pyx_t_7 = __pyx_t_8;
        goto __pyx_L31_bool_binop_done;
      }

      /* "aldy/indelpost/pileup.pyx":632
 *         if read_dict["low_qual_base_num"] < 6
 *         and not read_dict["is_dirty"]
 *         and not read_dict["is_end_dirty"]             # <<<<<<<<<<<<<<
 *         and read_dict.get("is_worth_realn", True)
 *     ]
 */
      __pyx_t_9 = __Pyx_PyObject_Dict_GetItem(__pyx_9genexpr16__pyx_v_read_dict, __pyx_n_u_is_end_dirty); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 632, __pyx_L27_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 632, __pyx_L27_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_4 = ((!__pyx_t_8) != 0);
      if (__pyx_t_4) {
      } else {
        __pyx_t_7 = __pyx_t_4;
        goto __pyx_L31_bool_binop_done;
      }

      /* "aldy/indelpost/pileup.pyx":633
 *         and not read_dict["is_dirty"]
 *         and not read_dict["is_end_dirty"]
 *         and read_dict.get("is_worth_realn", True)             # <<<<<<<<<<<<<<
 *     ]
 * 
 */
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_9genexpr16__pyx_v_read_dict, __pyx_n_s_get); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 633, __pyx_L27_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 633, __pyx_L27_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 633, __pyx_L27_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_7 = __pyx_t_4;
      __pyx_L31_bool_binop_done:;

      /* "aldy/indelpost/pileup.pyx":630
 *         for read_dict
 *         in non_refs
 *         if read_dict["low_qual_base_num"] < 6             # <<<<<<<<<<<<<<
 *         and not read_dict["is_dirty"]
 *         and not read_dict["is_end_dirty"]
 */
      if (__pyx_t_7) {

        /* "aldy/indelpost/pileup.pyx":627
 * 
 *     non_refs = [
 *         read_dict             # <<<<<<<<<<<<<<
 *         for read_dict
 *         in non_refs
 */
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_9genexpr16__pyx_v_read_dict))) __PYX_ERR(0, 626, __pyx_L27_error)

        /* "aldy/indelpost/pileup.pyx":630
 *         for read_dict
 *         in non_refs
 *         if read_dict["low_qual_base_num"] < 6             # <<<<<<<<<<<<<<
 *         and not read_dict["is_dirty"]
 *         and not read_dict["is_end_dirty"]
 */
      }

      /* "aldy/indelpost/pileup.pyx":628
 *     non_refs = [
 *         read_dict
 *         for read_dict             # <<<<<<<<<<<<<<
 *         in non_refs
 *         if read_dict["low_qual_base_num"] < 6
 */
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_9genexpr16__pyx_v_read_dict); __pyx_9genexpr16__pyx_v_read_dict = 0;
    goto __pyx_L35_exit_scope;
    __pyx_L27_error:;
    __Pyx_XDECREF(__pyx_9genexpr16__pyx_v_read_dict); __pyx_9genexpr16__pyx_v_read_dict = 0;
    goto __pyx_L1_error;
    __pyx_L35_exit_scope:;
  } /* exit inner scope */
  __Pyx_DECREF_SET(__pyx_v_non_refs, ((PyObject*)__pyx_t_3));
  __pyx_t_3 = 0;

  /* "aldy/indelpost/pileup.pyx":636
 *     ]
 * 
 *     if not non_refs:             # <<<<<<<<<<<<<<
 *         non_refs = [read_dict for read_dict in tmp_non_refs if not read_dict["is_dirty"]]
 * 
 */
  __pyx_t_7 = (PyList_GET_SIZE(__pyx_v_non_refs) != 0);
  __pyx_t_4 = ((!__pyx_t_7) != 0);
  if (__pyx_t_4) {

    /* "aldy/indelpost/pileup.pyx":637
 * 
 *     if not non_refs:
 *         non_refs = [read_dict for read_dict in tmp_non_refs if not read_dict["is_dirty"]]             # <<<<<<<<<<<<<<
 * 
 *     ref_starts, ref_alns, ref_seqs, aligners = [], [], [], []
 */
    { /* enter inner scope */
      __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 637, __pyx_L39_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (likely(PyList_CheckExact(__pyx_v_tmp_non_refs)) || PyTuple_CheckExact(__pyx_v_tmp_non_refs)) {
        __pyx_t_2 = __pyx_v_tmp_non_refs; __Pyx_INCREF(__pyx_t_2); __pyx_t_5 = 0;
        __pyx_t_6 = NULL;
      } else {
        __pyx_t_5 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_tmp_non_refs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 637, __pyx_L39_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_6 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 637, __pyx_L39_error)
      }
      for (;;) {
        if (likely(!__pyx_t_6)) {
          if (likely(PyList_CheckExact(__pyx_t_2))) {
            if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_2)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 637, __pyx_L39_error)
            #else
            __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 637, __pyx_L39_error)
            __Pyx_GOTREF(__pyx_t_1);
            #endif
          } else {
            if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 637, __pyx_L39_error)
            #else
            __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 637, __pyx_L39_error)
            __Pyx_GOTREF(__pyx_t_1);
            #endif
          }
        } else {
          __pyx_t_1 = __pyx_t_6(__pyx_t_2);
          if (unlikely(!__pyx_t_1)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(0, 637, __pyx_L39_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_1);
        }
        __Pyx_XDECREF_SET(__pyx_9genexpr17__pyx_v_read_dict, __pyx_t_1);
        __pyx_t_1 = 0;
        __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_9genexpr17__pyx_v_read_dict, __pyx_n_u_is_dirty); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 637, __pyx_L39_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 637, __pyx_L39_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_7 = ((!__pyx_t_4) != 0);
        if (__pyx_t_7) {
          if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_9genexpr17__pyx_v_read_dict))) __PYX_ERR(0, 637, __pyx_L39_error)
        }
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_9genexpr17__pyx_v_read_dict); __pyx_9genexpr17__pyx_v_read_dict = 0;
      goto __pyx_L43_exit_scope;
      __pyx_L39_error:;
      __Pyx_XDECREF(__pyx_9genexpr17__pyx_v_read_dict); __pyx_9genexpr17__pyx_v_read_dict = 0;
      goto __pyx_L1_error;
      __pyx_L43_exit_scope:;
    } /* exit inner scope */
    __Pyx_DECREF_SET(__pyx_v_non_refs, ((PyObject*)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "aldy/indelpost/pileup.pyx":636
 *     ]
 * 
 *     if not non_refs:             # <<<<<<<<<<<<<<
 *         non_refs = [read_dict for read_dict in tmp_non_refs if not read_dict["is_dirty"]]
 * 
 */
  }

  /* "aldy/indelpost/pileup.pyx":639
 *         non_refs = [read_dict for read_dict in tmp_non_refs if not read_dict["is_dirty"]]
 * 
 *     ref_starts, ref_alns, ref_seqs, aligners = [], [], [], []             # <<<<<<<<<<<<<<
 *     for read in non_refs:
 *         ref_seq, lt_len = get_local_reference(target, [read], window, unspl_loc_ref)
 */
  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 639, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 639, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 639, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_9 = PyList_New(0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 639, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_v_ref_starts = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_v_ref_alns = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_v_ref_seqs = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_v_aligners = ((PyObject*)__pyx_t_9);
  __pyx_t_9 = 0;

  /* "aldy/indelpost/pileup.pyx":640
 * 
 *     ref_starts, ref_alns, ref_seqs, aligners = [], [], [], []
 *     for read in non_refs:             # <<<<<<<<<<<<<<
 *         ref_seq, lt_len = get_local_reference(target, [read], window, unspl_loc_ref)
 *         ref_seqs.append(ref_seq)
 */
  __pyx_t_9 = __pyx_v_non_refs; __Pyx_INCREF(__pyx_t_9); __pyx_t_5 = 0;
  for (;;) {
    if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_9)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_1 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 640, __pyx_L1_error)
    #else
    __pyx_t_1 = PySequence_ITEM(__pyx_t_9, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 640, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_read, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "aldy/indelpost/pileup.pyx":641
 *     ref_starts, ref_alns, ref_seqs, aligners = [], [], [], []
 *     for read in non_refs:
 *         ref_seq, lt_len = get_local_reference(target, [read], window, unspl_loc_ref)             # <<<<<<<<<<<<<<
 *         ref_seqs.append(ref_seq)
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_get_local_reference); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 641, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 641, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_read);
    __Pyx_GIVEREF(__pyx_v_read);
    PyList_SET_ITEM(__pyx_t_3, 0, __pyx_v_read);
    __pyx_t_10 = NULL;
    __pyx_t_11 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_11 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[5] = {__pyx_t_10, __pyx_cur_scope->__pyx_v_target, __pyx_t_3, __pyx_v_window, __pyx_v_unspl_loc_ref};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_11, 4+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 641, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[5] = {__pyx_t_10, __pyx_cur_scope->__pyx_v_target, __pyx_t_3, __pyx_v_window, __pyx_v_unspl_loc_ref};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_11, 4+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 641, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    {
      __pyx_t_12 = PyTuple_New(4+__pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 641, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      if (__pyx_t_10) {
        __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_10); __pyx_t_10 = NULL;
      }
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_target);
      __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_target);
      PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_11, __pyx_cur_scope->__pyx_v_target);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_11, __pyx_t_3);
      __Pyx_INCREF(__pyx_v_window);
      __Pyx_GIVEREF(__pyx_v_window);
      PyTuple_SET_ITEM(__pyx_t_12, 2+__pyx_t_11, __pyx_v_window);
      __Pyx_INCREF(__pyx_v_unspl_loc_ref);
      __Pyx_GIVEREF(__pyx_v_unspl_loc_ref);
      PyTuple_SET_ITEM(__pyx_t_12, 3+__pyx_t_11, __pyx_v_unspl_loc_ref);
      __pyx_t_3 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_12, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 641, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
      PyObject* sequence = __pyx_t_1;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 641, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_12 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_12 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_12);
      #else
      __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 641, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_12 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 641, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 641, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_13 = Py_TYPE(__pyx_t_3)->tp_iternext;
      index = 0; __pyx_t_2 = __pyx_t_13(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L46_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_2);
      index = 1; __pyx_t_12 = __pyx_t_13(__pyx_t_3); if (unlikely(!__pyx_t_12)) goto __pyx_L46_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_12);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_3), 2) < 0) __PYX_ERR(0, 641, __pyx_L1_error)
      __pyx_t_13 = NULL;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L47_unpacking_done;
      __pyx_L46_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_13 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 641, __pyx_L1_error)
      __pyx_L47_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_ref_seq, __pyx_t_2);
    __pyx_t_2 = 0;
    __Pyx_XDECREF_SET(__pyx_v_lt_len, __pyx_t_12);
    __pyx_t_12 = 0;

    /* "aldy/indelpost/pileup.pyx":642
 *     for read in non_refs:
 *         ref_seq, lt_len = get_local_reference(target, [read], window, unspl_loc_ref)
 *         ref_seqs.append(ref_seq)             # <<<<<<<<<<<<<<
 * 
 *         aligner = make_aligner(ref_seq, match_score, mismatch_penalty)
 */
    __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_ref_seqs, __pyx_v_ref_seq); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 642, __pyx_L1_error)

    /* "aldy/indelpost/pileup.pyx":644
 *         ref_seqs.append(ref_seq)
 * 
 *         aligner = make_aligner(ref_seq, match_score, mismatch_penalty)             # <<<<<<<<<<<<<<
 *         aligners.append(aligner)
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_make_aligner); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 644, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_2 = NULL;
    __pyx_t_11 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_12);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_12, function);
        __pyx_t_11 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_12)) {
      PyObject *__pyx_temp[4] = {__pyx_t_2, __pyx_v_ref_seq, __pyx_v_match_score, __pyx_v_mismatch_penalty};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 644, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_12)) {
      PyObject *__pyx_temp[4] = {__pyx_t_2, __pyx_v_ref_seq, __pyx_v_match_score, __pyx_v_mismatch_penalty};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 644, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    {
      __pyx_t_3 = PyTuple_New(3+__pyx_t_11); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 644, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (__pyx_t_2) {
        __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __pyx_t_2 = NULL;
      }
      __Pyx_INCREF(__pyx_v_ref_seq);
      __Pyx_GIVEREF(__pyx_v_ref_seq);
      PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_11, __pyx_v_ref_seq);
      __Pyx_INCREF(__pyx_v_match_score);
      __Pyx_GIVEREF(__pyx_v_match_score);
      PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_11, __pyx_v_match_score);
      __Pyx_INCREF(__pyx_v_mismatch_penalty);
      __Pyx_GIVEREF(__pyx_v_mismatch_penalty);
      PyTuple_SET_ITEM(__pyx_t_3, 2+__pyx_t_11, __pyx_v_mismatch_penalty);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 644, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_XDECREF_SET(__pyx_v_aligner, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "aldy/indelpost/pileup.pyx":645
 * 
 *         aligner = make_aligner(ref_seq, match_score, mismatch_penalty)
 *         aligners.append(aligner)             # <<<<<<<<<<<<<<
 * 
 *         ref_alns.append(align(aligner, read["read_seq"], gap_open_penalty, gap_extension_penalty))
 */
    __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_aligners, __pyx_v_aligner); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 645, __pyx_L1_error)

    /* "aldy/indelpost/pileup.pyx":647
 *         aligners.append(aligner)
 * 
 *         ref_alns.append(align(aligner, read["read_seq"], gap_open_penalty, gap_extension_penalty))             # <<<<<<<<<<<<<<
 *         ref_starts.append(target.pos + 1 - lt_len)
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_align); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 647, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_v_read, __pyx_n_u_read_seq); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 647, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = NULL;
    __pyx_t_11 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_12);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_12, function);
        __pyx_t_11 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_12)) {
      PyObject *__pyx_temp[5] = {__pyx_t_2, __pyx_v_aligner, __pyx_t_3, __pyx_v_gap_open_penalty, __pyx_v_gap_extension_penalty};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_11, 4+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 647, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_12)) {
      PyObject *__pyx_temp[5] = {__pyx_t_2, __pyx_v_aligner, __pyx_t_3, __pyx_v_gap_open_penalty, __pyx_v_gap_extension_penalty};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_11, 4+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 647, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    {
      __pyx_t_10 = PyTuple_New(4+__pyx_t_11); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 647, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      if (__pyx_t_2) {
        __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_2); __pyx_t_2 = NULL;
      }
      __Pyx_INCREF(__pyx_v_aligner);
      __Pyx_GIVEREF(__pyx_v_aligner);
      PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_11, __pyx_v_aligner);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_11, __pyx_t_3);
      __Pyx_INCREF(__pyx_v_gap_open_penalty);
      __Pyx_GIVEREF(__pyx_v_gap_open_penalty);
      PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_11, __pyx_v_gap_open_penalty);
      __Pyx_INCREF(__pyx_v_gap_extension_penalty);
      __Pyx_GIVEREF(__pyx_v_gap_extension_penalty);
      PyTuple_SET_ITEM(__pyx_t_10, 3+__pyx_t_11, __pyx_v_gap_extension_penalty);
      __pyx_t_3 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 647, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    }
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_ref_alns, __pyx_t_1); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 647, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "aldy/indelpost/pileup.pyx":648
 * 
 *         ref_alns.append(align(aligner, read["read_seq"], gap_open_penalty, gap_extension_penalty))
 *         ref_starts.append(target.pos + 1 - lt_len)             # <<<<<<<<<<<<<<
 * 
 *     complex_flags = []
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_target, __pyx_n_s_pos); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 648, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_12 = __Pyx_PyInt_AddObjC(__pyx_t_1, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 648, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_Subtract(__pyx_t_12, __pyx_v_lt_len); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 648, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_ref_starts, __pyx_t_1); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 648, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "aldy/indelpost/pileup.pyx":640
 * 
 *     ref_starts, ref_alns, ref_seqs, aligners = [], [], [], []
 *     for read in non_refs:             # <<<<<<<<<<<<<<
 *         ref_seq, lt_len = get_local_reference(target, [read], window, unspl_loc_ref)
 *         ref_seqs.append(ref_seq)
 */
  }
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "aldy/indelpost/pileup.pyx":650
 *         ref_starts.append(target.pos + 1 - lt_len)
 * 
 *     complex_flags = []             # <<<<<<<<<<<<<<
 *     candidates, candidate_reads, candidate_ref_seqs, candidate_ref_starts, candidate_aligners = [], [], [], [], []
 *     for read, aln, ref_seq, ref_start, aligner in zip(non_refs, ref_alns, ref_seqs, ref_starts, aligners):
 */
  __pyx_t_9 = PyList_New(0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 650, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_v_complex_flags = ((PyObject*)__pyx_t_9);
  __pyx_t_9 = 0;

  /* "aldy/indelpost/pileup.pyx":651
 * 
 *     complex_flags = []
 *     candidates, candidate_reads, candidate_ref_seqs, candidate_ref_starts, candidate_aligners = [], [], [], [], []             # <<<<<<<<<<<<<<
 *     for read, aln, ref_seq, ref_start, aligner in zip(non_refs, ref_alns, ref_seqs, ref_starts, aligners):
 *         genome_aln_pos = ref_start + aln.reference_start
 */
  __pyx_t_9 = PyList_New(0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 651, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 651, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_12 = PyList_New(0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 651, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_10 = PyList_New(0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 651, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 651, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_candidates = ((PyObject*)__pyx_t_9);
  __pyx_t_9 = 0;
  __pyx_v_candidate_reads = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_v_candidate_ref_seqs = ((PyObject*)__pyx_t_12);
  __pyx_t_12 = 0;
  __pyx_v_candidate_ref_starts = ((PyObject*)__pyx_t_10);
  __pyx_t_10 = 0;
  __pyx_v_candidate_aligners = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "aldy/indelpost/pileup.pyx":652
 *     complex_flags = []
 *     candidates, candidate_reads, candidate_ref_seqs, candidate_ref_starts, candidate_aligners = [], [], [], [], []
 *     for read, aln, ref_seq, ref_start, aligner in zip(non_refs, ref_alns, ref_seqs, ref_starts, aligners):             # <<<<<<<<<<<<<<
 *         genome_aln_pos = ref_start + aln.reference_start
 * 
 */
  __pyx_t_3 = PyTuple_New(5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 652, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_non_refs);
  __Pyx_GIVEREF(__pyx_v_non_refs);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_non_refs);
  __Pyx_INCREF(__pyx_v_ref_alns);
  __Pyx_GIVEREF(__pyx_v_ref_alns);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_ref_alns);
  __Pyx_INCREF(__pyx_v_ref_seqs);
  __Pyx_GIVEREF(__pyx_v_ref_seqs);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_ref_seqs);
  __Pyx_INCREF(__pyx_v_ref_starts);
  __Pyx_GIVEREF(__pyx_v_ref_starts);
  PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_v_ref_starts);
  __Pyx_INCREF(__pyx_v_aligners);
  __Pyx_GIVEREF(__pyx_v_aligners);
  PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_v_aligners);
  __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_zip, __pyx_t_3, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 652, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (likely(PyList_CheckExact(__pyx_t_10)) || PyTuple_CheckExact(__pyx_t_10)) {
    __pyx_t_3 = __pyx_t_10; __Pyx_INCREF(__pyx_t_3); __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
  } else {
    __pyx_t_5 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 652, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 652, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  for (;;) {
    if (likely(!__pyx_t_6)) {
      if (likely(PyList_CheckExact(__pyx_t_3))) {
        if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_10 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_10); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 652, __pyx_L1_error)
        #else
        __pyx_t_10 = PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 652, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        #endif
      } else {
        if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_10); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 652, __pyx_L1_error)
        #else
        __pyx_t_10 = PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 652, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        #endif
      }
    } else {
      __pyx_t_10 = __pyx_t_6(__pyx_t_3);
      if (unlikely(!__pyx_t_10)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 652, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_10);
    }
    if ((likely(PyTuple_CheckExact(__pyx_t_10))) || (PyList_CheckExact(__pyx_t_10))) {
      PyObject* sequence = __pyx_t_10;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 5)) {
        if (size > 5) __Pyx_RaiseTooManyValuesError(5);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 652, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_12 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_9 = PyTuple_GET_ITEM(sequence, 2); 
        __pyx_t_2 = PyTuple_GET_ITEM(sequence, 3); 
        __pyx_t_15 = PyTuple_GET_ITEM(sequence, 4); 
      } else {
        __pyx_t_12 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_9 = PyList_GET_ITEM(sequence, 2); 
        __pyx_t_2 = PyList_GET_ITEM(sequence, 3); 
        __pyx_t_15 = PyList_GET_ITEM(sequence, 4); 
      }
      __Pyx_INCREF(__pyx_t_12);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_15);
      #else
      {
        Py_ssize_t i;
        PyObject** temps[5] = {&__pyx_t_12,&__pyx_t_1,&__pyx_t_9,&__pyx_t_2,&__pyx_t_15};
        for (i=0; i < 5; i++) {
          PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 652, __pyx_L1_error)
          __Pyx_GOTREF(item);
          *(temps[i]) = item;
        }
      }
      #endif
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    } else {
      Py_ssize_t index = -1;
      PyObject** temps[5] = {&__pyx_t_12,&__pyx_t_1,&__pyx_t_9,&__pyx_t_2,&__pyx_t_15};
      __pyx_t_16 = PyObject_GetIter(__pyx_t_10); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 652, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_13 = Py_TYPE(__pyx_t_16)->tp_iternext;
      for (index=0; index < 5; index++) {
        PyObject* item = __pyx_t_13(__pyx_t_16); if (unlikely(!item)) goto __pyx_L50_unpacking_failed;
        __Pyx_GOTREF(item);
        *(temps[index]) = item;
      }
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_16), 5) < 0) __PYX_ERR(0, 652, __pyx_L1_error)
      __pyx_t_13 = NULL;
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      goto __pyx_L51_unpacking_done;
      __pyx_L50_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      __pyx_t_13 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 652, __pyx_L1_error)
      __pyx_L51_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_read, __pyx_t_12);
    __pyx_t_12 = 0;
    __Pyx_XDECREF_SET(__pyx_v_aln, __pyx_t_1);
    __pyx_t_1 = 0;
    __Pyx_XDECREF_SET(__pyx_v_ref_seq, __pyx_t_9);
    __pyx_t_9 = 0;
    __Pyx_XDECREF_SET(__pyx_v_ref_start, __pyx_t_2);
    __pyx_t_2 = 0;
    __Pyx_XDECREF_SET(__pyx_v_aligner, __pyx_t_15);
    __pyx_t_15 = 0;

    /* "aldy/indelpost/pileup.pyx":653
 *     candidates, candidate_reads, candidate_ref_seqs, candidate_ref_starts, candidate_aligners = [], [], [], [], []
 *     for read, aln, ref_seq, ref_start, aligner in zip(non_refs, ref_alns, ref_seqs, ref_starts, aligners):
 *         genome_aln_pos = ref_start + aln.reference_start             # <<<<<<<<<<<<<<
 * 
 *         aligned_read_len = (aln.read_end - aln.read_start)
 */
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_aln, __pyx_n_s_reference_start); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 653, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_15 = PyNumber_Add(__pyx_v_ref_start, __pyx_t_10); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 653, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF_SET(__pyx_v_genome_aln_pos, __pyx_t_15);
    __pyx_t_15 = 0;

    /* "aldy/indelpost/pileup.pyx":655
 *         genome_aln_pos = ref_start + aln.reference_start
 * 
 *         aligned_read_len = (aln.read_end - aln.read_start)             # <<<<<<<<<<<<<<
 *         window_len = window * 6
 *         aligned_frac = aligned_read_len / min(len(read["read_seq"]), window_len)
 */
    __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_aln, __pyx_n_s_read_end); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 655, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_aln, __pyx_n_s_read_start); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 655, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_2 = PyNumber_Subtract(__pyx_t_15, __pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 655, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF_SET(__pyx_v_aligned_read_len, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "aldy/indelpost/pileup.pyx":656
 * 
 *         aligned_read_len = (aln.read_end - aln.read_start)
 *         window_len = window * 6             # <<<<<<<<<<<<<<
 *         aligned_frac = aligned_read_len / min(len(read["read_seq"]), window_len)
 * 
 */
    __pyx_t_2 = PyNumber_Multiply(__pyx_v_window, __pyx_int_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 656, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XDECREF_SET(__pyx_v_window_len, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "aldy/indelpost/pileup.pyx":657
 *         aligned_read_len = (aln.read_end - aln.read_start)
 *         window_len = window * 6
 *         aligned_frac = aligned_read_len / min(len(read["read_seq"]), window_len)             # <<<<<<<<<<<<<<
 * 
 *         gap_cnt = aln.CIGAR.count("I") + aln.CIGAR.count("D")
 */
    __Pyx_INCREF(__pyx_v_window_len);
    __pyx_t_2 = __pyx_v_window_len;
    __pyx_t_10 = __Pyx_PyObject_Dict_GetItem(__pyx_v_read, __pyx_n_u_read_seq); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 657, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_17 = PyObject_Length(__pyx_t_10); if (unlikely(__pyx_t_17 == ((Py_ssize_t)-1))) __PYX_ERR(0, 657, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_15 = PyInt_FromSsize_t(__pyx_t_17); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 657, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __pyx_t_9 = PyObject_RichCompare(__pyx_t_2, __pyx_t_15, Py_LT); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 657, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 657, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (__pyx_t_7) {
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_10 = __pyx_t_2;
    } else {
      __pyx_t_9 = PyInt_FromSsize_t(__pyx_t_17); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 657, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = __pyx_t_9;
      __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_v_aligned_read_len, __pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 657, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF_SET(__pyx_v_aligned_frac, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "aldy/indelpost/pileup.pyx":659
 *         aligned_frac = aligned_read_len / min(len(read["read_seq"]), window_len)
 * 
 *         gap_cnt = aln.CIGAR.count("I") + aln.CIGAR.count("D")             # <<<<<<<<<<<<<<
 * 
 *         if 0 < gap_cnt < 6 and aligned_frac > 0.7:
 */
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_aln, __pyx_n_s_CIGAR); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 659, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_count); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 659, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_9, function);
      }
    }
    __pyx_t_2 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_10, __pyx_n_u_I) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_n_u_I);
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 659, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_aln, __pyx_n_s_CIGAR); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 659, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_count); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 659, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_15))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_15);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_15, function);
      }
    }
    __pyx_t_9 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_15, __pyx_t_10, __pyx_n_u_D) : __Pyx_PyObject_CallOneArg(__pyx_t_15, __pyx_n_u_D);
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 659, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_t_15 = PyNumber_Add(__pyx_t_2, __pyx_t_9); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 659, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_XDECREF_SET(__pyx_v_gap_cnt, __pyx_t_15);
    __pyx_t_15 = 0;

    /* "aldy/indelpost/pileup.pyx":661
 *         gap_cnt = aln.CIGAR.count("I") + aln.CIGAR.count("D")
 * 
 *         if 0 < gap_cnt < 6 and aligned_frac > 0.7:             # <<<<<<<<<<<<<<
 *             indels = findall_indels(aln, genome_aln_pos, ref_seq, read["read_seq"])
 *             positions = [d["pos"] for d in indels]
 */
    __pyx_t_15 = PyObject_RichCompare(__pyx_int_0, __pyx_v_gap_cnt, Py_LT); __Pyx_XGOTREF(__pyx_t_15); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 661, __pyx_L1_error)
    if (__Pyx_PyObject_IsTrue(__pyx_t_15)) {
      __Pyx_DECREF(__pyx_t_15);
      __pyx_t_15 = PyObject_RichCompare(__pyx_v_gap_cnt, __pyx_int_6, Py_LT); __Pyx_XGOTREF(__pyx_t_15); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 661, __pyx_L1_error)
    }
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_15); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 661, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    if (__pyx_t_4) {
    } else {
      __pyx_t_7 = __pyx_t_4;
      goto __pyx_L53_bool_binop_done;
    }
    __pyx_t_15 = PyObject_RichCompare(__pyx_v_aligned_frac, __pyx_float_0_7, Py_GT); __Pyx_XGOTREF(__pyx_t_15); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 661, __pyx_L1_error)
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_15); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 661, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_t_7 = __pyx_t_4;
    __pyx_L53_bool_binop_done:;
    if (__pyx_t_7) {

      /* "aldy/indelpost/pileup.pyx":662
 * 
 *         if 0 < gap_cnt < 6 and aligned_frac > 0.7:
 *             indels = findall_indels(aln, genome_aln_pos, ref_seq, read["read_seq"])             # <<<<<<<<<<<<<<
 *             positions = [d["pos"] for d in indels]
 *             complex_positions = set([p for p in positions if positions.count(p) == 2])
 */
      __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_findall_indels); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 662, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_read, __pyx_n_u_read_seq); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 662, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_10 = NULL;
      __pyx_t_11 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
        __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9);
        if (likely(__pyx_t_10)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_10);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_9, function);
          __pyx_t_11 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_9)) {
        PyObject *__pyx_temp[5] = {__pyx_t_10, __pyx_v_aln, __pyx_v_genome_aln_pos, __pyx_v_ref_seq, __pyx_t_2};
        __pyx_t_15 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_11, 4+__pyx_t_11); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 662, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_GOTREF(__pyx_t_15);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
        PyObject *__pyx_temp[5] = {__pyx_t_10, __pyx_v_aln, __pyx_v_genome_aln_pos, __pyx_v_ref_seq, __pyx_t_2};
        __pyx_t_15 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_11, 4+__pyx_t_11); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 662, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_GOTREF(__pyx_t_15);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else
      #endif
      {
        __pyx_t_1 = PyTuple_New(4+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 662, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        if (__pyx_t_10) {
          __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_10); __pyx_t_10 = NULL;
        }
        __Pyx_INCREF(__pyx_v_aln);
        __Pyx_GIVEREF(__pyx_v_aln);
        PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_11, __pyx_v_aln);
        __Pyx_INCREF(__pyx_v_genome_aln_pos);
        __Pyx_GIVEREF(__pyx_v_genome_aln_pos);
        PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_11, __pyx_v_genome_aln_pos);
        __Pyx_INCREF(__pyx_v_ref_seq);
        __Pyx_GIVEREF(__pyx_v_ref_seq);
        PyTuple_SET_ITEM(__pyx_t_1, 2+__pyx_t_11, __pyx_v_ref_seq);
        __Pyx_GIVEREF(__pyx_t_2);
        PyTuple_SET_ITEM(__pyx_t_1, 3+__pyx_t_11, __pyx_t_2);
        __pyx_t_2 = 0;
        __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_1, NULL); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 662, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      }
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_XDECREF_SET(__pyx_v_indels, __pyx_t_15);
      __pyx_t_15 = 0;

      /* "aldy/indelpost/pileup.pyx":663
 *         if 0 < gap_cnt < 6 and aligned_frac > 0.7:
 *             indels = findall_indels(aln, genome_aln_pos, ref_seq, read["read_seq"])
 *             positions = [d["pos"] for d in indels]             # <<<<<<<<<<<<<<
 *             complex_positions = set([p for p in positions if positions.count(p) == 2])
 * 
 */
      { /* enter inner scope */
        __pyx_t_15 = PyList_New(0); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 663, __pyx_L57_error)
        __Pyx_GOTREF(__pyx_t_15);
        if (likely(PyList_CheckExact(__pyx_v_indels)) || PyTuple_CheckExact(__pyx_v_indels)) {
          __pyx_t_9 = __pyx_v_indels; __Pyx_INCREF(__pyx_t_9); __pyx_t_17 = 0;
          __pyx_t_18 = NULL;
        } else {
          __pyx_t_17 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_v_indels); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 663, __pyx_L57_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_18 = Py_TYPE(__pyx_t_9)->tp_iternext; if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 663, __pyx_L57_error)
        }
        for (;;) {
          if (likely(!__pyx_t_18)) {
            if (likely(PyList_CheckExact(__pyx_t_9))) {
              if (__pyx_t_17 >= PyList_GET_SIZE(__pyx_t_9)) break;
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_1 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_17); __Pyx_INCREF(__pyx_t_1); __pyx_t_17++; if (unlikely(0 < 0)) __PYX_ERR(0, 663, __pyx_L57_error)
              #else
              __pyx_t_1 = PySequence_ITEM(__pyx_t_9, __pyx_t_17); __pyx_t_17++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 663, __pyx_L57_error)
              __Pyx_GOTREF(__pyx_t_1);
              #endif
            } else {
              if (__pyx_t_17 >= PyTuple_GET_SIZE(__pyx_t_9)) break;
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_17); __Pyx_INCREF(__pyx_t_1); __pyx_t_17++; if (unlikely(0 < 0)) __PYX_ERR(0, 663, __pyx_L57_error)
              #else
              __pyx_t_1 = PySequence_ITEM(__pyx_t_9, __pyx_t_17); __pyx_t_17++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 663, __pyx_L57_error)
              __Pyx_GOTREF(__pyx_t_1);
              #endif
            }
          } else {
            __pyx_t_1 = __pyx_t_18(__pyx_t_9);
            if (unlikely(!__pyx_t_1)) {
              PyObject* exc_type = PyErr_Occurred();
              if (exc_type) {
                if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
                else __PYX_ERR(0, 663, __pyx_L57_error)
              }
              break;
            }
            __Pyx_GOTREF(__pyx_t_1);
          }
          __Pyx_XDECREF_SET(__pyx_9genexpr18__pyx_v_d, __pyx_t_1);
          __pyx_t_1 = 0;
          __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_9genexpr18__pyx_v_d, __pyx_n_u_pos); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 663, __pyx_L57_error)
          __Pyx_GOTREF(__pyx_t_1);
          if (unlikely(__Pyx_ListComp_Append(__pyx_t_15, (PyObject*)__pyx_t_1))) __PYX_ERR(0, 663, __pyx_L57_error)
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        }
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_XDECREF(__pyx_9genexpr18__pyx_v_d); __pyx_9genexpr18__pyx_v_d = 0;
        goto __pyx_L60_exit_scope;
        __pyx_L57_error:;
        __Pyx_XDECREF(__pyx_9genexpr18__pyx_v_d); __pyx_9genexpr18__pyx_v_d = 0;
        goto __pyx_L1_error;
        __pyx_L60_exit_scope:;
      } /* exit inner scope */
      __Pyx_XDECREF_SET(__pyx_v_positions, ((PyObject*)__pyx_t_15));
      __pyx_t_15 = 0;

      /* "aldy/indelpost/pileup.pyx":664
 *             indels = findall_indels(aln, genome_aln_pos, ref_seq, read["read_seq"])
 *             positions = [d["pos"] for d in indels]
 *             complex_positions = set([p for p in positions if positions.count(p) == 2])             # <<<<<<<<<<<<<<
 * 
 *             target_type_indels = [
 */
      { /* enter inner scope */
        __pyx_t_15 = PyList_New(0); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 664, __pyx_L63_error)
        __Pyx_GOTREF(__pyx_t_15);
        __pyx_t_9 = __pyx_v_positions; __Pyx_INCREF(__pyx_t_9); __pyx_t_17 = 0;
        for (;;) {
          if (__pyx_t_17 >= PyList_GET_SIZE(__pyx_t_9)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_1 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_17); __Pyx_INCREF(__pyx_t_1); __pyx_t_17++; if (unlikely(0 < 0)) __PYX_ERR(0, 664, __pyx_L63_error)
          #else
          __pyx_t_1 = PySequence_ITEM(__pyx_t_9, __pyx_t_17); __pyx_t_17++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 664, __pyx_L63_error)
          __Pyx_GOTREF(__pyx_t_1);
          #endif
          __Pyx_XDECREF_SET(__pyx_9genexpr19__pyx_v_p, __pyx_t_1);
          __pyx_t_1 = 0;
          __pyx_t_1 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyList_Type_count, __pyx_v_positions, __pyx_9genexpr19__pyx_v_p); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 664, __pyx_L63_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_2 = __Pyx_PyInt_EqObjC(__pyx_t_1, __pyx_int_2, 2, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 664, __pyx_L63_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 664, __pyx_L63_error)
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (__pyx_t_7) {
            if (unlikely(__Pyx_ListComp_Append(__pyx_t_15, (PyObject*)__pyx_9genexpr19__pyx_v_p))) __PYX_ERR(0, 664, __pyx_L63_error)
          }
        }
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_XDECREF(__pyx_9genexpr19__pyx_v_p); __pyx_9genexpr19__pyx_v_p = 0;
        goto __pyx_L67_exit_scope;
        __pyx_L63_error:;
        __Pyx_XDECREF(__pyx_9genexpr19__pyx_v_p); __pyx_9genexpr19__pyx_v_p = 0;
        goto __pyx_L1_error;
        __pyx_L67_exit_scope:;
      } /* exit inner scope */
      __pyx_t_9 = PySet_New(__pyx_t_15); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 664, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __Pyx_XDECREF_SET(__pyx_v_complex_positions, ((PyObject*)__pyx_t_9));
      __pyx_t_9 = 0;

      /* "aldy/indelpost/pileup.pyx":666
 *             complex_positions = set([p for p in positions if positions.count(p) == 2])
 * 
 *             target_type_indels = [             # <<<<<<<<<<<<<<
 *                 indel for indel in indels if indel["indel_type"] == target_type
 *             ]
 */
      { /* enter inner scope */
        __pyx_t_9 = PyList_New(0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 666, __pyx_L70_error)
        __Pyx_GOTREF(__pyx_t_9);

        /* "aldy/indelpost/pileup.pyx":667
 * 
 *             target_type_indels = [
 *                 indel for indel in indels if indel["indel_type"] == target_type             # <<<<<<<<<<<<<<
 *             ]
 * 
 */
        if (likely(PyList_CheckExact(__pyx_v_indels)) || PyTuple_CheckExact(__pyx_v_indels)) {
          __pyx_t_15 = __pyx_v_indels; __Pyx_INCREF(__pyx_t_15); __pyx_t_17 = 0;
          __pyx_t_18 = NULL;
        } else {
          __pyx_t_17 = -1; __pyx_t_15 = PyObject_GetIter(__pyx_v_indels); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 667, __pyx_L70_error)
          __Pyx_GOTREF(__pyx_t_15);
          __pyx_t_18 = Py_TYPE(__pyx_t_15)->tp_iternext; if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 667, __pyx_L70_error)
        }
        for (;;) {
          if (likely(!__pyx_t_18)) {
            if (likely(PyList_CheckExact(__pyx_t_15))) {
              if (__pyx_t_17 >= PyList_GET_SIZE(__pyx_t_15)) break;
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_2 = PyList_GET_ITEM(__pyx_t_15, __pyx_t_17); __Pyx_INCREF(__pyx_t_2); __pyx_t_17++; if (unlikely(0 < 0)) __PYX_ERR(0, 667, __pyx_L70_error)
              #else
              __pyx_t_2 = PySequence_ITEM(__pyx_t_15, __pyx_t_17); __pyx_t_17++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 667, __pyx_L70_error)
              __Pyx_GOTREF(__pyx_t_2);
              #endif
            } else {
              if (__pyx_t_17 >= PyTuple_GET_SIZE(__pyx_t_15)) break;
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_15, __pyx_t_17); __Pyx_INCREF(__pyx_t_2); __pyx_t_17++; if (unlikely(0 < 0)) __PYX_ERR(0, 667, __pyx_L70_error)
              #else
              __pyx_t_2 = PySequence_ITEM(__pyx_t_15, __pyx_t_17); __pyx_t_17++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 667, __pyx_L70_error)
              __Pyx_GOTREF(__pyx_t_2);
              #endif
            }
          } else {
            __pyx_t_2 = __pyx_t_18(__pyx_t_15);
            if (unlikely(!__pyx_t_2)) {
              PyObject* exc_type = PyErr_Occurred();
              if (exc_type) {
                if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
                else __PYX_ERR(0, 667, __pyx_L70_error)
              }
              break;
            }
            __Pyx_GOTREF(__pyx_t_2);
          }
          __Pyx_XDECREF_SET(__pyx_9genexpr20__pyx_v_indel, __pyx_t_2);
          __pyx_t_2 = 0;
          __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_9genexpr20__pyx_v_indel, __pyx_n_u_indel_type); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 667, __pyx_L70_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_v_target_type, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 667, __pyx_L70_error)
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 667, __pyx_L70_error)
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          if (__pyx_t_7) {
            if (unlikely(__Pyx_ListComp_Append(__pyx_t_9, (PyObject*)__pyx_9genexpr20__pyx_v_indel))) __PYX_ERR(0, 666, __pyx_L70_error)
          }
        }
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __Pyx_XDECREF(__pyx_9genexpr20__pyx_v_indel); __pyx_9genexpr20__pyx_v_indel = 0;
        goto __pyx_L74_exit_scope;
        __pyx_L70_error:;
        __Pyx_XDECREF(__pyx_9genexpr20__pyx_v_indel); __pyx_9genexpr20__pyx_v_indel = 0;
        goto __pyx_L1_error;
        __pyx_L74_exit_scope:;
      } /* exit inner scope */
      __Pyx_XDECREF_SET(__pyx_v_target_type_indels, ((PyObject*)__pyx_t_9));
      __pyx_t_9 = 0;

      /* "aldy/indelpost/pileup.pyx":671
 * 
 *             # check for possible complex case
 *             if complex_positions:             # <<<<<<<<<<<<<<
 *                 complex_flags.append(1)
 *             else:
 */
      __pyx_t_7 = (PySet_GET_SIZE(__pyx_v_complex_positions) != 0);
      if (__pyx_t_7) {

        /* "aldy/indelpost/pileup.pyx":672
 *             # check for possible complex case
 *             if complex_positions:
 *                 complex_flags.append(1)             # <<<<<<<<<<<<<<
 *             else:
 *                 pass
 */
        __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_complex_flags, __pyx_int_1); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 672, __pyx_L1_error)

        /* "aldy/indelpost/pileup.pyx":671
 * 
 *             # check for possible complex case
 *             if complex_positions:             # <<<<<<<<<<<<<<
 *                 complex_flags.append(1)
 *             else:
 */
        goto __pyx_L75;
      }

      /* "aldy/indelpost/pileup.pyx":674
 *                 complex_flags.append(1)
 *             else:
 *                 pass             # <<<<<<<<<<<<<<
 * 
 *             for indel in target_type_indels:
 */
      /*else*/ {
      }
      __pyx_L75:;

      /* "aldy/indelpost/pileup.pyx":676
 *                 pass
 * 
 *             for indel in target_type_indels:             # <<<<<<<<<<<<<<
 *                 if indel["pos"] in complex_positions:
 *                     complex_del = [jndel for jndel in indels if jndel["pos"] == indel["pos"] and jndel["indel_type"] == "D"][0]
 */
      __pyx_t_9 = __pyx_v_target_type_indels; __Pyx_INCREF(__pyx_t_9); __pyx_t_17 = 0;
      for (;;) {
        if (__pyx_t_17 >= PyList_GET_SIZE(__pyx_t_9)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_15 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_17); __Pyx_INCREF(__pyx_t_15); __pyx_t_17++; if (unlikely(0 < 0)) __PYX_ERR(0, 676, __pyx_L1_error)
        #else
        __pyx_t_15 = PySequence_ITEM(__pyx_t_9, __pyx_t_17); __pyx_t_17++; if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 676, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
        #endif
        __Pyx_XDECREF_SET(__pyx_v_indel, __pyx_t_15);
        __pyx_t_15 = 0;

        /* "aldy/indelpost/pileup.pyx":677
 * 
 *             for indel in target_type_indels:
 *                 if indel["pos"] in complex_positions:             # <<<<<<<<<<<<<<
 *                     complex_del = [jndel for jndel in indels if jndel["pos"] == indel["pos"] and jndel["indel_type"] == "D"][0]
 *                     complex_ins = [jndel for jndel in indels if jndel["pos"] == indel["pos"] and jndel["indel_type"] == "I"][0]
 */
        __pyx_t_15 = __Pyx_PyObject_Dict_GetItem(__pyx_v_indel, __pyx_n_u_pos); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 677, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
        __pyx_t_7 = (__Pyx_PySet_ContainsTF(__pyx_t_15, __pyx_v_complex_positions, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 677, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __pyx_t_4 = (__pyx_t_7 != 0);
        if (__pyx_t_4) {

          /* "aldy/indelpost/pileup.pyx":678
 *             for indel in target_type_indels:
 *                 if indel["pos"] in complex_positions:
 *                     complex_del = [jndel for jndel in indels if jndel["pos"] == indel["pos"] and jndel["indel_type"] == "D"][0]             # <<<<<<<<<<<<<<
 *                     complex_ins = [jndel for jndel in indels if jndel["pos"] == indel["pos"] and jndel["indel_type"] == "I"][0]
 *                     ref = complex_del["lt_ref"][-1] + complex_del["del_seq"]
 */
          { /* enter inner scope */
            __pyx_t_15 = PyList_New(0); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 678, __pyx_L81_error)
            __Pyx_GOTREF(__pyx_t_15);
            if (likely(PyList_CheckExact(__pyx_v_indels)) || PyTuple_CheckExact(__pyx_v_indels)) {
              __pyx_t_1 = __pyx_v_indels; __Pyx_INCREF(__pyx_t_1); __pyx_t_19 = 0;
              __pyx_t_18 = NULL;
            } else {
              __pyx_t_19 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_indels); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 678, __pyx_L81_error)
              __Pyx_GOTREF(__pyx_t_1);
              __pyx_t_18 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 678, __pyx_L81_error)
            }
            for (;;) {
              if (likely(!__pyx_t_18)) {
                if (likely(PyList_CheckExact(__pyx_t_1))) {
                  if (__pyx_t_19 >= PyList_GET_SIZE(__pyx_t_1)) break;
                  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                  __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_19); __Pyx_INCREF(__pyx_t_2); __pyx_t_19++; if (unlikely(0 < 0)) __PYX_ERR(0, 678, __pyx_L81_error)
                  #else
                  __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_19); __pyx_t_19++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 678, __pyx_L81_error)
                  __Pyx_GOTREF(__pyx_t_2);
                  #endif
                } else {
                  if (__pyx_t_19 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
                  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                  __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_19); __Pyx_INCREF(__pyx_t_2); __pyx_t_19++; if (unlikely(0 < 0)) __PYX_ERR(0, 678, __pyx_L81_error)
                  #else
                  __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_19); __pyx_t_19++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 678, __pyx_L81_error)
                  __Pyx_GOTREF(__pyx_t_2);
                  #endif
                }
              } else {
                __pyx_t_2 = __pyx_t_18(__pyx_t_1);
                if (unlikely(!__pyx_t_2)) {
                  PyObject* exc_type = PyErr_Occurred();
                  if (exc_type) {
                    if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
                    else __PYX_ERR(0, 678, __pyx_L81_error)
                  }
                  break;
                }
                __Pyx_GOTREF(__pyx_t_2);
              }
              __Pyx_XDECREF_SET(__pyx_9genexpr21__pyx_v_jndel, __pyx_t_2);
              __pyx_t_2 = 0;
              __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_9genexpr21__pyx_v_jndel, __pyx_n_u_pos); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 678, __pyx_L81_error)
              __Pyx_GOTREF(__pyx_t_2);
              __pyx_t_10 = __Pyx_PyObject_Dict_GetItem(__pyx_v_indel, __pyx_n_u_pos); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 678, __pyx_L81_error)
              __Pyx_GOTREF(__pyx_t_10);
              __pyx_t_12 = PyObject_RichCompare(__pyx_t_2, __pyx_t_10, Py_EQ); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 678, __pyx_L81_error)
              __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
              __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 678, __pyx_L81_error)
              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
              if (__pyx_t_7) {
              } else {
                __pyx_t_4 = __pyx_t_7;
                goto __pyx_L85_bool_binop_done;
              }
              __pyx_t_12 = __Pyx_PyObject_Dict_GetItem(__pyx_9genexpr21__pyx_v_jndel, __pyx_n_u_indel_type); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 678, __pyx_L81_error)
              __Pyx_GOTREF(__pyx_t_12);
              __pyx_t_7 = (__Pyx_PyUnicode_Equals(__pyx_t_12, __pyx_n_u_D, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 678, __pyx_L81_error)
              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
              __pyx_t_4 = __pyx_t_7;
              __pyx_L85_bool_binop_done:;
              if (__pyx_t_4) {
                if (unlikely(__Pyx_ListComp_Append(__pyx_t_15, (PyObject*)__pyx_9genexpr21__pyx_v_jndel))) __PYX_ERR(0, 678, __pyx_L81_error)
              }
            }
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_XDECREF(__pyx_9genexpr21__pyx_v_jndel); __pyx_9genexpr21__pyx_v_jndel = 0;
            goto __pyx_L87_exit_scope;
            __pyx_L81_error:;
            __Pyx_XDECREF(__pyx_9genexpr21__pyx_v_jndel); __pyx_9genexpr21__pyx_v_jndel = 0;
            goto __pyx_L1_error;
            __pyx_L87_exit_scope:;
          } /* exit inner scope */
          __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_t_15, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 678, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          __Pyx_XDECREF_SET(__pyx_v_complex_del, __pyx_t_1);
          __pyx_t_1 = 0;

          /* "aldy/indelpost/pileup.pyx":679
 *                 if indel["pos"] in complex_positions:
 *                     complex_del = [jndel for jndel in indels if jndel["pos"] == indel["pos"] and jndel["indel_type"] == "D"][0]
 *                     complex_ins = [jndel for jndel in indels if jndel["pos"] == indel["pos"] and jndel["indel_type"] == "I"][0]             # <<<<<<<<<<<<<<
 *                     ref = complex_del["lt_ref"][-1] + complex_del["del_seq"]
 *                     alt = complex_ins["lt_ref"][-1] + complex_ins["indel_seq"]
 */
          { /* enter inner scope */
            __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 679, __pyx_L90_error)
            __Pyx_GOTREF(__pyx_t_1);
            if (likely(PyList_CheckExact(__pyx_v_indels)) || PyTuple_CheckExact(__pyx_v_indels)) {
              __pyx_t_15 = __pyx_v_indels; __Pyx_INCREF(__pyx_t_15); __pyx_t_19 = 0;
              __pyx_t_18 = NULL;
            } else {
              __pyx_t_19 = -1; __pyx_t_15 = PyObject_GetIter(__pyx_v_indels); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 679, __pyx_L90_error)
              __Pyx_GOTREF(__pyx_t_15);
              __pyx_t_18 = Py_TYPE(__pyx_t_15)->tp_iternext; if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 679, __pyx_L90_error)
            }
            for (;;) {
              if (likely(!__pyx_t_18)) {
                if (likely(PyList_CheckExact(__pyx_t_15))) {
                  if (__pyx_t_19 >= PyList_GET_SIZE(__pyx_t_15)) break;
                  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                  __pyx_t_12 = PyList_GET_ITEM(__pyx_t_15, __pyx_t_19); __Pyx_INCREF(__pyx_t_12); __pyx_t_19++; if (unlikely(0 < 0)) __PYX_ERR(0, 679, __pyx_L90_error)
                  #else
                  __pyx_t_12 = PySequence_ITEM(__pyx_t_15, __pyx_t_19); __pyx_t_19++; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 679, __pyx_L90_error)
                  __Pyx_GOTREF(__pyx_t_12);
                  #endif
                } else {
                  if (__pyx_t_19 >= PyTuple_GET_SIZE(__pyx_t_15)) break;
                  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                  __pyx_t_12 = PyTuple_GET_ITEM(__pyx_t_15, __pyx_t_19); __Pyx_INCREF(__pyx_t_12); __pyx_t_19++; if (unlikely(0 < 0)) __PYX_ERR(0, 679, __pyx_L90_error)
                  #else
                  __pyx_t_12 = PySequence_ITEM(__pyx_t_15, __pyx_t_19); __pyx_t_19++; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 679, __pyx_L90_error)
                  __Pyx_GOTREF(__pyx_t_12);
                  #endif
                }
              } else {
                __pyx_t_12 = __pyx_t_18(__pyx_t_15);
                if (unlikely(!__pyx_t_12)) {
                  PyObject* exc_type = PyErr_Occurred();
                  if (exc_type) {
                    if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
                    else __PYX_ERR(0, 679, __pyx_L90_error)
                  }
                  break;
                }
                __Pyx_GOTREF(__pyx_t_12);
              }
              __Pyx_XDECREF_SET(__pyx_9genexpr22__pyx_v_jndel, __pyx_t_12);
              __pyx_t_12 = 0;
              __pyx_t_12 = __Pyx_PyObject_Dict_GetItem(__pyx_9genexpr22__pyx_v_jndel, __pyx_n_u_pos); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 679, __pyx_L90_error)
              __Pyx_GOTREF(__pyx_t_12);
              __pyx_t_10 = __Pyx_PyObject_Dict_GetItem(__pyx_v_indel, __pyx_n_u_pos); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 679, __pyx_L90_error)
              __Pyx_GOTREF(__pyx_t_10);
              __pyx_t_2 = PyObject_RichCompare(__pyx_t_12, __pyx_t_10, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 679, __pyx_L90_error)
              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
              __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 679, __pyx_L90_error)
              __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
              if (__pyx_t_7) {
              } else {
                __pyx_t_4 = __pyx_t_7;
                goto __pyx_L94_bool_binop_done;
              }
              __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_9genexpr22__pyx_v_jndel, __pyx_n_u_indel_type); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 679, __pyx_L90_error)
              __Pyx_GOTREF(__pyx_t_2);
              __pyx_t_7 = (__Pyx_PyUnicode_Equals(__pyx_t_2, __pyx_n_u_I, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 679, __pyx_L90_error)
              __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
              __pyx_t_4 = __pyx_t_7;
              __pyx_L94_bool_binop_done:;
              if (__pyx_t_4) {
                if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_9genexpr22__pyx_v_jndel))) __PYX_ERR(0, 679, __pyx_L90_error)
              }
            }
            __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
            __Pyx_XDECREF(__pyx_9genexpr22__pyx_v_jndel); __pyx_9genexpr22__pyx_v_jndel = 0;
            goto __pyx_L96_exit_scope;
            __pyx_L90_error:;
            __Pyx_XDECREF(__pyx_9genexpr22__pyx_v_jndel); __pyx_9genexpr22__pyx_v_jndel = 0;
            goto __pyx_L1_error;
            __pyx_L96_exit_scope:;
          } /* exit inner scope */
          __pyx_t_15 = __Pyx_GetItemInt_List(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 679, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_15);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_XDECREF_SET(__pyx_v_complex_ins, __pyx_t_15);
          __pyx_t_15 = 0;

          /* "aldy/indelpost/pileup.pyx":680
 *                     complex_del = [jndel for jndel in indels if jndel["pos"] == indel["pos"] and jndel["indel_type"] == "D"][0]
 *                     complex_ins = [jndel for jndel in indels if jndel["pos"] == indel["pos"] and jndel["indel_type"] == "I"][0]
 *                     ref = complex_del["lt_ref"][-1] + complex_del["del_seq"]             # <<<<<<<<<<<<<<
 *                     alt = complex_ins["lt_ref"][-1] + complex_ins["indel_seq"]
 *                 else:
 */
          __pyx_t_15 = __Pyx_PyObject_Dict_GetItem(__pyx_v_complex_del, __pyx_n_u_lt_ref); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 680, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_15);
          __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_15, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 680, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          __pyx_t_15 = __Pyx_PyObject_Dict_GetItem(__pyx_v_complex_del, __pyx_n_u_del_seq); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 680, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_15);
          __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_t_15); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 680, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          __Pyx_XDECREF_SET(__pyx_v_ref, __pyx_t_2);
          __pyx_t_2 = 0;

          /* "aldy/indelpost/pileup.pyx":681
 *                     complex_ins = [jndel for jndel in indels if jndel["pos"] == indel["pos"] and jndel["indel_type"] == "I"][0]
 *                     ref = complex_del["lt_ref"][-1] + complex_del["del_seq"]
 *                     alt = complex_ins["lt_ref"][-1] + complex_ins["indel_seq"]             # <<<<<<<<<<<<<<
 *                 else:
 *                     if target_type == "I":
 */
          __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_complex_ins, __pyx_n_u_lt_ref); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 681, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_15 = __Pyx_GetItemInt(__pyx_t_2, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 681, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_15);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_complex_ins, __pyx_n_u_indel_seq); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 681, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_1 = PyNumber_Add(__pyx_t_15, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 681, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_XDECREF_SET(__pyx_v_alt, __pyx_t_1);
          __pyx_t_1 = 0;

          /* "aldy/indelpost/pileup.pyx":677
 * 
 *             for indel in target_type_indels:
 *                 if indel["pos"] in complex_positions:             # <<<<<<<<<<<<<<
 *                     complex_del = [jndel for jndel in indels if jndel["pos"] == indel["pos"] and jndel["indel_type"] == "D"][0]
 *                     complex_ins = [jndel for jndel in indels if jndel["pos"] == indel["pos"] and jndel["indel_type"] == "I"][0]
 */
          goto __pyx_L78;
        }

        /* "aldy/indelpost/pileup.pyx":683
 *                     alt = complex_ins["lt_ref"][-1] + complex_ins["indel_seq"]
 *                 else:
 *                     if target_type == "I":             # <<<<<<<<<<<<<<
 *                         ref = indel["lt_ref"][-1]
 *                         alt = ref + indel["indel_seq"]
 */
        /*else*/ {
          __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_v_target_type, __pyx_n_u_I, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 683, __pyx_L1_error)
          if (__pyx_t_4) {

            /* "aldy/indelpost/pileup.pyx":684
 *                 else:
 *                     if target_type == "I":
 *                         ref = indel["lt_ref"][-1]             # <<<<<<<<<<<<<<
 *                         alt = ref + indel["indel_seq"]
 *                     else:
 */
            __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_indel, __pyx_n_u_lt_ref); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 684, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_1);
            __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 684, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_XDECREF_SET(__pyx_v_ref, __pyx_t_2);
            __pyx_t_2 = 0;

            /* "aldy/indelpost/pileup.pyx":685
 *                     if target_type == "I":
 *                         ref = indel["lt_ref"][-1]
 *                         alt = ref + indel["indel_seq"]             # <<<<<<<<<<<<<<
 *                     else:
 *                         alt = indel["lt_ref"][-1]
 */
            __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_indel, __pyx_n_u_indel_seq); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 685, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
            __pyx_t_1 = PyNumber_Add(__pyx_v_ref, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 685, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
            __Pyx_XDECREF_SET(__pyx_v_alt, __pyx_t_1);
            __pyx_t_1 = 0;

            /* "aldy/indelpost/pileup.pyx":683
 *                     alt = complex_ins["lt_ref"][-1] + complex_ins["indel_seq"]
 *                 else:
 *                     if target_type == "I":             # <<<<<<<<<<<<<<
 *                         ref = indel["lt_ref"][-1]
 *                         alt = ref + indel["indel_seq"]
 */
            goto __pyx_L97;
          }

          /* "aldy/indelpost/pileup.pyx":687
 *                         alt = ref + indel["indel_seq"]
 *                     else:
 *                         alt = indel["lt_ref"][-1]             # <<<<<<<<<<<<<<
 *                         ref = alt + indel["del_seq"]
 * 
 */
          /*else*/ {
            __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_indel, __pyx_n_u_lt_ref); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 687, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_1);
            __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 687, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_XDECREF_SET(__pyx_v_alt, __pyx_t_2);
            __pyx_t_2 = 0;

            /* "aldy/indelpost/pileup.pyx":688
 *                     else:
 *                         alt = indel["lt_ref"][-1]
 *                         ref = alt + indel["del_seq"]             # <<<<<<<<<<<<<<
 * 
 *                 var = Variant(target.chrom, indel["pos"], ref, alt, target.reference, skip_validation=True)
 */
            __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_indel, __pyx_n_u_del_seq); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 688, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
            __pyx_t_1 = PyNumber_Add(__pyx_v_alt, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 688, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
            __Pyx_XDECREF_SET(__pyx_v_ref, __pyx_t_1);
            __pyx_t_1 = 0;
          }
          __pyx_L97:;
        }
        __pyx_L78:;

        /* "aldy/indelpost/pileup.pyx":690
 *                         ref = alt + indel["del_seq"]
 * 
 *                 var = Variant(target.chrom, indel["pos"], ref, alt, target.reference, skip_validation=True)             # <<<<<<<<<<<<<<
 * 
 *                 # non-target indel found in read end -> do not consider
 */
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_target, __pyx_n_s_chrom); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 690, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_indel, __pyx_n_u_pos); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 690, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_target, __pyx_n_s_reference); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 690, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
        __pyx_t_10 = PyTuple_New(5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 690, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_GIVEREF(__pyx_t_1);
        PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_2);
        PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_2);
        __Pyx_INCREF(__pyx_v_ref);
        __Pyx_GIVEREF(__pyx_v_ref);
        PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_v_ref);
        __Pyx_INCREF(__pyx_v_alt);
        __Pyx_GIVEREF(__pyx_v_alt);
        PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_v_alt);
        __Pyx_GIVEREF(__pyx_t_15);
        PyTuple_SET_ITEM(__pyx_t_10, 4, __pyx_t_15);
        __pyx_t_1 = 0;
        __pyx_t_2 = 0;
        __pyx_t_15 = 0;
        __pyx_t_15 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 690, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
        if (PyDict_SetItem(__pyx_t_15, __pyx_n_s_skip_validation, Py_True) < 0) __PYX_ERR(0, 690, __pyx_L1_error)
        __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4aldy_9indelpost_7variant_Variant), __pyx_t_10, __pyx_t_15); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 690, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __Pyx_XDECREF_SET(__pyx_v_var, ((struct __pyx_obj_4aldy_9indelpost_7variant_Variant *)__pyx_t_2));
        __pyx_t_2 = 0;

        /* "aldy/indelpost/pileup.pyx":693
 * 
 *                 # non-target indel found in read end -> do not consider
 *                 read_end_thresh = max(len(read["read_seq"]) / 30, 3)             # <<<<<<<<<<<<<<
 *                 if var.pos - read["read_start"] <= read_end_thresh or read["read_end"] - var.pos <= read_end_thresh:
 *                     if var == target or (complex_positions and var.pos not in complex_positions):
 */
        __pyx_t_20 = 3;
        __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_read, __pyx_n_u_read_seq); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 693, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_19 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_19 == ((Py_ssize_t)-1))) __PYX_ERR(0, 693, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_21 = (((double)__pyx_t_19) / 30.0);
        if (((__pyx_t_20 > __pyx_t_21) != 0)) {
          __pyx_t_22 = __pyx_t_20;
        } else {
          __pyx_t_22 = __pyx_t_21;
        }
        __pyx_v_read_end_thresh = __pyx_t_22;

        /* "aldy/indelpost/pileup.pyx":694
 *                 # non-target indel found in read end -> do not consider
 *                 read_end_thresh = max(len(read["read_seq"]) / 30, 3)
 *                 if var.pos - read["read_start"] <= read_end_thresh or read["read_end"] - var.pos <= read_end_thresh:             # <<<<<<<<<<<<<<
 *                     if var == target or (complex_positions and var.pos not in complex_positions):
 *                         candidates.append(var)
 */
        __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_var->pos); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 694, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_15 = __Pyx_PyObject_Dict_GetItem(__pyx_v_read, __pyx_n_u_read_start); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 694, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
        __pyx_t_10 = PyNumber_Subtract(__pyx_t_2, __pyx_t_15); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 694, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __pyx_t_15 = PyFloat_FromDouble(__pyx_v_read_end_thresh); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 694, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
        __pyx_t_2 = PyObject_RichCompare(__pyx_t_10, __pyx_t_15, Py_LE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 694, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 694, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (!__pyx_t_7) {
        } else {
          __pyx_t_4 = __pyx_t_7;
          goto __pyx_L99_bool_binop_done;
        }
        __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_read, __pyx_n_u_read_end); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 694, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_v_var->pos); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 694, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
        __pyx_t_10 = PyNumber_Subtract(__pyx_t_2, __pyx_t_15); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 694, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __pyx_t_15 = PyFloat_FromDouble(__pyx_v_read_end_thresh); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 694, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
        __pyx_t_2 = PyObject_RichCompare(__pyx_t_10, __pyx_t_15, Py_LE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 694, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 694, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_4 = __pyx_t_7;
        __pyx_L99_bool_binop_done:;
        if (__pyx_t_4) {

          /* "aldy/indelpost/pileup.pyx":695
 *                 read_end_thresh = max(len(read["read_seq"]) / 30, 3)
 *                 if var.pos - read["read_start"] <= read_end_thresh or read["read_end"] - var.pos <= read_end_thresh:
 *                     if var == target or (complex_positions and var.pos not in complex_positions):             # <<<<<<<<<<<<<<
 *                         candidates.append(var)
 *                         candidate_reads.append(read)
 */
          __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_var), __pyx_cur_scope->__pyx_v_target, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 695, __pyx_L1_error)
          __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 695, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (!__pyx_t_7) {
          } else {
            __pyx_t_4 = __pyx_t_7;
            goto __pyx_L102_bool_binop_done;
          }
          __pyx_t_7 = (PySet_GET_SIZE(__pyx_v_complex_positions) != 0);
          if (__pyx_t_7) {
          } else {
            __pyx_t_4 = __pyx_t_7;
            goto __pyx_L102_bool_binop_done;
          }
          __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_var->pos); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 695, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_7 = (__Pyx_PySet_ContainsTF(__pyx_t_2, __pyx_v_complex_positions, Py_NE)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 695, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_8 = (__pyx_t_7 != 0);
          __pyx_t_4 = __pyx_t_8;
          __pyx_L102_bool_binop_done:;
          if (__pyx_t_4) {

            /* "aldy/indelpost/pileup.pyx":696
 *                 if var.pos - read["read_start"] <= read_end_thresh or read["read_end"] - var.pos <= read_end_thresh:
 *                     if var == target or (complex_positions and var.pos not in complex_positions):
 *                         candidates.append(var)             # <<<<<<<<<<<<<<
 *                         candidate_reads.append(read)
 *                         candidate_ref_seqs.append(ref_seq)
 */
            __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_candidates, ((PyObject *)__pyx_v_var)); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 696, __pyx_L1_error)

            /* "aldy/indelpost/pileup.pyx":697
 *                     if var == target or (complex_positions and var.pos not in complex_positions):
 *                         candidates.append(var)
 *                         candidate_reads.append(read)             # <<<<<<<<<<<<<<
 *                         candidate_ref_seqs.append(ref_seq)
 *                         candidate_ref_starts.append(ref_start)
 */
            __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_candidate_reads, __pyx_v_read); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 697, __pyx_L1_error)

            /* "aldy/indelpost/pileup.pyx":698
 *                         candidates.append(var)
 *                         candidate_reads.append(read)
 *                         candidate_ref_seqs.append(ref_seq)             # <<<<<<<<<<<<<<
 *                         candidate_ref_starts.append(ref_start)
 *                         candidate_aligners.append(aligner)
 */
            __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_candidate_ref_seqs, __pyx_v_ref_seq); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 698, __pyx_L1_error)

            /* "aldy/indelpost/pileup.pyx":699
 *                         candidate_reads.append(read)
 *                         candidate_ref_seqs.append(ref_seq)
 *                         candidate_ref_starts.append(ref_start)             # <<<<<<<<<<<<<<
 *                         candidate_aligners.append(aligner)
 *                 else:
 */
            __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_candidate_ref_starts, __pyx_v_ref_start); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 699, __pyx_L1_error)

            /* "aldy/indelpost/pileup.pyx":700
 *                         candidate_ref_seqs.append(ref_seq)
 *                         candidate_ref_starts.append(ref_start)
 *                         candidate_aligners.append(aligner)             # <<<<<<<<<<<<<<
 *                 else:
 *                     candidates.append(var)
 */
            __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_candidate_aligners, __pyx_v_aligner); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 700, __pyx_L1_error)

            /* "aldy/indelpost/pileup.pyx":695
 *                 read_end_thresh = max(len(read["read_seq"]) / 30, 3)
 *                 if var.pos - read["read_start"] <= read_end_thresh or read["read_end"] - var.pos <= read_end_thresh:
 *                     if var == target or (complex_positions and var.pos not in complex_positions):             # <<<<<<<<<<<<<<
 *                         candidates.append(var)
 *                         candidate_reads.append(read)
 */
          }

          /* "aldy/indelpost/pileup.pyx":694
 *                 # non-target indel found in read end -> do not consider
 *                 read_end_thresh = max(len(read["read_seq"]) / 30, 3)
 *                 if var.pos - read["read_start"] <= read_end_thresh or read["read_end"] - var.pos <= read_end_thresh:             # <<<<<<<<<<<<<<
 *                     if var == target or (complex_positions and var.pos not in complex_positions):
 *                         candidates.append(var)
 */
          goto __pyx_L98;
        }

        /* "aldy/indelpost/pileup.pyx":702
 *                         candidate_aligners.append(aligner)
 *                 else:
 *                     candidates.append(var)             # <<<<<<<<<<<<<<
 *                     candidate_reads.append(read)
 *                     candidate_ref_seqs.append(ref_seq)
 */
        /*else*/ {
          __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_candidates, ((PyObject *)__pyx_v_var)); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 702, __pyx_L1_error)

          /* "aldy/indelpost/pileup.pyx":703
 *                 else:
 *                     candidates.append(var)
 *                     candidate_reads.append(read)             # <<<<<<<<<<<<<<
 *                     candidate_ref_seqs.append(ref_seq)
 *                     candidate_ref_starts.append(ref_start)
 */
          __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_candidate_reads, __pyx_v_read); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 703, __pyx_L1_error)

          /* "aldy/indelpost/pileup.pyx":704
 *                     candidates.append(var)
 *                     candidate_reads.append(read)
 *                     candidate_ref_seqs.append(ref_seq)             # <<<<<<<<<<<<<<
 *                     candidate_ref_starts.append(ref_start)
 *                     candidate_aligners.append(aligner)
 */
          __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_candidate_ref_seqs, __pyx_v_ref_seq); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 704, __pyx_L1_error)

          /* "aldy/indelpost/pileup.pyx":705
 *                     candidate_reads.append(read)
 *                     candidate_ref_seqs.append(ref_seq)
 *                     candidate_ref_starts.append(ref_start)             # <<<<<<<<<<<<<<
 *                     candidate_aligners.append(aligner)
 * 
 */
          __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_candidate_ref_starts, __pyx_v_ref_start); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 705, __pyx_L1_error)

          /* "aldy/indelpost/pileup.pyx":706
 *                     candidate_ref_seqs.append(ref_seq)
 *                     candidate_ref_starts.append(ref_start)
 *                     candidate_aligners.append(aligner)             # <<<<<<<<<<<<<<
 * 
 *     if not candidates:
 */
          __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_candidate_aligners, __pyx_v_aligner); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 706, __pyx_L1_error)
        }
        __pyx_L98:;

        /* "aldy/indelpost/pileup.pyx":676
 *                 pass
 * 
 *             for indel in target_type_indels:             # <<<<<<<<<<<<<<
 *                 if indel["pos"] in complex_positions:
 *                     complex_del = [jndel for jndel in indels if jndel["pos"] == indel["pos"] and jndel["indel_type"] == "D"][0]
 */
      }
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "aldy/indelpost/pileup.pyx":661
 *         gap_cnt = aln.CIGAR.count("I") + aln.CIGAR.count("D")
 * 
 *         if 0 < gap_cnt < 6 and aligned_frac > 0.7:             # <<<<<<<<<<<<<<
 *             indels = findall_indels(aln, genome_aln_pos, ref_seq, read["read_seq"])
 *             positions = [d["pos"] for d in indels]
 */
    }

    /* "aldy/indelpost/pileup.pyx":652
 *     complex_flags = []
 *     candidates, candidate_reads, candidate_ref_seqs, candidate_ref_starts, candidate_aligners = [], [], [], [], []
 *     for read, aln, ref_seq, ref_start, aligner in zip(non_refs, ref_alns, ref_seqs, ref_starts, aligners):             # <<<<<<<<<<<<<<
 *         genome_aln_pos = ref_start + aln.reference_start
 * 
 */
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "aldy/indelpost/pileup.pyx":708
 *                     candidate_aligners.append(aligner)
 * 
 *     if not candidates:             # <<<<<<<<<<<<<<
 *         # long reference may align ins as del
 *         if target.is_ins and window > 3:
 */
  __pyx_t_4 = (PyList_GET_SIZE(__pyx_v_candidates) != 0);
  __pyx_t_8 = ((!__pyx_t_4) != 0);
  if (__pyx_t_8) {

    /* "aldy/indelpost/pileup.pyx":710
 *     if not candidates:
 *         # long reference may align ins as del
 *         if target.is_ins and window > 3:             # <<<<<<<<<<<<<<
 *             window = int(window/3)
 *             return retarget(
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_target, __pyx_n_s_is_ins); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 710, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 710, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_4) {
    } else {
      __pyx_t_8 = __pyx_t_4;
      goto __pyx_L107_bool_binop_done;
    }
    __pyx_t_3 = PyObject_RichCompare(__pyx_v_window, __pyx_int_3, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 710, __pyx_L1_error)
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 710, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_8 = __pyx_t_4;
    __pyx_L107_bool_binop_done:;
    if (__pyx_t_8) {

      /* "aldy/indelpost/pileup.pyx":711
 *         # long reference may align ins as del
 *         if target.is_ins and window > 3:
 *             window = int(window/3)             # <<<<<<<<<<<<<<
 *             return retarget(
 *                         target,
 */
      __pyx_t_3 = __Pyx_PyInt_TrueDivideObjC(__pyx_v_window, __pyx_int_3, 3, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 711, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_9 = __Pyx_PyNumber_Int(__pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 711, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF_SET(__pyx_v_window, __pyx_t_9);
      __pyx_t_9 = 0;

      /* "aldy/indelpost/pileup.pyx":712
 *         if target.is_ins and window > 3:
 *             window = int(window/3)
 *             return retarget(             # <<<<<<<<<<<<<<
 *                         target,
 *                         pileup,
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_retarget); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 712, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);

      /* "aldy/indelpost/pileup.pyx":724
 *                         gap_extension_penalty,
 *                         unspl_loc_ref,
 *                         require_exact_for_shiftable,             # <<<<<<<<<<<<<<
 *                    )
 *         else:
 */
      __pyx_t_2 = NULL;
      __pyx_t_11 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
          __pyx_t_11 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[13] = {__pyx_t_2, __pyx_cur_scope->__pyx_v_target, __pyx_v_pileup, __pyx_v_window, __pyx_v_mapq4retarget, __pyx_v_within, __pyx_v_retargetcutoff, __pyx_v_match_score, __pyx_v_mismatch_penalty, __pyx_v_gap_open_penalty, __pyx_v_gap_extension_penalty, __pyx_v_unspl_loc_ref, __pyx_v_require_exact_for_shiftable};
        __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_11, 12+__pyx_t_11); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 712, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GOTREF(__pyx_t_9);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[13] = {__pyx_t_2, __pyx_cur_scope->__pyx_v_target, __pyx_v_pileup, __pyx_v_window, __pyx_v_mapq4retarget, __pyx_v_within, __pyx_v_retargetcutoff, __pyx_v_match_score, __pyx_v_mismatch_penalty, __pyx_v_gap_open_penalty, __pyx_v_gap_extension_penalty, __pyx_v_unspl_loc_ref, __pyx_v_require_exact_for_shiftable};
        __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_11, 12+__pyx_t_11); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 712, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GOTREF(__pyx_t_9);
      } else
      #endif
      {
        __pyx_t_15 = PyTuple_New(12+__pyx_t_11); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 712, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
        if (__pyx_t_2) {
          __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_2); __pyx_t_2 = NULL;
        }
        __Pyx_INCREF(__pyx_cur_scope->__pyx_v_target);
        __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_target);
        PyTuple_SET_ITEM(__pyx_t_15, 0+__pyx_t_11, __pyx_cur_scope->__pyx_v_target);
        __Pyx_INCREF(__pyx_v_pileup);
        __Pyx_GIVEREF(__pyx_v_pileup);
        PyTuple_SET_ITEM(__pyx_t_15, 1+__pyx_t_11, __pyx_v_pileup);
        __Pyx_INCREF(__pyx_v_window);
        __Pyx_GIVEREF(__pyx_v_window);
        PyTuple_SET_ITEM(__pyx_t_15, 2+__pyx_t_11, __pyx_v_window);
        __Pyx_INCREF(__pyx_v_mapq4retarget);
        __Pyx_GIVEREF(__pyx_v_mapq4retarget);
        PyTuple_SET_ITEM(__pyx_t_15, 3+__pyx_t_11, __pyx_v_mapq4retarget);
        __Pyx_INCREF(__pyx_v_within);
        __Pyx_GIVEREF(__pyx_v_within);
        PyTuple_SET_ITEM(__pyx_t_15, 4+__pyx_t_11, __pyx_v_within);
        __Pyx_INCREF(__pyx_v_retargetcutoff);
        __Pyx_GIVEREF(__pyx_v_retargetcutoff);
        PyTuple_SET_ITEM(__pyx_t_15, 5+__pyx_t_11, __pyx_v_retargetcutoff);
        __Pyx_INCREF(__pyx_v_match_score);
        __Pyx_GIVEREF(__pyx_v_match_score);
        PyTuple_SET_ITEM(__pyx_t_15, 6+__pyx_t_11, __pyx_v_match_score);
        __Pyx_INCREF(__pyx_v_mismatch_penalty);
        __Pyx_GIVEREF(__pyx_v_mismatch_penalty);
        PyTuple_SET_ITEM(__pyx_t_15, 7+__pyx_t_11, __pyx_v_mismatch_penalty);
        __Pyx_INCREF(__pyx_v_gap_open_penalty);
        __Pyx_GIVEREF(__pyx_v_gap_open_penalty);
        PyTuple_SET_ITEM(__pyx_t_15, 8+__pyx_t_11, __pyx_v_gap_open_penalty);
        __Pyx_INCREF(__pyx_v_gap_extension_penalty);
        __Pyx_GIVEREF(__pyx_v_gap_extension_penalty);
        PyTuple_SET_ITEM(__pyx_t_15, 9+__pyx_t_11, __pyx_v_gap_extension_penalty);
        __Pyx_INCREF(__pyx_v_unspl_loc_ref);
        __Pyx_GIVEREF(__pyx_v_unspl_loc_ref);
        PyTuple_SET_ITEM(__pyx_t_15, 10+__pyx_t_11, __pyx_v_unspl_loc_ref);
        __Pyx_INCREF(__pyx_v_require_exact_for_shiftable);
        __Pyx_GIVEREF(__pyx_v_require_exact_for_shiftable);
        PyTuple_SET_ITEM(__pyx_t_15, 11+__pyx_t_11, __pyx_v_require_exact_for_shiftable);
        __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_15, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 712, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_9;
      __pyx_t_9 = 0;
      goto __pyx_L0;

      /* "aldy/indelpost/pileup.pyx":710
 *     if not candidates:
 *         # long reference may align ins as del
 *         if target.is_ins and window > 3:             # <<<<<<<<<<<<<<
 *             window = int(window/3)
 *             return retarget(
 */
    }

    /* "aldy/indelpost/pileup.pyx":727
 *                    )
 *         else:
 *             return None             # <<<<<<<<<<<<<<
 *     elif len(target.indel_seq) <= 3:
 *         if not sum(complex_flags) and target not in candidates:
 */
    /*else*/ {
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
    }

    /* "aldy/indelpost/pileup.pyx":708
 *                     candidate_aligners.append(aligner)
 * 
 *     if not candidates:             # <<<<<<<<<<<<<<
 *         # long reference may align ins as del
 *         if target.is_ins and window > 3:
 */
  }

  /* "aldy/indelpost/pileup.pyx":728
 *         else:
 *             return None
 *     elif len(target.indel_seq) <= 3:             # <<<<<<<<<<<<<<
 *         if not sum(complex_flags) and target not in candidates:
 *             return None
 */
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_target, __pyx_n_s_indel_seq); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 728, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_5 = PyObject_Length(__pyx_t_9); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 728, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_8 = ((__pyx_t_5 <= 3) != 0);
  if (__pyx_t_8) {

    /* "aldy/indelpost/pileup.pyx":729
 *             return None
 *     elif len(target.indel_seq) <= 3:
 *         if not sum(complex_flags) and target not in candidates:             # <<<<<<<<<<<<<<
 *             return None
 * 
 */
    __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_builtin_sum, __pyx_v_complex_flags); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 729, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 729, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_7 = ((!__pyx_t_4) != 0);
    if (__pyx_t_7) {
    } else {
      __pyx_t_8 = __pyx_t_7;
      goto __pyx_L110_bool_binop_done;
    }
    __pyx_t_7 = (__Pyx_PySequence_ContainsTF(__pyx_cur_scope->__pyx_v_target, __pyx_v_candidates, Py_NE)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 729, __pyx_L1_error)
    __pyx_t_4 = (__pyx_t_7 != 0);
    __pyx_t_8 = __pyx_t_4;
    __pyx_L110_bool_binop_done:;
    if (__pyx_t_8) {

      /* "aldy/indelpost/pileup.pyx":730
 *     elif len(target.indel_seq) <= 3:
 *         if not sum(complex_flags) and target not in candidates:
 *             return None             # <<<<<<<<<<<<<<
 * 
 *     u_candidates = to_flat_list([var._generate_equivalents_private() for var in set(candidates)])
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;

      /* "aldy/indelpost/pileup.pyx":729
 *             return None
 *     elif len(target.indel_seq) <= 3:
 *         if not sum(complex_flags) and target not in candidates:             # <<<<<<<<<<<<<<
 *             return None
 * 
 */
    }

    /* "aldy/indelpost/pileup.pyx":728
 *         else:
 *             return None
 *     elif len(target.indel_seq) <= 3:             # <<<<<<<<<<<<<<
 *         if not sum(complex_flags) and target not in candidates:
 *             return None
 */
  }

  /* "aldy/indelpost/pileup.pyx":732
 *             return None
 * 
 *     u_candidates = to_flat_list([var._generate_equivalents_private() for var in set(candidates)])             # <<<<<<<<<<<<<<
 *     u_candidates.sort(key=lambda x: abs(x.pos - target.pos))
 *     candidate_seqs = [var._get_indel_seq(how=target_type) for var in u_candidates]
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_to_flat_list); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 732, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  { /* enter inner scope */
    __pyx_t_15 = PyList_New(0); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 732, __pyx_L114_error)
    __Pyx_GOTREF(__pyx_t_15);
    __pyx_t_5 = 0;
    __pyx_t_10 = PySet_New(__pyx_v_candidates); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 732, __pyx_L114_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_1 = __Pyx_set_iterator(__pyx_t_10, 1, (&__pyx_t_17), (&__pyx_t_11)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 732, __pyx_L114_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_2);
    __pyx_t_2 = __pyx_t_1;
    __pyx_t_1 = 0;
    while (1) {
      __pyx_t_23 = __Pyx_set_iter_next(__pyx_t_2, __pyx_t_17, &__pyx_t_5, &__pyx_t_1, __pyx_t_11);
      if (unlikely(__pyx_t_23 == 0)) break;
      if (unlikely(__pyx_t_23 == -1)) __PYX_ERR(0, 732, __pyx_L114_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_XDECREF_SET(__pyx_9genexpr23__pyx_v_var, __pyx_t_1);
      __pyx_t_1 = 0;
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_9genexpr23__pyx_v_var, __pyx_n_s_generate_equivalents_private); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 732, __pyx_L114_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_12 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
        __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_10);
        if (likely(__pyx_t_12)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
          __Pyx_INCREF(__pyx_t_12);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_10, function);
        }
      }
      __pyx_t_1 = (__pyx_t_12) ? __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_12) : __Pyx_PyObject_CallNoArg(__pyx_t_10);
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 732, __pyx_L114_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_15, (PyObject*)__pyx_t_1))) __PYX_ERR(0, 732, __pyx_L114_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_9genexpr23__pyx_v_var); __pyx_9genexpr23__pyx_v_var = 0;
    goto __pyx_L117_exit_scope;
    __pyx_L114_error:;
    __Pyx_XDECREF(__pyx_9genexpr23__pyx_v_var); __pyx_9genexpr23__pyx_v_var = 0;
    goto __pyx_L1_error;
    __pyx_L117_exit_scope:;
  } /* exit inner scope */
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_9 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_t_15) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_15);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 732, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_u_candidates = __pyx_t_9;
  __pyx_t_9 = 0;

  /* "aldy/indelpost/pileup.pyx":733
 * 
 *     u_candidates = to_flat_list([var._generate_equivalents_private() for var in set(candidates)])
 *     u_candidates.sort(key=lambda x: abs(x.pos - target.pos))             # <<<<<<<<<<<<<<
 *     candidate_seqs = [var._get_indel_seq(how=target_type) for var in u_candidates]
 * 
 */
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_u_candidates, __pyx_n_s_sort); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 733, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 733, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_15 = __Pyx_CyFunction_New(&__pyx_mdef_4aldy_9indelpost_6pileup_8retarget_lambda3, 0, __pyx_n_s_retarget_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_n_s_aldy_indelpost_pileup, __pyx_d, NULL); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 733, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_key, __pyx_t_15) < 0) __PYX_ERR(0, 733, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 733, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

  /* "aldy/indelpost/pileup.pyx":734
 *     u_candidates = to_flat_list([var._generate_equivalents_private() for var in set(candidates)])
 *     u_candidates.sort(key=lambda x: abs(x.pos - target.pos))
 *     candidate_seqs = [var._get_indel_seq(how=target_type) for var in u_candidates]             # <<<<<<<<<<<<<<
 * 
 *     best_match = get_close_matches(
 */
  { /* enter inner scope */
    __pyx_t_15 = PyList_New(0); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 734, __pyx_L120_error)
    __Pyx_GOTREF(__pyx_t_15);
    if (likely(PyList_CheckExact(__pyx_v_u_candidates)) || PyTuple_CheckExact(__pyx_v_u_candidates)) {
      __pyx_t_3 = __pyx_v_u_candidates; __Pyx_INCREF(__pyx_t_3); __pyx_t_17 = 0;
      __pyx_t_6 = NULL;
    } else {
      __pyx_t_17 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_u_candidates); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 734, __pyx_L120_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 734, __pyx_L120_error)
    }
    for (;;) {
      if (likely(!__pyx_t_6)) {
        if (likely(PyList_CheckExact(__pyx_t_3))) {
          if (__pyx_t_17 >= PyList_GET_SIZE(__pyx_t_3)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_9 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_17); __Pyx_INCREF(__pyx_t_9); __pyx_t_17++; if (unlikely(0 < 0)) __PYX_ERR(0, 734, __pyx_L120_error)
          #else
          __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_17); __pyx_t_17++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 734, __pyx_L120_error)
          __Pyx_GOTREF(__pyx_t_9);
          #endif
        } else {
          if (__pyx_t_17 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_17); __Pyx_INCREF(__pyx_t_9); __pyx_t_17++; if (unlikely(0 < 0)) __PYX_ERR(0, 734, __pyx_L120_error)
          #else
          __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_17); __pyx_t_17++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 734, __pyx_L120_error)
          __Pyx_GOTREF(__pyx_t_9);
          #endif
        }
      } else {
        __pyx_t_9 = __pyx_t_6(__pyx_t_3);
        if (unlikely(!__pyx_t_9)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 734, __pyx_L120_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_9);
      }
      __Pyx_XDECREF_SET(__pyx_9genexpr24__pyx_v_var, __pyx_t_9);
      __pyx_t_9 = 0;
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_9genexpr24__pyx_v_var, __pyx_n_s_get_indel_seq); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 734, __pyx_L120_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 734, __pyx_L120_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_how, __pyx_v_target_type) < 0) __PYX_ERR(0, 734, __pyx_L120_error)
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 734, __pyx_L120_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_15, (PyObject*)__pyx_t_1))) __PYX_ERR(0, 734, __pyx_L120_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_9genexpr24__pyx_v_var); __pyx_9genexpr24__pyx_v_var = 0;
    goto __pyx_L123_exit_scope;
    __pyx_L120_error:;
    __Pyx_XDECREF(__pyx_9genexpr24__pyx_v_var); __pyx_9genexpr24__pyx_v_var = 0;
    goto __pyx_L1_error;
    __pyx_L123_exit_scope:;
  } /* exit inner scope */
  __pyx_v_candidate_seqs = ((PyObject*)__pyx_t_15);
  __pyx_t_15 = 0;

  /* "aldy/indelpost/pileup.pyx":736
 *     candidate_seqs = [var._get_indel_seq(how=target_type) for var in u_candidates]
 * 
 *     best_match = get_close_matches(             # <<<<<<<<<<<<<<
 *         target.indel_seq, candidate_seqs, n=1, cutoff=cutoff
 *     )
 */
  __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_n_s_get_close_matches); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 736, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);

  /* "aldy/indelpost/pileup.pyx":737
 * 
 *     best_match = get_close_matches(
 *         target.indel_seq, candidate_seqs, n=1, cutoff=cutoff             # <<<<<<<<<<<<<<
 *     )
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_target, __pyx_n_s_indel_seq); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 737, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "aldy/indelpost/pileup.pyx":736
 *     candidate_seqs = [var._get_indel_seq(how=target_type) for var in u_candidates]
 * 
 *     best_match = get_close_matches(             # <<<<<<<<<<<<<<
 *         target.indel_seq, candidate_seqs, n=1, cutoff=cutoff
 *     )
 */
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 736, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
  __Pyx_INCREF(__pyx_v_candidate_seqs);
  __Pyx_GIVEREF(__pyx_v_candidate_seqs);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_candidate_seqs);
  __pyx_t_3 = 0;

  /* "aldy/indelpost/pileup.pyx":737
 * 
 *     best_match = get_close_matches(
 *         target.indel_seq, candidate_seqs, n=1, cutoff=cutoff             # <<<<<<<<<<<<<<
 *     )
 * 
 */
  __pyx_t_3 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 737, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_n, __pyx_int_1) < 0) __PYX_ERR(0, 737, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_cutoff, __pyx_v_cutoff) < 0) __PYX_ERR(0, 737, __pyx_L1_error)

  /* "aldy/indelpost/pileup.pyx":736
 *     candidate_seqs = [var._get_indel_seq(how=target_type) for var in u_candidates]
 * 
 *     best_match = get_close_matches(             # <<<<<<<<<<<<<<
 *         target.indel_seq, candidate_seqs, n=1, cutoff=cutoff
 *     )
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 736, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_best_match = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "aldy/indelpost/pileup.pyx":740
 *     )
 * 
 *     if best_match:             # <<<<<<<<<<<<<<
 *         best_seq = best_match[0]
 *         match_score = SequenceMatcher(None, target.indel_seq, best_seq).ratio()
 */
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_best_match); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 740, __pyx_L1_error)
  if (__pyx_t_8) {

    /* "aldy/indelpost/pileup.pyx":741
 * 
 *     if best_match:
 *         best_seq = best_match[0]             # <<<<<<<<<<<<<<
 *         match_score = SequenceMatcher(None, target.indel_seq, best_seq).ratio()
 * 
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_best_match, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 741, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_best_seq = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "aldy/indelpost/pileup.pyx":742
 *     if best_match:
 *         best_seq = best_match[0]
 *         match_score = SequenceMatcher(None, target.indel_seq, best_seq).ratio()             # <<<<<<<<<<<<<<
 * 
 *         idx = candidate_seqs.index(best_seq)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_SequenceMatcher); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 742, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_target, __pyx_n_s_indel_seq); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 742, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __pyx_t_9 = NULL;
    __pyx_t_11 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
        __pyx_t_11 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[4] = {__pyx_t_9, Py_None, __pyx_t_15, __pyx_v_best_seq};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 742, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[4] = {__pyx_t_9, Py_None, __pyx_t_15, __pyx_v_best_seq};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 742, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    } else
    #endif
    {
      __pyx_t_10 = PyTuple_New(3+__pyx_t_11); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 742, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      if (__pyx_t_9) {
        __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __pyx_t_9 = NULL;
      }
      __Pyx_INCREF(Py_None);
      __Pyx_GIVEREF(Py_None);
      PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_11, Py_None);
      __Pyx_GIVEREF(__pyx_t_15);
      PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_11, __pyx_t_15);
      __Pyx_INCREF(__pyx_v_best_seq);
      __Pyx_GIVEREF(__pyx_v_best_seq);
      PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_11, __pyx_v_best_seq);
      __pyx_t_15 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_10, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 742, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_ratio); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 742, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 742, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_match_score, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "aldy/indelpost/pileup.pyx":744
 *         match_score = SequenceMatcher(None, target.indel_seq, best_seq).ratio()
 * 
 *         idx = candidate_seqs.index(best_seq)             # <<<<<<<<<<<<<<
 *         hit = u_candidates[idx]
 * 
 */
    __pyx_t_2 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyList_Type_index, __pyx_v_candidate_seqs, __pyx_v_best_seq); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 744, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_idx = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "aldy/indelpost/pileup.pyx":745
 * 
 *         idx = candidate_seqs.index(best_seq)
 *         hit = u_candidates[idx]             # <<<<<<<<<<<<<<
 * 
 *         # require exact match for shiftable indels
 */
    __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_u_candidates, __pyx_v_idx); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 745, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_hit = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "aldy/indelpost/pileup.pyx":748
 * 
 *         # require exact match for shiftable indels
 *         if require_exact_for_shiftable:             # <<<<<<<<<<<<<<
 *             if len(hit.generate_equivalents()) > 1 or len(target.generate_equivalents()) > 1:
 *                 if hit != target:
 */
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_require_exact_for_shiftable); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 748, __pyx_L1_error)
    if (__pyx_t_8) {

      /* "aldy/indelpost/pileup.pyx":749
 *         # require exact match for shiftable indels
 *         if require_exact_for_shiftable:
 *             if len(hit.generate_equivalents()) > 1 or len(target.generate_equivalents()) > 1:             # <<<<<<<<<<<<<<
 *                 if hit != target:
 *                     return None
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_hit, __pyx_n_s_generate_equivalents); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 749, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 749, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_17 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_17 == ((Py_ssize_t)-1))) __PYX_ERR(0, 749, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_4 = ((__pyx_t_17 > 1) != 0);
      if (!__pyx_t_4) {
      } else {
        __pyx_t_8 = __pyx_t_4;
        goto __pyx_L127_bool_binop_done;
      }
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_target, __pyx_n_s_generate_equivalents); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 749, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 749, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_17 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_17 == ((Py_ssize_t)-1))) __PYX_ERR(0, 749, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_4 = ((__pyx_t_17 > 1) != 0);
      __pyx_t_8 = __pyx_t_4;
      __pyx_L127_bool_binop_done:;
      if (__pyx_t_8) {

        /* "aldy/indelpost/pileup.pyx":750
 *         if require_exact_for_shiftable:
 *             if len(hit.generate_equivalents()) > 1 or len(target.generate_equivalents()) > 1:
 *                 if hit != target:             # <<<<<<<<<<<<<<
 *                     return None
 * 
 */
        __pyx_t_2 = PyObject_RichCompare(__pyx_v_hit, __pyx_cur_scope->__pyx_v_target, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 750, __pyx_L1_error)
        __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 750, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (__pyx_t_8) {

          /* "aldy/indelpost/pileup.pyx":751
 *             if len(hit.generate_equivalents()) > 1 or len(target.generate_equivalents()) > 1:
 *                 if hit != target:
 *                     return None             # <<<<<<<<<<<<<<
 * 
 *         if abs(target.pos - hit.pos) < within:
 */
          __Pyx_XDECREF(__pyx_r);
          __pyx_r = Py_None; __Pyx_INCREF(Py_None);
          goto __pyx_L0;

          /* "aldy/indelpost/pileup.pyx":750
 *         if require_exact_for_shiftable:
 *             if len(hit.generate_equivalents()) > 1 or len(target.generate_equivalents()) > 1:
 *                 if hit != target:             # <<<<<<<<<<<<<<
 *                     return None
 * 
 */
        }

        /* "aldy/indelpost/pileup.pyx":749
 *         # require exact match for shiftable indels
 *         if require_exact_for_shiftable:
 *             if len(hit.generate_equivalents()) > 1 or len(target.generate_equivalents()) > 1:             # <<<<<<<<<<<<<<
 *                 if hit != target:
 *                     return None
 */
      }

      /* "aldy/indelpost/pileup.pyx":748
 * 
 *         # require exact match for shiftable indels
 *         if require_exact_for_shiftable:             # <<<<<<<<<<<<<<
 *             if len(hit.generate_equivalents()) > 1 or len(target.generate_equivalents()) > 1:
 *                 if hit != target:
 */
    }

    /* "aldy/indelpost/pileup.pyx":753
 *                     return None
 * 
 *         if abs(target.pos - hit.pos) < within:             # <<<<<<<<<<<<<<
 * 
 *             try:
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_target, __pyx_n_s_pos); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 753, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_hit, __pyx_n_s_pos); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 753, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyNumber_Subtract(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 753, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyNumber_Absolute(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 753, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_v_within, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 753, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 753, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_8) {

      /* "aldy/indelpost/pileup.pyx":755
 *         if abs(target.pos - hit.pos) < within:
 * 
 *             try:             # <<<<<<<<<<<<<<
 *                 idx2 = candidates.index(hit)  #get original representation, do not normalize here.
 *             except:
 */
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_24, &__pyx_t_25, &__pyx_t_26);
        __Pyx_XGOTREF(__pyx_t_24);
        __Pyx_XGOTREF(__pyx_t_25);
        __Pyx_XGOTREF(__pyx_t_26);
        /*try:*/ {

          /* "aldy/indelpost/pileup.pyx":756
 * 
 *             try:
 *                 idx2 = candidates.index(hit)  #get original representation, do not normalize here.             # <<<<<<<<<<<<<<
 *             except:
 *                 hit.pos = hit.pos - len(hit.ref)
 */
          __pyx_t_3 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyList_Type_index, __pyx_v_candidates, __pyx_v_hit); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 756, __pyx_L131_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_v_idx2 = __pyx_t_3;
          __pyx_t_3 = 0;

          /* "aldy/indelpost/pileup.pyx":755
 *         if abs(target.pos - hit.pos) < within:
 * 
 *             try:             # <<<<<<<<<<<<<<
 *                 idx2 = candidates.index(hit)  #get original representation, do not normalize here.
 *             except:
 */
        }
        __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0;
        __Pyx_XDECREF(__pyx_t_25); __pyx_t_25 = 0;
        __Pyx_XDECREF(__pyx_t_26); __pyx_t_26 = 0;
        goto __pyx_L136_try_end;
        __pyx_L131_error:;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
        __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

        /* "aldy/indelpost/pileup.pyx":757
 *             try:
 *                 idx2 = candidates.index(hit)  #get original representation, do not normalize here.
 *             except:             # <<<<<<<<<<<<<<
 *                 hit.pos = hit.pos - len(hit.ref)
 *                 idx2 = candidates.index(hit)
 */
        /*except:*/ {
          __Pyx_AddTraceback("aldy.indelpost.pileup.retarget", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_1, &__pyx_t_2) < 0) __PYX_ERR(0, 757, __pyx_L133_except_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_GOTREF(__pyx_t_2);

          /* "aldy/indelpost/pileup.pyx":758
 *                 idx2 = candidates.index(hit)  #get original representation, do not normalize here.
 *             except:
 *                 hit.pos = hit.pos - len(hit.ref)             # <<<<<<<<<<<<<<
 *                 idx2 = candidates.index(hit)
 * 
 */
          __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_hit, __pyx_n_s_pos); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 758, __pyx_L133_except_error)
          __Pyx_GOTREF(__pyx_t_10);
          __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_hit, __pyx_n_s_ref); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 758, __pyx_L133_except_error)
          __Pyx_GOTREF(__pyx_t_15);
          __pyx_t_17 = PyObject_Length(__pyx_t_15); if (unlikely(__pyx_t_17 == ((Py_ssize_t)-1))) __PYX_ERR(0, 758, __pyx_L133_except_error)
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          __pyx_t_15 = PyInt_FromSsize_t(__pyx_t_17); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 758, __pyx_L133_except_error)
          __Pyx_GOTREF(__pyx_t_15);
          __pyx_t_9 = PyNumber_Subtract(__pyx_t_10, __pyx_t_15); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 758, __pyx_L133_except_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          if (__Pyx_PyObject_SetAttrStr(__pyx_v_hit, __pyx_n_s_pos, __pyx_t_9) < 0) __PYX_ERR(0, 758, __pyx_L133_except_error)
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

          /* "aldy/indelpost/pileup.pyx":759
 *             except:
 *                 hit.pos = hit.pos - len(hit.ref)
 *                 idx2 = candidates.index(hit)             # <<<<<<<<<<<<<<
 * 
 *             candidate = candidates[idx2]
 */
          __pyx_t_9 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyList_Type_index, __pyx_v_candidates, __pyx_v_hit); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 759, __pyx_L133_except_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_XDECREF_SET(__pyx_v_idx2, __pyx_t_9);
          __pyx_t_9 = 0;
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          goto __pyx_L132_exception_handled;
        }
        __pyx_L133_except_error:;

        /* "aldy/indelpost/pileup.pyx":755
 *         if abs(target.pos - hit.pos) < within:
 * 
 *             try:             # <<<<<<<<<<<<<<
 *                 idx2 = candidates.index(hit)  #get original representation, do not normalize here.
 *             except:
 */
        __Pyx_XGIVEREF(__pyx_t_24);
        __Pyx_XGIVEREF(__pyx_t_25);
        __Pyx_XGIVEREF(__pyx_t_26);
        __Pyx_ExceptionReset(__pyx_t_24, __pyx_t_25, __pyx_t_26);
        goto __pyx_L1_error;
        __pyx_L132_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_24);
        __Pyx_XGIVEREF(__pyx_t_25);
        __Pyx_XGIVEREF(__pyx_t_26);
        __Pyx_ExceptionReset(__pyx_t_24, __pyx_t_25, __pyx_t_26);
        __pyx_L136_try_end:;
      }

      /* "aldy/indelpost/pileup.pyx":761
 *                 idx2 = candidates.index(hit)
 * 
 *             candidate = candidates[idx2]             # <<<<<<<<<<<<<<
 *             idx = [i for i, var in enumerate(candidates) if var == candidate]
 * 
 */
      __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_candidates, __pyx_v_idx2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 761, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_v_candidate = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "aldy/indelpost/pileup.pyx":762
 * 
 *             candidate = candidates[idx2]
 *             idx = [i for i, var in enumerate(candidates) if var == candidate]             # <<<<<<<<<<<<<<
 * 
 *             # check if the candidate can be del/ins component of a complex indel
 */
      { /* enter inner scope */
        __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 762, __pyx_L141_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_INCREF(__pyx_int_0);
        __pyx_t_1 = __pyx_int_0;
        __pyx_t_3 = __pyx_v_candidates; __Pyx_INCREF(__pyx_t_3); __pyx_t_17 = 0;
        for (;;) {
          if (__pyx_t_17 >= PyList_GET_SIZE(__pyx_t_3)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_9 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_17); __Pyx_INCREF(__pyx_t_9); __pyx_t_17++; if (unlikely(0 < 0)) __PYX_ERR(0, 762, __pyx_L141_error)
          #else
          __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_17); __pyx_t_17++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 762, __pyx_L141_error)
          __Pyx_GOTREF(__pyx_t_9);
          #endif
          __Pyx_XDECREF_SET(__pyx_9genexpr25__pyx_v_var, __pyx_t_9);
          __pyx_t_9 = 0;
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_XDECREF_SET(__pyx_9genexpr25__pyx_v_i, __pyx_t_1);
          __pyx_t_9 = __Pyx_PyInt_AddObjC(__pyx_t_1, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 762, __pyx_L141_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_1);
          __pyx_t_1 = __pyx_t_9;
          __pyx_t_9 = 0;
          __pyx_t_9 = PyObject_RichCompare(__pyx_9genexpr25__pyx_v_var, __pyx_v_candidate, Py_EQ); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 762, __pyx_L141_error)
          __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 762, __pyx_L141_error)
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          if (__pyx_t_8) {
            if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_9genexpr25__pyx_v_i))) __PYX_ERR(0, 762, __pyx_L141_error)
          }
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_9genexpr25__pyx_v_i); __pyx_9genexpr25__pyx_v_i = 0;
        __Pyx_XDECREF(__pyx_9genexpr25__pyx_v_var); __pyx_9genexpr25__pyx_v_var = 0;
        goto __pyx_L145_exit_scope;
        __pyx_L141_error:;
        __Pyx_XDECREF(__pyx_9genexpr25__pyx_v_i); __pyx_9genexpr25__pyx_v_i = 0;
        __Pyx_XDECREF(__pyx_9genexpr25__pyx_v_var); __pyx_9genexpr25__pyx_v_var = 0;
        goto __pyx_L1_error;
        __pyx_L145_exit_scope:;
      } /* exit inner scope */
      __Pyx_DECREF_SET(__pyx_v_idx, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "aldy/indelpost/pileup.pyx":765
 * 
 *             # check if the candidate can be del/ins component of a complex indel
 *             if candidate.is_non_complex_indel():             # <<<<<<<<<<<<<<
 *                 complex_candidates = [var for var in set(candidates) if not var.is_non_complex_indel()]
 *                 if complex_candidates:
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_candidate, __pyx_n_s_is_non_complex_indel); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 765, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 765, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 765, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (__pyx_t_8) {

        /* "aldy/indelpost/pileup.pyx":766
 *             # check if the candidate can be del/ins component of a complex indel
 *             if candidate.is_non_complex_indel():
 *                 complex_candidates = [var for var in set(candidates) if not var.is_non_complex_indel()]             # <<<<<<<<<<<<<<
 *                 if complex_candidates:
 *                     for cplx_candidate in complex_candidates:
 */
        { /* enter inner scope */
          __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 766, __pyx_L149_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_17 = 0;
          __pyx_t_3 = PySet_New(__pyx_v_candidates); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 766, __pyx_L149_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_9 = __Pyx_set_iterator(__pyx_t_3, 1, (&__pyx_t_5), (&__pyx_t_11)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 766, __pyx_L149_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_XDECREF(__pyx_t_1);
          __pyx_t_1 = __pyx_t_9;
          __pyx_t_9 = 0;
          while (1) {
            __pyx_t_23 = __Pyx_set_iter_next(__pyx_t_1, __pyx_t_5, &__pyx_t_17, &__pyx_t_9, __pyx_t_11);
            if (unlikely(__pyx_t_23 == 0)) break;
            if (unlikely(__pyx_t_23 == -1)) __PYX_ERR(0, 766, __pyx_L149_error)
            __Pyx_GOTREF(__pyx_t_9);
            __Pyx_XDECREF_SET(__pyx_9genexpr26__pyx_v_var, __pyx_t_9);
            __pyx_t_9 = 0;
            __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_9genexpr26__pyx_v_var, __pyx_n_s_is_non_complex_indel); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 766, __pyx_L149_error)
            __Pyx_GOTREF(__pyx_t_3);
            __pyx_t_15 = NULL;
            if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
              __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_3);
              if (likely(__pyx_t_15)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
                __Pyx_INCREF(__pyx_t_15);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_3, function);
              }
            }
            __pyx_t_9 = (__pyx_t_15) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_15) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
            __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
            if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 766, __pyx_L149_error)
            __Pyx_GOTREF(__pyx_t_9);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 766, __pyx_L149_error)
            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
            __pyx_t_4 = ((!__pyx_t_8) != 0);
            if (__pyx_t_4) {
              if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_9genexpr26__pyx_v_var))) __PYX_ERR(0, 766, __pyx_L149_error)
            }
          }
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_XDECREF(__pyx_9genexpr26__pyx_v_var); __pyx_9genexpr26__pyx_v_var = 0;
          goto __pyx_L153_exit_scope;
          __pyx_L149_error:;
          __Pyx_XDECREF(__pyx_9genexpr26__pyx_v_var); __pyx_9genexpr26__pyx_v_var = 0;
          goto __pyx_L1_error;
          __pyx_L153_exit_scope:;
        } /* exit inner scope */
        __pyx_v_complex_candidates = ((PyObject*)__pyx_t_2);
        __pyx_t_2 = 0;

        /* "aldy/indelpost/pileup.pyx":767
 *             if candidate.is_non_complex_indel():
 *                 complex_candidates = [var for var in set(candidates) if not var.is_non_complex_indel()]
 *                 if complex_candidates:             # <<<<<<<<<<<<<<
 *                     for cplx_candidate in complex_candidates:
 *                         reduced = cplx_candidate._reduce_complex_indel(to=target_type)
 */
        __pyx_t_4 = (PyList_GET_SIZE(__pyx_v_complex_candidates) != 0);
        if (__pyx_t_4) {

          /* "aldy/indelpost/pileup.pyx":768
 *                 complex_candidates = [var for var in set(candidates) if not var.is_non_complex_indel()]
 *                 if complex_candidates:
 *                     for cplx_candidate in complex_candidates:             # <<<<<<<<<<<<<<
 *                         reduced = cplx_candidate._reduce_complex_indel(to=target_type)
 *                         if candidate == reduced:
 */
          __pyx_t_2 = __pyx_v_complex_candidates; __Pyx_INCREF(__pyx_t_2); __pyx_t_5 = 0;
          for (;;) {
            if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_2)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 768, __pyx_L1_error)
            #else
            __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 768, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_1);
            #endif
            __Pyx_XDECREF_SET(__pyx_v_cplx_candidate, __pyx_t_1);
            __pyx_t_1 = 0;

            /* "aldy/indelpost/pileup.pyx":769
 *                 if complex_candidates:
 *                     for cplx_candidate in complex_candidates:
 *                         reduced = cplx_candidate._reduce_complex_indel(to=target_type)             # <<<<<<<<<<<<<<
 *                         if candidate == reduced:
 *                             idx = [i for i, var in enumerate(candidates) if var == cplx_candidate]
 */
            __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_cplx_candidate, __pyx_n_s_reduce_complex_indel); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 769, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_1);
            __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 769, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_9);
            if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_to, __pyx_v_target_type) < 0) __PYX_ERR(0, 769, __pyx_L1_error)
            __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 769, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
            __Pyx_XDECREF_SET(__pyx_v_reduced, __pyx_t_3);
            __pyx_t_3 = 0;

            /* "aldy/indelpost/pileup.pyx":770
 *                     for cplx_candidate in complex_candidates:
 *                         reduced = cplx_candidate._reduce_complex_indel(to=target_type)
 *                         if candidate == reduced:             # <<<<<<<<<<<<<<
 *                             idx = [i for i, var in enumerate(candidates) if var == cplx_candidate]
 *                             candidate = reduced
 */
            __pyx_t_3 = PyObject_RichCompare(__pyx_v_candidate, __pyx_v_reduced, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 770, __pyx_L1_error)
            __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 770, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            if (__pyx_t_4) {

              /* "aldy/indelpost/pileup.pyx":771
 *                         reduced = cplx_candidate._reduce_complex_indel(to=target_type)
 *                         if candidate == reduced:
 *                             idx = [i for i, var in enumerate(candidates) if var == cplx_candidate]             # <<<<<<<<<<<<<<
 *                             candidate = reduced
 *                             break
 */
              { /* enter inner scope */
                __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 771, __pyx_L160_error)
                __Pyx_GOTREF(__pyx_t_3);
                __Pyx_INCREF(__pyx_int_0);
                __pyx_t_9 = __pyx_int_0;
                __pyx_t_1 = __pyx_v_candidates; __Pyx_INCREF(__pyx_t_1); __pyx_t_17 = 0;
                for (;;) {
                  if (__pyx_t_17 >= PyList_GET_SIZE(__pyx_t_1)) break;
                  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                  __pyx_t_15 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_17); __Pyx_INCREF(__pyx_t_15); __pyx_t_17++; if (unlikely(0 < 0)) __PYX_ERR(0, 771, __pyx_L160_error)
                  #else
                  __pyx_t_15 = PySequence_ITEM(__pyx_t_1, __pyx_t_17); __pyx_t_17++; if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 771, __pyx_L160_error)
                  __Pyx_GOTREF(__pyx_t_15);
                  #endif
                  __Pyx_XDECREF_SET(__pyx_9genexpr27__pyx_v_var, __pyx_t_15);
                  __pyx_t_15 = 0;
                  __Pyx_INCREF(__pyx_t_9);
                  __Pyx_XDECREF_SET(__pyx_9genexpr27__pyx_v_i, __pyx_t_9);
                  __pyx_t_15 = __Pyx_PyInt_AddObjC(__pyx_t_9, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 771, __pyx_L160_error)
                  __Pyx_GOTREF(__pyx_t_15);
                  __Pyx_DECREF(__pyx_t_9);
                  __pyx_t_9 = __pyx_t_15;
                  __pyx_t_15 = 0;
                  __pyx_t_15 = PyObject_RichCompare(__pyx_9genexpr27__pyx_v_var, __pyx_v_cplx_candidate, Py_EQ); __Pyx_XGOTREF(__pyx_t_15); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 771, __pyx_L160_error)
                  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_15); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 771, __pyx_L160_error)
                  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
                  if (__pyx_t_4) {
                    if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_9genexpr27__pyx_v_i))) __PYX_ERR(0, 771, __pyx_L160_error)
                  }
                }
                __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
                __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
                __Pyx_XDECREF(__pyx_9genexpr27__pyx_v_i); __pyx_9genexpr27__pyx_v_i = 0;
                __Pyx_XDECREF(__pyx_9genexpr27__pyx_v_var); __pyx_9genexpr27__pyx_v_var = 0;
                goto __pyx_L164_exit_scope;
                __pyx_L160_error:;
                __Pyx_XDECREF(__pyx_9genexpr27__pyx_v_i); __pyx_9genexpr27__pyx_v_i = 0;
                __Pyx_XDECREF(__pyx_9genexpr27__pyx_v_var); __pyx_9genexpr27__pyx_v_var = 0;
                goto __pyx_L1_error;
                __pyx_L164_exit_scope:;
              } /* exit inner scope */
              __Pyx_DECREF_SET(__pyx_v_idx, __pyx_t_3);
              __pyx_t_3 = 0;

              /* "aldy/indelpost/pileup.pyx":772
 *                         if candidate == reduced:
 *                             idx = [i for i, var in enumerate(candidates) if var == cplx_candidate]
 *                             candidate = reduced             # <<<<<<<<<<<<<<
 *                             break
 *             else:
 */
              __Pyx_INCREF(__pyx_v_reduced);
              __Pyx_DECREF_SET(__pyx_v_candidate, __pyx_v_reduced);

              /* "aldy/indelpost/pileup.pyx":773
 *                             idx = [i for i, var in enumerate(candidates) if var == cplx_candidate]
 *                             candidate = reduced
 *                             break             # <<<<<<<<<<<<<<
 *             else:
 *                 candidate = candidate._reduce_complex_indel(to=target_type)
 */
              goto __pyx_L156_break;

              /* "aldy/indelpost/pileup.pyx":770
 *                     for cplx_candidate in complex_candidates:
 *                         reduced = cplx_candidate._reduce_complex_indel(to=target_type)
 *                         if candidate == reduced:             # <<<<<<<<<<<<<<
 *                             idx = [i for i, var in enumerate(candidates) if var == cplx_candidate]
 *                             candidate = reduced
 */
            }

            /* "aldy/indelpost/pileup.pyx":768
 *                 complex_candidates = [var for var in set(candidates) if not var.is_non_complex_indel()]
 *                 if complex_candidates:
 *                     for cplx_candidate in complex_candidates:             # <<<<<<<<<<<<<<
 *                         reduced = cplx_candidate._reduce_complex_indel(to=target_type)
 *                         if candidate == reduced:
 */
          }
          __pyx_L156_break:;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

          /* "aldy/indelpost/pileup.pyx":767
 *             if candidate.is_non_complex_indel():
 *                 complex_candidates = [var for var in set(candidates) if not var.is_non_complex_indel()]
 *                 if complex_candidates:             # <<<<<<<<<<<<<<
 *                     for cplx_candidate in complex_candidates:
 *                         reduced = cplx_candidate._reduce_complex_indel(to=target_type)
 */
        }

        /* "aldy/indelpost/pileup.pyx":765
 * 
 *             # check if the candidate can be del/ins component of a complex indel
 *             if candidate.is_non_complex_indel():             # <<<<<<<<<<<<<<
 *                 complex_candidates = [var for var in set(candidates) if not var.is_non_complex_indel()]
 *                 if complex_candidates:
 */
        goto __pyx_L146;
      }

      /* "aldy/indelpost/pileup.pyx":775
 *                             break
 *             else:
 *                 candidate = candidate._reduce_complex_indel(to=target_type)             # <<<<<<<<<<<<<<
 * 
 *             candidate_reads = [candidate_reads[i] for i in idx]
 */
      /*else*/ {
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_candidate, __pyx_n_s_reduce_complex_indel); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 775, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 775, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_to, __pyx_v_target_type) < 0) __PYX_ERR(0, 775, __pyx_L1_error)
        __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 775, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF_SET(__pyx_v_candidate, __pyx_t_9);
        __pyx_t_9 = 0;
      }
      __pyx_L146:;

      /* "aldy/indelpost/pileup.pyx":777
 *                 candidate = candidate._reduce_complex_indel(to=target_type)
 * 
 *             candidate_reads = [candidate_reads[i] for i in idx]             # <<<<<<<<<<<<<<
 *             candidate_ref_seqs = [candidate_ref_seqs[i] for i in idx]
 *             candidate_ref_starts = [candidate_ref_starts[i] for i in idx]
 */
      { /* enter inner scope */
        __pyx_t_9 = PyList_New(0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 777, __pyx_L167_error)
        __Pyx_GOTREF(__pyx_t_9);
        if (likely(PyList_CheckExact(__pyx_v_idx)) || PyTuple_CheckExact(__pyx_v_idx)) {
          __pyx_t_3 = __pyx_v_idx; __Pyx_INCREF(__pyx_t_3); __pyx_t_5 = 0;
          __pyx_t_6 = NULL;
        } else {
          __pyx_t_5 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_idx); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 777, __pyx_L167_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_6 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 777, __pyx_L167_error)
        }
        for (;;) {
          if (likely(!__pyx_t_6)) {
            if (likely(PyList_CheckExact(__pyx_t_3))) {
              if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_3)) break;
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 777, __pyx_L167_error)
              #else
              __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 777, __pyx_L167_error)
              __Pyx_GOTREF(__pyx_t_2);
              #endif
            } else {
              if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 777, __pyx_L167_error)
              #else
              __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 777, __pyx_L167_error)
              __Pyx_GOTREF(__pyx_t_2);
              #endif
            }
          } else {
            __pyx_t_2 = __pyx_t_6(__pyx_t_3);
            if (unlikely(!__pyx_t_2)) {
              PyObject* exc_type = PyErr_Occurred();
              if (exc_type) {
                if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
                else __PYX_ERR(0, 777, __pyx_L167_error)
              }
              break;
            }
            __Pyx_GOTREF(__pyx_t_2);
          }
          __Pyx_XDECREF_SET(__pyx_9genexpr28__pyx_v_i, __pyx_t_2);
          __pyx_t_2 = 0;
          __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_candidate_reads, __pyx_9genexpr28__pyx_v_i); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 777, __pyx_L167_error)
          __Pyx_GOTREF(__pyx_t_2);
          if (unlikely(__Pyx_ListComp_Append(__pyx_t_9, (PyObject*)__pyx_t_2))) __PYX_ERR(0, 777, __pyx_L167_error)
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_9genexpr28__pyx_v_i); __pyx_9genexpr28__pyx_v_i = 0;
        goto __pyx_L170_exit_scope;
        __pyx_L167_error:;
        __Pyx_XDECREF(__pyx_9genexpr28__pyx_v_i); __pyx_9genexpr28__pyx_v_i = 0;
        goto __pyx_L1_error;
        __pyx_L170_exit_scope:;
      } /* exit inner scope */
      __Pyx_DECREF_SET(__pyx_v_candidate_reads, ((PyObject*)__pyx_t_9));
      __pyx_t_9 = 0;

      /* "aldy/indelpost/pileup.pyx":778
 * 
 *             candidate_reads = [candidate_reads[i] for i in idx]
 *             candidate_ref_seqs = [candidate_ref_seqs[i] for i in idx]             # <<<<<<<<<<<<<<
 *             candidate_ref_starts = [candidate_ref_starts[i] for i in idx]
 *             candidate_aligners = [candidate_aligners[i] for i in idx]
 */
      { /* enter inner scope */
        __pyx_t_9 = PyList_New(0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 778, __pyx_L173_error)
        __Pyx_GOTREF(__pyx_t_9);
        if (likely(PyList_CheckExact(__pyx_v_idx)) || PyTuple_CheckExact(__pyx_v_idx)) {
          __pyx_t_3 = __pyx_v_idx; __Pyx_INCREF(__pyx_t_3); __pyx_t_5 = 0;
          __pyx_t_6 = NULL;
        } else {
          __pyx_t_5 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_idx); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 778, __pyx_L173_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_6 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 778, __pyx_L173_error)
        }
        for (;;) {
          if (likely(!__pyx_t_6)) {
            if (likely(PyList_CheckExact(__pyx_t_3))) {
              if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_3)) break;
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 778, __pyx_L173_error)
              #else
              __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 778, __pyx_L173_error)
              __Pyx_GOTREF(__pyx_t_2);
              #endif
            } else {
              if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 778, __pyx_L173_error)
              #else
              __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 778, __pyx_L173_error)
              __Pyx_GOTREF(__pyx_t_2);
              #endif
            }
          } else {
            __pyx_t_2 = __pyx_t_6(__pyx_t_3);
            if (unlikely(!__pyx_t_2)) {
              PyObject* exc_type = PyErr_Occurred();
              if (exc_type) {
                if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
                else __PYX_ERR(0, 778, __pyx_L173_error)
              }
              break;
            }
            __Pyx_GOTREF(__pyx_t_2);
          }
          __Pyx_XDECREF_SET(__pyx_9genexpr29__pyx_v_i, __pyx_t_2);
          __pyx_t_2 = 0;
          __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_candidate_ref_seqs, __pyx_9genexpr29__pyx_v_i); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 778, __pyx_L173_error)
          __Pyx_GOTREF(__pyx_t_2);
          if (unlikely(__Pyx_ListComp_Append(__pyx_t_9, (PyObject*)__pyx_t_2))) __PYX_ERR(0, 778, __pyx_L173_error)
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_9genexpr29__pyx_v_i); __pyx_9genexpr29__pyx_v_i = 0;
        goto __pyx_L176_exit_scope;
        __pyx_L173_error:;
        __Pyx_XDECREF(__pyx_9genexpr29__pyx_v_i); __pyx_9genexpr29__pyx_v_i = 0;
        goto __pyx_L1_error;
        __pyx_L176_exit_scope:;
      } /* exit inner scope */
      __Pyx_DECREF_SET(__pyx_v_candidate_ref_seqs, ((PyObject*)__pyx_t_9));
      __pyx_t_9 = 0;

      /* "aldy/indelpost/pileup.pyx":779
 *             candidate_reads = [candidate_reads[i] for i in idx]
 *             candidate_ref_seqs = [candidate_ref_seqs[i] for i in idx]
 *             candidate_ref_starts = [candidate_ref_starts[i] for i in idx]             # <<<<<<<<<<<<<<
 *             candidate_aligners = [candidate_aligners[i] for i in idx]
 * 
 */
      { /* enter inner scope */
        __pyx_t_9 = PyList_New(0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 779, __pyx_L179_error)
        __Pyx_GOTREF(__pyx_t_9);
        if (likely(PyList_CheckExact(__pyx_v_idx)) || PyTuple_CheckExact(__pyx_v_idx)) {
          __pyx_t_3 = __pyx_v_idx; __Pyx_INCREF(__pyx_t_3); __pyx_t_5 = 0;
          __pyx_t_6 = NULL;
        } else {
          __pyx_t_5 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_idx); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 779, __pyx_L179_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_6 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 779, __pyx_L179_error)
        }
        for (;;) {
          if (likely(!__pyx_t_6)) {
            if (likely(PyList_CheckExact(__pyx_t_3))) {
              if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_3)) break;
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 779, __pyx_L179_error)
              #else
              __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 779, __pyx_L179_error)
              __Pyx_GOTREF(__pyx_t_2);
              #endif
            } else {
              if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 779, __pyx_L179_error)
              #else
              __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 779, __pyx_L179_error)
              __Pyx_GOTREF(__pyx_t_2);
              #endif
            }
          } else {
            __pyx_t_2 = __pyx_t_6(__pyx_t_3);
            if (unlikely(!__pyx_t_2)) {
              PyObject* exc_type = PyErr_Occurred();
              if (exc_type) {
                if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
                else __PYX_ERR(0, 779, __pyx_L179_error)
              }
              break;
            }
            __Pyx_GOTREF(__pyx_t_2);
          }
          __Pyx_XDECREF_SET(__pyx_9genexpr30__pyx_v_i, __pyx_t_2);
          __pyx_t_2 = 0;
          __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_candidate_ref_starts, __pyx_9genexpr30__pyx_v_i); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 779, __pyx_L179_error)
          __Pyx_GOTREF(__pyx_t_2);
          if (unlikely(__Pyx_ListComp_Append(__pyx_t_9, (PyObject*)__pyx_t_2))) __PYX_ERR(0, 779, __pyx_L179_error)
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_9genexpr30__pyx_v_i); __pyx_9genexpr30__pyx_v_i = 0;
        goto __pyx_L182_exit_scope;
        __pyx_L179_error:;
        __Pyx_XDECREF(__pyx_9genexpr30__pyx_v_i); __pyx_9genexpr30__pyx_v_i = 0;
        goto __pyx_L1_error;
        __pyx_L182_exit_scope:;
      } /* exit inner scope */
      __Pyx_DECREF_SET(__pyx_v_candidate_ref_starts, ((PyObject*)__pyx_t_9));
      __pyx_t_9 = 0;

      /* "aldy/indelpost/pileup.pyx":780
 *             candidate_ref_seqs = [candidate_ref_seqs[i] for i in idx]
 *             candidate_ref_starts = [candidate_ref_starts[i] for i in idx]
 *             candidate_aligners = [candidate_aligners[i] for i in idx]             # <<<<<<<<<<<<<<
 * 
 *             return candidate, candidate_reads, match_score, candidate_ref_seqs, candidate_ref_starts, candidate_aligners
 */
      { /* enter inner scope */
        __pyx_t_9 = PyList_New(0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 780, __pyx_L185_error)
        __Pyx_GOTREF(__pyx_t_9);
        if (likely(PyList_CheckExact(__pyx_v_idx)) || PyTuple_CheckExact(__pyx_v_idx)) {
          __pyx_t_3 = __pyx_v_idx; __Pyx_INCREF(__pyx_t_3); __pyx_t_5 = 0;
          __pyx_t_6 = NULL;
        } else {
          __pyx_t_5 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_idx); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 780, __pyx_L185_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_6 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 780, __pyx_L185_error)
        }
        for (;;) {
          if (likely(!__pyx_t_6)) {
            if (likely(PyList_CheckExact(__pyx_t_3))) {
              if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_3)) break;
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 780, __pyx_L185_error)
              #else
              __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 780, __pyx_L185_error)
              __Pyx_GOTREF(__pyx_t_2);
              #endif
            } else {
              if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 780, __pyx_L185_error)
              #else
              __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 780, __pyx_L185_error)
              __Pyx_GOTREF(__pyx_t_2);
              #endif
            }
          } else {
            __pyx_t_2 = __pyx_t_6(__pyx_t_3);
            if (unlikely(!__pyx_t_2)) {
              PyObject* exc_type = PyErr_Occurred();
              if (exc_type) {
                if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
                else __PYX_ERR(0, 780, __pyx_L185_error)
              }
              break;
            }
            __Pyx_GOTREF(__pyx_t_2);
          }
          __Pyx_XDECREF_SET(__pyx_9genexpr31__pyx_v_i, __pyx_t_2);
          __pyx_t_2 = 0;
          __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_candidate_aligners, __pyx_9genexpr31__pyx_v_i); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 780, __pyx_L185_error)
          __Pyx_GOTREF(__pyx_t_2);
          if (unlikely(__Pyx_ListComp_Append(__pyx_t_9, (PyObject*)__pyx_t_2))) __PYX_ERR(0, 780, __pyx_L185_error)
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_9genexpr31__pyx_v_i); __pyx_9genexpr31__pyx_v_i = 0;
        goto __pyx_L188_exit_scope;
        __pyx_L185_error:;
        __Pyx_XDECREF(__pyx_9genexpr31__pyx_v_i); __pyx_9genexpr31__pyx_v_i = 0;
        goto __pyx_L1_error;
        __pyx_L188_exit_scope:;
      } /* exit inner scope */
      __Pyx_DECREF_SET(__pyx_v_candidate_aligners, ((PyObject*)__pyx_t_9));
      __pyx_t_9 = 0;

      /* "aldy/indelpost/pileup.pyx":782
 *             candidate_aligners = [candidate_aligners[i] for i in idx]
 * 
 *             return candidate, candidate_reads, match_score, candidate_ref_seqs, candidate_ref_starts, candidate_aligners             # <<<<<<<<<<<<<<
 *         else:
 *             return None
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_9 = PyTuple_New(6); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 782, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_v_candidate);
      __Pyx_GIVEREF(__pyx_v_candidate);
      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_candidate);
      __Pyx_INCREF(__pyx_v_candidate_reads);
      __Pyx_GIVEREF(__pyx_v_candidate_reads);
      PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_candidate_reads);
      __Pyx_INCREF(__pyx_v_match_score);
      __Pyx_GIVEREF(__pyx_v_match_score);
      PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_v_match_score);
      __Pyx_INCREF(__pyx_v_candidate_ref_seqs);
      __Pyx_GIVEREF(__pyx_v_candidate_ref_seqs);
      PyTuple_SET_ITEM(__pyx_t_9, 3, __pyx_v_candidate_ref_seqs);
      __Pyx_INCREF(__pyx_v_candidate_ref_starts);
      __Pyx_GIVEREF(__pyx_v_candidate_ref_starts);
      PyTuple_SET_ITEM(__pyx_t_9, 4, __pyx_v_candidate_ref_starts);
      __Pyx_INCREF(__pyx_v_candidate_aligners);
      __Pyx_GIVEREF(__pyx_v_candidate_aligners);
      PyTuple_SET_ITEM(__pyx_t_9, 5, __pyx_v_candidate_aligners);
      __pyx_r = __pyx_t_9;
      __pyx_t_9 = 0;
      goto __pyx_L0;

      /* "aldy/indelpost/pileup.pyx":753
 *                     return None
 * 
 *         if abs(target.pos - hit.pos) < within:             # <<<<<<<<<<<<<<
 * 
 *             try:
 */
    }

    /* "aldy/indelpost/pileup.pyx":784
 *             return candidate, candidate_reads, match_score, candidate_ref_seqs, candidate_ref_starts, candidate_aligners
 *         else:
 *             return None             # <<<<<<<<<<<<<<
 *     else:
 *         if target.is_ins and window > 3:
 */
    /*else*/ {
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
    }

    /* "aldy/indelpost/pileup.pyx":740
 *     )
 * 
 *     if best_match:             # <<<<<<<<<<<<<<
 *         best_seq = best_match[0]
 *         match_score = SequenceMatcher(None, target.indel_seq, best_seq).ratio()
 */
  }

  /* "aldy/indelpost/pileup.pyx":786
 *             return None
 *     else:
 *         if target.is_ins and window > 3:             # <<<<<<<<<<<<<<
 *             window = int(window/3)
 *             return retarget(
 */
  /*else*/ {
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_target, __pyx_n_s_is_ins); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 786, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 786, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (__pyx_t_8) {
    } else {
      __pyx_t_4 = __pyx_t_8;
      goto __pyx_L190_bool_binop_done;
    }
    __pyx_t_9 = PyObject_RichCompare(__pyx_v_window, __pyx_int_3, Py_GT); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 786, __pyx_L1_error)
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 786, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_4 = __pyx_t_8;
    __pyx_L190_bool_binop_done:;
    if (__pyx_t_4) {

      /* "aldy/indelpost/pileup.pyx":787
 *     else:
 *         if target.is_ins and window > 3:
 *             window = int(window/3)             # <<<<<<<<<<<<<<
 *             return retarget(
 *                         target,
 */
      __pyx_t_9 = __Pyx_PyInt_TrueDivideObjC(__pyx_v_window, __pyx_int_3, 3, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 787, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_3 = __Pyx_PyNumber_Int(__pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 787, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF_SET(__pyx_v_window, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "aldy/indelpost/pileup.pyx":788
 *         if target.is_ins and window > 3:
 *             window = int(window/3)
 *             return retarget(             # <<<<<<<<<<<<<<
 *                         target,
 *                         pileup,
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_retarget); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 788, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);

      /* "aldy/indelpost/pileup.pyx":800
 *                         gap_extension_penalty,
 *                         unspl_loc_ref,
 *                         require_exact_for_shiftable             # <<<<<<<<<<<<<<
 *                     )
 *         else:
 */
      __pyx_t_2 = NULL;
      __pyx_t_11 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_9);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_9, function);
          __pyx_t_11 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_9)) {
        PyObject *__pyx_temp[13] = {__pyx_t_2, __pyx_cur_scope->__pyx_v_target, __pyx_v_pileup, __pyx_v_window, __pyx_v_mapq4retarget, __pyx_v_within, __pyx_v_retargetcutoff, __pyx_v_match_score, __pyx_v_mismatch_penalty, __pyx_v_gap_open_penalty, __pyx_v_gap_extension_penalty, __pyx_v_unspl_loc_ref, __pyx_v_require_exact_for_shiftable};
        __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_11, 12+__pyx_t_11); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 788, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
        PyObject *__pyx_temp[13] = {__pyx_t_2, __pyx_cur_scope->__pyx_v_target, __pyx_v_pileup, __pyx_v_window, __pyx_v_mapq4retarget, __pyx_v_within, __pyx_v_retargetcutoff, __pyx_v_match_score, __pyx_v_mismatch_penalty, __pyx_v_gap_open_penalty, __pyx_v_gap_extension_penalty, __pyx_v_unspl_loc_ref, __pyx_v_require_exact_for_shiftable};
        __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_11, 12+__pyx_t_11); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 788, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      {
        __pyx_t_1 = PyTuple_New(12+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 788, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        if (__pyx_t_2) {
          __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); __pyx_t_2 = NULL;
        }
        __Pyx_INCREF(__pyx_cur_scope->__pyx_v_target);
        __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_target);
        PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_11, __pyx_cur_scope->__pyx_v_target);
        __Pyx_INCREF(__pyx_v_pileup);
        __Pyx_GIVEREF(__pyx_v_pileup);
        PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_11, __pyx_v_pileup);
        __Pyx_INCREF(__pyx_v_window);
        __Pyx_GIVEREF(__pyx_v_window);
        PyTuple_SET_ITEM(__pyx_t_1, 2+__pyx_t_11, __pyx_v_window);
        __Pyx_INCREF(__pyx_v_mapq4retarget);
        __Pyx_GIVEREF(__pyx_v_mapq4retarget);
        PyTuple_SET_ITEM(__pyx_t_1, 3+__pyx_t_11, __pyx_v_mapq4retarget);
        __Pyx_INCREF(__pyx_v_within);
        __Pyx_GIVEREF(__pyx_v_within);
        PyTuple_SET_ITEM(__pyx_t_1, 4+__pyx_t_11, __pyx_v_within);
        __Pyx_INCREF(__pyx_v_retargetcutoff);
        __Pyx_GIVEREF(__pyx_v_retargetcutoff);
        PyTuple_SET_ITEM(__pyx_t_1, 5+__pyx_t_11, __pyx_v_retargetcutoff);
        __Pyx_INCREF(__pyx_v_match_score);
        __Pyx_GIVEREF(__pyx_v_match_score);
        PyTuple_SET_ITEM(__pyx_t_1, 6+__pyx_t_11, __pyx_v_match_score);
        __Pyx_INCREF(__pyx_v_mismatch_penalty);
        __Pyx_GIVEREF(__pyx_v_mismatch_penalty);
        PyTuple_SET_ITEM(__pyx_t_1, 7+__pyx_t_11, __pyx_v_mismatch_penalty);
        __Pyx_INCREF(__pyx_v_gap_open_penalty);
        __Pyx_GIVEREF(__pyx_v_gap_open_penalty);
        PyTuple_SET_ITEM(__pyx_t_1, 8+__pyx_t_11, __pyx_v_gap_open_penalty);
        __Pyx_INCREF(__pyx_v_gap_extension_penalty);
        __Pyx_GIVEREF(__pyx_v_gap_extension_penalty);
        PyTuple_SET_ITEM(__pyx_t_1, 9+__pyx_t_11, __pyx_v_gap_extension_penalty);
        __Pyx_INCREF(__pyx_v_unspl_loc_ref);
        __Pyx_GIVEREF(__pyx_v_unspl_loc_ref);
        PyTuple_SET_ITEM(__pyx_t_1, 10+__pyx_t_11, __pyx_v_unspl_loc_ref);
        __Pyx_INCREF(__pyx_v_require_exact_for_shiftable);
        __Pyx_GIVEREF(__pyx_v_require_exact_for_shiftable);
        PyTuple_SET_ITEM(__pyx_t_1, 11+__pyx_t_11, __pyx_v_require_exact_for_shiftable);
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 788, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      }
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L0;

      /* "aldy/indelpost/pileup.pyx":786
 *             return None
 *     else:
 *         if target.is_ins and window > 3:             # <<<<<<<<<<<<<<
 *             window = int(window/3)
 *             return retarget(
 */
    }

    /* "aldy/indelpost/pileup.pyx":803
 *                     )
 *         else:
 *             return None             # <<<<<<<<<<<<<<
 * 
 * 
 */
    /*else*/ {
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
    }
  }

  /* "aldy/indelpost/pileup.pyx":577
 * 
 * 
 * def retarget(             # <<<<<<<<<<<<<<
 *     target,
 *     pileup,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_AddTraceback("aldy.indelpost.pileup.retarget", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_target_seq);
  __Pyx_XDECREF(__pyx_v_target_type);
  __Pyx_XDECREF(__pyx_v_target_pos);
  __Pyx_XDECREF(__pyx_v_non_refs);
  __Pyx_XDECREF(__pyx_v_cutoff);
  __Pyx_XDECREF(__pyx_v_tmp_non_refs);
  __Pyx_XDECREF(__pyx_v_ref_starts);
  __Pyx_XDECREF(__pyx_v_ref_alns);
  __Pyx_XDECREF(__pyx_v_ref_seqs);
  __Pyx_XDECREF(__pyx_v_aligners);
  __Pyx_XDECREF(__pyx_v_read);
  __Pyx_XDECREF(__pyx_v_ref_seq);
  __Pyx_XDECREF(__pyx_v_lt_len);
  __Pyx_XDECREF(__pyx_v_aligner);
  __Pyx_XDECREF(__pyx_v_complex_flags);
  __Pyx_XDECREF(__pyx_v_candidates);
  __Pyx_XDECREF(__pyx_v_candidate_reads);
  __Pyx_XDECREF(__pyx_v_candidate_ref_seqs);
  __Pyx_XDECREF(__pyx_v_candidate_ref_starts);
  __Pyx_XDECREF(__pyx_v_candidate_aligners);
  __Pyx_XDECREF(__pyx_v_aln);
  __Pyx_XDECREF(__pyx_v_ref_start);
  __Pyx_XDECREF(__pyx_v_genome_aln_pos);
  __Pyx_XDECREF(__pyx_v_aligned_read_len);
  __Pyx_XDECREF(__pyx_v_window_len);
  __Pyx_XDECREF(__pyx_v_aligned_frac);
  __Pyx_XDECREF(__pyx_v_gap_cnt);
  __Pyx_XDECREF(__pyx_v_indels);
  __Pyx_XDECREF(__pyx_v_positions);
  __Pyx_XDECREF(__pyx_v_complex_positions);
  __Pyx_XDECREF(__pyx_v_target_type_indels);
  __Pyx_XDECREF(__pyx_v_indel);
  __Pyx_XDECREF(__pyx_v_complex_del);
  __Pyx_XDECREF(__pyx_v_complex_ins);
  __Pyx_XDECREF(__pyx_v_ref);
  __Pyx_XDECREF(__pyx_v_alt);
  __Pyx_XDECREF((PyObject *)__pyx_v_var);
  __Pyx_XDECREF(__pyx_v_u_candidates);
  __Pyx_XDECREF(__pyx_v_candidate_seqs);
  __Pyx_XDECREF(__pyx_v_best_match);
  __Pyx_XDECREF(__pyx_v_best_seq);
  __Pyx_XDECREF(__pyx_v_idx);
  __Pyx_XDECREF(__pyx_v_hit);
  __Pyx_XDECREF(__pyx_v_idx2);
  __Pyx_XDECREF(__pyx_v_candidate);
  __Pyx_XDECREF(__pyx_v_complex_candidates);
  __Pyx_XDECREF(__pyx_v_cplx_candidate);
  __Pyx_XDECREF(__pyx_v_reduced);
  __Pyx_XDECREF(__pyx_9genexpr14__pyx_v_read_dict);
  __Pyx_XDECREF(__pyx_9genexpr15__pyx_v_read_dict);
  __Pyx_XDECREF(__pyx_9genexpr16__pyx_v_read_dict);
  __Pyx_XDECREF(__pyx_9genexpr17__pyx_v_read_dict);
  __Pyx_XDECREF(__pyx_9genexpr18__pyx_v_d);
  __Pyx_XDECREF(__pyx_9genexpr19__pyx_v_p);
  __Pyx_XDECREF(__pyx_9genexpr20__pyx_v_indel);
  __Pyx_XDECREF(__pyx_9genexpr21__pyx_v_jndel);
  __Pyx_XDECREF(__pyx_9genexpr22__pyx_v_jndel);
  __Pyx_XDECREF(__pyx_9genexpr23__pyx_v_var);
  __Pyx_XDECREF(__pyx_9genexpr24__pyx_v_var);
  __Pyx_XDECREF(__pyx_9genexpr25__pyx_v_i);
  __Pyx_XDECREF(__pyx_9genexpr25__pyx_v_var);
  __Pyx_XDECREF(__pyx_9genexpr26__pyx_v_var);
  __Pyx_XDECREF(__pyx_9genexpr27__pyx_v_i);
  __Pyx_XDECREF(__pyx_9genexpr27__pyx_v_var);
  __Pyx_XDECREF(__pyx_9genexpr28__pyx_v_i);
  __Pyx_XDECREF(__pyx_9genexpr29__pyx_v_i);
  __Pyx_XDECREF(__pyx_9genexpr30__pyx_v_i);
  __Pyx_XDECREF(__pyx_9genexpr31__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_window);
  __Pyx_XDECREF(__pyx_v_match_score);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "aldy/indelpost/pileup.pyx":806
 * 
 * 
 * def update_read_info(             # <<<<<<<<<<<<<<
 *     read,
 *     candidate,
 */

/* Python wrapper */
static PyObject *__pyx_pw_4aldy_9indelpost_6pileup_17update_read_info(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_4aldy_9indelpost_6pileup_17update_read_info = {"update_read_info", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4aldy_9indelpost_6pileup_17update_read_info, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4aldy_9indelpost_6pileup_17update_read_info(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_read = 0;
  PyObject *__pyx_v_candidate = 0;
  PyObject *__pyx_v_is_gapped_aln = 0;
  PyObject *__pyx_v_gap_open_penalty = 0;
  PyObject *__pyx_v_gap_extension_penalty = 0;
  PyObject *__pyx_v_aligner = 0;
  PyObject *__pyx_v_ref_seq = 0;
  PyObject *__pyx_v_ref_start = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("update_read_info (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_read,&__pyx_n_s_candidate,&__pyx_n_s_is_gapped_aln,&__pyx_n_s_gap_open_penalty,&__pyx_n_s_gap_extension_penalty,&__pyx_n_s_aligner,&__pyx_n_s_ref_seq,&__pyx_n_s_ref_start,0};
    PyObject* values[8] = {0,0,0,0,0,0,0,0};

    /* "aldy/indelpost/pileup.pyx":809
 *     read,
 *     candidate,
 *     is_gapped_aln=True,             # <<<<<<<<<<<<<<
 *     gap_open_penalty=3,
 *     gap_extension_penalty=1,
 */
    values[2] = ((PyObject *)Py_True);
    values[3] = ((PyObject *)__pyx_int_3);
    values[4] = ((PyObject *)__pyx_int_1);

    /* "aldy/indelpost/pileup.pyx":812
 *     gap_open_penalty=3,
 *     gap_extension_penalty=1,
 *     aligner=None,             # <<<<<<<<<<<<<<
 *     ref_seq=None,
 *     ref_start=None,
 */
    values[5] = ((PyObject *)Py_None);

    /* "aldy/indelpost/pileup.pyx":813
 *     gap_extension_penalty=1,
 *     aligner=None,
 *     ref_seq=None,             # <<<<<<<<<<<<<<
 *     ref_start=None,
 * ):
 */
    values[6] = ((PyObject *)Py_None);

    /* "aldy/indelpost/pileup.pyx":814
 *     aligner=None,
 *     ref_seq=None,
 *     ref_start=None,             # <<<<<<<<<<<<<<
 * ):
 *     if is_gapped_aln:
 */
    values[7] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_read)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_candidate)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("update_read_info", 0, 2, 8, 1); __PYX_ERR(0, 806, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_is_gapped_aln);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gap_open_penalty);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gap_extension_penalty);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_aligner);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ref_seq);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ref_start);
          if (value) { values[7] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "update_read_info") < 0)) __PYX_ERR(0, 806, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_read = values[0];
    __pyx_v_candidate = values[1];
    __pyx_v_is_gapped_aln = values[2];
    __pyx_v_gap_open_penalty = values[3];
    __pyx_v_gap_extension_penalty = values[4];
    __pyx_v_aligner = values[5];
    __pyx_v_ref_seq = values[6];
    __pyx_v_ref_start = values[7];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("update_read_info", 0, 2, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 806, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("aldy.indelpost.pileup.update_read_info", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4aldy_9indelpost_6pileup_16update_read_info(__pyx_self, __pyx_v_read, __pyx_v_candidate, __pyx_v_is_gapped_aln, __pyx_v_gap_open_penalty, __pyx_v_gap_extension_penalty, __pyx_v_aligner, __pyx_v_ref_seq, __pyx_v_ref_start);

  /* "aldy/indelpost/pileup.pyx":806
 * 
 * 
 * def update_read_info(             # <<<<<<<<<<<<<<
 *     read,
 *     candidate,
 */

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

static PyObject *__pyx_pf_4aldy_9indelpost_6pileup_16update_read_info(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_read, PyObject *__pyx_v_candidate, PyObject *__pyx_v_is_gapped_aln, PyObject *__pyx_v_gap_open_penalty, PyObject *__pyx_v_gap_extension_penalty, PyObject *__pyx_v_aligner, PyObject *__pyx_v_ref_seq, PyObject *__pyx_v_ref_start) {
  PyObject *__pyx_v_parsed = NULL;
  PyObject *__pyx_v_aln = NULL;
  PyObject *__pyx_v_genome_aln_pos = NULL;
  PyObject *__pyx_v_indels = NULL;
  int __pyx_v_is_found;
  PyObject *__pyx_v_indel = NULL;
  PyObject *__pyx_v_ref = NULL;
  PyObject *__pyx_v_alt = NULL;
  struct __pyx_obj_4aldy_9indelpost_7variant_Variant *__pyx_v_obj = NULL;
  PyObject *__pyx_v_indel_pos_in_this_read = NULL;
  PyObject *__pyx_v_realn_lt_cigar = NULL;
  PyObject *__pyx_v_realn_rt_cigar = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *(*__pyx_t_14)(PyObject *);
  PyObject *(*__pyx_t_15)(PyObject *);
  int __pyx_t_16;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("update_read_info", 0);

  /* "aldy/indelpost/pileup.pyx":816
 *     ref_start=None,
 * ):
 *     if is_gapped_aln:             # <<<<<<<<<<<<<<
 *         parsed = leftalign_indel_read(
 *             candidate.chrom,
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_is_gapped_aln); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 816, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "aldy/indelpost/pileup.pyx":818
 *     if is_gapped_aln:
 *         parsed = leftalign_indel_read(
 *             candidate.chrom,             # <<<<<<<<<<<<<<
 *             candidate.pos,
 *             len(candidate.indel_seq),
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_candidate, __pyx_n_s_chrom); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 818, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (!(likely(PyUnicode_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 818, __pyx_L1_error)

    /* "aldy/indelpost/pileup.pyx":819
 *         parsed = leftalign_indel_read(
 *             candidate.chrom,
 *             candidate.pos,             # <<<<<<<<<<<<<<
 *             len(candidate.indel_seq),
 *             candidate.variant_type,
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_candidate, __pyx_n_s_pos); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 819, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 819, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "aldy/indelpost/pileup.pyx":820
 *             candidate.chrom,
 *             candidate.pos,
 *             len(candidate.indel_seq),             # <<<<<<<<<<<<<<
 *             candidate.variant_type,
 *             read["cigar_string"],
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_candidate, __pyx_n_s_indel_seq); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 820, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 820, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "aldy/indelpost/pileup.pyx":821
 *             candidate.pos,
 *             len(candidate.indel_seq),
 *             candidate.variant_type,             # <<<<<<<<<<<<<<
 *             read["cigar_string"],
 *             read["read_start"],
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_candidate, __pyx_n_s_variant_type); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 821, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (!(likely(PyUnicode_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(0, 821, __pyx_L1_error)

    /* "aldy/indelpost/pileup.pyx":822
 *             len(candidate.indel_seq),
 *             candidate.variant_type,
 *             read["cigar_string"],             # <<<<<<<<<<<<<<
 *             read["read_start"],
 *             read["aln_start"],
 */
    __pyx_t_6 = __Pyx_PyObject_Dict_GetItem(__pyx_v_read, __pyx_n_u_cigar_string); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 822, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (!(likely(PyUnicode_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_6)->tp_name), 0))) __PYX_ERR(0, 822, __pyx_L1_error)

    /* "aldy/indelpost/pileup.pyx":823
 *             candidate.variant_type,
 *             read["cigar_string"],
 *             read["read_start"],             # <<<<<<<<<<<<<<
 *             read["aln_start"],
 *             read["read_seq"],
 */
    __pyx_t_7 = __Pyx_PyObject_Dict_GetItem(__pyx_v_read, __pyx_n_u_read_start); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 823, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_7); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 823, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "aldy/indelpost/pileup.pyx":824
 *             read["cigar_string"],
 *             read["read_start"],
 *             read["aln_start"],             # <<<<<<<<<<<<<<
 *             read["read_seq"],
 *             read["ref_seq"],
 */
    __pyx_t_7 = __Pyx_PyObject_Dict_GetItem(__pyx_v_read, __pyx_n_u_aln_start); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 824, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_7); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 824, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "aldy/indelpost/pileup.pyx":825
 *             read["read_start"],
 *             read["aln_start"],
 *             read["read_seq"],             # <<<<<<<<<<<<<<
 *             read["ref_seq"],
 *             read["read_qual"],
 */
    __pyx_t_7 = __Pyx_PyObject_Dict_GetItem(__pyx_v_read, __pyx_n_u_read_seq); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 825, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (!(likely(PyUnicode_CheckExact(__pyx_t_7))||((__pyx_t_7) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_7)->tp_name), 0))) __PYX_ERR(0, 825, __pyx_L1_error)

    /* "aldy/indelpost/pileup.pyx":826
 *             read["aln_start"],
 *             read["read_seq"],
 *             read["ref_seq"],             # <<<<<<<<<<<<<<
 *             read["read_qual"],
 *             candidate.reference,
 */
    __pyx_t_10 = __Pyx_PyObject_Dict_GetItem(__pyx_v_read, __pyx_n_u_ref_seq); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 826, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    if (!(likely(PyUnicode_CheckExact(__pyx_t_10))||((__pyx_t_10) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_10)->tp_name), 0))) __PYX_ERR(0, 826, __pyx_L1_error)

    /* "aldy/indelpost/pileup.pyx":827
 *             read["read_seq"],
 *             read["ref_seq"],
 *             read["read_qual"],             # <<<<<<<<<<<<<<
 *             candidate.reference,
 *         )
 */
    __pyx_t_11 = __Pyx_PyObject_Dict_GetItem(__pyx_v_read, __pyx_n_u_read_qual); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 827, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);

    /* "aldy/indelpost/pileup.pyx":828
 *             read["ref_seq"],
 *             read["read_qual"],
 *             candidate.reference,             # <<<<<<<<<<<<<<
 *         )
 *         read["lt_flank"] = parsed[1]
 */
    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_candidate, __pyx_n_s_reference); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 828, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_ptype_5pysam_9libcfaidx_FastaFile))))) __PYX_ERR(0, 828, __pyx_L1_error)

    /* "aldy/indelpost/pileup.pyx":817
 * ):
 *     if is_gapped_aln:
 *         parsed = leftalign_indel_read(             # <<<<<<<<<<<<<<
 *             candidate.chrom,
 *             candidate.pos,
 */
    __pyx_t_13 = __pyx_f_4aldy_9indelpost_6pileup_leftalign_indel_read(((PyObject*)__pyx_t_2), __pyx_t_4, __pyx_t_5, ((PyObject*)__pyx_t_3), ((PyObject*)__pyx_t_6), __pyx_t_8, __pyx_t_9, ((PyObject*)__pyx_t_7), ((PyObject*)__pyx_t_10), __pyx_t_11, ((struct __pyx_obj_5pysam_9libcfaidx_FastaFile *)__pyx_t_12)); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 817, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_v_parsed = ((PyObject*)__pyx_t_13);
    __pyx_t_13 = 0;

    /* "aldy/indelpost/pileup.pyx":830
 *             candidate.reference,
 *         )
 *         read["lt_flank"] = parsed[1]             # <<<<<<<<<<<<<<
 *         read["indel_seq"] = parsed[2] if candidate.is_ins else ""
 *         read["rt_flank"] = parsed[3]
 */
    if (unlikely(__pyx_v_parsed == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 830, __pyx_L1_error)
    }
    __pyx_t_13 = __Pyx_GetItemInt_Tuple(__pyx_v_parsed, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 830, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    if (unlikely(PyObject_SetItem(__pyx_v_read, __pyx_n_u_lt_flank, __pyx_t_13) < 0)) __PYX_ERR(0, 830, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

    /* "aldy/indelpost/pileup.pyx":831
 *         )
 *         read["lt_flank"] = parsed[1]
 *         read["indel_seq"] = parsed[2] if candidate.is_ins else ""             # <<<<<<<<<<<<<<
 *         read["rt_flank"] = parsed[3]
 *         read["lt_ref"] = parsed[4]
 */
    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_candidate, __pyx_n_s_is_ins); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 831, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 831, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    if (__pyx_t_1) {
      if (unlikely(__pyx_v_parsed == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 831, __pyx_L1_error)
      }
      __pyx_t_12 = __Pyx_GetItemInt_Tuple(__pyx_v_parsed, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 831, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_13 = __pyx_t_12;
      __pyx_t_12 = 0;
    } else {
      __Pyx_INCREF(__pyx_kp_u_);
      __pyx_t_13 = __pyx_kp_u_;
    }
    if (unlikely(PyObject_SetItem(__pyx_v_read, __pyx_n_u_indel_seq, __pyx_t_13) < 0)) __PYX_ERR(0, 831, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

    /* "aldy/indelpost/pileup.pyx":832
 *         read["lt_flank"] = parsed[1]
 *         read["indel_seq"] = parsed[2] if candidate.is_ins else ""
 *         read["rt_flank"] = parsed[3]             # <<<<<<<<<<<<<<
 *         read["lt_ref"] = parsed[4]
 *         read["rt_ref"] = parsed[5]
 */
    if (unlikely(__pyx_v_parsed == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 832, __pyx_L1_error)
    }
    __pyx_t_13 = __Pyx_GetItemInt_Tuple(__pyx_v_parsed, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 832, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    if (unlikely(PyObject_SetItem(__pyx_v_read, __pyx_n_u_rt_flank, __pyx_t_13) < 0)) __PYX_ERR(0, 832, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

    /* "aldy/indelpost/pileup.pyx":833
 *         read["indel_seq"] = parsed[2] if candidate.is_ins else ""
 *         read["rt_flank"] = parsed[3]
 *         read["lt_ref"] = parsed[4]             # <<<<<<<<<<<<<<
 *         read["rt_ref"] = parsed[5]
 *         read["lt_qual"] = parsed[6]
 */
    if (unlikely(__pyx_v_parsed == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 833, __pyx_L1_error)
    }
    __pyx_t_13 = __Pyx_GetItemInt_Tuple(__pyx_v_parsed, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 833, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    if (unlikely(PyObject_SetItem(__pyx_v_read, __pyx_n_u_lt_ref, __pyx_t_13) < 0)) __PYX_ERR(0, 833, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

    /* "aldy/indelpost/pileup.pyx":834
 *         read["rt_flank"] = parsed[3]
 *         read["lt_ref"] = parsed[4]
 *         read["rt_ref"] = parsed[5]             # <<<<<<<<<<<<<<
 *         read["lt_qual"] = parsed[6]
 *         read["rt_qual"] = parsed[7]
 */
    if (unlikely(__pyx_v_parsed == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 834, __pyx_L1_error)
    }
    __pyx_t_13 = __Pyx_GetItemInt_Tuple(__pyx_v_parsed, 5, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 834, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    if (unlikely(PyObject_SetItem(__pyx_v_read, __pyx_n_u_rt_ref, __pyx_t_13) < 0)) __PYX_ERR(0, 834, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

    /* "aldy/indelpost/pileup.pyx":835
 *         read["lt_ref"] = parsed[4]
 *         read["rt_ref"] = parsed[5]
 *         read["lt_qual"] = parsed[6]             # <<<<<<<<<<<<<<
 *         read["rt_qual"] = parsed[7]
 * 
 */
    if (unlikely(__pyx_v_parsed == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 835, __pyx_L1_error)
    }
    __pyx_t_13 = __Pyx_GetItemInt_Tuple(__pyx_v_parsed, 6, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 835, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    if (unlikely(PyObject_SetItem(__pyx_v_read, __pyx_n_u_lt_qual, __pyx_t_13) < 0)) __PYX_ERR(0, 835, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

    /* "aldy/indelpost/pileup.pyx":836
 *         read["rt_ref"] = parsed[5]
 *         read["lt_qual"] = parsed[6]
 *         read["rt_qual"] = parsed[7]             # <<<<<<<<<<<<<<
 * 
 *         read["lt_cigar"], read["rt_cigar"] = split_cigar(
 */
    if (unlikely(__pyx_v_parsed == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 836, __pyx_L1_error)
    }
    __pyx_t_13 = __Pyx_GetItemInt_Tuple(__pyx_v_parsed, 7, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 836, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    if (unlikely(PyObject_SetItem(__pyx_v_read, __pyx_n_u_rt_qual, __pyx_t_13) < 0)) __PYX_ERR(0, 836, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

    /* "aldy/indelpost/pileup.pyx":838
 *         read["rt_qual"] = parsed[7]
 * 
 *         read["lt_cigar"], read["rt_cigar"] = split_cigar(             # <<<<<<<<<<<<<<
 *             read["cigar_string"], candidate.pos, read["read_start"]
 *         )
 */
    __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_split_cigar); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 838, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);

    /* "aldy/indelpost/pileup.pyx":839
 * 
 *         read["lt_cigar"], read["rt_cigar"] = split_cigar(
 *             read["cigar_string"], candidate.pos, read["read_start"]             # <<<<<<<<<<<<<<
 *         )
 * 
 */
    __pyx_t_11 = __Pyx_PyObject_Dict_GetItem(__pyx_v_read, __pyx_n_u_cigar_string); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 839, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_candidate, __pyx_n_s_pos); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 839, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_7 = __Pyx_PyObject_Dict_GetItem(__pyx_v_read, __pyx_n_u_read_start); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 839, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_6 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_12);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_12, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_12)) {
      PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_t_11, __pyx_t_10, __pyx_t_7};
      __pyx_t_13 = __Pyx_PyFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 838, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_12)) {
      PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_t_11, __pyx_t_10, __pyx_t_7};
      __pyx_t_13 = __Pyx_PyCFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 838, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    #endif
    {
      __pyx_t_3 = PyTuple_New(3+__pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 838, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (__pyx_t_6) {
        __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6); __pyx_t_6 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_11);
      PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_9, __pyx_t_11);
      __Pyx_GIVEREF(__pyx_t_10);
      PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_9, __pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_3, 2+__pyx_t_9, __pyx_t_7);
      __pyx_t_11 = 0;
      __pyx_t_10 = 0;
      __pyx_t_7 = 0;
      __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_3, NULL); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 838, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_13))) || (PyList_CheckExact(__pyx_t_13))) {
      PyObject* sequence = __pyx_t_13;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 838, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_12 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_12 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_12);
      __Pyx_INCREF(__pyx_t_3);
      #else
      __pyx_t_12 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 838, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 838, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      #endif
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_13); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 838, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __pyx_t_14 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_12 = __pyx_t_14(__pyx_t_7); if (unlikely(!__pyx_t_12)) goto __pyx_L4_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_12);
      index = 1; __pyx_t_3 = __pyx_t_14(__pyx_t_7); if (unlikely(!__pyx_t_3)) goto __pyx_L4_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_14(__pyx_t_7), 2) < 0) __PYX_ERR(0, 838, __pyx_L1_error)
      __pyx_t_14 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L5_unpacking_done;
      __pyx_L4_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_14 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 838, __pyx_L1_error)
      __pyx_L5_unpacking_done:;
    }

    /* "aldy/indelpost/pileup.pyx":838
 *         read["rt_qual"] = parsed[7]
 * 
 *         read["lt_cigar"], read["rt_cigar"] = split_cigar(             # <<<<<<<<<<<<<<
 *             read["cigar_string"], candidate.pos, read["read_start"]
 *         )
 */
    if (unlikely(PyObject_SetItem(__pyx_v_read, __pyx_n_u_lt_cigar, __pyx_t_12) < 0)) __PYX_ERR(0, 838, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    if (unlikely(PyObject_SetItem(__pyx_v_read, __pyx_n_u_rt_cigar, __pyx_t_3) < 0)) __PYX_ERR(0, 838, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "aldy/indelpost/pileup.pyx":842
 *         )
 * 
 *         read["is_target"] = True             # <<<<<<<<<<<<<<
 *     else:
 *         aln = align(aligner, read["read_seq"], gap_open_penalty, gap_extension_penalty)
 */
    if (unlikely(PyObject_SetItem(__pyx_v_read, __pyx_n_u_is_target, Py_True) < 0)) __PYX_ERR(0, 842, __pyx_L1_error)

    /* "aldy/indelpost/pileup.pyx":816
 *     ref_start=None,
 * ):
 *     if is_gapped_aln:             # <<<<<<<<<<<<<<
 *         parsed = leftalign_indel_read(
 *             candidate.chrom,
 */
    goto __pyx_L3;
  }

  /* "aldy/indelpost/pileup.pyx":844
 *         read["is_target"] = True
 *     else:
 *         aln = align(aligner, read["read_seq"], gap_open_penalty, gap_extension_penalty)             # <<<<<<<<<<<<<<
 *         genome_aln_pos = ref_start + aln.reference_start
 * 
 */
  /*else*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_align); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 844, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_12 = __Pyx_PyObject_Dict_GetItem(__pyx_v_read, __pyx_n_u_read_seq); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 844, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_7 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_v_aligner, __pyx_t_12, __pyx_v_gap_open_penalty, __pyx_v_gap_extension_penalty};
      __pyx_t_13 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_9, 4+__pyx_t_9); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 844, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_v_aligner, __pyx_t_12, __pyx_v_gap_open_penalty, __pyx_v_gap_extension_penalty};
      __pyx_t_13 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_9, 4+__pyx_t_9); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 844, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    } else
    #endif
    {
      __pyx_t_10 = PyTuple_New(4+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 844, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      if (__pyx_t_7) {
        __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_7); __pyx_t_7 = NULL;
      }
      __Pyx_INCREF(__pyx_v_aligner);
      __Pyx_GIVEREF(__pyx_v_aligner);
      PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_v_aligner);
      __Pyx_GIVEREF(__pyx_t_12);
      PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_t_12);
      __Pyx_INCREF(__pyx_v_gap_open_penalty);
      __Pyx_GIVEREF(__pyx_v_gap_open_penalty);
      PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_9, __pyx_v_gap_open_penalty);
      __Pyx_INCREF(__pyx_v_gap_extension_penalty);
      __Pyx_GIVEREF(__pyx_v_gap_extension_penalty);
      PyTuple_SET_ITEM(__pyx_t_10, 3+__pyx_t_9, __pyx_v_gap_extension_penalty);
      __pyx_t_12 = 0;
      __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_10, NULL); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 844, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_aln = __pyx_t_13;
    __pyx_t_13 = 0;

    /* "aldy/indelpost/pileup.pyx":845
 *     else:
 *         aln = align(aligner, read["read_seq"], gap_open_penalty, gap_extension_penalty)
 *         genome_aln_pos = ref_start + aln.reference_start             # <<<<<<<<<<<<<<
 * 
 *         indels = findall_indels(
 */
    __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_aln, __pyx_n_s_reference_start); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 845, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_3 = PyNumber_Add(__pyx_v_ref_start, __pyx_t_13); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 845, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_v_genome_aln_pos = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "aldy/indelpost/pileup.pyx":847
 *         genome_aln_pos = ref_start + aln.reference_start
 * 
 *         indels = findall_indels(             # <<<<<<<<<<<<<<
 *             aln, genome_aln_pos, ref_seq, read["read_seq"], basequals=read["read_qual"]
 *         )
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_findall_indels); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 847, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);

    /* "aldy/indelpost/pileup.pyx":848
 * 
 *         indels = findall_indels(
 *             aln, genome_aln_pos, ref_seq, read["read_seq"], basequals=read["read_qual"]             # <<<<<<<<<<<<<<
 *         )
 * 
 */
    __pyx_t_13 = __Pyx_PyObject_Dict_GetItem(__pyx_v_read, __pyx_n_u_read_seq); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 848, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);

    /* "aldy/indelpost/pileup.pyx":847
 *         genome_aln_pos = ref_start + aln.reference_start
 * 
 *         indels = findall_indels(             # <<<<<<<<<<<<<<
 *             aln, genome_aln_pos, ref_seq, read["read_seq"], basequals=read["read_qual"]
 *         )
 */
    __pyx_t_10 = PyTuple_New(4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 847, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_INCREF(__pyx_v_aln);
    __Pyx_GIVEREF(__pyx_v_aln);
    PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_aln);
    __Pyx_INCREF(__pyx_v_genome_aln_pos);
    __Pyx_GIVEREF(__pyx_v_genome_aln_pos);
    PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_genome_aln_pos);
    __Pyx_INCREF(__pyx_v_ref_seq);
    __Pyx_GIVEREF(__pyx_v_ref_seq);
    PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_v_ref_seq);
    __Pyx_GIVEREF(__pyx_t_13);
    PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_t_13);
    __pyx_t_13 = 0;

    /* "aldy/indelpost/pileup.pyx":848
 * 
 *         indels = findall_indels(
 *             aln, genome_aln_pos, ref_seq, read["read_seq"], basequals=read["read_qual"]             # <<<<<<<<<<<<<<
 *         )
 * 
 */
    __pyx_t_13 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 848, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_12 = __Pyx_PyObject_Dict_GetItem(__pyx_v_read, __pyx_n_u_read_qual); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 848, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    if (PyDict_SetItem(__pyx_t_13, __pyx_n_s_basequals, __pyx_t_12) < 0) __PYX_ERR(0, 848, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

    /* "aldy/indelpost/pileup.pyx":847
 *         genome_aln_pos = ref_start + aln.reference_start
 * 
 *         indels = findall_indels(             # <<<<<<<<<<<<<<
 *             aln, genome_aln_pos, ref_seq, read["read_seq"], basequals=read["read_qual"]
 *         )
 */
    __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_10, __pyx_t_13); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 847, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_v_indels = __pyx_t_12;
    __pyx_t_12 = 0;

    /* "aldy/indelpost/pileup.pyx":851
 *         )
 * 
 *         is_found= False             # <<<<<<<<<<<<<<
 *         for indel in indels:
 *             if not indel.get("del_seq", False):
 */
    __pyx_v_is_found = 0;

    /* "aldy/indelpost/pileup.pyx":852
 * 
 *         is_found= False
 *         for indel in indels:             # <<<<<<<<<<<<<<
 *             if not indel.get("del_seq", False):
 *                 ref = indel["lt_ref"][-1]
 */
    if (likely(PyList_CheckExact(__pyx_v_indels)) || PyTuple_CheckExact(__pyx_v_indels)) {
      __pyx_t_12 = __pyx_v_indels; __Pyx_INCREF(__pyx_t_12); __pyx_t_5 = 0;
      __pyx_t_15 = NULL;
    } else {
      __pyx_t_5 = -1; __pyx_t_12 = PyObject_GetIter(__pyx_v_indels); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 852, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_15 = Py_TYPE(__pyx_t_12)->tp_iternext; if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 852, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_15)) {
        if (likely(PyList_CheckExact(__pyx_t_12))) {
          if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_12)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_13 = PyList_GET_ITEM(__pyx_t_12, __pyx_t_5); __Pyx_INCREF(__pyx_t_13); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 852, __pyx_L1_error)
          #else
          __pyx_t_13 = PySequence_ITEM(__pyx_t_12, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 852, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_13);
          #endif
        } else {
          if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_12)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_13 = PyTuple_GET_ITEM(__pyx_t_12, __pyx_t_5); __Pyx_INCREF(__pyx_t_13); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 852, __pyx_L1_error)
          #else
          __pyx_t_13 = PySequence_ITEM(__pyx_t_12, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 852, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_13);
          #endif
        }
      } else {
        __pyx_t_13 = __pyx_t_15(__pyx_t_12);
        if (unlikely(!__pyx_t_13)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 852, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_13);
      }
      __Pyx_XDECREF_SET(__pyx_v_indel, __pyx_t_13);
      __pyx_t_13 = 0;

      /* "aldy/indelpost/pileup.pyx":853
 *         is_found= False
 *         for indel in indels:
 *             if not indel.get("del_seq", False):             # <<<<<<<<<<<<<<
 *                 ref = indel["lt_ref"][-1]
 *                 alt = ref + indel["indel_seq"]
 */
      __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_indel, __pyx_n_s_get); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 853, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 853, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 853, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_16 = ((!__pyx_t_1) != 0);
      if (__pyx_t_16) {

        /* "aldy/indelpost/pileup.pyx":854
 *         for indel in indels:
 *             if not indel.get("del_seq", False):
 *                 ref = indel["lt_ref"][-1]             # <<<<<<<<<<<<<<
 *                 alt = ref + indel["indel_seq"]
 *             else:
 */
        __pyx_t_10 = __Pyx_PyObject_Dict_GetItem(__pyx_v_indel, __pyx_n_u_lt_ref); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 854, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_13 = __Pyx_GetItemInt(__pyx_t_10, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 854, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_XDECREF_SET(__pyx_v_ref, __pyx_t_13);
        __pyx_t_13 = 0;

        /* "aldy/indelpost/pileup.pyx":855
 *             if not indel.get("del_seq", False):
 *                 ref = indel["lt_ref"][-1]
 *                 alt = ref + indel["indel_seq"]             # <<<<<<<<<<<<<<
 *             else:
 *                 alt = indel["lt_ref"][-1]
 */
        __pyx_t_13 = __Pyx_PyObject_Dict_GetItem(__pyx_v_indel, __pyx_n_u_indel_seq); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 855, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        __pyx_t_10 = PyNumber_Add(__pyx_v_ref, __pyx_t_13); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 855, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_XDECREF_SET(__pyx_v_alt, __pyx_t_10);
        __pyx_t_10 = 0;

        /* "aldy/indelpost/pileup.pyx":853
 *         is_found= False
 *         for indel in indels:
 *             if not indel.get("del_seq", False):             # <<<<<<<<<<<<<<
 *                 ref = indel["lt_ref"][-1]
 *                 alt = ref + indel["indel_seq"]
 */
        goto __pyx_L8;
      }

      /* "aldy/indelpost/pileup.pyx":857
 *                 alt = ref + indel["indel_seq"]
 *             else:
 *                 alt = indel["lt_ref"][-1]             # <<<<<<<<<<<<<<
 *                 ref = alt + indel["del_seq"]
 * 
 */
      /*else*/ {
        __pyx_t_10 = __Pyx_PyObject_Dict_GetItem(__pyx_v_indel, __pyx_n_u_lt_ref); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 857, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_13 = __Pyx_GetItemInt(__pyx_t_10, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 857, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_XDECREF_SET(__pyx_v_alt, __pyx_t_13);
        __pyx_t_13 = 0;

        /* "aldy/indelpost/pileup.pyx":858
 *             else:
 *                 alt = indel["lt_ref"][-1]
 *                 ref = alt + indel["del_seq"]             # <<<<<<<<<<<<<<
 * 
 *             obj = Variant(candidate.chrom, indel["pos"], ref, alt, candidate.reference, skip_validation=True)
 */
        __pyx_t_13 = __Pyx_PyObject_Dict_GetItem(__pyx_v_indel, __pyx_n_u_del_seq); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 858, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        __pyx_t_10 = PyNumber_Add(__pyx_v_alt, __pyx_t_13); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 858, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_XDECREF_SET(__pyx_v_ref, __pyx_t_10);
        __pyx_t_10 = 0;
      }
      __pyx_L8:;

      /* "aldy/indelpost/pileup.pyx":860
 *                 ref = alt + indel["del_seq"]
 * 
 *             obj = Variant(candidate.chrom, indel["pos"], ref, alt, candidate.reference, skip_validation=True)             # <<<<<<<<<<<<<<
 *             if candidate == obj:
 *                 is_found = True
 */
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_candidate, __pyx_n_s_chrom); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 860, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_13 = __Pyx_PyObject_Dict_GetItem(__pyx_v_indel, __pyx_n_u_pos); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 860, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_candidate, __pyx_n_s_reference); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 860, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_7 = PyTuple_New(5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 860, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_10);
      PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_13);
      PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_13);
      __Pyx_INCREF(__pyx_v_ref);
      __Pyx_GIVEREF(__pyx_v_ref);
      PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_v_ref);
      __Pyx_INCREF(__pyx_v_alt);
      __Pyx_GIVEREF(__pyx_v_alt);
      PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_v_alt);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_7, 4, __pyx_t_3);
      __pyx_t_10 = 0;
      __pyx_t_13 = 0;
      __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 860, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_skip_validation, Py_True) < 0) __PYX_ERR(0, 860, __pyx_L1_error)
      __pyx_t_13 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4aldy_9indelpost_7variant_Variant), __pyx_t_7, __pyx_t_3); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 860, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF_SET(__pyx_v_obj, ((struct __pyx_obj_4aldy_9indelpost_7variant_Variant *)__pyx_t_13));
      __pyx_t_13 = 0;

      /* "aldy/indelpost/pileup.pyx":861
 * 
 *             obj = Variant(candidate.chrom, indel["pos"], ref, alt, candidate.reference, skip_validation=True)
 *             if candidate == obj:             # <<<<<<<<<<<<<<
 *                 is_found = True
 *                 indel_pos_in_this_read = indel["pos"]
 */
      __pyx_t_13 = PyObject_RichCompare(__pyx_v_candidate, ((PyObject *)__pyx_v_obj), Py_EQ); __Pyx_XGOTREF(__pyx_t_13); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 861, __pyx_L1_error)
      __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_13); if (unlikely(__pyx_t_16 < 0)) __PYX_ERR(0, 861, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      if (__pyx_t_16) {

        /* "aldy/indelpost/pileup.pyx":862
 *             obj = Variant(candidate.chrom, indel["pos"], ref, alt, candidate.reference, skip_validation=True)
 *             if candidate == obj:
 *                 is_found = True             # <<<<<<<<<<<<<<
 *                 indel_pos_in_this_read = indel["pos"]
 *                 break
 */
        __pyx_v_is_found = 1;

        /* "aldy/indelpost/pileup.pyx":863
 *             if candidate == obj:
 *                 is_found = True
 *                 indel_pos_in_this_read = indel["pos"]             # <<<<<<<<<<<<<<
 *                 break
 * 
 */
        __pyx_t_13 = __Pyx_PyObject_Dict_GetItem(__pyx_v_indel, __pyx_n_u_pos); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 863, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        __pyx_v_indel_pos_in_this_read = __pyx_t_13;
        __pyx_t_13 = 0;

        /* "aldy/indelpost/pileup.pyx":864
 *                 is_found = True
 *                 indel_pos_in_this_read = indel["pos"]
 *                 break             # <<<<<<<<<<<<<<
 * 
 *         if not is_found:
 */
        goto __pyx_L7_break;

        /* "aldy/indelpost/pileup.pyx":861
 * 
 *             obj = Variant(candidate.chrom, indel["pos"], ref, alt, candidate.reference, skip_validation=True)
 *             if candidate == obj:             # <<<<<<<<<<<<<<
 *                 is_found = True
 *                 indel_pos_in_this_read = indel["pos"]
 */
      }

      /* "aldy/indelpost/pileup.pyx":852
 * 
 *         is_found= False
 *         for indel in indels:             # <<<<<<<<<<<<<<
 *             if not indel.get("del_seq", False):
 *                 ref = indel["lt_ref"][-1]
 */
    }
    __pyx_L7_break:;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

    /* "aldy/indelpost/pileup.pyx":866
 *                 break
 * 
 *         if not is_found:             # <<<<<<<<<<<<<<
 *             read["cigar_updated"] = False
 *             return read
 */
    __pyx_t_16 = ((!(__pyx_v_is_found != 0)) != 0);
    if (__pyx_t_16) {

      /* "aldy/indelpost/pileup.pyx":867
 * 
 *         if not is_found:
 *             read["cigar_updated"] = False             # <<<<<<<<<<<<<<
 *             return read
 * 
 */
      if (unlikely(PyObject_SetItem(__pyx_v_read, __pyx_n_u_cigar_updated, Py_False) < 0)) __PYX_ERR(0, 867, __pyx_L1_error)

      /* "aldy/indelpost/pileup.pyx":868
 *         if not is_found:
 *             read["cigar_updated"] = False
 *             return read             # <<<<<<<<<<<<<<
 * 
 *         read["lt_flank"] = indel["lt_flank"]
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_read);
      __pyx_r = __pyx_v_read;
      goto __pyx_L0;

      /* "aldy/indelpost/pileup.pyx":866
 *                 break
 * 
 *         if not is_found:             # <<<<<<<<<<<<<<
 *             read["cigar_updated"] = False
 *             return read
 */
    }

    /* "aldy/indelpost/pileup.pyx":870
 *             return read
 * 
 *         read["lt_flank"] = indel["lt_flank"]             # <<<<<<<<<<<<<<
 *         read["indel_seq"] = candidate.indel_seq if candidate.is_ins else ""
 *         read["rt_flank"] = indel["rt_flank"]
 */
    if (unlikely(!__pyx_v_indel)) { __Pyx_RaiseUnboundLocalError("indel"); __PYX_ERR(0, 870, __pyx_L1_error) }
    __pyx_t_12 = __Pyx_PyObject_Dict_GetItem(__pyx_v_indel, __pyx_n_u_lt_flank); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 870, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    if (unlikely(PyObject_SetItem(__pyx_v_read, __pyx_n_u_lt_flank, __pyx_t_12) < 0)) __PYX_ERR(0, 870, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

    /* "aldy/indelpost/pileup.pyx":871
 * 
 *         read["lt_flank"] = indel["lt_flank"]
 *         read["indel_seq"] = candidate.indel_seq if candidate.is_ins else ""             # <<<<<<<<<<<<<<
 *         read["rt_flank"] = indel["rt_flank"]
 *         read["lt_qual"] = indel["lt_qual"]
 */
    __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_candidate, __pyx_n_s_is_ins); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 871, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_13); if (unlikely(__pyx_t_16 < 0)) __PYX_ERR(0, 871, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    if (__pyx_t_16) {
      __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_candidate, __pyx_n_s_indel_seq); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 871, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __pyx_t_12 = __pyx_t_13;
      __pyx_t_13 = 0;
    } else {
      __Pyx_INCREF(__pyx_kp_u_);
      __pyx_t_12 = __pyx_kp_u_;
    }
    if (unlikely(PyObject_SetItem(__pyx_v_read, __pyx_n_u_indel_seq, __pyx_t_12) < 0)) __PYX_ERR(0, 871, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

    /* "aldy/indelpost/pileup.pyx":872
 *         read["lt_flank"] = indel["lt_flank"]
 *         read["indel_seq"] = candidate.indel_seq if candidate.is_ins else ""
 *         read["rt_flank"] = indel["rt_flank"]             # <<<<<<<<<<<<<<
 *         read["lt_qual"] = indel["lt_qual"]
 *         read["rt_qual"] = indel["rt_qual"]
 */
    if (unlikely(!__pyx_v_indel)) { __Pyx_RaiseUnboundLocalError("indel"); __PYX_ERR(0, 872, __pyx_L1_error) }
    __pyx_t_12 = __Pyx_PyObject_Dict_GetItem(__pyx_v_indel, __pyx_n_u_rt_flank); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 872, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    if (unlikely(PyObject_SetItem(__pyx_v_read, __pyx_n_u_rt_flank, __pyx_t_12) < 0)) __PYX_ERR(0, 872, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

    /* "aldy/indelpost/pileup.pyx":873
 *         read["indel_seq"] = candidate.indel_seq if candidate.is_ins else ""
 *         read["rt_flank"] = indel["rt_flank"]
 *         read["lt_qual"] = indel["lt_qual"]             # <<<<<<<<<<<<<<
 *         read["rt_qual"] = indel["rt_qual"]
 * 
 */
    if (unlikely(!__pyx_v_indel)) { __Pyx_RaiseUnboundLocalError("indel"); __PYX_ERR(0, 873, __pyx_L1_error) }
    __pyx_t_12 = __Pyx_PyObject_Dict_GetItem(__pyx_v_indel, __pyx_n_u_lt_qual); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 873, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    if (unlikely(PyObject_SetItem(__pyx_v_read, __pyx_n_u_lt_qual, __pyx_t_12) < 0)) __PYX_ERR(0, 873, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

    /* "aldy/indelpost/pileup.pyx":874
 *         read["rt_flank"] = indel["rt_flank"]
 *         read["lt_qual"] = indel["lt_qual"]
 *         read["rt_qual"] = indel["rt_qual"]             # <<<<<<<<<<<<<<
 * 
 *         realn_lt_cigar, realn_rt_cigar = split_cigar(
 */
    if (unlikely(!__pyx_v_indel)) { __Pyx_RaiseUnboundLocalError("indel"); __PYX_ERR(0, 874, __pyx_L1_error) }
    __pyx_t_12 = __Pyx_PyObject_Dict_GetItem(__pyx_v_indel, __pyx_n_u_rt_qual); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 874, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    if (unlikely(PyObject_SetItem(__pyx_v_read, __pyx_n_u_rt_qual, __pyx_t_12) < 0)) __PYX_ERR(0, 874, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

    /* "aldy/indelpost/pileup.pyx":876
 *         read["rt_qual"] = indel["rt_qual"]
 * 
 *         realn_lt_cigar, realn_rt_cigar = split_cigar(             # <<<<<<<<<<<<<<
 *             make_insertion_first(aln.CIGAR), indel["pos"], genome_aln_pos
 *         )
 */
    __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_split_cigar); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 876, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);

    /* "aldy/indelpost/pileup.pyx":877
 * 
 *         realn_lt_cigar, realn_rt_cigar = split_cigar(
 *             make_insertion_first(aln.CIGAR), indel["pos"], genome_aln_pos             # <<<<<<<<<<<<<<
 *         )
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_make_insertion_first); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 877, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_aln, __pyx_n_s_CIGAR); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 877, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_11 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_11)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_11);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_3 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_11, __pyx_t_10) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_10);
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 877, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_v_indel)) { __Pyx_RaiseUnboundLocalError("indel"); __PYX_ERR(0, 877, __pyx_L1_error) }
    __pyx_t_7 = __Pyx_PyObject_Dict_GetItem(__pyx_v_indel, __pyx_n_u_pos); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 877, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_10 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_13))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_13);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_13, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_13)) {
      PyObject *__pyx_temp[4] = {__pyx_t_10, __pyx_t_3, __pyx_t_7, __pyx_v_genome_aln_pos};
      __pyx_t_12 = __Pyx_PyFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 876, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_13)) {
      PyObject *__pyx_temp[4] = {__pyx_t_10, __pyx_t_3, __pyx_t_7, __pyx_v_genome_aln_pos};
      __pyx_t_12 = __Pyx_PyCFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 876, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    #endif
    {
      __pyx_t_11 = PyTuple_New(3+__pyx_t_9); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 876, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      if (__pyx_t_10) {
        __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_10); __pyx_t_10 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_9, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_9, __pyx_t_7);
      __Pyx_INCREF(__pyx_v_genome_aln_pos);
      __Pyx_GIVEREF(__pyx_v_genome_aln_pos);
      PyTuple_SET_ITEM(__pyx_t_11, 2+__pyx_t_9, __pyx_v_genome_aln_pos);
      __pyx_t_3 = 0;
      __pyx_t_7 = 0;
      __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_11, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 876, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    }
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_12))) || (PyList_CheckExact(__pyx_t_12))) {
      PyObject* sequence = __pyx_t_12;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 876, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_13 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_11 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_13 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_11 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_13);
      __Pyx_INCREF(__pyx_t_11);
      #else
      __pyx_t_13 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 876, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __pyx_t_11 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 876, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      #endif
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_12); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 876, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_14 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_13 = __pyx_t_14(__pyx_t_7); if (unlikely(!__pyx_t_13)) goto __pyx_L11_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_13);
      index = 1; __pyx_t_11 = __pyx_t_14(__pyx_t_7); if (unlikely(!__pyx_t_11)) goto __pyx_L11_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_11);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_14(__pyx_t_7), 2) < 0) __PYX_ERR(0, 876, __pyx_L1_error)
      __pyx_t_14 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L12_unpacking_done;
      __pyx_L11_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_14 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 876, __pyx_L1_error)
      __pyx_L12_unpacking_done:;
    }

    /* "aldy/indelpost/pileup.pyx":876
 *         read["rt_qual"] = indel["rt_qual"]
 * 
 *         realn_lt_cigar, realn_rt_cigar = split_cigar(             # <<<<<<<<<<<<<<
 *             make_insertion_first(aln.CIGAR), indel["pos"], genome_aln_pos
 *         )
 */
    __pyx_v_realn_lt_cigar = __pyx_t_13;
    __pyx_t_13 = 0;
    __pyx_v_realn_rt_cigar = __pyx_t_11;
    __pyx_t_11 = 0;

    /* "aldy/indelpost/pileup.pyx":880
 *         )
 * 
 *         read["lt_ref"] = trim_ref_flank(indel["lt_ref"], realn_lt_cigar, left=True)             # <<<<<<<<<<<<<<
 *         read["rt_ref"] = trim_ref_flank(indel["rt_ref"], realn_rt_cigar, left=False)
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_trim_ref_flank); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 880, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    if (unlikely(!__pyx_v_indel)) { __Pyx_RaiseUnboundLocalError("indel"); __PYX_ERR(0, 880, __pyx_L1_error) }
    __pyx_t_11 = __Pyx_PyObject_Dict_GetItem(__pyx_v_indel, __pyx_n_u_lt_ref); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 880, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 880, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_GIVEREF(__pyx_t_11);
    PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_11);
    __Pyx_INCREF(__pyx_v_realn_lt_cigar);
    __Pyx_GIVEREF(__pyx_v_realn_lt_cigar);
    PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_v_realn_lt_cigar);
    __pyx_t_11 = 0;
    __pyx_t_11 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 880, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_left, Py_True) < 0) __PYX_ERR(0, 880, __pyx_L1_error)
    __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_13, __pyx_t_11); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 880, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    if (unlikely(PyObject_SetItem(__pyx_v_read, __pyx_n_u_lt_ref, __pyx_t_7) < 0)) __PYX_ERR(0, 880, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "aldy/indelpost/pileup.pyx":881
 * 
 *         read["lt_ref"] = trim_ref_flank(indel["lt_ref"], realn_lt_cigar, left=True)
 *         read["rt_ref"] = trim_ref_flank(indel["rt_ref"], realn_rt_cigar, left=False)             # <<<<<<<<<<<<<<
 * 
 *         read["lt_cigar"] = update_cigar(
 */
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_trim_ref_flank); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 881, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (unlikely(!__pyx_v_indel)) { __Pyx_RaiseUnboundLocalError("indel"); __PYX_ERR(0, 881, __pyx_L1_error) }
    __pyx_t_11 = __Pyx_PyObject_Dict_GetItem(__pyx_v_indel, __pyx_n_u_rt_ref); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 881, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 881, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_GIVEREF(__pyx_t_11);
    PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_11);
    __Pyx_INCREF(__pyx_v_realn_rt_cigar);
    __Pyx_GIVEREF(__pyx_v_realn_rt_cigar);
    PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_v_realn_rt_cigar);
    __pyx_t_11 = 0;
    __pyx_t_11 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 881, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_left, Py_False) < 0) __PYX_ERR(0, 881, __pyx_L1_error)
    __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_13, __pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 881, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    if (unlikely(PyObject_SetItem(__pyx_v_read, __pyx_n_u_rt_ref, __pyx_t_12) < 0)) __PYX_ERR(0, 881, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

    /* "aldy/indelpost/pileup.pyx":883
 *         read["rt_ref"] = trim_ref_flank(indel["rt_ref"], realn_rt_cigar, left=False)
 * 
 *         read["lt_cigar"] = update_cigar(             # <<<<<<<<<<<<<<
 *             read["cigar_string"],
 *             realn_lt_cigar,
 */
    __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_update_cigar); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 883, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);

    /* "aldy/indelpost/pileup.pyx":884
 * 
 *         read["lt_cigar"] = update_cigar(
 *             read["cigar_string"],             # <<<<<<<<<<<<<<
 *             realn_lt_cigar,
 *             read["read_start"],
 */
    __pyx_t_11 = __Pyx_PyObject_Dict_GetItem(__pyx_v_read, __pyx_n_u_cigar_string); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 884, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);

    /* "aldy/indelpost/pileup.pyx":886
 *             read["cigar_string"],
 *             realn_lt_cigar,
 *             read["read_start"],             # <<<<<<<<<<<<<<
 *             read["splice_pattern"],
 *             indel["lt_clipped"],
 */
    __pyx_t_13 = __Pyx_PyObject_Dict_GetItem(__pyx_v_read, __pyx_n_u_read_start); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 886, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);

    /* "aldy/indelpost/pileup.pyx":887
 *             realn_lt_cigar,
 *             read["read_start"],
 *             read["splice_pattern"],             # <<<<<<<<<<<<<<
 *             indel["lt_clipped"],
 *             left=True,
 */
    __pyx_t_7 = __Pyx_PyObject_Dict_GetItem(__pyx_v_read, __pyx_n_u_splice_pattern); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 887, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);

    /* "aldy/indelpost/pileup.pyx":888
 *             read["read_start"],
 *             read["splice_pattern"],
 *             indel["lt_clipped"],             # <<<<<<<<<<<<<<
 *             left=True,
 *         )
 */
    if (unlikely(!__pyx_v_indel)) { __Pyx_RaiseUnboundLocalError("indel"); __PYX_ERR(0, 888, __pyx_L1_error) }
    __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_v_indel, __pyx_n_u_lt_clipped); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 888, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);

    /* "aldy/indelpost/pileup.pyx":883
 *         read["rt_ref"] = trim_ref_flank(indel["rt_ref"], realn_rt_cigar, left=False)
 * 
 *         read["lt_cigar"] = update_cigar(             # <<<<<<<<<<<<<<
 *             read["cigar_string"],
 *             realn_lt_cigar,
 */
    __pyx_t_10 = PyTuple_New(5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 883, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_GIVEREF(__pyx_t_11);
    PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_11);
    __Pyx_INCREF(__pyx_v_realn_lt_cigar);
    __Pyx_GIVEREF(__pyx_v_realn_lt_cigar);
    PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_realn_lt_cigar);
    __Pyx_GIVEREF(__pyx_t_13);
    PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_13);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_10, 4, __pyx_t_3);
    __pyx_t_11 = 0;
    __pyx_t_13 = 0;
    __pyx_t_7 = 0;
    __pyx_t_3 = 0;

    /* "aldy/indelpost/pileup.pyx":889
 *             read["splice_pattern"],
 *             indel["lt_clipped"],
 *             left=True,             # <<<<<<<<<<<<<<
 *         )
 *         read["rt_cigar"] = update_cigar(
 */
    __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 889, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_left, Py_True) < 0) __PYX_ERR(0, 889, __pyx_L1_error)

    /* "aldy/indelpost/pileup.pyx":883
 *         read["rt_ref"] = trim_ref_flank(indel["rt_ref"], realn_rt_cigar, left=False)
 * 
 *         read["lt_cigar"] = update_cigar(             # <<<<<<<<<<<<<<
 *             read["cigar_string"],
 *             realn_lt_cigar,
 */
    __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_10, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 883, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(PyObject_SetItem(__pyx_v_read, __pyx_n_u_lt_cigar, __pyx_t_7) < 0)) __PYX_ERR(0, 883, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "aldy/indelpost/pileup.pyx":891
 *             left=True,
 *         )
 *         read["rt_cigar"] = update_cigar(             # <<<<<<<<<<<<<<
 *             read["cigar_string"],
 *             realn_rt_cigar,
 */
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_update_cigar); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 891, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);

    /* "aldy/indelpost/pileup.pyx":892
 *         )
 *         read["rt_cigar"] = update_cigar(
 *             read["cigar_string"],             # <<<<<<<<<<<<<<
 *             realn_rt_cigar,
 *             candidate.pos,
 */
    __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_v_read, __pyx_n_u_cigar_string); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 892, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);

    /* "aldy/indelpost/pileup.pyx":894
 *             read["cigar_string"],
 *             realn_rt_cigar,
 *             candidate.pos,             # <<<<<<<<<<<<<<
 *             read["splice_pattern"],
 *             indel["rt_clipped"],
 */
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_candidate, __pyx_n_s_pos); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 894, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);

    /* "aldy/indelpost/pileup.pyx":895
 *             realn_rt_cigar,
 *             candidate.pos,
 *             read["splice_pattern"],             # <<<<<<<<<<<<<<
 *             indel["rt_clipped"],
 *             left=False,
 */
    __pyx_t_12 = __Pyx_PyObject_Dict_GetItem(__pyx_v_read, __pyx_n_u_splice_pattern); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 895, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);

    /* "aldy/indelpost/pileup.pyx":896
 *             candidate.pos,
 *             read["splice_pattern"],
 *             indel["rt_clipped"],             # <<<<<<<<<<<<<<
 *             left=False,
 *         )
 */
    if (unlikely(!__pyx_v_indel)) { __Pyx_RaiseUnboundLocalError("indel"); __PYX_ERR(0, 896, __pyx_L1_error) }
    __pyx_t_13 = __Pyx_PyObject_Dict_GetItem(__pyx_v_indel, __pyx_n_u_rt_clipped); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 896, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);

    /* "aldy/indelpost/pileup.pyx":891
 *             left=True,
 *         )
 *         read["rt_cigar"] = update_cigar(             # <<<<<<<<<<<<<<
 *             read["cigar_string"],
 *             realn_rt_cigar,
 */
    __pyx_t_11 = PyTuple_New(5); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 891, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3);
    __Pyx_INCREF(__pyx_v_realn_rt_cigar);
    __Pyx_GIVEREF(__pyx_v_realn_rt_cigar);
    PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_v_realn_rt_cigar);
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_t_10);
    __Pyx_GIVEREF(__pyx_t_12);
    PyTuple_SET_ITEM(__pyx_t_11, 3, __pyx_t_12);
    __Pyx_GIVEREF(__pyx_t_13);
    PyTuple_SET_ITEM(__pyx_t_11, 4, __pyx_t_13);
    __pyx_t_3 = 0;
    __pyx_t_10 = 0;
    __pyx_t_12 = 0;
    __pyx_t_13 = 0;

    /* "aldy/indelpost/pileup.pyx":897
 *             read["splice_pattern"],
 *             indel["rt_clipped"],
 *             left=False,             # <<<<<<<<<<<<<<
 *         )
 * 
 */
    __pyx_t_13 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 897, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    if (PyDict_SetItem(__pyx_t_13, __pyx_n_s_left, Py_False) < 0) __PYX_ERR(0, 897, __pyx_L1_error)

    /* "aldy/indelpost/pileup.pyx":891
 *             left=True,
 *         )
 *         read["rt_cigar"] = update_cigar(             # <<<<<<<<<<<<<<
 *             read["cigar_string"],
 *             realn_rt_cigar,
 */
    __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_11, __pyx_t_13); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 891, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    if (unlikely(PyObject_SetItem(__pyx_v_read, __pyx_n_u_rt_cigar, __pyx_t_12) < 0)) __PYX_ERR(0, 891, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

    /* "aldy/indelpost/pileup.pyx":900
 *         )
 * 
 *         read["cigar_list"] = read["lt_cigar"] + read["rt_cigar"]             # <<<<<<<<<<<<<<
 *         read["cigar_string"] = "".join(read["cigar_list"])
 *         read["cigar_updated"] = True
 */
    __pyx_t_12 = __Pyx_PyObject_Dict_GetItem(__pyx_v_read, __pyx_n_u_lt_cigar); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 900, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_13 = __Pyx_PyObject_Dict_GetItem(__pyx_v_read, __pyx_n_u_rt_cigar); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 900, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_11 = PyNumber_Add(__pyx_t_12, __pyx_t_13); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 900, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    if (unlikely(PyObject_SetItem(__pyx_v_read, __pyx_n_u_cigar_list, __pyx_t_11) < 0)) __PYX_ERR(0, 900, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

    /* "aldy/indelpost/pileup.pyx":901
 * 
 *         read["cigar_list"] = read["lt_cigar"] + read["rt_cigar"]
 *         read["cigar_string"] = "".join(read["cigar_list"])             # <<<<<<<<<<<<<<
 *         read["cigar_updated"] = True
 * 
 */
    __pyx_t_11 = __Pyx_PyObject_Dict_GetItem(__pyx_v_read, __pyx_n_u_cigar_list); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 901, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_13 = PyUnicode_Join(__pyx_kp_u_, __pyx_t_11); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 901, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    if (unlikely(PyObject_SetItem(__pyx_v_read, __pyx_n_u_cigar_string, __pyx_t_13) < 0)) __PYX_ERR(0, 901, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

    /* "aldy/indelpost/pileup.pyx":902
 *         read["cigar_list"] = read["lt_cigar"] + read["rt_cigar"]
 *         read["cigar_string"] = "".join(read["cigar_list"])
 *         read["cigar_updated"] = True             # <<<<<<<<<<<<<<
 * 
 *         update_read_positions(read, indel_pos_in_this_read)
 */
    if (unlikely(PyObject_SetItem(__pyx_v_read, __pyx_n_u_cigar_updated, Py_True) < 0)) __PYX_ERR(0, 902, __pyx_L1_error)

    /* "aldy/indelpost/pileup.pyx":904
 *         read["cigar_updated"] = True
 * 
 *         update_read_positions(read, indel_pos_in_this_read)             # <<<<<<<<<<<<<<
 * 
 *         read["is_target"] = True
 */
    __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_update_read_positions); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 904, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    if (unlikely(!__pyx_v_indel_pos_in_this_read)) { __Pyx_RaiseUnboundLocalError("indel_pos_in_this_read"); __PYX_ERR(0, 904, __pyx_L1_error) }
    __pyx_t_12 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) {
      __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_11);
      if (likely(__pyx_t_12)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
        __Pyx_INCREF(__pyx_t_12);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_11, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_11)) {
      PyObject *__pyx_temp[3] = {__pyx_t_12, __pyx_v_read, __pyx_v_indel_pos_in_this_read};
      __pyx_t_13 = __Pyx_PyFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 904, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_GOTREF(__pyx_t_13);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_11)) {
      PyObject *__pyx_temp[3] = {__pyx_t_12, __pyx_v_read, __pyx_v_indel_pos_in_this_read};
      __pyx_t_13 = __Pyx_PyCFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 904, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_GOTREF(__pyx_t_13);
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 904, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (__pyx_t_12) {
        __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_12); __pyx_t_12 = NULL;
      }
      __Pyx_INCREF(__pyx_v_read);
      __Pyx_GIVEREF(__pyx_v_read);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_9, __pyx_v_read);
      __Pyx_INCREF(__pyx_v_indel_pos_in_this_read);
      __Pyx_GIVEREF(__pyx_v_indel_pos_in_this_read);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_9, __pyx_v_indel_pos_in_this_read);
      __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_7, NULL); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 904, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

    /* "aldy/indelpost/pileup.pyx":906
 *         update_read_positions(read, indel_pos_in_this_read)
 * 
 *         read["is_target"] = True             # <<<<<<<<<<<<<<
 * 
 *     return read
 */
    if (unlikely(PyObject_SetItem(__pyx_v_read, __pyx_n_u_is_target, Py_True) < 0)) __PYX_ERR(0, 906, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "aldy/indelpost/pileup.pyx":908
 *         read["is_target"] = True
 * 
 *     return read             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_read);
  __pyx_r = __pyx_v_read;
  goto __pyx_L0;

  /* "aldy/indelpost/pileup.pyx":806
 * 
 * 
 * def update_read_info(             # <<<<<<<<<<<<<<
 *     read,
 *     candidate,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("aldy.indelpost.pileup.update_read_info", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_parsed);
  __Pyx_XDECREF(__pyx_v_aln);
  __Pyx_XDECREF(__pyx_v_genome_aln_pos);
  __Pyx_XDECREF(__pyx_v_indels);
  __Pyx_XDECREF(__pyx_v_indel);
  __Pyx_XDECREF(__pyx_v_ref);
  __Pyx_XDECREF(__pyx_v_alt);
  __Pyx_XDECREF((PyObject *)__pyx_v_obj);
  __Pyx_XDECREF(__pyx_v_indel_pos_in_this_read);
  __Pyx_XDECREF(__pyx_v_realn_lt_cigar);
  __Pyx_XDECREF(__pyx_v_realn_rt_cigar);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "aldy/indelpost/pileup.pyx":911
 * 
 * 
 * def trim_ref_flank(ref_flank, flank_cigar, left):             # <<<<<<<<<<<<<<
 * 
 *     cum = sum([int(c[:-1]) for c in flank_cigar if c[-1] != "I"])
 */

/* Python wrapper */
static PyObject *__pyx_pw_4aldy_9indelpost_6pileup_19trim_ref_flank(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_4aldy_9indelpost_6pileup_19trim_ref_flank = {"trim_ref_flank", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4aldy_9indelpost_6pileup_19trim_ref_flank, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4aldy_9indelpost_6pileup_19trim_ref_flank(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_ref_flank = 0;
  PyObject *__pyx_v_flank_cigar = 0;
  PyObject *__pyx_v_left = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("trim_ref_flank (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ref_flank,&__pyx_n_s_flank_cigar,&__pyx_n_s_left,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ref_flank)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flank_cigar)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("trim_ref_flank", 1, 3, 3, 1); __PYX_ERR(0, 911, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_left)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("trim_ref_flank", 1, 3, 3, 2); __PYX_ERR(0, 911, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "trim_ref_flank") < 0)) __PYX_ERR(0, 911, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_ref_flank = values[0];
    __pyx_v_flank_cigar = values[1];
    __pyx_v_left = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("trim_ref_flank", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 911, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("aldy.indelpost.pileup.trim_ref_flank", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4aldy_9indelpost_6pileup_18trim_ref_flank(__pyx_self, __pyx_v_ref_flank, __pyx_v_flank_cigar, __pyx_v_left);

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

static PyObject *__pyx_pf_4aldy_9indelpost_6pileup_18trim_ref_flank(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_ref_flank, PyObject *__pyx_v_flank_cigar, PyObject *__pyx_v_left) {
  PyObject *__pyx_v_cum = NULL;
  PyObject *__pyx_9genexpr32__pyx_v_c = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("trim_ref_flank", 0);
  __Pyx_INCREF(__pyx_v_ref_flank);

  /* "aldy/indelpost/pileup.pyx":913
 * def trim_ref_flank(ref_flank, flank_cigar, left):
 * 
 *     cum = sum([int(c[:-1]) for c in flank_cigar if c[-1] != "I"])             # <<<<<<<<<<<<<<
 *     if left:
 *         ref_flank = ref_flank[-cum:]
 */
  { /* enter inner scope */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 913, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (likely(PyList_CheckExact(__pyx_v_flank_cigar)) || PyTuple_CheckExact(__pyx_v_flank_cigar)) {
      __pyx_t_2 = __pyx_v_flank_cigar; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
      __pyx_t_4 = NULL;
    } else {
      __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_flank_cigar); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 913, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 913, __pyx_L5_error)
    }
    for (;;) {
      if (likely(!__pyx_t_4)) {
        if (likely(PyList_CheckExact(__pyx_t_2))) {
          if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 913, __pyx_L5_error)
          #else
          __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 913, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_5);
          #endif
        } else {
          if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 913, __pyx_L5_error)
          #else
          __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 913, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_5);
          #endif
        }
      } else {
        __pyx_t_5 = __pyx_t_4(__pyx_t_2);
        if (unlikely(!__pyx_t_5)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 913, __pyx_L5_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_5);
      }
      __Pyx_XDECREF_SET(__pyx_9genexpr32__pyx_v_c, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_GetItemInt(__pyx_9genexpr32__pyx_v_c, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 913, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_t_5, __pyx_n_u_I, Py_NE)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 913, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_6) {
        __pyx_t_5 = __Pyx_PyObject_GetSlice(__pyx_9genexpr32__pyx_v_c, 0, -1L, NULL, NULL, &__pyx_slice__4, 0, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 913, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_7 = __Pyx_PyNumber_Int(__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 913, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_7))) __PYX_ERR(0, 913, __pyx_L5_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_9genexpr32__pyx_v_c); __pyx_9genexpr32__pyx_v_c = 0;
    goto __pyx_L9_exit_scope;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_9genexpr32__pyx_v_c); __pyx_9genexpr32__pyx_v_c = 0;
    goto __pyx_L1_error;
    __pyx_L9_exit_scope:;
  } /* exit inner scope */
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_sum, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 913, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_cum = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "aldy/indelpost/pileup.pyx":914
 * 
 *     cum = sum([int(c[:-1]) for c in flank_cigar if c[-1] != "I"])
 *     if left:             # <<<<<<<<<<<<<<
 *         ref_flank = ref_flank[-cum:]
 *     else:
 */
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_left); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 914, __pyx_L1_error)
  if (__pyx_t_6) {

    /* "aldy/indelpost/pileup.pyx":915
 *     cum = sum([int(c[:-1]) for c in flank_cigar if c[-1] != "I"])
 *     if left:
 *         ref_flank = ref_flank[-cum:]             # <<<<<<<<<<<<<<
 *     else:
 *         ref_flank = ref_flank[:cum]
 */
    __pyx_t_2 = PyNumber_Negative(__pyx_v_cum); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 915, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_ref_flank, 0, 0, &__pyx_t_2, NULL, NULL, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 915, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF_SET(__pyx_v_ref_flank, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "aldy/indelpost/pileup.pyx":914
 * 
 *     cum = sum([int(c[:-1]) for c in flank_cigar if c[-1] != "I"])
 *     if left:             # <<<<<<<<<<<<<<
 *         ref_flank = ref_flank[-cum:]
 *     else:
 */
    goto __pyx_L10;
  }

  /* "aldy/indelpost/pileup.pyx":917
 *         ref_flank = ref_flank[-cum:]
 *     else:
 *         ref_flank = ref_flank[:cum]             # <<<<<<<<<<<<<<
 * 
 *     return ref_flank
 */
  /*else*/ {
    __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_ref_flank, 0, 0, NULL, &__pyx_v_cum, NULL, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 917, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_ref_flank, __pyx_t_1);
    __pyx_t_1 = 0;
  }
  __pyx_L10:;

  /* "aldy/indelpost/pileup.pyx":919
 *         ref_flank = ref_flank[:cum]
 * 
 *     return ref_flank             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_ref_flank);
  __pyx_r = __pyx_v_ref_flank;
  goto __pyx_L0;

  /* "aldy/indelpost/pileup.pyx":911
 * 
 * 
 * def trim_ref_flank(ref_flank, flank_cigar, left):             # <<<<<<<<<<<<<<
 * 
 *     cum = sum([int(c[:-1]) for c in flank_cigar if c[-1] != "I"])
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("aldy.indelpost.pileup.trim_ref_flank", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_cum);
  __Pyx_XDECREF(__pyx_9genexpr32__pyx_v_c);
  __Pyx_XDECREF(__pyx_v_ref_flank);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "aldy/indelpost/pileup.pyx":922
 * 
 * 
 * def update_cigar(             # <<<<<<<<<<<<<<
 *     orig_cigar_string, realn_cigar, start_pos, splice_prtn, clipped_bases, left
 * ):
 */

/* Python wrapper */
static PyObject *__pyx_pw_4aldy_9indelpost_6pileup_21update_cigar(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_4aldy_9indelpost_6pileup_21update_cigar = {"update_cigar", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4aldy_9indelpost_6pileup_21update_cigar, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4aldy_9indelpost_6pileup_21update_cigar(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_orig_cigar_string = 0;
  PyObject *__pyx_v_realn_cigar = 0;
  PyObject *__pyx_v_start_pos = 0;
  PyObject *__pyx_v_splice_prtn = 0;
  PyObject *__pyx_v_clipped_bases = 0;
  PyObject *__pyx_v_left = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("update_cigar (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_orig_cigar_string,&__pyx_n_s_realn_cigar,&__pyx_n_s_start_pos,&__pyx_n_s_splice_prtn,&__pyx_n_s_clipped_bases,&__pyx_n_s_left,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_orig_cigar_string)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_realn_cigar)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("update_cigar", 1, 6, 6, 1); __PYX_ERR(0, 922, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_start_pos)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("update_cigar", 1, 6, 6, 2); __PYX_ERR(0, 922, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_splice_prtn)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("update_cigar", 1, 6, 6, 3); __PYX_ERR(0, 922, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_clipped_bases)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("update_cigar", 1, 6, 6, 4); __PYX_ERR(0, 922, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_left)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("update_cigar", 1, 6, 6, 5); __PYX_ERR(0, 922, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "update_cigar") < 0)) __PYX_ERR(0, 922, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
    }
    __pyx_v_orig_cigar_string = values[0];
    __pyx_v_realn_cigar = values[1];
    __pyx_v_start_pos = values[2];
    __pyx_v_splice_prtn = values[3];
    __pyx_v_clipped_bases = values[4];
    __pyx_v_left = values[5];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("update_cigar", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 922, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("aldy.indelpost.pileup.update_cigar", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4aldy_9indelpost_6pileup_20update_cigar(__pyx_self, __pyx_v_orig_cigar_string, __pyx_v_realn_cigar, __pyx_v_start_pos, __pyx_v_splice_prtn, __pyx_v_clipped_bases, __pyx_v_left);

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

static PyObject *__pyx_pf_4aldy_9indelpost_6pileup_20update_cigar(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_orig_cigar_string, PyObject *__pyx_v_realn_cigar, PyObject *__pyx_v_start_pos, PyObject *__pyx_v_splice_prtn, PyObject *__pyx_v_clipped_bases, PyObject *__pyx_v_left) {
  PyObject *__pyx_v_splice_ptrn = NULL;
  PyObject *__pyx_v_spl_spans = NULL;
  PyObject *__pyx_v_clip_len = NULL;
  PyObject *__pyx_v_new_cigar = NULL;
  PyObject *__pyx_v_current_pos = NULL;
  PyObject *__pyx_v_target_event = NULL;
  PyObject *__pyx_v_target_type = NULL;
  PyObject *__pyx_v_target_len = NULL;
  PyObject *__pyx_v_trailing_clip = NULL;
  PyObject *__pyx_v_c = NULL;
  PyObject *__pyx_v_event = NULL;
  PyObject *__pyx_v_event_len = NULL;
  Py_ssize_t __pyx_v_last;
  PyObject *__pyx_v_tmp = NULL;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_span = NULL;
  PyObject *__pyx_v_n = NULL;
  PyObject *__pyx_v_m = NULL;
  PyObject *__pyx_v_m1 = NULL;
  PyObject *__pyx_v_m2 = NULL;
  PyObject *__pyx_v_spl_start = NULL;
  PyObject *__pyx_v_spl_end = NULL;
  PyObject *__pyx_v_this_event = NULL;
  PyObject *__pyx_9genexpr33__pyx_v_spl_span = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyObject *__pyx_t_8 = NULL;
  Py_ssize_t __pyx_t_9;
  PyObject *(*__pyx_t_10)(PyObject *);
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_t_13;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("update_cigar", 0);
  __Pyx_INCREF(__pyx_v_realn_cigar);

  /* "aldy/indelpost/pileup.pyx":926
 * ):
 * 
 *     splice_ptrn = splice_prtn[0] if left else splice_prtn[1]             # <<<<<<<<<<<<<<
 * 
 *     if splice_ptrn:
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_left); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 926, __pyx_L1_error)
  if (__pyx_t_2) {
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_splice_prtn, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 926, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
  } else {
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_splice_prtn, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 926, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
  }
  __pyx_v_splice_ptrn = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "aldy/indelpost/pileup.pyx":928
 *     splice_ptrn = splice_prtn[0] if left else splice_prtn[1]
 * 
 *     if splice_ptrn:             # <<<<<<<<<<<<<<
 *         spl_spans = [numeric_span(spl_span) for spl_span in splice_ptrn.split(":")]
 *     else:
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_splice_ptrn); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 928, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "aldy/indelpost/pileup.pyx":929
 * 
 *     if splice_ptrn:
 *         spl_spans = [numeric_span(spl_span) for spl_span in splice_ptrn.split(":")]             # <<<<<<<<<<<<<<
 *     else:
 *         spl_spans = []
 */
    { /* enter inner scope */
      __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 929, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_splice_ptrn, __pyx_n_s_split); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 929, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_u__10) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_u__10);
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 929, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
        __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); __pyx_t_6 = 0;
        __pyx_t_7 = NULL;
      } else {
        __pyx_t_6 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 929, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_7 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 929, __pyx_L6_error)
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      for (;;) {
        if (likely(!__pyx_t_7)) {
          if (likely(PyList_CheckExact(__pyx_t_4))) {
            if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_4)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 929, __pyx_L6_error)
            #else
            __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 929, __pyx_L6_error)
            __Pyx_GOTREF(__pyx_t_3);
            #endif
          } else {
            if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 929, __pyx_L6_error)
            #else
            __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 929, __pyx_L6_error)
            __Pyx_GOTREF(__pyx_t_3);
            #endif
          }
        } else {
          __pyx_t_3 = __pyx_t_7(__pyx_t_4);
          if (unlikely(!__pyx_t_3)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(0, 929, __pyx_L6_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_3);
        }
        __Pyx_XDECREF_SET(__pyx_9genexpr33__pyx_v_spl_span, __pyx_t_3);
        __pyx_t_3 = 0;
        __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_numeric_span); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 929, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_8 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
          if (likely(__pyx_t_8)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
            __Pyx_INCREF(__pyx_t_8);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_5, function);
          }
        }
        __pyx_t_3 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_8, __pyx_9genexpr33__pyx_v_spl_span) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_9genexpr33__pyx_v_spl_span);
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 929, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_3))) __PYX_ERR(0, 929, __pyx_L6_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_9genexpr33__pyx_v_spl_span); __pyx_9genexpr33__pyx_v_spl_span = 0;
      goto __pyx_L9_exit_scope;
      __pyx_L6_error:;
      __Pyx_XDECREF(__pyx_9genexpr33__pyx_v_spl_span); __pyx_9genexpr33__pyx_v_spl_span = 0;
      goto __pyx_L1_error;
      __pyx_L9_exit_scope:;
    } /* exit inner scope */
    __pyx_v_spl_spans = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "aldy/indelpost/pileup.pyx":928
 *     splice_ptrn = splice_prtn[0] if left else splice_prtn[1]
 * 
 *     if splice_ptrn:             # <<<<<<<<<<<<<<
 *         spl_spans = [numeric_span(spl_span) for spl_span in splice_ptrn.split(":")]
 *     else:
 */
    goto __pyx_L3;
  }

  /* "aldy/indelpost/pileup.pyx":931
 *         spl_spans = [numeric_span(spl_span) for spl_span in splice_ptrn.split(":")]
 *     else:
 *         spl_spans = []             # <<<<<<<<<<<<<<
 * 
 *     clip_len = len(clipped_bases)
 */
  /*else*/ {
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 931, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_spl_spans = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;
  }
  __pyx_L3:;

  /* "aldy/indelpost/pileup.pyx":933
 *         spl_spans = []
 * 
 *     clip_len = len(clipped_bases)             # <<<<<<<<<<<<<<
 * 
 *     if left:
 */
  __pyx_t_6 = PyObject_Length(__pyx_v_clipped_bases); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 933, __pyx_L1_error)
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 933, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_clip_len = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "aldy/indelpost/pileup.pyx":935
 *     clip_len = len(clipped_bases)
 * 
 *     if left:             # <<<<<<<<<<<<<<
 *         new_cigar = [str(clip_len) + "S"] if clip_len else []
 *         current_pos = start_pos + clip_len
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_left); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 935, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "aldy/indelpost/pileup.pyx":936
 * 
 *     if left:
 *         new_cigar = [str(clip_len) + "S"] if clip_len else []             # <<<<<<<<<<<<<<
 *         current_pos = start_pos + clip_len
 *     else:
 */
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_clip_len); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 936, __pyx_L1_error)
    if (__pyx_t_2) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_clip_len); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 936, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = __Pyx_PyUnicode_Concat(__pyx_t_4, __pyx_n_u_S); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 936, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 936, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_3);
      PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_1 = __pyx_t_4;
      __pyx_t_4 = 0;
    } else {
      __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 936, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = __pyx_t_4;
      __pyx_t_4 = 0;
    }
    __pyx_v_new_cigar = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "aldy/indelpost/pileup.pyx":937
 *     if left:
 *         new_cigar = [str(clip_len) + "S"] if clip_len else []
 *         current_pos = start_pos + clip_len             # <<<<<<<<<<<<<<
 *     else:
 *         new_cigar = []
 */
    __pyx_t_1 = PyNumber_Add(__pyx_v_start_pos, __pyx_v_clip_len); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 937, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_current_pos = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "aldy/indelpost/pileup.pyx":935
 *     clip_len = len(clipped_bases)
 * 
 *     if left:             # <<<<<<<<<<<<<<
 *         new_cigar = [str(clip_len) + "S"] if clip_len else []
 *         current_pos = start_pos + clip_len
 */
    goto __pyx_L10;
  }

  /* "aldy/indelpost/pileup.pyx":939
 *         current_pos = start_pos + clip_len
 *     else:
 *         new_cigar = []             # <<<<<<<<<<<<<<
 *         target_event = realn_cigar[0]
 *         target_type, target_len = target_event[-1], int(target_event[:-1])
 */
  /*else*/ {
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 939, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_new_cigar = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "aldy/indelpost/pileup.pyx":940
 *     else:
 *         new_cigar = []
 *         target_event = realn_cigar[0]             # <<<<<<<<<<<<<<
 *         target_type, target_len = target_event[-1], int(target_event[:-1])
 *         current_pos = (
 */
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_realn_cigar, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 940, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_target_event = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "aldy/indelpost/pileup.pyx":941
 *         new_cigar = []
 *         target_event = realn_cigar[0]
 *         target_type, target_len = target_event[-1], int(target_event[:-1])             # <<<<<<<<<<<<<<
 *         current_pos = (
 *             start_pos + 1 if target_type == "I" else start_pos + target_len + 1
 */
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_target_event, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 941, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyObject_GetSlice(__pyx_v_target_event, 0, -1L, NULL, NULL, &__pyx_slice__4, 0, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 941, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_PyNumber_Int(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 941, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_target_type = __pyx_t_1;
    __pyx_t_1 = 0;
    __pyx_v_target_len = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "aldy/indelpost/pileup.pyx":943
 *         target_type, target_len = target_event[-1], int(target_event[:-1])
 *         current_pos = (
 *             start_pos + 1 if target_type == "I" else start_pos + target_len + 1             # <<<<<<<<<<<<<<
 *         )
 *         trailing_clip = [str(clip_len) + "S"] if clip_len else []
 */
    __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_target_type, __pyx_n_u_I, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 943, __pyx_L1_error)
    if (__pyx_t_2) {
      __pyx_t_1 = __Pyx_PyInt_AddObjC(__pyx_v_start_pos, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 943, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1;
      __pyx_t_1 = 0;
    } else {
      __pyx_t_1 = PyNumber_Add(__pyx_v_start_pos, __pyx_v_target_len); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 943, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = __Pyx_PyInt_AddObjC(__pyx_t_1, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 943, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_3 = __pyx_t_4;
      __pyx_t_4 = 0;
    }
    __pyx_v_current_pos = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "aldy/indelpost/pileup.pyx":945
 *             start_pos + 1 if target_type == "I" else start_pos + target_len + 1
 *         )
 *         trailing_clip = [str(clip_len) + "S"] if clip_len else []             # <<<<<<<<<<<<<<
 *         realn_cigar = realn_cigar[1:]
 * 
 */
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_clip_len); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 945, __pyx_L1_error)
    if (__pyx_t_2) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_clip_len); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 945, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = __Pyx_PyUnicode_Concat(__pyx_t_4, __pyx_n_u_S); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 945, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 945, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_1);
      PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
      __pyx_t_1 = 0;
      __pyx_t_3 = __pyx_t_4;
      __pyx_t_4 = 0;
    } else {
      __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 945, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = __pyx_t_4;
      __pyx_t_4 = 0;
    }
    __pyx_v_trailing_clip = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "aldy/indelpost/pileup.pyx":946
 *         )
 *         trailing_clip = [str(clip_len) + "S"] if clip_len else []
 *         realn_cigar = realn_cigar[1:]             # <<<<<<<<<<<<<<
 * 
 *     for c in realn_cigar:
 */
    __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_realn_cigar, 1, 0, NULL, NULL, &__pyx_slice__14, 1, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 946, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_realn_cigar, __pyx_t_3);
    __pyx_t_3 = 0;
  }
  __pyx_L10:;

  /* "aldy/indelpost/pileup.pyx":948
 *         realn_cigar = realn_cigar[1:]
 * 
 *     for c in realn_cigar:             # <<<<<<<<<<<<<<
 *         event, event_len = c[-1], int(c[:-1])
 *         if event == "M":
 */
  if (likely(PyList_CheckExact(__pyx_v_realn_cigar)) || PyTuple_CheckExact(__pyx_v_realn_cigar)) {
    __pyx_t_3 = __pyx_v_realn_cigar; __Pyx_INCREF(__pyx_t_3); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
  } else {
    __pyx_t_6 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_realn_cigar); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 948, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 948, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_7)) {
      if (likely(PyList_CheckExact(__pyx_t_3))) {
        if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 948, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 948, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 948, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 948, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_7(__pyx_t_3);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 948, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_c, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "aldy/indelpost/pileup.pyx":949
 * 
 *     for c in realn_cigar:
 *         event, event_len = c[-1], int(c[:-1])             # <<<<<<<<<<<<<<
 *         if event == "M":
 *             if spl_spans:
 */
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_c, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 949, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_c, 0, -1L, NULL, NULL, &__pyx_slice__4, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 949, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyNumber_Int(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 949, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF_SET(__pyx_v_event, __pyx_t_4);
    __pyx_t_4 = 0;
    __Pyx_XDECREF_SET(__pyx_v_event_len, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "aldy/indelpost/pileup.pyx":950
 *     for c in realn_cigar:
 *         event, event_len = c[-1], int(c[:-1])
 *         if event == "M":             # <<<<<<<<<<<<<<
 *             if spl_spans:
 *                 last = len(spl_spans) - 1
 */
    __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_event, __pyx_n_u_M, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 950, __pyx_L1_error)
    if (__pyx_t_2) {

      /* "aldy/indelpost/pileup.pyx":951
 *         event, event_len = c[-1], int(c[:-1])
 *         if event == "M":
 *             if spl_spans:             # <<<<<<<<<<<<<<
 *                 last = len(spl_spans) - 1
 *                 tmp = spl_spans.copy()
 */
      __pyx_t_2 = (PyList_GET_SIZE(__pyx_v_spl_spans) != 0);
      if (__pyx_t_2) {

        /* "aldy/indelpost/pileup.pyx":952
 *         if event == "M":
 *             if spl_spans:
 *                 last = len(spl_spans) - 1             # <<<<<<<<<<<<<<
 *                 tmp = spl_spans.copy()
 *                 for i, span in enumerate(tmp):
 */
        __pyx_t_9 = PyList_GET_SIZE(__pyx_v_spl_spans); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 952, __pyx_L1_error)
        __pyx_v_last = (__pyx_t_9 - 1);

        /* "aldy/indelpost/pileup.pyx":953
 *             if spl_spans:
 *                 last = len(spl_spans) - 1
 *                 tmp = spl_spans.copy()             # <<<<<<<<<<<<<<
 *                 for i, span in enumerate(tmp):
 *                     n = span[1] - span[0] + 1
 */
        __pyx_t_5 = __Pyx_CallUnboundCMethod0(&__pyx_umethod_PyList_Type_copy, __pyx_v_spl_spans); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 953, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_XDECREF_SET(__pyx_v_tmp, __pyx_t_5);
        __pyx_t_5 = 0;

        /* "aldy/indelpost/pileup.pyx":954
 *                 last = len(spl_spans) - 1
 *                 tmp = spl_spans.copy()
 *                 for i, span in enumerate(tmp):             # <<<<<<<<<<<<<<
 *                     n = span[1] - span[0] + 1
 *                     if span[0] <= current_pos + event_len:
 */
        __Pyx_INCREF(__pyx_int_0);
        __pyx_t_5 = __pyx_int_0;
        if (likely(PyList_CheckExact(__pyx_v_tmp)) || PyTuple_CheckExact(__pyx_v_tmp)) {
          __pyx_t_4 = __pyx_v_tmp; __Pyx_INCREF(__pyx_t_4); __pyx_t_9 = 0;
          __pyx_t_10 = NULL;
        } else {
          __pyx_t_9 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_tmp); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 954, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_10 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 954, __pyx_L1_error)
        }
        for (;;) {
          if (likely(!__pyx_t_10)) {
            if (likely(PyList_CheckExact(__pyx_t_4))) {
              if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_4)) break;
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_9); __Pyx_INCREF(__pyx_t_1); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 954, __pyx_L1_error)
              #else
              __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 954, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_1);
              #endif
            } else {
              if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_9); __Pyx_INCREF(__pyx_t_1); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 954, __pyx_L1_error)
              #else
              __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 954, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_1);
              #endif
            }
          } else {
            __pyx_t_1 = __pyx_t_10(__pyx_t_4);
            if (unlikely(!__pyx_t_1)) {
              PyObject* exc_type = PyErr_Occurred();
              if (exc_type) {
                if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
                else __PYX_ERR(0, 954, __pyx_L1_error)
              }
              break;
            }
            __Pyx_GOTREF(__pyx_t_1);
          }
          __Pyx_XDECREF_SET(__pyx_v_span, __pyx_t_1);
          __pyx_t_1 = 0;
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_5);
          __pyx_t_1 = __Pyx_PyInt_AddObjC(__pyx_t_5, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 954, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_5);
          __pyx_t_5 = __pyx_t_1;
          __pyx_t_1 = 0;

          /* "aldy/indelpost/pileup.pyx":955
 *                 tmp = spl_spans.copy()
 *                 for i, span in enumerate(tmp):
 *                     n = span[1] - span[0] + 1             # <<<<<<<<<<<<<<
 *                     if span[0] <= current_pos + event_len:
 *                         if i != last:
 */
          __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_span, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 955, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_span, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 955, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_11 = PyNumber_Subtract(__pyx_t_1, __pyx_t_8); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 955, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __pyx_t_8 = __Pyx_PyInt_AddObjC(__pyx_t_11, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 955, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_XDECREF_SET(__pyx_v_n, __pyx_t_8);
          __pyx_t_8 = 0;

          /* "aldy/indelpost/pileup.pyx":956
 *                 for i, span in enumerate(tmp):
 *                     n = span[1] - span[0] + 1
 *                     if span[0] <= current_pos + event_len:             # <<<<<<<<<<<<<<
 *                         if i != last:
 *                             m = span[0] - current_pos
 */
          __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_span, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 956, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_11 = PyNumber_Add(__pyx_v_current_pos, __pyx_v_event_len); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 956, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_11);
          __pyx_t_1 = PyObject_RichCompare(__pyx_t_8, __pyx_t_11, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 956, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 956, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          if (__pyx_t_2) {

            /* "aldy/indelpost/pileup.pyx":957
 *                     n = span[1] - span[0] + 1
 *                     if span[0] <= current_pos + event_len:
 *                         if i != last:             # <<<<<<<<<<<<<<
 *                             m = span[0] - current_pos
 * 
 */
            __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_last); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 957, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_1);
            __pyx_t_11 = PyObject_RichCompare(__pyx_v_i, __pyx_t_1, Py_NE); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 957, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 957, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
            if (__pyx_t_2) {

              /* "aldy/indelpost/pileup.pyx":958
 *                     if span[0] <= current_pos + event_len:
 *                         if i != last:
 *                             m = span[0] - current_pos             # <<<<<<<<<<<<<<
 * 
 *                             if m:
 */
              __pyx_t_11 = __Pyx_GetItemInt(__pyx_v_span, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 958, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_11);
              __pyx_t_1 = PyNumber_Subtract(__pyx_t_11, __pyx_v_current_pos); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 958, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_1);
              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
              __Pyx_XDECREF_SET(__pyx_v_m, __pyx_t_1);
              __pyx_t_1 = 0;

              /* "aldy/indelpost/pileup.pyx":960
 *                             m = span[0] - current_pos
 * 
 *                             if m:             # <<<<<<<<<<<<<<
 *                                 new_cigar += [str(m) + "M", str(n) + "N"]
 *                             else:
 */
              __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_m); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 960, __pyx_L1_error)
              if (__pyx_t_2) {

                /* "aldy/indelpost/pileup.pyx":961
 * 
 *                             if m:
 *                                 new_cigar += [str(m) + "M", str(n) + "N"]             # <<<<<<<<<<<<<<
 *                             else:
 *                                 new_cigar += [str(n) + "N"]
 */
                __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_m); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 961, __pyx_L1_error)
                __Pyx_GOTREF(__pyx_t_1);
                __pyx_t_11 = __Pyx_PyUnicode_Concat(__pyx_t_1, __pyx_n_u_M); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 961, __pyx_L1_error)
                __Pyx_GOTREF(__pyx_t_11);
                __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
                __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 961, __pyx_L1_error)
                __Pyx_GOTREF(__pyx_t_1);
                __pyx_t_8 = __Pyx_PyUnicode_Concat(__pyx_t_1, __pyx_n_u_N); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 961, __pyx_L1_error)
                __Pyx_GOTREF(__pyx_t_8);
                __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
                __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 961, __pyx_L1_error)
                __Pyx_GOTREF(__pyx_t_1);
                __Pyx_GIVEREF(__pyx_t_11);
                PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_11);
                __Pyx_GIVEREF(__pyx_t_8);
                PyList_SET_ITEM(__pyx_t_1, 1, __pyx_t_8);
                __pyx_t_11 = 0;
                __pyx_t_8 = 0;
                __pyx_t_8 = PyNumber_InPlaceAdd(__pyx_v_new_cigar, __pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 961, __pyx_L1_error)
                __Pyx_GOTREF(__pyx_t_8);
                __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
                __Pyx_DECREF_SET(__pyx_v_new_cigar, ((PyObject*)__pyx_t_8));
                __pyx_t_8 = 0;

                /* "aldy/indelpost/pileup.pyx":960
 *                             m = span[0] - current_pos
 * 
 *                             if m:             # <<<<<<<<<<<<<<
 *                                 new_cigar += [str(m) + "M", str(n) + "N"]
 *                             else:
 */
                goto __pyx_L19;
              }

              /* "aldy/indelpost/pileup.pyx":963
 *                                 new_cigar += [str(m) + "M", str(n) + "N"]
 *                             else:
 *                                 new_cigar += [str(n) + "N"]             # <<<<<<<<<<<<<<
 * 
 *                             current_pos += m + n
 */
              /*else*/ {
                __pyx_t_8 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_n); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 963, __pyx_L1_error)
                __Pyx_GOTREF(__pyx_t_8);
                __pyx_t_1 = __Pyx_PyUnicode_Concat(__pyx_t_8, __pyx_n_u_N); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 963, __pyx_L1_error)
                __Pyx_GOTREF(__pyx_t_1);
                __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
                __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 963, __pyx_L1_error)
                __Pyx_GOTREF(__pyx_t_8);
                __Pyx_GIVEREF(__pyx_t_1);
                PyList_SET_ITEM(__pyx_t_8, 0, __pyx_t_1);
                __pyx_t_1 = 0;
                __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_new_cigar, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 963, __pyx_L1_error)
                __Pyx_GOTREF(__pyx_t_1);
                __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
                __Pyx_DECREF_SET(__pyx_v_new_cigar, ((PyObject*)__pyx_t_1));
                __pyx_t_1 = 0;
              }
              __pyx_L19:;

              /* "aldy/indelpost/pileup.pyx":965
 *                                 new_cigar += [str(n) + "N"]
 * 
 *                             current_pos += m + n             # <<<<<<<<<<<<<<
 *                             event_len -= m
 *                         else:
 */
              __pyx_t_1 = PyNumber_Add(__pyx_v_m, __pyx_v_n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 965, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_1);
              __pyx_t_8 = PyNumber_InPlaceAdd(__pyx_v_current_pos, __pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 965, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_8);
              __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
              __Pyx_DECREF_SET(__pyx_v_current_pos, __pyx_t_8);
              __pyx_t_8 = 0;

              /* "aldy/indelpost/pileup.pyx":966
 * 
 *                             current_pos += m + n
 *                             event_len -= m             # <<<<<<<<<<<<<<
 *                         else:
 *                             m1 = span[0] - current_pos
 */
              __pyx_t_8 = PyNumber_InPlaceSubtract(__pyx_v_event_len, __pyx_v_m); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 966, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_8);
              __Pyx_DECREF_SET(__pyx_v_event_len, __pyx_t_8);
              __pyx_t_8 = 0;

              /* "aldy/indelpost/pileup.pyx":957
 *                     n = span[1] - span[0] + 1
 *                     if span[0] <= current_pos + event_len:
 *                         if i != last:             # <<<<<<<<<<<<<<
 *                             m = span[0] - current_pos
 * 
 */
              goto __pyx_L18;
            }

            /* "aldy/indelpost/pileup.pyx":968
 *                             event_len -= m
 *                         else:
 *                             m1 = span[0] - current_pos             # <<<<<<<<<<<<<<
 *                             m2 = event_len - m1
 * 
 */
            /*else*/ {
              __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_span, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 968, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_8);
              __pyx_t_1 = PyNumber_Subtract(__pyx_t_8, __pyx_v_current_pos); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 968, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_1);
              __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
              __Pyx_XDECREF_SET(__pyx_v_m1, __pyx_t_1);
              __pyx_t_1 = 0;

              /* "aldy/indelpost/pileup.pyx":969
 *                         else:
 *                             m1 = span[0] - current_pos
 *                             m2 = event_len - m1             # <<<<<<<<<<<<<<
 * 
 *                             if m2:
 */
              __pyx_t_1 = PyNumber_Subtract(__pyx_v_event_len, __pyx_v_m1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 969, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_1);
              __Pyx_XDECREF_SET(__pyx_v_m2, __pyx_t_1);
              __pyx_t_1 = 0;

              /* "aldy/indelpost/pileup.pyx":971
 *                             m2 = event_len - m1
 * 
 *                             if m2:             # <<<<<<<<<<<<<<
 *                                 if m1:
 *                                     new_cigar += [str(m1) + "M", str(n) + "N", str(m2) + "M"]
 */
              __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_m2); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 971, __pyx_L1_error)
              if (__pyx_t_2) {

                /* "aldy/indelpost/pileup.pyx":972
 * 
 *                             if m2:
 *                                 if m1:             # <<<<<<<<<<<<<<
 *                                     new_cigar += [str(m1) + "M", str(n) + "N", str(m2) + "M"]
 *                                 else:
 */
                __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_m1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 972, __pyx_L1_error)
                if (__pyx_t_2) {

                  /* "aldy/indelpost/pileup.pyx":973
 *                             if m2:
 *                                 if m1:
 *                                     new_cigar += [str(m1) + "M", str(n) + "N", str(m2) + "M"]             # <<<<<<<<<<<<<<
 *                                 else:
 *                                     new_cigar += [str(n) + "N", str(m2) + "M"]
 */
                  __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_m1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 973, __pyx_L1_error)
                  __Pyx_GOTREF(__pyx_t_1);
                  __pyx_t_8 = __Pyx_PyUnicode_Concat(__pyx_t_1, __pyx_n_u_M); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 973, __pyx_L1_error)
                  __Pyx_GOTREF(__pyx_t_8);
                  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
                  __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 973, __pyx_L1_error)
                  __Pyx_GOTREF(__pyx_t_1);
                  __pyx_t_11 = __Pyx_PyUnicode_Concat(__pyx_t_1, __pyx_n_u_N); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 973, __pyx_L1_error)
                  __Pyx_GOTREF(__pyx_t_11);
                  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
                  __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_m2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 973, __pyx_L1_error)
                  __Pyx_GOTREF(__pyx_t_1);
                  __pyx_t_12 = __Pyx_PyUnicode_Concat(__pyx_t_1, __pyx_n_u_M); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 973, __pyx_L1_error)
                  __Pyx_GOTREF(__pyx_t_12);
                  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
                  __pyx_t_1 = PyList_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 973, __pyx_L1_error)
                  __Pyx_GOTREF(__pyx_t_1);
                  __Pyx_GIVEREF(__pyx_t_8);
                  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_8);
                  __Pyx_GIVEREF(__pyx_t_11);
                  PyList_SET_ITEM(__pyx_t_1, 1, __pyx_t_11);
                  __Pyx_GIVEREF(__pyx_t_12);
                  PyList_SET_ITEM(__pyx_t_1, 2, __pyx_t_12);
                  __pyx_t_8 = 0;
                  __pyx_t_11 = 0;
                  __pyx_t_12 = 0;
                  __pyx_t_12 = PyNumber_InPlaceAdd(__pyx_v_new_cigar, __pyx_t_1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 973, __pyx_L1_error)
                  __Pyx_GOTREF(__pyx_t_12);
                  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
                  __Pyx_DECREF_SET(__pyx_v_new_cigar, ((PyObject*)__pyx_t_12));
                  __pyx_t_12 = 0;

                  /* "aldy/indelpost/pileup.pyx":972
 * 
 *                             if m2:
 *                                 if m1:             # <<<<<<<<<<<<<<
 *                                     new_cigar += [str(m1) + "M", str(n) + "N", str(m2) + "M"]
 *                                 else:
 */
                  goto __pyx_L21;
                }

                /* "aldy/indelpost/pileup.pyx":975
 *                                     new_cigar += [str(m1) + "M", str(n) + "N", str(m2) + "M"]
 *                                 else:
 *                                     new_cigar += [str(n) + "N", str(m2) + "M"]             # <<<<<<<<<<<<<<
 *                             else:
 *                                 new_cigar += [str(event_len) + "M", str(n) + "N"]
 */
                /*else*/ {
                  __pyx_t_12 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_n); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 975, __pyx_L1_error)
                  __Pyx_GOTREF(__pyx_t_12);
                  __pyx_t_1 = __Pyx_PyUnicode_Concat(__pyx_t_12, __pyx_n_u_N); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 975, __pyx_L1_error)
                  __Pyx_GOTREF(__pyx_t_1);
                  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
                  __pyx_t_12 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_m2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 975, __pyx_L1_error)
                  __Pyx_GOTREF(__pyx_t_12);
                  __pyx_t_11 = __Pyx_PyUnicode_Concat(__pyx_t_12, __pyx_n_u_M); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 975, __pyx_L1_error)
                  __Pyx_GOTREF(__pyx_t_11);
                  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
                  __pyx_t_12 = PyList_New(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 975, __pyx_L1_error)
                  __Pyx_GOTREF(__pyx_t_12);
                  __Pyx_GIVEREF(__pyx_t_1);
                  PyList_SET_ITEM(__pyx_t_12, 0, __pyx_t_1);
                  __Pyx_GIVEREF(__pyx_t_11);
                  PyList_SET_ITEM(__pyx_t_12, 1, __pyx_t_11);
                  __pyx_t_1 = 0;
                  __pyx_t_11 = 0;
                  __pyx_t_11 = PyNumber_InPlaceAdd(__pyx_v_new_cigar, __pyx_t_12); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 975, __pyx_L1_error)
                  __Pyx_GOTREF(__pyx_t_11);
                  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
                  __Pyx_DECREF_SET(__pyx_v_new_cigar, ((PyObject*)__pyx_t_11));
                  __pyx_t_11 = 0;
                }
                __pyx_L21:;

                /* "aldy/indelpost/pileup.pyx":971
 *                             m2 = event_len - m1
 * 
 *                             if m2:             # <<<<<<<<<<<<<<
 *                                 if m1:
 *                                     new_cigar += [str(m1) + "M", str(n) + "N", str(m2) + "M"]
 */
                goto __pyx_L20;
              }

              /* "aldy/indelpost/pileup.pyx":977
 *                                     new_cigar += [str(n) + "N", str(m2) + "M"]
 *                             else:
 *                                 new_cigar += [str(event_len) + "M", str(n) + "N"]             # <<<<<<<<<<<<<<
 * 
 *                             current_pos += n + event_len
 */
              /*else*/ {
                __pyx_t_11 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_event_len); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 977, __pyx_L1_error)
                __Pyx_GOTREF(__pyx_t_11);
                __pyx_t_12 = __Pyx_PyUnicode_Concat(__pyx_t_11, __pyx_n_u_M); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 977, __pyx_L1_error)
                __Pyx_GOTREF(__pyx_t_12);
                __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
                __pyx_t_11 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_n); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 977, __pyx_L1_error)
                __Pyx_GOTREF(__pyx_t_11);
                __pyx_t_1 = __Pyx_PyUnicode_Concat(__pyx_t_11, __pyx_n_u_N); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 977, __pyx_L1_error)
                __Pyx_GOTREF(__pyx_t_1);
                __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
                __pyx_t_11 = PyList_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 977, __pyx_L1_error)
                __Pyx_GOTREF(__pyx_t_11);
                __Pyx_GIVEREF(__pyx_t_12);
                PyList_SET_ITEM(__pyx_t_11, 0, __pyx_t_12);
                __Pyx_GIVEREF(__pyx_t_1);
                PyList_SET_ITEM(__pyx_t_11, 1, __pyx_t_1);
                __pyx_t_12 = 0;
                __pyx_t_1 = 0;
                __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_new_cigar, __pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 977, __pyx_L1_error)
                __Pyx_GOTREF(__pyx_t_1);
                __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
                __Pyx_DECREF_SET(__pyx_v_new_cigar, ((PyObject*)__pyx_t_1));
                __pyx_t_1 = 0;
              }
              __pyx_L20:;

              /* "aldy/indelpost/pileup.pyx":979
 *                                 new_cigar += [str(event_len) + "M", str(n) + "N"]
 * 
 *                             current_pos += n + event_len             # <<<<<<<<<<<<<<
 *                         spl_spans = spl_spans[1:]
 *                     else:
 */
              __pyx_t_1 = PyNumber_Add(__pyx_v_n, __pyx_v_event_len); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 979, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_1);
              __pyx_t_11 = PyNumber_InPlaceAdd(__pyx_v_current_pos, __pyx_t_1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 979, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_11);
              __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
              __Pyx_DECREF_SET(__pyx_v_current_pos, __pyx_t_11);
              __pyx_t_11 = 0;
            }
            __pyx_L18:;

            /* "aldy/indelpost/pileup.pyx":980
 * 
 *                             current_pos += n + event_len
 *                         spl_spans = spl_spans[1:]             # <<<<<<<<<<<<<<
 *                     else:
 *                         new_cigar.append(str(event_len) + "M")
 */
            __pyx_t_11 = __Pyx_PyList_GetSlice(__pyx_v_spl_spans, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 980, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_11);
            __Pyx_DECREF_SET(__pyx_v_spl_spans, ((PyObject*)__pyx_t_11));
            __pyx_t_11 = 0;

            /* "aldy/indelpost/pileup.pyx":956
 *                 for i, span in enumerate(tmp):
 *                     n = span[1] - span[0] + 1
 *                     if span[0] <= current_pos + event_len:             # <<<<<<<<<<<<<<
 *                         if i != last:
 *                             m = span[0] - current_pos
 */
            goto __pyx_L17;
          }

          /* "aldy/indelpost/pileup.pyx":982
 *                         spl_spans = spl_spans[1:]
 *                     else:
 *                         new_cigar.append(str(event_len) + "M")             # <<<<<<<<<<<<<<
 *                         current_pos += event_len - 1
 *                         # hotfix -1 should be checked! Mar 12
 */
          /*else*/ {
            if (unlikely(__pyx_v_new_cigar == Py_None)) {
              PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
              __PYX_ERR(0, 982, __pyx_L1_error)
            }
            __pyx_t_11 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_event_len); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 982, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_11);
            __pyx_t_1 = __Pyx_PyUnicode_Concat(__pyx_t_11, __pyx_n_u_M); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 982, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
            __pyx_t_13 = __Pyx_PyList_Append(__pyx_v_new_cigar, __pyx_t_1); if (unlikely(__pyx_t_13 == ((int)-1))) __PYX_ERR(0, 982, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

            /* "aldy/indelpost/pileup.pyx":983
 *                     else:
 *                         new_cigar.append(str(event_len) + "M")
 *                         current_pos += event_len - 1             # <<<<<<<<<<<<<<
 *                         # hotfix -1 should be checked! Mar 12
 *                         break
 */
            __pyx_t_1 = __Pyx_PyInt_SubtractObjC(__pyx_v_event_len, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 983, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_1);
            __pyx_t_11 = PyNumber_InPlaceAdd(__pyx_v_current_pos, __pyx_t_1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 983, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_11);
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_DECREF_SET(__pyx_v_current_pos, __pyx_t_11);
            __pyx_t_11 = 0;

            /* "aldy/indelpost/pileup.pyx":985
 *                         current_pos += event_len - 1
 *                         # hotfix -1 should be checked! Mar 12
 *                         break             # <<<<<<<<<<<<<<
 * 
 *             else:
 */
            goto __pyx_L16_break;
          }
          __pyx_L17:;

          /* "aldy/indelpost/pileup.pyx":954
 *                 last = len(spl_spans) - 1
 *                 tmp = spl_spans.copy()
 *                 for i, span in enumerate(tmp):             # <<<<<<<<<<<<<<
 *                     n = span[1] - span[0] + 1
 *                     if span[0] <= current_pos + event_len:
 */
        }
        __pyx_L16_break:;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "aldy/indelpost/pileup.pyx":951
 *         event, event_len = c[-1], int(c[:-1])
 *         if event == "M":
 *             if spl_spans:             # <<<<<<<<<<<<<<
 *                 last = len(spl_spans) - 1
 *                 tmp = spl_spans.copy()
 */
        goto __pyx_L14;
      }

      /* "aldy/indelpost/pileup.pyx":988
 * 
 *             else:
 *                 new_cigar.append(str(event_len) + "M")             # <<<<<<<<<<<<<<
 *                 current_pos += event_len
 * 
 */
      /*else*/ {
        if (unlikely(__pyx_v_new_cigar == Py_None)) {
          PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
          __PYX_ERR(0, 988, __pyx_L1_error)
        }
        __pyx_t_5 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_event_len); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 988, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_t_5, __pyx_n_u_M); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 988, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_13 = __Pyx_PyList_Append(__pyx_v_new_cigar, __pyx_t_4); if (unlikely(__pyx_t_13 == ((int)-1))) __PYX_ERR(0, 988, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

        /* "aldy/indelpost/pileup.pyx":989
 *             else:
 *                 new_cigar.append(str(event_len) + "M")
 *                 current_pos += event_len             # <<<<<<<<<<<<<<
 * 
 *         elif event == "I":
 */
        __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_current_pos, __pyx_v_event_len); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 989, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF_SET(__pyx_v_current_pos, __pyx_t_4);
        __pyx_t_4 = 0;
      }
      __pyx_L14:;

      /* "aldy/indelpost/pileup.pyx":950
 *     for c in realn_cigar:
 *         event, event_len = c[-1], int(c[:-1])
 *         if event == "M":             # <<<<<<<<<<<<<<
 *             if spl_spans:
 *                 last = len(spl_spans) - 1
 */
      goto __pyx_L13;
    }

    /* "aldy/indelpost/pileup.pyx":991
 *                 current_pos += event_len
 * 
 *         elif event == "I":             # <<<<<<<<<<<<<<
 * 
 *             if spl_spans:
 */
    __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_event, __pyx_n_u_I, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 991, __pyx_L1_error)
    if (__pyx_t_2) {

      /* "aldy/indelpost/pileup.pyx":993
 *         elif event == "I":
 * 
 *             if spl_spans:             # <<<<<<<<<<<<<<
 *                 span = spl_spans[0]
 *                 spl_start, spl_end = span[0], span[1]
 */
      __pyx_t_2 = (PyList_GET_SIZE(__pyx_v_spl_spans) != 0);
      if (__pyx_t_2) {

        /* "aldy/indelpost/pileup.pyx":994
 * 
 *             if spl_spans:
 *                 span = spl_spans[0]             # <<<<<<<<<<<<<<
 *                 spl_start, spl_end = span[0], span[1]
 *                 n = spl_end - spl_start + 1
 */
        __pyx_t_4 = __Pyx_GetItemInt_List(__pyx_v_spl_spans, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 994, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_XDECREF_SET(__pyx_v_span, __pyx_t_4);
        __pyx_t_4 = 0;

        /* "aldy/indelpost/pileup.pyx":995
 *             if spl_spans:
 *                 span = spl_spans[0]
 *                 spl_start, spl_end = span[0], span[1]             # <<<<<<<<<<<<<<
 *                 n = spl_end - spl_start + 1
 * 
 */
        __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_span, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 995, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_span, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 995, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_XDECREF_SET(__pyx_v_spl_start, __pyx_t_4);
        __pyx_t_4 = 0;
        __Pyx_XDECREF_SET(__pyx_v_spl_end, __pyx_t_5);
        __pyx_t_5 = 0;

        /* "aldy/indelpost/pileup.pyx":996
 *                 span = spl_spans[0]
 *                 spl_start, spl_end = span[0], span[1]
 *                 n = spl_end - spl_start + 1             # <<<<<<<<<<<<<<
 * 
 *                 if spl_start == current_pos:
 */
        __pyx_t_5 = PyNumber_Subtract(__pyx_v_spl_end, __pyx_v_spl_start); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 996, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_4 = __Pyx_PyInt_AddObjC(__pyx_t_5, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 996, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF_SET(__pyx_v_n, __pyx_t_4);
        __pyx_t_4 = 0;

        /* "aldy/indelpost/pileup.pyx":998
 *                 n = spl_end - spl_start + 1
 * 
 *                 if spl_start == current_pos:             # <<<<<<<<<<<<<<
 *                     this_event = [str(event_len) + "I", str(n) + "N"]
 * 
 */
        __pyx_t_4 = PyObject_RichCompare(__pyx_v_spl_start, __pyx_v_current_pos, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 998, __pyx_L1_error)
        __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 998, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (__pyx_t_2) {

          /* "aldy/indelpost/pileup.pyx":999
 * 
 *                 if spl_start == current_pos:
 *                     this_event = [str(event_len) + "I", str(n) + "N"]             # <<<<<<<<<<<<<<
 * 
 *                     new_cigar += this_event
 */
          __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_event_len); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 999, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_5 = __Pyx_PyUnicode_Concat(__pyx_t_4, __pyx_n_u_I); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 999, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_n); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 999, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_11 = __Pyx_PyUnicode_Concat(__pyx_t_4, __pyx_n_u_N); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 999, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_4 = PyList_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 999, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_GIVEREF(__pyx_t_5);
          PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
          __Pyx_GIVEREF(__pyx_t_11);
          PyList_SET_ITEM(__pyx_t_4, 1, __pyx_t_11);
          __pyx_t_5 = 0;
          __pyx_t_11 = 0;
          __Pyx_XDECREF_SET(__pyx_v_this_event, ((PyObject*)__pyx_t_4));
          __pyx_t_4 = 0;

          /* "aldy/indelpost/pileup.pyx":1001
 *                     this_event = [str(event_len) + "I", str(n) + "N"]
 * 
 *                     new_cigar += this_event             # <<<<<<<<<<<<<<
 *                     current_pos += n
 * 
 */
          __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_new_cigar, __pyx_v_this_event); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1001, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF_SET(__pyx_v_new_cigar, ((PyObject*)__pyx_t_4));
          __pyx_t_4 = 0;

          /* "aldy/indelpost/pileup.pyx":1002
 * 
 *                     new_cigar += this_event
 *                     current_pos += n             # <<<<<<<<<<<<<<
 * 
 *                     spl_spans = spl_spans[1:]
 */
          __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_current_pos, __pyx_v_n); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1002, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF_SET(__pyx_v_current_pos, __pyx_t_4);
          __pyx_t_4 = 0;

          /* "aldy/indelpost/pileup.pyx":1004
 *                     current_pos += n
 * 
 *                     spl_spans = spl_spans[1:]             # <<<<<<<<<<<<<<
 *                 else:
 *                     new_cigar.append(str(event_len) + "I")
 */
          __pyx_t_4 = __Pyx_PyList_GetSlice(__pyx_v_spl_spans, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1004, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF_SET(__pyx_v_spl_spans, ((PyObject*)__pyx_t_4));
          __pyx_t_4 = 0;

          /* "aldy/indelpost/pileup.pyx":998
 *                 n = spl_end - spl_start + 1
 * 
 *                 if spl_start == current_pos:             # <<<<<<<<<<<<<<
 *                     this_event = [str(event_len) + "I", str(n) + "N"]
 * 
 */
          goto __pyx_L23;
        }

        /* "aldy/indelpost/pileup.pyx":1006
 *                     spl_spans = spl_spans[1:]
 *                 else:
 *                     new_cigar.append(str(event_len) + "I")             # <<<<<<<<<<<<<<
 *                     current_pos += 1
 *             else:
 */
        /*else*/ {
          if (unlikely(__pyx_v_new_cigar == Py_None)) {
            PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
            __PYX_ERR(0, 1006, __pyx_L1_error)
          }
          __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_event_len); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1006, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_11 = __Pyx_PyUnicode_Concat(__pyx_t_4, __pyx_n_u_I); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1006, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_13 = __Pyx_PyList_Append(__pyx_v_new_cigar, __pyx_t_11); if (unlikely(__pyx_t_13 == ((int)-1))) __PYX_ERR(0, 1006, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

          /* "aldy/indelpost/pileup.pyx":1007
 *                 else:
 *                     new_cigar.append(str(event_len) + "I")
 *                     current_pos += 1             # <<<<<<<<<<<<<<
 *             else:
 *                 new_cigar.append(str(event_len) + "I")
 */
          __pyx_t_11 = __Pyx_PyInt_AddObjC(__pyx_v_current_pos, __pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1007, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_DECREF_SET(__pyx_v_current_pos, __pyx_t_11);
          __pyx_t_11 = 0;
        }
        __pyx_L23:;

        /* "aldy/indelpost/pileup.pyx":993
 *         elif event == "I":
 * 
 *             if spl_spans:             # <<<<<<<<<<<<<<
 *                 span = spl_spans[0]
 *                 spl_start, spl_end = span[0], span[1]
 */
        goto __pyx_L22;
      }

      /* "aldy/indelpost/pileup.pyx":1009
 *                     current_pos += 1
 *             else:
 *                 new_cigar.append(str(event_len) + "I")             # <<<<<<<<<<<<<<
 *                 current_pos += 1
 * 
 */
      /*else*/ {
        if (unlikely(__pyx_v_new_cigar == Py_None)) {
          PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
          __PYX_ERR(0, 1009, __pyx_L1_error)
        }
        __pyx_t_11 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_event_len); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1009, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_t_11, __pyx_n_u_I); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1009, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_t_13 = __Pyx_PyList_Append(__pyx_v_new_cigar, __pyx_t_4); if (unlikely(__pyx_t_13 == ((int)-1))) __PYX_ERR(0, 1009, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

        /* "aldy/indelpost/pileup.pyx":1010
 *             else:
 *                 new_cigar.append(str(event_len) + "I")
 *                 current_pos += 1             # <<<<<<<<<<<<<<
 * 
 *         elif event == "D":
 */
        __pyx_t_4 = __Pyx_PyInt_AddObjC(__pyx_v_current_pos, __pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1010, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF_SET(__pyx_v_current_pos, __pyx_t_4);
        __pyx_t_4 = 0;
      }
      __pyx_L22:;

      /* "aldy/indelpost/pileup.pyx":991
 *                 current_pos += event_len
 * 
 *         elif event == "I":             # <<<<<<<<<<<<<<
 * 
 *             if spl_spans:
 */
      goto __pyx_L13;
    }

    /* "aldy/indelpost/pileup.pyx":1012
 *                 current_pos += 1
 * 
 *         elif event == "D":             # <<<<<<<<<<<<<<
 *             new_cigar.append(str(event_len) + "D")
 *             current_pos += event_len
 */
    __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_event, __pyx_n_u_D, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1012, __pyx_L1_error)
    if (__pyx_t_2) {

      /* "aldy/indelpost/pileup.pyx":1013
 * 
 *         elif event == "D":
 *             new_cigar.append(str(event_len) + "D")             # <<<<<<<<<<<<<<
 *             current_pos += event_len
 * 
 */
      if (unlikely(__pyx_v_new_cigar == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
        __PYX_ERR(0, 1013, __pyx_L1_error)
      }
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_event_len); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1013, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_11 = __Pyx_PyUnicode_Concat(__pyx_t_4, __pyx_n_u_D); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1013, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_13 = __Pyx_PyList_Append(__pyx_v_new_cigar, __pyx_t_11); if (unlikely(__pyx_t_13 == ((int)-1))) __PYX_ERR(0, 1013, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

      /* "aldy/indelpost/pileup.pyx":1014
 *         elif event == "D":
 *             new_cigar.append(str(event_len) + "D")
 *             current_pos += event_len             # <<<<<<<<<<<<<<
 * 
 *     if left:
 */
      __pyx_t_11 = PyNumber_InPlaceAdd(__pyx_v_current_pos, __pyx_v_event_len); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1014, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF_SET(__pyx_v_current_pos, __pyx_t_11);
      __pyx_t_11 = 0;

      /* "aldy/indelpost/pileup.pyx":1012
 *                 current_pos += 1
 * 
 *         elif event == "D":             # <<<<<<<<<<<<<<
 *             new_cigar.append(str(event_len) + "D")
 *             current_pos += event_len
 */
    }
    __pyx_L13:;

    /* "aldy/indelpost/pileup.pyx":948
 *         realn_cigar = realn_cigar[1:]
 * 
 *     for c in realn_cigar:             # <<<<<<<<<<<<<<
 *         event, event_len = c[-1], int(c[:-1])
 *         if event == "M":
 */
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "aldy/indelpost/pileup.pyx":1016
 *             current_pos += event_len
 * 
 *     if left:             # <<<<<<<<<<<<<<
 *         return new_cigar
 *     else:
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_left); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1016, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "aldy/indelpost/pileup.pyx":1017
 * 
 *     if left:
 *         return new_cigar             # <<<<<<<<<<<<<<
 *     else:
 *         return [target_event] + new_cigar + trailing_clip
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_new_cigar);
    __pyx_r = __pyx_v_new_cigar;
    goto __pyx_L0;

    /* "aldy/indelpost/pileup.pyx":1016
 *             current_pos += event_len
 * 
 *     if left:             # <<<<<<<<<<<<<<
 *         return new_cigar
 *     else:
 */
  }

  /* "aldy/indelpost/pileup.pyx":1019
 *         return new_cigar
 *     else:
 *         return [target_event] + new_cigar + trailing_clip             # <<<<<<<<<<<<<<
 * 
 *     #return updated_cigar
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    if (unlikely(!__pyx_v_target_event)) { __Pyx_RaiseUnboundLocalError("target_event"); __PYX_ERR(0, 1019, __pyx_L1_error) }
    __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1019, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_target_event);
    __Pyx_GIVEREF(__pyx_v_target_event);
    PyList_SET_ITEM(__pyx_t_3, 0, __pyx_v_target_event);
    __pyx_t_11 = PyNumber_Add(__pyx_t_3, __pyx_v_new_cigar); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1019, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_v_trailing_clip)) { __Pyx_RaiseUnboundLocalError("trailing_clip"); __PYX_ERR(0, 1019, __pyx_L1_error) }
    __pyx_t_3 = PyNumber_Add(__pyx_t_11, __pyx_v_trailing_clip); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1019, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "aldy/indelpost/pileup.pyx":922
 * 
 * 
 * def update_cigar(             # <<<<<<<<<<<<<<
 *     orig_cigar_string, realn_cigar, start_pos, splice_prtn, clipped_bases, left
 * ):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("aldy.indelpost.pileup.update_cigar", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_splice_ptrn);
  __Pyx_XDECREF(__pyx_v_spl_spans);
  __Pyx_XDECREF(__pyx_v_clip_len);
  __Pyx_XDECREF(__pyx_v_new_cigar);
  __Pyx_XDECREF(__pyx_v_current_pos);
  __Pyx_XDECREF(__pyx_v_target_event);
  __Pyx_XDECREF(__pyx_v_target_type);
  __Pyx_XDECREF(__pyx_v_target_len);
  __Pyx_XDECREF(__pyx_v_trailing_clip);
  __Pyx_XDECREF(__pyx_v_c);
  __Pyx_XDECREF(__pyx_v_event);
  __Pyx_XDECREF(__pyx_v_event_len);
  __Pyx_XDECREF(__pyx_v_tmp);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_span);
  __Pyx_XDECREF(__pyx_v_n);
  __Pyx_XDECREF(__pyx_v_m);
  __Pyx_XDECREF(__pyx_v_m1);
  __Pyx_XDECREF(__pyx_v_m2);
  __Pyx_XDECREF(__pyx_v_spl_start);
  __Pyx_XDECREF(__pyx_v_spl_end);
  __Pyx_XDECREF(__pyx_v_this_event);
  __Pyx_XDECREF(__pyx_9genexpr33__pyx_v_spl_span);
  __Pyx_XDECREF(__pyx_v_realn_cigar);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "aldy/indelpost/pileup.pyx":1024
 * 
 * 
 * def numeric_span(spl_span):             # <<<<<<<<<<<<<<
 *     spl_span_lst = spl_span.split("-")
 *     return [int(i) for i in spl_span_lst]
 */

/* Python wrapper */
static PyObject *__pyx_pw_4aldy_9indelpost_6pileup_23numeric_span(PyObject *__pyx_self, PyObject *__pyx_v_spl_span); /*proto*/
static PyMethodDef __pyx_mdef_4aldy_9indelpost_6pileup_23numeric_span = {"numeric_span", (PyCFunction)__pyx_pw_4aldy_9indelpost_6pileup_23numeric_span, METH_O, 0};
static PyObject *__pyx_pw_4aldy_9indelpost_6pileup_23numeric_span(PyObject *__pyx_self, PyObject *__pyx_v_spl_span) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("numeric_span (wrapper)", 0);
  __pyx_r = __pyx_pf_4aldy_9indelpost_6pileup_22numeric_span(__pyx_self, ((PyObject *)__pyx_v_spl_span));

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

static PyObject *__pyx_pf_4aldy_9indelpost_6pileup_22numeric_span(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_spl_span) {
  PyObject *__pyx_v_spl_span_lst = NULL;
  PyObject *__pyx_9genexpr34__pyx_v_i = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *(*__pyx_t_5)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("numeric_span", 0);

  /* "aldy/indelpost/pileup.pyx":1025
 * 
 * def numeric_span(spl_span):
 *     spl_span_lst = spl_span.split("-")             # <<<<<<<<<<<<<<
 *     return [int(i) for i in spl_span_lst]
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_spl_span, __pyx_n_s_split); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1025, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_u__9) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u__9);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1025, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_spl_span_lst = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "aldy/indelpost/pileup.pyx":1026
 * def numeric_span(spl_span):
 *     spl_span_lst = spl_span.split("-")
 *     return [int(i) for i in spl_span_lst]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  { /* enter inner scope */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1026, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (likely(PyList_CheckExact(__pyx_v_spl_span_lst)) || PyTuple_CheckExact(__pyx_v_spl_span_lst)) {
      __pyx_t_2 = __pyx_v_spl_span_lst; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
      __pyx_t_5 = NULL;
    } else {
      __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_spl_span_lst); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1026, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1026, __pyx_L5_error)
    }
    for (;;) {
      if (likely(!__pyx_t_5)) {
        if (likely(PyList_CheckExact(__pyx_t_2))) {
          if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 1026, __pyx_L5_error)
          #else
          __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1026, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_3);
          #endif
        } else {
          if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 1026, __pyx_L5_error)
          #else
          __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1026, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_3);
          #endif
        }
      } else {
        __pyx_t_3 = __pyx_t_5(__pyx_t_2);
        if (unlikely(!__pyx_t_3)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 1026, __pyx_L5_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_3);
      }
      __Pyx_XDECREF_SET(__pyx_9genexpr34__pyx_v_i, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyNumber_Int(__pyx_9genexpr34__pyx_v_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1026, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_3))) __PYX_ERR(0, 1026, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_9genexpr34__pyx_v_i); __pyx_9genexpr34__pyx_v_i = 0;
    goto __pyx_L8_exit_scope;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_9genexpr34__pyx_v_i); __pyx_9genexpr34__pyx_v_i = 0;
    goto __pyx_L1_error;
    __pyx_L8_exit_scope:;
  } /* exit inner scope */
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "aldy/indelpost/pileup.pyx":1024
 * 
 * 
 * def numeric_span(spl_span):             # <<<<<<<<<<<<<<
 *     spl_span_lst = spl_span.split("-")
 *     return [int(i) for i in spl_span_lst]
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("aldy.indelpost.pileup.numeric_span", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_spl_span_lst);
  __Pyx_XDECREF(__pyx_9genexpr34__pyx_v_i);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "aldy/indelpost/pileup.pyx":1029
 * 
 * 
 * def update_read_positions(read, target_pos):             # <<<<<<<<<<<<<<
 * 
 *     left_adjust = sum([-int(c[:-1]) if c[-1] != "I" else 0 for c in read["lt_cigar"]])
 */

/* Python wrapper */
static PyObject *__pyx_pw_4aldy_9indelpost_6pileup_25update_read_positions(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_4aldy_9indelpost_6pileup_25update_read_positions = {"update_read_positions", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4aldy_9indelpost_6pileup_25update_read_positions, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4aldy_9indelpost_6pileup_25update_read_positions(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_read = 0;
  PyObject *__pyx_v_target_pos = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("update_read_positions (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_read,&__pyx_n_s_target_pos,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_read)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_target_pos)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("update_read_positions", 1, 2, 2, 1); __PYX_ERR(0, 1029, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "update_read_positions") < 0)) __PYX_ERR(0, 1029, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_read = values[0];
    __pyx_v_target_pos = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("update_read_positions", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1029, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("aldy.indelpost.pileup.update_read_positions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4aldy_9indelpost_6pileup_24update_read_positions(__pyx_self, __pyx_v_read, __pyx_v_target_pos);

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

static PyObject *__pyx_pf_4aldy_9indelpost_6pileup_24update_read_positions(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_read, PyObject *__pyx_v_target_pos) {
  PyObject *__pyx_v_left_adjust = NULL;
  PyObject *__pyx_v_right_adjust = NULL;
  PyObject *__pyx_v_lt_most_cigar = NULL;
  PyObject *__pyx_v_rt_most_cigar = NULL;
  PyObject *__pyx_9genexpr35__pyx_v_c = NULL;
  PyObject *__pyx_9genexpr36__pyx_v_c = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("update_read_positions", 0);

  /* "aldy/indelpost/pileup.pyx":1031
 * def update_read_positions(read, target_pos):
 * 
 *     left_adjust = sum([-int(c[:-1]) if c[-1] != "I" else 0 for c in read["lt_cigar"]])             # <<<<<<<<<<<<<<
 *     right_adjust = sum([int(c[:-1]) if c[-1] != "I" else 0 for c in read["rt_cigar"]])
 * 
 */
  { /* enter inner scope */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1031, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_read, __pyx_n_u_lt_cigar); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1031, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
      __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
      __pyx_t_5 = NULL;
    } else {
      __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1031, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1031, __pyx_L5_error)
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    for (;;) {
      if (likely(!__pyx_t_5)) {
        if (likely(PyList_CheckExact(__pyx_t_3))) {
          if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 1031, __pyx_L5_error)
          #else
          __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1031, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        } else {
          if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 1031, __pyx_L5_error)
          #else
          __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1031, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        }
      } else {
        __pyx_t_2 = __pyx_t_5(__pyx_t_3);
        if (unlikely(!__pyx_t_2)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 1031, __pyx_L5_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_XDECREF_SET(__pyx_9genexpr35__pyx_v_c, __pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_6 = __Pyx_GetItemInt(__pyx_9genexpr35__pyx_v_c, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1031, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = (__Pyx_PyUnicode_Equals(__pyx_t_6, __pyx_n_u_I, Py_NE)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1031, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (__pyx_t_7) {
        __pyx_t_6 = __Pyx_PyObject_GetSlice(__pyx_9genexpr35__pyx_v_c, 0, -1L, NULL, NULL, &__pyx_slice__4, 0, 1, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1031, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_8 = __Pyx_PyNumber_Int(__pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1031, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_6 = PyNumber_Negative(__pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1031, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_2 = __pyx_t_6;
        __pyx_t_6 = 0;
      } else {
        __Pyx_INCREF(__pyx_int_0);
        __pyx_t_2 = __pyx_int_0;
      }
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_2))) __PYX_ERR(0, 1031, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_9genexpr35__pyx_v_c); __pyx_9genexpr35__pyx_v_c = 0;
    goto __pyx_L8_exit_scope;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_9genexpr35__pyx_v_c); __pyx_9genexpr35__pyx_v_c = 0;
    goto __pyx_L1_error;
    __pyx_L8_exit_scope:;
  } /* exit inner scope */
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_sum, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1031, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_left_adjust = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "aldy/indelpost/pileup.pyx":1032
 * 
 *     left_adjust = sum([-int(c[:-1]) if c[-1] != "I" else 0 for c in read["lt_cigar"]])
 *     right_adjust = sum([int(c[:-1]) if c[-1] != "I" else 0 for c in read["rt_cigar"]])             # <<<<<<<<<<<<<<
 * 
 *     read["read_start"] = target_pos + left_adjust + 1
 */
  { /* enter inner scope */
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1032, __pyx_L11_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_read, __pyx_n_u_rt_cigar); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1032, __pyx_L11_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
      __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
      __pyx_t_5 = NULL;
    } else {
      __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1032, __pyx_L11_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1032, __pyx_L11_error)
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    for (;;) {
      if (likely(!__pyx_t_5)) {
        if (likely(PyList_CheckExact(__pyx_t_2))) {
          if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 1032, __pyx_L11_error)
          #else
          __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1032, __pyx_L11_error)
          __Pyx_GOTREF(__pyx_t_1);
          #endif
        } else {
          if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 1032, __pyx_L11_error)
          #else
          __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1032, __pyx_L11_error)
          __Pyx_GOTREF(__pyx_t_1);
          #endif
        }
      } else {
        __pyx_t_1 = __pyx_t_5(__pyx_t_2);
        if (unlikely(!__pyx_t_1)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 1032, __pyx_L11_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_XDECREF_SET(__pyx_9genexpr36__pyx_v_c, __pyx_t_1);
      __pyx_t_1 = 0;
      __pyx_t_6 = __Pyx_GetItemInt(__pyx_9genexpr36__pyx_v_c, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1032, __pyx_L11_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = (__Pyx_PyUnicode_Equals(__pyx_t_6, __pyx_n_u_I, Py_NE)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1032, __pyx_L11_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (__pyx_t_7) {
        __pyx_t_6 = __Pyx_PyObject_GetSlice(__pyx_9genexpr36__pyx_v_c, 0, -1L, NULL, NULL, &__pyx_slice__4, 0, 1, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1032, __pyx_L11_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_8 = __Pyx_PyNumber_Int(__pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1032, __pyx_L11_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_1 = __pyx_t_8;
        __pyx_t_8 = 0;
      } else {
        __Pyx_INCREF(__pyx_int_0);
        __pyx_t_1 = __pyx_int_0;
      }
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_1))) __PYX_ERR(0, 1032, __pyx_L11_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_9genexpr36__pyx_v_c); __pyx_9genexpr36__pyx_v_c = 0;
    goto __pyx_L14_exit_scope;
    __pyx_L11_error:;
    __Pyx_XDECREF(__pyx_9genexpr36__pyx_v_c); __pyx_9genexpr36__pyx_v_c = 0;
    goto __pyx_L1_error;
    __pyx_L14_exit_scope:;
  } /* exit inner scope */
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_sum, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1032, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_right_adjust = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "aldy/indelpost/pileup.pyx":1034
 *     right_adjust = sum([int(c[:-1]) if c[-1] != "I" else 0 for c in read["rt_cigar"]])
 * 
 *     read["read_start"] = target_pos + left_adjust + 1             # <<<<<<<<<<<<<<
 *     read["read_end"] = target_pos + right_adjust
 * 
 */
  __pyx_t_2 = PyNumber_Add(__pyx_v_target_pos, __pyx_v_left_adjust); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1034, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_t_2, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1034, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(PyObject_SetItem(__pyx_v_read, __pyx_n_u_read_start, __pyx_t_3) < 0)) __PYX_ERR(0, 1034, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "aldy/indelpost/pileup.pyx":1035
 * 
 *     read["read_start"] = target_pos + left_adjust + 1
 *     read["read_end"] = target_pos + right_adjust             # <<<<<<<<<<<<<<
 * 
 *     lt_most_cigar = read["lt_cigar"][0]
 */
  __pyx_t_3 = PyNumber_Add(__pyx_v_target_pos, __pyx_v_right_adjust); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1035, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (unlikely(PyObject_SetItem(__pyx_v_read, __pyx_n_u_read_end, __pyx_t_3) < 0)) __PYX_ERR(0, 1035, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "aldy/indelpost/pileup.pyx":1037
 *     read["read_end"] = target_pos + right_adjust
 * 
 *     lt_most_cigar = read["lt_cigar"][0]             # <<<<<<<<<<<<<<
 *     read["start_offset"] = int(lt_most_cigar[:-1]) if "S" in lt_most_cigar else 0
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_v_read, __pyx_n_u_lt_cigar); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1037, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_3, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1037, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_lt_most_cigar = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "aldy/indelpost/pileup.pyx":1038
 * 
 *     lt_most_cigar = read["lt_cigar"][0]
 *     read["start_offset"] = int(lt_most_cigar[:-1]) if "S" in lt_most_cigar else 0             # <<<<<<<<<<<<<<
 * 
 *     rt_most_cigar = read["rt_cigar"][-1]
 */
  __pyx_t_7 = (__Pyx_PySequence_ContainsTF(__pyx_n_u_S, __pyx_v_lt_most_cigar, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1038, __pyx_L1_error)
  if ((__pyx_t_7 != 0)) {
    __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_lt_most_cigar, 0, -1L, NULL, NULL, &__pyx_slice__4, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1038, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __Pyx_PyNumber_Int(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1038, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_2 = __pyx_t_1;
    __pyx_t_1 = 0;
  } else {
    __Pyx_INCREF(__pyx_int_0);
    __pyx_t_2 = __pyx_int_0;
  }
  if (unlikely(PyObject_SetItem(__pyx_v_read, __pyx_n_u_start_offset, __pyx_t_2) < 0)) __PYX_ERR(0, 1038, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "aldy/indelpost/pileup.pyx":1040
 *     read["start_offset"] = int(lt_most_cigar[:-1]) if "S" in lt_most_cigar else 0
 * 
 *     rt_most_cigar = read["rt_cigar"][-1]             # <<<<<<<<<<<<<<
 *     read["end_offset"] = int(rt_most_cigar[:-1]) if "S" in rt_most_cigar else 0
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_read, __pyx_n_u_rt_cigar); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1040, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1040, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_rt_most_cigar = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "aldy/indelpost/pileup.pyx":1041
 * 
 *     rt_most_cigar = read["rt_cigar"][-1]
 *     read["end_offset"] = int(rt_most_cigar[:-1]) if "S" in rt_most_cigar else 0             # <<<<<<<<<<<<<<
 * 
 *     read["aln_start"] = read["read_start"] + read["start_offset"]
 */
  __pyx_t_7 = (__Pyx_PySequence_ContainsTF(__pyx_n_u_S, __pyx_v_rt_most_cigar, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1041, __pyx_L1_error)
  if ((__pyx_t_7 != 0)) {
    __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_rt_most_cigar, 0, -1L, NULL, NULL, &__pyx_slice__4, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1041, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyNumber_Int(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1041, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
  } else {
    __Pyx_INCREF(__pyx_int_0);
    __pyx_t_1 = __pyx_int_0;
  }
  if (unlikely(PyObject_SetItem(__pyx_v_read, __pyx_n_u_end_offset, __pyx_t_1) < 0)) __PYX_ERR(0, 1041, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "aldy/indelpost/pileup.pyx":1043
 *     read["end_offset"] = int(rt_most_cigar[:-1]) if "S" in rt_most_cigar else 0
 * 
 *     read["aln_start"] = read["read_start"] + read["start_offset"]             # <<<<<<<<<<<<<<
 *     read["aln_end"] = read["read_end"] - read["end_offset"]
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_read, __pyx_n_u_read_start); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1043, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_v_read, __pyx_n_u_start_offset); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1043, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1043, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(PyObject_SetItem(__pyx_v_read, __pyx_n_u_aln_start, __pyx_t_2) < 0)) __PYX_ERR(0, 1043, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "aldy/indelpost/pileup.pyx":1044
 * 
 *     read["aln_start"] = read["read_start"] + read["start_offset"]
 *     read["aln_end"] = read["read_end"] - read["end_offset"]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_read, __pyx_n_u_read_end); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1044, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_v_read, __pyx_n_u_end_offset); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1044, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyNumber_Subtract(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1044, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(PyObject_SetItem(__pyx_v_read, __pyx_n_u_aln_end, __pyx_t_1) < 0)) __PYX_ERR(0, 1044, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "aldy/indelpost/pileup.pyx":1029
 * 
 * 
 * def update_read_positions(read, target_pos):             # <<<<<<<<<<<<<<
 * 
 *     left_adjust = sum([-int(c[:-1]) if c[-1] != "I" else 0 for c in read["lt_cigar"]])
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("aldy.indelpost.pileup.update_read_positions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_left_adjust);
  __Pyx_XDECREF(__pyx_v_right_adjust);
  __Pyx_XDECREF(__pyx_v_lt_most_cigar);
  __Pyx_XDECREF(__pyx_v_rt_most_cigar);
  __Pyx_XDECREF(__pyx_9genexpr35__pyx_v_c);
  __Pyx_XDECREF(__pyx_9genexpr36__pyx_v_c);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "aldy/indelpost/pileup.pyx":1047
 * 
 * 
 * def update_pileup(             # <<<<<<<<<<<<<<
 *     pileup,
 *     new_target,
 */

/* Python wrapper */
static PyObject *__pyx_pw_4aldy_9indelpost_6pileup_27update_pileup(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_4aldy_9indelpost_6pileup_27update_pileup = {"update_pileup", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4aldy_9indelpost_6pileup_27update_pileup, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4aldy_9indelpost_6pileup_27update_pileup(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_pileup = 0;
  PyObject *__pyx_v_new_target = 0;
  PyObject *__pyx_v_window = 0;
  PyObject *__pyx_v_match_score = 0;
  PyObject *__pyx_v_mismatch_penalty = 0;
  PyObject *__pyx_v_gap_open_penalty = 0;
  PyObject *__pyx_v_gap_extension_penalty = 0;
  PyObject *__pyx_v_basequalthresh = 0;
  PyObject *__pyx_v_bypass_search = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("update_pileup (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pileup,&__pyx_n_s_new_target,&__pyx_n_s_window,&__pyx_n_s_match_score,&__pyx_n_s_mismatch_penalty,&__pyx_n_s_gap_open_penalty,&__pyx_n_s_gap_extension_penalty,&__pyx_n_s_basequalthresh,&__pyx_n_s_bypass_search,0};
    PyObject* values[9] = {0,0,0,0,0,0,0,0,0};

    /* "aldy/indelpost/pileup.pyx":1056
 *     gap_extension_penalty,
 *     basequalthresh,
 *     bypass_search=False             # <<<<<<<<<<<<<<
 * ):
 * 
 */
    values[8] = ((PyObject *)Py_False);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pileup)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_new_target)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("update_pileup", 0, 8, 9, 1); __PYX_ERR(0, 1047, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_window)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("update_pileup", 0, 8, 9, 2); __PYX_ERR(0, 1047, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_match_score)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("update_pileup", 0, 8, 9, 3); __PYX_ERR(0, 1047, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mismatch_penalty)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("update_pileup", 0, 8, 9, 4); __PYX_ERR(0, 1047, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gap_open_penalty)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("update_pileup", 0, 8, 9, 5); __PYX_ERR(0, 1047, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gap_extension_penalty)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("update_pileup", 0, 8, 9, 6); __PYX_ERR(0, 1047, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_basequalthresh)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("update_pileup", 0, 8, 9, 7); __PYX_ERR(0, 1047, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bypass_search);
          if (value) { values[8] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "update_pileup") < 0)) __PYX_ERR(0, 1047, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_pileup = values[0];
    __pyx_v_new_target = values[1];
    __pyx_v_window = values[2];
    __pyx_v_match_score = values[3];
    __pyx_v_mismatch_penalty = values[4];
    __pyx_v_gap_open_penalty = values[5];
    __pyx_v_gap_extension_penalty = values[6];
    __pyx_v_basequalthresh = values[7];
    __pyx_v_bypass_search = values[8];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("update_pileup", 0, 8, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1047, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("aldy.indelpost.pileup.update_pileup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4aldy_9indelpost_6pileup_26update_pileup(__pyx_self, __pyx_v_pileup, __pyx_v_new_target, __pyx_v_window, __pyx_v_match_score, __pyx_v_mismatch_penalty, __pyx_v_gap_open_penalty, __pyx_v_gap_extension_penalty, __pyx_v_basequalthresh, __pyx_v_bypass_search);

  /* "aldy/indelpost/pileup.pyx":1047
 * 
 * 
 * def update_pileup(             # <<<<<<<<<<<<<<
 *     pileup,
 *     new_target,
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_4aldy_9indelpost_6pileup_13update_pileup_2generator3(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "aldy/indelpost/pileup.pyx":1059
 * ):
 * 
 *     rpos = max(v.pos for v in new_target.generate_equivalents())             # <<<<<<<<<<<<<<
 *     for read in pileup:
 * 
 */

static PyObject *__pyx_pf_4aldy_9indelpost_6pileup_13update_pileup_genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_7_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_7_genexpr *)__pyx_tp_new_4aldy_9indelpost_6pileup___pyx_scope_struct_7_genexpr(__pyx_ptype_4aldy_9indelpost_6pileup___pyx_scope_struct_7_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_7_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1059, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_6_update_pileup *) __pyx_self;
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4aldy_9indelpost_6pileup_13update_pileup_2generator3, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_update_pileup_locals_genexpr, __pyx_n_s_aldy_indelpost_pileup); if (unlikely(!gen)) __PYX_ERR(0, 1059, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("aldy.indelpost.pileup.update_pileup.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_4aldy_9indelpost_6pileup_13update_pileup_2generator3(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_7_genexpr *__pyx_cur_scope = ((struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_7_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *(*__pyx_t_5)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1059, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_new_target)) { __Pyx_RaiseClosureNameError("new_target"); __PYX_ERR(0, 1059, __pyx_L1_error) }
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_new_target, __pyx_n_s_generate_equivalents); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1059, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1059, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
  } else {
    __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1059, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1059, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_5)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 1059, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1059, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 1059, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1059, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_5(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 1059, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_v);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_v, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_v, __pyx_n_s_pos); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1059, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    __Pyx_XGIVEREF(__pyx_t_2);
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_4;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_5;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_0;
    __pyx_cur_scope->__pyx_t_0 = 0;
    __Pyx_XGOTREF(__pyx_t_2);
    __pyx_t_4 = __pyx_cur_scope->__pyx_t_1;
    __pyx_t_5 = __pyx_cur_scope->__pyx_t_2;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1059, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "aldy/indelpost/pileup.pyx":1047
 * 
 * 
 * def update_pileup(             # <<<<<<<<<<<<<<
 *     pileup,
 *     new_target,
 */

static PyObject *__pyx_pf_4aldy_9indelpost_6pileup_26update_pileup(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pileup, PyObject *__pyx_v_new_target, PyObject *__pyx_v_window, PyObject *__pyx_v_match_score, PyObject *__pyx_v_mismatch_penalty, PyObject *__pyx_v_gap_open_penalty, PyObject *__pyx_v_gap_extension_penalty, PyObject *__pyx_v_basequalthresh, PyObject *__pyx_v_bypass_search) {
  struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_6_update_pileup *__pyx_cur_scope;
  PyObject *__pyx_v_rpos = NULL;
  PyObject *__pyx_v_read = NULL;
  PyObject *__pyx_v_is_covering = NULL;
  PyObject *__pyx_v_covering_subread = NULL;
  PyObject *__pyx_v_is_spliced = NULL;
  PyObject *__pyx_v_splice_ptrn = NULL;
  PyObject *__pyx_v_intron_ptrn = NULL;
  PyObject *__pyx_gb_4aldy_9indelpost_6pileup_13update_pileup_2generator3 = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("update_pileup", 0);
  __pyx_cur_scope = (struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_6_update_pileup *)__pyx_tp_new_4aldy_9indelpost_6pileup___pyx_scope_struct_6_update_pileup(__pyx_ptype_4aldy_9indelpost_6pileup___pyx_scope_struct_6_update_pileup, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_6_update_pileup *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1047, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_new_target = __pyx_v_new_target;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_new_target);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_new_target);

  /* "aldy/indelpost/pileup.pyx":1059
 * ):
 * 
 *     rpos = max(v.pos for v in new_target.generate_equivalents())             # <<<<<<<<<<<<<<
 *     for read in pileup:
 * 
 */
  __pyx_t_1 = __pyx_pf_4aldy_9indelpost_6pileup_13update_pileup_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1059, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_max, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1059, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_rpos = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "aldy/indelpost/pileup.pyx":1060
 * 
 *     rpos = max(v.pos for v in new_target.generate_equivalents())
 *     for read in pileup:             # <<<<<<<<<<<<<<
 * 
 *         (
 */
  if (likely(PyList_CheckExact(__pyx_v_pileup)) || PyTuple_CheckExact(__pyx_v_pileup)) {
    __pyx_t_2 = __pyx_v_pileup; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_pileup); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1060, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1060, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 1060, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1060, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 1060, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1060, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 1060, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XDECREF_SET(__pyx_v_read, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "aldy/indelpost/pileup.pyx":1069
 *             intron_ptrn,
 *         ) = parse_spliced_read(
 *             read["cigar_string"], read["read_start"], read["read_end"], new_target.pos, rpos             # <<<<<<<<<<<<<<
 *         )
 * 
 */
    __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_read, __pyx_n_u_cigar_string); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1069, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 1069, __pyx_L1_error)
    __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_read, __pyx_n_u_read_start); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1069, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1069, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_read, __pyx_n_u_read_end); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1069, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1069, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_new_target, __pyx_n_s_pos); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1069, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1069, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_v_rpos); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1069, __pyx_L1_error)

    /* "aldy/indelpost/pileup.pyx":1068
 *             splice_ptrn,
 *             intron_ptrn,
 *         ) = parse_spliced_read(             # <<<<<<<<<<<<<<
 *             read["cigar_string"], read["read_start"], read["read_end"], new_target.pos, rpos
 *         )
 */
    __pyx_t_5 = __pyx_f_4aldy_9indelpost_6pileup_parse_spliced_read(((PyObject*)__pyx_t_1), __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1068, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (likely(__pyx_t_5 != Py_None)) {
      PyObject* sequence = __pyx_t_5;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 5)) {
        if (size > 5) __Pyx_RaiseTooManyValuesError(5);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1063, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_11 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_12 = PyTuple_GET_ITEM(sequence, 3); 
      __pyx_t_13 = PyTuple_GET_ITEM(sequence, 4); 
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_10);
      __Pyx_INCREF(__pyx_t_11);
      __Pyx_INCREF(__pyx_t_12);
      __Pyx_INCREF(__pyx_t_13);
      #else
      {
        Py_ssize_t i;
        PyObject** temps[5] = {&__pyx_t_1,&__pyx_t_10,&__pyx_t_11,&__pyx_t_12,&__pyx_t_13};
        for (i=0; i < 5; i++) {
          PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 1063, __pyx_L1_error)
          __Pyx_GOTREF(item);
          *(temps[i]) = item;
        }
      }
      #endif
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 1063, __pyx_L1_error)
    }

    /* "aldy/indelpost/pileup.pyx":1063
 * 
 *         (
 *             is_covering,             # <<<<<<<<<<<<<<
 *             covering_subread,
 *             is_spliced,
 */
    __Pyx_XDECREF_SET(__pyx_v_is_covering, __pyx_t_1);
    __pyx_t_1 = 0;
    __Pyx_XDECREF_SET(__pyx_v_covering_subread, __pyx_t_10);
    __pyx_t_10 = 0;
    __Pyx_XDECREF_SET(__pyx_v_is_spliced, __pyx_t_11);
    __pyx_t_11 = 0;
    __Pyx_XDECREF_SET(__pyx_v_splice_ptrn, __pyx_t_12);
    __pyx_t_12 = 0;
    __Pyx_XDECREF_SET(__pyx_v_intron_ptrn, __pyx_t_13);
    __pyx_t_13 = 0;

    /* "aldy/indelpost/pileup.pyx":1072
 *         )
 * 
 *         read["is_covering"] = is_covering             # <<<<<<<<<<<<<<
 *         read["covering_subread"] = covering_subread
 *         read["is_spliced"] = is_spliced
 */
    if (unlikely(PyObject_SetItem(__pyx_v_read, __pyx_n_u_is_covering, __pyx_v_is_covering) < 0)) __PYX_ERR(0, 1072, __pyx_L1_error)

    /* "aldy/indelpost/pileup.pyx":1073
 * 
 *         read["is_covering"] = is_covering
 *         read["covering_subread"] = covering_subread             # <<<<<<<<<<<<<<
 *         read["is_spliced"] = is_spliced
 *         read["splice_pattern"] = splice_ptrn
 */
    if (unlikely(PyObject_SetItem(__pyx_v_read, __pyx_n_u_covering_subread, __pyx_v_covering_subread) < 0)) __PYX_ERR(0, 1073, __pyx_L1_error)

    /* "aldy/indelpost/pileup.pyx":1074
 *         read["is_covering"] = is_covering
 *         read["covering_subread"] = covering_subread
 *         read["is_spliced"] = is_spliced             # <<<<<<<<<<<<<<
 *         read["splice_pattern"] = splice_ptrn
 *         read["intron_pattern"] = intron_ptrn
 */
    if (unlikely(PyObject_SetItem(__pyx_v_read, __pyx_n_u_is_spliced, __pyx_v_is_spliced) < 0)) __PYX_ERR(0, 1074, __pyx_L1_error)

    /* "aldy/indelpost/pileup.pyx":1075
 *         read["covering_subread"] = covering_subread
 *         read["is_spliced"] = is_spliced
 *         read["splice_pattern"] = splice_ptrn             # <<<<<<<<<<<<<<
 *         read["intron_pattern"] = intron_ptrn
 * 
 */
    if (unlikely(PyObject_SetItem(__pyx_v_read, __pyx_n_u_splice_pattern, __pyx_v_splice_ptrn) < 0)) __PYX_ERR(0, 1075, __pyx_L1_error)

    /* "aldy/indelpost/pileup.pyx":1076
 *         read["is_spliced"] = is_spliced
 *         read["splice_pattern"] = splice_ptrn
 *         read["intron_pattern"] = intron_ptrn             # <<<<<<<<<<<<<<
 * 
 *     if bypass_search:
 */
    if (unlikely(PyObject_SetItem(__pyx_v_read, __pyx_n_u_intron_pattern, __pyx_v_intron_ptrn) < 0)) __PYX_ERR(0, 1076, __pyx_L1_error)

    /* "aldy/indelpost/pileup.pyx":1060
 * 
 *     rpos = max(v.pos for v in new_target.generate_equivalents())
 *     for read in pileup:             # <<<<<<<<<<<<<<
 * 
 *         (
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "aldy/indelpost/pileup.pyx":1078
 *         read["intron_pattern"] = intron_ptrn
 * 
 *     if bypass_search:             # <<<<<<<<<<<<<<
 *         return new_target, pileup
 *     else:
 */
  __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_v_bypass_search); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 1078, __pyx_L1_error)
  if (__pyx_t_14) {

    /* "aldy/indelpost/pileup.pyx":1079
 * 
 *     if bypass_search:
 *         return new_target, pileup             # <<<<<<<<<<<<<<
 *     else:
 *         return find_by_normalization(
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1079, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_new_target);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_new_target);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_cur_scope->__pyx_v_new_target);
    __Pyx_INCREF(__pyx_v_pileup);
    __Pyx_GIVEREF(__pyx_v_pileup);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_pileup);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "aldy/indelpost/pileup.pyx":1078
 *         read["intron_pattern"] = intron_ptrn
 * 
 *     if bypass_search:             # <<<<<<<<<<<<<<
 *         return new_target, pileup
 *     else:
 */
  }

  /* "aldy/indelpost/pileup.pyx":1081
 *         return new_target, pileup
 *     else:
 *         return find_by_normalization(             # <<<<<<<<<<<<<<
 *             new_target,
 *             pileup,
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_find_by_normalization); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1081, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);

    /* "aldy/indelpost/pileup.pyx":1089
 *             gap_open_penalty,
 *             gap_extension_penalty,
 *             basequalthresh,             # <<<<<<<<<<<<<<
 *         )
 */
    __pyx_t_13 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_13)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_13);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[9] = {__pyx_t_13, __pyx_cur_scope->__pyx_v_new_target, __pyx_v_pileup, __pyx_v_window, __pyx_v_match_score, __pyx_v_mismatch_penalty, __pyx_v_gap_open_penalty, __pyx_v_gap_extension_penalty, __pyx_v_basequalthresh};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_9, 8+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1081, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[9] = {__pyx_t_13, __pyx_cur_scope->__pyx_v_new_target, __pyx_v_pileup, __pyx_v_window, __pyx_v_match_score, __pyx_v_mismatch_penalty, __pyx_v_gap_open_penalty, __pyx_v_gap_extension_penalty, __pyx_v_basequalthresh};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_9, 8+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1081, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else
    #endif
    {
      __pyx_t_12 = PyTuple_New(8+__pyx_t_9); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1081, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      if (__pyx_t_13) {
        __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_13); __pyx_t_13 = NULL;
      }
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_new_target);
      __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_new_target);
      PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_9, __pyx_cur_scope->__pyx_v_new_target);
      __Pyx_INCREF(__pyx_v_pileup);
      __Pyx_GIVEREF(__pyx_v_pileup);
      PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_9, __pyx_v_pileup);
      __Pyx_INCREF(__pyx_v_window);
      __Pyx_GIVEREF(__pyx_v_window);
      PyTuple_SET_ITEM(__pyx_t_12, 2+__pyx_t_9, __pyx_v_window);
      __Pyx_INCREF(__pyx_v_match_score);
      __Pyx_GIVEREF(__pyx_v_match_score);
      PyTuple_SET_ITEM(__pyx_t_12, 3+__pyx_t_9, __pyx_v_match_score);
      __Pyx_INCREF(__pyx_v_mismatch_penalty);
      __Pyx_GIVEREF(__pyx_v_mismatch_penalty);
      PyTuple_SET_ITEM(__pyx_t_12, 4+__pyx_t_9, __pyx_v_mismatch_penalty);
      __Pyx_INCREF(__pyx_v_gap_open_penalty);
      __Pyx_GIVEREF(__pyx_v_gap_open_penalty);
      PyTuple_SET_ITEM(__pyx_t_12, 5+__pyx_t_9, __pyx_v_gap_open_penalty);
      __Pyx_INCREF(__pyx_v_gap_extension_penalty);
      __Pyx_GIVEREF(__pyx_v_gap_extension_penalty);
      PyTuple_SET_ITEM(__pyx_t_12, 6+__pyx_t_9, __pyx_v_gap_extension_penalty);
      __Pyx_INCREF(__pyx_v_basequalthresh);
      __Pyx_GIVEREF(__pyx_v_basequalthresh);
      PyTuple_SET_ITEM(__pyx_t_12, 7+__pyx_t_9, __pyx_v_basequalthresh);
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_12, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1081, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "aldy/indelpost/pileup.pyx":1047
 * 
 * 
 * def update_pileup(             # <<<<<<<<<<<<<<
 *     pileup,
 *     new_target,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("aldy.indelpost.pileup.update_pileup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rpos);
  __Pyx_XDECREF(__pyx_v_read);
  __Pyx_XDECREF(__pyx_v_is_covering);
  __Pyx_XDECREF(__pyx_v_covering_subread);
  __Pyx_XDECREF(__pyx_v_is_spliced);
  __Pyx_XDECREF(__pyx_v_splice_ptrn);
  __Pyx_XDECREF(__pyx_v_intron_ptrn);
  __Pyx_XDECREF(__pyx_gb_4aldy_9indelpost_6pileup_13update_pileup_2generator3);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "array.pxd":93
 *             __data_union data
 * 
 *         def __getbuffer__(self, Py_buffer* info, int flags):             # <<<<<<<<<<<<<<
 *             # This implementation of getbuffer is geared towards Cython
 *             # requirements, and does not yet fulfill the PEP.
 */

/* Python wrapper */
static CYTHON_UNUSED int __pyx_pw_7cpython_5array_5array_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
static CYTHON_UNUSED int __pyx_pw_7cpython_5array_5array_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cpython_5array_5array___getbuffer__(((arrayobject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));

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

static int __pyx_pf_7cpython_5array_5array___getbuffer__(arrayobject *__pyx_v_self, Py_buffer *__pyx_v_info, CYTHON_UNUSED int __pyx_v_flags) {
  PyObject *__pyx_v_item_count = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  char *__pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;
  char __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  if (__pyx_v_info == NULL) {
    PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
    return -1;
  }
  __Pyx_RefNannySetupContext("__getbuffer__", 0);
  __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(__pyx_v_info->obj);

  /* "array.pxd":98
 *             # In particular strided access is always provided regardless
 *             # of flags
 *             item_count = Py_SIZE(self)             # <<<<<<<<<<<<<<
 * 
 *             info.suboffsets = NULL
 */
  __pyx_t_1 = PyInt_FromSsize_t(Py_SIZE(((PyObject *)__pyx_v_self))); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 98, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_item_count = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "array.pxd":100
 *             item_count = Py_SIZE(self)
 * 
 *             info.suboffsets = NULL             # <<<<<<<<<<<<<<
 *             info.buf = self.data.as_chars
 *             info.readonly = 0
 */
  __pyx_v_info->suboffsets = NULL;

  /* "array.pxd":101
 * 
 *             info.suboffsets = NULL
 *             info.buf = self.data.as_chars             # <<<<<<<<<<<<<<
 *             info.readonly = 0
 *             info.ndim = 1
 */
  __pyx_t_2 = __pyx_v_self->data.as_chars;
  __pyx_v_info->buf = __pyx_t_2;

  /* "array.pxd":102
 *             info.suboffsets = NULL
 *             info.buf = self.data.as_chars
 *             info.readonly = 0             # <<<<<<<<<<<<<<
 *             info.ndim = 1
 *             info.itemsize = self.ob_descr.itemsize   # e.g. sizeof(float)
 */
  __pyx_v_info->readonly = 0;

  /* "array.pxd":103
 *             info.buf = self.data.as_chars
 *             info.readonly = 0
 *             info.ndim = 1             # <<<<<<<<<<<<<<
 *             info.itemsize = self.ob_descr.itemsize   # e.g. sizeof(float)
 *             info.len = info.itemsize * item_count
 */
  __pyx_v_info->ndim = 1;

  /* "array.pxd":104
 *             info.readonly = 0
 *             info.ndim = 1
 *             info.itemsize = self.ob_descr.itemsize   # e.g. sizeof(float)             # <<<<<<<<<<<<<<
 *             info.len = info.itemsize * item_count
 * 
 */
  __pyx_t_3 = __pyx_v_self->ob_descr->itemsize;
  __pyx_v_info->itemsize = __pyx_t_3;

  /* "array.pxd":105
 *             info.ndim = 1
 *             info.itemsize = self.ob_descr.itemsize   # e.g. sizeof(float)
 *             info.len = info.itemsize * item_count             # <<<<<<<<<<<<<<
 * 
 *             info.shape = <Py_ssize_t*> PyObject_Malloc(sizeof(Py_ssize_t) + 2)
 */
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_info->itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 105, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyNumber_Multiply(__pyx_t_1, __pyx_v_item_count); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 105, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_4); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 105, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_info->len = __pyx_t_5;

  /* "array.pxd":107
 *             info.len = info.itemsize * item_count
 * 
 *             info.shape = <Py_ssize_t*> PyObject_Malloc(sizeof(Py_ssize_t) + 2)             # <<<<<<<<<<<<<<
 *             if not info.shape:
 *                 raise MemoryError()
 */
  __pyx_v_info->shape = ((Py_ssize_t *)PyObject_Malloc(((sizeof(Py_ssize_t)) + 2)));

  /* "array.pxd":108
 * 
 *             info.shape = <Py_ssize_t*> PyObject_Malloc(sizeof(Py_ssize_t) + 2)
 *             if not info.shape:             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 *             info.shape[0] = item_count      # constant regardless of resizing
 */
  __pyx_t_6 = ((!(__pyx_v_info->shape != 0)) != 0);
  if (unlikely(__pyx_t_6)) {

    /* "array.pxd":109
 *             info.shape = <Py_ssize_t*> PyObject_Malloc(sizeof(Py_ssize_t) + 2)
 *             if not info.shape:
 *                 raise MemoryError()             # <<<<<<<<<<<<<<
 *             info.shape[0] = item_count      # constant regardless of resizing
 *             info.strides = &info.itemsize
 */
    PyErr_NoMemory(); __PYX_ERR(1, 109, __pyx_L1_error)

    /* "array.pxd":108
 * 
 *             info.shape = <Py_ssize_t*> PyObject_Malloc(sizeof(Py_ssize_t) + 2)
 *             if not info.shape:             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 *             info.shape[0] = item_count      # constant regardless of resizing
 */
  }

  /* "array.pxd":110
 *             if not info.shape:
 *                 raise MemoryError()
 *             info.shape[0] = item_count      # constant regardless of resizing             # <<<<<<<<<<<<<<
 *             info.strides = &info.itemsize
 * 
 */
  __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_v_item_count); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 110, __pyx_L1_error)
  (__pyx_v_info->shape[0]) = __pyx_t_5;

  /* "array.pxd":111
 *                 raise MemoryError()
 *             info.shape[0] = item_count      # constant regardless of resizing
 *             info.strides = &info.itemsize             # <<<<<<<<<<<<<<
 * 
 *             info.format = <char*> (info.shape + 1)
 */
  __pyx_v_info->strides = (&__pyx_v_info->itemsize);

  /* "array.pxd":113
 *             info.strides = &info.itemsize
 * 
 *             info.format = <char*> (info.shape + 1)             # <<<<<<<<<<<<<<
 *             info.format[0] = self.ob_descr.typecode
 *             info.format[1] = 0
 */
  __pyx_v_info->format = ((char *)(__pyx_v_info->shape + 1));

  /* "array.pxd":114
 * 
 *             info.format = <char*> (info.shape + 1)
 *             info.format[0] = self.ob_descr.typecode             # <<<<<<<<<<<<<<
 *             info.format[1] = 0
 *             info.obj = self
 */
  __pyx_t_7 = __pyx_v_self->ob_descr->typecode;
  (__pyx_v_info->format[0]) = __pyx_t_7;

  /* "array.pxd":115
 *             info.format = <char*> (info.shape + 1)
 *             info.format[0] = self.ob_descr.typecode
 *             info.format[1] = 0             # <<<<<<<<<<<<<<
 *             info.obj = self
 * 
 */
  (__pyx_v_info->format[1]) = 0;

  /* "array.pxd":116
 *             info.format[0] = self.ob_descr.typecode
 *             info.format[1] = 0
 *             info.obj = self             # <<<<<<<<<<<<<<
 * 
 *         def __releasebuffer__(self, Py_buffer* info):
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __Pyx_GOTREF(__pyx_v_info->obj);
  __Pyx_DECREF(__pyx_v_info->obj);
  __pyx_v_info->obj = ((PyObject *)__pyx_v_self);

  /* "array.pxd":93
 *             __data_union data
 * 
 *         def __getbuffer__(self, Py_buffer* info, int flags):             # <<<<<<<<<<<<<<
 *             # This implementation of getbuffer is geared towards Cython
 *             # requirements, and does not yet fulfill the PEP.
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cpython.array.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  if (__pyx_v_info->obj != NULL) {
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
  }
  goto __pyx_L2;
  __pyx_L0:;
  if (__pyx_v_info->obj == Py_None) {
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
  }
  __pyx_L2:;
  __Pyx_XDECREF(__pyx_v_item_count);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "array.pxd":118
 *             info.obj = self
 * 
 *         def __releasebuffer__(self, Py_buffer* info):             # <<<<<<<<<<<<<<
 *             PyObject_Free(info.shape)
 * 
 */

/* Python wrapper */
static CYTHON_UNUSED void __pyx_pw_7cpython_5array_5array_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
static CYTHON_UNUSED void __pyx_pw_7cpython_5array_5array_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
  __pyx_pf_7cpython_5array_5array_2__releasebuffer__(((arrayobject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info));

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

static void __pyx_pf_7cpython_5array_5array_2__releasebuffer__(CYTHON_UNUSED arrayobject *__pyx_v_self, Py_buffer *__pyx_v_info) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__releasebuffer__", 0);

  /* "array.pxd":119
 * 
 *         def __releasebuffer__(self, Py_buffer* info):
 *             PyObject_Free(info.shape)             # <<<<<<<<<<<<<<
 * 
 *     array newarrayobject(PyTypeObject* type, Py_ssize_t size, arraydescr *descr)
 */
  PyObject_Free(__pyx_v_info->shape);

  /* "array.pxd":118
 *             info.obj = self
 * 
 *         def __releasebuffer__(self, Py_buffer* info):             # <<<<<<<<<<<<<<
 *             PyObject_Free(info.shape)
 * 
 */

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

/* "array.pxd":130
 * 
 * 
 * cdef inline array clone(array template, Py_ssize_t length, bint zero):             # <<<<<<<<<<<<<<
 *     """ fast creation of a new array, given a template array.
 *     type will be same as template.
 */

static CYTHON_INLINE arrayobject *__pyx_f_7cpython_5array_clone(arrayobject *__pyx_v_template, Py_ssize_t __pyx_v_length, int __pyx_v_zero) {
  arrayobject *__pyx_v_op = 0;
  arrayobject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("clone", 0);

  /* "array.pxd":134
 *     type will be same as template.
 *     if zero is true, new array will be initialized with zeroes."""
 *     cdef array op = newarrayobject(Py_TYPE(template), length, template.ob_descr)             # <<<<<<<<<<<<<<
 *     if zero and op is not None:
 *         memset(op.data.as_chars, 0, length * op.ob_descr.itemsize)
 */
  __pyx_t_1 = ((PyObject *)newarrayobject(Py_TYPE(((PyObject *)__pyx_v_template)), __pyx_v_length, __pyx_v_template->ob_descr)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 134, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_op = ((arrayobject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "array.pxd":135
 *     if zero is true, new array will be initialized with zeroes."""
 *     cdef array op = newarrayobject(Py_TYPE(template), length, template.ob_descr)
 *     if zero and op is not None:             # <<<<<<<<<<<<<<
 *         memset(op.data.as_chars, 0, length * op.ob_descr.itemsize)
 *     return op
 */
  __pyx_t_3 = (__pyx_v_zero != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (((PyObject *)__pyx_v_op) != Py_None);
  __pyx_t_4 = (__pyx_t_3 != 0);
  __pyx_t_2 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "array.pxd":136
 *     cdef array op = newarrayobject(Py_TYPE(template), length, template.ob_descr)
 *     if zero and op is not None:
 *         memset(op.data.as_chars, 0, length * op.ob_descr.itemsize)             # <<<<<<<<<<<<<<
 *     return op
 * 
 */
    (void)(memset(__pyx_v_op->data.as_chars, 0, (__pyx_v_length * __pyx_v_op->ob_descr->itemsize)));

    /* "array.pxd":135
 *     if zero is true, new array will be initialized with zeroes."""
 *     cdef array op = newarrayobject(Py_TYPE(template), length, template.ob_descr)
 *     if zero and op is not None:             # <<<<<<<<<<<<<<
 *         memset(op.data.as_chars, 0, length * op.ob_descr.itemsize)
 *     return op
 */
  }

  /* "array.pxd":137
 *     if zero and op is not None:
 *         memset(op.data.as_chars, 0, length * op.ob_descr.itemsize)
 *     return op             # <<<<<<<<<<<<<<
 * 
 * cdef inline array copy(array self):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_op));
  __pyx_r = __pyx_v_op;
  goto __pyx_L0;

  /* "array.pxd":130
 * 
 * 
 * cdef inline array clone(array template, Py_ssize_t length, bint zero):             # <<<<<<<<<<<<<<
 *     """ fast creation of a new array, given a template array.
 *     type will be same as template.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cpython.array.clone", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_op);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "array.pxd":139
 *     return op
 * 
 * cdef inline array copy(array self):             # <<<<<<<<<<<<<<
 *     """ make a copy of an array. """
 *     cdef array op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr)
 */

static CYTHON_INLINE arrayobject *__pyx_f_7cpython_5array_copy(arrayobject *__pyx_v_self) {
  arrayobject *__pyx_v_op = 0;
  arrayobject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy", 0);

  /* "array.pxd":141
 * cdef inline array copy(array self):
 *     """ make a copy of an array. """
 *     cdef array op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr)             # <<<<<<<<<<<<<<
 *     memcpy(op.data.as_chars, self.data.as_chars, Py_SIZE(op) * op.ob_descr.itemsize)
 *     return op
 */
  __pyx_t_1 = ((PyObject *)newarrayobject(Py_TYPE(((PyObject *)__pyx_v_self)), Py_SIZE(((PyObject *)__pyx_v_self)), __pyx_v_self->ob_descr)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 141, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_op = ((arrayobject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "array.pxd":142
 *     """ make a copy of an array. """
 *     cdef array op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr)
 *     memcpy(op.data.as_chars, self.data.as_chars, Py_SIZE(op) * op.ob_descr.itemsize)             # <<<<<<<<<<<<<<
 *     return op
 * 
 */
  (void)(memcpy(__pyx_v_op->data.as_chars, __pyx_v_self->data.as_chars, (Py_SIZE(((PyObject *)__pyx_v_op)) * __pyx_v_op->ob_descr->itemsize)));

  /* "array.pxd":143
 *     cdef array op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr)
 *     memcpy(op.data.as_chars, self.data.as_chars, Py_SIZE(op) * op.ob_descr.itemsize)
 *     return op             # <<<<<<<<<<<<<<
 * 
 * cdef inline int extend_buffer(array self, char* stuff, Py_ssize_t n) except -1:
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_op));
  __pyx_r = __pyx_v_op;
  goto __pyx_L0;

  /* "array.pxd":139
 *     return op
 * 
 * cdef inline array copy(array self):             # <<<<<<<<<<<<<<
 *     """ make a copy of an array. """
 *     cdef array op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cpython.array.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_op);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "array.pxd":145
 *     return op
 * 
 * cdef inline int extend_buffer(array self, char* stuff, Py_ssize_t n) except -1:             # <<<<<<<<<<<<<<
 *     """ efficient appending of new stuff of same type
 *     (e.g. of same array type)
 */

static CYTHON_INLINE int __pyx_f_7cpython_5array_extend_buffer(arrayobject *__pyx_v_self, char *__pyx_v_stuff, Py_ssize_t __pyx_v_n) {
  Py_ssize_t __pyx_v_itemsize;
  Py_ssize_t __pyx_v_origsize;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("extend_buffer", 0);

  /* "array.pxd":149
 *     (e.g. of same array type)
 *     n: number of elements (not number of bytes!) """
 *     cdef Py_ssize_t itemsize = self.ob_descr.itemsize             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t origsize = Py_SIZE(self)
 *     resize_smart(self, origsize + n)
 */
  __pyx_t_1 = __pyx_v_self->ob_descr->itemsize;
  __pyx_v_itemsize = __pyx_t_1;

  /* "array.pxd":150
 *     n: number of elements (not number of bytes!) """
 *     cdef Py_ssize_t itemsize = self.ob_descr.itemsize
 *     cdef Py_ssize_t origsize = Py_SIZE(self)             # <<<<<<<<<<<<<<
 *     resize_smart(self, origsize + n)
 *     memcpy(self.data.as_chars + origsize * itemsize, stuff, n * itemsize)
 */
  __pyx_v_origsize = Py_SIZE(((PyObject *)__pyx_v_self));

  /* "array.pxd":151
 *     cdef Py_ssize_t itemsize = self.ob_descr.itemsize
 *     cdef Py_ssize_t origsize = Py_SIZE(self)
 *     resize_smart(self, origsize + n)             # <<<<<<<<<<<<<<
 *     memcpy(self.data.as_chars + origsize * itemsize, stuff, n * itemsize)
 *     return 0
 */
  __pyx_t_1 = resize_smart(__pyx_v_self, (__pyx_v_origsize + __pyx_v_n)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 151, __pyx_L1_error)

  /* "array.pxd":152
 *     cdef Py_ssize_t origsize = Py_SIZE(self)
 *     resize_smart(self, origsize + n)
 *     memcpy(self.data.as_chars + origsize * itemsize, stuff, n * itemsize)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  (void)(memcpy((__pyx_v_self->data.as_chars + (__pyx_v_origsize * __pyx_v_itemsize)), __pyx_v_stuff, (__pyx_v_n * __pyx_v_itemsize)));

  /* "array.pxd":153
 *     resize_smart(self, origsize + n)
 *     memcpy(self.data.as_chars + origsize * itemsize, stuff, n * itemsize)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef inline int extend(array self, array other) except -1:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "array.pxd":145
 *     return op
 * 
 * cdef inline int extend_buffer(array self, char* stuff, Py_ssize_t n) except -1:             # <<<<<<<<<<<<<<
 *     """ efficient appending of new stuff of same type
 *     (e.g. of same array type)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("cpython.array.extend_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "array.pxd":155
 *     return 0
 * 
 * cdef inline int extend(array self, array other) except -1:             # <<<<<<<<<<<<<<
 *     """ extend array with data from another array; types must match. """
 *     if self.ob_descr.typecode != other.ob_descr.typecode:
 */

static CYTHON_INLINE int __pyx_f_7cpython_5array_extend(arrayobject *__pyx_v_self, arrayobject *__pyx_v_other) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("extend", 0);

  /* "array.pxd":157
 * cdef inline int extend(array self, array other) except -1:
 *     """ extend array with data from another array; types must match. """
 *     if self.ob_descr.typecode != other.ob_descr.typecode:             # <<<<<<<<<<<<<<
 *         PyErr_BadArgument()
 *     return extend_buffer(self, other.data.as_chars, Py_SIZE(other))
 */
  __pyx_t_1 = ((__pyx_v_self->ob_descr->typecode != __pyx_v_other->ob_descr->typecode) != 0);
  if (__pyx_t_1) {

    /* "array.pxd":158
 *     """ extend array with data from another array; types must match. """
 *     if self.ob_descr.typecode != other.ob_descr.typecode:
 *         PyErr_BadArgument()             # <<<<<<<<<<<<<<
 *     return extend_buffer(self, other.data.as_chars, Py_SIZE(other))
 * 
 */
    __pyx_t_2 = PyErr_BadArgument(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(1, 158, __pyx_L1_error)

    /* "array.pxd":157
 * cdef inline int extend(array self, array other) except -1:
 *     """ extend array with data from another array; types must match. """
 *     if self.ob_descr.typecode != other.ob_descr.typecode:             # <<<<<<<<<<<<<<
 *         PyErr_BadArgument()
 *     return extend_buffer(self, other.data.as_chars, Py_SIZE(other))
 */
  }

  /* "array.pxd":159
 *     if self.ob_descr.typecode != other.ob_descr.typecode:
 *         PyErr_BadArgument()
 *     return extend_buffer(self, other.data.as_chars, Py_SIZE(other))             # <<<<<<<<<<<<<<
 * 
 * cdef inline void zero(array self):
 */
  __pyx_t_2 = __pyx_f_7cpython_5array_extend_buffer(__pyx_v_self, __pyx_v_other->data.as_chars, Py_SIZE(((PyObject *)__pyx_v_other))); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 159, __pyx_L1_error)
  __pyx_r = __pyx_t_2;
  goto __pyx_L0;

  /* "array.pxd":155
 *     return 0
 * 
 * cdef inline int extend(array self, array other) except -1:             # <<<<<<<<<<<<<<
 *     """ extend array with data from another array; types must match. """
 *     if self.ob_descr.typecode != other.ob_descr.typecode:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("cpython.array.extend", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "array.pxd":161
 *     return extend_buffer(self, other.data.as_chars, Py_SIZE(other))
 * 
 * cdef inline void zero(array self):             # <<<<<<<<<<<<<<
 *     """ set all elements of array to zero. """
 *     memset(self.data.as_chars, 0, Py_SIZE(self) * self.ob_descr.itemsize)
 */

static CYTHON_INLINE void __pyx_f_7cpython_5array_zero(arrayobject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("zero", 0);

  /* "array.pxd":163
 * cdef inline void zero(array self):
 *     """ set all elements of array to zero. """
 *     memset(self.data.as_chars, 0, Py_SIZE(self) * self.ob_descr.itemsize)             # <<<<<<<<<<<<<<
 */
  (void)(memset(__pyx_v_self->data.as_chars, 0, (Py_SIZE(((PyObject *)__pyx_v_self)) * __pyx_v_self->ob_descr->itemsize)));

  /* "array.pxd":161
 *     return extend_buffer(self, other.data.as_chars, Py_SIZE(other))
 * 
 * cdef inline void zero(array self):             # <<<<<<<<<<<<<<
 *     """ set all elements of array to zero. """
 *     memset(self.data.as_chars, 0, Py_SIZE(self) * self.ob_descr.itemsize)
 */

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

static struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct____pyx_f_4aldy_9indelpost_6pileup_make_pileup *__pyx_freelist_4aldy_9indelpost_6pileup___pyx_scope_struct____pyx_f_4aldy_9indelpost_6pileup_make_pileup[8];
static int __pyx_freecount_4aldy_9indelpost_6pileup___pyx_scope_struct____pyx_f_4aldy_9indelpost_6pileup_make_pileup = 0;

static PyObject *__pyx_tp_new_4aldy_9indelpost_6pileup___pyx_scope_struct____pyx_f_4aldy_9indelpost_6pileup_make_pileup(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4aldy_9indelpost_6pileup___pyx_scope_struct____pyx_f_4aldy_9indelpost_6pileup_make_pileup > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct____pyx_f_4aldy_9indelpost_6pileup_make_pileup)))) {
    o = (PyObject*)__pyx_freelist_4aldy_9indelpost_6pileup___pyx_scope_struct____pyx_f_4aldy_9indelpost_6pileup_make_pileup[--__pyx_freecount_4aldy_9indelpost_6pileup___pyx_scope_struct____pyx_f_4aldy_9indelpost_6pileup_make_pileup];
    memset(o, 0, sizeof(struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct____pyx_f_4aldy_9indelpost_6pileup_make_pileup));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4aldy_9indelpost_6pileup___pyx_scope_struct____pyx_f_4aldy_9indelpost_6pileup_make_pileup(PyObject *o) {
  struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct____pyx_f_4aldy_9indelpost_6pileup_make_pileup *p = (struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct____pyx_f_4aldy_9indelpost_6pileup_make_pileup *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_target);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4aldy_9indelpost_6pileup___pyx_scope_struct____pyx_f_4aldy_9indelpost_6pileup_make_pileup < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct____pyx_f_4aldy_9indelpost_6pileup_make_pileup)))) {
    __pyx_freelist_4aldy_9indelpost_6pileup___pyx_scope_struct____pyx_f_4aldy_9indelpost_6pileup_make_pileup[__pyx_freecount_4aldy_9indelpost_6pileup___pyx_scope_struct____pyx_f_4aldy_9indelpost_6pileup_make_pileup++] = ((struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct____pyx_f_4aldy_9indelpost_6pileup_make_pileup *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

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

static int __pyx_tp_clear_4aldy_9indelpost_6pileup___pyx_scope_struct____pyx_f_4aldy_9indelpost_6pileup_make_pileup(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct____pyx_f_4aldy_9indelpost_6pileup_make_pileup *p = (struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct____pyx_f_4aldy_9indelpost_6pileup_make_pileup *)o;
  tmp = ((PyObject*)p->__pyx_v_target);
  p->__pyx_v_target = ((struct __pyx_obj_4aldy_9indelpost_7variant_Variant *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_4aldy_9indelpost_6pileup___pyx_scope_struct____pyx_f_4aldy_9indelpost_6pileup_make_pileup = {
  PyVarObject_HEAD_INIT(0, 0)
  "aldy.indelpost.pileup.__pyx_scope_struct____pyx_f_4aldy_9indelpost_6pileup_make_pileup", /*tp_name*/
  sizeof(struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct____pyx_f_4aldy_9indelpost_6pileup_make_pileup), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4aldy_9indelpost_6pileup___pyx_scope_struct____pyx_f_4aldy_9indelpost_6pileup_make_pileup, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4aldy_9indelpost_6pileup___pyx_scope_struct____pyx_f_4aldy_9indelpost_6pileup_make_pileup, /*tp_traverse*/
  __pyx_tp_clear_4aldy_9indelpost_6pileup___pyx_scope_struct____pyx_f_4aldy_9indelpost_6pileup_make_pileup, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4aldy_9indelpost_6pileup___pyx_scope_struct____pyx_f_4aldy_9indelpost_6pileup_make_pileup, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_1_genexpr *__pyx_freelist_4aldy_9indelpost_6pileup___pyx_scope_struct_1_genexpr[8];
static int __pyx_freecount_4aldy_9indelpost_6pileup___pyx_scope_struct_1_genexpr = 0;

static PyObject *__pyx_tp_new_4aldy_9indelpost_6pileup___pyx_scope_struct_1_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4aldy_9indelpost_6pileup___pyx_scope_struct_1_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_1_genexpr)))) {
    o = (PyObject*)__pyx_freelist_4aldy_9indelpost_6pileup___pyx_scope_struct_1_genexpr[--__pyx_freecount_4aldy_9indelpost_6pileup___pyx_scope_struct_1_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_1_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4aldy_9indelpost_6pileup___pyx_scope_struct_1_genexpr(PyObject *o) {
  struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_1_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_v_v);
  Py_CLEAR(p->__pyx_t_0);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4aldy_9indelpost_6pileup___pyx_scope_struct_1_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_1_genexpr)))) {
    __pyx_freelist_4aldy_9indelpost_6pileup___pyx_scope_struct_1_genexpr[__pyx_freecount_4aldy_9indelpost_6pileup___pyx_scope_struct_1_genexpr++] = ((struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_1_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_4aldy_9indelpost_6pileup___pyx_scope_struct_1_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_1_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_v_v) {
    e = (*v)(p->__pyx_v_v, a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_4aldy_9indelpost_6pileup___pyx_scope_struct_1_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "aldy.indelpost.pileup.__pyx_scope_struct_1_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_1_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4aldy_9indelpost_6pileup___pyx_scope_struct_1_genexpr, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4aldy_9indelpost_6pileup___pyx_scope_struct_1_genexpr, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4aldy_9indelpost_6pileup___pyx_scope_struct_1_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_2___pyx_f_4aldy_9indelpost_6pileup_dictize_read *__pyx_freelist_4aldy_9indelpost_6pileup___pyx_scope_struct_2___pyx_f_4aldy_9indelpost_6pileup_dictize_read[8];
static int __pyx_freecount_4aldy_9indelpost_6pileup___pyx_scope_struct_2___pyx_f_4aldy_9indelpost_6pileup_dictize_read = 0;

static PyObject *__pyx_tp_new_4aldy_9indelpost_6pileup___pyx_scope_struct_2___pyx_f_4aldy_9indelpost_6pileup_dictize_read(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4aldy_9indelpost_6pileup___pyx_scope_struct_2___pyx_f_4aldy_9indelpost_6pileup_dictize_read > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_2___pyx_f_4aldy_9indelpost_6pileup_dictize_read)))) {
    o = (PyObject*)__pyx_freelist_4aldy_9indelpost_6pileup___pyx_scope_struct_2___pyx_f_4aldy_9indelpost_6pileup_dictize_read[--__pyx_freecount_4aldy_9indelpost_6pileup___pyx_scope_struct_2___pyx_f_4aldy_9indelpost_6pileup_dictize_read];
    memset(o, 0, sizeof(struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_2___pyx_f_4aldy_9indelpost_6pileup_dictize_read));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4aldy_9indelpost_6pileup___pyx_scope_struct_2___pyx_f_4aldy_9indelpost_6pileup_dictize_read(PyObject *o) {
  struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_2___pyx_f_4aldy_9indelpost_6pileup_dictize_read *p = (struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_2___pyx_f_4aldy_9indelpost_6pileup_dictize_read *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_cigar_list);
  Py_CLEAR(p->__pyx_v_read_qual);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4aldy_9indelpost_6pileup___pyx_scope_struct_2___pyx_f_4aldy_9indelpost_6pileup_dictize_read < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_2___pyx_f_4aldy_9indelpost_6pileup_dictize_read)))) {
    __pyx_freelist_4aldy_9indelpost_6pileup___pyx_scope_struct_2___pyx_f_4aldy_9indelpost_6pileup_dictize_read[__pyx_freecount_4aldy_9indelpost_6pileup___pyx_scope_struct_2___pyx_f_4aldy_9indelpost_6pileup_dictize_read++] = ((struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_2___pyx_f_4aldy_9indelpost_6pileup_dictize_read *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_4aldy_9indelpost_6pileup___pyx_scope_struct_2___pyx_f_4aldy_9indelpost_6pileup_dictize_read(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_2___pyx_f_4aldy_9indelpost_6pileup_dictize_read *p = (struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_2___pyx_f_4aldy_9indelpost_6pileup_dictize_read *)o;
  if (p->__pyx_v_cigar_list) {
    e = (*v)(p->__pyx_v_cigar_list, a); if (e) return e;
  }
  if (p->__pyx_v_read_qual) {
    e = (*v)(p->__pyx_v_read_qual, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4aldy_9indelpost_6pileup___pyx_scope_struct_2___pyx_f_4aldy_9indelpost_6pileup_dictize_read(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_2___pyx_f_4aldy_9indelpost_6pileup_dictize_read *p = (struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_2___pyx_f_4aldy_9indelpost_6pileup_dictize_read *)o;
  tmp = ((PyObject*)p->__pyx_v_cigar_list);
  p->__pyx_v_cigar_list = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_read_qual);
  p->__pyx_v_read_qual = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_4aldy_9indelpost_6pileup___pyx_scope_struct_2___pyx_f_4aldy_9indelpost_6pileup_dictize_read = {
  PyVarObject_HEAD_INIT(0, 0)
  "aldy.indelpost.pileup.__pyx_scope_struct_2___pyx_f_4aldy_9indelpost_6pileup_dictize_read", /*tp_name*/
  sizeof(struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_2___pyx_f_4aldy_9indelpost_6pileup_dictize_read), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4aldy_9indelpost_6pileup___pyx_scope_struct_2___pyx_f_4aldy_9indelpost_6pileup_dictize_read, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4aldy_9indelpost_6pileup___pyx_scope_struct_2___pyx_f_4aldy_9indelpost_6pileup_dictize_read, /*tp_traverse*/
  __pyx_tp_clear_4aldy_9indelpost_6pileup___pyx_scope_struct_2___pyx_f_4aldy_9indelpost_6pileup_dictize_read, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4aldy_9indelpost_6pileup___pyx_scope_struct_2___pyx_f_4aldy_9indelpost_6pileup_dictize_read, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_3_genexpr *__pyx_freelist_4aldy_9indelpost_6pileup___pyx_scope_struct_3_genexpr[8];
static int __pyx_freecount_4aldy_9indelpost_6pileup___pyx_scope_struct_3_genexpr = 0;

static PyObject *__pyx_tp_new_4aldy_9indelpost_6pileup___pyx_scope_struct_3_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4aldy_9indelpost_6pileup___pyx_scope_struct_3_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_3_genexpr)))) {
    o = (PyObject*)__pyx_freelist_4aldy_9indelpost_6pileup___pyx_scope_struct_3_genexpr[--__pyx_freecount_4aldy_9indelpost_6pileup___pyx_scope_struct_3_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_3_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4aldy_9indelpost_6pileup___pyx_scope_struct_3_genexpr(PyObject *o) {
  struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_3_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_v_c);
  Py_CLEAR(p->__pyx_t_0);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4aldy_9indelpost_6pileup___pyx_scope_struct_3_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_3_genexpr)))) {
    __pyx_freelist_4aldy_9indelpost_6pileup___pyx_scope_struct_3_genexpr[__pyx_freecount_4aldy_9indelpost_6pileup___pyx_scope_struct_3_genexpr++] = ((struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_3_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_4aldy_9indelpost_6pileup___pyx_scope_struct_3_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_3_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_v_c) {
    e = (*v)(p->__pyx_v_c, a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_4aldy_9indelpost_6pileup___pyx_scope_struct_3_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "aldy.indelpost.pileup.__pyx_scope_struct_3_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_3_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4aldy_9indelpost_6pileup___pyx_scope_struct_3_genexpr, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4aldy_9indelpost_6pileup___pyx_scope_struct_3_genexpr, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4aldy_9indelpost_6pileup___pyx_scope_struct_3_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_4_genexpr *__pyx_freelist_4aldy_9indelpost_6pileup___pyx_scope_struct_4_genexpr[8];
static int __pyx_freecount_4aldy_9indelpost_6pileup___pyx_scope_struct_4_genexpr = 0;

static PyObject *__pyx_tp_new_4aldy_9indelpost_6pileup___pyx_scope_struct_4_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4aldy_9indelpost_6pileup___pyx_scope_struct_4_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_4_genexpr)))) {
    o = (PyObject*)__pyx_freelist_4aldy_9indelpost_6pileup___pyx_scope_struct_4_genexpr[--__pyx_freecount_4aldy_9indelpost_6pileup___pyx_scope_struct_4_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_4_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4aldy_9indelpost_6pileup___pyx_scope_struct_4_genexpr(PyObject *o) {
  struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_4_genexpr *p = (struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_4_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_v_q);
  Py_CLEAR(p->__pyx_t_0);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4aldy_9indelpost_6pileup___pyx_scope_struct_4_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_4_genexpr)))) {
    __pyx_freelist_4aldy_9indelpost_6pileup___pyx_scope_struct_4_genexpr[__pyx_freecount_4aldy_9indelpost_6pileup___pyx_scope_struct_4_genexpr++] = ((struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_4_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_4aldy_9indelpost_6pileup___pyx_scope_struct_4_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_4_genexpr *p = (struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_4_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_v_q) {
    e = (*v)(p->__pyx_v_q, a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_4aldy_9indelpost_6pileup___pyx_scope_struct_4_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "aldy.indelpost.pileup.__pyx_scope_struct_4_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_4_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4aldy_9indelpost_6pileup___pyx_scope_struct_4_genexpr, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4aldy_9indelpost_6pileup___pyx_scope_struct_4_genexpr, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4aldy_9indelpost_6pileup___pyx_scope_struct_4_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_5_retarget *__pyx_freelist_4aldy_9indelpost_6pileup___pyx_scope_struct_5_retarget[8];
static int __pyx_freecount_4aldy_9indelpost_6pileup___pyx_scope_struct_5_retarget = 0;

static PyObject *__pyx_tp_new_4aldy_9indelpost_6pileup___pyx_scope_struct_5_retarget(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4aldy_9indelpost_6pileup___pyx_scope_struct_5_retarget > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_5_retarget)))) {
    o = (PyObject*)__pyx_freelist_4aldy_9indelpost_6pileup___pyx_scope_struct_5_retarget[--__pyx_freecount_4aldy_9indelpost_6pileup___pyx_scope_struct_5_retarget];
    memset(o, 0, sizeof(struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_5_retarget));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4aldy_9indelpost_6pileup___pyx_scope_struct_5_retarget(PyObject *o) {
  struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_5_retarget *p = (struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_5_retarget *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_target);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4aldy_9indelpost_6pileup___pyx_scope_struct_5_retarget < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_5_retarget)))) {
    __pyx_freelist_4aldy_9indelpost_6pileup___pyx_scope_struct_5_retarget[__pyx_freecount_4aldy_9indelpost_6pileup___pyx_scope_struct_5_retarget++] = ((struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_5_retarget *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

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

static int __pyx_tp_clear_4aldy_9indelpost_6pileup___pyx_scope_struct_5_retarget(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_5_retarget *p = (struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_5_retarget *)o;
  tmp = ((PyObject*)p->__pyx_v_target);
  p->__pyx_v_target = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_4aldy_9indelpost_6pileup___pyx_scope_struct_5_retarget = {
  PyVarObject_HEAD_INIT(0, 0)
  "aldy.indelpost.pileup.__pyx_scope_struct_5_retarget", /*tp_name*/
  sizeof(struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_5_retarget), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4aldy_9indelpost_6pileup___pyx_scope_struct_5_retarget, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4aldy_9indelpost_6pileup___pyx_scope_struct_5_retarget, /*tp_traverse*/
  __pyx_tp_clear_4aldy_9indelpost_6pileup___pyx_scope_struct_5_retarget, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4aldy_9indelpost_6pileup___pyx_scope_struct_5_retarget, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_6_update_pileup *__pyx_freelist_4aldy_9indelpost_6pileup___pyx_scope_struct_6_update_pileup[8];
static int __pyx_freecount_4aldy_9indelpost_6pileup___pyx_scope_struct_6_update_pileup = 0;

static PyObject *__pyx_tp_new_4aldy_9indelpost_6pileup___pyx_scope_struct_6_update_pileup(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4aldy_9indelpost_6pileup___pyx_scope_struct_6_update_pileup > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_6_update_pileup)))) {
    o = (PyObject*)__pyx_freelist_4aldy_9indelpost_6pileup___pyx_scope_struct_6_update_pileup[--__pyx_freecount_4aldy_9indelpost_6pileup___pyx_scope_struct_6_update_pileup];
    memset(o, 0, sizeof(struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_6_update_pileup));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4aldy_9indelpost_6pileup___pyx_scope_struct_6_update_pileup(PyObject *o) {
  struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_6_update_pileup *p = (struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_6_update_pileup *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_new_target);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4aldy_9indelpost_6pileup___pyx_scope_struct_6_update_pileup < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_6_update_pileup)))) {
    __pyx_freelist_4aldy_9indelpost_6pileup___pyx_scope_struct_6_update_pileup[__pyx_freecount_4aldy_9indelpost_6pileup___pyx_scope_struct_6_update_pileup++] = ((struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_6_update_pileup *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

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

static int __pyx_tp_clear_4aldy_9indelpost_6pileup___pyx_scope_struct_6_update_pileup(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_6_update_pileup *p = (struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_6_update_pileup *)o;
  tmp = ((PyObject*)p->__pyx_v_new_target);
  p->__pyx_v_new_target = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_4aldy_9indelpost_6pileup___pyx_scope_struct_6_update_pileup = {
  PyVarObject_HEAD_INIT(0, 0)
  "aldy.indelpost.pileup.__pyx_scope_struct_6_update_pileup", /*tp_name*/
  sizeof(struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_6_update_pileup), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4aldy_9indelpost_6pileup___pyx_scope_struct_6_update_pileup, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4aldy_9indelpost_6pileup___pyx_scope_struct_6_update_pileup, /*tp_traverse*/
  __pyx_tp_clear_4aldy_9indelpost_6pileup___pyx_scope_struct_6_update_pileup, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4aldy_9indelpost_6pileup___pyx_scope_struct_6_update_pileup, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_7_genexpr *__pyx_freelist_4aldy_9indelpost_6pileup___pyx_scope_struct_7_genexpr[8];
static int __pyx_freecount_4aldy_9indelpost_6pileup___pyx_scope_struct_7_genexpr = 0;

static PyObject *__pyx_tp_new_4aldy_9indelpost_6pileup___pyx_scope_struct_7_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4aldy_9indelpost_6pileup___pyx_scope_struct_7_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_7_genexpr)))) {
    o = (PyObject*)__pyx_freelist_4aldy_9indelpost_6pileup___pyx_scope_struct_7_genexpr[--__pyx_freecount_4aldy_9indelpost_6pileup___pyx_scope_struct_7_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_7_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4aldy_9indelpost_6pileup___pyx_scope_struct_7_genexpr(PyObject *o) {
  struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_7_genexpr *p = (struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_7_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_v_v);
  Py_CLEAR(p->__pyx_t_0);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4aldy_9indelpost_6pileup___pyx_scope_struct_7_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_7_genexpr)))) {
    __pyx_freelist_4aldy_9indelpost_6pileup___pyx_scope_struct_7_genexpr[__pyx_freecount_4aldy_9indelpost_6pileup___pyx_scope_struct_7_genexpr++] = ((struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_7_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_4aldy_9indelpost_6pileup___pyx_scope_struct_7_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_7_genexpr *p = (struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_7_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_v_v) {
    e = (*v)(p->__pyx_v_v, a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_4aldy_9indelpost_6pileup___pyx_scope_struct_7_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "aldy.indelpost.pileup.__pyx_scope_struct_7_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_4aldy_9indelpost_6pileup___pyx_scope_struct_7_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4aldy_9indelpost_6pileup___pyx_scope_struct_7_genexpr, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4aldy_9indelpost_6pileup___pyx_scope_struct_7_genexpr, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4aldy_9indelpost_6pileup___pyx_scope_struct_7_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
  0, /*tp_pypy_flags*/
  #endif
};

static PyMethodDef __pyx_methods[] = {
  {0, 0, 0, 0}
};

#if PY_MAJOR_VERSION >= 3
#if CYTHON_PEP489_MULTI_PHASE_INIT
static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
static int __pyx_pymod_exec_pileup(PyObject* module); /*proto*/
static PyModuleDef_Slot __pyx_moduledef_slots[] = {
  {Py_mod_create, (void*)__pyx_pymod_create},
  {Py_mod_exec, (void*)__pyx_pymod_exec_pileup},
  {0, NULL}
};
#endif

static struct PyModuleDef __pyx_moduledef = {
    PyModuleDef_HEAD_INIT,
    "pileup",
    0, /* m_doc */
  #if CYTHON_PEP489_MULTI_PHASE_INIT
    0, /* m_size */
  #else
    -1, /* m_size */
  #endif
    __pyx_methods /* m_methods */,
  #if CYTHON_PEP489_MULTI_PHASE_INIT
    __pyx_moduledef_slots, /* m_slots */
  #else
    NULL, /* m_reload */
  #endif
    NULL, /* m_traverse */
    NULL, /* m_clear */
    NULL /* m_free */
};
#endif
#ifndef CYTHON_SMALL_CODE
#if defined(__clang__)
    #define CYTHON_SMALL_CODE
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
    #define CYTHON_SMALL_CODE __attribute__((cold))
#else
    #define CYTHON_SMALL_CODE
#endif
#endif

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_kp_u_, __pyx_k_, sizeof(__pyx_k_), 0, 1, 0, 0},
  {&__pyx_kp_u_0_9_MIDNSHPX, __pyx_k_0_9_MIDNSHPX, sizeof(__pyx_k_0_9_MIDNSHPX), 0, 1, 0, 0},
  {&__pyx_n_s_CIGAR, __pyx_k_CIGAR, sizeof(__pyx_k_CIGAR), 0, 0, 1, 1},
  {&__pyx_n_u_D, __pyx_k_D, sizeof(__pyx_k_D), 0, 1, 0, 1},
  {&__pyx_n_u_H, __pyx_k_H, sizeof(__pyx_k_H), 0, 1, 0, 1},
  {&__pyx_n_u_I, __pyx_k_I, sizeof(__pyx_k_I), 0, 1, 0, 1},
  {&__pyx_n_u_M, __pyx_k_M, sizeof(__pyx_k_M), 0, 1, 0, 1},
  {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
  {&__pyx_n_u_N, __pyx_k_N, sizeof(__pyx_k_N), 0, 1, 0, 1},
  {&__pyx_n_u_P, __pyx_k_P, sizeof(__pyx_k_P), 0, 1, 0, 1},
  {&__pyx_n_u_S, __pyx_k_S, sizeof(__pyx_k_S), 0, 1, 0, 1},
  {&__pyx_n_s_SequenceMatcher, __pyx_k_SequenceMatcher, sizeof(__pyx_k_SequenceMatcher), 0, 0, 1, 1},
  {&__pyx_n_u_X, __pyx_k_X, sizeof(__pyx_k_X), 0, 1, 0, 1},
  {&__pyx_kp_u__10, __pyx_k__10, sizeof(__pyx_k__10), 0, 1, 0, 0},
  {&__pyx_kp_u__3, __pyx_k__3, sizeof(__pyx_k__3), 0, 1, 0, 0},
  {&__pyx_kp_u__9, __pyx_k__9, sizeof(__pyx_k__9), 0, 1, 0, 0},
  {&__pyx_n_s_aldy_indelpost_pileup, __pyx_k_aldy_indelpost_pileup, sizeof(__pyx_k_aldy_indelpost_pileup), 0, 0, 1, 1},
  {&__pyx_kp_s_aldy_indelpost_pileup_pyx, __pyx_k_aldy_indelpost_pileup_pyx, sizeof(__pyx_k_aldy_indelpost_pileup_pyx), 0, 0, 1, 0},
  {&__pyx_n_s_align, __pyx_k_align, sizeof(__pyx_k_align), 0, 0, 1, 1},
  {&__pyx_n_s_aligned_frac, __pyx_k_aligned_frac, sizeof(__pyx_k_aligned_frac), 0, 0, 1, 1},
  {&__pyx_n_s_aligned_read_len, __pyx_k_aligned_read_len, sizeof(__pyx_k_aligned_read_len), 0, 0, 1, 1},
  {&__pyx_n_s_aligner, __pyx_k_aligner, sizeof(__pyx_k_aligner), 0, 0, 1, 1},
  {&__pyx_n_s_aligners, __pyx_k_aligners, sizeof(__pyx_k_aligners), 0, 0, 1, 1},
  {&__pyx_n_u_all, __pyx_k_all, sizeof(__pyx_k_all), 0, 1, 0, 1},
  {&__pyx_n_s_aln, __pyx_k_aln, sizeof(__pyx_k_aln), 0, 0, 1, 1},
  {&__pyx_n_u_aln_end, __pyx_k_aln_end, sizeof(__pyx_k_aln_end), 0, 1, 0, 1},
  {&__pyx_n_s_aln_len, __pyx_k_aln_len, sizeof(__pyx_k_aln_len), 0, 0, 1, 1},
  {&__pyx_n_u_aln_start, __pyx_k_aln_start, sizeof(__pyx_k_aln_start), 0, 1, 0, 1},
  {&__pyx_n_s_alt, __pyx_k_alt, sizeof(__pyx_k_alt), 0, 0, 1, 1},
  {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 0, 0, 1, 1},
  {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1},
  {&__pyx_n_s_array, __pyx_k_array, sizeof(__pyx_k_array), 0, 0, 1, 1},
  {&__pyx_n_s_basequals, __pyx_k_basequals, sizeof(__pyx_k_basequals), 0, 0, 1, 1},
  {&__pyx_n_s_basequalthresh, __pyx_k_basequalthresh, sizeof(__pyx_k_basequalthresh), 0, 0, 1, 1},
  {&__pyx_n_s_best_match, __pyx_k_best_match, sizeof(__pyx_k_best_match), 0, 0, 1, 1},
  {&__pyx_n_s_best_seq, __pyx_k_best_seq, sizeof(__pyx_k_best_seq), 0, 0, 1, 1},
  {&__pyx_n_s_bypass_search, __pyx_k_bypass_search, sizeof(__pyx_k_bypass_search), 0, 0, 1, 1},
  {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1},
  {&__pyx_n_s_candidate, __pyx_k_candidate, sizeof(__pyx_k_candidate), 0, 0, 1, 1},
  {&__pyx_n_s_candidate_aligners, __pyx_k_candidate_aligners, sizeof(__pyx_k_candidate_aligners), 0, 0, 1, 1},
  {&__pyx_n_s_candidate_reads, __pyx_k_candidate_reads, sizeof(__pyx_k_candidate_reads), 0, 0, 1, 1},
  {&__pyx_n_s_candidate_ref_seqs, __pyx_k_candidate_ref_seqs, sizeof(__pyx_k_candidate_ref_seqs), 0, 0, 1, 1},
  {&__pyx_n_s_candidate_ref_starts, __pyx_k_candidate_ref_starts, sizeof(__pyx_k_candidate_ref_starts), 0, 0, 1, 1},
  {&__pyx_n_s_candidate_seqs, __pyx_k_candidate_seqs, sizeof(__pyx_k_candidate_seqs), 0, 0, 1, 1},
  {&__pyx_n_s_candidates, __pyx_k_candidates, sizeof(__pyx_k_candidates), 0, 0, 1, 1},
  {&__pyx_n_s_check_overhangs, __pyx_k_check_overhangs, sizeof(__pyx_k_check_overhangs), 0, 0, 1, 1},
  {&__pyx_n_u_chr, __pyx_k_chr, sizeof(__pyx_k_chr), 0, 1, 0, 1},
  {&__pyx_n_s_chrom, __pyx_k_chrom, sizeof(__pyx_k_chrom), 0, 0, 1, 1},
  {&__pyx_n_u_cigar_list, __pyx_k_cigar_list, sizeof(__pyx_k_cigar_list), 0, 1, 0, 1},
  {&__pyx_n_s_cigar_ptrn, __pyx_k_cigar_ptrn, sizeof(__pyx_k_cigar_ptrn), 0, 0, 1, 1},
  {&__pyx_n_u_cigar_string, __pyx_k_cigar_string, sizeof(__pyx_k_cigar_string), 0, 1, 0, 1},
  {&__pyx_n_u_cigar_updated, __pyx_k_cigar_updated, sizeof(__pyx_k_cigar_updated), 0, 1, 0, 1},
  {&__pyx_n_s_cigarstring, __pyx_k_cigarstring, sizeof(__pyx_k_cigarstring), 0, 0, 1, 1},
  {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
  {&__pyx_n_s_clip_len, __pyx_k_clip_len, sizeof(__pyx_k_clip_len), 0, 0, 1, 1},
  {&__pyx_n_s_clipped_bases, __pyx_k_clipped_bases, sizeof(__pyx_k_clipped_bases), 0, 0, 1, 1},
  {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1},
  {&__pyx_n_s_compile, __pyx_k_compile, sizeof(__pyx_k_compile), 0, 0, 1, 1},
  {&__pyx_n_s_complex_candidates, __pyx_k_complex_candidates, sizeof(__pyx_k_complex_candidates), 0, 0, 1, 1},
  {&__pyx_n_s_complex_del, __pyx_k_complex_del, sizeof(__pyx_k_complex_del), 0, 0, 1, 1},
  {&__pyx_n_s_complex_flags, __pyx_k_complex_flags, sizeof(__pyx_k_complex_flags), 0, 0, 1, 1},
  {&__pyx_n_s_complex_ins, __pyx_k_complex_ins, sizeof(__pyx_k_complex_ins), 0, 0, 1, 1},
  {&__pyx_n_s_complex_positions, __pyx_k_complex_positions, sizeof(__pyx_k_complex_positions), 0, 0, 1, 1},
  {&__pyx_n_s_consensus, __pyx_k_consensus, sizeof(__pyx_k_consensus), 0, 0, 1, 1},
  {&__pyx_n_s_consensus_refseq, __pyx_k_consensus_refseq, sizeof(__pyx_k_consensus_refseq), 0, 0, 1, 1},
  {&__pyx_n_s_copy, __pyx_k_copy, sizeof(__pyx_k_copy), 0, 0, 1, 1},
  {&__pyx_n_s_count, __pyx_k_count, sizeof(__pyx_k_count), 0, 0, 1, 1},
  {&__pyx_n_s_covering_subread, __pyx_k_covering_subread, sizeof(__pyx_k_covering_subread), 0, 0, 1, 1},
  {&__pyx_n_u_covering_subread, __pyx_k_covering_subread, sizeof(__pyx_k_covering_subread), 0, 1, 0, 1},
  {&__pyx_n_s_cplx_candidate, __pyx_k_cplx_candidate, sizeof(__pyx_k_cplx_candidate), 0, 0, 1, 1},
  {&__pyx_n_s_cum, __pyx_k_cum, sizeof(__pyx_k_cum), 0, 0, 1, 1},
  {&__pyx_n_s_current_pos, __pyx_k_current_pos, sizeof(__pyx_k_current_pos), 0, 0, 1, 1},
  {&__pyx_n_s_cutoff, __pyx_k_cutoff, sizeof(__pyx_k_cutoff), 0, 0, 1, 1},
  {&__pyx_n_s_d, __pyx_k_d, sizeof(__pyx_k_d), 0, 0, 1, 1},
  {&__pyx_n_u_del_seq, __pyx_k_del_seq, sizeof(__pyx_k_del_seq), 0, 1, 0, 1},
  {&__pyx_n_s_dictize_read_locals_genexpr, __pyx_k_dictize_read_locals_genexpr, sizeof(__pyx_k_dictize_read_locals_genexpr), 0, 0, 1, 1},
  {&__pyx_n_s_difflib, __pyx_k_difflib, sizeof(__pyx_k_difflib), 0, 0, 1, 1},
  {&__pyx_n_u_end_offset, __pyx_k_end_offset, sizeof(__pyx_k_end_offset), 0, 1, 0, 1},
  {&__pyx_n_s_endswith, __pyx_k_endswith, sizeof(__pyx_k_endswith), 0, 0, 1, 1},
  {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
  {&__pyx_n_s_event, __pyx_k_event, sizeof(__pyx_k_event), 0, 0, 1, 1},
  {&__pyx_n_s_event_len, __pyx_k_event_len, sizeof(__pyx_k_event_len), 0, 0, 1, 1},
  {&__pyx_n_s_fetch, __pyx_k_fetch, sizeof(__pyx_k_fetch), 0, 0, 1, 1},
  {&__pyx_n_s_filter_spurious_overhangs, __pyx_k_filter_spurious_overhangs, sizeof(__pyx_k_filter_spurious_overhangs), 0, 0, 1, 1},
  {&__pyx_n_s_find_by_normalization, __pyx_k_find_by_normalization, sizeof(__pyx_k_find_by_normalization), 0, 0, 1, 1},
  {&__pyx_n_s_findall, __pyx_k_findall, sizeof(__pyx_k_findall), 0, 0, 1, 1},
  {&__pyx_n_s_findall_indels, __pyx_k_findall_indels, sizeof(__pyx_k_findall_indels), 0, 0, 1, 1},
  {&__pyx_n_s_findall_mismatches, __pyx_k_findall_mismatches, sizeof(__pyx_k_findall_mismatches), 0, 0, 1, 1},
  {&__pyx_n_s_flank_cigar, __pyx_k_flank_cigar, sizeof(__pyx_k_flank_cigar), 0, 0, 1, 1},
  {&__pyx_n_s_functools, __pyx_k_functools, sizeof(__pyx_k_functools), 0, 0, 1, 1},
  {&__pyx_n_s_gap_cnt, __pyx_k_gap_cnt, sizeof(__pyx_k_gap_cnt), 0, 0, 1, 1},
  {&__pyx_n_s_gap_extension_penalty, __pyx_k_gap_extension_penalty, sizeof(__pyx_k_gap_extension_penalty), 0, 0, 1, 1},
  {&__pyx_n_s_gap_open_penalty, __pyx_k_gap_open_penalty, sizeof(__pyx_k_gap_open_penalty), 0, 0, 1, 1},
  {&__pyx_n_s_gappedaln, __pyx_k_gappedaln, sizeof(__pyx_k_gappedaln), 0, 0, 1, 1},
  {&__pyx_n_s_generate_equivalents, __pyx_k_generate_equivalents, sizeof(__pyx_k_generate_equivalents), 0, 0, 1, 1},
  {&__pyx_n_s_generate_equivalents_private, __pyx_k_generate_equivalents_private, sizeof(__pyx_k_generate_equivalents_private), 0, 0, 1, 1},
  {&__pyx_n_s_genexpr, __pyx_k_genexpr, sizeof(__pyx_k_genexpr), 0, 0, 1, 1},
  {&__pyx_n_s_genome_aligner, __pyx_k_genome_aligner, sizeof(__pyx_k_genome_aligner), 0, 0, 1, 1},
  {&__pyx_n_s_genome_aln, __pyx_k_genome_aln, sizeof(__pyx_k_genome_aln), 0, 0, 1, 1},
  {&__pyx_n_s_genome_aln_pos, __pyx_k_genome_aln_pos, sizeof(__pyx_k_genome_aln_pos), 0, 0, 1, 1},
  {&__pyx_n_s_genome_cigar, __pyx_k_genome_cigar, sizeof(__pyx_k_genome_cigar), 0, 0, 1, 1},
  {&__pyx_n_s_genome_ref, __pyx_k_genome_ref, sizeof(__pyx_k_genome_ref), 0, 0, 1, 1},
  {&__pyx_n_s_genome_score, __pyx_k_genome_score, sizeof(__pyx_k_genome_score), 0, 0, 1, 1},
  {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1},
  {&__pyx_n_s_get_close_matches, __pyx_k_get_close_matches, sizeof(__pyx_k_get_close_matches), 0, 0, 1, 1},
  {&__pyx_n_s_get_indel_seq, __pyx_k_get_indel_seq, sizeof(__pyx_k_get_indel_seq), 0, 0, 1, 1},
  {&__pyx_n_s_get_local_reference, __pyx_k_get_local_reference, sizeof(__pyx_k_get_local_reference), 0, 0, 1, 1},
  {&__pyx_n_s_get_mapped_subreads, __pyx_k_get_mapped_subreads, sizeof(__pyx_k_get_mapped_subreads), 0, 0, 1, 1},
  {&__pyx_n_s_get_ref_seq, __pyx_k_get_ref_seq, sizeof(__pyx_k_get_ref_seq), 0, 0, 1, 1},
  {&__pyx_n_s_get_reference_length, __pyx_k_get_reference_length, sizeof(__pyx_k_get_reference_length), 0, 0, 1, 1},
  {&__pyx_n_s_hit, __pyx_k_hit, sizeof(__pyx_k_hit), 0, 0, 1, 1},
  {&__pyx_n_s_how, __pyx_k_how, sizeof(__pyx_k_how), 0, 0, 1, 1},
  {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
  {&__pyx_n_s_idx, __pyx_k_idx, sizeof(__pyx_k_idx), 0, 0, 1, 1},
  {&__pyx_n_s_idx2, __pyx_k_idx2, sizeof(__pyx_k_idx2), 0, 0, 1, 1},
  {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
  {&__pyx_n_s_indel, __pyx_k_indel, sizeof(__pyx_k_indel), 0, 0, 1, 1},
  {&__pyx_n_s_indel_pos_in_this_read, __pyx_k_indel_pos_in_this_read, sizeof(__pyx_k_indel_pos_in_this_read), 0, 0, 1, 1},
  {&__pyx_n_s_indel_seq, __pyx_k_indel_seq, sizeof(__pyx_k_indel_seq), 0, 0, 1, 1},
  {&__pyx_n_u_indel_seq, __pyx_k_indel_seq, sizeof(__pyx_k_indel_seq), 0, 1, 0, 1},
  {&__pyx_n_u_indel_type, __pyx_k_indel_type, sizeof(__pyx_k_indel_type), 0, 1, 0, 1},
  {&__pyx_n_s_indels, __pyx_k_indels, sizeof(__pyx_k_indels), 0, 0, 1, 1},
  {&__pyx_n_s_indels_within_intron, __pyx_k_indels_within_intron, sizeof(__pyx_k_indels_within_intron), 0, 0, 1, 1},
  {&__pyx_n_s_index, __pyx_k_index, sizeof(__pyx_k_index), 0, 0, 1, 1},
  {&__pyx_n_s_inplace, __pyx_k_inplace, sizeof(__pyx_k_inplace), 0, 0, 1, 1},
  {&__pyx_n_s_intron, __pyx_k_intron, sizeof(__pyx_k_intron), 0, 0, 1, 1},
  {&__pyx_n_s_intron_end, __pyx_k_intron_end, sizeof(__pyx_k_intron_end), 0, 0, 1, 1},
  {&__pyx_n_u_intron_pattern, __pyx_k_intron_pattern, sizeof(__pyx_k_intron_pattern), 0, 1, 0, 1},
  {&__pyx_n_s_intron_ptrn, __pyx_k_intron_ptrn, sizeof(__pyx_k_intron_ptrn), 0, 0, 1, 1},
  {&__pyx_n_s_intron_ptrns, __pyx_k_intron_ptrns, sizeof(__pyx_k_intron_ptrns), 0, 0, 1, 1},
  {&__pyx_n_s_intron_start, __pyx_k_intron_start, sizeof(__pyx_k_intron_start), 0, 0, 1, 1},
  {&__pyx_n_s_introns, __pyx_k_introns, sizeof(__pyx_k_introns), 0, 0, 1, 1},
  {&__pyx_n_s_is_covering, __pyx_k_is_covering, sizeof(__pyx_k_is_covering), 0, 0, 1, 1},
  {&__pyx_n_u_is_covering, __pyx_k_is_covering, sizeof(__pyx_k_is_covering), 0, 1, 0, 1},
  {&__pyx_n_u_is_dirty, __pyx_k_is_dirty, sizeof(__pyx_k_is_dirty), 0, 1, 0, 1},
  {&__pyx_n_s_is_duplicate, __pyx_k_is_duplicate, sizeof(__pyx_k_is_duplicate), 0, 0, 1, 1},
  {&__pyx_n_u_is_end_dirty, __pyx_k_is_end_dirty, sizeof(__pyx_k_is_end_dirty), 0, 1, 0, 1},
  {&__pyx_n_s_is_found, __pyx_k_is_found, sizeof(__pyx_k_is_found), 0, 0, 1, 1},
  {&__pyx_n_s_is_gapped_aln, __pyx_k_is_gapped_aln, sizeof(__pyx_k_is_gapped_aln), 0, 0, 1, 1},
  {&__pyx_n_s_is_ins, __pyx_k_is_ins, sizeof(__pyx_k_is_ins), 0, 0, 1, 1},
  {&__pyx_n_s_is_junctional, __pyx_k_is_junctional, sizeof(__pyx_k_is_junctional), 0, 0, 1, 1},
  {&__pyx_n_s_is_non_complex_indel, __pyx_k_is_non_complex_indel, sizeof(__pyx_k_is_non_complex_indel), 0, 0, 1, 1},
  {&__pyx_n_s_is_non_spurious_overhang, __pyx_k_is_non_spurious_overhang, sizeof(__pyx_k_is_non_spurious_overhang), 0, 0, 1, 1},
  {&__pyx_n_s_is_overhang, __pyx_k_is_overhang, sizeof(__pyx_k_is_overhang), 0, 0, 1, 1},
  {&__pyx_n_u_is_reference_seq, __pyx_k_is_reference_seq, sizeof(__pyx_k_is_reference_seq), 0, 1, 0, 1},
  {&__pyx_n_s_is_reverse, __pyx_k_is_reverse, sizeof(__pyx_k_is_reverse), 0, 0, 1, 1},
  {&__pyx_n_u_is_reverse, __pyx_k_is_reverse, sizeof(__pyx_k_is_reverse), 0, 1, 0, 1},
  {&__pyx_n_s_is_secondary, __pyx_k_is_secondary, sizeof(__pyx_k_is_secondary), 0, 0, 1, 1},
  {&__pyx_n_s_is_spliced, __pyx_k_is_spliced, sizeof(__pyx_k_is_spliced), 0, 0, 1, 1},
  {&__pyx_n_u_is_spliced, __pyx_k_is_spliced, sizeof(__pyx_k_is_spliced), 0, 1, 0, 1},
  {&__pyx_n_u_is_target, __pyx_k_is_target, sizeof(__pyx_k_is_target), 0, 1, 0, 1},
  {&__pyx_n_s_is_within_intron, __pyx_k_is_within_intron, sizeof(__pyx_k_is_within_intron), 0, 0, 1, 1},
  {&__pyx_n_s_is_worth_realn, __pyx_k_is_worth_realn, sizeof(__pyx_k_is_worth_realn), 0, 0, 1, 1},
  {&__pyx_n_u_is_worth_realn, __pyx_k_is_worth_realn, sizeof(__pyx_k_is_worth_realn), 0, 1, 0, 1},
  {&__pyx_n_s_jndel, __pyx_k_jndel, sizeof(__pyx_k_jndel), 0, 0, 1, 1},
  {&__pyx_n_s_junction_aligner, __pyx_k_junction_aligner, sizeof(__pyx_k_junction_aligner), 0, 0, 1, 1},
  {&__pyx_n_s_junction_aln, __pyx_k_junction_aln, sizeof(__pyx_k_junction_aln), 0, 0, 1, 1},
  {&__pyx_n_s_junction_ref, __pyx_k_junction_ref, sizeof(__pyx_k_junction_ref), 0, 0, 1, 1},
  {&__pyx_n_s_junction_score, __pyx_k_junction_score, sizeof(__pyx_k_junction_score), 0, 0, 1, 1},
  {&__pyx_n_s_junctional_aligner, __pyx_k_junctional_aligner, sizeof(__pyx_k_junctional_aligner), 0, 0, 1, 1},
  {&__pyx_n_s_key, __pyx_k_key, sizeof(__pyx_k_key), 0, 0, 1, 1},
  {&__pyx_n_s_last, __pyx_k_last, sizeof(__pyx_k_last), 0, 0, 1, 1},
  {&__pyx_n_s_left, __pyx_k_left, sizeof(__pyx_k_left), 0, 0, 1, 1},
  {&__pyx_n_s_left_adjust, __pyx_k_left_adjust, sizeof(__pyx_k_left_adjust), 0, 0, 1, 1},
  {&__pyx_n_s_localn, __pyx_k_localn, sizeof(__pyx_k_localn), 0, 0, 1, 1},
  {&__pyx_n_u_low_qual_base_num, __pyx_k_low_qual_base_num, sizeof(__pyx_k_low_qual_base_num), 0, 1, 0, 1},
  {&__pyx_n_u_lt_cigar, __pyx_k_lt_cigar, sizeof(__pyx_k_lt_cigar), 0, 1, 0, 1},
  {&__pyx_n_u_lt_clipped, __pyx_k_lt_clipped, sizeof(__pyx_k_lt_clipped), 0, 1, 0, 1},
  {&__pyx_n_s_lt_exon_end, __pyx_k_lt_exon_end, sizeof(__pyx_k_lt_exon_end), 0, 0, 1, 1},
  {&__pyx_n_u_lt_flank, __pyx_k_lt_flank, sizeof(__pyx_k_lt_flank), 0, 1, 0, 1},
  {&__pyx_n_s_lt_len, __pyx_k_lt_len, sizeof(__pyx_k_lt_len), 0, 0, 1, 1},
  {&__pyx_n_s_lt_most_cigar, __pyx_k_lt_most_cigar, sizeof(__pyx_k_lt_most_cigar), 0, 0, 1, 1},
  {&__pyx_n_u_lt_qual, __pyx_k_lt_qual, sizeof(__pyx_k_lt_qual), 0, 1, 0, 1},
  {&__pyx_n_s_lt_read_lim, __pyx_k_lt_read_lim, sizeof(__pyx_k_lt_read_lim), 0, 0, 1, 1},
  {&__pyx_n_u_lt_ref, __pyx_k_lt_ref, sizeof(__pyx_k_lt_ref), 0, 1, 0, 1},
  {&__pyx_n_s_m, __pyx_k_m, sizeof(__pyx_k_m), 0, 0, 1, 1},
  {&__pyx_n_s_m1, __pyx_k_m1, sizeof(__pyx_k_m1), 0, 0, 1, 1},
  {&__pyx_n_s_m2, __pyx_k_m2, sizeof(__pyx_k_m2), 0, 0, 1, 1},
  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
  {&__pyx_n_s_make_aligner, __pyx_k_make_aligner, sizeof(__pyx_k_make_aligner), 0, 0, 1, 1},
  {&__pyx_n_s_make_insertion_first, __pyx_k_make_insertion_first, sizeof(__pyx_k_make_insertion_first), 0, 0, 1, 1},
  {&__pyx_n_s_make_pileup_locals_genexpr, __pyx_k_make_pileup_locals_genexpr, sizeof(__pyx_k_make_pileup_locals_genexpr), 0, 0, 1, 1},
  {&__pyx_n_s_mapping_quality, __pyx_k_mapping_quality, sizeof(__pyx_k_mapping_quality), 0, 0, 1, 1},
  {&__pyx_n_u_mapq, __pyx_k_mapq, sizeof(__pyx_k_mapq), 0, 1, 0, 1},
  {&__pyx_n_s_mapq4retarget, __pyx_k_mapq4retarget, sizeof(__pyx_k_mapq4retarget), 0, 0, 1, 1},
  {&__pyx_n_s_match_score, __pyx_k_match_score, sizeof(__pyx_k_match_score), 0, 0, 1, 1},
  {&__pyx_n_s_max, __pyx_k_max, sizeof(__pyx_k_max), 0, 0, 1, 1},
  {&__pyx_n_s_min, __pyx_k_min, sizeof(__pyx_k_min), 0, 0, 1, 1},
  {&__pyx_n_s_mismatch_penalty, __pyx_k_mismatch_penalty, sizeof(__pyx_k_mismatch_penalty), 0, 0, 1, 1},
  {&__pyx_n_s_most_common, __pyx_k_most_common, sizeof(__pyx_k_most_common), 0, 0, 1, 1},
  {&__pyx_n_s_n, __pyx_k_n, sizeof(__pyx_k_n), 0, 0, 1, 1},
  {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
  {&__pyx_n_s_new_cigar, __pyx_k_new_cigar, sizeof(__pyx_k_new_cigar), 0, 0, 1, 1},
  {&__pyx_n_s_new_target, __pyx_k_new_target, sizeof(__pyx_k_new_target), 0, 0, 1, 1},
  {&__pyx_n_u_nofilter, __pyx_k_nofilter, sizeof(__pyx_k_nofilter), 0, 1, 0, 1},
  {&__pyx_n_s_non_refs, __pyx_k_non_refs, sizeof(__pyx_k_non_refs), 0, 0, 1, 1},
  {&__pyx_n_s_non_spurious_overhangs, __pyx_k_non_spurious_overhangs, sizeof(__pyx_k_non_spurious_overhangs), 0, 0, 1, 1},
  {&__pyx_n_s_normalize, __pyx_k_normalize, sizeof(__pyx_k_normalize), 0, 0, 1, 1},
  {&__pyx_n_s_numeric_span, __pyx_k_numeric_span, sizeof(__pyx_k_numeric_span), 0, 0, 1, 1},
  {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1},
  {&__pyx_n_s_optimal_score, __pyx_k_optimal_score, sizeof(__pyx_k_optimal_score), 0, 0, 1, 1},
  {&__pyx_n_s_orig_cigar_string, __pyx_k_orig_cigar_string, sizeof(__pyx_k_orig_cigar_string), 0, 0, 1, 1},
  {&__pyx_n_s_overhang_aligners, __pyx_k_overhang_aligners, sizeof(__pyx_k_overhang_aligners), 0, 0, 1, 1},
  {&__pyx_n_s_overhangs, __pyx_k_overhangs, sizeof(__pyx_k_overhangs), 0, 0, 1, 1},
  {&__pyx_n_s_p, __pyx_k_p, sizeof(__pyx_k_p), 0, 0, 1, 1},
  {&__pyx_n_s_parsed, __pyx_k_parsed, sizeof(__pyx_k_parsed), 0, 0, 1, 1},
  {&__pyx_n_s_partial, __pyx_k_partial, sizeof(__pyx_k_partial), 0, 0, 1, 1},
  {&__pyx_n_s_pileup, __pyx_k_pileup, sizeof(__pyx_k_pileup), 0, 0, 1, 1},
  {&__pyx_n_s_pos, __pyx_k_pos, sizeof(__pyx_k_pos), 0, 0, 1, 1},
  {&__pyx_n_u_pos, __pyx_k_pos, sizeof(__pyx_k_pos), 0, 1, 0, 1},
  {&__pyx_n_s_positions, __pyx_k_positions, sizeof(__pyx_k_positions), 0, 0, 1, 1},
  {&__pyx_n_s_ptrn, __pyx_k_ptrn, sizeof(__pyx_k_ptrn), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
  {&__pyx_n_s_query_name, __pyx_k_query_name, sizeof(__pyx_k_query_name), 0, 0, 1, 1},
  {&__pyx_n_s_query_qualities, __pyx_k_query_qualities, sizeof(__pyx_k_query_qualities), 0, 0, 1, 1},
  {&__pyx_n_s_query_sequence, __pyx_k_query_sequence, sizeof(__pyx_k_query_sequence), 0, 0, 1, 1},
  {&__pyx_n_s_random, __pyx_k_random, sizeof(__pyx_k_random), 0, 0, 1, 1},
  {&__pyx_n_s_ratio, __pyx_k_ratio, sizeof(__pyx_k_ratio), 0, 0, 1, 1},
  {&__pyx_n_s_re, __pyx_k_re, sizeof(__pyx_k_re), 0, 0, 1, 1},
  {&__pyx_n_s_read, __pyx_k_read, sizeof(__pyx_k_read), 0, 0, 1, 1},
  {&__pyx_n_u_read, __pyx_k_read, sizeof(__pyx_k_read), 0, 1, 0, 1},
  {&__pyx_n_s_read_callback, __pyx_k_read_callback, sizeof(__pyx_k_read_callback), 0, 0, 1, 1},
  {&__pyx_n_s_read_dict, __pyx_k_read_dict, sizeof(__pyx_k_read_dict), 0, 0, 1, 1},
  {&__pyx_n_s_read_end, __pyx_k_read_end, sizeof(__pyx_k_read_end), 0, 0, 1, 1},
  {&__pyx_n_u_read_end, __pyx_k_read_end, sizeof(__pyx_k_read_end), 0, 1, 0, 1},
  {&__pyx_n_s_read_end_thresh, __pyx_k_read_end_thresh, sizeof(__pyx_k_read_end_thresh), 0, 0, 1, 1},
  {&__pyx_n_u_read_name, __pyx_k_read_name, sizeof(__pyx_k_read_name), 0, 1, 0, 1},
  {&__pyx_n_u_read_qual, __pyx_k_read_qual, sizeof(__pyx_k_read_qual), 0, 1, 0, 1},
  {&__pyx_n_s_read_seq, __pyx_k_read_seq, sizeof(__pyx_k_read_seq), 0, 0, 1, 1},
  {&__pyx_n_u_read_seq, __pyx_k_read_seq, sizeof(__pyx_k_read_seq), 0, 1, 0, 1},
  {&__pyx_n_s_read_start, __pyx_k_read_start, sizeof(__pyx_k_read_start), 0, 0, 1, 1},
  {&__pyx_n_u_read_start, __pyx_k_read_start, sizeof(__pyx_k_read_start), 0, 1, 0, 1},
  {&__pyx_n_s_realn_cigar, __pyx_k_realn_cigar, sizeof(__pyx_k_realn_cigar), 0, 0, 1, 1},
  {&__pyx_n_s_realn_lt_cigar, __pyx_k_realn_lt_cigar, sizeof(__pyx_k_realn_lt_cigar), 0, 0, 1, 1},
  {&__pyx_n_s_realn_rt_cigar, __pyx_k_realn_rt_cigar, sizeof(__pyx_k_realn_rt_cigar), 0, 0, 1, 1},
  {&__pyx_n_s_reduce_complex_indel, __pyx_k_reduce_complex_indel, sizeof(__pyx_k_reduce_complex_indel), 0, 0, 1, 1},
  {&__pyx_n_s_reduced, __pyx_k_reduced, sizeof(__pyx_k_reduced), 0, 0, 1, 1},
  {&__pyx_n_s_ref, __pyx_k_ref, sizeof(__pyx_k_ref), 0, 0, 1, 1},
  {&__pyx_n_s_ref_alns, __pyx_k_ref_alns, sizeof(__pyx_k_ref_alns), 0, 0, 1, 1},
  {&__pyx_n_s_ref_flank, __pyx_k_ref_flank, sizeof(__pyx_k_ref_flank), 0, 0, 1, 1},
  {&__pyx_n_s_ref_seq, __pyx_k_ref_seq, sizeof(__pyx_k_ref_seq), 0, 0, 1, 1},
  {&__pyx_n_u_ref_seq, __pyx_k_ref_seq, sizeof(__pyx_k_ref_seq), 0, 1, 0, 1},
  {&__pyx_n_s_ref_seqs, __pyx_k_ref_seqs, sizeof(__pyx_k_ref_seqs), 0, 0, 1, 1},
  {&__pyx_n_s_ref_start, __pyx_k_ref_start, sizeof(__pyx_k_ref_start), 0, 0, 1, 1},
  {&__pyx_n_s_ref_starts, __pyx_k_ref_starts, sizeof(__pyx_k_ref_starts), 0, 0, 1, 1},
  {&__pyx_n_s_reference, __pyx_k_reference, sizeof(__pyx_k_reference), 0, 0, 1, 1},
  {&__pyx_n_s_reference_end, __pyx_k_reference_end, sizeof(__pyx_k_reference_end), 0, 0, 1, 1},
  {&__pyx_n_s_reference_start, __pyx_k_reference_start, sizeof(__pyx_k_reference_start), 0, 0, 1, 1},
  {&__pyx_n_s_references, __pyx_k_references, sizeof(__pyx_k_references), 0, 0, 1, 1},
  {&__pyx_n_s_require_exact_for_shiftable, __pyx_k_require_exact_for_shiftable, sizeof(__pyx_k_require_exact_for_shiftable), 0, 0, 1, 1},
  {&__pyx_n_s_retarget, __pyx_k_retarget, sizeof(__pyx_k_retarget), 0, 0, 1, 1},
  {&__pyx_n_s_retarget_locals_lambda, __pyx_k_retarget_locals_lambda, sizeof(__pyx_k_retarget_locals_lambda), 0, 0, 1, 1},
  {&__pyx_n_s_retargetcutoff, __pyx_k_retargetcutoff, sizeof(__pyx_k_retargetcutoff), 0, 0, 1, 1},
  {&__pyx_n_s_right_adjust, __pyx_k_right_adjust, sizeof(__pyx_k_right_adjust), 0, 0, 1, 1},
  {&__pyx_n_s_rpos, __pyx_k_rpos, sizeof(__pyx_k_rpos), 0, 0, 1, 1},
  {&__pyx_n_u_rt_cigar, __pyx_k_rt_cigar, sizeof(__pyx_k_rt_cigar), 0, 1, 0, 1},
  {&__pyx_n_u_rt_clipped, __pyx_k_rt_clipped, sizeof(__pyx_k_rt_clipped), 0, 1, 0, 1},
  {&__pyx_n_s_rt_exon_start, __pyx_k_rt_exon_start, sizeof(__pyx_k_rt_exon_start), 0, 0, 1, 1},
  {&__pyx_n_u_rt_flank, __pyx_k_rt_flank, sizeof(__pyx_k_rt_flank), 0, 1, 0, 1},
  {&__pyx_n_s_rt_most_cigar, __pyx_k_rt_most_cigar, sizeof(__pyx_k_rt_most_cigar), 0, 0, 1, 1},
  {&__pyx_n_u_rt_qual, __pyx_k_rt_qual, sizeof(__pyx_k_rt_qual), 0, 1, 0, 1},
  {&__pyx_n_s_rt_read_lim, __pyx_k_rt_read_lim, sizeof(__pyx_k_rt_read_lim), 0, 0, 1, 1},
  {&__pyx_n_u_rt_ref, __pyx_k_rt_ref, sizeof(__pyx_k_rt_ref), 0, 1, 0, 1},
  {&__pyx_n_s_sample, __pyx_k_sample, sizeof(__pyx_k_sample), 0, 0, 1, 1},
  {&__pyx_n_s_seed, __pyx_k_seed, sizeof(__pyx_k_seed), 0, 0, 1, 1},
  {&__pyx_n_s_send, __pyx_k_send, sizeof(__pyx_k_send), 0, 0, 1, 1},
  {&__pyx_n_s_skip_validation, __pyx_k_skip_validation, sizeof(__pyx_k_skip_validation), 0, 0, 1, 1},
  {&__pyx_n_s_sort, __pyx_k_sort, sizeof(__pyx_k_sort), 0, 0, 1, 1},
  {&__pyx_n_s_span, __pyx_k_span, sizeof(__pyx_k_span), 0, 0, 1, 1},
  {&__pyx_n_s_spl_end, __pyx_k_spl_end, sizeof(__pyx_k_spl_end), 0, 0, 1, 1},
  {&__pyx_n_s_spl_span, __pyx_k_spl_span, sizeof(__pyx_k_spl_span), 0, 0, 1, 1},
  {&__pyx_n_s_spl_span_lst, __pyx_k_spl_span_lst, sizeof(__pyx_k_spl_span_lst), 0, 0, 1, 1},
  {&__pyx_n_s_spl_spans, __pyx_k_spl_spans, sizeof(__pyx_k_spl_spans), 0, 0, 1, 1},
  {&__pyx_n_s_spl_start, __pyx_k_spl_start, sizeof(__pyx_k_spl_start), 0, 0, 1, 1},
  {&__pyx_n_u_splice_pattern, __pyx_k_splice_pattern, sizeof(__pyx_k_splice_pattern), 0, 1, 0, 1},
  {&__pyx_n_s_splice_prtn, __pyx_k_splice_prtn, sizeof(__pyx_k_splice_prtn), 0, 0, 1, 1},
  {&__pyx_n_s_splice_ptrn, __pyx_k_splice_ptrn, sizeof(__pyx_k_splice_ptrn), 0, 0, 1, 1},
  {&__pyx_n_s_splice_rate, __pyx_k_splice_rate, sizeof(__pyx_k_splice_rate), 0, 0, 1, 1},
  {&__pyx_n_s_split, __pyx_k_split, sizeof(__pyx_k_split), 0, 0, 1, 1},
  {&__pyx_n_s_split_cigar, __pyx_k_split_cigar, sizeof(__pyx_k_split_cigar), 0, 0, 1, 1},
  {&__pyx_n_u_start_offset, __pyx_k_start_offset, sizeof(__pyx_k_start_offset), 0, 1, 0, 1},
  {&__pyx_n_s_start_pos, __pyx_k_start_pos, sizeof(__pyx_k_start_pos), 0, 0, 1, 1},
  {&__pyx_n_s_sum, __pyx_k_sum, sizeof(__pyx_k_sum), 0, 0, 1, 1},
  {&__pyx_n_s_target, __pyx_k_target, sizeof(__pyx_k_target), 0, 0, 1, 1},
  {&__pyx_n_s_target_event, __pyx_k_target_event, sizeof(__pyx_k_target_event), 0, 0, 1, 1},
  {&__pyx_n_s_target_len, __pyx_k_target_len, sizeof(__pyx_k_target_len), 0, 0, 1, 1},
  {&__pyx_n_s_target_pos, __pyx_k_target_pos, sizeof(__pyx_k_target_pos), 0, 0, 1, 1},
  {&__pyx_n_s_target_seq, __pyx_k_target_seq, sizeof(__pyx_k_target_seq), 0, 0, 1, 1},
  {&__pyx_n_s_target_type, __pyx_k_target_type, sizeof(__pyx_k_target_type), 0, 0, 1, 1},
  {&__pyx_n_s_target_type_indels, __pyx_k_target_type_indels, sizeof(__pyx_k_target_type_indels), 0, 0, 1, 1},
  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
  {&__pyx_n_s_this_event, __pyx_k_this_event, sizeof(__pyx_k_this_event), 0, 0, 1, 1},
  {&__pyx_n_s_throw, __pyx_k_throw, sizeof(__pyx_k_throw), 0, 0, 1, 1},
  {&__pyx_n_s_tmp, __pyx_k_tmp, sizeof(__pyx_k_tmp), 0, 0, 1, 1},
  {&__pyx_n_s_tmp_non_refs, __pyx_k_tmp_non_refs, sizeof(__pyx_k_tmp_non_refs), 0, 0, 1, 1},
  {&__pyx_n_s_to, __pyx_k_to, sizeof(__pyx_k_to), 0, 0, 1, 1},
  {&__pyx_n_s_to_flat_list, __pyx_k_to_flat_list, sizeof(__pyx_k_to_flat_list), 0, 0, 1, 1},
  {&__pyx_n_s_trailing_clip, __pyx_k_trailing_clip, sizeof(__pyx_k_trailing_clip), 0, 0, 1, 1},
  {&__pyx_n_s_trim_ref_flank, __pyx_k_trim_ref_flank, sizeof(__pyx_k_trim_ref_flank), 0, 0, 1, 1},
  {&__pyx_n_s_u_candidates, __pyx_k_u_candidates, sizeof(__pyx_k_u_candidates), 0, 0, 1, 1},
  {&__pyx_n_s_unspl_loc_ref, __pyx_k_unspl_loc_ref, sizeof(__pyx_k_unspl_loc_ref), 0, 0, 1, 1},
  {&__pyx_n_s_until_eof, __pyx_k_until_eof, sizeof(__pyx_k_until_eof), 0, 0, 1, 1},
  {&__pyx_n_s_update_cigar, __pyx_k_update_cigar, sizeof(__pyx_k_update_cigar), 0, 0, 1, 1},
  {&__pyx_n_s_update_pileup, __pyx_k_update_pileup, sizeof(__pyx_k_update_pileup), 0, 0, 1, 1},
  {&__pyx_n_s_update_pileup_locals_genexpr, __pyx_k_update_pileup_locals_genexpr, sizeof(__pyx_k_update_pileup_locals_genexpr), 0, 0, 1, 1},
  {&__pyx_n_s_update_read_info, __pyx_k_update_read_info, sizeof(__pyx_k_update_read_info), 0, 0, 1, 1},
  {&__pyx_n_s_update_read_positions, __pyx_k_update_read_positions, sizeof(__pyx_k_update_read_positions), 0, 0, 1, 1},
  {&__pyx_n_s_utilities, __pyx_k_utilities, sizeof(__pyx_k_utilities), 0, 0, 1, 1},
  {&__pyx_n_s_var, __pyx_k_var, sizeof(__pyx_k_var), 0, 0, 1, 1},
  {&__pyx_n_s_variant_type, __pyx_k_variant_type, sizeof(__pyx_k_variant_type), 0, 0, 1, 1},
  {&__pyx_n_s_window, __pyx_k_window, sizeof(__pyx_k_window), 0, 0, 1, 1},
  {&__pyx_n_s_window_len, __pyx_k_window_len, sizeof(__pyx_k_window_len), 0, 0, 1, 1},
  {&__pyx_n_s_within, __pyx_k_within, sizeof(__pyx_k_within), 0, 0, 1, 1},
  {&__pyx_n_s_zip, __pyx_k_zip, sizeof(__pyx_k_zip), 0, 0, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_max = __Pyx_GetBuiltinName(__pyx_n_s_max); if (!__pyx_builtin_max) __PYX_ERR(0, 67, __pyx_L1_error)
  __pyx_builtin_sum = __Pyx_GetBuiltinName(__pyx_n_s_sum); if (!__pyx_builtin_sum) __PYX_ERR(0, 178, __pyx_L1_error)
  __pyx_builtin_min = __Pyx_GetBuiltinName(__pyx_n_s_min); if (!__pyx_builtin_min) __PYX_ERR(0, 354, __pyx_L1_error)
  __pyx_builtin_zip = __Pyx_GetBuiltinName(__pyx_n_s_zip); if (!__pyx_builtin_zip) __PYX_ERR(0, 652, __pyx_L1_error)
  __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 762, __pyx_L1_error)
  __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(1, 109, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}

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

  /* "aldy/indelpost/pileup.pyx":116
 * def is_within_intron(read, pos, window):
 *     intron = read["intron_pattern"]
 *     if intron == (0, 0):             # <<<<<<<<<<<<<<
 *         return False
 *     else:
 */
  __pyx_tuple__2 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_0); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__2);
  __Pyx_GIVEREF(__pyx_tuple__2);

  /* "aldy/indelpost/pileup.pyx":178
 *     aln_end = read.reference_end  # do not add 1
 *     if aln_end is None:
 *         aln_end = aln_start + sum(int(c[:-1]) for c in cigar_list if c[-1] in ("M", "N", "D", "=", "X"))             # <<<<<<<<<<<<<<
 * 
 *     end_offset = int(cigar_list[-1][:-1]) if cigar_list[-1].endswith("S") else 0
 */
  __pyx_slice__4 = PySlice_New(Py_None, __pyx_int_neg_1, Py_None); if (unlikely(!__pyx_slice__4)) __PYX_ERR(0, 178, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__4);
  __Pyx_GIVEREF(__pyx_slice__4);

  /* "aldy/indelpost/pileup.pyx":354
 *     else:
 *         if is_lefty:
 *             return min(read_qual[: 3]) < basequalthresh             # <<<<<<<<<<<<<<
 *         else:
 *             return min(read_qual[-3 :]) < basequalthresh
 */
  __pyx_slice__5 = PySlice_New(Py_None, __pyx_int_3, Py_None); if (unlikely(!__pyx_slice__5)) __PYX_ERR(0, 354, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__5);
  __Pyx_GIVEREF(__pyx_slice__5);

  /* "aldy/indelpost/pileup.pyx":356
 *             return min(read_qual[: 3]) < basequalthresh
 *         else:
 *             return min(read_qual[-3 :]) < basequalthresh             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_slice__6 = PySlice_New(__pyx_int_neg_3, Py_None, Py_None); if (unlikely(!__pyx_slice__6)) __PYX_ERR(0, 356, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__6);
  __Pyx_GIVEREF(__pyx_slice__6);

  /* "aldy/indelpost/pileup.pyx":375
 *         return cigarstring
 * 
 *     new_cigar = tmp1 + str(tmp0 + tmp2) + "M" + "".join(rt_cigar_lst[3:])             # <<<<<<<<<<<<<<
 * 
 *     return "".join(lt_cigar_lst) + new_cigar
 */
  __pyx_slice__7 = PySlice_New(__pyx_int_3, Py_None, Py_None); if (unlikely(!__pyx_slice__7)) __PYX_ERR(0, 375, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__7);
  __Pyx_GIVEREF(__pyx_slice__7);

  /* "aldy/indelpost/pileup.pyx":402
 *         lt_ptrn, rt_ptrn = "", ""
 *         positions = to_flat_list(spliced_subreads)
 *         positions = positions[1:-1]             # <<<<<<<<<<<<<<
 * 
 *         i = 0
 */
  __pyx_slice__8 = PySlice_New(__pyx_int_1, __pyx_int_neg_1, Py_None); if (unlikely(!__pyx_slice__8)) __PYX_ERR(0, 402, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__8);
  __Pyx_GIVEREF(__pyx_slice__8);

  /* "aldy/indelpost/pileup.pyx":430
 *     else:
 *         is_spliced = False
 *         splice_ptrn = ("", "")             # <<<<<<<<<<<<<<
 * 
 *     return is_covering, covering_subread, is_spliced, splice_ptrn, intron_ptrn
 */
  __pyx_tuple__11 = PyTuple_Pack(2, __pyx_kp_u_, __pyx_kp_u_); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 430, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__11);
  __Pyx_GIVEREF(__pyx_tuple__11);

  /* "aldy/indelpost/pileup.pyx":633
 *         and not read_dict["is_dirty"]
 *         and not read_dict["is_end_dirty"]
 *         and read_dict.get("is_worth_realn", True)             # <<<<<<<<<<<<<<
 *     ]
 * 
 */
  __pyx_tuple__12 = PyTuple_Pack(2, __pyx_n_u_is_worth_realn, Py_True); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 633, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__12);
  __Pyx_GIVEREF(__pyx_tuple__12);

  /* "aldy/indelpost/pileup.pyx":853
 *         is_found= False
 *         for indel in indels:
 *             if not indel.get("del_seq", False):             # <<<<<<<<<<<<<<
 *                 ref = indel["lt_ref"][-1]
 *                 alt = ref + indel["indel_seq"]
 */
  __pyx_tuple__13 = PyTuple_Pack(2, __pyx_n_u_del_seq, Py_False); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 853, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__13);
  __Pyx_GIVEREF(__pyx_tuple__13);

  /* "aldy/indelpost/pileup.pyx":946
 *         )
 *         trailing_clip = [str(clip_len) + "S"] if clip_len else []
 *         realn_cigar = realn_cigar[1:]             # <<<<<<<<<<<<<<
 * 
 *     for c in realn_cigar:
 */
  __pyx_slice__14 = PySlice_New(__pyx_int_1, Py_None, Py_None); if (unlikely(!__pyx_slice__14)) __PYX_ERR(0, 946, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__14);
  __Pyx_GIVEREF(__pyx_slice__14);

  /* "aldy/indelpost/pileup.pyx":46
 * from pysam.libcalignmentfile cimport AlignmentFile
 * 
 * random.seed(123)             # <<<<<<<<<<<<<<
 * 
 * cigar_ptrn = re.compile(r"[0-9]+[MIDNSHPX=]")
 */
  __pyx_tuple__15 = PyTuple_Pack(1, __pyx_int_123); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 46, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__15);
  __Pyx_GIVEREF(__pyx_tuple__15);

  /* "aldy/indelpost/pileup.pyx":48
 * random.seed(123)
 * 
 * cigar_ptrn = re.compile(r"[0-9]+[MIDNSHPX=]")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_u_0_9_MIDNSHPX); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 48, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__16);
  __Pyx_GIVEREF(__pyx_tuple__16);

  /* "aldy/indelpost/pileup.pyx":114
 * 
 * 
 * def is_within_intron(read, pos, window):             # <<<<<<<<<<<<<<
 *     intron = read["intron_pattern"]
 *     if intron == (0, 0):
 */
  __pyx_tuple__17 = PyTuple_Pack(6, __pyx_n_s_read, __pyx_n_s_pos, __pyx_n_s_window, __pyx_n_s_intron, __pyx_n_s_intron_start, __pyx_n_s_intron_end); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 114, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__17);
  __Pyx_GIVEREF(__pyx_tuple__17);
  __pyx_codeobj__18 = (PyObject*)__Pyx_PyCode_New(3, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__17, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_aldy_indelpost_pileup_pyx, __pyx_n_s_is_within_intron, 114, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__18)) __PYX_ERR(0, 114, __pyx_L1_error)

  /* "aldy/indelpost/pileup.pyx":435
 * 
 * 
 * def check_overhangs(pileup, splice_rate=0.2):             # <<<<<<<<<<<<<<
 * 
 *     intron_ptrns = [read["intron_pattern"] for read in pileup if is_junctional(read)]
 */
  __pyx_tuple__19 = PyTuple_Pack(11, __pyx_n_s_pileup, __pyx_n_s_splice_rate, __pyx_n_s_intron_ptrns, __pyx_n_s_introns, __pyx_n_s_intron, __pyx_n_s_intron_start, __pyx_n_s_intron_end, __pyx_n_s_overhangs, __pyx_n_s_read, __pyx_n_s_ptrn, __pyx_n_s_read); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 435, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__19);
  __Pyx_GIVEREF(__pyx_tuple__19);
  __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(2, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_aldy_indelpost_pileup_pyx, __pyx_n_s_check_overhangs, 435, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) __PYX_ERR(0, 435, __pyx_L1_error)

  /* "aldy/indelpost/pileup.pyx":454
 * 
 * 
 * def is_junctional(read):             # <<<<<<<<<<<<<<
 *     if read["intron_pattern"] == (0, 0):
 *         return read["is_covering"]
 */
  __pyx_tuple__21 = PyTuple_Pack(1, __pyx_n_s_read); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 454, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__21);
  __Pyx_GIVEREF(__pyx_tuple__21);
  __pyx_codeobj__22 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_aldy_indelpost_pileup_pyx, __pyx_n_s_is_junctional, 454, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) __PYX_ERR(0, 454, __pyx_L1_error)

  /* "aldy/indelpost/pileup.pyx":461
 * 
 * 
 * def is_overhang(read, intron_start, intron_end):             # <<<<<<<<<<<<<<
 *     covering_subread = read["covering_subread"]
 *     if not covering_subread:
 */
  __pyx_tuple__23 = PyTuple_Pack(6, __pyx_n_s_read, __pyx_n_s_intron_start, __pyx_n_s_intron_end, __pyx_n_s_covering_subread, __pyx_n_s_lt_read_lim, __pyx_n_s_rt_read_lim); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 461, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__23);
  __Pyx_GIVEREF(__pyx_tuple__23);
  __pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(3, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_aldy_indelpost_pileup_pyx, __pyx_n_s_is_overhang, 461, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(0, 461, __pyx_L1_error)

  /* "aldy/indelpost/pileup.pyx":477
 * 
 * 
 * def overhang_aligners(target, intron, match_score, mismatch_penalty):             # <<<<<<<<<<<<<<
 *     genome_ref = target.reference.fetch(
 *         target.chrom, target.pos - 100, target.pos + 100
 */
  __pyx_tuple__25 = PyTuple_Pack(10, __pyx_n_s_target, __pyx_n_s_intron, __pyx_n_s_match_score, __pyx_n_s_mismatch_penalty, __pyx_n_s_genome_ref, __pyx_n_s_genome_aligner, __pyx_n_s_lt_exon_end, __pyx_n_s_rt_exon_start, __pyx_n_s_junction_ref, __pyx_n_s_junction_aligner); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 477, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__25);
  __Pyx_GIVEREF(__pyx_tuple__25);
  __pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(4, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__25, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_aldy_indelpost_pileup_pyx, __pyx_n_s_overhang_aligners, 477, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(0, 477, __pyx_L1_error)

  /* "aldy/indelpost/pileup.pyx":494
 * 
 * 
 * def filter_spurious_overhangs(             # <<<<<<<<<<<<<<
 *     target,
 *     intron,
 */
  __pyx_tuple__27 = PyTuple_Pack(11, __pyx_n_s_target, __pyx_n_s_intron, __pyx_n_s_overhangs, __pyx_n_s_match_score, __pyx_n_s_mismatch_penalty, __pyx_n_s_gap_open_penalty, __pyx_n_s_gap_extension_penalty, __pyx_n_s_genome_aligner, __pyx_n_s_junctional_aligner, __pyx_n_s_non_spurious_overhangs, __pyx_n_s_read); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 494, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__27);
  __Pyx_GIVEREF(__pyx_tuple__27);
  __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(7, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_aldy_indelpost_pileup_pyx, __pyx_n_s_filter_spurious_overhangs, 494, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 494, __pyx_L1_error)

  /* "aldy/indelpost/pileup.pyx":527
 * 
 * 
 * def is_non_spurious_overhang(             # <<<<<<<<<<<<<<
 *     read,
 *     target,
 */
  __pyx_tuple__29 = PyTuple_Pack(21, __pyx_n_s_read, __pyx_n_s_target, __pyx_n_s_intron, __pyx_n_s_genome_aligner, __pyx_n_s_junction_aligner, __pyx_n_s_match_score, __pyx_n_s_mismatch_penalty, __pyx_n_s_gap_open_penalty, __pyx_n_s_gap_extension_penalty, __pyx_n_s_read_seq, __pyx_n_s_genome_aln, __pyx_n_s_junction_aln, __pyx_n_s_genome_score, __pyx_n_s_junction_score, __pyx_n_s_genome_cigar, __pyx_n_s_gap_cnt, __pyx_n_s_aln_len, __pyx_n_s_lt_exon_end, __pyx_n_s_rt_exon_start, __pyx_n_s_indels_within_intron, __pyx_n_s_var); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 527, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__29);
  __Pyx_GIVEREF(__pyx_tuple__29);
  __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(9, 0, 21, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_aldy_indelpost_pileup_pyx, __pyx_n_s_is_non_spurious_overhang, 527, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 527, __pyx_L1_error)

  /* "aldy/indelpost/pileup.pyx":577
 * 
 * 
 * def retarget(             # <<<<<<<<<<<<<<
 *     target,
 *     pileup,
 */
  __pyx_tuple__31 = PyTuple_Pack(81, __pyx_n_s_target, __pyx_n_s_pileup, __pyx_n_s_window, __pyx_n_s_mapq4retarget, __pyx_n_s_within, __pyx_n_s_retargetcutoff, __pyx_n_s_match_score, __pyx_n_s_mismatch_penalty, __pyx_n_s_gap_open_penalty, __pyx_n_s_gap_extension_penalty, __pyx_n_s_unspl_loc_ref, __pyx_n_s_require_exact_for_shiftable, __pyx_n_s_target_seq, __pyx_n_s_target_type, __pyx_n_s_target_pos, __pyx_n_s_non_refs, __pyx_n_s_cutoff, __pyx_n_s_tmp_non_refs, __pyx_n_s_ref_starts, __pyx_n_s_ref_alns, __pyx_n_s_ref_seqs, __pyx_n_s_aligners, __pyx_n_s_read, __pyx_n_s_ref_seq, __pyx_n_s_lt_len, __pyx_n_s_aligner, __pyx_n_s_complex_flags, __pyx_n_s_candidates, __pyx_n_s_candidate_reads, __pyx_n_s_candidate_ref_seqs, __pyx_n_s_candidate_ref_starts, __pyx_n_s_candidate_aligners, __pyx_n_s_aln, __pyx_n_s_ref_start, __pyx_n_s_genome_aln_pos, __pyx_n_s_aligned_read_len, __pyx_n_s_window_len, __pyx_n_s_aligned_frac, __pyx_n_s_gap_cnt, __pyx_n_s_indels, __pyx_n_s_positions, __pyx_n_s_complex_positions, __pyx_n_s_target_type_indels, __pyx_n_s_indel, __pyx_n_s_complex_del, __pyx_n_s_complex_ins, __pyx_n_s_ref, __pyx_n_s_alt, __pyx_n_s_var, __pyx_n_s_read_end_thresh, __pyx_n_s_u_candidates, __pyx_n_s_candidate_seqs, __pyx_n_s_best_match, __pyx_n_s_best_seq, __pyx_n_s_idx, __pyx_n_s_hit, __pyx_n_s_idx2, __pyx_n_s_candidate, __pyx_n_s_complex_candidates, __pyx_n_s_cplx_candidate, __pyx_n_s_reduced, __pyx_n_s_read_dict, __pyx_n_s_read_dict, __pyx_n_s_read_dict, __pyx_n_s_read_dict, __pyx_n_s_d, __pyx_n_s_p, __pyx_n_s_indel, __pyx_n_s_jndel, __pyx_n_s_jndel, __pyx_n_s_var, __pyx_n_s_var, __pyx_n_s_i, __pyx_n_s_var, __pyx_n_s_var, __pyx_n_s_i, __pyx_n_s_var, __pyx_n_s_i, __pyx_n_s_i, __pyx_n_s_i, __pyx_n_s_i); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 577, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__31);
  __Pyx_GIVEREF(__pyx_tuple__31);
  __pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(12, 0, 81, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_aldy_indelpost_pileup_pyx, __pyx_n_s_retarget, 577, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 577, __pyx_L1_error)

  /* "aldy/indelpost/pileup.pyx":806
 * 
 * 
 * def update_read_info(             # <<<<<<<<<<<<<<
 *     read,
 *     candidate,
 */
  __pyx_tuple__33 = PyTuple_Pack(20, __pyx_n_s_read, __pyx_n_s_candidate, __pyx_n_s_is_gapped_aln, __pyx_n_s_gap_open_penalty, __pyx_n_s_gap_extension_penalty, __pyx_n_s_aligner, __pyx_n_s_ref_seq, __pyx_n_s_ref_start, __pyx_n_s_parsed, __pyx_n_s_aln, __pyx_n_s_genome_aln_pos, __pyx_n_s_indels, __pyx_n_s_is_found, __pyx_n_s_indel, __pyx_n_s_ref, __pyx_n_s_alt, __pyx_n_s_obj, __pyx_n_s_indel_pos_in_this_read, __pyx_n_s_realn_lt_cigar, __pyx_n_s_realn_rt_cigar); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 806, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__33);
  __Pyx_GIVEREF(__pyx_tuple__33);
  __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(8, 0, 20, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__33, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_aldy_indelpost_pileup_pyx, __pyx_n_s_update_read_info, 806, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 806, __pyx_L1_error)

  /* "aldy/indelpost/pileup.pyx":911
 * 
 * 
 * def trim_ref_flank(ref_flank, flank_cigar, left):             # <<<<<<<<<<<<<<
 * 
 *     cum = sum([int(c[:-1]) for c in flank_cigar if c[-1] != "I"])
 */
  __pyx_tuple__35 = PyTuple_Pack(5, __pyx_n_s_ref_flank, __pyx_n_s_flank_cigar, __pyx_n_s_left, __pyx_n_s_cum, __pyx_n_s_c); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 911, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__35);
  __Pyx_GIVEREF(__pyx_tuple__35);
  __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_aldy_indelpost_pileup_pyx, __pyx_n_s_trim_ref_flank, 911, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 911, __pyx_L1_error)

  /* "aldy/indelpost/pileup.pyx":922
 * 
 * 
 * def update_cigar(             # <<<<<<<<<<<<<<
 *     orig_cigar_string, realn_cigar, start_pos, splice_prtn, clipped_bases, left
 * ):
 */
  __pyx_tuple__37 = PyTuple_Pack(30, __pyx_n_s_orig_cigar_string, __pyx_n_s_realn_cigar, __pyx_n_s_start_pos, __pyx_n_s_splice_prtn, __pyx_n_s_clipped_bases, __pyx_n_s_left, __pyx_n_s_splice_ptrn, __pyx_n_s_spl_spans, __pyx_n_s_clip_len, __pyx_n_s_new_cigar, __pyx_n_s_current_pos, __pyx_n_s_target_event, __pyx_n_s_target_type, __pyx_n_s_target_len, __pyx_n_s_trailing_clip, __pyx_n_s_c, __pyx_n_s_event, __pyx_n_s_event_len, __pyx_n_s_last, __pyx_n_s_tmp, __pyx_n_s_i, __pyx_n_s_span, __pyx_n_s_n, __pyx_n_s_m, __pyx_n_s_m1, __pyx_n_s_m2, __pyx_n_s_spl_start, __pyx_n_s_spl_end, __pyx_n_s_this_event, __pyx_n_s_spl_span); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 922, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__37);
  __Pyx_GIVEREF(__pyx_tuple__37);
  __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(6, 0, 30, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__37, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_aldy_indelpost_pileup_pyx, __pyx_n_s_update_cigar, 922, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(0, 922, __pyx_L1_error)

  /* "aldy/indelpost/pileup.pyx":1024
 * 
 * 
 * def numeric_span(spl_span):             # <<<<<<<<<<<<<<
 *     spl_span_lst = spl_span.split("-")
 *     return [int(i) for i in spl_span_lst]
 */
  __pyx_tuple__39 = PyTuple_Pack(3, __pyx_n_s_spl_span, __pyx_n_s_spl_span_lst, __pyx_n_s_i); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 1024, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__39);
  __Pyx_GIVEREF(__pyx_tuple__39);
  __pyx_codeobj__40 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__39, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_aldy_indelpost_pileup_pyx, __pyx_n_s_numeric_span, 1024, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__40)) __PYX_ERR(0, 1024, __pyx_L1_error)

  /* "aldy/indelpost/pileup.pyx":1029
 * 
 * 
 * def update_read_positions(read, target_pos):             # <<<<<<<<<<<<<<
 * 
 *     left_adjust = sum([-int(c[:-1]) if c[-1] != "I" else 0 for c in read["lt_cigar"]])
 */
  __pyx_tuple__41 = PyTuple_Pack(8, __pyx_n_s_read, __pyx_n_s_target_pos, __pyx_n_s_left_adjust, __pyx_n_s_right_adjust, __pyx_n_s_lt_most_cigar, __pyx_n_s_rt_most_cigar, __pyx_n_s_c, __pyx_n_s_c); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(0, 1029, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__41);
  __Pyx_GIVEREF(__pyx_tuple__41);
  __pyx_codeobj__42 = (PyObject*)__Pyx_PyCode_New(2, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__41, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_aldy_indelpost_pileup_pyx, __pyx_n_s_update_read_positions, 1029, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__42)) __PYX_ERR(0, 1029, __pyx_L1_error)

  /* "aldy/indelpost/pileup.pyx":1047
 * 
 * 
 * def update_pileup(             # <<<<<<<<<<<<<<
 *     pileup,
 *     new_target,
 */
  __pyx_tuple__43 = PyTuple_Pack(18, __pyx_n_s_pileup, __pyx_n_s_new_target, __pyx_n_s_window, __pyx_n_s_match_score, __pyx_n_s_mismatch_penalty, __pyx_n_s_gap_open_penalty, __pyx_n_s_gap_extension_penalty, __pyx_n_s_basequalthresh, __pyx_n_s_bypass_search, __pyx_n_s_rpos, __pyx_n_s_read, __pyx_n_s_is_covering, __pyx_n_s_covering_subread, __pyx_n_s_is_spliced, __pyx_n_s_splice_ptrn, __pyx_n_s_intron_ptrn, __pyx_n_s_genexpr, __pyx_n_s_genexpr); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(0, 1047, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__43);
  __Pyx_GIVEREF(__pyx_tuple__43);
  __pyx_codeobj__44 = (PyObject*)__Pyx_PyCode_New(9, 0, 18, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__43, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_aldy_indelpost_pileup_pyx, __pyx_n_s_update_pileup, 1047, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__44)) __PYX_ERR(0, 1047, __pyx_L1_error)
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
  __pyx_umethod_PyList_Type_copy.type = (PyObject*)&PyList_Type;
  __pyx_umethod_PyList_Type_count.type = (PyObject*)&PyList_Type;
  __pyx_umethod_PyList_Type_index.type = (PyObject*)&PyList_Type;
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  __pyx_float_0_2 = PyFloat_FromDouble(0.2); if (unlikely(!__pyx_float_0_2)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_0_7 = PyFloat_FromDouble(0.7); if (unlikely(!__pyx_float_0_7)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_1_0 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_float_1_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_1_2 = PyFloat_FromDouble(1.2); if (unlikely(!__pyx_float_1_2)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_0_15 = PyFloat_FromDouble(0.15); if (unlikely(!__pyx_float_0_15)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_0_98 = PyFloat_FromDouble(0.98); if (unlikely(!__pyx_float_0_98)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_6 = PyInt_FromLong(6); if (unlikely(!__pyx_int_6)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_50 = PyInt_FromLong(50); if (unlikely(!__pyx_int_50)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_100 = PyInt_FromLong(100); if (unlikely(!__pyx_int_100)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_123 = PyInt_FromLong(123); if (unlikely(!__pyx_int_123)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_neg_3 = PyInt_FromLong(-3); if (unlikely(!__pyx_int_neg_3)) __PYX_ERR(0, 1, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}

static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/

static int __Pyx_modinit_global_init_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
  /*--- Global init code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_variable_export_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
  /*--- Variable export code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_function_export_code(void) {
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
  /*--- Function export code ---*/
  if (__Pyx_ExportFunction("make_pileup", (void (*)(void))__pyx_f_4aldy_9indelpost_6pileup_make_pileup, "PyObject *(struct __pyx_obj_4aldy_9indelpost_7variant_Variant *, struct __pyx_obj_5pysam_17libcalignmentfile_AlignmentFile *, struct __pyx_obj_4aldy_9indelpost_15local_reference_UnsplicedLocalReference *, int, int, int, int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_type_init_code(void) {
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
  /*--- Type init code ---*/
  if (PyType_Ready(&__pyx_type_4aldy_9indelpost_6pileup___pyx_scope_struct____pyx_f_4aldy_9indelpost_6pileup_make_pileup) < 0) __PYX_ERR(0, 51, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_4aldy_9indelpost_6pileup___pyx_scope_struct____pyx_f_4aldy_9indelpost_6pileup_make_pileup.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_4aldy_9indelpost_6pileup___pyx_scope_struct____pyx_f_4aldy_9indelpost_6pileup_make_pileup.tp_dictoffset && __pyx_type_4aldy_9indelpost_6pileup___pyx_scope_struct____pyx_f_4aldy_9indelpost_6pileup_make_pileup.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_4aldy_9indelpost_6pileup___pyx_scope_struct____pyx_f_4aldy_9indelpost_6pileup_make_pileup.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_4aldy_9indelpost_6pileup___pyx_scope_struct____pyx_f_4aldy_9indelpost_6pileup_make_pileup = &__pyx_type_4aldy_9indelpost_6pileup___pyx_scope_struct____pyx_f_4aldy_9indelpost_6pileup_make_pileup;
  if (PyType_Ready(&__pyx_type_4aldy_9indelpost_6pileup___pyx_scope_struct_1_genexpr) < 0) __PYX_ERR(0, 67, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_4aldy_9indelpost_6pileup___pyx_scope_struct_1_genexpr.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_4aldy_9indelpost_6pileup___pyx_scope_struct_1_genexpr.tp_dictoffset && __pyx_type_4aldy_9indelpost_6pileup___pyx_scope_struct_1_genexpr.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_4aldy_9indelpost_6pileup___pyx_scope_struct_1_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_4aldy_9indelpost_6pileup___pyx_scope_struct_1_genexpr = &__pyx_type_4aldy_9indelpost_6pileup___pyx_scope_struct_1_genexpr;
  if (PyType_Ready(&__pyx_type_4aldy_9indelpost_6pileup___pyx_scope_struct_2___pyx_f_4aldy_9indelpost_6pileup_dictize_read) < 0) __PYX_ERR(0, 156, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_4aldy_9indelpost_6pileup___pyx_scope_struct_2___pyx_f_4aldy_9indelpost_6pileup_dictize_read.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_4aldy_9indelpost_6pileup___pyx_scope_struct_2___pyx_f_4aldy_9indelpost_6pileup_dictize_read.tp_dictoffset && __pyx_type_4aldy_9indelpost_6pileup___pyx_scope_struct_2___pyx_f_4aldy_9indelpost_6pileup_dictize_read.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_4aldy_9indelpost_6pileup___pyx_scope_struct_2___pyx_f_4aldy_9indelpost_6pileup_dictize_read.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_4aldy_9indelpost_6pileup___pyx_scope_struct_2___pyx_f_4aldy_9indelpost_6pileup_dictize_read = &__pyx_type_4aldy_9indelpost_6pileup___pyx_scope_struct_2___pyx_f_4aldy_9indelpost_6pileup_dictize_read;
  if (PyType_Ready(&__pyx_type_4aldy_9indelpost_6pileup___pyx_scope_struct_3_genexpr) < 0) __PYX_ERR(0, 178, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_4aldy_9indelpost_6pileup___pyx_scope_struct_3_genexpr.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_4aldy_9indelpost_6pileup___pyx_scope_struct_3_genexpr.tp_dictoffset && __pyx_type_4aldy_9indelpost_6pileup___pyx_scope_struct_3_genexpr.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_4aldy_9indelpost_6pileup___pyx_scope_struct_3_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_4aldy_9indelpost_6pileup___pyx_scope_struct_3_genexpr = &__pyx_type_4aldy_9indelpost_6pileup___pyx_scope_struct_3_genexpr;
  if (PyType_Ready(&__pyx_type_4aldy_9indelpost_6pileup___pyx_scope_struct_4_genexpr) < 0) __PYX_ERR(0, 212, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_4aldy_9indelpost_6pileup___pyx_scope_struct_4_genexpr.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_4aldy_9indelpost_6pileup___pyx_scope_struct_4_genexpr.tp_dictoffset && __pyx_type_4aldy_9indelpost_6pileup___pyx_scope_struct_4_genexpr.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_4aldy_9indelpost_6pileup___pyx_scope_struct_4_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_4aldy_9indelpost_6pileup___pyx_scope_struct_4_genexpr = &__pyx_type_4aldy_9indelpost_6pileup___pyx_scope_struct_4_genexpr;
  if (PyType_Ready(&__pyx_type_4aldy_9indelpost_6pileup___pyx_scope_struct_5_retarget) < 0) __PYX_ERR(0, 577, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_4aldy_9indelpost_6pileup___pyx_scope_struct_5_retarget.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_4aldy_9indelpost_6pileup___pyx_scope_struct_5_retarget.tp_dictoffset && __pyx_type_4aldy_9indelpost_6pileup___pyx_scope_struct_5_retarget.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_4aldy_9indelpost_6pileup___pyx_scope_struct_5_retarget.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_4aldy_9indelpost_6pileup___pyx_scope_struct_5_retarget = &__pyx_type_4aldy_9indelpost_6pileup___pyx_scope_struct_5_retarget;
  if (PyType_Ready(&__pyx_type_4aldy_9indelpost_6pileup___pyx_scope_struct_6_update_pileup) < 0) __PYX_ERR(0, 1047, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_4aldy_9indelpost_6pileup___pyx_scope_struct_6_update_pileup.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_4aldy_9indelpost_6pileup___pyx_scope_struct_6_update_pileup.tp_dictoffset && __pyx_type_4aldy_9indelpost_6pileup___pyx_scope_struct_6_update_pileup.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_4aldy_9indelpost_6pileup___pyx_scope_struct_6_update_pileup.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_4aldy_9indelpost_6pileup___pyx_scope_struct_6_update_pileup = &__pyx_type_4aldy_9indelpost_6pileup___pyx_scope_struct_6_update_pileup;
  if (PyType_Ready(&__pyx_type_4aldy_9indelpost_6pileup___pyx_scope_struct_7_genexpr) < 0) __PYX_ERR(0, 1059, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_4aldy_9indelpost_6pileup___pyx_scope_struct_7_genexpr.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_4aldy_9indelpost_6pileup___pyx_scope_struct_7_genexpr.tp_dictoffset && __pyx_type_4aldy_9indelpost_6pileup___pyx_scope_struct_7_genexpr.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_4aldy_9indelpost_6pileup___pyx_scope_struct_7_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_4aldy_9indelpost_6pileup___pyx_scope_struct_7_genexpr = &__pyx_type_4aldy_9indelpost_6pileup___pyx_scope_struct_7_genexpr;
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_type_import_code(void) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
  /*--- Type import code ---*/
  __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", 
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyTypeObject),
  #else
  sizeof(PyHeapTypeObject),
  #endif
  __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(2, 9, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7cpython_4bool_bool) __PYX_ERR(3, 8, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7cpython_7complex_complex) __PYX_ERR(4, 15, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("array"); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 58, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_7cpython_5array_array = __Pyx_ImportType(__pyx_t_1, "array", "array", sizeof(arrayobject), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7cpython_5array_array) __PYX_ERR(1, 58, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("pysam.libchtslib"); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 2680, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_5pysam_10libchtslib_HTSFile = __Pyx_ImportType(__pyx_t_1, "pysam.libchtslib", "HTSFile", sizeof(struct __pyx_obj_5pysam_10libchtslib_HTSFile), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5pysam_10libchtslib_HTSFile) __PYX_ERR(5, 2680, __pyx_L1_error)
  __pyx_vtabptr_5pysam_10libchtslib_HTSFile = (struct __pyx_vtabstruct_5pysam_10libchtslib_HTSFile*)__Pyx_GetVtable(__pyx_ptype_5pysam_10libchtslib_HTSFile->tp_dict); if (unlikely(!__pyx_vtabptr_5pysam_10libchtslib_HTSFile)) __PYX_ERR(5, 2680, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("pysam.libcfaidx"); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_5pysam_9libcfaidx_FastaFile = __Pyx_ImportType(__pyx_t_1, "pysam.libcfaidx", "FastaFile", sizeof(struct __pyx_obj_5pysam_9libcfaidx_FastaFile), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5pysam_9libcfaidx_FastaFile) __PYX_ERR(6, 37, __pyx_L1_error)
  __pyx_vtabptr_5pysam_9libcfaidx_FastaFile = (struct __pyx_vtabstruct_5pysam_9libcfaidx_FastaFile*)__Pyx_GetVtable(__pyx_ptype_5pysam_9libcfaidx_FastaFile->tp_dict); if (unlikely(!__pyx_vtabptr_5pysam_9libcfaidx_FastaFile)) __PYX_ERR(6, 37, __pyx_L1_error)
  __pyx_ptype_5pysam_9libcfaidx_FastqProxy = __Pyx_ImportType(__pyx_t_1, "pysam.libcfaidx", "FastqProxy", sizeof(struct __pyx_obj_5pysam_9libcfaidx_FastqProxy), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5pysam_9libcfaidx_FastqProxy) __PYX_ERR(6, 45, __pyx_L1_error)
  __pyx_vtabptr_5pysam_9libcfaidx_FastqProxy = (struct __pyx_vtabstruct_5pysam_9libcfaidx_FastqProxy*)__Pyx_GetVtable(__pyx_ptype_5pysam_9libcfaidx_FastqProxy->tp_dict); if (unlikely(!__pyx_vtabptr_5pysam_9libcfaidx_FastqProxy)) __PYX_ERR(6, 45, __pyx_L1_error)
  __pyx_ptype_5pysam_9libcfaidx_FastxRecord = __Pyx_ImportType(__pyx_t_1, "pysam.libcfaidx", "FastxRecord", sizeof(struct __pyx_obj_5pysam_9libcfaidx_FastxRecord), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5pysam_9libcfaidx_FastxRecord) __PYX_ERR(6, 52, __pyx_L1_error)
  __pyx_vtabptr_5pysam_9libcfaidx_FastxRecord = (struct __pyx_vtabstruct_5pysam_9libcfaidx_FastxRecord*)__Pyx_GetVtable(__pyx_ptype_5pysam_9libcfaidx_FastxRecord->tp_dict); if (unlikely(!__pyx_vtabptr_5pysam_9libcfaidx_FastxRecord)) __PYX_ERR(6, 52, __pyx_L1_error)
  __pyx_ptype_5pysam_9libcfaidx_FastxFile = __Pyx_ImportType(__pyx_t_1, "pysam.libcfaidx", "FastxFile", sizeof(struct __pyx_obj_5pysam_9libcfaidx_FastxFile), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5pysam_9libcfaidx_FastxFile) __PYX_ERR(6, 61, __pyx_L1_error)
  __pyx_vtabptr_5pysam_9libcfaidx_FastxFile = (struct __pyx_vtabstruct_5pysam_9libcfaidx_FastxFile*)__Pyx_GetVtable(__pyx_ptype_5pysam_9libcfaidx_FastxFile->tp_dict); if (unlikely(!__pyx_vtabptr_5pysam_9libcfaidx_FastxFile)) __PYX_ERR(6, 61, __pyx_L1_error)
  __pyx_ptype_5pysam_9libcfaidx_FastqFile = __Pyx_ImportType(__pyx_t_1, "pysam.libcfaidx", "FastqFile", sizeof(struct __pyx_obj_5pysam_9libcfaidx_FastqFile), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5pysam_9libcfaidx_FastqFile) __PYX_ERR(6, 73, __pyx_L1_error)
  __pyx_vtabptr_5pysam_9libcfaidx_FastqFile = (struct __pyx_vtabstruct_5pysam_9libcfaidx_FastqFile*)__Pyx_GetVtable(__pyx_ptype_5pysam_9libcfaidx_FastqFile->tp_dict); if (unlikely(!__pyx_vtabptr_5pysam_9libcfaidx_FastqFile)) __PYX_ERR(6, 73, __pyx_L1_error)
  __pyx_ptype_5pysam_9libcfaidx_Fastafile = __Pyx_ImportType(__pyx_t_1, "pysam.libcfaidx", "Fastafile", sizeof(struct __pyx_obj_5pysam_9libcfaidx_Fastafile), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5pysam_9libcfaidx_Fastafile) __PYX_ERR(6, 78, __pyx_L1_error)
  __pyx_vtabptr_5pysam_9libcfaidx_Fastafile = (struct __pyx_vtabstruct_5pysam_9libcfaidx_Fastafile*)__Pyx_GetVtable(__pyx_ptype_5pysam_9libcfaidx_Fastafile->tp_dict); if (unlikely(!__pyx_vtabptr_5pysam_9libcfaidx_Fastafile)) __PYX_ERR(6, 78, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("pysam.libcbcf"); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 38, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_5pysam_7libcbcf_VariantHeader = __Pyx_ImportType(__pyx_t_1, "pysam.libcbcf", "VariantHeader", sizeof(struct __pyx_obj_5pysam_7libcbcf_VariantHeader), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5pysam_7libcbcf_VariantHeader) __PYX_ERR(7, 38, __pyx_L1_error)
  __pyx_vtabptr_5pysam_7libcbcf_VariantHeader = (struct __pyx_vtabstruct_5pysam_7libcbcf_VariantHeader*)__Pyx_GetVtable(__pyx_ptype_5pysam_7libcbcf_VariantHeader->tp_dict); if (unlikely(!__pyx_vtabptr_5pysam_7libcbcf_VariantHeader)) __PYX_ERR(7, 38, __pyx_L1_error)
  __pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord = __Pyx_ImportType(__pyx_t_1, "pysam.libcbcf", "VariantHeaderRecord", sizeof(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord) __PYX_ERR(7, 46, __pyx_L1_error)
  __pyx_ptype_5pysam_7libcbcf_VariantHeaderRecords = __Pyx_ImportType(__pyx_t_1, "pysam.libcbcf", "VariantHeaderRecords", sizeof(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecords), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecords) __PYX_ERR(7, 51, __pyx_L1_error)
  __pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs = __Pyx_ImportType(__pyx_t_1, "pysam.libcbcf", "VariantHeaderContigs", sizeof(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs) __PYX_ERR(7, 55, __pyx_L1_error)
  __pyx_ptype_5pysam_7libcbcf_VariantHeaderSamples = __Pyx_ImportType(__pyx_t_1, "pysam.libcbcf", "VariantHeaderSamples", sizeof(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderSamples), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5pysam_7libcbcf_VariantHeaderSamples) __PYX_ERR(7, 59, __pyx_L1_error)
  __pyx_ptype_5pysam_7libcbcf_VariantContig = __Pyx_ImportType(__pyx_t_1, "pysam.libcbcf", "VariantContig", sizeof(struct __pyx_obj_5pysam_7libcbcf_VariantContig), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5pysam_7libcbcf_VariantContig) __PYX_ERR(7, 63, __pyx_L1_error)
  __pyx_ptype_5pysam_7libcbcf_VariantMetadata = __Pyx_ImportType(__pyx_t_1, "pysam.libcbcf", "VariantMetadata", sizeof(struct __pyx_obj_5pysam_7libcbcf_VariantMetadata), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5pysam_7libcbcf_VariantMetadata) __PYX_ERR(7, 68, __pyx_L1_error)
  __pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata = __Pyx_ImportType(__pyx_t_1, "pysam.libcbcf", "VariantHeaderMetadata", sizeof(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata) __PYX_ERR(7, 74, __pyx_L1_error)
  __pyx_ptype_5pysam_7libcbcf_VariantRecord = __Pyx_ImportType(__pyx_t_1, "pysam.libcbcf", "VariantRecord", sizeof(struct __pyx_obj_5pysam_7libcbcf_VariantRecord), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5pysam_7libcbcf_VariantRecord) __PYX_ERR(7, 79, __pyx_L1_error)
  __pyx_ptype_5pysam_7libcbcf_VariantRecordFilter = __Pyx_ImportType(__pyx_t_1, "pysam.libcbcf", "VariantRecordFilter", sizeof(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5pysam_7libcbcf_VariantRecordFilter) __PYX_ERR(7, 84, __pyx_L1_error)
  __pyx_ptype_5pysam_7libcbcf_VariantRecordFormat = __Pyx_ImportType(__pyx_t_1, "pysam.libcbcf", "VariantRecordFormat", sizeof(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5pysam_7libcbcf_VariantRecordFormat) __PYX_ERR(7, 88, __pyx_L1_error)
  __pyx_ptype_5pysam_7libcbcf_VariantRecordInfo = __Pyx_ImportType(__pyx_t_1, "pysam.libcbcf", "VariantRecordInfo", sizeof(struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo) __PYX_ERR(7, 92, __pyx_L1_error)
  __pyx_ptype_5pysam_7libcbcf_VariantRecordSamples = __Pyx_ImportType(__pyx_t_1, "pysam.libcbcf", "VariantRecordSamples", sizeof(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5pysam_7libcbcf_VariantRecordSamples) __PYX_ERR(7, 96, __pyx_L1_error)
  __pyx_ptype_5pysam_7libcbcf_VariantRecordSample = __Pyx_ImportType(__pyx_t_1, "pysam.libcbcf", "VariantRecordSample", sizeof(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5pysam_7libcbcf_VariantRecordSample) __PYX_ERR(7, 100, __pyx_L1_error)
  __pyx_ptype_5pysam_7libcbcf_BaseIndex = __Pyx_ImportType(__pyx_t_1, "pysam.libcbcf", "BaseIndex", sizeof(struct __pyx_obj_5pysam_7libcbcf_BaseIndex), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5pysam_7libcbcf_BaseIndex) __PYX_ERR(7, 105, __pyx_L1_error)
  __pyx_ptype_5pysam_7libcbcf_BCFIndex = __Pyx_ImportType(__pyx_t_1, "pysam.libcbcf", "BCFIndex", sizeof(struct __pyx_obj_5pysam_7libcbcf_BCFIndex), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5pysam_7libcbcf_BCFIndex) __PYX_ERR(7, 110, __pyx_L1_error)
  __pyx_ptype_5pysam_7libcbcf_TabixIndex = __Pyx_ImportType(__pyx_t_1, "pysam.libcbcf", "TabixIndex", sizeof(struct __pyx_obj_5pysam_7libcbcf_TabixIndex), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5pysam_7libcbcf_TabixIndex) __PYX_ERR(7, 115, __pyx_L1_error)
  __pyx_ptype_5pysam_7libcbcf_BaseIterator = __Pyx_ImportType(__pyx_t_1, "pysam.libcbcf", "BaseIterator", sizeof(struct __pyx_obj_5pysam_7libcbcf_BaseIterator), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5pysam_7libcbcf_BaseIterator) __PYX_ERR(7, 119, __pyx_L1_error)
  __pyx_ptype_5pysam_7libcbcf_BCFIterator = __Pyx_ImportType(__pyx_t_1, "pysam.libcbcf", "BCFIterator", sizeof(struct __pyx_obj_5pysam_7libcbcf_BCFIterator), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5pysam_7libcbcf_BCFIterator) __PYX_ERR(7, 124, __pyx_L1_error)
  __pyx_ptype_5pysam_7libcbcf_TabixIterator = __Pyx_ImportType(__pyx_t_1, "pysam.libcbcf", "TabixIterator", sizeof(struct __pyx_obj_5pysam_7libcbcf_TabixIterator), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5pysam_7libcbcf_TabixIterator) __PYX_ERR(7, 128, __pyx_L1_error)
  __pyx_ptype_5pysam_7libcbcf_VariantFile = __Pyx_ImportType(__pyx_t_1, "pysam.libcbcf", "VariantFile", sizeof(struct __pyx_obj_5pysam_7libcbcf_VariantFile), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5pysam_7libcbcf_VariantFile) __PYX_ERR(7, 133, __pyx_L1_error)
  __pyx_vtabptr_5pysam_7libcbcf_VariantFile = (struct __pyx_vtabstruct_5pysam_7libcbcf_VariantFile*)__Pyx_GetVtable(__pyx_ptype_5pysam_7libcbcf_VariantFile->tp_dict); if (unlikely(!__pyx_vtabptr_5pysam_7libcbcf_VariantFile)) __PYX_ERR(7, 133, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("aldy.indelpost.variant"); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4aldy_9indelpost_7variant_NullVariant = __Pyx_ImportType(__pyx_t_1, "aldy.indelpost.variant", "NullVariant", sizeof(struct __pyx_obj_4aldy_9indelpost_7variant_NullVariant), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4aldy_9indelpost_7variant_NullVariant) __PYX_ERR(8, 6, __pyx_L1_error)
  __pyx_ptype_4aldy_9indelpost_7variant_Variant = __Pyx_ImportType(__pyx_t_1, "aldy.indelpost.variant", "Variant", sizeof(struct __pyx_obj_4aldy_9indelpost_7variant_Variant), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4aldy_9indelpost_7variant_Variant) __PYX_ERR(8, 13, __pyx_L1_error)
  __pyx_vtabptr_4aldy_9indelpost_7variant_Variant = (struct __pyx_vtabstruct_4aldy_9indelpost_7variant_Variant*)__Pyx_GetVtable(__pyx_ptype_4aldy_9indelpost_7variant_Variant->tp_dict); if (unlikely(!__pyx_vtabptr_4aldy_9indelpost_7variant_Variant)) __PYX_ERR(8, 13, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("aldy.indelpost.local_reference"); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4aldy_9indelpost_15local_reference_UnsplicedLocalReference = __Pyx_ImportType(__pyx_t_1, "aldy.indelpost.local_reference", "UnsplicedLocalReference", sizeof(struct __pyx_obj_4aldy_9indelpost_15local_reference_UnsplicedLocalReference), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4aldy_9indelpost_15local_reference_UnsplicedLocalReference) __PYX_ERR(9, 4, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("pysam.libcalignedsegment"); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 34, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_5pysam_18libcalignedsegment_AlignedSegment = __Pyx_ImportType(__pyx_t_1, "pysam.libcalignedsegment", "AlignedSegment", sizeof(struct __pyx_obj_5pysam_18libcalignedsegment_AlignedSegment), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5pysam_18libcalignedsegment_AlignedSegment) __PYX_ERR(10, 34, __pyx_L1_error)
  __pyx_vtabptr_5pysam_18libcalignedsegment_AlignedSegment = (struct __pyx_vtabstruct_5pysam_18libcalignedsegment_AlignedSegment*)__Pyx_GetVtable(__pyx_ptype_5pysam_18libcalignedsegment_AlignedSegment->tp_dict); if (unlikely(!__pyx_vtabptr_5pysam_18libcalignedsegment_AlignedSegment)) __PYX_ERR(10, 34, __pyx_L1_error)
  __pyx_ptype_5pysam_18libcalignedsegment_PileupColumn = __Pyx_ImportType(__pyx_t_1, "pysam.libcalignedsegment", "PileupColumn", sizeof(struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5pysam_18libcalignedsegment_PileupColumn) __PYX_ERR(10, 65, __pyx_L1_error)
  __pyx_ptype_5pysam_18libcalignedsegment_PileupRead = __Pyx_ImportType(__pyx_t_1, "pysam.libcalignedsegment", "PileupRead", sizeof(struct __pyx_obj_5pysam_18libcalignedsegment_PileupRead), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5pysam_18libcalignedsegment_PileupRead) __PYX_ERR(10, 75, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("pysam.libcalignmentfile"); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 41, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_5pysam_17libcalignmentfile_AlignmentHeader = __Pyx_ImportType(__pyx_t_1, "pysam.libcalignmentfile", "AlignmentHeader", sizeof(struct __pyx_obj_5pysam_17libcalignmentfile_AlignmentHeader), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5pysam_17libcalignmentfile_AlignmentHeader) __PYX_ERR(11, 41, __pyx_L1_error)
  __pyx_ptype_5pysam_17libcalignmentfile_AlignmentFile = __Pyx_ImportType(__pyx_t_1, "pysam.libcalignmentfile", "AlignmentFile", sizeof(struct __pyx_obj_5pysam_17libcalignmentfile_AlignmentFile), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5pysam_17libcalignmentfile_AlignmentFile) __PYX_ERR(11, 44, __pyx_L1_error)
  __pyx_vtabptr_5pysam_17libcalignmentfile_AlignmentFile = (struct __pyx_vtabstruct_5pysam_17libcalignmentfile_AlignmentFile*)__Pyx_GetVtable(__pyx_ptype_5pysam_17libcalignmentfile_AlignmentFile->tp_dict); if (unlikely(!__pyx_vtabptr_5pysam_17libcalignmentfile_AlignmentFile)) __PYX_ERR(11, 44, __pyx_L1_error)
  __pyx_ptype_5pysam_17libcalignmentfile_IteratorRow = __Pyx_ImportType(__pyx_t_1, "pysam.libcalignmentfile", "IteratorRow", sizeof(struct __pyx_obj_5pysam_17libcalignmentfile_IteratorRow), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5pysam_17libcalignmentfile_IteratorRow) __PYX_ERR(11, 61, __pyx_L1_error)
  __pyx_ptype_5pysam_17libcalignmentfile_IteratorRowRegion = __Pyx_ImportType(__pyx_t_1, "pysam.libcalignmentfile", "IteratorRowRegion", sizeof(struct __pyx_obj_5pysam_17libcalignmentfile_IteratorRowRegion), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5pysam_17libcalignmentfile_IteratorRowRegion) __PYX_ERR(11, 71, __pyx_L1_error)
  __pyx_vtabptr_5pysam_17libcalignmentfile_IteratorRowRegion = (struct __pyx_vtabstruct_5pysam_17libcalignmentfile_IteratorRowRegion*)__Pyx_GetVtable(__pyx_ptype_5pysam_17libcalignmentfile_IteratorRowRegion->tp_dict); if (unlikely(!__pyx_vtabptr_5pysam_17libcalignmentfile_IteratorRowRegion)) __PYX_ERR(11, 71, __pyx_L1_error)
  __pyx_ptype_5pysam_17libcalignmentfile_IteratorRowHead = __Pyx_ImportType(__pyx_t_1, "pysam.libcalignmentfile", "IteratorRowHead", sizeof(struct __pyx_obj_5pysam_17libcalignmentfile_IteratorRowHead), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5pysam_17libcalignmentfile_IteratorRowHead) __PYX_ERR(11, 77, __pyx_L1_error)
  __pyx_vtabptr_5pysam_17libcalignmentfile_IteratorRowHead = (struct __pyx_vtabstruct_5pysam_17libcalignmentfile_IteratorRowHead*)__Pyx_GetVtable(__pyx_ptype_5pysam_17libcalignmentfile_IteratorRowHead->tp_dict); if (unlikely(!__pyx_vtabptr_5pysam_17libcalignmentfile_IteratorRowHead)) __PYX_ERR(11, 77, __pyx_L1_error)
  __pyx_ptype_5pysam_17libcalignmentfile_IteratorRowAll = __Pyx_ImportType(__pyx_t_1, "pysam.libcalignmentfile", "IteratorRowAll", sizeof(struct __pyx_obj_5pysam_17libcalignmentfile_IteratorRowAll), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5pysam_17libcalignmentfile_IteratorRowAll) __PYX_ERR(11, 84, __pyx_L1_error)
  __pyx_vtabptr_5pysam_17libcalignmentfile_IteratorRowAll = (struct __pyx_vtabstruct_5pysam_17libcalignmentfile_IteratorRowAll*)__Pyx_GetVtable(__pyx_ptype_5pysam_17libcalignmentfile_IteratorRowAll->tp_dict); if (unlikely(!__pyx_vtabptr_5pysam_17libcalignmentfile_IteratorRowAll)) __PYX_ERR(11, 84, __pyx_L1_error)
  __pyx_ptype_5pysam_17libcalignmentfile_IteratorRowAllRefs = __Pyx_ImportType(__pyx_t_1, "pysam.libcalignmentfile", "IteratorRowAllRefs", sizeof(struct __pyx_obj_5pysam_17libcalignmentfile_IteratorRowAllRefs), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5pysam_17libcalignmentfile_IteratorRowAllRefs) __PYX_ERR(11, 89, __pyx_L1_error)
  __pyx_ptype_5pysam_17libcalignmentfile_IteratorRowSelection = __Pyx_ImportType(__pyx_t_1, "pysam.libcalignmentfile", "IteratorRowSelection", sizeof(struct __pyx_obj_5pysam_17libcalignmentfile_IteratorRowSelection), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5pysam_17libcalignmentfile_IteratorRowSelection) __PYX_ERR(11, 94, __pyx_L1_error)
  __pyx_vtabptr_5pysam_17libcalignmentfile_IteratorRowSelection = (struct __pyx_vtabstruct_5pysam_17libcalignmentfile_IteratorRowSelection*)__Pyx_GetVtable(__pyx_ptype_5pysam_17libcalignmentfile_IteratorRowSelection->tp_dict); if (unlikely(!__pyx_vtabptr_5pysam_17libcalignmentfile_IteratorRowSelection)) __PYX_ERR(11, 94, __pyx_L1_error)
  __pyx_ptype_5pysam_17libcalignmentfile_IteratorColumn = __Pyx_ImportType(__pyx_t_1, "pysam.libcalignmentfile", "IteratorColumn", sizeof(struct __pyx_obj_5pysam_17libcalignmentfile_IteratorColumn), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5pysam_17libcalignmentfile_IteratorColumn) __PYX_ERR(11, 101, __pyx_L1_error)
  __pyx_vtabptr_5pysam_17libcalignmentfile_IteratorColumn = (struct __pyx_vtabstruct_5pysam_17libcalignmentfile_IteratorColumn*)__Pyx_GetVtable(__pyx_ptype_5pysam_17libcalignmentfile_IteratorColumn->tp_dict); if (unlikely(!__pyx_vtabptr_5pysam_17libcalignmentfile_IteratorColumn)) __PYX_ERR(11, 101, __pyx_L1_error)
  __pyx_ptype_5pysam_17libcalignmentfile_IteratorColumnRegion = __Pyx_ImportType(__pyx_t_1, "pysam.libcalignmentfile", "IteratorColumnRegion", sizeof(struct __pyx_obj_5pysam_17libcalignmentfile_IteratorColumnRegion), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5pysam_17libcalignmentfile_IteratorColumnRegion) __PYX_ERR(11, 133, __pyx_L1_error)
  __pyx_vtabptr_5pysam_17libcalignmentfile_IteratorColumnRegion = (struct __pyx_vtabstruct_5pysam_17libcalignmentfile_IteratorColumnRegion*)__Pyx_GetVtable(__pyx_ptype_5pysam_17libcalignmentfile_IteratorColumnRegion->tp_dict); if (unlikely(!__pyx_vtabptr_5pysam_17libcalignmentfile_IteratorColumnRegion)) __PYX_ERR(11, 133, __pyx_L1_error)
  __pyx_ptype_5pysam_17libcalignmentfile_IteratorColumnAllRefs = __Pyx_ImportType(__pyx_t_1, "pysam.libcalignmentfile", "IteratorColumnAllRefs", sizeof(struct __pyx_obj_5pysam_17libcalignmentfile_IteratorColumnAllRefs), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5pysam_17libcalignmentfile_IteratorColumnAllRefs) __PYX_ERR(11, 139, __pyx_L1_error)
  __pyx_vtabptr_5pysam_17libcalignmentfile_IteratorColumnAllRefs = (struct __pyx_vtabstruct_5pysam_17libcalignmentfile_IteratorColumnAllRefs*)__Pyx_GetVtable(__pyx_ptype_5pysam_17libcalignmentfile_IteratorColumnAllRefs->tp_dict); if (unlikely(!__pyx_vtabptr_5pysam_17libcalignmentfile_IteratorColumnAllRefs)) __PYX_ERR(11, 139, __pyx_L1_error)
  __pyx_ptype_5pysam_17libcalignmentfile_IteratorColumnAll = __Pyx_ImportType(__pyx_t_1, "pysam.libcalignmentfile", "IteratorColumnAll", sizeof(struct __pyx_obj_5pysam_17libcalignmentfile_IteratorColumnAll), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5pysam_17libcalignmentfile_IteratorColumnAll) __PYX_ERR(11, 143, __pyx_L1_error)
  __pyx_vtabptr_5pysam_17libcalignmentfile_IteratorColumnAll = (struct __pyx_vtabstruct_5pysam_17libcalignmentfile_IteratorColumnAll*)__Pyx_GetVtable(__pyx_ptype_5pysam_17libcalignmentfile_IteratorColumnAll->tp_dict); if (unlikely(!__pyx_vtabptr_5pysam_17libcalignmentfile_IteratorColumnAll)) __PYX_ERR(11, 143, __pyx_L1_error)
  __pyx_ptype_5pysam_17libcalignmentfile_IndexedReads = __Pyx_ImportType(__pyx_t_1, "pysam.libcalignmentfile", "IndexedReads", sizeof(struct __pyx_obj_5pysam_17libcalignmentfile_IndexedReads), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5pysam_17libcalignmentfile_IndexedReads) __PYX_ERR(11, 147, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_variable_import_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
  /*--- Variable import code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_function_import_code(void) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
  /*--- Function import code ---*/
  __pyx_t_1 = PyImport_ImportModule("aldy.indelpost.utilities"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_ImportFunction(__pyx_t_1, "split", (void (**)(void))&__pyx_f_4aldy_9indelpost_9utilities_split, "PyObject *(PyObject *, PyObject *, int, int, int, int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "locate_indels", (void (**)(void))&__pyx_f_4aldy_9indelpost_9utilities_locate_indels, "PyObject *(PyObject *, int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "get_spliced_subreads", (void (**)(void))&__pyx_f_4aldy_9indelpost_9utilities_get_spliced_subreads, "PyObject *(PyObject *, int, int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "count_lowqual_non_ref_bases", (void (**)(void))&__pyx_f_4aldy_9indelpost_9utilities_count_lowqual_non_ref_bases, "int (PyObject *, PyObject *, arrayobject *, PyObject *, int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_RefNannyFinishContext();
  return -1;
}


#ifndef CYTHON_NO_PYINIT_EXPORT
#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
#elif PY_MAJOR_VERSION < 3
#ifdef __cplusplus
#define __Pyx_PyMODINIT_FUNC extern "C" void
#else
#define __Pyx_PyMODINIT_FUNC void
#endif
#else
#ifdef __cplusplus
#define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
#else
#define __Pyx_PyMODINIT_FUNC PyObject *
#endif
#endif


#if PY_MAJOR_VERSION < 3
__Pyx_PyMODINIT_FUNC initpileup(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC initpileup(void)
#else
__Pyx_PyMODINIT_FUNC PyInit_pileup(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC PyInit_pileup(void)
#if CYTHON_PEP489_MULTI_PHASE_INIT
{
  return PyModuleDef_Init(&__pyx_moduledef);
}
static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
    #if PY_VERSION_HEX >= 0x030700A1
    static PY_INT64_T main_interpreter_id = -1;
    PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
    if (main_interpreter_id == -1) {
        main_interpreter_id = current_id;
        return (unlikely(current_id == -1)) ? -1 : 0;
    } else if (unlikely(main_interpreter_id != current_id))
    #else
    static PyInterpreterState *main_interpreter = NULL;
    PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
    if (!main_interpreter) {
        main_interpreter = current_interpreter;
    } else if (unlikely(main_interpreter != current_interpreter))
    #endif
    {
        PyErr_SetString(
            PyExc_ImportError,
            "Interpreter change detected - this module can only be loaded into one interpreter per process.");
        return -1;
    }
    return 0;
}
static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) {
    PyObject *value = PyObject_GetAttrString(spec, from_name);
    int result = 0;
    if (likely(value)) {
        if (allow_none || value != Py_None) {
            result = PyDict_SetItemString(moddict, to_name, value);
        }
        Py_DECREF(value);
    } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
        PyErr_Clear();
    } else {
        result = -1;
    }
    return result;
}
static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
    PyObject *module = NULL, *moddict, *modname;
    if (__Pyx_check_single_interpreter())
        return NULL;
    if (__pyx_m)
        return __Pyx_NewRef(__pyx_m);
    modname = PyObject_GetAttrString(spec, "name");
    if (unlikely(!modname)) goto bad;
    module = PyModule_NewObject(modname);
    Py_DECREF(modname);
    if (unlikely(!module)) goto bad;
    moddict = PyModule_GetDict(module);
    if (unlikely(!moddict)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
    return module;
bad:
    Py_XDECREF(module);
    return NULL;
}


static CYTHON_SMALL_CODE int __pyx_pymod_exec_pileup(PyObject *__pyx_pyinit_module)
#endif
#endif
{
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  if (__pyx_m) {
    if (__pyx_m == __pyx_pyinit_module) return 0;
    PyErr_SetString(PyExc_RuntimeError, "Module 'pileup' has already been imported. Re-initialisation is not supported.");
    return -1;
  }
  #elif PY_MAJOR_VERSION >= 3
  if (__pyx_m) return __Pyx_NewRef(__pyx_m);
  #endif
  #if CYTHON_REFNANNY
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
if (!__Pyx_RefNanny) {
  PyErr_Clear();
  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
  if (!__Pyx_RefNanny)
      Py_FatalError("failed to import 'refnanny' module");
}
#endif
  __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_pileup(void)", 0);
  if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #ifdef __Pxy_PyFrame_Initialize_Offsets
  __Pxy_PyFrame_Initialize_Offsets();
  #endif
  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
  #ifdef __Pyx_CyFunction_USED
  if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_FusedFunction_USED
  if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Coroutine_USED
  if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Generator_USED
  if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_AsyncGen_USED
  if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_StopAsyncIteration_USED
  if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  /*--- Library function declarations ---*/
  /*--- Threads initialization code ---*/
  #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  PyEval_InitThreads();
  #endif
  /*--- Module creation code ---*/
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  __pyx_m = __pyx_pyinit_module;
  Py_INCREF(__pyx_m);
  #else
  #if PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4("pileup", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_INCREF(__pyx_d);
  __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_INCREF(__pyx_b);
  __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_INCREF(__pyx_cython_runtime);
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  /*--- Initialize various global constants etc. ---*/
  if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
  if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  if (__pyx_module_is_main_aldy__indelpost__pileup) {
    if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  }
  #if PY_MAJOR_VERSION >= 3
  {
    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
    if (!PyDict_GetItemString(modules, "aldy.indelpost.pileup")) {
      if (unlikely(PyDict_SetItemString(modules, "aldy.indelpost.pileup", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
    }
  }
  #endif
  /*--- Builtin init code ---*/
  if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Constants init code ---*/
  if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Global type/function init code ---*/
  (void)__Pyx_modinit_global_init_code();
  (void)__Pyx_modinit_variable_export_code();
  if (unlikely(__Pyx_modinit_function_export_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
  if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
  if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
  (void)__Pyx_modinit_variable_import_code();
  if (unlikely(__Pyx_modinit_function_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Execution code ---*/
  #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
  if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif

  /* "aldy/indelpost/pileup.pyx":3
 * #cython: profile=False
 * 
 * import re             # <<<<<<<<<<<<<<
 * import random
 * cimport cython
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_re, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_re, __pyx_t_1) < 0) __PYX_ERR(0, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "aldy/indelpost/pileup.pyx":4
 * 
 * import re
 * import random             # <<<<<<<<<<<<<<
 * cimport cython
 * 
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_random, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_random, __pyx_t_1) < 0) __PYX_ERR(0, 4, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "aldy/indelpost/pileup.pyx":8
 * 
 * from cpython cimport array
 * import array             # <<<<<<<<<<<<<<
 * 
 * from  functools import partial
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_array, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_array, __pyx_t_1) < 0) __PYX_ERR(0, 8, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "aldy/indelpost/pileup.pyx":10
 * import array
 * 
 * from  functools import partial             # <<<<<<<<<<<<<<
 * from difflib import get_close_matches, SequenceMatcher
 * 
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_partial);
  __Pyx_GIVEREF(__pyx_n_s_partial);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_partial);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_functools, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_partial); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_partial, __pyx_t_1) < 0) __PYX_ERR(0, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "aldy/indelpost/pileup.pyx":11
 * 
 * from  functools import partial
 * from difflib import get_close_matches, SequenceMatcher             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 11, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_get_close_matches);
  __Pyx_GIVEREF(__pyx_n_s_get_close_matches);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_get_close_matches);
  __Pyx_INCREF(__pyx_n_s_SequenceMatcher);
  __Pyx_GIVEREF(__pyx_n_s_SequenceMatcher);
  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_SequenceMatcher);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_difflib, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 11, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_get_close_matches); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 11, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_close_matches, __pyx_t_2) < 0) __PYX_ERR(0, 11, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_SequenceMatcher); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 11, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_SequenceMatcher, __pyx_t_2) < 0) __PYX_ERR(0, 11, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "aldy/indelpost/pileup.pyx":17
 * from .local_reference cimport UnsplicedLocalReference
 * 
 * from .consensus import consensus_refseq             # <<<<<<<<<<<<<<
 * from .gappedaln import find_by_normalization
 * 
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_consensus_refseq);
  __Pyx_GIVEREF(__pyx_n_s_consensus_refseq);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_consensus_refseq);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_consensus, __pyx_t_1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_consensus_refseq); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_consensus_refseq, __pyx_t_1) < 0) __PYX_ERR(0, 17, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "aldy/indelpost/pileup.pyx":18
 * 
 * from .consensus import consensus_refseq
 * from .gappedaln import find_by_normalization             # <<<<<<<<<<<<<<
 * 
 * from .utilities cimport (
 */
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_find_by_normalization);
  __Pyx_GIVEREF(__pyx_n_s_find_by_normalization);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_find_by_normalization);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_gappedaln, __pyx_t_2, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_find_by_normalization); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_find_by_normalization, __pyx_t_2) < 0) __PYX_ERR(0, 18, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "aldy/indelpost/pileup.pyx":27
 * )
 * from .utilities import (
 *     split_cigar,             # <<<<<<<<<<<<<<
 *     most_common,
 *     to_flat_list,
 */
  __pyx_t_1 = PyList_New(6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 27, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_split_cigar);
  __Pyx_GIVEREF(__pyx_n_s_split_cigar);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_split_cigar);
  __Pyx_INCREF(__pyx_n_s_most_common);
  __Pyx_GIVEREF(__pyx_n_s_most_common);
  PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_most_common);
  __Pyx_INCREF(__pyx_n_s_to_flat_list);
  __Pyx_GIVEREF(__pyx_n_s_to_flat_list);
  PyList_SET_ITEM(__pyx_t_1, 2, __pyx_n_s_to_flat_list);
  __Pyx_INCREF(__pyx_n_s_get_mapped_subreads);
  __Pyx_GIVEREF(__pyx_n_s_get_mapped_subreads);
  PyList_SET_ITEM(__pyx_t_1, 3, __pyx_n_s_get_mapped_subreads);
  __Pyx_INCREF(__pyx_n_s_get_local_reference);
  __Pyx_GIVEREF(__pyx_n_s_get_local_reference);
  PyList_SET_ITEM(__pyx_t_1, 4, __pyx_n_s_get_local_reference);
  __Pyx_INCREF(__pyx_n_s_make_insertion_first);
  __Pyx_GIVEREF(__pyx_n_s_make_insertion_first);
  PyList_SET_ITEM(__pyx_t_1, 5, __pyx_n_s_make_insertion_first);

  /* "aldy/indelpost/pileup.pyx":26
 *     count_lowqual_non_ref_bases,
 * )
 * from .utilities import (             # <<<<<<<<<<<<<<
 *     split_cigar,
 *     most_common,
 */
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_utilities, __pyx_t_1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 26, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_split_cigar); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 26, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_split_cigar, __pyx_t_1) < 0) __PYX_ERR(0, 27, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_most_common); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 26, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_most_common, __pyx_t_1) < 0) __PYX_ERR(0, 28, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_to_flat_list); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 26, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_to_flat_list, __pyx_t_1) < 0) __PYX_ERR(0, 29, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_get_mapped_subreads); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 26, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_mapped_subreads, __pyx_t_1) < 0) __PYX_ERR(0, 30, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_get_local_reference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 26, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_local_reference, __pyx_t_1) < 0) __PYX_ERR(0, 31, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_make_insertion_first); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 26, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_insertion_first, __pyx_t_1) < 0) __PYX_ERR(0, 32, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "aldy/indelpost/pileup.pyx":35
 * )
 * from .localn import (
 *     align,             # <<<<<<<<<<<<<<
 *     make_aligner,
 *     is_worth_realn,
 */
  __pyx_t_2 = PyList_New(5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 35, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_align);
  __Pyx_GIVEREF(__pyx_n_s_align);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_align);
  __Pyx_INCREF(__pyx_n_s_make_aligner);
  __Pyx_GIVEREF(__pyx_n_s_make_aligner);
  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_make_aligner);
  __Pyx_INCREF(__pyx_n_s_is_worth_realn);
  __Pyx_GIVEREF(__pyx_n_s_is_worth_realn);
  PyList_SET_ITEM(__pyx_t_2, 2, __pyx_n_s_is_worth_realn);
  __Pyx_INCREF(__pyx_n_s_findall_indels);
  __Pyx_GIVEREF(__pyx_n_s_findall_indels);
  PyList_SET_ITEM(__pyx_t_2, 3, __pyx_n_s_findall_indels);
  __Pyx_INCREF(__pyx_n_s_findall_mismatches);
  __Pyx_GIVEREF(__pyx_n_s_findall_mismatches);
  PyList_SET_ITEM(__pyx_t_2, 4, __pyx_n_s_findall_mismatches);

  /* "aldy/indelpost/pileup.pyx":34
 *     make_insertion_first,
 * )
 * from .localn import (             # <<<<<<<<<<<<<<
 *     align,
 *     make_aligner,
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_localn, __pyx_t_2, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 34, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_align); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 34, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_align, __pyx_t_2) < 0) __PYX_ERR(0, 35, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_make_aligner); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 34, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_aligner, __pyx_t_2) < 0) __PYX_ERR(0, 36, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_is_worth_realn); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 34, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_worth_realn, __pyx_t_2) < 0) __PYX_ERR(0, 37, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_findall_indels); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 34, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_findall_indels, __pyx_t_2) < 0) __PYX_ERR(0, 38, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_findall_mismatches); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 34, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_findall_mismatches, __pyx_t_2) < 0) __PYX_ERR(0, 39, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "aldy/indelpost/pileup.pyx":46
 * from pysam.libcalignmentfile cimport AlignmentFile
 * 
 * random.seed(123)             # <<<<<<<<<<<<<<
 * 
 * cigar_ptrn = re.compile(r"[0-9]+[MIDNSHPX=]")
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_random); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 46, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_seed); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 46, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 46, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "aldy/indelpost/pileup.pyx":48
 * random.seed(123)
 * 
 * cigar_ptrn = re.compile(r"[0-9]+[MIDNSHPX=]")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_re); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 48, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_compile); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 48, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 48, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_cigar_ptrn, __pyx_t_1) < 0) __PYX_ERR(0, 48, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "aldy/indelpost/pileup.pyx":114
 * 
 * 
 * def is_within_intron(read, pos, window):             # <<<<<<<<<<<<<<
 *     intron = read["intron_pattern"]
 *     if intron == (0, 0):
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4aldy_9indelpost_6pileup_1is_within_intron, NULL, __pyx_n_s_aldy_indelpost_pileup); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 114, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_within_intron, __pyx_t_1) < 0) __PYX_ERR(0, 114, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "aldy/indelpost/pileup.pyx":435
 * 
 * 
 * def check_overhangs(pileup, splice_rate=0.2):             # <<<<<<<<<<<<<<
 * 
 *     intron_ptrns = [read["intron_pattern"] for read in pileup if is_junctional(read)]
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4aldy_9indelpost_6pileup_3check_overhangs, NULL, __pyx_n_s_aldy_indelpost_pileup); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 435, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_check_overhangs, __pyx_t_1) < 0) __PYX_ERR(0, 435, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "aldy/indelpost/pileup.pyx":454
 * 
 * 
 * def is_junctional(read):             # <<<<<<<<<<<<<<
 *     if read["intron_pattern"] == (0, 0):
 *         return read["is_covering"]
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4aldy_9indelpost_6pileup_5is_junctional, NULL, __pyx_n_s_aldy_indelpost_pileup); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 454, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_junctional, __pyx_t_1) < 0) __PYX_ERR(0, 454, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "aldy/indelpost/pileup.pyx":461
 * 
 * 
 * def is_overhang(read, intron_start, intron_end):             # <<<<<<<<<<<<<<
 *     covering_subread = read["covering_subread"]
 *     if not covering_subread:
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4aldy_9indelpost_6pileup_7is_overhang, NULL, __pyx_n_s_aldy_indelpost_pileup); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 461, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_overhang, __pyx_t_1) < 0) __PYX_ERR(0, 461, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "aldy/indelpost/pileup.pyx":477
 * 
 * 
 * def overhang_aligners(target, intron, match_score, mismatch_penalty):             # <<<<<<<<<<<<<<
 *     genome_ref = target.reference.fetch(
 *         target.chrom, target.pos - 100, target.pos + 100
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4aldy_9indelpost_6pileup_9overhang_aligners, NULL, __pyx_n_s_aldy_indelpost_pileup); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 477, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_overhang_aligners, __pyx_t_1) < 0) __PYX_ERR(0, 477, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "aldy/indelpost/pileup.pyx":494
 * 
 * 
 * def filter_spurious_overhangs(             # <<<<<<<<<<<<<<
 *     target,
 *     intron,
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4aldy_9indelpost_6pileup_11filter_spurious_overhangs, NULL, __pyx_n_s_aldy_indelpost_pileup); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 494, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_filter_spurious_overhangs, __pyx_t_1) < 0) __PYX_ERR(0, 494, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "aldy/indelpost/pileup.pyx":527
 * 
 * 
 * def is_non_spurious_overhang(             # <<<<<<<<<<<<<<
 *     read,
 *     target,
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4aldy_9indelpost_6pileup_13is_non_spurious_overhang, NULL, __pyx_n_s_aldy_indelpost_pileup); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 527, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_non_spurious_overhang, __pyx_t_1) < 0) __PYX_ERR(0, 527, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "aldy/indelpost/pileup.pyx":577
 * 
 * 
 * def retarget(             # <<<<<<<<<<<<<<
 *     target,
 *     pileup,
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4aldy_9indelpost_6pileup_15retarget, NULL, __pyx_n_s_aldy_indelpost_pileup); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 577, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_retarget, __pyx_t_1) < 0) __PYX_ERR(0, 577, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "aldy/indelpost/pileup.pyx":806
 * 
 * 
 * def update_read_info(             # <<<<<<<<<<<<<<
 *     read,
 *     candidate,
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4aldy_9indelpost_6pileup_17update_read_info, NULL, __pyx_n_s_aldy_indelpost_pileup); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 806, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_update_read_info, __pyx_t_1) < 0) __PYX_ERR(0, 806, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "aldy/indelpost/pileup.pyx":911
 * 
 * 
 * def trim_ref_flank(ref_flank, flank_cigar, left):             # <<<<<<<<<<<<<<
 * 
 *     cum = sum([int(c[:-1]) for c in flank_cigar if c[-1] != "I"])
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4aldy_9indelpost_6pileup_19trim_ref_flank, NULL, __pyx_n_s_aldy_indelpost_pileup); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 911, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_trim_ref_flank, __pyx_t_1) < 0) __PYX_ERR(0, 911, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "aldy/indelpost/pileup.pyx":922
 * 
 * 
 * def update_cigar(             # <<<<<<<<<<<<<<
 *     orig_cigar_string, realn_cigar, start_pos, splice_prtn, clipped_bases, left
 * ):
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4aldy_9indelpost_6pileup_21update_cigar, NULL, __pyx_n_s_aldy_indelpost_pileup); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 922, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_update_cigar, __pyx_t_1) < 0) __PYX_ERR(0, 922, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "aldy/indelpost/pileup.pyx":1024
 * 
 * 
 * def numeric_span(spl_span):             # <<<<<<<<<<<<<<
 *     spl_span_lst = spl_span.split("-")
 *     return [int(i) for i in spl_span_lst]
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4aldy_9indelpost_6pileup_23numeric_span, NULL, __pyx_n_s_aldy_indelpost_pileup); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1024, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_numeric_span, __pyx_t_1) < 0) __PYX_ERR(0, 1024, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "aldy/indelpost/pileup.pyx":1029
 * 
 * 
 * def update_read_positions(read, target_pos):             # <<<<<<<<<<<<<<
 * 
 *     left_adjust = sum([-int(c[:-1]) if c[-1] != "I" else 0 for c in read["lt_cigar"]])
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4aldy_9indelpost_6pileup_25update_read_positions, NULL, __pyx_n_s_aldy_indelpost_pileup); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1029, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_update_read_positions, __pyx_t_1) < 0) __PYX_ERR(0, 1029, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "aldy/indelpost/pileup.pyx":1047
 * 
 * 
 * def update_pileup(             # <<<<<<<<<<<<<<
 *     pileup,
 *     new_target,
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4aldy_9indelpost_6pileup_27update_pileup, NULL, __pyx_n_s_aldy_indelpost_pileup); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1047, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_update_pileup, __pyx_t_1) < 0) __PYX_ERR(0, 1047, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "aldy/indelpost/pileup.pyx":1
 * #cython: profile=False             # <<<<<<<<<<<<<<
 * 
 * import re
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "array.pxd":161
 *     return extend_buffer(self, other.data.as_chars, Py_SIZE(other))
 * 
 * cdef inline void zero(array self):             # <<<<<<<<<<<<<<
 *     """ set all elements of array to zero. """
 *     memset(self.data.as_chars, 0, Py_SIZE(self) * self.ob_descr.itemsize)
 */

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

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  if (__pyx_m) {
    if (__pyx_d) {
      __Pyx_AddTraceback("init aldy.indelpost.pileup", __pyx_clineno, __pyx_lineno, __pyx_filename);
    }
    Py_CLEAR(__pyx_m);
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init aldy.indelpost.pileup");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  return (__pyx_m != NULL) ? 0 : -1;
  #elif PY_MAJOR_VERSION >= 3
  return __pyx_m;
  #else
  return;
  #endif
}

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

/* PyObjectGetAttrStr */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_getattro))
        return tp->tp_getattro(obj, attr_name);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_getattr))
        return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
#endif
    return PyObject_GetAttr(obj, attr_name);
}
#endif

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

/* None */
static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname) {
    PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname);
}

/* PyFunctionFastCall */
#if CYTHON_FAST_PYCALL
static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
                                               PyObject *globals) {
    PyFrameObject *f;
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    PyObject **fastlocals;
    Py_ssize_t i;
    PyObject *result;
    assert(globals != NULL);
    /* XXX Perhaps we should create a specialized
       PyFrame_New() that doesn't take locals, but does
       take builtins without sanity checking them.
       */
    assert(tstate != NULL);
    f = PyFrame_New(tstate, co, globals, NULL);
    if (f == NULL) {
        return NULL;
    }
    fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
    for (i = 0; i < na; i++) {
        Py_INCREF(*args);
        fastlocals[i] = *args++;
    }
    result = PyEval_EvalFrameEx(f,0);
    ++tstate->recursion_depth;
    Py_DECREF(f);
    --tstate->recursion_depth;
    return result;
}
#if 1 || PY_VERSION_HEX < 0x030600B1
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
    PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
    PyObject *globals = PyFunction_GET_GLOBALS(func);
    PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
    PyObject *closure;
#if PY_MAJOR_VERSION >= 3
    PyObject *kwdefs;
#endif
    PyObject *kwtuple, **k;
    PyObject **d;
    Py_ssize_t nd;
    Py_ssize_t nk;
    PyObject *result;
    assert(kwargs == NULL || PyDict_Check(kwargs));
    nk = kwargs ? PyDict_Size(kwargs) : 0;
    if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
        return NULL;
    }
    if (
#if PY_MAJOR_VERSION >= 3
            co->co_kwonlyargcount == 0 &&
#endif
            likely(kwargs == NULL || nk == 0) &&
            co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
        if (argdefs == NULL && co->co_argcount == nargs) {
            result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
            goto done;
        }
        else if (nargs == 0 && argdefs != NULL
                 && co->co_argcount == Py_SIZE(argdefs)) {
            /* function called with no arguments, but all parameters have
               a default value: use default values as arguments .*/
            args = &PyTuple_GET_ITEM(argdefs, 0);
            result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
            goto done;
        }
    }
    if (kwargs != NULL) {
        Py_ssize_t pos, i;
        kwtuple = PyTuple_New(2 * nk);
        if (kwtuple == NULL) {
            result = NULL;
            goto done;
        }
        k = &PyTuple_GET_ITEM(kwtuple, 0);
        pos = i = 0;
        while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
            Py_INCREF(k[i]);
            Py_INCREF(k[i+1]);
            i += 2;
        }
        nk = i / 2;
    }
    else {
        kwtuple = NULL;
        k = NULL;
    }
    closure = PyFunction_GET_CLOSURE(func);
#if PY_MAJOR_VERSION >= 3
    kwdefs = PyFunction_GET_KW_DEFAULTS(func);
#endif
    if (argdefs != NULL) {
        d = &PyTuple_GET_ITEM(argdefs, 0);
        nd = Py_SIZE(argdefs);
    }
    else {
        d = NULL;
        nd = 0;
    }
#if PY_MAJOR_VERSION >= 3
    result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
                               args, (int)nargs,
                               k, (int)nk,
                               d, (int)nd, kwdefs, closure);
#else
    result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
                               args, (int)nargs,
                               k, (int)nk,
                               d, (int)nd, closure);
#endif
    Py_XDECREF(kwtuple);
done:
    Py_LeaveRecursiveCall();
    return result;
}
#endif
#endif

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

/* PyObjectCallMethO */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
    PyObject *self, *result;
    PyCFunction cfunc;
    cfunc = PyCFunction_GET_FUNCTION(func);
    self = PyCFunction_GET_SELF(func);
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
    result = cfunc(self, arg);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

/* PyObjectCallNoArg */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
#if CYTHON_FAST_PYCALL
    if (PyFunction_Check(func)) {
        return __Pyx_PyFunction_FastCall(func, NULL, 0);
    }
#endif
#ifdef __Pyx_CyFunction_USED
    if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
#else
    if (likely(PyCFunction_Check(func)))
#endif
    {
        if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
            return __Pyx_PyObject_CallMethO(func, NULL);
        }
    }
    return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
}
#endif

/* PyCFunctionFastCall */
#if CYTHON_FAST_PYCCALL
static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
    PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
    PyCFunction meth = PyCFunction_GET_FUNCTION(func);
    PyObject *self = PyCFunction_GET_SELF(func);
    int flags = PyCFunction_GET_FLAGS(func);
    assert(PyCFunction_Check(func));
    assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
    assert(nargs >= 0);
    assert(nargs == 0 || args != NULL);
    /* _PyCFunction_FastCallDict() must not be called with an exception set,
       because it may clear it (directly or indirectly) and so the
       caller loses its exception */
    assert(!PyErr_Occurred());
    if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
        return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
    } else {
        return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
    }
}
#endif

/* PyObjectCallOneArg */
#if CYTHON_COMPILING_IN_CPYTHON
static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *result;
    PyObject *args = PyTuple_New(1);
    if (unlikely(!args)) return NULL;
    Py_INCREF(arg);
    PyTuple_SET_ITEM(args, 0, arg);
    result = __Pyx_PyObject_Call(func, args, NULL);
    Py_DECREF(args);
    return result;
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
#if CYTHON_FAST_PYCALL
    if (PyFunction_Check(func)) {
        return __Pyx_PyFunction_FastCall(func, &arg, 1);
    }
#endif
    if (likely(PyCFunction_Check(func))) {
        if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
            return __Pyx_PyObject_CallMethO(func, arg);
#if CYTHON_FAST_PYCCALL
        } else if (__Pyx_PyFastCFunction_Check(func)) {
            return __Pyx_PyCFunction_FastCall(func, &arg, 1);
#endif
        }
    }
    return __Pyx__PyObject_CallOneArg(func, arg);
}
#else
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *result;
    PyObject *args = PyTuple_Pack(1, arg);
    if (unlikely(!args)) return NULL;
    result = __Pyx_PyObject_Call(func, args, NULL);
    Py_DECREF(args);
    return result;
}
#endif

/* PyObjectCall2Args */
static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
    PyObject *args, *result = NULL;
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(function)) {
        PyObject *args[2] = {arg1, arg2};
        return __Pyx_PyFunction_FastCall(function, args, 2);
    }
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(function)) {
        PyObject *args[2] = {arg1, arg2};
        return __Pyx_PyCFunction_FastCall(function, args, 2);
    }
    #endif
    args = PyTuple_New(2);
    if (unlikely(!args)) goto done;
    Py_INCREF(arg1);
    PyTuple_SET_ITEM(args, 0, arg1);
    Py_INCREF(arg2);
    PyTuple_SET_ITEM(args, 1, arg2);
    Py_INCREF(function);
    result = __Pyx_PyObject_Call(function, args, NULL);
    Py_DECREF(args);
    Py_DECREF(function);
done:
    return result;
}

/* unicode_tailmatch */
static int __Pyx_PyUnicode_TailmatchTuple(PyObject* s, PyObject* substrings,
                                          Py_ssize_t start, Py_ssize_t end, int direction) {
    Py_ssize_t i, count = PyTuple_GET_SIZE(substrings);
    for (i = 0; i < count; i++) {
        Py_ssize_t result;
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        result = PyUnicode_Tailmatch(s, PyTuple_GET_ITEM(substrings, i),
                                     start, end, direction);
#else
        PyObject* sub = PySequence_ITEM(substrings, i);
        if (unlikely(!sub)) return -1;
        result = PyUnicode_Tailmatch(s, sub, start, end, direction);
        Py_DECREF(sub);
#endif
        if (result) {
            return (int) result;
        }
    }
    return 0;
}
static int __Pyx_PyUnicode_Tailmatch(PyObject* s, PyObject* substr,
                                     Py_ssize_t start, Py_ssize_t end, int direction) {
    if (unlikely(PyTuple_Check(substr))) {
        return __Pyx_PyUnicode_TailmatchTuple(s, substr, start, end, direction);
    }
    return (int) PyUnicode_Tailmatch(s, substr, start, end, direction);
}

/* PyDictVersioning */
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
    PyObject *dict = Py_TYPE(obj)->tp_dict;
    return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
}
static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
    PyObject **dictptr = NULL;
    Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
    if (offset) {
#if CYTHON_COMPILING_IN_CPYTHON
        dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
#else
        dictptr = _PyObject_GetDictPtr(obj);
#endif
    }
    return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
}
static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
    PyObject *dict = Py_TYPE(obj)->tp_dict;
    if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
        return 0;
    return obj_dict_version == __Pyx_get_object_dict_version(obj);
}
#endif

/* GetModuleGlobalName */
#if CYTHON_USE_DICT_VERSIONS
static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
#else
static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
#endif
{
    PyObject *result;
#if !CYTHON_AVOID_BORROWED_REFS
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
    result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    } else if (unlikely(PyErr_Occurred())) {
        return NULL;
    }
#else
    result = PyDict_GetItem(__pyx_d, name);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    }
#endif
#else
    result = PyObject_GetItem(__pyx_d, name);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    }
    PyErr_Clear();
#endif
    return __Pyx_GetBuiltinName(name);
}

/* ExtTypeTest */
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (likely(__Pyx_TypeCheck(obj, type)))
        return 1;
    PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
                 Py_TYPE(obj)->tp_name, type->tp_name);
    return 0;
}

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

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

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

/* DictGetItem */
#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
    PyObject *value;
    value = PyDict_GetItemWithError(d, key);
    if (unlikely(!value)) {
        if (!PyErr_Occurred()) {
            if (unlikely(PyTuple_Check(key))) {
                PyObject* args = PyTuple_Pack(1, key);
                if (likely(args)) {
                    PyErr_SetObject(PyExc_KeyError, args);
                    Py_DECREF(args);
                }
            } else {
                PyErr_SetObject(PyExc_KeyError, key);
            }
        }
        return NULL;
    }
    Py_INCREF(value);
    return value;
}
#endif

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

/* BytesEquals */
static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY
    return PyObject_RichCompareBool(s1, s2, equals);
#else
    if (s1 == s2) {
        return (equals == Py_EQ);
    } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
        const char *ps1, *ps2;
        Py_ssize_t length = PyBytes_GET_SIZE(s1);
        if (length != PyBytes_GET_SIZE(s2))
            return (equals == Py_NE);
        ps1 = PyBytes_AS_STRING(s1);
        ps2 = PyBytes_AS_STRING(s2);
        if (ps1[0] != ps2[0]) {
            return (equals == Py_NE);
        } else if (length == 1) {
            return (equals == Py_EQ);
        } else {
            int result;
#if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000)
            Py_hash_t hash1, hash2;
            hash1 = ((PyBytesObject*)s1)->ob_shash;
            hash2 = ((PyBytesObject*)s2)->ob_shash;
            if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
                return (equals == Py_NE);
            }
#endif
            result = memcmp(ps1, ps2, (size_t)length);
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
        return (equals == Py_NE);
    } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
        return (equals == Py_NE);
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
#endif
}

/* UnicodeEquals */
static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY
    return PyObject_RichCompareBool(s1, s2, equals);
#else
#if PY_MAJOR_VERSION < 3
    PyObject* owned_ref = NULL;
#endif
    int s1_is_unicode, s2_is_unicode;
    if (s1 == s2) {
        goto return_eq;
    }
    s1_is_unicode = PyUnicode_CheckExact(s1);
    s2_is_unicode = PyUnicode_CheckExact(s2);
#if PY_MAJOR_VERSION < 3
    if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
        owned_ref = PyUnicode_FromObject(s2);
        if (unlikely(!owned_ref))
            return -1;
        s2 = owned_ref;
        s2_is_unicode = 1;
    } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
        owned_ref = PyUnicode_FromObject(s1);
        if (unlikely(!owned_ref))
            return -1;
        s1 = owned_ref;
        s1_is_unicode = 1;
    } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
        return __Pyx_PyBytes_Equals(s1, s2, equals);
    }
#endif
    if (s1_is_unicode & s2_is_unicode) {
        Py_ssize_t length;
        int kind;
        void *data1, *data2;
        if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
            return -1;
        length = __Pyx_PyUnicode_GET_LENGTH(s1);
        if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
            goto return_ne;
        }
#if CYTHON_USE_UNICODE_INTERNALS
        {
            Py_hash_t hash1, hash2;
        #if CYTHON_PEP393_ENABLED
            hash1 = ((PyASCIIObject*)s1)->hash;
            hash2 = ((PyASCIIObject*)s2)->hash;
        #else
            hash1 = ((PyUnicodeObject*)s1)->hash;
            hash2 = ((PyUnicodeObject*)s2)->hash;
        #endif
            if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
                goto return_ne;
            }
        }
#endif
        kind = __Pyx_PyUnicode_KIND(s1);
        if (kind != __Pyx_PyUnicode_KIND(s2)) {
            goto return_ne;
        }
        data1 = __Pyx_PyUnicode_DATA(s1);
        data2 = __Pyx_PyUnicode_DATA(s2);
        if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
            goto return_ne;
        } else if (length == 1) {
            goto return_eq;
        } else {
            int result = memcmp(data1, data2, (size_t)(length * kind));
            #if PY_MAJOR_VERSION < 3
            Py_XDECREF(owned_ref);
            #endif
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & s2_is_unicode) {
        goto return_ne;
    } else if ((s2 == Py_None) & s1_is_unicode) {
        goto return_ne;
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        #if PY_MAJOR_VERSION < 3
        Py_XDECREF(owned_ref);
        #endif
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
return_eq:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(owned_ref);
    #endif
    return (equals == Py_EQ);
return_ne:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(owned_ref);
    #endif
    return (equals == Py_NE);
#endif
}

/* SliceObject */
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj,
        Py_ssize_t cstart, Py_ssize_t cstop,
        PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
        int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
#if CYTHON_USE_TYPE_SLOTS
    PyMappingMethods* mp;
#if PY_MAJOR_VERSION < 3
    PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence;
    if (likely(ms && ms->sq_slice)) {
        if (!has_cstart) {
            if (_py_start && (*_py_start != Py_None)) {
                cstart = __Pyx_PyIndex_AsSsize_t(*_py_start);
                if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
            } else
                cstart = 0;
        }
        if (!has_cstop) {
            if (_py_stop && (*_py_stop != Py_None)) {
                cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop);
                if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
            } else
                cstop = PY_SSIZE_T_MAX;
        }
        if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) {
            Py_ssize_t l = ms->sq_length(obj);
            if (likely(l >= 0)) {
                if (cstop < 0) {
                    cstop += l;
                    if (cstop < 0) cstop = 0;
                }
                if (cstart < 0) {
                    cstart += l;
                    if (cstart < 0) cstart = 0;
                }
            } else {
                if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                    goto bad;
                PyErr_Clear();
            }
        }
        return ms->sq_slice(obj, cstart, cstop);
    }
#endif
    mp = Py_TYPE(obj)->tp_as_mapping;
    if (likely(mp && mp->mp_subscript))
#endif
    {
        PyObject* result;
        PyObject *py_slice, *py_start, *py_stop;
        if (_py_slice) {
            py_slice = *_py_slice;
        } else {
            PyObject* owned_start = NULL;
            PyObject* owned_stop = NULL;
            if (_py_start) {
                py_start = *_py_start;
            } else {
                if (has_cstart) {
                    owned_start = py_start = PyInt_FromSsize_t(cstart);
                    if (unlikely(!py_start)) goto bad;
                } else
                    py_start = Py_None;
            }
            if (_py_stop) {
                py_stop = *_py_stop;
            } else {
                if (has_cstop) {
                    owned_stop = py_stop = PyInt_FromSsize_t(cstop);
                    if (unlikely(!py_stop)) {
                        Py_XDECREF(owned_start);
                        goto bad;
                    }
                } else
                    py_stop = Py_None;
            }
            py_slice = PySlice_New(py_start, py_stop, Py_None);
            Py_XDECREF(owned_start);
            Py_XDECREF(owned_stop);
            if (unlikely(!py_slice)) goto bad;
        }
#if CYTHON_USE_TYPE_SLOTS
        result = mp->mp_subscript(obj, py_slice);
#else
        result = PyObject_GetItem(obj, py_slice);
#endif
        if (!_py_slice) {
            Py_DECREF(py_slice);
        }
        return result;
    }
    PyErr_Format(PyExc_TypeError,
        "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name);
bad:
    return NULL;
}

/* PyIntBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
    (void)inplace;
    (void)zerodivision_check;
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long x;
        long a = PyInt_AS_LONG(op1);
            x = (long)((unsigned long)a + b);
            if (likely((x^a) >= 0 || (x^b) >= 0))
                return PyInt_FromLong(x);
            return PyLong_Type.tp_as_number->nb_add(op1, op2);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a, x;
#ifdef HAVE_LONG_LONG
        const PY_LONG_LONG llb = intval;
        PY_LONG_LONG lla, llx;
#endif
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            a = likely(size) ? digits[0] : 0;
            if (size == -1) a = -a;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
            }
        }
                x = a + b;
            return PyLong_FromLong(x);
#ifdef HAVE_LONG_LONG
        long_long:
                llx = lla + llb;
            return PyLong_FromLongLong(llx);
#endif
        
        
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
            double result;
            PyFPE_START_PROTECT("add", return NULL)
            result = ((double)a) + (double)b;
            PyFPE_END_PROTECT(result)
            return PyFloat_FromDouble(result);
    }
    return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
}
#endif

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

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

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

/* PyObjectGetMethod */
static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) {
    PyObject *attr;
#if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP
    PyTypeObject *tp = Py_TYPE(obj);
    PyObject *descr;
    descrgetfunc f = NULL;
    PyObject **dictptr, *dict;
    int meth_found = 0;
    assert (*method == NULL);
    if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) {
        attr = __Pyx_PyObject_GetAttrStr(obj, name);
        goto try_unpack;
    }
    if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) {
        return 0;
    }
    descr = _PyType_Lookup(tp, name);
    if (likely(descr != NULL)) {
        Py_INCREF(descr);
#if PY_MAJOR_VERSION >= 3
        #ifdef __Pyx_CyFunction_USED
        if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr)))
        #else
        if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type)))
        #endif
#else
        #ifdef __Pyx_CyFunction_USED
        if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr)))
        #else
        if (likely(PyFunction_Check(descr)))
        #endif
#endif
        {
            meth_found = 1;
        } else {
            f = Py_TYPE(descr)->tp_descr_get;
            if (f != NULL && PyDescr_IsData(descr)) {
                attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
                Py_DECREF(descr);
                goto try_unpack;
            }
        }
    }
    dictptr = _PyObject_GetDictPtr(obj);
    if (dictptr != NULL && (dict = *dictptr) != NULL) {
        Py_INCREF(dict);
        attr = __Pyx_PyDict_GetItemStr(dict, name);
        if (attr != NULL) {
            Py_INCREF(attr);
            Py_DECREF(dict);
            Py_XDECREF(descr);
            goto try_unpack;
        }
        Py_DECREF(dict);
    }
    if (meth_found) {
        *method = descr;
        return 1;
    }
    if (f != NULL) {
        attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
        Py_DECREF(descr);
        goto try_unpack;
    }
    if (descr != NULL) {
        *method = descr;
        return 0;
    }
    PyErr_Format(PyExc_AttributeError,
#if PY_MAJOR_VERSION >= 3
                 "'%.50s' object has no attribute '%U'",
                 tp->tp_name, name);
#else
                 "'%.50s' object has no attribute '%.400s'",
                 tp->tp_name, PyString_AS_STRING(name));
#endif
    return 0;
#else
    attr = __Pyx_PyObject_GetAttrStr(obj, name);
    goto try_unpack;
#endif
try_unpack:
#if CYTHON_UNPACK_METHODS
    if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) {
        PyObject *function = PyMethod_GET_FUNCTION(attr);
        Py_INCREF(function);
        Py_DECREF(attr);
        *method = function;
        return 1;
    }
#endif
    *method = attr;
    return 0;
}

/* PyObjectCallMethod1 */
static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
    PyObject *result = __Pyx_PyObject_CallOneArg(method, arg);
    Py_DECREF(method);
    return result;
}
static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
    PyObject *method = NULL, *result;
    int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
    if (likely(is_method)) {
        result = __Pyx_PyObject_Call2Args(method, obj, arg);
        Py_DECREF(method);
        return result;
    }
    if (unlikely(!method)) return NULL;
    return __Pyx__PyObject_CallMethod1(method, arg);
}

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

/* GetItemIntUnicode */
static CYTHON_INLINE Py_UCS4 __Pyx_GetItemInt_Unicode_Fast(PyObject* ustring, Py_ssize_t i,
                                                           int wraparound, int boundscheck) {
    Py_ssize_t length;
    if (unlikely(__Pyx_PyUnicode_READY(ustring) < 0)) return (Py_UCS4)-1;
    if (wraparound | boundscheck) {
        length = __Pyx_PyUnicode_GET_LENGTH(ustring);
        if (wraparound & unlikely(i < 0)) i += length;
        if ((!boundscheck) || likely(__Pyx_is_valid_index(i, length))) {
            return __Pyx_PyUnicode_READ_CHAR(ustring, i);
        } else {
            PyErr_SetString(PyExc_IndexError, "string index out of range");
            return (Py_UCS4)-1;
        }
    } else {
        return __Pyx_PyUnicode_READ_CHAR(ustring, i);
    }
}

/* PyUnicode_Substring */
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Substring(
            PyObject* text, Py_ssize_t start, Py_ssize_t stop) {
    Py_ssize_t length;
    if (unlikely(__Pyx_PyUnicode_READY(text) == -1)) return NULL;
    length = __Pyx_PyUnicode_GET_LENGTH(text);
    if (start < 0) {
        start += length;
        if (start < 0)
            start = 0;
    }
    if (stop < 0)
        stop += length;
    else if (stop > length)
        stop = length;
    if (stop <= start)
        return __Pyx_NewRef(__pyx_empty_unicode);
#if CYTHON_PEP393_ENABLED
    return PyUnicode_FromKindAndData(PyUnicode_KIND(text),
        PyUnicode_1BYTE_DATA(text) + start*PyUnicode_KIND(text), stop-start);
#else
    return PyUnicode_FromUnicode(PyUnicode_AS_UNICODE(text)+start, stop-start);
#endif
}

/* PyErrFetchRestore */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    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 CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    *type = tstate->curexc_type;
    *value = tstate->curexc_value;
    *tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
}
#endif

/* WriteUnraisableException */
static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
                                  CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename,
                                  int full_traceback, CYTHON_UNUSED int nogil) {
    PyObject *old_exc, *old_val, *old_tb;
    PyObject *ctx;
    __Pyx_PyThreadState_declare
#ifdef WITH_THREAD
    PyGILState_STATE state;
    if (nogil)
        state = PyGILState_Ensure();
#ifdef _MSC_VER
    else state = (PyGILState_STATE)-1;
#endif
#endif
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
    if (full_traceback) {
        Py_XINCREF(old_exc);
        Py_XINCREF(old_val);
        Py_XINCREF(old_tb);
        __Pyx_ErrRestore(old_exc, old_val, old_tb);
        PyErr_PrintEx(1);
    }
    #if PY_MAJOR_VERSION < 3
    ctx = PyString_FromString(name);
    #else
    ctx = PyUnicode_FromString(name);
    #endif
    __Pyx_ErrRestore(old_exc, old_val, old_tb);
    if (!ctx) {
        PyErr_WriteUnraisable(Py_None);
    } else {
        PyErr_WriteUnraisable(ctx);
        Py_DECREF(ctx);
    }
#ifdef WITH_THREAD
    if (nogil)
        PyGILState_Release(state);
#endif
}

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

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

/* ObjectGetItem */
#if CYTHON_USE_TYPE_SLOTS
static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
    PyObject *runerr;
    Py_ssize_t key_value;
    PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
    if (unlikely(!(m && m->sq_item))) {
        PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
        return NULL;
    }
    key_value = __Pyx_PyIndex_AsSsize_t(index);
    if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
        return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
    }
    if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
        PyErr_Clear();
        PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
    }
    return NULL;
}
static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
    PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
    if (likely(m && m->mp_subscript)) {
        return m->mp_subscript(obj, key);
    }
    return __Pyx_PyObject_GetIndex(obj, key);
}
#endif

/* PyIntBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
    (void)inplace;
    (void)zerodivision_check;
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long x;
        long a = PyInt_AS_LONG(op1);
            x = (long)((unsigned long)a - b);
            if (likely((x^a) >= 0 || (x^~b) >= 0))
                return PyInt_FromLong(x);
            return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a, x;
#ifdef HAVE_LONG_LONG
        const PY_LONG_LONG llb = intval;
        PY_LONG_LONG lla, llx;
#endif
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            a = likely(size) ? digits[0] : 0;
            if (size == -1) a = -a;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                default: return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
            }
        }
                x = a - b;
            return PyLong_FromLong(x);
#ifdef HAVE_LONG_LONG
        long_long:
                llx = lla - llb;
            return PyLong_FromLongLong(llx);
#endif
        
        
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
            double result;
            PyFPE_START_PROTECT("subtract", return NULL)
            result = ((double)a) - (double)b;
            PyFPE_END_PROTECT(result)
            return PyFloat_FromDouble(result);
    }
    return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2);
}
#endif

/* UnpackUnboundCMethod */
static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) {
    PyObject *method;
    method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name);
    if (unlikely(!method))
        return -1;
    target->method = method;
#if CYTHON_COMPILING_IN_CPYTHON
    #if PY_MAJOR_VERSION >= 3
    if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type)))
    #endif
    {
        PyMethodDescrObject *descr = (PyMethodDescrObject*) method;
        target->func = descr->d_method->ml_meth;
        target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS);
    }
#endif
    return 0;
}

/* CallUnboundCMethod1 */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg) {
    if (likely(cfunc->func)) {
        int flag = cfunc->flag;
        if (flag == METH_O) {
            return (*(cfunc->func))(self, arg);
        } else if (PY_VERSION_HEX >= 0x030600B1 && flag == METH_FASTCALL) {
            if (PY_VERSION_HEX >= 0x030700A0) {
                return (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)cfunc->func)(self, &arg, 1);
            } else {
                return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL);
            }
        } else if (PY_VERSION_HEX >= 0x030700A0 && flag == (METH_FASTCALL | METH_KEYWORDS)) {
            return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL);
        }
    }
    return __Pyx__CallUnboundCMethod1(cfunc, self, arg);
}
#endif
static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg){
    PyObject *args, *result = NULL;
    if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
#if CYTHON_COMPILING_IN_CPYTHON
    if (cfunc->func && (cfunc->flag & METH_VARARGS)) {
        args = PyTuple_New(1);
        if (unlikely(!args)) goto bad;
        Py_INCREF(arg);
        PyTuple_SET_ITEM(args, 0, arg);
        if (cfunc->flag & METH_KEYWORDS)
            result = (*(PyCFunctionWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, NULL);
        else
            result = (*cfunc->func)(self, args);
    } else {
        args = PyTuple_New(2);
        if (unlikely(!args)) goto bad;
        Py_INCREF(self);
        PyTuple_SET_ITEM(args, 0, self);
        Py_INCREF(arg);
        PyTuple_SET_ITEM(args, 1, arg);
        result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
    }
#else
    args = PyTuple_Pack(2, self, arg);
    if (unlikely(!args)) goto bad;
    result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
#endif
bad:
    Py_XDECREF(args);
    return result;
}

/* PyIntCompare */
static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED long inplace) {
    if (op1 == op2) {
        Py_RETURN_TRUE;
    }
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long a = PyInt_AS_LONG(op1);
        if (a == b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        int unequal;
        unsigned long uintval;
        Py_ssize_t size = Py_SIZE(op1);
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        if (intval == 0) {
            if (size == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
        } else if (intval < 0) {
            if (size >= 0)
                Py_RETURN_FALSE;
            intval = -intval;
            size = -size;
        } else {
            if (size <= 0)
                Py_RETURN_FALSE;
        }
        uintval = (unsigned long) intval;
#if PyLong_SHIFT * 4 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 4)) {
            unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 3 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 3)) {
            unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 2 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 2)) {
            unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 1 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 1)) {
            unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
            unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK));
        if (unequal == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
        if ((double)a == (double)b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
    }
    return (
        PyObject_RichCompare(op1, op2, Py_EQ));
}

/* py_abs */
#if CYTHON_USE_PYLONG_INTERNALS
static PyObject *__Pyx_PyLong_AbsNeg(PyObject *n) {
    if (likely(Py_SIZE(n) == -1)) {
        return PyLong_FromLong(((PyLongObject*)n)->ob_digit[0]);
    }
#if CYTHON_COMPILING_IN_CPYTHON
    {
        PyObject *copy = _PyLong_Copy((PyLongObject*)n);
        if (likely(copy)) {
            __Pyx_SET_SIZE(copy, -Py_SIZE(copy));
        }
        return copy;
    }
#else
    return PyNumber_Negative(n);
#endif
}
#endif

/* CallUnboundCMethod0 */
static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) {
    PyObject *args, *result = NULL;
    if (unlikely(!cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
#if CYTHON_ASSUME_SAFE_MACROS
    args = PyTuple_New(1);
    if (unlikely(!args)) goto bad;
    Py_INCREF(self);
    PyTuple_SET_ITEM(args, 0, self);
#else
    args = PyTuple_Pack(1, self);
    if (unlikely(!args)) goto bad;
#endif
    result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
    Py_DECREF(args);
bad:
    return result;
}

/* pyfrozenset_new */
static CYTHON_INLINE PyObject* __Pyx_PyFrozenSet_New(PyObject* it) {
    if (it) {
        PyObject* result;
#if CYTHON_COMPILING_IN_PYPY
        PyObject* args;
        args = PyTuple_Pack(1, it);
        if (unlikely(!args))
            return NULL;
        result = PyObject_Call((PyObject*)&PyFrozenSet_Type, args, NULL);
        Py_DECREF(args);
        return result;
#else
        if (PyFrozenSet_CheckExact(it)) {
            Py_INCREF(it);
            return it;
        }
        result = PyFrozenSet_New(it);
        if (unlikely(!result))
            return NULL;
        if ((PY_VERSION_HEX >= 0x031000A1) || likely(PySet_GET_SIZE(result)))
            return result;
        Py_DECREF(result);
#endif
    }
#if CYTHON_USE_TYPE_SLOTS
    return PyFrozenSet_Type.tp_new(&PyFrozenSet_Type, __pyx_empty_tuple, NULL);
#else
    return PyObject_Call((PyObject*)&PyFrozenSet_Type, __pyx_empty_tuple, NULL);
#endif
}

/* PySetContains */
static int __Pyx_PySet_ContainsUnhashable(PyObject *set, PyObject *key) {
    int result = -1;
    if (PySet_Check(key) && PyErr_ExceptionMatches(PyExc_TypeError)) {
        PyObject *tmpkey;
        PyErr_Clear();
        tmpkey = __Pyx_PyFrozenSet_New(key);
        if (tmpkey != NULL) {
            result = PySet_Contains(set, tmpkey);
            Py_DECREF(tmpkey);
        }
    }
    return result;
}
static CYTHON_INLINE int __Pyx_PySet_ContainsTF(PyObject* key, PyObject* set, int eq) {
    int result = PySet_Contains(set, key);
    if (unlikely(result < 0)) {
        result = __Pyx_PySet_ContainsUnhashable(set, key);
    }
    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
}

/* PyIntBinop */
#if !CYTHON_COMPILING_IN_PYPY
#if PY_MAJOR_VERSION < 3 || CYTHON_USE_PYLONG_INTERNALS
#define __Pyx_PyInt_TrueDivideObjC_ZeroDivisionError(operand)\
    if (unlikely(zerodivision_check && ((operand) == 0))) {\
        PyErr_SetString(PyExc_ZeroDivisionError, "integer division by zero");\
        return NULL;\
    }
#endif
static PyObject* __Pyx_PyInt_TrueDivideObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
    (void)inplace;
    (void)zerodivision_check;
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long a = PyInt_AS_LONG(op1);
            __Pyx_PyInt_TrueDivideObjC_ZeroDivisionError(b)
            if (8 * sizeof(long) <= 53 || likely(labs(a) <= ((PY_LONG_LONG)1 << 53))) {
                return PyFloat_FromDouble((double)a / (double)b);
            }
            return PyInt_Type.tp_as_number->nb_true_divide(op1, op2);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a, x;
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            a = likely(size) ? digits[0] : 0;
            if (size == -1) a = -a;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT && 1 * PyLong_SHIFT < 53) {
                        a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                    CYTHON_FALLTHROUGH;
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT && 1 * PyLong_SHIFT < 53) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                    CYTHON_FALLTHROUGH;
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT && 2 * PyLong_SHIFT < 53) {
                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                    CYTHON_FALLTHROUGH;
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT && 2 * PyLong_SHIFT < 53) {
                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                    CYTHON_FALLTHROUGH;
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT && 3 * PyLong_SHIFT < 53) {
                        a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                    CYTHON_FALLTHROUGH;
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT && 3 * PyLong_SHIFT < 53) {
                        a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                    CYTHON_FALLTHROUGH;
                default: return PyLong_Type.tp_as_number->nb_true_divide(op1, op2);
            }
        }
                __Pyx_PyInt_TrueDivideObjC_ZeroDivisionError(b)
                if ((8 * sizeof(long) <= 53 || likely(labs(a) <= ((PY_LONG_LONG)1 << 53)))
                        || __Pyx_sst_abs(size) <= 52 / PyLong_SHIFT) {
                    return PyFloat_FromDouble((double)a / (double)b);
                }
                return PyLong_Type.tp_as_number->nb_true_divide(op1, op2);
            return PyLong_FromLong(x);
        
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
            double result;
            if (unlikely(zerodivision_check && b == 0)) {
                PyErr_SetString(PyExc_ZeroDivisionError, "float division by zero");
                return NULL;
            }
            PyFPE_START_PROTECT("divide", return NULL)
            result = ((double)a) / (double)b;
            PyFPE_END_PROTECT(result)
            return PyFloat_FromDouble(result);
    }
    return (inplace ? PyNumber_InPlaceTrueDivide : PyNumber_TrueDivide)(op1, op2);
}
#endif

/* set_iter */
static CYTHON_INLINE PyObject* __Pyx_set_iterator(PyObject* iterable, int is_set,
                                                  Py_ssize_t* p_orig_length, int* p_source_is_set) {
#if CYTHON_COMPILING_IN_CPYTHON
    is_set = is_set || likely(PySet_CheckExact(iterable) || PyFrozenSet_CheckExact(iterable));
    *p_source_is_set = is_set;
    if (likely(is_set)) {
        *p_orig_length = PySet_Size(iterable);
        Py_INCREF(iterable);
        return iterable;
    }
#else
    (void)is_set;
    *p_source_is_set = 0;
#endif
    *p_orig_length = 0;
    return PyObject_GetIter(iterable);
}
static CYTHON_INLINE int __Pyx_set_iter_next(
        PyObject* iter_obj, Py_ssize_t orig_length,
        Py_ssize_t* ppos, PyObject **value,
        int source_is_set) {
    if (!CYTHON_COMPILING_IN_CPYTHON || unlikely(!source_is_set)) {
        *value = PyIter_Next(iter_obj);
        if (unlikely(!*value)) {
            return __Pyx_IterFinish();
        }
        (void)orig_length;
        (void)ppos;
        return 1;
    }
#if CYTHON_COMPILING_IN_CPYTHON
    if (unlikely(PySet_GET_SIZE(iter_obj) != orig_length)) {
        PyErr_SetString(
            PyExc_RuntimeError,
            "set changed size during iteration");
        return -1;
    }
    {
        Py_hash_t hash;
        int ret = _PySet_NextEntry(iter_obj, ppos, value, &hash);
        assert (ret != -1);
        if (likely(ret)) {
            Py_INCREF(*value);
            return 1;
        }
    }
#endif
    return 0;
}

/* FetchCommonType */
static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
    PyObject* fake_module;
    PyTypeObject* cached_type = NULL;
    fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
    if (!fake_module) return NULL;
    Py_INCREF(fake_module);
    cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
    if (cached_type) {
        if (!PyType_Check((PyObject*)cached_type)) {
            PyErr_Format(PyExc_TypeError,
                "Shared Cython type %.200s is not a type object",
                type->tp_name);
            goto bad;
        }
        if (cached_type->tp_basicsize != type->tp_basicsize) {
            PyErr_Format(PyExc_TypeError,
                "Shared Cython type %.200s has the wrong size, try recompiling",
                type->tp_name);
            goto bad;
        }
    } else {
        if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
        PyErr_Clear();
        if (PyType_Ready(type) < 0) goto bad;
        if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
            goto bad;
        Py_INCREF(type);
        cached_type = type;
    }
done:
    Py_DECREF(fake_module);
    return cached_type;
bad:
    Py_XDECREF(cached_type);
    cached_type = NULL;
    goto done;
}

/* CythonFunctionShared */
#include <structmember.h>
static PyObject *
__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
{
    if (unlikely(op->func_doc == NULL)) {
        if (op->func.m_ml->ml_doc) {
#if PY_MAJOR_VERSION >= 3
            op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
#else
            op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
#endif
            if (unlikely(op->func_doc == NULL))
                return NULL;
        } else {
            Py_INCREF(Py_None);
            return Py_None;
        }
    }
    Py_INCREF(op->func_doc);
    return op->func_doc;
}
static int
__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
{
    PyObject *tmp = op->func_doc;
    if (value == NULL) {
        value = Py_None;
    }
    Py_INCREF(value);
    op->func_doc = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    if (unlikely(op->func_name == NULL)) {
#if PY_MAJOR_VERSION >= 3
        op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
#else
        op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
#endif
        if (unlikely(op->func_name == NULL))
            return NULL;
    }
    Py_INCREF(op->func_name);
    return op->func_name;
}
static int
__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value)))
#else
    if (unlikely(value == NULL || !PyString_Check(value)))
#endif
    {
        PyErr_SetString(PyExc_TypeError,
                        "__name__ must be set to a string object");
        return -1;
    }
    tmp = op->func_name;
    Py_INCREF(value);
    op->func_name = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    Py_INCREF(op->func_qualname);
    return op->func_qualname;
}
static int
__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value)))
#else
    if (unlikely(value == NULL || !PyString_Check(value)))
#endif
    {
        PyErr_SetString(PyExc_TypeError,
                        "__qualname__ must be set to a string object");
        return -1;
    }
    tmp = op->func_qualname;
    Py_INCREF(value);
    op->func_qualname = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
{
    PyObject *self;
    self = m->func_closure;
    if (self == NULL)
        self = Py_None;
    Py_INCREF(self);
    return self;
}
static PyObject *
__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    if (unlikely(op->func_dict == NULL)) {
        op->func_dict = PyDict_New();
        if (unlikely(op->func_dict == NULL))
            return NULL;
    }
    Py_INCREF(op->func_dict);
    return op->func_dict;
}
static int
__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
{
    PyObject *tmp;
    if (unlikely(value == NULL)) {
        PyErr_SetString(PyExc_TypeError,
               "function's dictionary may not be deleted");
        return -1;
    }
    if (unlikely(!PyDict_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
               "setting function's dictionary to a non-dict");
        return -1;
    }
    tmp = op->func_dict;
    Py_INCREF(value);
    op->func_dict = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    Py_INCREF(op->func_globals);
    return op->func_globals;
}
static PyObject *
__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    Py_INCREF(Py_None);
    return Py_None;
}
static PyObject *
__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    PyObject* result = (op->func_code) ? op->func_code : Py_None;
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
    int result = 0;
    PyObject *res = op->defaults_getter((PyObject *) op);
    if (unlikely(!res))
        return -1;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
    Py_INCREF(op->defaults_tuple);
    op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
    Py_INCREF(op->defaults_kwdict);
    #else
    op->defaults_tuple = PySequence_ITEM(res, 0);
    if (unlikely(!op->defaults_tuple)) result = -1;
    else {
        op->defaults_kwdict = PySequence_ITEM(res, 1);
        if (unlikely(!op->defaults_kwdict)) result = -1;
    }
    #endif
    Py_DECREF(res);
    return result;
}
static int
__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
    PyObject* tmp;
    if (!value) {
        value = Py_None;
    } else if (value != Py_None && !PyTuple_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__defaults__ must be set to a tuple object");
        return -1;
    }
    Py_INCREF(value);
    tmp = op->defaults_tuple;
    op->defaults_tuple = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
    PyObject* result = op->defaults_tuple;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
            result = op->defaults_tuple;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
    PyObject* tmp;
    if (!value) {
        value = Py_None;
    } else if (value != Py_None && !PyDict_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__kwdefaults__ must be set to a dict object");
        return -1;
    }
    Py_INCREF(value);
    tmp = op->defaults_kwdict;
    op->defaults_kwdict = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
    PyObject* result = op->defaults_kwdict;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
            result = op->defaults_kwdict;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
    PyObject* tmp;
    if (!value || value == Py_None) {
        value = NULL;
    } else if (!PyDict_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__annotations__ must be set to a dict object");
        return -1;
    }
    Py_XINCREF(value);
    tmp = op->func_annotations;
    op->func_annotations = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
    PyObject* result = op->func_annotations;
    if (unlikely(!result)) {
        result = PyDict_New();
        if (unlikely(!result)) return NULL;
        op->func_annotations = result;
    }
    Py_INCREF(result);
    return result;
}
static PyGetSetDef __pyx_CyFunction_getsets[] = {
    {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {(char *) "__doc__",  (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
    {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
    {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
    {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
    {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
    {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
    {0, 0, 0, 0, 0}
};
static PyMemberDef __pyx_CyFunction_members[] = {
    {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), PY_WRITE_RESTRICTED, 0},
    {0, 0, 0,  0, 0}
};
static PyObject *
__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
{
#if PY_MAJOR_VERSION >= 3
    Py_INCREF(m->func_qualname);
    return m->func_qualname;
#else
    return PyString_FromString(m->func.m_ml->ml_name);
#endif
}
static PyMethodDef __pyx_CyFunction_methods[] = {
    {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
    {0, 0, 0, 0}
};
#if PY_VERSION_HEX < 0x030500A0
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
#else
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist)
#endif
static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname,
                                       PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
    if (unlikely(op == NULL))
        return NULL;
    op->flags = flags;
    __Pyx_CyFunction_weakreflist(op) = NULL;
    op->func.m_ml = ml;
    op->func.m_self = (PyObject *) op;
    Py_XINCREF(closure);
    op->func_closure = closure;
    Py_XINCREF(module);
    op->func.m_module = module;
    op->func_dict = NULL;
    op->func_name = NULL;
    Py_INCREF(qualname);
    op->func_qualname = qualname;
    op->func_doc = NULL;
    op->func_classobj = NULL;
    op->func_globals = globals;
    Py_INCREF(op->func_globals);
    Py_XINCREF(code);
    op->func_code = code;
    op->defaults_pyobjects = 0;
    op->defaults_size = 0;
    op->defaults = NULL;
    op->defaults_tuple = NULL;
    op->defaults_kwdict = NULL;
    op->defaults_getter = NULL;
    op->func_annotations = NULL;
    return (PyObject *) op;
}
static int
__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
{
    Py_CLEAR(m->func_closure);
    Py_CLEAR(m->func.m_module);
    Py_CLEAR(m->func_dict);
    Py_CLEAR(m->func_name);
    Py_CLEAR(m->func_qualname);
    Py_CLEAR(m->func_doc);
    Py_CLEAR(m->func_globals);
    Py_CLEAR(m->func_code);
    Py_CLEAR(m->func_classobj);
    Py_CLEAR(m->defaults_tuple);
    Py_CLEAR(m->defaults_kwdict);
    Py_CLEAR(m->func_annotations);
    if (m->defaults) {
        PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
        int i;
        for (i = 0; i < m->defaults_pyobjects; i++)
            Py_XDECREF(pydefaults[i]);
        PyObject_Free(m->defaults);
        m->defaults = NULL;
    }
    return 0;
}
static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
    if (__Pyx_CyFunction_weakreflist(m) != NULL)
        PyObject_ClearWeakRefs((PyObject *) m);
    __Pyx_CyFunction_clear(m);
    PyObject_GC_Del(m);
}
static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
    PyObject_GC_UnTrack(m);
    __Pyx__CyFunction_dealloc(m);
}
static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
{
    Py_VISIT(m->func_closure);
    Py_VISIT(m->func.m_module);
    Py_VISIT(m->func_dict);
    Py_VISIT(m->func_name);
    Py_VISIT(m->func_qualname);
    Py_VISIT(m->func_doc);
    Py_VISIT(m->func_globals);
    Py_VISIT(m->func_code);
    Py_VISIT(m->func_classobj);
    Py_VISIT(m->defaults_tuple);
    Py_VISIT(m->defaults_kwdict);
    if (m->defaults) {
        PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
        int i;
        for (i = 0; i < m->defaults_pyobjects; i++)
            Py_VISIT(pydefaults[i]);
    }
    return 0;
}
static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
{
#if PY_MAJOR_VERSION < 3
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
        Py_INCREF(func);
        return func;
    }
    if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
        if (type == NULL)
            type = (PyObject *)(Py_TYPE(obj));
        return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type)));
    }
    if (obj == Py_None)
        obj = NULL;
#endif
    return __Pyx_PyMethod_New(func, obj, type);
}
static PyObject*
__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
{
#if PY_MAJOR_VERSION >= 3
    return PyUnicode_FromFormat("<cyfunction %U at %p>",
                                op->func_qualname, (void *)op);
#else
    return PyString_FromFormat("<cyfunction %s at %p>",
                               PyString_AsString(op->func_qualname), (void *)op);
#endif
}
static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
    PyCFunctionObject* f = (PyCFunctionObject*)func;
    PyCFunction meth = f->m_ml->ml_meth;
    Py_ssize_t size;
    switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
    case METH_VARARGS:
        if (likely(kw == NULL || PyDict_Size(kw) == 0))
            return (*meth)(self, arg);
        break;
    case METH_VARARGS | METH_KEYWORDS:
        return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw);
    case METH_NOARGS:
        if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
            size = PyTuple_GET_SIZE(arg);
            if (likely(size == 0))
                return (*meth)(self, NULL);
            PyErr_Format(PyExc_TypeError,
                "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
                f->m_ml->ml_name, size);
            return NULL;
        }
        break;
    case METH_O:
        if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
            size = PyTuple_GET_SIZE(arg);
            if (likely(size == 1)) {
                PyObject *result, *arg0;
                #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                arg0 = PyTuple_GET_ITEM(arg, 0);
                #else
                arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL;
                #endif
                result = (*meth)(self, arg0);
                #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
                Py_DECREF(arg0);
                #endif
                return result;
            }
            PyErr_Format(PyExc_TypeError,
                "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
                f->m_ml->ml_name, size);
            return NULL;
        }
        break;
    default:
        PyErr_SetString(PyExc_SystemError, "Bad call flags in "
                        "__Pyx_CyFunction_Call. METH_OLDARGS is no "
                        "longer supported!");
        return NULL;
    }
    PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
                 f->m_ml->ml_name);
    return NULL;
}
static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw);
}
static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
    PyObject *result;
    __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
    if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
        Py_ssize_t argc;
        PyObject *new_args;
        PyObject *self;
        argc = PyTuple_GET_SIZE(args);
        new_args = PyTuple_GetSlice(args, 1, argc);
        if (unlikely(!new_args))
            return NULL;
        self = PyTuple_GetItem(args, 0);
        if (unlikely(!self)) {
            Py_DECREF(new_args);
            PyErr_Format(PyExc_TypeError,
                         "unbound method %.200S() needs an argument",
                         cyfunc->func_qualname);
            return NULL;
        }
        result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
        Py_DECREF(new_args);
    } else {
        result = __Pyx_CyFunction_Call(func, args, kw);
    }
    return result;
}
static PyTypeObject __pyx_CyFunctionType_type = {
    PyVarObject_HEAD_INIT(0, 0)
    "cython_function_or_method",
    sizeof(__pyx_CyFunctionObject),
    0,
    (destructor) __Pyx_CyFunction_dealloc,
    0,
    0,
    0,
#if PY_MAJOR_VERSION < 3
    0,
#else
    0,
#endif
    (reprfunc) __Pyx_CyFunction_repr,
    0,
    0,
    0,
    0,
    __Pyx_CyFunction_CallAsMethod,
    0,
    0,
    0,
    0,
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
    0,
    (traverseproc) __Pyx_CyFunction_traverse,
    (inquiry) __Pyx_CyFunction_clear,
    0,
#if PY_VERSION_HEX < 0x030500A0
    offsetof(__pyx_CyFunctionObject, func_weakreflist),
#else
    offsetof(PyCFunctionObject, m_weakreflist),
#endif
    0,
    0,
    __pyx_CyFunction_methods,
    __pyx_CyFunction_members,
    __pyx_CyFunction_getsets,
    0,
    0,
    __Pyx_CyFunction_descr_get,
    0,
    offsetof(__pyx_CyFunctionObject, func_dict),
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
#if PY_VERSION_HEX >= 0x030400a1
    0,
#endif
#if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
    0,
#endif
#if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
    0,
#endif
#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
    0,
#endif
};
static int __pyx_CyFunction_init(void) {
    __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
    if (unlikely(__pyx_CyFunctionType == NULL)) {
        return -1;
    }
    return 0;
}
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults = PyObject_Malloc(size);
    if (unlikely(!m->defaults))
        return PyErr_NoMemory();
    memset(m->defaults, 0, size);
    m->defaults_pyobjects = pyobjects;
    m->defaults_size = size;
    return m->defaults;
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_tuple = tuple;
    Py_INCREF(tuple);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_kwdict = dict;
    Py_INCREF(dict);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->func_annotations = dict;
    Py_INCREF(dict);
}

/* CythonFunction */
static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname,
                                      PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
    PyObject *op = __Pyx_CyFunction_Init(
        PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType),
        ml, flags, qualname, closure, module, globals, code
    );
    if (likely(op)) {
        PyObject_GC_Track(op);
    }
    return op;
}

/* GetTopmostException */
#if CYTHON_USE_EXC_INFO_STACK
static _PyErr_StackItem *
__Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
{
    _PyErr_StackItem *exc_info = tstate->exc_info;
    while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
           exc_info->previous_item != NULL)
    {
        exc_info = exc_info->previous_item;
    }
    return exc_info;
}
#endif

/* SaveResetException */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    #if CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
    *type = exc_info->exc_type;
    *value = exc_info->exc_value;
    *tb = exc_info->exc_traceback;
    #else
    *type = tstate->exc_type;
    *value = tstate->exc_value;
    *tb = tstate->exc_traceback;
    #endif
    Py_XINCREF(*type);
    Py_XINCREF(*value);
    Py_XINCREF(*tb);
}
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    #if CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = tstate->exc_info;
    tmp_type = exc_info->exc_type;
    tmp_value = exc_info->exc_value;
    tmp_tb = exc_info->exc_traceback;
    exc_info->exc_type = type;
    exc_info->exc_value = value;
    exc_info->exc_traceback = tb;
    #else
    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;
    #endif
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
}
#endif

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

/* PyObjectSetAttrStr */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_setattro))
        return tp->tp_setattro(obj, attr_name, value);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_setattr))
        return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value);
#endif
    return PyObject_SetAttr(obj, attr_name, value);
}
#endif

/* None */
static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
    PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
}

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

/* PyObject_GenericGetAttrNoDict */
#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
    PyErr_Format(PyExc_AttributeError,
#if PY_MAJOR_VERSION >= 3
                 "'%.50s' object has no attribute '%U'",
                 tp->tp_name, attr_name);
#else
                 "'%.50s' object has no attribute '%.400s'",
                 tp->tp_name, PyString_AS_STRING(attr_name));
#endif
    return NULL;
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
    PyObject *descr;
    PyTypeObject *tp = Py_TYPE(obj);
    if (unlikely(!PyString_Check(attr_name))) {
        return PyObject_GenericGetAttr(obj, attr_name);
    }
    assert(!tp->tp_dictoffset);
    descr = _PyType_Lookup(tp, attr_name);
    if (unlikely(!descr)) {
        return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
    }
    Py_INCREF(descr);
    #if PY_MAJOR_VERSION < 3
    if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
    #endif
    {
        descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
        if (unlikely(f)) {
            PyObject *res = f(descr, obj, (PyObject *)tp);
            Py_DECREF(descr);
            return res;
        }
    }
    return descr;
}
#endif

/* TypeImport */
#ifndef __PYX_HAVE_RT_ImportType
#define __PYX_HAVE_RT_ImportType
static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
    size_t size, enum __Pyx_ImportType_CheckSize check_size)
{
    PyObject *result = 0;
    char warning[200];
    Py_ssize_t basicsize;
#ifdef Py_LIMITED_API
    PyObject *py_basicsize;
#endif
    result = PyObject_GetAttrString(module, class_name);
    if (!result)
        goto bad;
    if (!PyType_Check(result)) {
        PyErr_Format(PyExc_TypeError,
            "%.200s.%.200s is not a type object",
            module_name, class_name);
        goto bad;
    }
#ifndef Py_LIMITED_API
    basicsize = ((PyTypeObject *)result)->tp_basicsize;
#else
    py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
    if (!py_basicsize)
        goto bad;
    basicsize = PyLong_AsSsize_t(py_basicsize);
    Py_DECREF(py_basicsize);
    py_basicsize = 0;
    if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
        goto bad;
#endif
    if ((size_t)basicsize < size) {
        PyErr_Format(PyExc_ValueError,
            "%.200s.%.200s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd from PyObject",
            module_name, class_name, size, basicsize);
        goto bad;
    }
    if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
        PyErr_Format(PyExc_ValueError,
            "%.200s.%.200s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd from PyObject",
            module_name, class_name, size, basicsize);
        goto bad;
    }
    else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
        PyOS_snprintf(warning, sizeof(warning),
            "%s.%s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd from PyObject",
            module_name, class_name, size, basicsize);
        if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
    }
    return (PyTypeObject *)result;
bad:
    Py_XDECREF(result);
    return NULL;
}
#endif

/* GetVTable */
static void* __Pyx_GetVtable(PyObject *dict) {
    void* ptr;
    PyObject *ob = PyObject_GetItem(dict, __pyx_n_s_pyx_vtable);
    if (!ob)
        goto bad;
#if PY_VERSION_HEX >= 0x02070000
    ptr = PyCapsule_GetPointer(ob, 0);
#else
    ptr = PyCObject_AsVoidPtr(ob);
#endif
    if (!ptr && !PyErr_Occurred())
        PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type");
    Py_DECREF(ob);
    return ptr;
bad:
    Py_XDECREF(ob);
    return NULL;
}

/* Import */
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
    PyObject *empty_list = 0;
    PyObject *module = 0;
    PyObject *global_dict = 0;
    PyObject *empty_dict = 0;
    PyObject *list;
    #if PY_MAJOR_VERSION < 3
    PyObject *py_import;
    py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
    if (!py_import)
        goto bad;
    #endif
    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;
    {
        #if PY_MAJOR_VERSION >= 3
        if (level == -1) {
            if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
                module = PyImport_ImportModuleLevelObject(
                    name, global_dict, empty_dict, list, 1);
                if (!module) {
                    if (!PyErr_ExceptionMatches(PyExc_ImportError))
                        goto bad;
                    PyErr_Clear();
                }
            }
            level = 0;
        }
        #endif
        if (!module) {
            #if PY_MAJOR_VERSION < 3
            PyObject *py_level = PyInt_FromLong(level);
            if (!py_level)
                goto bad;
            module = PyObject_CallFunctionObjArgs(py_import,
                name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
            Py_DECREF(py_level);
            #else
            module = PyImport_ImportModuleLevelObject(
                name, global_dict, empty_dict, list, level);
            #endif
        }
    }
bad:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(py_import);
    #endif
    Py_XDECREF(empty_list);
    Py_XDECREF(empty_dict);
    return module;
}

/* ImportFrom */
static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
    PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
    if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
        PyErr_Format(PyExc_ImportError,
        #if PY_MAJOR_VERSION < 3
            "cannot import name %.230s", PyString_AS_STRING(name));
        #else
            "cannot import name %S", name);
        #endif
    }
    return value;
}

/* CLineInTraceback */
#ifndef CYTHON_CLINE_IN_TRACEBACK
static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) {
    PyObject *use_cline;
    PyObject *ptype, *pvalue, *ptraceback;
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject **cython_runtime_dict;
#endif
    if (unlikely(!__pyx_cython_runtime)) {
        return c_line;
    }
    __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
#if CYTHON_COMPILING_IN_CPYTHON
    cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
    if (likely(cython_runtime_dict)) {
        __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
            use_cline, *cython_runtime_dict,
            __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
    } else
#endif
    {
      PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
      if (use_cline_obj) {
        use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
        Py_DECREF(use_cline_obj);
      } else {
        PyErr_Clear();
        use_cline = NULL;
      }
    }
    if (!use_cline) {
        c_line = 0;
        (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
    }
    else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
        c_line = 0;
    }
    __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
    return c_line;
}
#endif

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

/* AddTraceback */
#include "compile.h"
#include "frameobject.h"
#include "traceback.h"
#if PY_VERSION_HEX >= 0x030b00a6
  #ifndef Py_BUILD_CORE
    #define Py_BUILD_CORE 1
  #endif
  #include "internal/pycore_frame.h"
#endif
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
            const char *funcname, int c_line,
            int py_line, const char *filename) {
    PyCodeObject *py_code = NULL;
    PyObject *py_funcname = NULL;
    #if PY_MAJOR_VERSION < 3
    PyObject *py_srcfile = NULL;
    py_srcfile = PyString_FromString(filename);
    if (!py_srcfile) goto bad;
    #endif
    if (c_line) {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        if (!py_funcname) goto bad;
        #else
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        if (!py_funcname) goto bad;
        funcname = PyUnicode_AsUTF8(py_funcname);
        if (!funcname) goto bad;
        #endif
    }
    else {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromString(funcname);
        if (!py_funcname) goto bad;
        #endif
    }
    #if PY_MAJOR_VERSION < 3
    py_code = __Pyx_PyCode_New(
        0,
        0,
        0,
        0,
        0,
        __pyx_empty_bytes, /*PyObject *code,*/
        __pyx_empty_tuple, /*PyObject *consts,*/
        __pyx_empty_tuple, /*PyObject *names,*/
        __pyx_empty_tuple, /*PyObject *varnames,*/
        __pyx_empty_tuple, /*PyObject *freevars,*/
        __pyx_empty_tuple, /*PyObject *cellvars,*/
        py_srcfile,   /*PyObject *filename,*/
        py_funcname,  /*PyObject *name,*/
        py_line,
        __pyx_empty_bytes  /*PyObject *lnotab*/
    );
    Py_DECREF(py_srcfile);
    #else
    py_code = PyCode_NewEmpty(filename, funcname, py_line);
    #endif
    Py_XDECREF(py_funcname);  // XDECREF since it's only set on Py3 if cline
    return py_code;
bad:
    Py_XDECREF(py_funcname);
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(py_srcfile);
    #endif
    return NULL;
}
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyFrameObject *py_frame = 0;
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    PyObject *ptype, *pvalue, *ptraceback;
    if (c_line) {
        c_line = __Pyx_CLineForTraceback(tstate, c_line);
    }
    py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
    if (!py_code) {
        __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
        py_code = __Pyx_CreateCodeObjectForTraceback(
            funcname, c_line, py_line, filename);
        if (!py_code) {
            /* If the code object creation fails, then we should clear the
               fetched exception references and propagate the new exception */
            Py_XDECREF(ptype);
            Py_XDECREF(pvalue);
            Py_XDECREF(ptraceback);
            goto bad;
        }
        __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
        __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
    }
    py_frame = PyFrame_New(
        tstate,            /*PyThreadState *tstate,*/
        py_code,           /*PyCodeObject *code,*/
        __pyx_d,    /*PyObject *globals,*/
        0                  /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}

/* CIntFromPyVerify */
#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
    {\
        func_type value = func_value;\
        if (sizeof(target_type) < sizeof(func_type)) {\
            if (unlikely(value != (func_type) (target_type) value)) {\
                func_type zero = 0;\
                if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
                    return (target_type) -1;\
                if (is_unsigned && unlikely(value < zero))\
                    goto raise_neg_overflow;\
                else\
                    goto raise_overflow;\
            }\
        }\
        return (target_type) value;\
    }

/* CIntFromPy */
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const int neg_one = (int) -1, const_zero = (int) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(int) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (int) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (int) 0;
                case  1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
                case 2:
                    if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
                            return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
                            return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
                            return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (int) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(int) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (int) 0;
                case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(int,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                            return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                            return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
                            return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(int) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            int val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (int) -1;
        }
    } else {
        int val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (int) -1;
        val = __Pyx_PyInt_As_int(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to int");
    return (int) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to int");
    return (int) -1;
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const long neg_one = (long) -1, const_zero = (long) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(long) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(long) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(long) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(long),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const int neg_one = (int) -1, const_zero = (int) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(int) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(int) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(int) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(int),
                                     little, !is_unsigned);
    }
}

/* CIntFromPy */
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const long neg_one = (long) -1, const_zero = (long) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(long) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (long) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (long) 0;
                case  1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
                case 2:
                    if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
                            return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
                            return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
                            return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (long) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(long) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (long) 0;
                case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                            return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                            return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                            return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(long) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            long val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (long) -1;
        }
    } else {
        long val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (long) -1;
        val = __Pyx_PyInt_As_long(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to long");
    return (long) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to long");
    return (long) -1;
}

/* FastTypeChecks */
#if CYTHON_COMPILING_IN_CPYTHON
static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
    while (a) {
        a = a->tp_base;
        if (a == b)
            return 1;
    }
    return b == &PyBaseObject_Type;
}
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
    PyObject *mro;
    if (a == b) return 1;
    mro = a->tp_mro;
    if (likely(mro)) {
        Py_ssize_t i, n;
        n = PyTuple_GET_SIZE(mro);
        for (i = 0; i < n; i++) {
            if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
                return 1;
        }
        return 0;
    }
    return __Pyx_InBases(a, b);
}
#if PY_MAJOR_VERSION == 2
static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
    PyObject *exception, *value, *tb;
    int res;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&exception, &value, &tb);
    res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
    if (unlikely(res == -1)) {
        PyErr_WriteUnraisable(err);
        res = 0;
    }
    if (!res) {
        res = PyObject_IsSubclass(err, exc_type2);
        if (unlikely(res == -1)) {
            PyErr_WriteUnraisable(err);
            res = 0;
        }
    }
    __Pyx_ErrRestore(exception, value, tb);
    return res;
}
#else
static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
    int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
    if (!res) {
        res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
    }
    return res;
}
#endif
static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
    Py_ssize_t i, n;
    assert(PyExceptionClass_Check(exc_type));
    n = PyTuple_GET_SIZE(tuple);
#if PY_MAJOR_VERSION >= 3
    for (i=0; i<n; i++) {
        if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
    }
#endif
    for (i=0; i<n; i++) {
        PyObject *t = PyTuple_GET_ITEM(tuple, i);
        #if PY_MAJOR_VERSION < 3
        if (likely(exc_type == t)) return 1;
        #endif
        if (likely(PyExceptionClass_Check(t))) {
            if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
        } else {
        }
    }
    return 0;
}
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
    if (likely(err == exc_type)) return 1;
    if (likely(PyExceptionClass_Check(err))) {
        if (likely(PyExceptionClass_Check(exc_type))) {
            return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
        } else if (likely(PyTuple_Check(exc_type))) {
            return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
        } else {
        }
    }
    return PyErr_GivenExceptionMatches(err, exc_type);
}
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
    assert(PyExceptionClass_Check(exc_type1));
    assert(PyExceptionClass_Check(exc_type2));
    if (likely(err == exc_type1 || err == exc_type2)) return 1;
    if (likely(PyExceptionClass_Check(err))) {
        return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
    }
    return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
}
#endif

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

/* SwapException */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    #if CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = tstate->exc_info;
    tmp_type = exc_info->exc_type;
    tmp_value = exc_info->exc_value;
    tmp_tb = exc_info->exc_traceback;
    exc_info->exc_type = *type;
    exc_info->exc_value = *value;
    exc_info->exc_traceback = *tb;
    #else
    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;
    #endif
    *type = tmp_type;
    *value = tmp_value;
    *tb = tmp_tb;
}
#else
static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
    PyErr_SetExcInfo(*type, *value, *tb);
    *type = tmp_type;
    *value = tmp_value;
    *tb = tmp_tb;
}
#endif

/* CoroutineBase */
#include <structmember.h>
#include <frameobject.h>
#if PY_VERSION_HEX >= 0x030b00a6
  #ifndef Py_BUILD_CORE
    #define Py_BUILD_CORE 1
  #endif
  #include "internal/pycore_frame.h"
#endif
#define __Pyx_Coroutine_Undelegate(gen) Py_CLEAR((gen)->yieldfrom)
static int __Pyx_PyGen__FetchStopIterationValue(CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject **pvalue) {
    PyObject *et, *ev, *tb;
    PyObject *value = NULL;
    __Pyx_ErrFetch(&et, &ev, &tb);
    if (!et) {
        Py_XDECREF(tb);
        Py_XDECREF(ev);
        Py_INCREF(Py_None);
        *pvalue = Py_None;
        return 0;
    }
    if (likely(et == PyExc_StopIteration)) {
        if (!ev) {
            Py_INCREF(Py_None);
            value = Py_None;
        }
#if PY_VERSION_HEX >= 0x030300A0
        else if (Py_TYPE(ev) == (PyTypeObject*)PyExc_StopIteration) {
            value = ((PyStopIterationObject *)ev)->value;
            Py_INCREF(value);
            Py_DECREF(ev);
        }
#endif
        else if (unlikely(PyTuple_Check(ev))) {
            if (PyTuple_GET_SIZE(ev) >= 1) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                value = PyTuple_GET_ITEM(ev, 0);
                Py_INCREF(value);
#else
                value = PySequence_ITEM(ev, 0);
#endif
            } else {
                Py_INCREF(Py_None);
                value = Py_None;
            }
            Py_DECREF(ev);
        }
        else if (!__Pyx_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration)) {
            value = ev;
        }
        if (likely(value)) {
            Py_XDECREF(tb);
            Py_DECREF(et);
            *pvalue = value;
            return 0;
        }
    } else if (!__Pyx_PyErr_GivenExceptionMatches(et, PyExc_StopIteration)) {
        __Pyx_ErrRestore(et, ev, tb);
        return -1;
    }
    PyErr_NormalizeException(&et, &ev, &tb);
    if (unlikely(!PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration))) {
        __Pyx_ErrRestore(et, ev, tb);
        return -1;
    }
    Py_XDECREF(tb);
    Py_DECREF(et);
#if PY_VERSION_HEX >= 0x030300A0
    value = ((PyStopIterationObject *)ev)->value;
    Py_INCREF(value);
    Py_DECREF(ev);
#else
    {
        PyObject* args = __Pyx_PyObject_GetAttrStr(ev, __pyx_n_s_args);
        Py_DECREF(ev);
        if (likely(args)) {
            value = PySequence_GetItem(args, 0);
            Py_DECREF(args);
        }
        if (unlikely(!value)) {
            __Pyx_ErrRestore(NULL, NULL, NULL);
            Py_INCREF(Py_None);
            value = Py_None;
        }
    }
#endif
    *pvalue = value;
    return 0;
}
static CYTHON_INLINE
void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *exc_state) {
    PyObject *t, *v, *tb;
    t = exc_state->exc_type;
    v = exc_state->exc_value;
    tb = exc_state->exc_traceback;
    exc_state->exc_type = NULL;
    exc_state->exc_value = NULL;
    exc_state->exc_traceback = NULL;
    Py_XDECREF(t);
    Py_XDECREF(v);
    Py_XDECREF(tb);
}
#define __Pyx_Coroutine_AlreadyRunningError(gen)  (__Pyx__Coroutine_AlreadyRunningError(gen), (PyObject*)NULL)
static void __Pyx__Coroutine_AlreadyRunningError(CYTHON_UNUSED __pyx_CoroutineObject *gen) {
    const char *msg;
    if ((0)) {
    #ifdef __Pyx_Coroutine_USED
    } else if (__Pyx_Coroutine_Check((PyObject*)gen)) {
        msg = "coroutine already executing";
    #endif
    #ifdef __Pyx_AsyncGen_USED
    } else if (__Pyx_AsyncGen_CheckExact((PyObject*)gen)) {
        msg = "async generator already executing";
    #endif
    } else {
        msg = "generator already executing";
    }
    PyErr_SetString(PyExc_ValueError, msg);
}
#define __Pyx_Coroutine_NotStartedError(gen)  (__Pyx__Coroutine_NotStartedError(gen), (PyObject*)NULL)
static void __Pyx__Coroutine_NotStartedError(CYTHON_UNUSED PyObject *gen) {
    const char *msg;
    if ((0)) {
    #ifdef __Pyx_Coroutine_USED
    } else if (__Pyx_Coroutine_Check(gen)) {
        msg = "can't send non-None value to a just-started coroutine";
    #endif
    #ifdef __Pyx_AsyncGen_USED
    } else if (__Pyx_AsyncGen_CheckExact(gen)) {
        msg = "can't send non-None value to a just-started async generator";
    #endif
    } else {
        msg = "can't send non-None value to a just-started generator";
    }
    PyErr_SetString(PyExc_TypeError, msg);
}
#define __Pyx_Coroutine_AlreadyTerminatedError(gen, value, closing)  (__Pyx__Coroutine_AlreadyTerminatedError(gen, value, closing), (PyObject*)NULL)
static void __Pyx__Coroutine_AlreadyTerminatedError(CYTHON_UNUSED PyObject *gen, PyObject *value, CYTHON_UNUSED int closing) {
    #ifdef __Pyx_Coroutine_USED
    if (!closing && __Pyx_Coroutine_Check(gen)) {
        PyErr_SetString(PyExc_RuntimeError, "cannot reuse already awaited coroutine");
    } else
    #endif
    if (value) {
        #ifdef __Pyx_AsyncGen_USED
        if (__Pyx_AsyncGen_CheckExact(gen))
            PyErr_SetNone(__Pyx_PyExc_StopAsyncIteration);
        else
        #endif
        PyErr_SetNone(PyExc_StopIteration);
    }
}
static
PyObject *__Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value, int closing) {
    __Pyx_PyThreadState_declare
    PyThreadState *tstate;
    __Pyx_ExcInfoStruct *exc_state;
    PyObject *retval;
    assert(!self->is_running);
    if (unlikely(self->resume_label == 0)) {
        if (unlikely(value && value != Py_None)) {
            return __Pyx_Coroutine_NotStartedError((PyObject*)self);
        }
    }
    if (unlikely(self->resume_label == -1)) {
        return __Pyx_Coroutine_AlreadyTerminatedError((PyObject*)self, value, closing);
    }
#if CYTHON_FAST_THREAD_STATE
    __Pyx_PyThreadState_assign
    tstate = __pyx_tstate;
#else
    tstate = __Pyx_PyThreadState_Current;
#endif
    exc_state = &self->gi_exc_state;
    if (exc_state->exc_type) {
        #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON
        #else
        if (exc_state->exc_traceback) {
            PyTracebackObject *tb = (PyTracebackObject *) exc_state->exc_traceback;
            PyFrameObject *f = tb->tb_frame;
            assert(f->f_back == NULL);
            #if PY_VERSION_HEX >= 0x030B00A1
            f->f_back = PyThreadState_GetFrame(tstate);
            #else
            Py_XINCREF(tstate->frame);
            f->f_back = tstate->frame;
            #endif
        }
        #endif
    }
#if CYTHON_USE_EXC_INFO_STACK
    exc_state->previous_item = tstate->exc_info;
    tstate->exc_info = exc_state;
#else
    if (exc_state->exc_type) {
        __Pyx_ExceptionSwap(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
    } else {
        __Pyx_Coroutine_ExceptionClear(exc_state);
        __Pyx_ExceptionSave(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
    }
#endif
    self->is_running = 1;
    retval = self->body((PyObject *) self, tstate, value);
    self->is_running = 0;
#if CYTHON_USE_EXC_INFO_STACK
    exc_state = &self->gi_exc_state;
    tstate->exc_info = exc_state->previous_item;
    exc_state->previous_item = NULL;
    __Pyx_Coroutine_ResetFrameBackpointer(exc_state);
#endif
    return retval;
}
static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state) {
    PyObject *exc_tb = exc_state->exc_traceback;
    if (likely(exc_tb)) {
#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON
#else
        PyTracebackObject *tb = (PyTracebackObject *) exc_tb;
        PyFrameObject *f = tb->tb_frame;
        Py_CLEAR(f->f_back);
#endif
    }
}
static CYTHON_INLINE
PyObject *__Pyx_Coroutine_MethodReturn(CYTHON_UNUSED PyObject* gen, PyObject *retval) {
    if (unlikely(!retval)) {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        if (!__Pyx_PyErr_Occurred()) {
            PyObject *exc = PyExc_StopIteration;
            #ifdef __Pyx_AsyncGen_USED
            if (__Pyx_AsyncGen_CheckExact(gen))
                exc = __Pyx_PyExc_StopAsyncIteration;
            #endif
            __Pyx_PyErr_SetNone(exc);
        }
    }
    return retval;
}
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
static CYTHON_INLINE
PyObject *__Pyx_PyGen_Send(PyGenObject *gen, PyObject *arg) {
#if PY_VERSION_HEX <= 0x030A00A1
    return _PyGen_Send(gen, arg);
#else
    PyObject *result;
    if (PyIter_Send((PyObject*)gen, arg ? arg : Py_None, &result) == PYGEN_RETURN) {
        if (PyAsyncGen_CheckExact(gen)) {
            assert(result == Py_None);
            PyErr_SetNone(PyExc_StopAsyncIteration);
        }
        else if (result == Py_None) {
            PyErr_SetNone(PyExc_StopIteration);
        }
        else {
            _PyGen_SetStopIterationValue(result);
        }
        Py_CLEAR(result);
    }
    return result;
#endif
}
#endif
static CYTHON_INLINE
PyObject *__Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject *gen) {
    PyObject *ret;
    PyObject *val = NULL;
    __Pyx_Coroutine_Undelegate(gen);
    __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, &val);
    ret = __Pyx_Coroutine_SendEx(gen, val, 0);
    Py_XDECREF(val);
    return ret;
}
static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) {
    PyObject *retval;
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
    PyObject *yf = gen->yieldfrom;
    if (unlikely(gen->is_running))
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    if (yf) {
        PyObject *ret;
        gen->is_running = 1;
        #ifdef __Pyx_Generator_USED
        if (__Pyx_Generator_CheckExact(yf)) {
            ret = __Pyx_Coroutine_Send(yf, value);
        } else
        #endif
        #ifdef __Pyx_Coroutine_USED
        if (__Pyx_Coroutine_Check(yf)) {
            ret = __Pyx_Coroutine_Send(yf, value);
        } else
        #endif
        #ifdef __Pyx_AsyncGen_USED
        if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
            ret = __Pyx_async_gen_asend_send(yf, value);
        } else
        #endif
        #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
        if (PyGen_CheckExact(yf)) {
            ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
        } else
        #endif
        #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03050000 && defined(PyCoro_CheckExact) && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
        if (PyCoro_CheckExact(yf)) {
            ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
        } else
        #endif
        {
            if (value == Py_None)
                ret = Py_TYPE(yf)->tp_iternext(yf);
            else
                ret = __Pyx_PyObject_CallMethod1(yf, __pyx_n_s_send, value);
        }
        gen->is_running = 0;
        if (likely(ret)) {
            return ret;
        }
        retval = __Pyx_Coroutine_FinishDelegation(gen);
    } else {
        retval = __Pyx_Coroutine_SendEx(gen, value, 0);
    }
    return __Pyx_Coroutine_MethodReturn(self, retval);
}
static int __Pyx_Coroutine_CloseIter(__pyx_CoroutineObject *gen, PyObject *yf) {
    PyObject *retval = NULL;
    int err = 0;
    #ifdef __Pyx_Generator_USED
    if (__Pyx_Generator_CheckExact(yf)) {
        retval = __Pyx_Coroutine_Close(yf);
        if (!retval)
            return -1;
    } else
    #endif
    #ifdef __Pyx_Coroutine_USED
    if (__Pyx_Coroutine_Check(yf)) {
        retval = __Pyx_Coroutine_Close(yf);
        if (!retval)
            return -1;
    } else
    if (__Pyx_CoroutineAwait_CheckExact(yf)) {
        retval = __Pyx_CoroutineAwait_Close((__pyx_CoroutineAwaitObject*)yf, NULL);
        if (!retval)
            return -1;
    } else
    #endif
    #ifdef __Pyx_AsyncGen_USED
    if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
        retval = __Pyx_async_gen_asend_close(yf, NULL);
    } else
    if (__pyx_PyAsyncGenAThrow_CheckExact(yf)) {
        retval = __Pyx_async_gen_athrow_close(yf, NULL);
    } else
    #endif
    {
        PyObject *meth;
        gen->is_running = 1;
        meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_close);
        if (unlikely(!meth)) {
            if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
                PyErr_WriteUnraisable(yf);
            }
            PyErr_Clear();
        } else {
            retval = PyObject_CallFunction(meth, NULL);
            Py_DECREF(meth);
            if (!retval)
                err = -1;
        }
        gen->is_running = 0;
    }
    Py_XDECREF(retval);
    return err;
}
static PyObject *__Pyx_Generator_Next(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
    PyObject *yf = gen->yieldfrom;
    if (unlikely(gen->is_running))
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    if (yf) {
        PyObject *ret;
        gen->is_running = 1;
        #ifdef __Pyx_Generator_USED
        if (__Pyx_Generator_CheckExact(yf)) {
            ret = __Pyx_Generator_Next(yf);
        } else
        #endif
        #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
        if (PyGen_CheckExact(yf)) {
            ret = __Pyx_PyGen_Send((PyGenObject*)yf, NULL);
        } else
        #endif
        #ifdef __Pyx_Coroutine_USED
        if (__Pyx_Coroutine_Check(yf)) {
            ret = __Pyx_Coroutine_Send(yf, Py_None);
        } else
        #endif
            ret = Py_TYPE(yf)->tp_iternext(yf);
        gen->is_running = 0;
        if (likely(ret)) {
            return ret;
        }
        return __Pyx_Coroutine_FinishDelegation(gen);
    }
    return __Pyx_Coroutine_SendEx(gen, Py_None, 0);
}
static PyObject *__Pyx_Coroutine_Close_Method(PyObject *self, CYTHON_UNUSED PyObject *arg) {
    return __Pyx_Coroutine_Close(self);
}
static PyObject *__Pyx_Coroutine_Close(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    PyObject *retval, *raised_exception;
    PyObject *yf = gen->yieldfrom;
    int err = 0;
    if (unlikely(gen->is_running))
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    if (yf) {
        Py_INCREF(yf);
        err = __Pyx_Coroutine_CloseIter(gen, yf);
        __Pyx_Coroutine_Undelegate(gen);
        Py_DECREF(yf);
    }
    if (err == 0)
        PyErr_SetNone(PyExc_GeneratorExit);
    retval = __Pyx_Coroutine_SendEx(gen, NULL, 1);
    if (unlikely(retval)) {
        const char *msg;
        Py_DECREF(retval);
        if ((0)) {
        #ifdef __Pyx_Coroutine_USED
        } else if (__Pyx_Coroutine_Check(self)) {
            msg = "coroutine ignored GeneratorExit";
        #endif
        #ifdef __Pyx_AsyncGen_USED
        } else if (__Pyx_AsyncGen_CheckExact(self)) {
#if PY_VERSION_HEX < 0x03060000
            msg = "async generator ignored GeneratorExit - might require Python 3.6+ finalisation (PEP 525)";
#else
            msg = "async generator ignored GeneratorExit";
#endif
        #endif
        } else {
            msg = "generator ignored GeneratorExit";
        }
        PyErr_SetString(PyExc_RuntimeError, msg);
        return NULL;
    }
    raised_exception = PyErr_Occurred();
    if (likely(!raised_exception || __Pyx_PyErr_GivenExceptionMatches2(raised_exception, PyExc_GeneratorExit, PyExc_StopIteration))) {
        if (raised_exception) PyErr_Clear();
        Py_INCREF(Py_None);
        return Py_None;
    }
    return NULL;
}
static PyObject *__Pyx__Coroutine_Throw(PyObject *self, PyObject *typ, PyObject *val, PyObject *tb,
                                        PyObject *args, int close_on_genexit) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    PyObject *yf = gen->yieldfrom;
    if (unlikely(gen->is_running))
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    if (yf) {
        PyObject *ret;
        Py_INCREF(yf);
        if (__Pyx_PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit) && close_on_genexit) {
            int err = __Pyx_Coroutine_CloseIter(gen, yf);
            Py_DECREF(yf);
            __Pyx_Coroutine_Undelegate(gen);
            if (err < 0)
                return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0));
            goto throw_here;
        }
        gen->is_running = 1;
        if (0
        #ifdef __Pyx_Generator_USED
            || __Pyx_Generator_CheckExact(yf)
        #endif
        #ifdef __Pyx_Coroutine_USED
            || __Pyx_Coroutine_Check(yf)
        #endif
            ) {
            ret = __Pyx__Coroutine_Throw(yf, typ, val, tb, args, close_on_genexit);
        #ifdef __Pyx_Coroutine_USED
        } else if (__Pyx_CoroutineAwait_CheckExact(yf)) {
            ret = __Pyx__Coroutine_Throw(((__pyx_CoroutineAwaitObject*)yf)->coroutine, typ, val, tb, args, close_on_genexit);
        #endif
        } else {
            PyObject *meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_throw);
            if (unlikely(!meth)) {
                Py_DECREF(yf);
                if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
                    gen->is_running = 0;
                    return NULL;
                }
                PyErr_Clear();
                __Pyx_Coroutine_Undelegate(gen);
                gen->is_running = 0;
                goto throw_here;
            }
            if (likely(args)) {
                ret = PyObject_CallObject(meth, args);
            } else {
                ret = PyObject_CallFunctionObjArgs(meth, typ, val, tb, NULL);
            }
            Py_DECREF(meth);
        }
        gen->is_running = 0;
        Py_DECREF(yf);
        if (!ret) {
            ret = __Pyx_Coroutine_FinishDelegation(gen);
        }
        return __Pyx_Coroutine_MethodReturn(self, ret);
    }
throw_here:
    __Pyx_Raise(typ, val, tb, NULL);
    return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0));
}
static PyObject *__Pyx_Coroutine_Throw(PyObject *self, PyObject *args) {
    PyObject *typ;
    PyObject *val = NULL;
    PyObject *tb = NULL;
    if (!PyArg_UnpackTuple(args, (char *)"throw", 1, 3, &typ, &val, &tb))
        return NULL;
    return __Pyx__Coroutine_Throw(self, typ, val, tb, args, 1);
}
static CYTHON_INLINE int __Pyx_Coroutine_traverse_excstate(__Pyx_ExcInfoStruct *exc_state, visitproc visit, void *arg) {
    Py_VISIT(exc_state->exc_type);
    Py_VISIT(exc_state->exc_value);
    Py_VISIT(exc_state->exc_traceback);
    return 0;
}
static int __Pyx_Coroutine_traverse(__pyx_CoroutineObject *gen, visitproc visit, void *arg) {
    Py_VISIT(gen->closure);
    Py_VISIT(gen->classobj);
    Py_VISIT(gen->yieldfrom);
    return __Pyx_Coroutine_traverse_excstate(&gen->gi_exc_state, visit, arg);
}
static int __Pyx_Coroutine_clear(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    Py_CLEAR(gen->closure);
    Py_CLEAR(gen->classobj);
    Py_CLEAR(gen->yieldfrom);
    __Pyx_Coroutine_ExceptionClear(&gen->gi_exc_state);
#ifdef __Pyx_AsyncGen_USED
    if (__Pyx_AsyncGen_CheckExact(self)) {
        Py_CLEAR(((__pyx_PyAsyncGenObject*)gen)->ag_finalizer);
    }
#endif
    Py_CLEAR(gen->gi_code);
    Py_CLEAR(gen->gi_frame);
    Py_CLEAR(gen->gi_name);
    Py_CLEAR(gen->gi_qualname);
    Py_CLEAR(gen->gi_modulename);
    return 0;
}
static void __Pyx_Coroutine_dealloc(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    PyObject_GC_UnTrack(gen);
    if (gen->gi_weakreflist != NULL)
        PyObject_ClearWeakRefs(self);
    if (gen->resume_label >= 0) {
        PyObject_GC_Track(self);
#if PY_VERSION_HEX >= 0x030400a1 && CYTHON_USE_TP_FINALIZE
        if (PyObject_CallFinalizerFromDealloc(self))
#else
        Py_TYPE(gen)->tp_del(self);
        if (Py_REFCNT(self) > 0)
#endif
        {
            return;
        }
        PyObject_GC_UnTrack(self);
    }
#ifdef __Pyx_AsyncGen_USED
    if (__Pyx_AsyncGen_CheckExact(self)) {
        /* We have to handle this case for asynchronous generators
           right here, because this code has to be between UNTRACK
           and GC_Del. */
        Py_CLEAR(((__pyx_PyAsyncGenObject*)self)->ag_finalizer);
    }
#endif
    __Pyx_Coroutine_clear(self);
    PyObject_GC_Del(gen);
}
static void __Pyx_Coroutine_del(PyObject *self) {
    PyObject *error_type, *error_value, *error_traceback;
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    __Pyx_PyThreadState_declare
    if (gen->resume_label < 0) {
        return;
    }
#if !CYTHON_USE_TP_FINALIZE
    assert(self->ob_refcnt == 0);
    __Pyx_SET_REFCNT(self, 1);
#endif
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&error_type, &error_value, &error_traceback);
#ifdef __Pyx_AsyncGen_USED
    if (__Pyx_AsyncGen_CheckExact(self)) {
        __pyx_PyAsyncGenObject *agen = (__pyx_PyAsyncGenObject*)self;
        PyObject *finalizer = agen->ag_finalizer;
        if (finalizer && !agen->ag_closed) {
            PyObject *res = __Pyx_PyObject_CallOneArg(finalizer, self);
            if (unlikely(!res)) {
                PyErr_WriteUnraisable(self);
            } else {
                Py_DECREF(res);
            }
            __Pyx_ErrRestore(error_type, error_value, error_traceback);
            return;
        }
    }
#endif
    if (unlikely(gen->resume_label == 0 && !error_value)) {
#ifdef __Pyx_Coroutine_USED
#ifdef __Pyx_Generator_USED
    if (!__Pyx_Generator_CheckExact(self))
#endif
        {
        PyObject_GC_UnTrack(self);
#if PY_MAJOR_VERSION >= 3  || defined(PyErr_WarnFormat)
        if (unlikely(PyErr_WarnFormat(PyExc_RuntimeWarning, 1, "coroutine '%.50S' was never awaited", gen->gi_qualname) < 0))
            PyErr_WriteUnraisable(self);
#else
        {PyObject *msg;
        char *cmsg;
        #if CYTHON_COMPILING_IN_PYPY
        msg = NULL;
        cmsg = (char*) "coroutine was never awaited";
        #else
        char *cname;
        PyObject *qualname;
        qualname = gen->gi_qualname;
        cname = PyString_AS_STRING(qualname);
        msg = PyString_FromFormat("coroutine '%.50s' was never awaited", cname);
        if (unlikely(!msg)) {
            PyErr_Clear();
            cmsg = (char*) "coroutine was never awaited";
        } else {
            cmsg = PyString_AS_STRING(msg);
        }
        #endif
        if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, cmsg, 1) < 0))
            PyErr_WriteUnraisable(self);
        Py_XDECREF(msg);}
#endif
        PyObject_GC_Track(self);
        }
#endif
    } else {
        PyObject *res = __Pyx_Coroutine_Close(self);
        if (unlikely(!res)) {
            if (PyErr_Occurred())
                PyErr_WriteUnraisable(self);
        } else {
            Py_DECREF(res);
        }
    }
    __Pyx_ErrRestore(error_type, error_value, error_traceback);
#if !CYTHON_USE_TP_FINALIZE
    assert(Py_REFCNT(self) > 0);
    if (--self->ob_refcnt == 0) {
        return;
    }
    {
        Py_ssize_t refcnt = Py_REFCNT(self);
        _Py_NewReference(self);
        __Pyx_SET_REFCNT(self, refcnt);
    }
#if CYTHON_COMPILING_IN_CPYTHON
    assert(PyType_IS_GC(Py_TYPE(self)) &&
           _Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED);
    _Py_DEC_REFTOTAL;
#endif
#ifdef COUNT_ALLOCS
    --Py_TYPE(self)->tp_frees;
    --Py_TYPE(self)->tp_allocs;
#endif
#endif
}
static PyObject *
__Pyx_Coroutine_get_name(__pyx_CoroutineObject *self, CYTHON_UNUSED void *context)
{
    PyObject *name = self->gi_name;
    if (unlikely(!name)) name = Py_None;
    Py_INCREF(name);
    return name;
}
static int
__Pyx_Coroutine_set_name(__pyx_CoroutineObject *self, PyObject *value, CYTHON_UNUSED void *context)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value)))
#else
    if (unlikely(value == NULL || !PyString_Check(value)))
#endif
    {
        PyErr_SetString(PyExc_TypeError,
                        "__name__ must be set to a string object");
        return -1;
    }
    tmp = self->gi_name;
    Py_INCREF(value);
    self->gi_name = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self, CYTHON_UNUSED void *context)
{
    PyObject *name = self->gi_qualname;
    if (unlikely(!name)) name = Py_None;
    Py_INCREF(name);
    return name;
}
static int
__Pyx_Coroutine_set_qualname(__pyx_CoroutineObject *self, PyObject *value, CYTHON_UNUSED void *context)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value)))
#else
    if (unlikely(value == NULL || !PyString_Check(value)))
#endif
    {
        PyErr_SetString(PyExc_TypeError,
                        "__qualname__ must be set to a string object");
        return -1;
    }
    tmp = self->gi_qualname;
    Py_INCREF(value);
    self->gi_qualname = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_Coroutine_get_frame(__pyx_CoroutineObject *self, CYTHON_UNUSED void *context)
{
    PyObject *frame = self->gi_frame;
    if (!frame) {
        if (unlikely(!self->gi_code)) {
            Py_RETURN_NONE;
        }
        frame = (PyObject *) PyFrame_New(
            PyThreadState_Get(),            /*PyThreadState *tstate,*/
            (PyCodeObject*) self->gi_code,  /*PyCodeObject *code,*/
            __pyx_d,                 /*PyObject *globals,*/
            0                               /*PyObject *locals*/
        );
        if (unlikely(!frame))
            return NULL;
        self->gi_frame = frame;
    }
    Py_INCREF(frame);
    return frame;
}
static __pyx_CoroutineObject *__Pyx__Coroutine_New(
            PyTypeObject* type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
            PyObject *name, PyObject *qualname, PyObject *module_name) {
    __pyx_CoroutineObject *gen = PyObject_GC_New(__pyx_CoroutineObject, type);
    if (unlikely(!gen))
        return NULL;
    return __Pyx__Coroutine_NewInit(gen, body, code, closure, name, qualname, module_name);
}
static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
            __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
            PyObject *name, PyObject *qualname, PyObject *module_name) {
    gen->body = body;
    gen->closure = closure;
    Py_XINCREF(closure);
    gen->is_running = 0;
    gen->resume_label = 0;
    gen->classobj = NULL;
    gen->yieldfrom = NULL;
    gen->gi_exc_state.exc_type = NULL;
    gen->gi_exc_state.exc_value = NULL;
    gen->gi_exc_state.exc_traceback = NULL;
#if CYTHON_USE_EXC_INFO_STACK
    gen->gi_exc_state.previous_item = NULL;
#endif
    gen->gi_weakreflist = NULL;
    Py_XINCREF(qualname);
    gen->gi_qualname = qualname;
    Py_XINCREF(name);
    gen->gi_name = name;
    Py_XINCREF(module_name);
    gen->gi_modulename = module_name;
    Py_XINCREF(code);
    gen->gi_code = code;
    gen->gi_frame = NULL;
    PyObject_GC_Track(gen);
    return gen;
}

/* PatchModuleWithCoroutine */
static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code) {
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
    int result;
    PyObject *globals, *result_obj;
    globals = PyDict_New();  if (unlikely(!globals)) goto ignore;
    result = PyDict_SetItemString(globals, "_cython_coroutine_type",
    #ifdef __Pyx_Coroutine_USED
        (PyObject*)__pyx_CoroutineType);
    #else
        Py_None);
    #endif
    if (unlikely(result < 0)) goto ignore;
    result = PyDict_SetItemString(globals, "_cython_generator_type",
    #ifdef __Pyx_Generator_USED
        (PyObject*)__pyx_GeneratorType);
    #else
        Py_None);
    #endif
    if (unlikely(result < 0)) goto ignore;
    if (unlikely(PyDict_SetItemString(globals, "_module", module) < 0)) goto ignore;
    if (unlikely(PyDict_SetItemString(globals, "__builtins__", __pyx_b) < 0)) goto ignore;
    result_obj = PyRun_String(py_code, Py_file_input, globals, globals);
    if (unlikely(!result_obj)) goto ignore;
    Py_DECREF(result_obj);
    Py_DECREF(globals);
    return module;
ignore:
    Py_XDECREF(globals);
    PyErr_WriteUnraisable(module);
    if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, "Cython module failed to patch module with custom type", 1) < 0)) {
        Py_DECREF(module);
        module = NULL;
    }
#else
    py_code++;
#endif
    return module;
}

/* PatchGeneratorABC */
#ifndef CYTHON_REGISTER_ABCS
#define CYTHON_REGISTER_ABCS 1
#endif
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
static PyObject* __Pyx_patch_abc_module(PyObject *module);
static PyObject* __Pyx_patch_abc_module(PyObject *module) {
    module = __Pyx_Coroutine_patch_module(
        module, ""
"if _cython_generator_type is not None:\n"
"    try: Generator = _module.Generator\n"
"    except AttributeError: pass\n"
"    else: Generator.register(_cython_generator_type)\n"
"if _cython_coroutine_type is not None:\n"
"    try: Coroutine = _module.Coroutine\n"
"    except AttributeError: pass\n"
"    else: Coroutine.register(_cython_coroutine_type)\n"
    );
    return module;
}
#endif
static int __Pyx_patch_abc(void) {
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
    static int abc_patched = 0;
    if (CYTHON_REGISTER_ABCS && !abc_patched) {
        PyObject *module;
        module = PyImport_ImportModule((PY_MAJOR_VERSION >= 3) ? "collections.abc" : "collections");
        if (!module) {
            PyErr_WriteUnraisable(NULL);
            if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning,
                    ((PY_MAJOR_VERSION >= 3) ?
                        "Cython module failed to register with collections.abc module" :
                        "Cython module failed to register with collections module"), 1) < 0)) {
                return -1;
            }
        } else {
            module = __Pyx_patch_abc_module(module);
            abc_patched = 1;
            if (unlikely(!module))
                return -1;
            Py_DECREF(module);
        }
        module = PyImport_ImportModule("backports_abc");
        if (module) {
            module = __Pyx_patch_abc_module(module);
            Py_XDECREF(module);
        }
        if (!module) {
            PyErr_Clear();
        }
    }
#else
    if ((0)) __Pyx_Coroutine_patch_module(NULL, NULL);
#endif
    return 0;
}

/* Generator */
static PyMethodDef __pyx_Generator_methods[] = {
    {"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O,
     (char*) PyDoc_STR("send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration.")},
    {"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS,
     (char*) PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in generator,\nreturn next yielded value or raise StopIteration.")},
    {"close", (PyCFunction) __Pyx_Coroutine_Close_Method, METH_NOARGS,
     (char*) PyDoc_STR("close() -> raise GeneratorExit inside generator.")},
    {0, 0, 0, 0}
};
static PyMemberDef __pyx_Generator_memberlist[] = {
    {(char *) "gi_running", T_BOOL, offsetof(__pyx_CoroutineObject, is_running), READONLY, NULL},
    {(char*) "gi_yieldfrom", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY,
     (char*) PyDoc_STR("object being iterated by 'yield from', or None")},
    {(char*) "gi_code", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_code), READONLY, NULL},
    {0, 0, 0, 0, 0}
};
static PyGetSetDef __pyx_Generator_getsets[] = {
    {(char *) "__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name,
     (char*) PyDoc_STR("name of the generator"), 0},
    {(char *) "__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname,
     (char*) PyDoc_STR("qualified name of the generator"), 0},
    {(char *) "gi_frame", (getter)__Pyx_Coroutine_get_frame, NULL,
     (char*) PyDoc_STR("Frame of the generator"), 0},
    {0, 0, 0, 0, 0}
};
static PyTypeObject __pyx_GeneratorType_type = {
    PyVarObject_HEAD_INIT(0, 0)
    "generator",
    sizeof(__pyx_CoroutineObject),
    0,
    (destructor) __Pyx_Coroutine_dealloc,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE,
    0,
    (traverseproc) __Pyx_Coroutine_traverse,
    0,
    0,
    offsetof(__pyx_CoroutineObject, gi_weakreflist),
    0,
    (iternextfunc) __Pyx_Generator_Next,
    __pyx_Generator_methods,
    __pyx_Generator_memberlist,
    __pyx_Generator_getsets,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
#if CYTHON_USE_TP_FINALIZE
    0,
#else
    __Pyx_Coroutine_del,
#endif
    0,
#if CYTHON_USE_TP_FINALIZE
    __Pyx_Coroutine_del,
#elif PY_VERSION_HEX >= 0x030400a1
    0,
#endif
#if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
    0,
#endif
#if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
    0,
#endif
#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
    0,
#endif
};
static int __pyx_Generator_init(void) {
    __pyx_GeneratorType_type.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
    __pyx_GeneratorType_type.tp_iter = PyObject_SelfIter;
    __pyx_GeneratorType = __Pyx_FetchCommonType(&__pyx_GeneratorType_type);
    if (unlikely(!__pyx_GeneratorType)) {
        return -1;
    }
    return 0;
}

/* CheckBinaryVersion */
static int __Pyx_check_binary_version(void) {
    char ctversion[5];
    int same=1, i, found_dot;
    const char* rt_from_call = Py_GetVersion();
    PyOS_snprintf(ctversion, 5, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
    found_dot = 0;
    for (i = 0; i < 4; i++) {
        if (!ctversion[i]) {
            same = (rt_from_call[i] < '0' || rt_from_call[i] > '9');
            break;
        }
        if (rt_from_call[i] != ctversion[i]) {
            same = 0;
            break;
        }
    }
    if (!same) {
        char rtversion[5] = {'\0'};
        char message[200];
        for (i=0; i<4; ++i) {
            if (rt_from_call[i] == '.') {
                if (found_dot) break;
                found_dot = 1;
            } else if (rt_from_call[i] < '0' || rt_from_call[i] > '9') {
                break;
            }
            rtversion[i] = rt_from_call[i];
        }
        PyOS_snprintf(message, sizeof(message),
                      "compiletime version %s of module '%.100s' "
                      "does not match runtime version %s",
                      ctversion, __Pyx_MODULE_NAME, rtversion);
        return PyErr_WarnEx(NULL, message, 1);
    }
    return 0;
}

/* FunctionExport */
static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig) {
    PyObject *d = 0;
    PyObject *cobj = 0;
    union {
        void (*fp)(void);
        void *p;
    } tmp;
    d = PyObject_GetAttrString(__pyx_m, (char *)"__pyx_capi__");
    if (!d) {
        PyErr_Clear();
        d = PyDict_New();
        if (!d)
            goto bad;
        Py_INCREF(d);
        if (PyModule_AddObject(__pyx_m, (char *)"__pyx_capi__", d) < 0)
            goto bad;
    }
    tmp.fp = f;
#if PY_VERSION_HEX >= 0x02070000
    cobj = PyCapsule_New(tmp.p, sig, 0);
#else
    cobj = PyCObject_FromVoidPtrAndDesc(tmp.p, (void *)sig, 0);
#endif
    if (!cobj)
        goto bad;
    if (PyDict_SetItemString(d, name, cobj) < 0)
        goto bad;
    Py_DECREF(cobj);
    Py_DECREF(d);
    return 0;
bad:
    Py_XDECREF(cobj);
    Py_XDECREF(d);
    return -1;
}

/* FunctionImport */
#ifndef __PYX_HAVE_RT_ImportFunction
#define __PYX_HAVE_RT_ImportFunction
static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig) {
    PyObject *d = 0;
    PyObject *cobj = 0;
    union {
        void (*fp)(void);
        void *p;
    } tmp;
    d = PyObject_GetAttrString(module, (char *)"__pyx_capi__");
    if (!d)
        goto bad;
    cobj = PyDict_GetItemString(d, funcname);
    if (!cobj) {
        PyErr_Format(PyExc_ImportError,
            "%.200s does not export expected C function %.200s",
                PyModule_GetName(module), funcname);
        goto bad;
    }
#if PY_VERSION_HEX >= 0x02070000
    if (!PyCapsule_IsValid(cobj, sig)) {
        PyErr_Format(PyExc_TypeError,
            "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
             PyModule_GetName(module), funcname, sig, PyCapsule_GetName(cobj));
        goto bad;
    }
    tmp.p = PyCapsule_GetPointer(cobj, sig);
#else
    {const char *desc, *s1, *s2;
    desc = (const char *)PyCObject_GetDesc(cobj);
    if (!desc)
        goto bad;
    s1 = desc; s2 = sig;
    while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; }
    if (*s1 != *s2) {
        PyErr_Format(PyExc_TypeError,
            "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
             PyModule_GetName(module), funcname, sig, desc);
        goto bad;
    }
    tmp.p = PyCObject_AsVoidPtr(cobj);}
#endif
    *f = tmp.fp;
    if (!(*f))
        goto bad;
    Py_DECREF(d);
    return 0;
bad:
    Py_XDECREF(d);
    return -1;
}
#endif

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

static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
    return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
}
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
    Py_ssize_t ignore;
    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
}
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
#if !CYTHON_PEP393_ENABLED
static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
    char* defenc_c;
    PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
    if (!defenc) return NULL;
    defenc_c = PyBytes_AS_STRING(defenc);
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
    {
        char* end = defenc_c + PyBytes_GET_SIZE(defenc);
        char* c;
        for (c = defenc_c; c < end; c++) {
            if ((unsigned char) (*c) >= 128) {
                PyUnicode_AsASCIIString(o);
                return NULL;
            }
        }
    }
#endif
    *length = PyBytes_GET_SIZE(defenc);
    return defenc_c;
}
#else
static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
    if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
    if (likely(PyUnicode_IS_ASCII(o))) {
        *length = PyUnicode_GET_LENGTH(o);
        return PyUnicode_AsUTF8(o);
    } else {
        PyUnicode_AsASCIIString(o);
        return NULL;
    }
#else
    return PyUnicode_AsUTF8AndSize(o, length);
#endif
}
#endif
#endif
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
    if (
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
            __Pyx_sys_getdefaultencoding_not_ascii &&
#endif
            PyUnicode_Check(o)) {
        return __Pyx_PyUnicode_AsStringAndSize(o, length);
    } else
#endif
#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
    if (PyByteArray_Check(o)) {
        *length = PyByteArray_GET_SIZE(o);
        return PyByteArray_AS_STRING(o);
    } else
#endif
    {
        char* result;
        int r = PyBytes_AsStringAndSize(o, &result, length);
        if (unlikely(r < 0)) {
            return NULL;
        } else {
            return result;
        }
    }
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
   int is_true = x == Py_True;
   if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
   else return PyObject_IsTrue(x);
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
    int retval;
    if (unlikely(!x)) return -1;
    retval = __Pyx_PyObject_IsTrue(x);
    Py_DECREF(x);
    return retval;
}
static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
#if PY_MAJOR_VERSION >= 3
    if (PyLong_Check(result)) {
        if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
                "__int__ returned non-int (type %.200s).  "
                "The ability to return an instance of a strict subclass of int "
                "is deprecated, and may be removed in a future version of Python.",
                Py_TYPE(result)->tp_name)) {
            Py_DECREF(result);
            return NULL;
        }
        return result;
    }
#endif
    PyErr_Format(PyExc_TypeError,
                 "__%.4s__ returned non-%.4s (type %.200s)",
                 type_name, type_name, Py_TYPE(result)->tp_name);
    Py_DECREF(result);
    return NULL;
}
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
#if CYTHON_USE_TYPE_SLOTS
  PyNumberMethods *m;
#endif
  const char *name = NULL;
  PyObject *res = NULL;
#if PY_MAJOR_VERSION < 3
  if (likely(PyInt_Check(x) || PyLong_Check(x)))
#else
  if (likely(PyLong_Check(x)))
#endif
    return __Pyx_NewRef(x);
#if CYTHON_USE_TYPE_SLOTS
  m = Py_TYPE(x)->tp_as_number;
  #if PY_MAJOR_VERSION < 3
  if (m && m->nb_int) {
    name = "int";
    res = m->nb_int(x);
  }
  else if (m && m->nb_long) {
    name = "long";
    res = m->nb_long(x);
  }
  #else
  if (likely(m && m->nb_int)) {
    name = "int";
    res = m->nb_int(x);
  }
  #endif
#else
  if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
    res = PyNumber_Int(x);
  }
#endif
  if (likely(res)) {
#if PY_MAJOR_VERSION < 3
    if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
#else
    if (unlikely(!PyLong_CheckExact(res))) {
#endif
        return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
    }
  }
  else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_TypeError,
                    "an integer is required");
  }
  return res;
}
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  Py_ssize_t ival;
  PyObject *x;
#if PY_MAJOR_VERSION < 3
  if (likely(PyInt_CheckExact(b))) {
    if (sizeof(Py_ssize_t) >= sizeof(long))
        return PyInt_AS_LONG(b);
    else
        return PyInt_AsSsize_t(b);
  }
#endif
  if (likely(PyLong_CheckExact(b))) {
    #if CYTHON_USE_PYLONG_INTERNALS
    const digit* digits = ((PyLongObject*)b)->ob_digit;
    const Py_ssize_t size = Py_SIZE(b);
    if (likely(__Pyx_sst_abs(size) <= 1)) {
        ival = likely(size) ? digits[0] : 0;
        if (size == -1) ival = -ival;
        return ival;
    } else {
      switch (size) {
         case 2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case 3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case 4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
      }
    }
    #endif
    return PyLong_AsSsize_t(b);
  }
  x = PyNumber_Index(b);
  if (!x) return -1;
  ival = PyInt_AsSsize_t(x);
  Py_DECREF(x);
  return ival;
}
static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) {
  if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) {
    return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o);
#if PY_MAJOR_VERSION < 3
  } else if (likely(PyInt_CheckExact(o))) {
    return PyInt_AS_LONG(o);
#endif
  } else {
    Py_ssize_t ival;
    PyObject *x;
    x = PyNumber_Index(o);
    if (!x) return -1;
    ival = PyInt_AsLong(x);
    Py_DECREF(x);
    return ival;
  }
}
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
  return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
}
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
    return PyInt_FromSize_t(ival);
}


#endif /* Py_PYTHON_H */
