/* Generated by Cython 0.29.2 */

/* BEGIN: Cython Metadata
{
    "distutils": {
        "depends": [
            "/home/aliman/pyenv/pysamstats-dev/lib/python3.7/site-packages/pysam/htslib_util.h",
            "/home/aliman/pyenv/pysamstats-dev/lib/python3.7/site-packages/pysam/include/htslib/htslib/bgzf.h",
            "/home/aliman/pyenv/pysamstats-dev/lib/python3.7/site-packages/pysam/include/htslib/htslib/cram.h",
            "/home/aliman/pyenv/pysamstats-dev/lib/python3.7/site-packages/pysam/include/htslib/htslib/faidx.h",
            "/home/aliman/pyenv/pysamstats-dev/lib/python3.7/site-packages/pysam/include/htslib/htslib/hfile.h",
            "/home/aliman/pyenv/pysamstats-dev/lib/python3.7/site-packages/pysam/include/htslib/htslib/hts.h",
            "/home/aliman/pyenv/pysamstats-dev/lib/python3.7/site-packages/pysam/include/htslib/htslib/kstring.h",
            "/home/aliman/pyenv/pysamstats-dev/lib/python3.7/site-packages/pysam/include/htslib/htslib/sam.h",
            "/home/aliman/pyenv/pysamstats-dev/lib/python3.7/site-packages/pysam/include/htslib/htslib/tbx.h",
            "/home/aliman/pyenv/pysamstats-dev/lib/python3.7/site-packages/pysam/include/htslib/htslib/vcf.h",
            "/home/aliman/pyenv/pysamstats-dev/lib/python3.7/site-packages/pysam/include/htslib/htslib/vcfutils.h",
            "/home/aliman/pyenv/pysamstats-dev/lib/python3.7/site-packages/pysam/pysam_stream.h"
        ],
        "include_dirs": [
            "/home/aliman/pyenv/pysamstats-dev/lib/python3.7/site-packages/pysam",
            "/home/aliman/pyenv/pysamstats-dev/lib/python3.7/site-packages/pysam/include/htslib",
            "/home/aliman/pyenv/pysamstats-dev/lib/python3.7/site-packages/pysam/include/samtools"
        ],
        "name": "pysamstats.opt",
        "sources": [
            "pysamstats/opt.pyx"
        ]
    },
    "module_name": "pysamstats.opt"
}
END: Cython Metadata */

#define 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_2"
#define CYTHON_HEX_VERSION 0x001D02F0
#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
  #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
#elif defined(PYSTON_VERSION)
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_PYSTON 1
  #define CYTHON_COMPILING_IN_CPYTHON 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
#else
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_PYSTON 0
  #define CYTHON_COMPILING_IN_CPYTHON 1
  #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
    #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
  #ifndef CYTHON_FAST_THREAD_STATE
    #define CYTHON_FAST_THREAD_STATE 1
  #endif
  #ifndef CYTHON_FAST_PYCALL
    #define CYTHON_FAST_PYCALL 1
  #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
  #ifndef CYTHON_USE_EXC_INFO_STACK
    #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
  #endif
#endif
#if !defined(CYTHON_FAST_PYCCALL)
#define CYTHON_FAST_PYCCALL  (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
#endif
#if CYTHON_USE_PYLONG_INTERNALS
  #include "longintrepr.h"
  #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_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  #define __Pyx_DefaultClassType PyType_Type
#endif
#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_USE_DICT_VERSIONS
#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);\
        }\
    }
#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
#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; // PyThread_create_key reports success always
}
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 // TSS (Thread Specific Storage) API
#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
  #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
                                              0 : _PyUnicode_Ready((PyObject *)(op)))
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
  #define __Pyx_PyUnicode_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)
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
#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
  #define PyObject_Unicode             PyObject_Str
#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 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   PyInt_AsLong
#else
  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
  #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
#endif
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : (Py_INCREF(func), 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(MS_WINDOWS)
  #define _USE_MATH_DEFINES
#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_ERR(f_index, lineno, Ln_error) \
{ \
  __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; 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__pysamstats__opt
#define __PYX_HAVE_API__pysamstats__opt
/* Early includes */
#include <stdint.h>
#include <math.h>
#include <string.h>
#include <stdio.h>
#include "pythread.h"
#include <stdlib.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_DEFAULT 0
#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);
#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[] = {
  "pysamstats/opt.pyx",
  "stringsource",
  "array.pxd",
  "type.pxd",
  "bool.pxd",
  "complex.pxd",
  "libchtslib.pxd",
  "libcfaidx.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_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_PileupColumn;
struct __pyx_obj_5pysam_17libcalignmentfile_PileupRead;
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_IndexedReads;
struct __pyx_obj_10pysamstats_3opt_PileupStat;
struct __pyx_obj_10pysamstats_3opt_CountPp;
struct __pyx_obj_10pysamstats_3opt_Coverage;
struct __pyx_obj_10pysamstats_3opt_CountPpStrand;
struct __pyx_obj_10pysamstats_3opt_CoverageStrand;
struct __pyx_obj_10pysamstats_3opt_CoverageExt;
struct __pyx_obj_10pysamstats_3opt_CountStrand;
struct __pyx_obj_10pysamstats_3opt_CoverageExtStrand;
struct __pyx_obj_10pysamstats_3opt_Variation;
struct __pyx_obj_10pysamstats_3opt_VariationStrand;
struct __pyx_obj_10pysamstats_3opt_TlenHelper;
struct __pyx_obj_10pysamstats_3opt_Tlen;
struct __pyx_obj_10pysamstats_3opt_TlenStrand;
struct __pyx_obj_10pysamstats_3opt_MapqHelper;
struct __pyx_obj_10pysamstats_3opt_Mapq;
struct __pyx_obj_10pysamstats_3opt_MapqStrand;
struct __pyx_obj_10pysamstats_3opt_BaseqHelper;
struct __pyx_obj_10pysamstats_3opt_BaseqPpHelper;
struct __pyx_obj_10pysamstats_3opt_Baseq;
struct __pyx_obj_10pysamstats_3opt_BaseqStrandPpHelper;
struct __pyx_obj_10pysamstats_3opt_BaseqStrand;
struct __pyx_obj_10pysamstats_3opt_BaseqExt;
struct __pyx_obj_10pysamstats_3opt_BaseqExtStrand;
struct __pyx_obj_10pysamstats_3opt_CoverageGC;
struct __pyx_obj_10pysamstats_3opt_BinnedStat;
struct __pyx_obj_10pysamstats_3opt_CoverageBinned;
struct __pyx_obj_10pysamstats_3opt_CoverageExtBinned;
struct __pyx_obj_10pysamstats_3opt_MapqBinned;
struct __pyx_obj_10pysamstats_3opt_AlignmentBinned;
struct __pyx_obj_10pysamstats_3opt_TlenBinned;
struct __pyx_obj_10pysamstats_3opt___pyx_scope_struct__iter_pileup_default;
struct __pyx_obj_10pysamstats_3opt___pyx_scope_struct_1_iter_pileup_padded_chrom;
struct __pyx_obj_10pysamstats_3opt___pyx_scope_struct_2_iter_binned_chrom;
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=?)             # <<<<<<<<<<<<<<
 * 
 *     # add an alignment tag with value to the AlignedSegment
 */
struct __pyx_opt_args_5pysam_18libcalignedsegment_14AlignedSegment_set_tag {
  int __pyx_n;
  PyObject *value_type;
  PyObject *replace;
};

/* "pysam/libcalignedsegment.pxd":54
 *     # add an alignment tag with value to the AlignedSegment
 *     # an existing tag of the same name will be replaced.
 *     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":63
 * 
 *     # 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":138
 *     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":2590
 * 
 * 
 * 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/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":66
 * 
 * 
 * cdef class PileupColumn:             # <<<<<<<<<<<<<<
 *     cdef bam_pileup1_t ** plp
 *     cdef int tid
 */
struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn {
  PyObject_HEAD
  bam_pileup1_t **plp;
  int tid;
  int pos;
  int n_pu;
  struct __pyx_obj_5pysam_17libcalignmentfile_AlignmentHeader *header;
  uint32_t min_base_quality;
  uint8_t *buf;
  char *reference_sequence;
};


/* "pysam/libcalignedsegment.pxd":76
 *     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 PileupColumn:             # <<<<<<<<<<<<<<
 *     cdef bam_pileup1_t ** plp
 *     cdef int tid
 */
struct __pyx_obj_5pysam_17libcalignmentfile_PileupColumn {
  PyObject_HEAD
  bam_pileup1_t **plp;
  int tid;
  int pos;
  int n_pu;
};


/* "pysam/libcalignmentfile.pxd":68
 * 
 * 
 * cdef class PileupRead:             # <<<<<<<<<<<<<<
 *     cdef AlignedSegment _alignment
 *     cdef int32_t  _qpos
 */
struct __pyx_obj_5pysam_17libcalignmentfile_PileupRead {
  PyObject_HEAD
  struct __pyx_obj_5pysam_18libcalignedsegment_AlignedSegment *_alignment;
  int32_t _qpos;
  int _indel;
  int _level;
  uint32_t _is_del;
  uint32_t _is_head;
  uint32_t _is_tail;
  uint32_t _is_refskip;
};


/* "pysam/libcalignmentfile.pxd":79
 * 
 * 
 * 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":89
 * 
 * 
 * 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":95
 * 
 * 
 * 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":102
 * 
 * 
 * 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":107
 * 
 * 
 * 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":112
 * 
 * 
 * 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":119
 * 
 * 
 * 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 *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":150
 * 
 * 
 * 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":156
 * 
 * 
 * cdef class IteratorColumnAllRefs(IteratorColumn):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_5pysam_17libcalignmentfile_IteratorColumnAllRefs {
  struct __pyx_obj_5pysam_17libcalignmentfile_IteratorColumn __pyx_base;
};


/* "pysam/libcalignmentfile.pxd":160
 * 
 * 
 * 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;
};


/* "pysamstats/opt.pyx":75
 * 
 * 
 * cdef class PileupStat(object):             # <<<<<<<<<<<<<<
 * 
 *     cdef dict rec(self, chrom, pos, FastaFile fafile, bytes refbase):
 */
struct __pyx_obj_10pysamstats_3opt_PileupStat {
  PyObject_HEAD
  struct __pyx_vtabstruct_10pysamstats_3opt_PileupStat *__pyx_vtab;
};


/* "pysamstats/opt.pyx":90
 * 
 * # noinspection PyAttributeOutsideInit
 * cdef class CountPp:             # <<<<<<<<<<<<<<
 *     cdef:
 *         int all, pp
 */
struct __pyx_obj_10pysamstats_3opt_CountPp {
  PyObject_HEAD
  struct __pyx_vtabstruct_10pysamstats_3opt_CountPp *__pyx_vtab;
  int all;
  int pp;
};


/* "pysamstats/opt.pyx":107
 * 
 * # noinspection PyAttributeOutsideInit
 * cdef class Coverage(PileupStat):             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
struct __pyx_obj_10pysamstats_3opt_Coverage {
  struct __pyx_obj_10pysamstats_3opt_PileupStat __pyx_base;
  struct __pyx_obj_10pysamstats_3opt_CountPp *reads;
};


/* "pysamstats/opt.pyx":147
 * 
 * # noinspection PyAttributeOutsideInit
 * cdef class CountPpStrand:             # <<<<<<<<<<<<<<
 *     cdef:
 *         int all, pp, fwd, rev, pp_fwd, pp_rev
 */
struct __pyx_obj_10pysamstats_3opt_CountPpStrand {
  PyObject_HEAD
  struct __pyx_vtabstruct_10pysamstats_3opt_CountPpStrand *__pyx_vtab;
  int all;
  int pp;
  int fwd;
  int rev;
  int pp_fwd;
  int pp_rev;
};


/* "pysamstats/opt.pyx":172
 * 
 * # noinspection PyAttributeOutsideInit
 * cdef class CoverageStrand(PileupStat):             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
struct __pyx_obj_10pysamstats_3opt_CoverageStrand {
  struct __pyx_obj_10pysamstats_3opt_PileupStat __pyx_base;
  struct __pyx_obj_10pysamstats_3opt_CountPpStrand *reads;
};


/* "pysamstats/opt.pyx":220
 * 
 * # noinspection PyAttributeOutsideInit
 * cdef class CoverageExt(PileupStat):             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
struct __pyx_obj_10pysamstats_3opt_CoverageExt {
  struct __pyx_obj_10pysamstats_3opt_PileupStat __pyx_base;
  int reads_all;
  int reads_pp;
  int reads_mate_unmapped;
  int reads_mate_other_chr;
  int reads_mate_same_strand;
  int reads_faceaway;
  int reads_softclipped;
  int reads_duplicate;
};


/* "pysamstats/opt.pyx":305
 * 
 * # noinspection PyAttributeOutsideInit
 * cdef class CountStrand:             # <<<<<<<<<<<<<<
 *     cdef:
 *         int all, fwd, rev
 */
struct __pyx_obj_10pysamstats_3opt_CountStrand {
  PyObject_HEAD
  struct __pyx_vtabstruct_10pysamstats_3opt_CountStrand *__pyx_vtab;
  int all;
  int fwd;
  int rev;
};


/* "pysamstats/opt.pyx":324
 * 
 * # noinspection PyAttributeOutsideInit
 * cdef class CoverageExtStrand(PileupStat):             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
struct __pyx_obj_10pysamstats_3opt_CoverageExtStrand {
  struct __pyx_obj_10pysamstats_3opt_PileupStat __pyx_base;
  struct __pyx_obj_10pysamstats_3opt_CountStrand *all;
  struct __pyx_obj_10pysamstats_3opt_CountStrand *pp;
  struct __pyx_obj_10pysamstats_3opt_CountStrand *mate_unmapped;
  struct __pyx_obj_10pysamstats_3opt_CountStrand *mate_other_chr;
  struct __pyx_obj_10pysamstats_3opt_CountStrand *same_strand;
  struct __pyx_obj_10pysamstats_3opt_CountStrand *faceaway;
  struct __pyx_obj_10pysamstats_3opt_CountStrand *softclipped;
  struct __pyx_obj_10pysamstats_3opt_CountStrand *duplicate;
};


/* "pysamstats/opt.pyx":435
 * 
 * # noinspection PyAttributeOutsideInit
 * cdef class Variation(PileupStat):             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
struct __pyx_obj_10pysamstats_3opt_Variation {
  struct __pyx_obj_10pysamstats_3opt_PileupStat __pyx_base;
  struct __pyx_obj_10pysamstats_3opt_CountPp *reads;
  struct __pyx_obj_10pysamstats_3opt_CountPp *matches;
  struct __pyx_obj_10pysamstats_3opt_CountPp *mismatches;
  struct __pyx_obj_10pysamstats_3opt_CountPp *deletions;
  struct __pyx_obj_10pysamstats_3opt_CountPp *insertions;
  struct __pyx_obj_10pysamstats_3opt_CountPp *A;
  struct __pyx_obj_10pysamstats_3opt_CountPp *C;
  struct __pyx_obj_10pysamstats_3opt_CountPp *T;
  struct __pyx_obj_10pysamstats_3opt_CountPp *G;
  struct __pyx_obj_10pysamstats_3opt_CountPp *N;
};


/* "pysamstats/opt.pyx":544
 * 
 * # noinspection PyAttributeOutsideInit
 * cdef class VariationStrand(PileupStat):             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
struct __pyx_obj_10pysamstats_3opt_VariationStrand {
  struct __pyx_obj_10pysamstats_3opt_PileupStat __pyx_base;
  struct __pyx_obj_10pysamstats_3opt_CountPpStrand *reads;
  struct __pyx_obj_10pysamstats_3opt_CountPpStrand *matches;
  struct __pyx_obj_10pysamstats_3opt_CountPpStrand *mismatches;
  struct __pyx_obj_10pysamstats_3opt_CountPpStrand *deletions;
  struct __pyx_obj_10pysamstats_3opt_CountPpStrand *insertions;
  struct __pyx_obj_10pysamstats_3opt_CountPpStrand *A;
  struct __pyx_obj_10pysamstats_3opt_CountPpStrand *C;
  struct __pyx_obj_10pysamstats_3opt_CountPpStrand *T;
  struct __pyx_obj_10pysamstats_3opt_CountPpStrand *G;
  struct __pyx_obj_10pysamstats_3opt_CountPpStrand *N;
};


/* "pysamstats/opt.pyx":679
 * 
 * # noinspection PyAttributeOutsideInit
 * cdef class TlenHelper:             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
struct __pyx_obj_10pysamstats_3opt_TlenHelper {
  PyObject_HEAD
  struct __pyx_vtabstruct_10pysamstats_3opt_TlenHelper *__pyx_vtab;
  long n;
  double m;
  double m2;
  double d;
  double d2;
  int64_t s;
  int64_t sq;
};


/* "pysamstats/opt.pyx":731
 * 
 * # noinspection PyAttributeOutsideInit
 * cdef class Tlen(PileupStat):             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
struct __pyx_obj_10pysamstats_3opt_Tlen {
  struct __pyx_obj_10pysamstats_3opt_PileupStat __pyx_base;
  int reads_all;
  struct __pyx_obj_10pysamstats_3opt_TlenHelper *tlen;
  struct __pyx_obj_10pysamstats_3opt_TlenHelper *tlen_pp;
};


/* "pysamstats/opt.pyx":796
 * 
 * # noinspection PyAttributeOutsideInit
 * cdef class TlenStrand(PileupStat):             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
struct __pyx_obj_10pysamstats_3opt_TlenStrand {
  struct __pyx_obj_10pysamstats_3opt_PileupStat __pyx_base;
  int reads_all;
  int reads_fwd;
  int reads_rev;
  struct __pyx_obj_10pysamstats_3opt_TlenHelper *tlen;
  struct __pyx_obj_10pysamstats_3opt_TlenHelper *tlen_fwd;
  struct __pyx_obj_10pysamstats_3opt_TlenHelper *tlen_rev;
  struct __pyx_obj_10pysamstats_3opt_TlenHelper *tlen_pp;
  struct __pyx_obj_10pysamstats_3opt_TlenHelper *tlen_pp_fwd;
  struct __pyx_obj_10pysamstats_3opt_TlenHelper *tlen_pp_rev;
};


/* "pysamstats/opt.pyx":912
 * 
 * # noinspection PyAttributeOutsideInit
 * cdef class MapqHelper:             # <<<<<<<<<<<<<<
 *     cdef:
 *         int n
 */
struct __pyx_obj_10pysamstats_3opt_MapqHelper {
  PyObject_HEAD
  struct __pyx_vtabstruct_10pysamstats_3opt_MapqHelper *__pyx_vtab;
  int n;
  int nz;
  uint64_t max;
  uint64_t sqsum;
};


/* "pysamstats/opt.pyx":941
 * 
 * # noinspection PyAttributeOutsideInit
 * cdef class Mapq(PileupStat):             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
struct __pyx_obj_10pysamstats_3opt_Mapq {
  struct __pyx_obj_10pysamstats_3opt_PileupStat __pyx_base;
  struct __pyx_obj_10pysamstats_3opt_MapqHelper *all;
  struct __pyx_obj_10pysamstats_3opt_MapqHelper *pp;
};


/* "pysamstats/opt.pyx":997
 * 
 * # noinspection PyAttributeOutsideInit
 * cdef class MapqStrand(PileupStat):             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
struct __pyx_obj_10pysamstats_3opt_MapqStrand {
  struct __pyx_obj_10pysamstats_3opt_PileupStat __pyx_base;
  struct __pyx_obj_10pysamstats_3opt_MapqHelper *all;
  struct __pyx_obj_10pysamstats_3opt_MapqHelper *fwd;
  struct __pyx_obj_10pysamstats_3opt_MapqHelper *rev;
  struct __pyx_obj_10pysamstats_3opt_MapqHelper *pp;
  struct __pyx_obj_10pysamstats_3opt_MapqHelper *pp_fwd;
  struct __pyx_obj_10pysamstats_3opt_MapqHelper *pp_rev;
};


/* "pysamstats/opt.pyx":1093
 * 
 * # noinspection PyAttributeOutsideInit
 * cdef class BaseqHelper:             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
struct __pyx_obj_10pysamstats_3opt_BaseqHelper {
  PyObject_HEAD
  struct __pyx_vtabstruct_10pysamstats_3opt_BaseqHelper *__pyx_vtab;
  int n;
  int n_nodel;
  uint64_t sqsum;
};


/* "pysamstats/opt.pyx":1119
 * 
 * # noinspection PyAttributeOutsideInit
 * cdef class BaseqPpHelper:             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
struct __pyx_obj_10pysamstats_3opt_BaseqPpHelper {
  PyObject_HEAD
  struct __pyx_vtabstruct_10pysamstats_3opt_BaseqPpHelper *__pyx_vtab;
  struct __pyx_obj_10pysamstats_3opt_BaseqHelper *all;
  struct __pyx_obj_10pysamstats_3opt_BaseqHelper *pp;
};


/* "pysamstats/opt.pyx":1141
 * 
 * # noinspection PyAttributeOutsideInit
 * cdef class Baseq(PileupStat):             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
struct __pyx_obj_10pysamstats_3opt_Baseq {
  struct __pyx_obj_10pysamstats_3opt_PileupStat __pyx_base;
  struct __pyx_obj_10pysamstats_3opt_BaseqPpHelper *helper;
};


/* "pysamstats/opt.pyx":1188
 * 
 * # noinspection PyAttributeOutsideInit
 * cdef class BaseqStrandPpHelper:             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
struct __pyx_obj_10pysamstats_3opt_BaseqStrandPpHelper {
  PyObject_HEAD
  struct __pyx_vtabstruct_10pysamstats_3opt_BaseqStrandPpHelper *__pyx_vtab;
  struct __pyx_obj_10pysamstats_3opt_BaseqHelper *all;
  struct __pyx_obj_10pysamstats_3opt_BaseqHelper *fwd;
  struct __pyx_obj_10pysamstats_3opt_BaseqHelper *rev;
  struct __pyx_obj_10pysamstats_3opt_BaseqHelper *pp;
  struct __pyx_obj_10pysamstats_3opt_BaseqHelper *pp_fwd;
  struct __pyx_obj_10pysamstats_3opt_BaseqHelper *pp_rev;
};


/* "pysamstats/opt.pyx":1230
 * 
 * # noinspection PyAttributeOutsideInit
 * cdef class BaseqStrand(PileupStat):             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
struct __pyx_obj_10pysamstats_3opt_BaseqStrand {
  struct __pyx_obj_10pysamstats_3opt_PileupStat __pyx_base;
  struct __pyx_obj_10pysamstats_3opt_BaseqStrandPpHelper *helper;
};


/* "pysamstats/opt.pyx":1292
 * 
 * # noinspection PyAttributeOutsideInit
 * cdef class BaseqExt(PileupStat):             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
struct __pyx_obj_10pysamstats_3opt_BaseqExt {
  struct __pyx_obj_10pysamstats_3opt_PileupStat __pyx_base;
  struct __pyx_obj_10pysamstats_3opt_BaseqPpHelper *all;
  struct __pyx_obj_10pysamstats_3opt_BaseqPpHelper *matches;
  struct __pyx_obj_10pysamstats_3opt_BaseqPpHelper *mismatches;
};


/* "pysamstats/opt.pyx":1367
 * 
 * # noinspection PyAttributeOutsideInit
 * cdef class BaseqExtStrand(PileupStat):             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
struct __pyx_obj_10pysamstats_3opt_BaseqExtStrand {
  struct __pyx_obj_10pysamstats_3opt_PileupStat __pyx_base;
  struct __pyx_obj_10pysamstats_3opt_BaseqStrandPpHelper *all;
  struct __pyx_obj_10pysamstats_3opt_BaseqStrandPpHelper *matches;
  struct __pyx_obj_10pysamstats_3opt_BaseqStrandPpHelper *mismatches;
};


/* "pysamstats/opt.pyx":1471
 * 
 * # noinspection PyAttributeOutsideInit
 * cdef class CoverageGC(PileupStat):             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
struct __pyx_obj_10pysamstats_3opt_CoverageGC {
  struct __pyx_obj_10pysamstats_3opt_PileupStat __pyx_base;
  struct __pyx_obj_10pysamstats_3opt_CountPp *reads;
  int window_size;
  int window_offset;
};


/* "pysamstats/opt.pyx":1542
 * 
 * 
 * cdef class BinnedStat(object):             # <<<<<<<<<<<<<<
 * 
 *     cdef dict rec(self, chrom, bin_start, bin_end, FastaFile fafile):
 */
struct __pyx_obj_10pysamstats_3opt_BinnedStat {
  PyObject_HEAD
  struct __pyx_vtabstruct_10pysamstats_3opt_BinnedStat *__pyx_vtab;
};


/* "pysamstats/opt.pyx":1551
 * 
 * 
 * cdef class CoverageBinned(BinnedStat):             # <<<<<<<<<<<<<<
 * 
 *     cdef int reads_all, reads_pp
 */
struct __pyx_obj_10pysamstats_3opt_CoverageBinned {
  struct __pyx_obj_10pysamstats_3opt_BinnedStat __pyx_base;
  int reads_all;
  int reads_pp;
};


/* "pysamstats/opt.pyx":1592
 * 
 * 
 * cdef class CoverageExtBinned(BinnedStat):             # <<<<<<<<<<<<<<
 * 
 *     cdef int reads_all, reads_pp, reads_mate_unmapped, reads_mate_other_chr, \
 */
struct __pyx_obj_10pysamstats_3opt_CoverageExtBinned {
  struct __pyx_obj_10pysamstats_3opt_BinnedStat __pyx_base;
  int reads_all;
  int reads_pp;
  int reads_mate_unmapped;
  int reads_mate_other_chr;
  int reads_mate_same_strand;
  int reads_faceaway;
  int reads_softclipped;
  int reads_duplicate;
};


/* "pysamstats/opt.pyx":1670
 * 
 * 
 * cdef class MapqBinned(BinnedStat):             # <<<<<<<<<<<<<<
 * 
 *     cdef int reads_all, reads_mapq0
 */
struct __pyx_obj_10pysamstats_3opt_MapqBinned {
  struct __pyx_obj_10pysamstats_3opt_BinnedStat __pyx_base;
  int reads_all;
  int reads_mapq0;
  uint64_t mapq;
  uint64_t mapq_squared_sum;
};


/* "pysamstats/opt.pyx":1711
 * 
 * 
 * cdef class AlignmentBinned(BinnedStat):             # <<<<<<<<<<<<<<
 * 
 *     cdef int reads_all, M, I, D, N, S, H, P, EQ, X
 */
struct __pyx_obj_10pysamstats_3opt_AlignmentBinned {
  struct __pyx_obj_10pysamstats_3opt_BinnedStat __pyx_base;
  int reads_all;
  int M;
  int I;
  int D;
  int N;
  int S;
  int H;
  int P;
  int EQ;
  int X;
};


/* "pysamstats/opt.pyx":1772
 * 
 * 
 * cdef class TlenBinned(BinnedStat):             # <<<<<<<<<<<<<<
 * 
 *     cdef int reads_all
 */
struct __pyx_obj_10pysamstats_3opt_TlenBinned {
  struct __pyx_obj_10pysamstats_3opt_BinnedStat __pyx_base;
  int reads_all;
  int reads_pp;
  int64_t tlen_sum;
  int64_t tlen_pp_sum;
  int64_t tlen_squared_sum;
  int64_t tlen_pp_squared_sum;
};


/* "pysamstats/opt.pyx":1846
 * 
 * 
 * def iter_pileup_default(stat, alignmentfile, fafile, chrom, start, end, one_based, truncate, stepper,             # <<<<<<<<<<<<<<
 *                         max_depth, int min_mapq, int min_baseq, bint no_del, bint no_dup):
 *     cdef:
 */
struct __pyx_obj_10pysamstats_3opt___pyx_scope_struct__iter_pileup_default {
  PyObject_HEAD
  PyObject *__pyx_v_alignmentfile;
  PyObject *__pyx_v_chrom;
  struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn *__pyx_v_col;
  PyObject *__pyx_v_end;
  PyObject *__pyx_v_fafile;
  PyObject *__pyx_v_it;
  PyObject *__pyx_v_max_depth;
  int __pyx_v_min_baseq;
  int __pyx_v_min_mapq;
  int __pyx_v_no_del;
  int __pyx_v_no_dup;
  PyObject *__pyx_v_one_based;
  PyObject *__pyx_v_rec;
  PyObject *__pyx_v_start;
  PyObject *__pyx_v_stat;
  PyObject *__pyx_v_stepper;
  PyObject *__pyx_v_truncate;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* "pysamstats/opt.pyx":1936
 * 
 * 
 * def iter_pileup_padded_chrom(PileupStat stat, alignmentfile, fafile, chrom, start, end,             # <<<<<<<<<<<<<<
 *                              one_based, truncate, stepper, max_depth, min_mapq, min_baseq, no_del, no_dup):
 *     cdef:
 */
struct __pyx_obj_10pysamstats_3opt___pyx_scope_struct_1_iter_pileup_padded_chrom {
  PyObject_HEAD
  PyObject *__pyx_v_alignmentfile;
  PyObject *__pyx_v_chrom;
  struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn *__pyx_v_col;
  int __pyx_v_curpos;
  PyObject *__pyx_v_end;
  PyObject *__pyx_v_fafile;
  PyObject *__pyx_v_it;
  PyObject *__pyx_v_max_depth;
  PyObject *__pyx_v_min_baseq;
  PyObject *__pyx_v_min_mapq;
  PyObject *__pyx_v_no_del;
  PyObject *__pyx_v_no_dup;
  PyObject *__pyx_v_one_based;
  long __pyx_v_pos;
  PyObject *__pyx_v_rec;
  PyObject *__pyx_v_refbase;
  PyObject *__pyx_v_start;
  struct __pyx_obj_10pysamstats_3opt_PileupStat *__pyx_v_stat;
  PyObject *__pyx_v_stepper;
  PyObject *__pyx_v_truncate;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* "pysamstats/opt.pyx":2026
 * 
 * 
 * def iter_binned_chrom(BinnedStat stat, AlignmentFile alignmentfile, FastaFile fafile,             # <<<<<<<<<<<<<<
 *                       chrom, start, end, one_based, int window_size, int window_offset,
 *                       int min_mapq, int no_dup):
 */
struct __pyx_obj_10pysamstats_3opt___pyx_scope_struct_2_iter_binned_chrom {
  PyObject_HEAD
  struct __pyx_obj_5pysam_17libcalignmentfile_AlignmentFile *__pyx_v_alignmentfile;
  bam1_t *__pyx_v_b;
  int __pyx_v_bin_end;
  int __pyx_v_bin_start;
  PyObject *__pyx_v_chrom;
  PyObject *__pyx_v_end;
  struct __pyx_obj_5pysam_9libcfaidx_FastaFile *__pyx_v_fafile;
  int __pyx_v_has_coord;
  struct __pyx_obj_5pysam_17libcalignmentfile_IteratorRowRegion *__pyx_v_it;
  int __pyx_v_min_mapq;
  int __pyx_v_no_dup;
  PyObject *__pyx_v_one_based;
  PyObject *__pyx_v_pos;
  PyObject *__pyx_v_rec;
  int __pyx_v_rend;
  int __pyx_v_rstart;
  int __pyx_v_rtid;
  PyObject *__pyx_v_start;
  struct __pyx_obj_10pysamstats_3opt_BinnedStat *__pyx_v_stat;
  int __pyx_v_window_offset;
  int __pyx_v_window_size;
};



/* "pysam/libchtslib.pxd":2590
 * 
 * 
 * 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/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":89
 * 
 * 
 * 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":95
 * 
 * 
 * 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":102
 * 
 * 
 * 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":112
 * 
 * 
 * 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":119
 * 
 * 
 * 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 *(*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":150
 * 
 * 
 * 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":156
 * 
 * 
 * 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;


/* "pysamstats/opt.pyx":75
 * 
 * 
 * cdef class PileupStat(object):             # <<<<<<<<<<<<<<
 * 
 *     cdef dict rec(self, chrom, pos, FastaFile fafile, bytes refbase):
 */

struct __pyx_vtabstruct_10pysamstats_3opt_PileupStat {
  PyObject *(*rec)(struct __pyx_obj_10pysamstats_3opt_PileupStat *, PyObject *, PyObject *, struct __pyx_obj_5pysam_9libcfaidx_FastaFile *, PyObject *);
  void (*recv)(struct __pyx_obj_10pysamstats_3opt_PileupStat *, bam_pileup1_t *, struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn *, PyObject *);
};
static struct __pyx_vtabstruct_10pysamstats_3opt_PileupStat *__pyx_vtabptr_10pysamstats_3opt_PileupStat;


/* "pysamstats/opt.pyx":90
 * 
 * # noinspection PyAttributeOutsideInit
 * cdef class CountPp:             # <<<<<<<<<<<<<<
 *     cdef:
 *         int all, pp
 */

struct __pyx_vtabstruct_10pysamstats_3opt_CountPp {
  void (*incr)(struct __pyx_obj_10pysamstats_3opt_CountPp *, int);
};
static struct __pyx_vtabstruct_10pysamstats_3opt_CountPp *__pyx_vtabptr_10pysamstats_3opt_CountPp;


/* "pysamstats/opt.pyx":107
 * 
 * # noinspection PyAttributeOutsideInit
 * cdef class Coverage(PileupStat):             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */

struct __pyx_vtabstruct_10pysamstats_3opt_Coverage {
  struct __pyx_vtabstruct_10pysamstats_3opt_PileupStat __pyx_base;
};
static struct __pyx_vtabstruct_10pysamstats_3opt_Coverage *__pyx_vtabptr_10pysamstats_3opt_Coverage;


/* "pysamstats/opt.pyx":147
 * 
 * # noinspection PyAttributeOutsideInit
 * cdef class CountPpStrand:             # <<<<<<<<<<<<<<
 *     cdef:
 *         int all, pp, fwd, rev, pp_fwd, pp_rev
 */

struct __pyx_vtabstruct_10pysamstats_3opt_CountPpStrand {
  void (*incr)(struct __pyx_obj_10pysamstats_3opt_CountPpStrand *, int, int);
};
static struct __pyx_vtabstruct_10pysamstats_3opt_CountPpStrand *__pyx_vtabptr_10pysamstats_3opt_CountPpStrand;


/* "pysamstats/opt.pyx":172
 * 
 * # noinspection PyAttributeOutsideInit
 * cdef class CoverageStrand(PileupStat):             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */

struct __pyx_vtabstruct_10pysamstats_3opt_CoverageStrand {
  struct __pyx_vtabstruct_10pysamstats_3opt_PileupStat __pyx_base;
};
static struct __pyx_vtabstruct_10pysamstats_3opt_CoverageStrand *__pyx_vtabptr_10pysamstats_3opt_CoverageStrand;


/* "pysamstats/opt.pyx":220
 * 
 * # noinspection PyAttributeOutsideInit
 * cdef class CoverageExt(PileupStat):             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */

struct __pyx_vtabstruct_10pysamstats_3opt_CoverageExt {
  struct __pyx_vtabstruct_10pysamstats_3opt_PileupStat __pyx_base;
};
static struct __pyx_vtabstruct_10pysamstats_3opt_CoverageExt *__pyx_vtabptr_10pysamstats_3opt_CoverageExt;


/* "pysamstats/opt.pyx":305
 * 
 * # noinspection PyAttributeOutsideInit
 * cdef class CountStrand:             # <<<<<<<<<<<<<<
 *     cdef:
 *         int all, fwd, rev
 */

struct __pyx_vtabstruct_10pysamstats_3opt_CountStrand {
  void (*incr)(struct __pyx_obj_10pysamstats_3opt_CountStrand *, int);
};
static struct __pyx_vtabstruct_10pysamstats_3opt_CountStrand *__pyx_vtabptr_10pysamstats_3opt_CountStrand;


/* "pysamstats/opt.pyx":324
 * 
 * # noinspection PyAttributeOutsideInit
 * cdef class CoverageExtStrand(PileupStat):             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */

struct __pyx_vtabstruct_10pysamstats_3opt_CoverageExtStrand {
  struct __pyx_vtabstruct_10pysamstats_3opt_PileupStat __pyx_base;
};
static struct __pyx_vtabstruct_10pysamstats_3opt_CoverageExtStrand *__pyx_vtabptr_10pysamstats_3opt_CoverageExtStrand;


/* "pysamstats/opt.pyx":435
 * 
 * # noinspection PyAttributeOutsideInit
 * cdef class Variation(PileupStat):             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */

struct __pyx_vtabstruct_10pysamstats_3opt_Variation {
  struct __pyx_vtabstruct_10pysamstats_3opt_PileupStat __pyx_base;
};
static struct __pyx_vtabstruct_10pysamstats_3opt_Variation *__pyx_vtabptr_10pysamstats_3opt_Variation;


/* "pysamstats/opt.pyx":544
 * 
 * # noinspection PyAttributeOutsideInit
 * cdef class VariationStrand(PileupStat):             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */

struct __pyx_vtabstruct_10pysamstats_3opt_VariationStrand {
  struct __pyx_vtabstruct_10pysamstats_3opt_PileupStat __pyx_base;
};
static struct __pyx_vtabstruct_10pysamstats_3opt_VariationStrand *__pyx_vtabptr_10pysamstats_3opt_VariationStrand;


/* "pysamstats/opt.pyx":679
 * 
 * # noinspection PyAttributeOutsideInit
 * cdef class TlenHelper:             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */

struct __pyx_vtabstruct_10pysamstats_3opt_TlenHelper {
  void (*update)(struct __pyx_obj_10pysamstats_3opt_TlenHelper *, int64_t);
};
static struct __pyx_vtabstruct_10pysamstats_3opt_TlenHelper *__pyx_vtabptr_10pysamstats_3opt_TlenHelper;


/* "pysamstats/opt.pyx":731
 * 
 * # noinspection PyAttributeOutsideInit
 * cdef class Tlen(PileupStat):             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */

struct __pyx_vtabstruct_10pysamstats_3opt_Tlen {
  struct __pyx_vtabstruct_10pysamstats_3opt_PileupStat __pyx_base;
};
static struct __pyx_vtabstruct_10pysamstats_3opt_Tlen *__pyx_vtabptr_10pysamstats_3opt_Tlen;


/* "pysamstats/opt.pyx":796
 * 
 * # noinspection PyAttributeOutsideInit
 * cdef class TlenStrand(PileupStat):             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */

struct __pyx_vtabstruct_10pysamstats_3opt_TlenStrand {
  struct __pyx_vtabstruct_10pysamstats_3opt_PileupStat __pyx_base;
};
static struct __pyx_vtabstruct_10pysamstats_3opt_TlenStrand *__pyx_vtabptr_10pysamstats_3opt_TlenStrand;


/* "pysamstats/opt.pyx":912
 * 
 * # noinspection PyAttributeOutsideInit
 * cdef class MapqHelper:             # <<<<<<<<<<<<<<
 *     cdef:
 *         int n
 */

struct __pyx_vtabstruct_10pysamstats_3opt_MapqHelper {
  void (*update)(struct __pyx_obj_10pysamstats_3opt_MapqHelper *, uint64_t);
};
static struct __pyx_vtabstruct_10pysamstats_3opt_MapqHelper *__pyx_vtabptr_10pysamstats_3opt_MapqHelper;


/* "pysamstats/opt.pyx":941
 * 
 * # noinspection PyAttributeOutsideInit
 * cdef class Mapq(PileupStat):             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */

struct __pyx_vtabstruct_10pysamstats_3opt_Mapq {
  struct __pyx_vtabstruct_10pysamstats_3opt_PileupStat __pyx_base;
};
static struct __pyx_vtabstruct_10pysamstats_3opt_Mapq *__pyx_vtabptr_10pysamstats_3opt_Mapq;


/* "pysamstats/opt.pyx":997
 * 
 * # noinspection PyAttributeOutsideInit
 * cdef class MapqStrand(PileupStat):             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */

struct __pyx_vtabstruct_10pysamstats_3opt_MapqStrand {
  struct __pyx_vtabstruct_10pysamstats_3opt_PileupStat __pyx_base;
};
static struct __pyx_vtabstruct_10pysamstats_3opt_MapqStrand *__pyx_vtabptr_10pysamstats_3opt_MapqStrand;


/* "pysamstats/opt.pyx":1093
 * 
 * # noinspection PyAttributeOutsideInit
 * cdef class BaseqHelper:             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */

struct __pyx_vtabstruct_10pysamstats_3opt_BaseqHelper {
  void (*update)(struct __pyx_obj_10pysamstats_3opt_BaseqHelper *, int64_t);
};
static struct __pyx_vtabstruct_10pysamstats_3opt_BaseqHelper *__pyx_vtabptr_10pysamstats_3opt_BaseqHelper;


/* "pysamstats/opt.pyx":1119
 * 
 * # noinspection PyAttributeOutsideInit
 * cdef class BaseqPpHelper:             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */

struct __pyx_vtabstruct_10pysamstats_3opt_BaseqPpHelper {
  void (*update)(struct __pyx_obj_10pysamstats_3opt_BaseqPpHelper *, int64_t, int);
};
static struct __pyx_vtabstruct_10pysamstats_3opt_BaseqPpHelper *__pyx_vtabptr_10pysamstats_3opt_BaseqPpHelper;


/* "pysamstats/opt.pyx":1141
 * 
 * # noinspection PyAttributeOutsideInit
 * cdef class Baseq(PileupStat):             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */

struct __pyx_vtabstruct_10pysamstats_3opt_Baseq {
  struct __pyx_vtabstruct_10pysamstats_3opt_PileupStat __pyx_base;
};
static struct __pyx_vtabstruct_10pysamstats_3opt_Baseq *__pyx_vtabptr_10pysamstats_3opt_Baseq;


/* "pysamstats/opt.pyx":1188
 * 
 * # noinspection PyAttributeOutsideInit
 * cdef class BaseqStrandPpHelper:             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */

struct __pyx_vtabstruct_10pysamstats_3opt_BaseqStrandPpHelper {
  void (*update)(struct __pyx_obj_10pysamstats_3opt_BaseqStrandPpHelper *, int64_t, int, int);
};
static struct __pyx_vtabstruct_10pysamstats_3opt_BaseqStrandPpHelper *__pyx_vtabptr_10pysamstats_3opt_BaseqStrandPpHelper;


/* "pysamstats/opt.pyx":1230
 * 
 * # noinspection PyAttributeOutsideInit
 * cdef class BaseqStrand(PileupStat):             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */

struct __pyx_vtabstruct_10pysamstats_3opt_BaseqStrand {
  struct __pyx_vtabstruct_10pysamstats_3opt_PileupStat __pyx_base;
};
static struct __pyx_vtabstruct_10pysamstats_3opt_BaseqStrand *__pyx_vtabptr_10pysamstats_3opt_BaseqStrand;


/* "pysamstats/opt.pyx":1292
 * 
 * # noinspection PyAttributeOutsideInit
 * cdef class BaseqExt(PileupStat):             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */

struct __pyx_vtabstruct_10pysamstats_3opt_BaseqExt {
  struct __pyx_vtabstruct_10pysamstats_3opt_PileupStat __pyx_base;
};
static struct __pyx_vtabstruct_10pysamstats_3opt_BaseqExt *__pyx_vtabptr_10pysamstats_3opt_BaseqExt;


/* "pysamstats/opt.pyx":1367
 * 
 * # noinspection PyAttributeOutsideInit
 * cdef class BaseqExtStrand(PileupStat):             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */

struct __pyx_vtabstruct_10pysamstats_3opt_BaseqExtStrand {
  struct __pyx_vtabstruct_10pysamstats_3opt_PileupStat __pyx_base;
};
static struct __pyx_vtabstruct_10pysamstats_3opt_BaseqExtStrand *__pyx_vtabptr_10pysamstats_3opt_BaseqExtStrand;


/* "pysamstats/opt.pyx":1471
 * 
 * # noinspection PyAttributeOutsideInit
 * cdef class CoverageGC(PileupStat):             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */

struct __pyx_vtabstruct_10pysamstats_3opt_CoverageGC {
  struct __pyx_vtabstruct_10pysamstats_3opt_PileupStat __pyx_base;
};
static struct __pyx_vtabstruct_10pysamstats_3opt_CoverageGC *__pyx_vtabptr_10pysamstats_3opt_CoverageGC;


/* "pysamstats/opt.pyx":1542
 * 
 * 
 * cdef class BinnedStat(object):             # <<<<<<<<<<<<<<
 * 
 *     cdef dict rec(self, chrom, bin_start, bin_end, FastaFile fafile):
 */

struct __pyx_vtabstruct_10pysamstats_3opt_BinnedStat {
  PyObject *(*rec)(struct __pyx_obj_10pysamstats_3opt_BinnedStat *, PyObject *, PyObject *, PyObject *, struct __pyx_obj_5pysam_9libcfaidx_FastaFile *);
  void (*recv)(struct __pyx_obj_10pysamstats_3opt_BinnedStat *, bam1_t *);
};
static struct __pyx_vtabstruct_10pysamstats_3opt_BinnedStat *__pyx_vtabptr_10pysamstats_3opt_BinnedStat;


/* "pysamstats/opt.pyx":1551
 * 
 * 
 * cdef class CoverageBinned(BinnedStat):             # <<<<<<<<<<<<<<
 * 
 *     cdef int reads_all, reads_pp
 */

struct __pyx_vtabstruct_10pysamstats_3opt_CoverageBinned {
  struct __pyx_vtabstruct_10pysamstats_3opt_BinnedStat __pyx_base;
};
static struct __pyx_vtabstruct_10pysamstats_3opt_CoverageBinned *__pyx_vtabptr_10pysamstats_3opt_CoverageBinned;


/* "pysamstats/opt.pyx":1592
 * 
 * 
 * cdef class CoverageExtBinned(BinnedStat):             # <<<<<<<<<<<<<<
 * 
 *     cdef int reads_all, reads_pp, reads_mate_unmapped, reads_mate_other_chr, \
 */

struct __pyx_vtabstruct_10pysamstats_3opt_CoverageExtBinned {
  struct __pyx_vtabstruct_10pysamstats_3opt_BinnedStat __pyx_base;
};
static struct __pyx_vtabstruct_10pysamstats_3opt_CoverageExtBinned *__pyx_vtabptr_10pysamstats_3opt_CoverageExtBinned;


/* "pysamstats/opt.pyx":1670
 * 
 * 
 * cdef class MapqBinned(BinnedStat):             # <<<<<<<<<<<<<<
 * 
 *     cdef int reads_all, reads_mapq0
 */

struct __pyx_vtabstruct_10pysamstats_3opt_MapqBinned {
  struct __pyx_vtabstruct_10pysamstats_3opt_BinnedStat __pyx_base;
};
static struct __pyx_vtabstruct_10pysamstats_3opt_MapqBinned *__pyx_vtabptr_10pysamstats_3opt_MapqBinned;


/* "pysamstats/opt.pyx":1711
 * 
 * 
 * cdef class AlignmentBinned(BinnedStat):             # <<<<<<<<<<<<<<
 * 
 *     cdef int reads_all, M, I, D, N, S, H, P, EQ, X
 */

struct __pyx_vtabstruct_10pysamstats_3opt_AlignmentBinned {
  struct __pyx_vtabstruct_10pysamstats_3opt_BinnedStat __pyx_base;
};
static struct __pyx_vtabstruct_10pysamstats_3opt_AlignmentBinned *__pyx_vtabptr_10pysamstats_3opt_AlignmentBinned;


/* "pysamstats/opt.pyx":1772
 * 
 * 
 * cdef class TlenBinned(BinnedStat):             # <<<<<<<<<<<<<<
 * 
 *     cdef int reads_all
 */

struct __pyx_vtabstruct_10pysamstats_3opt_TlenBinned {
  struct __pyx_vtabstruct_10pysamstats_3opt_BinnedStat __pyx_base;
};
static struct __pyx_vtabstruct_10pysamstats_3opt_TlenBinned *__pyx_vtabptr_10pysamstats_3opt_TlenBinned;

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

/* PyErrExceptionMatches.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
#else
#define __Pyx_PyErr_ExceptionMatches(err)  PyErr_ExceptionMatches(err)
#endif

/* 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

/* GetAttr.proto */
static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);

/* GetAttr3.proto */
static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);

/* 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

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

/* KeywordStringCheck.proto */
static int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed);

/* 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, int 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
  static size_t __pyx_pyframe_localsplus_offset = 0;
  #include "frameobject.h"
  #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

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

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

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

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

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

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

/* PyIntBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_FloorDivideObjC(PyObject *op1, PyObject *op2, long intval, int inplace);
#else
#define __Pyx_PyInt_FloorDivideObjC(op1, op2, intval, inplace)\
    (inplace ? PyNumber_InPlaceFloorDivide(op1, op2) : PyNumber_FloorDivide(op1, op2))
#endif

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

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

/* PyObjectCallMethod0.proto */
static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name);

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

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

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

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

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

/* UnpackTuple2.proto */
#define __Pyx_unpack_tuple2(tuple, value1, value2, is_tuple, has_known_size, decref_tuple)\
    (likely(is_tuple || PyTuple_Check(tuple)) ?\
        (likely(has_known_size || PyTuple_GET_SIZE(tuple) == 2) ?\
            __Pyx_unpack_tuple2_exact(tuple, value1, value2, decref_tuple) :\
            (__Pyx_UnpackTupleError(tuple, 2), -1)) :\
        __Pyx_unpack_tuple2_generic(tuple, value1, value2, has_known_size, decref_tuple))
static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
    PyObject* tuple, PyObject** value1, PyObject** value2, int decref_tuple);
static int __Pyx_unpack_tuple2_generic(
    PyObject* tuple, PyObject** value1, PyObject** value2, int has_known_size, int decref_tuple);

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

/* MergeKeywords.proto */
static int __Pyx_MergeKeywords(PyObject *kwdict, PyObject *source_mapping);

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

/* ArgTypeTest.proto */
#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
    ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
        __Pyx__ArgTypeTest(obj, type, name, exact))
static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);

/* 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);
        Py_SIZE(list) = len+1;
        return 0;
    }
    return PyList_Append(list, x);
}
#else
#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
#endif

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

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

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

/* PyIntBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace);
#else
#define __Pyx_PyInt_SubtractObjC(op1, op2, intval, inplace)\
    (inplace ? PyNumber_InPlaceSubtract(op1, op2) : PyNumber_Subtract(op1, op2))
#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);

/* 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

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

/* None.proto */
static CYTHON_INLINE long __Pyx_mod_long(long, long);

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

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

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

/* HasAttr.proto */
static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);

/* CallNextTpTraverse.proto */
static int __Pyx_call_next_tp_traverse(PyObject* obj, visitproc v, void *a, traverseproc current_tp_traverse);

/* CallNextTpClear.proto */
static void __Pyx_call_next_tp_clear(PyObject* obj, inquiry current_tp_dealloc);

/* 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

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

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

/* SetupReduce.proto */
static int __Pyx_setup_reduce(PyObject* type_obj);

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

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

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

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

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

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int64_t(int64_t value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint64_t(uint64_t value);

/* None.proto */
static CYTHON_INLINE int64_t __Pyx_pow_int64_t(int64_t, int64_t);

/* None.proto */
static CYTHON_INLINE uint64_t __Pyx_pow_uint64_t(uint64_t, uint64_t);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint32_t(uint32_t value);

/* 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;
    op->ob_size = 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;
    self->ob_size = 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) {
        self->ob_size = 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;
    self->ob_size = n;
    self->allocated = newsize;
    return 0;
}
#endif

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

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

/* CIntFromPy.proto */
static CYTHON_INLINE int64_t __Pyx_PyInt_As_int64_t(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE uint64_t __Pyx_PyInt_As_uint64_t(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)

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

/* 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

/* 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

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

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

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

static PyObject *__pyx_f_10pysamstats_3opt_10PileupStat_rec(CYTHON_UNUSED struct __pyx_obj_10pysamstats_3opt_PileupStat *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_chrom, CYTHON_UNUSED PyObject *__pyx_v_pos, CYTHON_UNUSED struct __pyx_obj_5pysam_9libcfaidx_FastaFile *__pyx_v_fafile, CYTHON_UNUSED PyObject *__pyx_v_refbase); /* proto*/
static void __pyx_f_10pysamstats_3opt_10PileupStat_recv(CYTHON_UNUSED struct __pyx_obj_10pysamstats_3opt_PileupStat *__pyx_v_self, CYTHON_UNUSED bam_pileup1_t *__pyx_v_read, CYTHON_UNUSED struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn *__pyx_v_col, CYTHON_UNUSED PyObject *__pyx_v_refbase); /* proto*/
static void __pyx_f_10pysamstats_3opt_7CountPp_incr(struct __pyx_obj_10pysamstats_3opt_CountPp *__pyx_v_self, int __pyx_v_is_proper_pair); /* proto*/
static void __pyx_f_10pysamstats_3opt_8Coverage_recv(struct __pyx_obj_10pysamstats_3opt_Coverage *__pyx_v_self, bam_pileup1_t *__pyx_v_read, CYTHON_UNUSED struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn *__pyx_v_col, CYTHON_UNUSED PyObject *__pyx_v_refbase); /* proto*/
static PyObject *__pyx_f_10pysamstats_3opt_8Coverage_rec(struct __pyx_obj_10pysamstats_3opt_Coverage *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_chrom, CYTHON_UNUSED PyObject *__pyx_v_pos, CYTHON_UNUSED struct __pyx_obj_5pysam_9libcfaidx_FastaFile *__pyx_v_fafile, CYTHON_UNUSED PyObject *__pyx_v_refbase); /* proto*/
static void __pyx_f_10pysamstats_3opt_13CountPpStrand_incr(struct __pyx_obj_10pysamstats_3opt_CountPpStrand *__pyx_v_self, int __pyx_v_is_reverse, int __pyx_v_is_proper_pair); /* proto*/
static void __pyx_f_10pysamstats_3opt_14CoverageStrand_recv(struct __pyx_obj_10pysamstats_3opt_CoverageStrand *__pyx_v_self, bam_pileup1_t *__pyx_v_read, CYTHON_UNUSED struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn *__pyx_v_col, CYTHON_UNUSED PyObject *__pyx_v_refbase); /* proto*/
static PyObject *__pyx_f_10pysamstats_3opt_14CoverageStrand_rec(struct __pyx_obj_10pysamstats_3opt_CoverageStrand *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_chrom, CYTHON_UNUSED PyObject *__pyx_v_pos, CYTHON_UNUSED struct __pyx_obj_5pysam_9libcfaidx_FastaFile *__pyx_v_fafile, CYTHON_UNUSED PyObject *__pyx_v_refbase); /* proto*/
static void __pyx_f_10pysamstats_3opt_11CoverageExt_recv(struct __pyx_obj_10pysamstats_3opt_CoverageExt *__pyx_v_self, bam_pileup1_t *__pyx_v_read, struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn *__pyx_v_col, CYTHON_UNUSED PyObject *__pyx_v_refbase); /* proto*/
static PyObject *__pyx_f_10pysamstats_3opt_11CoverageExt_rec(struct __pyx_obj_10pysamstats_3opt_CoverageExt *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_chrom, CYTHON_UNUSED PyObject *__pyx_v_pos, CYTHON_UNUSED struct __pyx_obj_5pysam_9libcfaidx_FastaFile *__pyx_v_fafile, CYTHON_UNUSED PyObject *__pyx_v_refbase); /* proto*/
static void __pyx_f_10pysamstats_3opt_11CountStrand_incr(struct __pyx_obj_10pysamstats_3opt_CountStrand *__pyx_v_self, int __pyx_v_is_reverse); /* proto*/
static void __pyx_f_10pysamstats_3opt_17CoverageExtStrand_recv(struct __pyx_obj_10pysamstats_3opt_CoverageExtStrand *__pyx_v_self, bam_pileup1_t *__pyx_v_read, struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn *__pyx_v_col, CYTHON_UNUSED PyObject *__pyx_v_refbase); /* proto*/
static PyObject *__pyx_f_10pysamstats_3opt_17CoverageExtStrand_rec(struct __pyx_obj_10pysamstats_3opt_CoverageExtStrand *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_chrom, CYTHON_UNUSED PyObject *__pyx_v_pos, CYTHON_UNUSED struct __pyx_obj_5pysam_9libcfaidx_FastaFile *__pyx_v_fafile, CYTHON_UNUSED PyObject *__pyx_v_refbase); /* proto*/
static void __pyx_f_10pysamstats_3opt_9Variation_recv(struct __pyx_obj_10pysamstats_3opt_Variation *__pyx_v_self, bam_pileup1_t *__pyx_v_read, CYTHON_UNUSED struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn *__pyx_v_col, PyObject *__pyx_v_refbase); /* proto*/
static PyObject *__pyx_f_10pysamstats_3opt_9Variation_rec(struct __pyx_obj_10pysamstats_3opt_Variation *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_chrom, CYTHON_UNUSED PyObject *__pyx_v_pos, CYTHON_UNUSED struct __pyx_obj_5pysam_9libcfaidx_FastaFile *__pyx_v_fafile, PyObject *__pyx_v_refbase); /* proto*/
static void __pyx_f_10pysamstats_3opt_15VariationStrand_recv(struct __pyx_obj_10pysamstats_3opt_VariationStrand *__pyx_v_self, bam_pileup1_t *__pyx_v_read, CYTHON_UNUSED struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn *__pyx_v_col, PyObject *__pyx_v_refbase); /* proto*/
static PyObject *__pyx_f_10pysamstats_3opt_15VariationStrand_rec(struct __pyx_obj_10pysamstats_3opt_VariationStrand *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_chrom, CYTHON_UNUSED PyObject *__pyx_v_pos, CYTHON_UNUSED struct __pyx_obj_5pysam_9libcfaidx_FastaFile *__pyx_v_fafile, PyObject *__pyx_v_refbase); /* proto*/
static void __pyx_f_10pysamstats_3opt_10TlenHelper_update(struct __pyx_obj_10pysamstats_3opt_TlenHelper *__pyx_v_self, int64_t __pyx_v_x); /* proto*/
static void __pyx_f_10pysamstats_3opt_4Tlen_recv(struct __pyx_obj_10pysamstats_3opt_Tlen *__pyx_v_self, bam_pileup1_t *__pyx_v_read, CYTHON_UNUSED struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn *__pyx_v_col, CYTHON_UNUSED PyObject *__pyx_v_refbase); /* proto*/
static PyObject *__pyx_f_10pysamstats_3opt_4Tlen_rec(struct __pyx_obj_10pysamstats_3opt_Tlen *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_chrom, CYTHON_UNUSED PyObject *__pyx_v_pos, CYTHON_UNUSED struct __pyx_obj_5pysam_9libcfaidx_FastaFile *__pyx_v_fafile, CYTHON_UNUSED PyObject *__pyx_v_refbase); /* proto*/
static void __pyx_f_10pysamstats_3opt_10TlenStrand_recv(struct __pyx_obj_10pysamstats_3opt_TlenStrand *__pyx_v_self, bam_pileup1_t *__pyx_v_read, CYTHON_UNUSED struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn *__pyx_v_col, CYTHON_UNUSED PyObject *__pyx_v_refbase); /* proto*/
static PyObject *__pyx_f_10pysamstats_3opt_10TlenStrand_rec(struct __pyx_obj_10pysamstats_3opt_TlenStrand *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_chrom, CYTHON_UNUSED PyObject *__pyx_v_pos, CYTHON_UNUSED struct __pyx_obj_5pysam_9libcfaidx_FastaFile *__pyx_v_fafile, CYTHON_UNUSED PyObject *__pyx_v_refbase); /* proto*/
static void __pyx_f_10pysamstats_3opt_10MapqHelper_update(struct __pyx_obj_10pysamstats_3opt_MapqHelper *__pyx_v_self, uint64_t __pyx_v_mapq); /* proto*/
static void __pyx_f_10pysamstats_3opt_4Mapq_recv(struct __pyx_obj_10pysamstats_3opt_Mapq *__pyx_v_self, bam_pileup1_t *__pyx_v_read, CYTHON_UNUSED struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn *__pyx_v_col, CYTHON_UNUSED PyObject *__pyx_v_refbase); /* proto*/
static PyObject *__pyx_f_10pysamstats_3opt_4Mapq_rec(struct __pyx_obj_10pysamstats_3opt_Mapq *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_chrom, CYTHON_UNUSED PyObject *__pyx_v_pos, CYTHON_UNUSED struct __pyx_obj_5pysam_9libcfaidx_FastaFile *__pyx_v_fafile, CYTHON_UNUSED PyObject *__pyx_v_refbase); /* proto*/
static void __pyx_f_10pysamstats_3opt_10MapqStrand_recv(struct __pyx_obj_10pysamstats_3opt_MapqStrand *__pyx_v_self, bam_pileup1_t *__pyx_v_read, CYTHON_UNUSED struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn *__pyx_v_col, CYTHON_UNUSED PyObject *__pyx_v_refbase); /* proto*/
static PyObject *__pyx_f_10pysamstats_3opt_10MapqStrand_rec(struct __pyx_obj_10pysamstats_3opt_MapqStrand *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_chrom, CYTHON_UNUSED PyObject *__pyx_v_pos, CYTHON_UNUSED struct __pyx_obj_5pysam_9libcfaidx_FastaFile *__pyx_v_fafile, CYTHON_UNUSED PyObject *__pyx_v_refbase); /* proto*/
static void __pyx_f_10pysamstats_3opt_11BaseqHelper_update(struct __pyx_obj_10pysamstats_3opt_BaseqHelper *__pyx_v_self, int64_t __pyx_v_baseq_squared); /* proto*/
static void __pyx_f_10pysamstats_3opt_13BaseqPpHelper_update(struct __pyx_obj_10pysamstats_3opt_BaseqPpHelper *__pyx_v_self, int64_t __pyx_v_baseq_squared, int __pyx_v_is_proper_pair); /* proto*/
static void __pyx_f_10pysamstats_3opt_5Baseq_recv(struct __pyx_obj_10pysamstats_3opt_Baseq *__pyx_v_self, bam_pileup1_t *__pyx_v_read, CYTHON_UNUSED struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn *__pyx_v_col, CYTHON_UNUSED PyObject *__pyx_v_refbase); /* proto*/
static PyObject *__pyx_f_10pysamstats_3opt_5Baseq_rec(struct __pyx_obj_10pysamstats_3opt_Baseq *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_chrom, CYTHON_UNUSED PyObject *__pyx_v_pos, CYTHON_UNUSED struct __pyx_obj_5pysam_9libcfaidx_FastaFile *__pyx_v_fafile, CYTHON_UNUSED PyObject *__pyx_v_refbase); /* proto*/
static void __pyx_f_10pysamstats_3opt_19BaseqStrandPpHelper_update(struct __pyx_obj_10pysamstats_3opt_BaseqStrandPpHelper *__pyx_v_self, int64_t __pyx_v_baseq_squared, int __pyx_v_is_proper_pair, int __pyx_v_is_reverse); /* proto*/
static void __pyx_f_10pysamstats_3opt_11BaseqStrand_recv(struct __pyx_obj_10pysamstats_3opt_BaseqStrand *__pyx_v_self, bam_pileup1_t *__pyx_v_read, CYTHON_UNUSED struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn *__pyx_v_col, CYTHON_UNUSED PyObject *__pyx_v_refbase); /* proto*/
static PyObject *__pyx_f_10pysamstats_3opt_11BaseqStrand_rec(struct __pyx_obj_10pysamstats_3opt_BaseqStrand *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_chrom, CYTHON_UNUSED PyObject *__pyx_v_pos, CYTHON_UNUSED struct __pyx_obj_5pysam_9libcfaidx_FastaFile *__pyx_v_fafile, CYTHON_UNUSED PyObject *__pyx_v_refbase); /* proto*/
static void __pyx_f_10pysamstats_3opt_8BaseqExt_recv(struct __pyx_obj_10pysamstats_3opt_BaseqExt *__pyx_v_self, bam_pileup1_t *__pyx_v_read, CYTHON_UNUSED struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn *__pyx_v_col, PyObject *__pyx_v_refbase); /* proto*/
static PyObject *__pyx_f_10pysamstats_3opt_8BaseqExt_rec(struct __pyx_obj_10pysamstats_3opt_BaseqExt *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_chrom, CYTHON_UNUSED PyObject *__pyx_v_pos, CYTHON_UNUSED struct __pyx_obj_5pysam_9libcfaidx_FastaFile *__pyx_v_fafile, PyObject *__pyx_v_refbase); /* proto*/
static void __pyx_f_10pysamstats_3opt_14BaseqExtStrand_recv(struct __pyx_obj_10pysamstats_3opt_BaseqExtStrand *__pyx_v_self, bam_pileup1_t *__pyx_v_read, CYTHON_UNUSED struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn *__pyx_v_col, PyObject *__pyx_v_refbase); /* proto*/
static PyObject *__pyx_f_10pysamstats_3opt_14BaseqExtStrand_rec(struct __pyx_obj_10pysamstats_3opt_BaseqExtStrand *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_chrom, CYTHON_UNUSED PyObject *__pyx_v_pos, CYTHON_UNUSED struct __pyx_obj_5pysam_9libcfaidx_FastaFile *__pyx_v_fafile, PyObject *__pyx_v_refbase); /* proto*/
static void __pyx_f_10pysamstats_3opt_10CoverageGC_recv(struct __pyx_obj_10pysamstats_3opt_CoverageGC *__pyx_v_self, bam_pileup1_t *__pyx_v_read, CYTHON_UNUSED struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn *__pyx_v_col, CYTHON_UNUSED PyObject *__pyx_v_refbase); /* proto*/
static PyObject *__pyx_f_10pysamstats_3opt_10CoverageGC_rec(struct __pyx_obj_10pysamstats_3opt_CoverageGC *__pyx_v_self, PyObject *__pyx_v_chrom, PyObject *__pyx_v_pos, struct __pyx_obj_5pysam_9libcfaidx_FastaFile *__pyx_v_fafile, CYTHON_UNUSED PyObject *__pyx_v_refbase); /* proto*/
static PyObject *__pyx_f_10pysamstats_3opt_10BinnedStat_rec(CYTHON_UNUSED struct __pyx_obj_10pysamstats_3opt_BinnedStat *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_chrom, CYTHON_UNUSED PyObject *__pyx_v_bin_start, CYTHON_UNUSED PyObject *__pyx_v_bin_end, CYTHON_UNUSED struct __pyx_obj_5pysam_9libcfaidx_FastaFile *__pyx_v_fafile); /* proto*/
static void __pyx_f_10pysamstats_3opt_10BinnedStat_recv(CYTHON_UNUSED struct __pyx_obj_10pysamstats_3opt_BinnedStat *__pyx_v_self, CYTHON_UNUSED bam1_t *__pyx_v_b); /* proto*/
static PyObject *__pyx_f_10pysamstats_3opt_14CoverageBinned_rec(struct __pyx_obj_10pysamstats_3opt_CoverageBinned *__pyx_v_self, PyObject *__pyx_v_chrom, PyObject *__pyx_v_bin_start, PyObject *__pyx_v_bin_end, struct __pyx_obj_5pysam_9libcfaidx_FastaFile *__pyx_v_fafile); /* proto*/
static void __pyx_f_10pysamstats_3opt_14CoverageBinned_recv(struct __pyx_obj_10pysamstats_3opt_CoverageBinned *__pyx_v_self, bam1_t *__pyx_v_b); /* proto*/
static PyObject *__pyx_f_10pysamstats_3opt_17CoverageExtBinned_rec(struct __pyx_obj_10pysamstats_3opt_CoverageExtBinned *__pyx_v_self, PyObject *__pyx_v_chrom, PyObject *__pyx_v_bin_start, PyObject *__pyx_v_bin_end, struct __pyx_obj_5pysam_9libcfaidx_FastaFile *__pyx_v_fafile); /* proto*/
static void __pyx_f_10pysamstats_3opt_17CoverageExtBinned_recv(struct __pyx_obj_10pysamstats_3opt_CoverageExtBinned *__pyx_v_self, bam1_t *__pyx_v_b); /* proto*/
static PyObject *__pyx_f_10pysamstats_3opt_10MapqBinned_rec(struct __pyx_obj_10pysamstats_3opt_MapqBinned *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_chrom, CYTHON_UNUSED PyObject *__pyx_v_bin_start, CYTHON_UNUSED PyObject *__pyx_v_bin_end, CYTHON_UNUSED struct __pyx_obj_5pysam_9libcfaidx_FastaFile *__pyx_v_fafile); /* proto*/
static void __pyx_f_10pysamstats_3opt_10MapqBinned_recv(struct __pyx_obj_10pysamstats_3opt_MapqBinned *__pyx_v_self, bam1_t *__pyx_v_b); /* proto*/
static PyObject *__pyx_f_10pysamstats_3opt_15AlignmentBinned_rec(struct __pyx_obj_10pysamstats_3opt_AlignmentBinned *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_chrom, CYTHON_UNUSED PyObject *__pyx_v_bin_start, CYTHON_UNUSED PyObject *__pyx_v_bin_end, CYTHON_UNUSED struct __pyx_obj_5pysam_9libcfaidx_FastaFile *__pyx_v_fafile); /* proto*/
static void __pyx_f_10pysamstats_3opt_15AlignmentBinned_recv(struct __pyx_obj_10pysamstats_3opt_AlignmentBinned *__pyx_v_self, bam1_t *__pyx_v_b); /* proto*/
static PyObject *__pyx_f_10pysamstats_3opt_10TlenBinned_rec(struct __pyx_obj_10pysamstats_3opt_TlenBinned *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_chrom, CYTHON_UNUSED PyObject *__pyx_v_bin_start, CYTHON_UNUSED PyObject *__pyx_v_bin_end, CYTHON_UNUSED struct __pyx_obj_5pysam_9libcfaidx_FastaFile *__pyx_v_fafile); /* proto*/
static void __pyx_f_10pysamstats_3opt_10TlenBinned_recv(struct __pyx_obj_10pysamstats_3opt_TlenBinned *__pyx_v_self, bam1_t *__pyx_v_b); /* proto*/

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

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

/* 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 'libc.string' */

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

/* 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 'libc.stdlib' */

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

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

/* Module declarations from 'cython' */

/* 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 '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.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_PileupColumn = 0;
static PyTypeObject *__pyx_ptype_5pysam_17libcalignmentfile_PileupRead = 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_IndexedReads = 0;

/* Module declarations from 'pysamstats.opt' */
static PyTypeObject *__pyx_ptype_10pysamstats_3opt_PileupStat = 0;
static PyTypeObject *__pyx_ptype_10pysamstats_3opt_CountPp = 0;
static PyTypeObject *__pyx_ptype_10pysamstats_3opt_Coverage = 0;
static PyTypeObject *__pyx_ptype_10pysamstats_3opt_CountPpStrand = 0;
static PyTypeObject *__pyx_ptype_10pysamstats_3opt_CoverageStrand = 0;
static PyTypeObject *__pyx_ptype_10pysamstats_3opt_CoverageExt = 0;
static PyTypeObject *__pyx_ptype_10pysamstats_3opt_CountStrand = 0;
static PyTypeObject *__pyx_ptype_10pysamstats_3opt_CoverageExtStrand = 0;
static PyTypeObject *__pyx_ptype_10pysamstats_3opt_Variation = 0;
static PyTypeObject *__pyx_ptype_10pysamstats_3opt_VariationStrand = 0;
static PyTypeObject *__pyx_ptype_10pysamstats_3opt_TlenHelper = 0;
static PyTypeObject *__pyx_ptype_10pysamstats_3opt_Tlen = 0;
static PyTypeObject *__pyx_ptype_10pysamstats_3opt_TlenStrand = 0;
static PyTypeObject *__pyx_ptype_10pysamstats_3opt_MapqHelper = 0;
static PyTypeObject *__pyx_ptype_10pysamstats_3opt_Mapq = 0;
static PyTypeObject *__pyx_ptype_10pysamstats_3opt_MapqStrand = 0;
static PyTypeObject *__pyx_ptype_10pysamstats_3opt_BaseqHelper = 0;
static PyTypeObject *__pyx_ptype_10pysamstats_3opt_BaseqPpHelper = 0;
static PyTypeObject *__pyx_ptype_10pysamstats_3opt_Baseq = 0;
static PyTypeObject *__pyx_ptype_10pysamstats_3opt_BaseqStrandPpHelper = 0;
static PyTypeObject *__pyx_ptype_10pysamstats_3opt_BaseqStrand = 0;
static PyTypeObject *__pyx_ptype_10pysamstats_3opt_BaseqExt = 0;
static PyTypeObject *__pyx_ptype_10pysamstats_3opt_BaseqExtStrand = 0;
static PyTypeObject *__pyx_ptype_10pysamstats_3opt_CoverageGC = 0;
static PyTypeObject *__pyx_ptype_10pysamstats_3opt_BinnedStat = 0;
static PyTypeObject *__pyx_ptype_10pysamstats_3opt_CoverageBinned = 0;
static PyTypeObject *__pyx_ptype_10pysamstats_3opt_CoverageExtBinned = 0;
static PyTypeObject *__pyx_ptype_10pysamstats_3opt_MapqBinned = 0;
static PyTypeObject *__pyx_ptype_10pysamstats_3opt_AlignmentBinned = 0;
static PyTypeObject *__pyx_ptype_10pysamstats_3opt_TlenBinned = 0;
static PyTypeObject *__pyx_ptype_10pysamstats_3opt___pyx_scope_struct__iter_pileup_default = 0;
static PyTypeObject *__pyx_ptype_10pysamstats_3opt___pyx_scope_struct_1_iter_pileup_padded_chrom = 0;
static PyTypeObject *__pyx_ptype_10pysamstats_3opt___pyx_scope_struct_2_iter_binned_chrom = 0;
static char *__pyx_v_10pysamstats_3opt_CODE2CIGAR;
static char *__pyx_v_10pysamstats_3opt_bam_nt16_rev_table;
static int __pyx_f_10pysamstats_3opt_gc_content(PyObject *); /*proto*/
static CYTHON_INLINE int __pyx_f_10pysamstats_3opt_is_softclipped(bam1_t *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_10pysamstats_3opt_get_seq_base(bam1_t *, uint32_t); /*proto*/
static PyObject *__pyx_f_10pysamstats_3opt___pyx_unpickle_PileupStat__set_state(struct __pyx_obj_10pysamstats_3opt_PileupStat *, PyObject *); /*proto*/
static PyObject *__pyx_f_10pysamstats_3opt___pyx_unpickle_CountPp__set_state(struct __pyx_obj_10pysamstats_3opt_CountPp *, PyObject *); /*proto*/
static PyObject *__pyx_f_10pysamstats_3opt___pyx_unpickle_Coverage__set_state(struct __pyx_obj_10pysamstats_3opt_Coverage *, PyObject *); /*proto*/
static PyObject *__pyx_f_10pysamstats_3opt___pyx_unpickle_CountPpStrand__set_state(struct __pyx_obj_10pysamstats_3opt_CountPpStrand *, PyObject *); /*proto*/
static PyObject *__pyx_f_10pysamstats_3opt___pyx_unpickle_CoverageStrand__set_state(struct __pyx_obj_10pysamstats_3opt_CoverageStrand *, PyObject *); /*proto*/
static PyObject *__pyx_f_10pysamstats_3opt___pyx_unpickle_CoverageExt__set_state(struct __pyx_obj_10pysamstats_3opt_CoverageExt *, PyObject *); /*proto*/
static PyObject *__pyx_f_10pysamstats_3opt___pyx_unpickle_CountStrand__set_state(struct __pyx_obj_10pysamstats_3opt_CountStrand *, PyObject *); /*proto*/
static PyObject *__pyx_f_10pysamstats_3opt___pyx_unpickle_CoverageExtStrand__set_state(struct __pyx_obj_10pysamstats_3opt_CoverageExtStrand *, PyObject *); /*proto*/
static PyObject *__pyx_f_10pysamstats_3opt___pyx_unpickle_Variation__set_state(struct __pyx_obj_10pysamstats_3opt_Variation *, PyObject *); /*proto*/
static PyObject *__pyx_f_10pysamstats_3opt___pyx_unpickle_VariationStrand__set_state(struct __pyx_obj_10pysamstats_3opt_VariationStrand *, PyObject *); /*proto*/
static PyObject *__pyx_f_10pysamstats_3opt___pyx_unpickle_TlenHelper__set_state(struct __pyx_obj_10pysamstats_3opt_TlenHelper *, PyObject *); /*proto*/
static PyObject *__pyx_f_10pysamstats_3opt___pyx_unpickle_Tlen__set_state(struct __pyx_obj_10pysamstats_3opt_Tlen *, PyObject *); /*proto*/
static PyObject *__pyx_f_10pysamstats_3opt___pyx_unpickle_TlenStrand__set_state(struct __pyx_obj_10pysamstats_3opt_TlenStrand *, PyObject *); /*proto*/
static PyObject *__pyx_f_10pysamstats_3opt___pyx_unpickle_MapqHelper__set_state(struct __pyx_obj_10pysamstats_3opt_MapqHelper *, PyObject *); /*proto*/
static PyObject *__pyx_f_10pysamstats_3opt___pyx_unpickle_Mapq__set_state(struct __pyx_obj_10pysamstats_3opt_Mapq *, PyObject *); /*proto*/
static PyObject *__pyx_f_10pysamstats_3opt___pyx_unpickle_MapqStrand__set_state(struct __pyx_obj_10pysamstats_3opt_MapqStrand *, PyObject *); /*proto*/
static PyObject *__pyx_f_10pysamstats_3opt___pyx_unpickle_BaseqHelper__set_state(struct __pyx_obj_10pysamstats_3opt_BaseqHelper *, PyObject *); /*proto*/
static PyObject *__pyx_f_10pysamstats_3opt___pyx_unpickle_BaseqPpHelper__set_state(struct __pyx_obj_10pysamstats_3opt_BaseqPpHelper *, PyObject *); /*proto*/
static PyObject *__pyx_f_10pysamstats_3opt___pyx_unpickle_Baseq__set_state(struct __pyx_obj_10pysamstats_3opt_Baseq *, PyObject *); /*proto*/
static PyObject *__pyx_f_10pysamstats_3opt___pyx_unpickle_BaseqStrandPpHelper__set_state(struct __pyx_obj_10pysamstats_3opt_BaseqStrandPpHelper *, PyObject *); /*proto*/
static PyObject *__pyx_f_10pysamstats_3opt___pyx_unpickle_BaseqStrand__set_state(struct __pyx_obj_10pysamstats_3opt_BaseqStrand *, PyObject *); /*proto*/
static PyObject *__pyx_f_10pysamstats_3opt___pyx_unpickle_BaseqExt__set_state(struct __pyx_obj_10pysamstats_3opt_BaseqExt *, PyObject *); /*proto*/
static PyObject *__pyx_f_10pysamstats_3opt___pyx_unpickle_BaseqExtStrand__set_state(struct __pyx_obj_10pysamstats_3opt_BaseqExtStrand *, PyObject *); /*proto*/
static PyObject *__pyx_f_10pysamstats_3opt___pyx_unpickle_CoverageGC__set_state(struct __pyx_obj_10pysamstats_3opt_CoverageGC *, PyObject *); /*proto*/
static PyObject *__pyx_f_10pysamstats_3opt___pyx_unpickle_BinnedStat__set_state(struct __pyx_obj_10pysamstats_3opt_BinnedStat *, PyObject *); /*proto*/
static PyObject *__pyx_f_10pysamstats_3opt___pyx_unpickle_CoverageBinned__set_state(struct __pyx_obj_10pysamstats_3opt_CoverageBinned *, PyObject *); /*proto*/
static PyObject *__pyx_f_10pysamstats_3opt___pyx_unpickle_CoverageExtBinned__set_state(struct __pyx_obj_10pysamstats_3opt_CoverageExtBinned *, PyObject *); /*proto*/
static PyObject *__pyx_f_10pysamstats_3opt___pyx_unpickle_MapqBinned__set_state(struct __pyx_obj_10pysamstats_3opt_MapqBinned *, PyObject *); /*proto*/
static PyObject *__pyx_f_10pysamstats_3opt___pyx_unpickle_AlignmentBinned__set_state(struct __pyx_obj_10pysamstats_3opt_AlignmentBinned *, PyObject *); /*proto*/
static PyObject *__pyx_f_10pysamstats_3opt___pyx_unpickle_TlenBinned__set_state(struct __pyx_obj_10pysamstats_3opt_TlenBinned *, PyObject *); /*proto*/
#define __Pyx_MODULE_NAME "pysamstats.opt"
extern int __pyx_module_is_main_pysamstats__opt;
int __pyx_module_is_main_pysamstats__opt = 0;

/* Implementation of 'pysamstats.opt' */
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_MemoryError;
static const char __pyx_k_[] = "=";
static const char __pyx_k_A[] = "A";
static const char __pyx_k_C[] = "C";
static const char __pyx_k_D[] = "D";
static const char __pyx_k_G[] = "G";
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_T[] = "T";
static const char __pyx_k_X[] = "X";
static const char __pyx_k_b[] = "b";
static const char __pyx_k_i[] = "i";
static const char __pyx_k_n[] = "n";
static const char __pyx_k_gc[] = "gc";
static const char __pyx_k_it[] = "it";
static const char __pyx_k_PY2[] = "PY2";
static const char __pyx_k_col[] = "col";
static const char __pyx_k_end[] = "end";
static const char __pyx_k_itc[] = "itc";
static const char __pyx_k_its[] = "its";
static const char __pyx_k_new[] = "__new__";
static const char __pyx_k_pad[] = "pad";
static const char __pyx_k_plp[] = "plp";
static const char __pyx_k_pos[] = "pos";
static const char __pyx_k_rec[] = "rec";
static const char __pyx_k_ref[] = "ref";
static const char __pyx_k_rms[] = "rms";
static const char __pyx_k_std[] = "std";
static const char __pyx_k_sys[] = "sys";
static const char __pyx_k_A_pp[] = "A_pp";
static const char __pyx_k_C_pp[] = "C_pp";
static const char __pyx_k_G_pp[] = "G_pp";
static const char __pyx_k_Mapq[] = "Mapq";
static const char __pyx_k_N_pp[] = "N_pp";
static const char __pyx_k_T_pp[] = "T_pp";
static const char __pyx_k_Tlen[] = "Tlen";
static const char __pyx_k_args[] = "args";
static const char __pyx_k_dict[] = "__dict__";
static const char __pyx_k_main[] = "__main__";
static const char __pyx_k_mean[] = "mean";
static const char __pyx_k_name[] = "__name__";
static const char __pyx_k_read[] = "read";
static const char __pyx_k_rend[] = "rend";
static const char __pyx_k_rtid[] = "rtid";
static const char __pyx_k_send[] = "send";
static const char __pyx_k_stat[] = "stat";
static const char __pyx_k_test[] = "__test__";
static const char __pyx_k_A_fwd[] = "A_fwd";
static const char __pyx_k_A_rev[] = "A_rev";
static const char __pyx_k_Baseq[] = "Baseq";
static const char __pyx_k_C_fwd[] = "C_fwd";
static const char __pyx_k_C_rev[] = "C_rev";
static const char __pyx_k_G_fwd[] = "G_fwd";
static const char __pyx_k_G_rev[] = "G_rev";
static const char __pyx_k_N_fwd[] = "N_fwd";
static const char __pyx_k_N_rev[] = "N_rev";
static const char __pyx_k_T_fwd[] = "T_fwd";
static const char __pyx_k_T_rev[] = "T_rev";
static const char __pyx_k_ascii[] = "ascii";
static const char __pyx_k_chain[] = "chain";
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_fetch[] = "fetch";
static const char __pyx_k_index[] = "index";
static const char __pyx_k_items[] = "items";
static const char __pyx_k_lower[] = "lower";
static const char __pyx_k_numpy[] = "numpy";
static const char __pyx_k_range[] = "range";
static const char __pyx_k_reset[] = "reset";
static const char __pyx_k_round[] = "round";
static const char __pyx_k_sqsum[] = "sqsum";
static const char __pyx_k_start[] = "start";
static const char __pyx_k_sys_2[] = "_sys";
static const char __pyx_k_throw[] = "throw";
static const char __pyx_k_total[] = "total";
static const char __pyx_k_upper[] = "upper";
static const char __pyx_k_around[] = "around";
static const char __pyx_k_chrlen[] = "chrlen";
static const char __pyx_k_curpos[] = "curpos";
static const char __pyx_k_encode[] = "encode";
static const char __pyx_k_fafile[] = "fafile";
static const char __pyx_k_import[] = "__import__";
static const char __pyx_k_kwargs[] = "kwargs";
static const char __pyx_k_no_del[] = "no_del";
static const char __pyx_k_no_dup[] = "no_dup";
static const char __pyx_k_pickle[] = "pickle";
static const char __pyx_k_pileup[] = "pileup";
static const char __pyx_k_reduce[] = "__reduce__";
static const char __pyx_k_rstart[] = "rstart";
static const char __pyx_k_update[] = "update";
static const char __pyx_k_CountPp[] = "CountPp";
static const char __pyx_k_bin_end[] = "bin_end";
static const char __pyx_k_lengths[] = "lengths";
static const char __pyx_k_matches[] = "matches";
static const char __pyx_k_refbase[] = "refbase";
static const char __pyx_k_stepper[] = "stepper";
static const char __pyx_k_A_pp_fwd[] = "A_pp_fwd";
static const char __pyx_k_A_pp_rev[] = "A_pp_rev";
static const char __pyx_k_BaseqExt[] = "BaseqExt";
static const char __pyx_k_C_pp_fwd[] = "C_pp_fwd";
static const char __pyx_k_C_pp_rev[] = "C_pp_rev";
static const char __pyx_k_Coverage[] = "Coverage";
static const char __pyx_k_G_pp_fwd[] = "G_pp_fwd";
static const char __pyx_k_G_pp_rev[] = "G_pp_rev";
static const char __pyx_k_N_pp_fwd[] = "N_pp_fwd";
static const char __pyx_k_N_pp_rev[] = "N_pp_rev";
static const char __pyx_k_T_pp_fwd[] = "T_pp_fwd";
static const char __pyx_k_T_pp_rev[] = "T_pp_rev";
static const char __pyx_k_getrname[] = "getrname";
static const char __pyx_k_getstate[] = "__getstate__";
static const char __pyx_k_max_mapq[] = "max_mapq";
static const char __pyx_k_min_mapq[] = "min_mapq";
static const char __pyx_k_pyx_type[] = "__pyx_type";
static const char __pyx_k_reads_pp[] = "reads_pp";
static const char __pyx_k_rms_mapq[] = "rms_mapq";
static const char __pyx_k_rms_tlen[] = "rms_tlen";
static const char __pyx_k_rootmean[] = "rootmean";
static const char __pyx_k_setstate[] = "__setstate__";
static const char __pyx_k_std_tlen[] = "std_tlen";
static const char __pyx_k_truncate[] = "truncate";
static const char __pyx_k_Variation[] = "Variation";
static const char __pyx_k_bases_all[] = "bases_all";
static const char __pyx_k_bin_start[] = "bin_start";
static const char __pyx_k_deletions[] = "deletions";
static const char __pyx_k_has_coord[] = "has_coord";
static const char __pyx_k_itertools[] = "itertools";
static const char __pyx_k_max_depth[] = "max_depth";
static const char __pyx_k_mean_tlen[] = "mean_tlen";
static const char __pyx_k_min_baseq[] = "min_baseq";
static const char __pyx_k_one_based[] = "one_based";
static const char __pyx_k_pyx_state[] = "__pyx_state";
static const char __pyx_k_reads_all[] = "reads_all";
static const char __pyx_k_reads_fwd[] = "reads_fwd";
static const char __pyx_k_reads_rev[] = "reads_rev";
static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
static const char __pyx_k_reference[] = "reference";
static const char __pyx_k_rms_baseq[] = "rms_baseq";
static const char __pyx_k_BinnedStat[] = "BinnedStat";
static const char __pyx_k_CoverageGC[] = "CoverageGC";
static const char __pyx_k_MapqBinned[] = "MapqBinned";
static const char __pyx_k_MapqHelper[] = "MapqHelper";
static const char __pyx_k_MapqStrand[] = "MapqStrand";
static const char __pyx_k_PileupStat[] = "PileupStat";
static const char __pyx_k_TlenBinned[] = "TlenBinned";
static const char __pyx_k_TlenHelper[] = "TlenHelper";
static const char __pyx_k_TlenStrand[] = "TlenStrand";
static const char __pyx_k_insertions[] = "insertions";
static const char __pyx_k_matches_pp[] = "matches_pp";
static const char __pyx_k_mismatches[] = "mismatches";
static const char __pyx_k_pyx_result[] = "__pyx_result";
static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
static const char __pyx_k_references[] = "references";
static const char __pyx_k_BaseqHelper[] = "BaseqHelper";
static const char __pyx_k_BaseqStrand[] = "BaseqStrand";
static const char __pyx_k_CountStrand[] = "CountStrand";
static const char __pyx_k_CoverageExt[] = "CoverageExt";
static const char __pyx_k_MemoryError[] = "MemoryError";
static const char __pyx_k_PickleError[] = "PickleError";
static const char __pyx_k_count_reads[] = "count_reads";
static const char __pyx_k_get_refbase[] = "get_refbase";
static const char __pyx_k_iter_binned[] = "iter_binned";
static const char __pyx_k_iter_pileup[] = "iter_pileup";
static const char __pyx_k_matches_fwd[] = "matches_fwd";
static const char __pyx_k_matches_rev[] = "matches_rev";
static const char __pyx_k_max_mapq_pp[] = "max_mapq_pp";
static const char __pyx_k_reads_mapq0[] = "reads_mapq0";
static const char __pyx_k_rms_mapq_pp[] = "rms_mapq_pp";
static const char __pyx_k_rms_tlen_pp[] = "rms_tlen_pp";
static const char __pyx_k_stat_pileup[] = "stat_pileup";
static const char __pyx_k_std_tlen_pp[] = "std_tlen_pp";
static const char __pyx_k_window_size[] = "window_size";
static const char __pyx_k_deletions_pp[] = "deletions_pp";
static const char __pyx_k_max_mapq_fwd[] = "max_mapq_fwd";
static const char __pyx_k_max_mapq_rev[] = "max_mapq_rev";
static const char __pyx_k_mean_tlen_pp[] = "mean_tlen_pp";
static const char __pyx_k_parse_region[] = "parse_region";
static const char __pyx_k_pyx_checksum[] = "__pyx_checksum";
static const char __pyx_k_reads_paired[] = "reads_paired";
static const char __pyx_k_reads_pp_fwd[] = "reads_pp_fwd";
static const char __pyx_k_reads_pp_rev[] = "reads_pp_rev";
static const char __pyx_k_rms_baseq_pp[] = "rms_baseq_pp";
static const char __pyx_k_rms_mapq_fwd[] = "rms_mapq_fwd";
static const char __pyx_k_rms_mapq_rev[] = "rms_mapq_rev";
static const char __pyx_k_rms_tlen_fwd[] = "rms_tlen_fwd";
static const char __pyx_k_rms_tlen_rev[] = "rms_tlen_rev";
static const char __pyx_k_std_tlen_fwd[] = "std_tlen_fwd";
static const char __pyx_k_std_tlen_rev[] = "std_tlen_rev";
static const char __pyx_k_string_types[] = "_string_types";
static const char __pyx_k_stringsource[] = "stringsource";
static const char __pyx_k_version_info[] = "version_info";
static const char __pyx_k_BaseqPpHelper[] = "BaseqPpHelper";
static const char __pyx_k_CountPpStrand[] = "CountPpStrand";
static const char __pyx_k_alignmentfile[] = "alignmentfile";
static const char __pyx_k_deletions_fwd[] = "deletions_fwd";
static const char __pyx_k_deletions_rev[] = "deletions_rev";
static const char __pyx_k_insertions_pp[] = "insertions_pp";
static const char __pyx_k_mean_tlen_fwd[] = "mean_tlen_fwd";
static const char __pyx_k_mean_tlen_rev[] = "mean_tlen_rev";
static const char __pyx_k_mismatches_pp[] = "mismatches_pp";
static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
static const char __pyx_k_rms_baseq_fwd[] = "rms_baseq_fwd";
static const char __pyx_k_rms_baseq_rev[] = "rms_baseq_rev";
static const char __pyx_k_window_offset[] = "window_offset";
static const char __pyx_k_BaseqExtStrand[] = "BaseqExtStrand";
static const char __pyx_k_CoverageBinned[] = "CoverageBinned";
static const char __pyx_k_CoverageStrand[] = "CoverageStrand";
static const char __pyx_k_insertions_fwd[] = "insertions_fwd";
static const char __pyx_k_insertions_rev[] = "insertions_rev";
static const char __pyx_k_matches_pp_fwd[] = "matches_pp_fwd";
static const char __pyx_k_matches_pp_rev[] = "matches_pp_rev";
static const char __pyx_k_mismatches_fwd[] = "mismatches_fwd";
static const char __pyx_k_mismatches_rev[] = "mismatches_rev";
static const char __pyx_k_pysamstats_opt[] = "pysamstats.opt";
static const char __pyx_k_reads_faceaway[] = "reads_faceaway";
static const char __pyx_k_reads_mapq0_pp[] = "reads_mapq0_pp";
static const char __pyx_k_AlignmentBinned[] = "AlignmentBinned";
static const char __pyx_k_VariationStrand[] = "VariationStrand";
static const char __pyx_k_max_mapq_pp_fwd[] = "max_mapq_pp_fwd";
static const char __pyx_k_max_mapq_pp_rev[] = "max_mapq_pp_rev";
static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError";
static const char __pyx_k_reads_duplicate[] = "reads_duplicate";
static const char __pyx_k_reads_mapq0_fwd[] = "reads_mapq0_fwd";
static const char __pyx_k_reads_mapq0_rev[] = "reads_mapq0_rev";
static const char __pyx_k_rms_mapq_pp_fwd[] = "rms_mapq_pp_fwd";
static const char __pyx_k_rms_mapq_pp_rev[] = "rms_mapq_pp_rev";
static const char __pyx_k_rms_tlen_pp_fwd[] = "rms_tlen_pp_fwd";
static const char __pyx_k_rms_tlen_pp_rev[] = "rms_tlen_pp_rev";
static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
static const char __pyx_k_std_tlen_pp_fwd[] = "std_tlen_pp_fwd";
static const char __pyx_k_std_tlen_pp_rev[] = "std_tlen_pp_rev";
static const char __pyx_k_deletions_pp_fwd[] = "deletions_pp_fwd";
static const char __pyx_k_deletions_pp_rev[] = "deletions_pp_rev";
static const char __pyx_k_mean_tlen_pp_fwd[] = "mean_tlen_pp_fwd";
static const char __pyx_k_mean_tlen_pp_rev[] = "mean_tlen_pp_rev";
static const char __pyx_k_normalise_coords[] = "normalise_coords";
static const char __pyx_k_reads_paired_fwd[] = "reads_paired_fwd";
static const char __pyx_k_reads_paired_rev[] = "reads_paired_rev";
static const char __pyx_k_rms_baseq_pp_fwd[] = "rms_baseq_pp_fwd";
static const char __pyx_k_rms_baseq_pp_rev[] = "rms_baseq_pp_rev";
static const char __pyx_k_CoverageExtBinned[] = "CoverageExtBinned";
static const char __pyx_k_CoverageExtStrand[] = "CoverageExtStrand";
static const char __pyx_k_insertions_pp_fwd[] = "insertions_pp_fwd";
static const char __pyx_k_insertions_pp_rev[] = "insertions_pp_rev";
static const char __pyx_k_iter_binned_chrom[] = "iter_binned_chrom";
static const char __pyx_k_mismatches_pp_fwd[] = "mismatches_pp_fwd";
static const char __pyx_k_mismatches_pp_rev[] = "mismatches_pp_rev";
static const char __pyx_k_pyx_unpickle_Mapq[] = "__pyx_unpickle_Mapq";
static const char __pyx_k_pyx_unpickle_Tlen[] = "__pyx_unpickle_Tlen";
static const char __pyx_k_reads_softclipped[] = "reads_softclipped";
static const char __pyx_k_rms_baseq_matches[] = "rms_baseq_matches";
static const char __pyx_k_chromosome_is_None[] = "chromosome is None";
static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
static const char __pyx_k_iter_pileup_padded[] = "iter_pileup_padded";
static const char __pyx_k_multiple_iterators[] = "multiple_iterators";
static const char __pyx_k_pysamstats_opt_pyx[] = "pysamstats/opt.pyx";
static const char __pyx_k_pyx_unpickle_Baseq[] = "__pyx_unpickle_Baseq";
static const char __pyx_k_reads_faceaway_fwd[] = "reads_faceaway_fwd";
static const char __pyx_k_reads_faceaway_rev[] = "reads_faceaway_rev";
static const char __pyx_k_reads_mapq0_pp_fwd[] = "reads_mapq0_pp_fwd";
static const char __pyx_k_reads_mapq0_pp_rev[] = "reads_mapq0_pp_rev";
static const char __pyx_k_BaseqStrandPpHelper[] = "BaseqStrandPpHelper";
static const char __pyx_k_iter_pileup_default[] = "iter_pileup_default";
static const char __pyx_k_reads_duplicate_fwd[] = "reads_duplicate_fwd";
static const char __pyx_k_reads_duplicate_rev[] = "reads_duplicate_rev";
static const char __pyx_k_reads_mate_unmapped[] = "reads_mate_unmapped";
static const char __pyx_k_pyx_unpickle_CountPp[] = "__pyx_unpickle_CountPp";
static const char __pyx_k_reads_mate_other_chr[] = "reads_mate_other_chr";
static const char __pyx_k_rms_baseq_matches_pp[] = "rms_baseq_matches_pp";
static const char __pyx_k_rms_baseq_mismatches[] = "rms_baseq_mismatches";
static const char __pyx_k_pyx_unpickle_BaseqExt[] = "__pyx_unpickle_BaseqExt";
static const char __pyx_k_pyx_unpickle_Coverage[] = "__pyx_unpickle_Coverage";
static const char __pyx_k_reads_softclipped_fwd[] = "reads_softclipped_fwd";
static const char __pyx_k_reads_softclipped_rev[] = "reads_softclipped_rev";
static const char __pyx_k_rms_baseq_matches_fwd[] = "rms_baseq_matches_fwd";
static const char __pyx_k_rms_baseq_matches_rev[] = "rms_baseq_matches_rev";
static const char __pyx_k_pyx_unpickle_Variation[] = "__pyx_unpickle_Variation";
static const char __pyx_k_reads_mate_same_strand[] = "reads_mate_same_strand";
static const char __pyx_k_pyx_unpickle_BinnedStat[] = "__pyx_unpickle_BinnedStat";
static const char __pyx_k_pyx_unpickle_CoverageGC[] = "__pyx_unpickle_CoverageGC";
static const char __pyx_k_pyx_unpickle_MapqBinned[] = "__pyx_unpickle_MapqBinned";
static const char __pyx_k_pyx_unpickle_MapqHelper[] = "__pyx_unpickle_MapqHelper";
static const char __pyx_k_pyx_unpickle_MapqStrand[] = "__pyx_unpickle_MapqStrand";
static const char __pyx_k_pyx_unpickle_PileupStat[] = "__pyx_unpickle_PileupStat";
static const char __pyx_k_pyx_unpickle_TlenBinned[] = "__pyx_unpickle_TlenBinned";
static const char __pyx_k_pyx_unpickle_TlenHelper[] = "__pyx_unpickle_TlenHelper";
static const char __pyx_k_pyx_unpickle_TlenStrand[] = "__pyx_unpickle_TlenStrand";
static const char __pyx_k_reads_mate_unmapped_fwd[] = "reads_mate_unmapped_fwd";
static const char __pyx_k_reads_mate_unmapped_rev[] = "reads_mate_unmapped_rev";
static const char __pyx_k_rms_baseq_mismatches_pp[] = "rms_baseq_mismatches_pp";
static const char __pyx_k_iter_pileup_padded_chrom[] = "iter_pileup_padded_chrom";
static const char __pyx_k_pyx_unpickle_BaseqHelper[] = "__pyx_unpickle_BaseqHelper";
static const char __pyx_k_pyx_unpickle_BaseqStrand[] = "__pyx_unpickle_BaseqStrand";
static const char __pyx_k_pyx_unpickle_CountStrand[] = "__pyx_unpickle_CountStrand";
static const char __pyx_k_pyx_unpickle_CoverageExt[] = "__pyx_unpickle_CoverageExt";
static const char __pyx_k_reads_mate_other_chr_fwd[] = "reads_mate_other_chr_fwd";
static const char __pyx_k_reads_mate_other_chr_rev[] = "reads_mate_other_chr_rev";
static const char __pyx_k_rms_baseq_matches_pp_fwd[] = "rms_baseq_matches_pp_fwd";
static const char __pyx_k_rms_baseq_matches_pp_rev[] = "rms_baseq_matches_pp_rev";
static const char __pyx_k_rms_baseq_mismatches_fwd[] = "rms_baseq_mismatches_fwd";
static const char __pyx_k_rms_baseq_mismatches_rev[] = "rms_baseq_mismatches_rev";
static const char __pyx_k_pyx_unpickle_BaseqPpHelper[] = "__pyx_unpickle_BaseqPpHelper";
static const char __pyx_k_pyx_unpickle_CountPpStrand[] = "__pyx_unpickle_CountPpStrand";
static const char __pyx_k_reads_mate_same_strand_fwd[] = "reads_mate_same_strand_fwd";
static const char __pyx_k_reads_mate_same_strand_rev[] = "reads_mate_same_strand_rev";
static const char __pyx_k_pyx_unpickle_BaseqExtStrand[] = "__pyx_unpickle_BaseqExtStrand";
static const char __pyx_k_pyx_unpickle_CoverageBinned[] = "__pyx_unpickle_CoverageBinned";
static const char __pyx_k_pyx_unpickle_CoverageStrand[] = "__pyx_unpickle_CoverageStrand";
static const char __pyx_k_rms_baseq_mismatches_pp_fwd[] = "rms_baseq_mismatches_pp_fwd";
static const char __pyx_k_rms_baseq_mismatches_pp_rev[] = "rms_baseq_mismatches_pp_rev";
static const char __pyx_k_pyx_unpickle_AlignmentBinned[] = "__pyx_unpickle_AlignmentBinned";
static const char __pyx_k_pyx_unpickle_VariationStrand[] = "__pyx_unpickle_VariationStrand";
static const char __pyx_k_pyx_unpickle_BaseqStrandPpHelp[] = "__pyx_unpickle_BaseqStrandPpHelper";
static const char __pyx_k_pyx_unpickle_CoverageExtBinned[] = "__pyx_unpickle_CoverageExtBinned";
static const char __pyx_k_pyx_unpickle_CoverageExtStrand[] = "__pyx_unpickle_CoverageExtStrand";
static const char __pyx_k_Incompatible_checksums_s_vs_0x09[] = "Incompatible checksums (%s vs 0x0931b2d = (all, fwd, rev))";
static const char __pyx_k_Incompatible_checksums_s_vs_0x0f[] = "Incompatible checksums (%s vs 0x0fb9cf5 = (reads))";
static const char __pyx_k_Incompatible_checksums_s_vs_0x14[] = "Incompatible checksums (%s vs 0x145977c = (all, pp))";
static const char __pyx_k_Incompatible_checksums_s_vs_0x2b[] = "Incompatible checksums (%s vs 0x2b98d68 = (max, n, nz, sqsum))";
static const char __pyx_k_Incompatible_checksums_s_vs_0x2c[] = "Incompatible checksums (%s vs 0x2c18efa = (reads_all, tlen, tlen_pp))";
static const char __pyx_k_Incompatible_checksums_s_vs_0x2e[] = "Incompatible checksums (%s vs 0x2efd474 = (d, d2, m, m2, n, s, sq))";
static const char __pyx_k_Incompatible_checksums_s_vs_0x3a[] = "Incompatible checksums (%s vs 0x3af741f = (mapq, mapq_squared_sum, reads_all, reads_mapq0))";
static const char __pyx_k_Incompatible_checksums_s_vs_0x4c[] = "Incompatible checksums (%s vs 0x4ce10ab = (n, n_nodel, sqsum))";
static const char __pyx_k_Incompatible_checksums_s_vs_0x5c[] = "Incompatible checksums (%s vs 0x5c4b584 = (A, C, G, N, T, deletions, insertions, matches, mismatches, reads))";
static const char __pyx_k_Incompatible_checksums_s_vs_0x63[] = "Incompatible checksums (%s vs 0x6319d44 = (reads_all, reads_fwd, reads_rev, tlen, tlen_fwd, tlen_pp, tlen_pp_fwd, tlen_pp_rev, tlen_rev))";
static const char __pyx_k_Incompatible_checksums_s_vs_0x67[] = "Incompatible checksums (%s vs 0x6770c51 = (D, EQ, H, I, M, N, P, S, X, reads_all))";
static const char __pyx_k_Incompatible_checksums_s_vs_0x6e[] = "Incompatible checksums (%s vs 0x6e74246 = (all, fwd, pp, pp_fwd, pp_rev, rev))";
static const char __pyx_k_Incompatible_checksums_s_vs_0x87[] = "Incompatible checksums (%s vs 0x87ba974 = (reads_all, reads_pp, tlen_pp_squared_sum, tlen_pp_sum, tlen_squared_sum, tlen_sum))";
static const char __pyx_k_Incompatible_checksums_s_vs_0xad[] = "Incompatible checksums (%s vs 0xad19be7 = (reads, window_offset, window_size))";
static const char __pyx_k_Incompatible_checksums_s_vs_0xbc[] = "Incompatible checksums (%s vs 0xbc518eb = (all, matches, mismatches))";
static const char __pyx_k_Incompatible_checksums_s_vs_0xc0[] = "Incompatible checksums (%s vs 0xc0c6edb = (all, duplicate, faceaway, mate_other_chr, mate_unmapped, pp, same_strand, softclipped))";
static const char __pyx_k_Incompatible_checksums_s_vs_0xce[] = "Incompatible checksums (%s vs 0xce7bb01 = (reads_all, reads_pp))";
static const char __pyx_k_Incompatible_checksums_s_vs_0xd4[] = "Incompatible checksums (%s vs 0xd41d8cd = ())";
static const char __pyx_k_Incompatible_checksums_s_vs_0xdc[] = "Incompatible checksums (%s vs 0xdc660eb = (reads_all, reads_duplicate, reads_faceaway, reads_mate_other_chr, reads_mate_same_strand, reads_mate_unmapped, reads_pp, reads_softclipped))";
static const char __pyx_k_Incompatible_checksums_s_vs_0xfd[] = "Incompatible checksums (%s vs 0xfde5d67 = (helper))";
static const char __pyx_k_chromosome_not_in_SAM_references[] = "chromosome not in SAM references: %s";
static PyObject *__pyx_kp_s_;
static PyObject *__pyx_n_b_A;
static PyObject *__pyx_n_s_A;
static PyObject *__pyx_n_s_A_fwd;
static PyObject *__pyx_n_s_A_pp;
static PyObject *__pyx_n_s_A_pp_fwd;
static PyObject *__pyx_n_s_A_pp_rev;
static PyObject *__pyx_n_s_A_rev;
static PyObject *__pyx_n_s_AlignmentBinned;
static PyObject *__pyx_n_s_Baseq;
static PyObject *__pyx_n_s_BaseqExt;
static PyObject *__pyx_n_s_BaseqExtStrand;
static PyObject *__pyx_n_s_BaseqHelper;
static PyObject *__pyx_n_s_BaseqPpHelper;
static PyObject *__pyx_n_s_BaseqStrand;
static PyObject *__pyx_n_s_BaseqStrandPpHelper;
static PyObject *__pyx_n_s_BinnedStat;
static PyObject *__pyx_n_b_C;
static PyObject *__pyx_n_s_C;
static PyObject *__pyx_n_s_C_fwd;
static PyObject *__pyx_n_s_C_pp;
static PyObject *__pyx_n_s_C_pp_fwd;
static PyObject *__pyx_n_s_C_pp_rev;
static PyObject *__pyx_n_s_C_rev;
static PyObject *__pyx_n_s_CountPp;
static PyObject *__pyx_n_s_CountPpStrand;
static PyObject *__pyx_n_s_CountStrand;
static PyObject *__pyx_n_s_Coverage;
static PyObject *__pyx_n_s_CoverageBinned;
static PyObject *__pyx_n_s_CoverageExt;
static PyObject *__pyx_n_s_CoverageExtBinned;
static PyObject *__pyx_n_s_CoverageExtStrand;
static PyObject *__pyx_n_s_CoverageGC;
static PyObject *__pyx_n_s_CoverageStrand;
static PyObject *__pyx_n_s_D;
static PyObject *__pyx_n_b_G;
static PyObject *__pyx_n_s_G;
static PyObject *__pyx_n_s_G_fwd;
static PyObject *__pyx_n_s_G_pp;
static PyObject *__pyx_n_s_G_pp_fwd;
static PyObject *__pyx_n_s_G_pp_rev;
static PyObject *__pyx_n_s_G_rev;
static PyObject *__pyx_n_s_H;
static PyObject *__pyx_n_s_I;
static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0x09;
static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0x0f;
static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0x14;
static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0x2b;
static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0x2c;
static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0x2e;
static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0x3a;
static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0x4c;
static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0x5c;
static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0x63;
static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0x67;
static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0x6e;
static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0x87;
static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xad;
static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xbc;
static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xc0;
static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xce;
static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xd4;
static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xdc;
static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xfd;
static PyObject *__pyx_n_s_M;
static PyObject *__pyx_n_s_Mapq;
static PyObject *__pyx_n_s_MapqBinned;
static PyObject *__pyx_n_s_MapqHelper;
static PyObject *__pyx_n_s_MapqStrand;
static PyObject *__pyx_n_s_MemoryError;
static PyObject *__pyx_n_b_N;
static PyObject *__pyx_n_s_N;
static PyObject *__pyx_n_s_N_fwd;
static PyObject *__pyx_n_s_N_pp;
static PyObject *__pyx_n_s_N_pp_fwd;
static PyObject *__pyx_n_s_N_pp_rev;
static PyObject *__pyx_n_s_N_rev;
static PyObject *__pyx_n_s_P;
static PyObject *__pyx_n_s_PY2;
static PyObject *__pyx_n_s_PickleError;
static PyObject *__pyx_n_s_PileupStat;
static PyObject *__pyx_n_s_S;
static PyObject *__pyx_n_b_T;
static PyObject *__pyx_n_s_T;
static PyObject *__pyx_n_s_T_fwd;
static PyObject *__pyx_n_s_T_pp;
static PyObject *__pyx_n_s_T_pp_fwd;
static PyObject *__pyx_n_s_T_pp_rev;
static PyObject *__pyx_n_s_T_rev;
static PyObject *__pyx_n_s_Tlen;
static PyObject *__pyx_n_s_TlenBinned;
static PyObject *__pyx_n_s_TlenHelper;
static PyObject *__pyx_n_s_TlenStrand;
static PyObject *__pyx_n_s_Variation;
static PyObject *__pyx_n_s_VariationStrand;
static PyObject *__pyx_n_s_X;
static PyObject *__pyx_n_s_alignmentfile;
static PyObject *__pyx_n_s_args;
static PyObject *__pyx_n_s_around;
static PyObject *__pyx_n_s_ascii;
static PyObject *__pyx_n_s_b;
static PyObject *__pyx_n_s_bases_all;
static PyObject *__pyx_n_s_bin_end;
static PyObject *__pyx_n_s_bin_start;
static PyObject *__pyx_n_s_chain;
static PyObject *__pyx_n_s_chrlen;
static PyObject *__pyx_n_s_chrom;
static PyObject *__pyx_kp_s_chromosome_is_None;
static PyObject *__pyx_kp_s_chromosome_not_in_SAM_references;
static PyObject *__pyx_n_s_cline_in_traceback;
static PyObject *__pyx_n_s_close;
static PyObject *__pyx_n_s_col;
static PyObject *__pyx_n_s_count;
static PyObject *__pyx_n_s_count_reads;
static PyObject *__pyx_n_s_curpos;
static PyObject *__pyx_n_s_deletions;
static PyObject *__pyx_n_s_deletions_fwd;
static PyObject *__pyx_n_s_deletions_pp;
static PyObject *__pyx_n_s_deletions_pp_fwd;
static PyObject *__pyx_n_s_deletions_pp_rev;
static PyObject *__pyx_n_s_deletions_rev;
static PyObject *__pyx_n_s_dict;
static PyObject *__pyx_n_s_encode;
static PyObject *__pyx_n_s_end;
static PyObject *__pyx_n_s_fafile;
static PyObject *__pyx_n_s_fetch;
static PyObject *__pyx_n_s_gc;
static PyObject *__pyx_n_s_get_refbase;
static PyObject *__pyx_n_s_getrname;
static PyObject *__pyx_n_s_getstate;
static PyObject *__pyx_n_s_has_coord;
static PyObject *__pyx_n_s_i;
static PyObject *__pyx_n_s_import;
static PyObject *__pyx_n_s_index;
static PyObject *__pyx_n_s_insertions;
static PyObject *__pyx_n_s_insertions_fwd;
static PyObject *__pyx_n_s_insertions_pp;
static PyObject *__pyx_n_s_insertions_pp_fwd;
static PyObject *__pyx_n_s_insertions_pp_rev;
static PyObject *__pyx_n_s_insertions_rev;
static PyObject *__pyx_n_s_it;
static PyObject *__pyx_n_s_itc;
static PyObject *__pyx_n_s_items;
static PyObject *__pyx_n_s_iter_binned;
static PyObject *__pyx_n_s_iter_binned_chrom;
static PyObject *__pyx_n_s_iter_pileup;
static PyObject *__pyx_n_s_iter_pileup_default;
static PyObject *__pyx_n_s_iter_pileup_padded;
static PyObject *__pyx_n_s_iter_pileup_padded_chrom;
static PyObject *__pyx_n_s_itertools;
static PyObject *__pyx_n_s_its;
static PyObject *__pyx_n_s_kwargs;
static PyObject *__pyx_n_s_lengths;
static PyObject *__pyx_n_s_lower;
static PyObject *__pyx_n_s_main;
static PyObject *__pyx_n_s_matches;
static PyObject *__pyx_n_s_matches_fwd;
static PyObject *__pyx_n_s_matches_pp;
static PyObject *__pyx_n_s_matches_pp_fwd;
static PyObject *__pyx_n_s_matches_pp_rev;
static PyObject *__pyx_n_s_matches_rev;
static PyObject *__pyx_n_s_max_depth;
static PyObject *__pyx_n_s_max_mapq;
static PyObject *__pyx_n_s_max_mapq_fwd;
static PyObject *__pyx_n_s_max_mapq_pp;
static PyObject *__pyx_n_s_max_mapq_pp_fwd;
static PyObject *__pyx_n_s_max_mapq_pp_rev;
static PyObject *__pyx_n_s_max_mapq_rev;
static PyObject *__pyx_n_s_mean;
static PyObject *__pyx_n_s_mean_tlen;
static PyObject *__pyx_n_s_mean_tlen_fwd;
static PyObject *__pyx_n_s_mean_tlen_pp;
static PyObject *__pyx_n_s_mean_tlen_pp_fwd;
static PyObject *__pyx_n_s_mean_tlen_pp_rev;
static PyObject *__pyx_n_s_mean_tlen_rev;
static PyObject *__pyx_n_s_min_baseq;
static PyObject *__pyx_n_s_min_mapq;
static PyObject *__pyx_n_s_mismatches;
static PyObject *__pyx_n_s_mismatches_fwd;
static PyObject *__pyx_n_s_mismatches_pp;
static PyObject *__pyx_n_s_mismatches_pp_fwd;
static PyObject *__pyx_n_s_mismatches_pp_rev;
static PyObject *__pyx_n_s_mismatches_rev;
static PyObject *__pyx_n_s_multiple_iterators;
static PyObject *__pyx_n_s_n;
static PyObject *__pyx_n_s_name;
static PyObject *__pyx_n_s_new;
static PyObject *__pyx_n_s_no_del;
static PyObject *__pyx_n_s_no_dup;
static PyObject *__pyx_n_s_normalise_coords;
static PyObject *__pyx_n_s_numpy;
static PyObject *__pyx_n_s_one_based;
static PyObject *__pyx_n_s_pad;
static PyObject *__pyx_n_s_parse_region;
static PyObject *__pyx_n_s_pickle;
static PyObject *__pyx_n_s_pileup;
static PyObject *__pyx_n_s_plp;
static PyObject *__pyx_n_s_pos;
static PyObject *__pyx_n_s_pysamstats_opt;
static PyObject *__pyx_kp_s_pysamstats_opt_pyx;
static PyObject *__pyx_n_s_pyx_PickleError;
static PyObject *__pyx_n_s_pyx_checksum;
static PyObject *__pyx_n_s_pyx_result;
static PyObject *__pyx_n_s_pyx_state;
static PyObject *__pyx_n_s_pyx_type;
static PyObject *__pyx_n_s_pyx_unpickle_AlignmentBinned;
static PyObject *__pyx_n_s_pyx_unpickle_Baseq;
static PyObject *__pyx_n_s_pyx_unpickle_BaseqExt;
static PyObject *__pyx_n_s_pyx_unpickle_BaseqExtStrand;
static PyObject *__pyx_n_s_pyx_unpickle_BaseqHelper;
static PyObject *__pyx_n_s_pyx_unpickle_BaseqPpHelper;
static PyObject *__pyx_n_s_pyx_unpickle_BaseqStrand;
static PyObject *__pyx_n_s_pyx_unpickle_BaseqStrandPpHelp;
static PyObject *__pyx_n_s_pyx_unpickle_BinnedStat;
static PyObject *__pyx_n_s_pyx_unpickle_CountPp;
static PyObject *__pyx_n_s_pyx_unpickle_CountPpStrand;
static PyObject *__pyx_n_s_pyx_unpickle_CountStrand;
static PyObject *__pyx_n_s_pyx_unpickle_Coverage;
static PyObject *__pyx_n_s_pyx_unpickle_CoverageBinned;
static PyObject *__pyx_n_s_pyx_unpickle_CoverageExt;
static PyObject *__pyx_n_s_pyx_unpickle_CoverageExtBinned;
static PyObject *__pyx_n_s_pyx_unpickle_CoverageExtStrand;
static PyObject *__pyx_n_s_pyx_unpickle_CoverageGC;
static PyObject *__pyx_n_s_pyx_unpickle_CoverageStrand;
static PyObject *__pyx_n_s_pyx_unpickle_Mapq;
static PyObject *__pyx_n_s_pyx_unpickle_MapqBinned;
static PyObject *__pyx_n_s_pyx_unpickle_MapqHelper;
static PyObject *__pyx_n_s_pyx_unpickle_MapqStrand;
static PyObject *__pyx_n_s_pyx_unpickle_PileupStat;
static PyObject *__pyx_n_s_pyx_unpickle_Tlen;
static PyObject *__pyx_n_s_pyx_unpickle_TlenBinned;
static PyObject *__pyx_n_s_pyx_unpickle_TlenHelper;
static PyObject *__pyx_n_s_pyx_unpickle_TlenStrand;
static PyObject *__pyx_n_s_pyx_unpickle_Variation;
static PyObject *__pyx_n_s_pyx_unpickle_VariationStrand;
static PyObject *__pyx_n_s_pyx_vtable;
static PyObject *__pyx_n_s_range;
static PyObject *__pyx_n_s_read;
static PyObject *__pyx_n_s_reads_all;
static PyObject *__pyx_n_s_reads_duplicate;
static PyObject *__pyx_n_s_reads_duplicate_fwd;
static PyObject *__pyx_n_s_reads_duplicate_rev;
static PyObject *__pyx_n_s_reads_faceaway;
static PyObject *__pyx_n_s_reads_faceaway_fwd;
static PyObject *__pyx_n_s_reads_faceaway_rev;
static PyObject *__pyx_n_s_reads_fwd;
static PyObject *__pyx_n_s_reads_mapq0;
static PyObject *__pyx_n_s_reads_mapq0_fwd;
static PyObject *__pyx_n_s_reads_mapq0_pp;
static PyObject *__pyx_n_s_reads_mapq0_pp_fwd;
static PyObject *__pyx_n_s_reads_mapq0_pp_rev;
static PyObject *__pyx_n_s_reads_mapq0_rev;
static PyObject *__pyx_n_s_reads_mate_other_chr;
static PyObject *__pyx_n_s_reads_mate_other_chr_fwd;
static PyObject *__pyx_n_s_reads_mate_other_chr_rev;
static PyObject *__pyx_n_s_reads_mate_same_strand;
static PyObject *__pyx_n_s_reads_mate_same_strand_fwd;
static PyObject *__pyx_n_s_reads_mate_same_strand_rev;
static PyObject *__pyx_n_s_reads_mate_unmapped;
static PyObject *__pyx_n_s_reads_mate_unmapped_fwd;
static PyObject *__pyx_n_s_reads_mate_unmapped_rev;
static PyObject *__pyx_n_s_reads_paired;
static PyObject *__pyx_n_s_reads_paired_fwd;
static PyObject *__pyx_n_s_reads_paired_rev;
static PyObject *__pyx_n_s_reads_pp;
static PyObject *__pyx_n_s_reads_pp_fwd;
static PyObject *__pyx_n_s_reads_pp_rev;
static PyObject *__pyx_n_s_reads_rev;
static PyObject *__pyx_n_s_reads_softclipped;
static PyObject *__pyx_n_s_reads_softclipped_fwd;
static PyObject *__pyx_n_s_reads_softclipped_rev;
static PyObject *__pyx_n_s_rec;
static PyObject *__pyx_n_s_reduce;
static PyObject *__pyx_n_s_reduce_cython;
static PyObject *__pyx_n_s_reduce_ex;
static PyObject *__pyx_n_s_ref;
static PyObject *__pyx_n_s_refbase;
static PyObject *__pyx_n_s_reference;
static PyObject *__pyx_n_s_references;
static PyObject *__pyx_n_s_rend;
static PyObject *__pyx_n_s_reset;
static PyObject *__pyx_n_s_rms;
static PyObject *__pyx_n_s_rms_baseq;
static PyObject *__pyx_n_s_rms_baseq_fwd;
static PyObject *__pyx_n_s_rms_baseq_matches;
static PyObject *__pyx_n_s_rms_baseq_matches_fwd;
static PyObject *__pyx_n_s_rms_baseq_matches_pp;
static PyObject *__pyx_n_s_rms_baseq_matches_pp_fwd;
static PyObject *__pyx_n_s_rms_baseq_matches_pp_rev;
static PyObject *__pyx_n_s_rms_baseq_matches_rev;
static PyObject *__pyx_n_s_rms_baseq_mismatches;
static PyObject *__pyx_n_s_rms_baseq_mismatches_fwd;
static PyObject *__pyx_n_s_rms_baseq_mismatches_pp;
static PyObject *__pyx_n_s_rms_baseq_mismatches_pp_fwd;
static PyObject *__pyx_n_s_rms_baseq_mismatches_pp_rev;
static PyObject *__pyx_n_s_rms_baseq_mismatches_rev;
static PyObject *__pyx_n_s_rms_baseq_pp;
static PyObject *__pyx_n_s_rms_baseq_pp_fwd;
static PyObject *__pyx_n_s_rms_baseq_pp_rev;
static PyObject *__pyx_n_s_rms_baseq_rev;
static PyObject *__pyx_n_s_rms_mapq;
static PyObject *__pyx_n_s_rms_mapq_fwd;
static PyObject *__pyx_n_s_rms_mapq_pp;
static PyObject *__pyx_n_s_rms_mapq_pp_fwd;
static PyObject *__pyx_n_s_rms_mapq_pp_rev;
static PyObject *__pyx_n_s_rms_mapq_rev;
static PyObject *__pyx_n_s_rms_tlen;
static PyObject *__pyx_n_s_rms_tlen_fwd;
static PyObject *__pyx_n_s_rms_tlen_pp;
static PyObject *__pyx_n_s_rms_tlen_pp_fwd;
static PyObject *__pyx_n_s_rms_tlen_pp_rev;
static PyObject *__pyx_n_s_rms_tlen_rev;
static PyObject *__pyx_n_s_rootmean;
static PyObject *__pyx_n_s_round;
static PyObject *__pyx_n_s_rstart;
static PyObject *__pyx_n_s_rtid;
static PyObject *__pyx_n_s_send;
static PyObject *__pyx_n_s_setstate;
static PyObject *__pyx_n_s_setstate_cython;
static PyObject *__pyx_n_s_sqsum;
static PyObject *__pyx_n_s_start;
static PyObject *__pyx_n_s_stat;
static PyObject *__pyx_n_s_stat_pileup;
static PyObject *__pyx_n_s_std;
static PyObject *__pyx_n_s_std_tlen;
static PyObject *__pyx_n_s_std_tlen_fwd;
static PyObject *__pyx_n_s_std_tlen_pp;
static PyObject *__pyx_n_s_std_tlen_pp_fwd;
static PyObject *__pyx_n_s_std_tlen_pp_rev;
static PyObject *__pyx_n_s_std_tlen_rev;
static PyObject *__pyx_n_s_stepper;
static PyObject *__pyx_n_s_string_types;
static PyObject *__pyx_kp_s_stringsource;
static PyObject *__pyx_n_s_sys;
static PyObject *__pyx_n_s_sys_2;
static PyObject *__pyx_n_s_test;
static PyObject *__pyx_n_s_throw;
static PyObject *__pyx_n_s_total;
static PyObject *__pyx_n_s_truncate;
static PyObject *__pyx_n_s_update;
static PyObject *__pyx_n_s_upper;
static PyObject *__pyx_n_s_version_info;
static PyObject *__pyx_n_s_window_offset;
static PyObject *__pyx_n_s_window_size;
static PyObject *__pyx_pf_10pysamstats_3opt_10PileupStat___reduce_cython__(struct __pyx_obj_10pysamstats_3opt_PileupStat *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_10PileupStat_2__setstate_cython__(struct __pyx_obj_10pysamstats_3opt_PileupStat *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_10pysamstats_3opt_7CountPp___init__(struct __pyx_obj_10pysamstats_3opt_CountPp *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_7CountPp_2reset(struct __pyx_obj_10pysamstats_3opt_CountPp *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_7CountPp_4__reduce_cython__(struct __pyx_obj_10pysamstats_3opt_CountPp *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_7CountPp_6__setstate_cython__(struct __pyx_obj_10pysamstats_3opt_CountPp *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_10pysamstats_3opt_8Coverage___init__(struct __pyx_obj_10pysamstats_3opt_Coverage *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_8Coverage_2reset(struct __pyx_obj_10pysamstats_3opt_Coverage *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_8Coverage_4__reduce_cython__(struct __pyx_obj_10pysamstats_3opt_Coverage *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_8Coverage_6__setstate_cython__(struct __pyx_obj_10pysamstats_3opt_Coverage *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_10pysamstats_3opt_13CountPpStrand___init__(struct __pyx_obj_10pysamstats_3opt_CountPpStrand *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_13CountPpStrand_2reset(struct __pyx_obj_10pysamstats_3opt_CountPpStrand *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_13CountPpStrand_4__reduce_cython__(struct __pyx_obj_10pysamstats_3opt_CountPpStrand *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_13CountPpStrand_6__setstate_cython__(struct __pyx_obj_10pysamstats_3opt_CountPpStrand *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_10pysamstats_3opt_14CoverageStrand___init__(struct __pyx_obj_10pysamstats_3opt_CoverageStrand *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_14CoverageStrand_2reset(struct __pyx_obj_10pysamstats_3opt_CoverageStrand *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_14CoverageStrand_4__reduce_cython__(struct __pyx_obj_10pysamstats_3opt_CoverageStrand *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_14CoverageStrand_6__setstate_cython__(struct __pyx_obj_10pysamstats_3opt_CoverageStrand *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_10pysamstats_3opt_11CoverageExt___init__(struct __pyx_obj_10pysamstats_3opt_CoverageExt *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_11CoverageExt_2reset(struct __pyx_obj_10pysamstats_3opt_CoverageExt *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_11CoverageExt_4__reduce_cython__(struct __pyx_obj_10pysamstats_3opt_CoverageExt *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_11CoverageExt_6__setstate_cython__(struct __pyx_obj_10pysamstats_3opt_CoverageExt *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_10pysamstats_3opt_11CountStrand___init__(struct __pyx_obj_10pysamstats_3opt_CountStrand *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_11CountStrand_2reset(struct __pyx_obj_10pysamstats_3opt_CountStrand *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_11CountStrand_4__reduce_cython__(struct __pyx_obj_10pysamstats_3opt_CountStrand *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_11CountStrand_6__setstate_cython__(struct __pyx_obj_10pysamstats_3opt_CountStrand *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_10pysamstats_3opt_17CoverageExtStrand___init__(struct __pyx_obj_10pysamstats_3opt_CoverageExtStrand *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_17CoverageExtStrand_2reset(struct __pyx_obj_10pysamstats_3opt_CoverageExtStrand *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_17CoverageExtStrand_4__reduce_cython__(struct __pyx_obj_10pysamstats_3opt_CoverageExtStrand *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_17CoverageExtStrand_6__setstate_cython__(struct __pyx_obj_10pysamstats_3opt_CoverageExtStrand *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_10pysamstats_3opt_9Variation___init__(struct __pyx_obj_10pysamstats_3opt_Variation *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_9Variation_2reset(struct __pyx_obj_10pysamstats_3opt_Variation *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_9Variation_4__reduce_cython__(struct __pyx_obj_10pysamstats_3opt_Variation *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_9Variation_6__setstate_cython__(struct __pyx_obj_10pysamstats_3opt_Variation *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_10pysamstats_3opt_15VariationStrand___init__(struct __pyx_obj_10pysamstats_3opt_VariationStrand *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_15VariationStrand_2reset(struct __pyx_obj_10pysamstats_3opt_VariationStrand *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_15VariationStrand_4__reduce_cython__(struct __pyx_obj_10pysamstats_3opt_VariationStrand *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_15VariationStrand_6__setstate_cython__(struct __pyx_obj_10pysamstats_3opt_VariationStrand *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_10pysamstats_3opt_10TlenHelper___init__(struct __pyx_obj_10pysamstats_3opt_TlenHelper *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_10TlenHelper_2reset(struct __pyx_obj_10pysamstats_3opt_TlenHelper *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_10TlenHelper_4variance(struct __pyx_obj_10pysamstats_3opt_TlenHelper *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_10TlenHelper_6std(struct __pyx_obj_10pysamstats_3opt_TlenHelper *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_10TlenHelper_8mean(struct __pyx_obj_10pysamstats_3opt_TlenHelper *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_10TlenHelper_10rms(struct __pyx_obj_10pysamstats_3opt_TlenHelper *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_10TlenHelper_12__reduce_cython__(struct __pyx_obj_10pysamstats_3opt_TlenHelper *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_10TlenHelper_14__setstate_cython__(struct __pyx_obj_10pysamstats_3opt_TlenHelper *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_10pysamstats_3opt_4Tlen___init__(struct __pyx_obj_10pysamstats_3opt_Tlen *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_4Tlen_2reset(struct __pyx_obj_10pysamstats_3opt_Tlen *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_4Tlen_4__reduce_cython__(struct __pyx_obj_10pysamstats_3opt_Tlen *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_4Tlen_6__setstate_cython__(struct __pyx_obj_10pysamstats_3opt_Tlen *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_10pysamstats_3opt_10TlenStrand___init__(struct __pyx_obj_10pysamstats_3opt_TlenStrand *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_10TlenStrand_2reset(struct __pyx_obj_10pysamstats_3opt_TlenStrand *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_10TlenStrand_4__reduce_cython__(struct __pyx_obj_10pysamstats_3opt_TlenStrand *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_10TlenStrand_6__setstate_cython__(struct __pyx_obj_10pysamstats_3opt_TlenStrand *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_10pysamstats_3opt_10MapqHelper___init__(struct __pyx_obj_10pysamstats_3opt_MapqHelper *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_10MapqHelper_2reset(struct __pyx_obj_10pysamstats_3opt_MapqHelper *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_10MapqHelper_4rms(struct __pyx_obj_10pysamstats_3opt_MapqHelper *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_10MapqHelper_6__reduce_cython__(struct __pyx_obj_10pysamstats_3opt_MapqHelper *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_10MapqHelper_8__setstate_cython__(struct __pyx_obj_10pysamstats_3opt_MapqHelper *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_10pysamstats_3opt_4Mapq___init__(struct __pyx_obj_10pysamstats_3opt_Mapq *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_4Mapq_2reset(struct __pyx_obj_10pysamstats_3opt_Mapq *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_4Mapq_4__reduce_cython__(struct __pyx_obj_10pysamstats_3opt_Mapq *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_4Mapq_6__setstate_cython__(struct __pyx_obj_10pysamstats_3opt_Mapq *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_10pysamstats_3opt_10MapqStrand___init__(struct __pyx_obj_10pysamstats_3opt_MapqStrand *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_10MapqStrand_2reset(struct __pyx_obj_10pysamstats_3opt_MapqStrand *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_10MapqStrand_4__reduce_cython__(struct __pyx_obj_10pysamstats_3opt_MapqStrand *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_10MapqStrand_6__setstate_cython__(struct __pyx_obj_10pysamstats_3opt_MapqStrand *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_10pysamstats_3opt_11BaseqHelper___init__(struct __pyx_obj_10pysamstats_3opt_BaseqHelper *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_11BaseqHelper_2reset(struct __pyx_obj_10pysamstats_3opt_BaseqHelper *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_11BaseqHelper_4rms(struct __pyx_obj_10pysamstats_3opt_BaseqHelper *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_11BaseqHelper_6__reduce_cython__(struct __pyx_obj_10pysamstats_3opt_BaseqHelper *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_11BaseqHelper_8__setstate_cython__(struct __pyx_obj_10pysamstats_3opt_BaseqHelper *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_10pysamstats_3opt_13BaseqPpHelper___init__(struct __pyx_obj_10pysamstats_3opt_BaseqPpHelper *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_13BaseqPpHelper_2reset(struct __pyx_obj_10pysamstats_3opt_BaseqPpHelper *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_13BaseqPpHelper_4__reduce_cython__(struct __pyx_obj_10pysamstats_3opt_BaseqPpHelper *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_13BaseqPpHelper_6__setstate_cython__(struct __pyx_obj_10pysamstats_3opt_BaseqPpHelper *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_10pysamstats_3opt_5Baseq___init__(struct __pyx_obj_10pysamstats_3opt_Baseq *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_5Baseq_2reset(struct __pyx_obj_10pysamstats_3opt_Baseq *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_5Baseq_4__reduce_cython__(struct __pyx_obj_10pysamstats_3opt_Baseq *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_5Baseq_6__setstate_cython__(struct __pyx_obj_10pysamstats_3opt_Baseq *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_10pysamstats_3opt_19BaseqStrandPpHelper___init__(struct __pyx_obj_10pysamstats_3opt_BaseqStrandPpHelper *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_19BaseqStrandPpHelper_2reset(struct __pyx_obj_10pysamstats_3opt_BaseqStrandPpHelper *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_19BaseqStrandPpHelper_4__reduce_cython__(struct __pyx_obj_10pysamstats_3opt_BaseqStrandPpHelper *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_19BaseqStrandPpHelper_6__setstate_cython__(struct __pyx_obj_10pysamstats_3opt_BaseqStrandPpHelper *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_10pysamstats_3opt_11BaseqStrand___init__(struct __pyx_obj_10pysamstats_3opt_BaseqStrand *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_11BaseqStrand_2reset(struct __pyx_obj_10pysamstats_3opt_BaseqStrand *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_11BaseqStrand_4__reduce_cython__(struct __pyx_obj_10pysamstats_3opt_BaseqStrand *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_11BaseqStrand_6__setstate_cython__(struct __pyx_obj_10pysamstats_3opt_BaseqStrand *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_10pysamstats_3opt_8BaseqExt___init__(struct __pyx_obj_10pysamstats_3opt_BaseqExt *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_8BaseqExt_2reset(struct __pyx_obj_10pysamstats_3opt_BaseqExt *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_8BaseqExt_4__reduce_cython__(struct __pyx_obj_10pysamstats_3opt_BaseqExt *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_8BaseqExt_6__setstate_cython__(struct __pyx_obj_10pysamstats_3opt_BaseqExt *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_10pysamstats_3opt_14BaseqExtStrand___init__(struct __pyx_obj_10pysamstats_3opt_BaseqExtStrand *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_14BaseqExtStrand_2reset(struct __pyx_obj_10pysamstats_3opt_BaseqExtStrand *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_14BaseqExtStrand_4__reduce_cython__(struct __pyx_obj_10pysamstats_3opt_BaseqExtStrand *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_14BaseqExtStrand_6__setstate_cython__(struct __pyx_obj_10pysamstats_3opt_BaseqExtStrand *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_10pysamstats_3opt_10CoverageGC___init__(struct __pyx_obj_10pysamstats_3opt_CoverageGC *__pyx_v_self, PyObject *__pyx_v_window_size, PyObject *__pyx_v_window_offset); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_10CoverageGC_2reset(struct __pyx_obj_10pysamstats_3opt_CoverageGC *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_10CoverageGC_4__reduce_cython__(struct __pyx_obj_10pysamstats_3opt_CoverageGC *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_10CoverageGC_6__setstate_cython__(struct __pyx_obj_10pysamstats_3opt_CoverageGC *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_10BinnedStat___reduce_cython__(struct __pyx_obj_10pysamstats_3opt_BinnedStat *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_10BinnedStat_2__setstate_cython__(struct __pyx_obj_10pysamstats_3opt_BinnedStat *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_10pysamstats_3opt_14CoverageBinned___init__(struct __pyx_obj_10pysamstats_3opt_CoverageBinned *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_14CoverageBinned_2__reduce_cython__(struct __pyx_obj_10pysamstats_3opt_CoverageBinned *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_14CoverageBinned_4__setstate_cython__(struct __pyx_obj_10pysamstats_3opt_CoverageBinned *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_10pysamstats_3opt_17CoverageExtBinned___init__(struct __pyx_obj_10pysamstats_3opt_CoverageExtBinned *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_17CoverageExtBinned_2__reduce_cython__(struct __pyx_obj_10pysamstats_3opt_CoverageExtBinned *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_17CoverageExtBinned_4__setstate_cython__(struct __pyx_obj_10pysamstats_3opt_CoverageExtBinned *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_10pysamstats_3opt_10MapqBinned___init__(struct __pyx_obj_10pysamstats_3opt_MapqBinned *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_10MapqBinned_2__reduce_cython__(struct __pyx_obj_10pysamstats_3opt_MapqBinned *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_10MapqBinned_4__setstate_cython__(struct __pyx_obj_10pysamstats_3opt_MapqBinned *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_10pysamstats_3opt_15AlignmentBinned___init__(struct __pyx_obj_10pysamstats_3opt_AlignmentBinned *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_15AlignmentBinned_2__reduce_cython__(struct __pyx_obj_10pysamstats_3opt_AlignmentBinned *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_15AlignmentBinned_4__setstate_cython__(struct __pyx_obj_10pysamstats_3opt_AlignmentBinned *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_10pysamstats_3opt_10TlenBinned___init__(struct __pyx_obj_10pysamstats_3opt_TlenBinned *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_10TlenBinned_2__reduce_cython__(struct __pyx_obj_10pysamstats_3opt_TlenBinned *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_10TlenBinned_4__setstate_cython__(struct __pyx_obj_10pysamstats_3opt_TlenBinned *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_iter_pileup(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_stat, PyObject *__pyx_v_alignmentfile, PyObject *__pyx_v_fafile, PyObject *__pyx_v_pad, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_2iter_pileup_default(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_stat, PyObject *__pyx_v_alignmentfile, PyObject *__pyx_v_fafile, PyObject *__pyx_v_chrom, PyObject *__pyx_v_start, PyObject *__pyx_v_end, PyObject *__pyx_v_one_based, PyObject *__pyx_v_truncate, PyObject *__pyx_v_stepper, PyObject *__pyx_v_max_depth, int __pyx_v_min_mapq, int __pyx_v_min_baseq, int __pyx_v_no_del, int __pyx_v_no_dup); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_5stat_pileup(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_10pysamstats_3opt_PileupStat *__pyx_v_stat, struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn *__pyx_v_col, struct __pyx_obj_5pysam_17libcalignmentfile_AlignmentFile *__pyx_v_alignmentfile, struct __pyx_obj_5pysam_9libcfaidx_FastaFile *__pyx_v_fafile, int __pyx_v_one_based, int __pyx_v_min_mapq, int __pyx_v_min_baseq, int __pyx_v_no_del, int __pyx_v_no_dup); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_7iter_pileup_padded(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_stat, PyObject *__pyx_v_alignmentfile, PyObject *__pyx_v_fafile, PyObject *__pyx_v_chrom, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_9iter_pileup_padded_chrom(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_10pysamstats_3opt_PileupStat *__pyx_v_stat, PyObject *__pyx_v_alignmentfile, PyObject *__pyx_v_fafile, PyObject *__pyx_v_chrom, PyObject *__pyx_v_start, PyObject *__pyx_v_end, PyObject *__pyx_v_one_based, PyObject *__pyx_v_truncate, PyObject *__pyx_v_stepper, PyObject *__pyx_v_max_depth, PyObject *__pyx_v_min_mapq, PyObject *__pyx_v_min_baseq, PyObject *__pyx_v_no_del, PyObject *__pyx_v_no_dup); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_12get_refbase(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fafile, PyObject *__pyx_v_chrom, PyObject *__pyx_v_pos); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_14iter_binned(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_stat, PyObject *__pyx_v_alignmentfile, PyObject *__pyx_v_fafile, PyObject *__pyx_v_chrom, PyObject *__pyx_v_window_size, PyObject *__pyx_v_window_offset, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_16iter_binned_chrom(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_10pysamstats_3opt_BinnedStat *__pyx_v_stat, struct __pyx_obj_5pysam_17libcalignmentfile_AlignmentFile *__pyx_v_alignmentfile, struct __pyx_obj_5pysam_9libcfaidx_FastaFile *__pyx_v_fafile, PyObject *__pyx_v_chrom, PyObject *__pyx_v_start, PyObject *__pyx_v_end, PyObject *__pyx_v_one_based, int __pyx_v_window_size, int __pyx_v_window_offset, int __pyx_v_min_mapq, int __pyx_v_no_dup); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_19normalise_coords(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5pysam_17libcalignmentfile_AlignmentFile *__pyx_v_alignmentfile, PyObject *__pyx_v_chrom, PyObject *__pyx_v_start, PyObject *__pyx_v_end, PyObject *__pyx_v_one_based); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_21rootmean(CYTHON_UNUSED PyObject *__pyx_self, uint64_t __pyx_v_sqsum, int __pyx_v_count); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_23mean(CYTHON_UNUSED PyObject *__pyx_self, int64_t __pyx_v_total, int __pyx_v_count); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_25count_reads(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5pysam_17libcalignmentfile_AlignmentFile *__pyx_v_alignmentfile, PyObject *__pyx_v_chrom, PyObject *__pyx_v_start, PyObject *__pyx_v_end); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_27__pyx_unpickle_PileupStat(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_29__pyx_unpickle_CountPp(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_31__pyx_unpickle_Coverage(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_33__pyx_unpickle_CountPpStrand(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_35__pyx_unpickle_CoverageStrand(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_37__pyx_unpickle_CoverageExt(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_39__pyx_unpickle_CountStrand(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_41__pyx_unpickle_CoverageExtStrand(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_43__pyx_unpickle_Variation(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_45__pyx_unpickle_VariationStrand(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_47__pyx_unpickle_TlenHelper(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_49__pyx_unpickle_Tlen(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_51__pyx_unpickle_TlenStrand(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_53__pyx_unpickle_MapqHelper(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_55__pyx_unpickle_Mapq(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_57__pyx_unpickle_MapqStrand(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_59__pyx_unpickle_BaseqHelper(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_61__pyx_unpickle_BaseqPpHelper(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_63__pyx_unpickle_Baseq(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_65__pyx_unpickle_BaseqStrandPpHelper(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_67__pyx_unpickle_BaseqStrand(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_69__pyx_unpickle_BaseqExt(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_71__pyx_unpickle_BaseqExtStrand(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_73__pyx_unpickle_CoverageGC(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_75__pyx_unpickle_BinnedStat(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_77__pyx_unpickle_CoverageBinned(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_79__pyx_unpickle_CoverageExtBinned(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_81__pyx_unpickle_MapqBinned(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_83__pyx_unpickle_AlignmentBinned(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_10pysamstats_3opt_85__pyx_unpickle_TlenBinned(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* 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_10pysamstats_3opt_PileupStat(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_10pysamstats_3opt_CountPp(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_10pysamstats_3opt_Coverage(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_10pysamstats_3opt_CountPpStrand(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_10pysamstats_3opt_CoverageStrand(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_10pysamstats_3opt_CoverageExt(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_10pysamstats_3opt_CountStrand(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_10pysamstats_3opt_CoverageExtStrand(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_10pysamstats_3opt_Variation(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_10pysamstats_3opt_VariationStrand(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_10pysamstats_3opt_TlenHelper(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_10pysamstats_3opt_Tlen(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_10pysamstats_3opt_TlenStrand(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_10pysamstats_3opt_MapqHelper(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_10pysamstats_3opt_Mapq(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_10pysamstats_3opt_MapqStrand(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_10pysamstats_3opt_BaseqHelper(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_10pysamstats_3opt_BaseqPpHelper(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_10pysamstats_3opt_Baseq(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_10pysamstats_3opt_BaseqStrandPpHelper(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_10pysamstats_3opt_BaseqStrand(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_10pysamstats_3opt_BaseqExt(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_10pysamstats_3opt_BaseqExtStrand(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_10pysamstats_3opt_CoverageGC(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_10pysamstats_3opt_BinnedStat(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_10pysamstats_3opt_CoverageBinned(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_10pysamstats_3opt_CoverageExtBinned(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_10pysamstats_3opt_MapqBinned(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_10pysamstats_3opt_AlignmentBinned(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_10pysamstats_3opt_TlenBinned(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_10pysamstats_3opt___pyx_scope_struct__iter_pileup_default(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_10pysamstats_3opt___pyx_scope_struct_1_iter_pileup_padded_chrom(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_10pysamstats_3opt___pyx_scope_struct_2_iter_binned_chrom(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static PyObject *__pyx_int_2;
static PyObject *__pyx_int_300;
static PyObject *__pyx_int_9640749;
static PyObject *__pyx_int_16489717;
static PyObject *__pyx_int_21337980;
static PyObject *__pyx_int_45714792;
static PyObject *__pyx_int_46239482;
static PyObject *__pyx_int_49271924;
static PyObject *__pyx_int_61830175;
static PyObject *__pyx_int_80613547;
static PyObject *__pyx_int_96777604;
static PyObject *__pyx_int_103914820;
static PyObject *__pyx_int_108465233;
static PyObject *__pyx_int_115819078;
static PyObject *__pyx_int_142322036;
static PyObject *__pyx_int_181509095;
static PyObject *__pyx_int_197466347;
static PyObject *__pyx_int_202141403;
static PyObject *__pyx_int_216513281;
static PyObject *__pyx_int_222419149;
static PyObject *__pyx_int_231104747;
static PyObject *__pyx_int_266231143;
static PyObject *__pyx_tuple__5;
static PyObject *__pyx_tuple__6;
static PyObject *__pyx_tuple__8;
static PyObject *__pyx_tuple__9;
static PyObject *__pyx_tuple__11;
static PyObject *__pyx_tuple__13;
static PyObject *__pyx_tuple__14;
static PyObject *__pyx_tuple__16;
static PyObject *__pyx_tuple__18;
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_tuple__45;
static PyObject *__pyx_tuple__47;
static PyObject *__pyx_tuple__49;
static PyObject *__pyx_tuple__51;
static PyObject *__pyx_tuple__53;
static PyObject *__pyx_tuple__55;
static PyObject *__pyx_tuple__57;
static PyObject *__pyx_tuple__59;
static PyObject *__pyx_tuple__61;
static PyObject *__pyx_tuple__63;
static PyObject *__pyx_tuple__65;
static PyObject *__pyx_tuple__67;
static PyObject *__pyx_tuple__69;
static PyObject *__pyx_tuple__71;
static PyObject *__pyx_tuple__73;
static PyObject *__pyx_tuple__75;
static PyObject *__pyx_tuple__77;
static PyObject *__pyx_tuple__79;
static PyObject *__pyx_tuple__81;
static PyObject *__pyx_tuple__83;
static PyObject *__pyx_tuple__85;
static PyObject *__pyx_codeobj__2;
static PyObject *__pyx_codeobj__3;
static PyObject *__pyx_codeobj__4;
static PyObject *__pyx_codeobj__7;
static PyObject *__pyx_codeobj__10;
static PyObject *__pyx_codeobj__12;
static PyObject *__pyx_codeobj__15;
static PyObject *__pyx_codeobj__17;
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;
static PyObject *__pyx_codeobj__46;
static PyObject *__pyx_codeobj__48;
static PyObject *__pyx_codeobj__50;
static PyObject *__pyx_codeobj__52;
static PyObject *__pyx_codeobj__54;
static PyObject *__pyx_codeobj__56;
static PyObject *__pyx_codeobj__58;
static PyObject *__pyx_codeobj__60;
static PyObject *__pyx_codeobj__62;
static PyObject *__pyx_codeobj__64;
static PyObject *__pyx_codeobj__66;
static PyObject *__pyx_codeobj__68;
static PyObject *__pyx_codeobj__70;
static PyObject *__pyx_codeobj__72;
static PyObject *__pyx_codeobj__74;
static PyObject *__pyx_codeobj__76;
static PyObject *__pyx_codeobj__78;
static PyObject *__pyx_codeobj__80;
static PyObject *__pyx_codeobj__82;
static PyObject *__pyx_codeobj__84;
static PyObject *__pyx_codeobj__86;
/* Late includes */

/* "pysamstats/opt.pyx":77
 * cdef class PileupStat(object):
 * 
 *     cdef dict rec(self, chrom, pos, FastaFile fafile, bytes refbase):             # <<<<<<<<<<<<<<
 *         return dict()
 * 
 */

static PyObject *__pyx_f_10pysamstats_3opt_10PileupStat_rec(CYTHON_UNUSED struct __pyx_obj_10pysamstats_3opt_PileupStat *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_chrom, CYTHON_UNUSED PyObject *__pyx_v_pos, CYTHON_UNUSED struct __pyx_obj_5pysam_9libcfaidx_FastaFile *__pyx_v_fafile, CYTHON_UNUSED PyObject *__pyx_v_refbase) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("rec", 0);

  /* "pysamstats/opt.pyx":78
 * 
 *     cdef dict rec(self, chrom, pos, FastaFile fafile, bytes refbase):
 *         return dict()             # <<<<<<<<<<<<<<
 * 
 *     cdef void recv(self, bam_pileup1_t* read, PileupColumn col, bytes refbase):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pysamstats/opt.pyx":77
 * cdef class PileupStat(object):
 * 
 *     cdef dict rec(self, chrom, pos, FastaFile fafile, bytes refbase):             # <<<<<<<<<<<<<<
 *         return dict()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysamstats.opt.PileupStat.rec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":80
 *         return dict()
 * 
 *     cdef void recv(self, bam_pileup1_t* read, PileupColumn col, bytes refbase):             # <<<<<<<<<<<<<<
 *         pass
 * 
 */

static void __pyx_f_10pysamstats_3opt_10PileupStat_recv(CYTHON_UNUSED struct __pyx_obj_10pysamstats_3opt_PileupStat *__pyx_v_self, CYTHON_UNUSED bam_pileup1_t *__pyx_v_read, CYTHON_UNUSED struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn *__pyx_v_col, CYTHON_UNUSED PyObject *__pyx_v_refbase) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("recv", 0);

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

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_10PileupStat_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pysamstats_3opt_10PileupStat___reduce_cython__[] = "PileupStat.__reduce_cython__(self)";
static PyObject *__pyx_pw_10pysamstats_3opt_10PileupStat_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_10PileupStat___reduce_cython__(((struct __pyx_obj_10pysamstats_3opt_PileupStat *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pysamstats_3opt_10PileupStat___reduce_cython__(struct __pyx_obj_10pysamstats_3opt_PileupStat *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  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;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = ()             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __Pyx_INCREF(__pyx_empty_tuple);
  __pyx_v_state = __pyx_empty_tuple;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = ()
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         state += (_dict,)
 */
  __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__dict = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":7
 *     state = ()
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
  __pyx_t_2 = (__pyx_v__dict != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
 */
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
    __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "(tree fragment)":9
 *     if _dict is not None:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = False
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = ()
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
    goto __pyx_L3;
  }

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = False             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_PileupStat, (type(self), 0xd41d8cd, None), state
 */
  /*else*/ {
    __pyx_v_use_setstate = 0;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_PileupStat, (type(self), 0xd41d8cd, None), state
 *     else:
 */
  __pyx_t_3 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":13
 *         use_setstate = False
 *     if use_setstate:
 *         return __pyx_unpickle_PileupStat, (type(self), 0xd41d8cd, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_PileupStat, (type(self), 0xd41d8cd, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_PileupStat); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_222419149);
    __Pyx_GIVEREF(__pyx_int_222419149);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_222419149);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_PileupStat, (type(self), 0xd41d8cd, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_PileupStat, (type(self), 0xd41d8cd, None), state
 *     else:
 *         return __pyx_unpickle_PileupStat, (type(self), 0xd41d8cd, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_PileupStat__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_PileupStat); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_222419149);
    __Pyx_GIVEREF(__pyx_int_222419149);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_222419149);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
    __pyx_t_5 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pysamstats.opt.PileupStat.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_PileupStat, (type(self), 0xd41d8cd, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_PileupStat__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_10PileupStat_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_10pysamstats_3opt_10PileupStat_2__setstate_cython__[] = "PileupStat.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_10pysamstats_3opt_10PileupStat_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_10PileupStat_2__setstate_cython__(((struct __pyx_obj_10pysamstats_3opt_PileupStat *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_10pysamstats_3opt_10PileupStat_2__setstate_cython__(struct __pyx_obj_10pysamstats_3opt_PileupStat *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_PileupStat, (type(self), 0xd41d8cd, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_PileupStat__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
 */
  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_10pysamstats_3opt___pyx_unpickle_PileupStat__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_PileupStat, (type(self), 0xd41d8cd, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_PileupStat__set_state(self, __pyx_state)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysamstats.opt.PileupStat.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":94
 *         int all, pp
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.reset()
 * 
 */

/* Python wrapper */
static int __pyx_pw_10pysamstats_3opt_7CountPp_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_10pysamstats_3opt_7CountPp_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
  __pyx_r = __pyx_pf_10pysamstats_3opt_7CountPp___init__(((struct __pyx_obj_10pysamstats_3opt_CountPp *)__pyx_v_self));

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

static int __pyx_pf_10pysamstats_3opt_7CountPp___init__(struct __pyx_obj_10pysamstats_3opt_CountPp *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "pysamstats/opt.pyx":95
 * 
 *     def __init__(self):
 *         self.reset()             # <<<<<<<<<<<<<<
 * 
 *     def reset(self):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 95, __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, 95, __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;

  /* "pysamstats/opt.pyx":94
 *         int all, pp
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.reset()
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysamstats.opt.CountPp.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":97
 *         self.reset()
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         self.all = self.pp = 0
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_7CountPp_3reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pysamstats_3opt_7CountPp_2reset[] = "CountPp.reset(self)";
static PyObject *__pyx_pw_10pysamstats_3opt_7CountPp_3reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reset (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_7CountPp_2reset(((struct __pyx_obj_10pysamstats_3opt_CountPp *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pysamstats_3opt_7CountPp_2reset(struct __pyx_obj_10pysamstats_3opt_CountPp *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reset", 0);

  /* "pysamstats/opt.pyx":98
 * 
 *     def reset(self):
 *         self.all = self.pp = 0             # <<<<<<<<<<<<<<
 * 
 *     cdef void incr(self, bint is_proper_pair):
 */
  __pyx_v_self->all = 0;
  __pyx_v_self->pp = 0;

  /* "pysamstats/opt.pyx":97
 *         self.reset()
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         self.all = self.pp = 0
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":100
 *         self.all = self.pp = 0
 * 
 *     cdef void incr(self, bint is_proper_pair):             # <<<<<<<<<<<<<<
 *         self.all += 1
 *         if is_proper_pair:
 */

static void __pyx_f_10pysamstats_3opt_7CountPp_incr(struct __pyx_obj_10pysamstats_3opt_CountPp *__pyx_v_self, int __pyx_v_is_proper_pair) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("incr", 0);

  /* "pysamstats/opt.pyx":101
 * 
 *     cdef void incr(self, bint is_proper_pair):
 *         self.all += 1             # <<<<<<<<<<<<<<
 *         if is_proper_pair:
 *             self.pp += 1
 */
  __pyx_v_self->all = (__pyx_v_self->all + 1);

  /* "pysamstats/opt.pyx":102
 *     cdef void incr(self, bint is_proper_pair):
 *         self.all += 1
 *         if is_proper_pair:             # <<<<<<<<<<<<<<
 *             self.pp += 1
 * 
 */
  __pyx_t_1 = (__pyx_v_is_proper_pair != 0);
  if (__pyx_t_1) {

    /* "pysamstats/opt.pyx":103
 *         self.all += 1
 *         if is_proper_pair:
 *             self.pp += 1             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_v_self->pp = (__pyx_v_self->pp + 1);

    /* "pysamstats/opt.pyx":102
 *     cdef void incr(self, bint is_proper_pair):
 *         self.all += 1
 *         if is_proper_pair:             # <<<<<<<<<<<<<<
 *             self.pp += 1
 * 
 */
  }

  /* "pysamstats/opt.pyx":100
 *         self.all = self.pp = 0
 * 
 *     cdef void incr(self, bint is_proper_pair):             # <<<<<<<<<<<<<<
 *         self.all += 1
 *         if is_proper_pair:
 */

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

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_7CountPp_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pysamstats_3opt_7CountPp_4__reduce_cython__[] = "CountPp.__reduce_cython__(self)";
static PyObject *__pyx_pw_10pysamstats_3opt_7CountPp_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_7CountPp_4__reduce_cython__(((struct __pyx_obj_10pysamstats_3opt_CountPp *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pysamstats_3opt_7CountPp_4__reduce_cython__(struct __pyx_obj_10pysamstats_3opt_CountPp *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  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;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self.all, self.pp)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->all); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->pp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_v_state = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self.all, self.pp)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         state += (_dict,)
 */
  __pyx_t_3 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v__dict = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":7
 *     state = (self.all, self.pp)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
  __pyx_t_4 = (__pyx_v__dict != Py_None);
  __pyx_t_5 = (__pyx_t_4 != 0);
  if (__pyx_t_5) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v__dict);
    __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "(tree fragment)":9
 *     if _dict is not None:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = False
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = (self.all, self.pp)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
    goto __pyx_L3;
  }

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = False             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_CountPp, (type(self), 0x145977c, None), state
 */
  /*else*/ {
    __pyx_v_use_setstate = 0;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_CountPp, (type(self), 0x145977c, None), state
 *     else:
 */
  __pyx_t_5 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_5) {

    /* "(tree fragment)":13
 *         use_setstate = False
 *     if use_setstate:
 *         return __pyx_unpickle_CountPp, (type(self), 0x145977c, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_CountPp, (type(self), 0x145977c, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pyx_unpickle_CountPp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_21337980);
    __Pyx_GIVEREF(__pyx_int_21337980);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_21337980);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_3, 2, Py_None);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
    __pyx_t_2 = 0;
    __pyx_t_3 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_CountPp, (type(self), 0x145977c, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_CountPp, (type(self), 0x145977c, None), state
 *     else:
 *         return __pyx_unpickle_CountPp, (type(self), 0x145977c, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_CountPp__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pyx_unpickle_CountPp); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_21337980);
    __Pyx_GIVEREF(__pyx_int_21337980);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_21337980);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_state);
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
    __pyx_t_1 = 0;
    __pyx_t_3 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysamstats.opt.CountPp.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_CountPp, (type(self), 0x145977c, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_CountPp__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_7CountPp_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_10pysamstats_3opt_7CountPp_6__setstate_cython__[] = "CountPp.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_10pysamstats_3opt_7CountPp_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_7CountPp_6__setstate_cython__(((struct __pyx_obj_10pysamstats_3opt_CountPp *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_10pysamstats_3opt_7CountPp_6__setstate_cython__(struct __pyx_obj_10pysamstats_3opt_CountPp *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_CountPp, (type(self), 0x145977c, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_CountPp__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
 */
  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_10pysamstats_3opt___pyx_unpickle_CountPp__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_CountPp, (type(self), 0x145977c, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_CountPp__set_state(self, __pyx_state)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysamstats.opt.CountPp.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":112
 *         CountPp reads
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.reads = CountPp()
 *         self.reset()
 */

/* Python wrapper */
static int __pyx_pw_10pysamstats_3opt_8Coverage_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_10pysamstats_3opt_8Coverage_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
  __pyx_r = __pyx_pf_10pysamstats_3opt_8Coverage___init__(((struct __pyx_obj_10pysamstats_3opt_Coverage *)__pyx_v_self));

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

static int __pyx_pf_10pysamstats_3opt_8Coverage___init__(struct __pyx_obj_10pysamstats_3opt_Coverage *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "pysamstats/opt.pyx":113
 * 
 *     def __init__(self):
 *         self.reads = CountPp()             # <<<<<<<<<<<<<<
 *         self.reset()
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_CountPp)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 113, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->reads);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->reads));
  __pyx_v_self->reads = ((struct __pyx_obj_10pysamstats_3opt_CountPp *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":114
 *     def __init__(self):
 *         self.reads = CountPp()
 *         self.reset()             # <<<<<<<<<<<<<<
 * 
 *     def reset(self):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 114, __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, 114, __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;

  /* "pysamstats/opt.pyx":112
 *         CountPp reads
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.reads = CountPp()
 *         self.reset()
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysamstats.opt.Coverage.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":116
 *         self.reset()
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         self.reads.reset()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_8Coverage_3reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pysamstats_3opt_8Coverage_2reset[] = "Coverage.reset(self)";
static PyObject *__pyx_pw_10pysamstats_3opt_8Coverage_3reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reset (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_8Coverage_2reset(((struct __pyx_obj_10pysamstats_3opt_Coverage *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pysamstats_3opt_8Coverage_2reset(struct __pyx_obj_10pysamstats_3opt_Coverage *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("reset", 0);

  /* "pysamstats/opt.pyx":117
 * 
 *     def reset(self):
 *         self.reads.reset()             # <<<<<<<<<<<<<<
 * 
 *     cdef void recv(self, bam_pileup1_t* read, PileupColumn col, bytes refbase):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->reads), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 117, __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, 117, __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;

  /* "pysamstats/opt.pyx":116
 *         self.reset()
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         self.reads.reset()
 * 
 */

  /* 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_AddTraceback("pysamstats.opt.Coverage.reset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":119
 *         self.reads.reset()
 * 
 *     cdef void recv(self, bam_pileup1_t* read, PileupColumn col, bytes refbase):             # <<<<<<<<<<<<<<
 *         cdef:
 *             bint is_proper_pair
 */

static void __pyx_f_10pysamstats_3opt_8Coverage_recv(struct __pyx_obj_10pysamstats_3opt_Coverage *__pyx_v_self, bam_pileup1_t *__pyx_v_read, CYTHON_UNUSED struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn *__pyx_v_col, CYTHON_UNUSED PyObject *__pyx_v_refbase) {
  int __pyx_v_is_proper_pair;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("recv", 0);

  /* "pysamstats/opt.pyx":124
 * 
 *         # convenience variables
 *         is_proper_pair = <bint>(read.b.core.flag & BAM_FPROPER_PAIR)             # <<<<<<<<<<<<<<
 * 
 *         # do the counting
 */
  __pyx_v_is_proper_pair = ((__pyx_v_read->b->core.flag & 2) != 0);

  /* "pysamstats/opt.pyx":127
 * 
 *         # do the counting
 *         self.reads.incr(is_proper_pair)             # <<<<<<<<<<<<<<
 * 
 *     cdef dict rec(self, chrom, pos, FastaFile fafile, bytes refbase):
 */
  ((struct __pyx_vtabstruct_10pysamstats_3opt_CountPp *)__pyx_v_self->reads->__pyx_vtab)->incr(__pyx_v_self->reads, __pyx_v_is_proper_pair);

  /* "pysamstats/opt.pyx":119
 *         self.reads.reset()
 * 
 *     cdef void recv(self, bam_pileup1_t* read, PileupColumn col, bytes refbase):             # <<<<<<<<<<<<<<
 *         cdef:
 *             bint is_proper_pair
 */

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

/* "pysamstats/opt.pyx":129
 *         self.reads.incr(is_proper_pair)
 * 
 *     cdef dict rec(self, chrom, pos, FastaFile fafile, bytes refbase):             # <<<<<<<<<<<<<<
 * 
 *         # make record
 */

static PyObject *__pyx_f_10pysamstats_3opt_8Coverage_rec(struct __pyx_obj_10pysamstats_3opt_Coverage *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_chrom, CYTHON_UNUSED PyObject *__pyx_v_pos, CYTHON_UNUSED struct __pyx_obj_5pysam_9libcfaidx_FastaFile *__pyx_v_fafile, CYTHON_UNUSED PyObject *__pyx_v_refbase) {
  PyObject *__pyx_v_rec = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("rec", 0);

  /* "pysamstats/opt.pyx":132
 * 
 *         # make record
 *         rec = {'reads_all': self.reads.all,             # <<<<<<<<<<<<<<
 *                'reads_pp': self.reads.pp}
 * 
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 132, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->reads->all); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 132, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_all, __pyx_t_2) < 0) __PYX_ERR(0, 132, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":133
 *         # make record
 *         rec = {'reads_all': self.reads.all,
 *                'reads_pp': self.reads.pp}             # <<<<<<<<<<<<<<
 * 
 *         # reset counters
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->reads->pp); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 133, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_pp, __pyx_t_2) < 0) __PYX_ERR(0, 132, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_rec = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":136
 * 
 *         # reset counters
 *         self.reset()             # <<<<<<<<<<<<<<
 * 
 *         return rec
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 136, __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, 136, __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;

  /* "pysamstats/opt.pyx":138
 *         self.reset()
 * 
 *         return rec             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_rec);
  __pyx_r = __pyx_v_rec;
  goto __pyx_L0;

  /* "pysamstats/opt.pyx":129
 *         self.reads.incr(is_proper_pair)
 * 
 *     cdef dict rec(self, chrom, pos, FastaFile fafile, bytes refbase):             # <<<<<<<<<<<<<<
 * 
 *         # make record
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysamstats.opt.Coverage.rec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rec);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_8Coverage_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pysamstats_3opt_8Coverage_4__reduce_cython__[] = "Coverage.__reduce_cython__(self)";
static PyObject *__pyx_pw_10pysamstats_3opt_8Coverage_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_8Coverage_4__reduce_cython__(((struct __pyx_obj_10pysamstats_3opt_Coverage *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pysamstats_3opt_8Coverage_4__reduce_cython__(struct __pyx_obj_10pysamstats_3opt_Coverage *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  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;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self.reads,)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->reads));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->reads));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self->reads));
  __pyx_v_state = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self.reads,)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         state += (_dict,)
 */
  __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__dict = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":7
 *     state = (self.reads,)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
  __pyx_t_2 = (__pyx_v__dict != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
 */
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
    __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "(tree fragment)":9
 *     if _dict is not None:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = self.reads is not None
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = (self.reads,)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
    goto __pyx_L3;
  }

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = self.reads is not None             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_Coverage, (type(self), 0x0fb9cf5, None), state
 */
  /*else*/ {
    __pyx_t_3 = (((PyObject *)__pyx_v_self->reads) != Py_None);
    __pyx_v_use_setstate = __pyx_t_3;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.reads is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_Coverage, (type(self), 0x0fb9cf5, None), state
 *     else:
 */
  __pyx_t_3 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":13
 *         use_setstate = self.reads is not None
 *     if use_setstate:
 *         return __pyx_unpickle_Coverage, (type(self), 0x0fb9cf5, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_Coverage, (type(self), 0x0fb9cf5, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_Coverage); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_16489717);
    __Pyx_GIVEREF(__pyx_int_16489717);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_16489717);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.reads is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_Coverage, (type(self), 0x0fb9cf5, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_Coverage, (type(self), 0x0fb9cf5, None), state
 *     else:
 *         return __pyx_unpickle_Coverage, (type(self), 0x0fb9cf5, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_Coverage__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_Coverage); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_16489717);
    __Pyx_GIVEREF(__pyx_int_16489717);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_16489717);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
    __pyx_t_5 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pysamstats.opt.Coverage.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_Coverage, (type(self), 0x0fb9cf5, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_Coverage__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_8Coverage_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_10pysamstats_3opt_8Coverage_6__setstate_cython__[] = "Coverage.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_10pysamstats_3opt_8Coverage_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_8Coverage_6__setstate_cython__(((struct __pyx_obj_10pysamstats_3opt_Coverage *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_10pysamstats_3opt_8Coverage_6__setstate_cython__(struct __pyx_obj_10pysamstats_3opt_Coverage *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_Coverage, (type(self), 0x0fb9cf5, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_Coverage__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
 */
  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_10pysamstats_3opt___pyx_unpickle_Coverage__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_Coverage, (type(self), 0x0fb9cf5, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_Coverage__set_state(self, __pyx_state)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysamstats.opt.Coverage.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":151
 *         int all, pp, fwd, rev, pp_fwd, pp_rev
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.reset()
 * 
 */

/* Python wrapper */
static int __pyx_pw_10pysamstats_3opt_13CountPpStrand_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_10pysamstats_3opt_13CountPpStrand_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
  __pyx_r = __pyx_pf_10pysamstats_3opt_13CountPpStrand___init__(((struct __pyx_obj_10pysamstats_3opt_CountPpStrand *)__pyx_v_self));

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

static int __pyx_pf_10pysamstats_3opt_13CountPpStrand___init__(struct __pyx_obj_10pysamstats_3opt_CountPpStrand *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "pysamstats/opt.pyx":152
 * 
 *     def __init__(self):
 *         self.reset()             # <<<<<<<<<<<<<<
 * 
 *     def reset(self):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 152, __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, 152, __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;

  /* "pysamstats/opt.pyx":151
 *         int all, pp, fwd, rev, pp_fwd, pp_rev
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.reset()
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysamstats.opt.CountPpStrand.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":154
 *         self.reset()
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         self.all = self.fwd = self.rev = self.pp = self.pp_fwd = self.pp_rev = 0
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_13CountPpStrand_3reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pysamstats_3opt_13CountPpStrand_2reset[] = "CountPpStrand.reset(self)";
static PyObject *__pyx_pw_10pysamstats_3opt_13CountPpStrand_3reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reset (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_13CountPpStrand_2reset(((struct __pyx_obj_10pysamstats_3opt_CountPpStrand *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pysamstats_3opt_13CountPpStrand_2reset(struct __pyx_obj_10pysamstats_3opt_CountPpStrand *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reset", 0);

  /* "pysamstats/opt.pyx":155
 * 
 *     def reset(self):
 *         self.all = self.fwd = self.rev = self.pp = self.pp_fwd = self.pp_rev = 0             # <<<<<<<<<<<<<<
 * 
 *     cdef void incr(self, bint is_reverse, bint is_proper_pair):
 */
  __pyx_v_self->all = 0;
  __pyx_v_self->fwd = 0;
  __pyx_v_self->rev = 0;
  __pyx_v_self->pp = 0;
  __pyx_v_self->pp_fwd = 0;
  __pyx_v_self->pp_rev = 0;

  /* "pysamstats/opt.pyx":154
 *         self.reset()
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         self.all = self.fwd = self.rev = self.pp = self.pp_fwd = self.pp_rev = 0
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":157
 *         self.all = self.fwd = self.rev = self.pp = self.pp_fwd = self.pp_rev = 0
 * 
 *     cdef void incr(self, bint is_reverse, bint is_proper_pair):             # <<<<<<<<<<<<<<
 *         self.all += 1
 *         if is_reverse:
 */

static void __pyx_f_10pysamstats_3opt_13CountPpStrand_incr(struct __pyx_obj_10pysamstats_3opt_CountPpStrand *__pyx_v_self, int __pyx_v_is_reverse, int __pyx_v_is_proper_pair) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("incr", 0);

  /* "pysamstats/opt.pyx":158
 * 
 *     cdef void incr(self, bint is_reverse, bint is_proper_pair):
 *         self.all += 1             # <<<<<<<<<<<<<<
 *         if is_reverse:
 *             self.rev += 1
 */
  __pyx_v_self->all = (__pyx_v_self->all + 1);

  /* "pysamstats/opt.pyx":159
 *     cdef void incr(self, bint is_reverse, bint is_proper_pair):
 *         self.all += 1
 *         if is_reverse:             # <<<<<<<<<<<<<<
 *             self.rev += 1
 *             if is_proper_pair:
 */
  __pyx_t_1 = (__pyx_v_is_reverse != 0);
  if (__pyx_t_1) {

    /* "pysamstats/opt.pyx":160
 *         self.all += 1
 *         if is_reverse:
 *             self.rev += 1             # <<<<<<<<<<<<<<
 *             if is_proper_pair:
 *                 self.pp += 1
 */
    __pyx_v_self->rev = (__pyx_v_self->rev + 1);

    /* "pysamstats/opt.pyx":161
 *         if is_reverse:
 *             self.rev += 1
 *             if is_proper_pair:             # <<<<<<<<<<<<<<
 *                 self.pp += 1
 *                 self.pp_rev += 1
 */
    __pyx_t_1 = (__pyx_v_is_proper_pair != 0);
    if (__pyx_t_1) {

      /* "pysamstats/opt.pyx":162
 *             self.rev += 1
 *             if is_proper_pair:
 *                 self.pp += 1             # <<<<<<<<<<<<<<
 *                 self.pp_rev += 1
 *         else:
 */
      __pyx_v_self->pp = (__pyx_v_self->pp + 1);

      /* "pysamstats/opt.pyx":163
 *             if is_proper_pair:
 *                 self.pp += 1
 *                 self.pp_rev += 1             # <<<<<<<<<<<<<<
 *         else:
 *             self.fwd += 1
 */
      __pyx_v_self->pp_rev = (__pyx_v_self->pp_rev + 1);

      /* "pysamstats/opt.pyx":161
 *         if is_reverse:
 *             self.rev += 1
 *             if is_proper_pair:             # <<<<<<<<<<<<<<
 *                 self.pp += 1
 *                 self.pp_rev += 1
 */
    }

    /* "pysamstats/opt.pyx":159
 *     cdef void incr(self, bint is_reverse, bint is_proper_pair):
 *         self.all += 1
 *         if is_reverse:             # <<<<<<<<<<<<<<
 *             self.rev += 1
 *             if is_proper_pair:
 */
    goto __pyx_L3;
  }

  /* "pysamstats/opt.pyx":165
 *                 self.pp_rev += 1
 *         else:
 *             self.fwd += 1             # <<<<<<<<<<<<<<
 *             if is_proper_pair:
 *                 self.pp += 1
 */
  /*else*/ {
    __pyx_v_self->fwd = (__pyx_v_self->fwd + 1);

    /* "pysamstats/opt.pyx":166
 *         else:
 *             self.fwd += 1
 *             if is_proper_pair:             # <<<<<<<<<<<<<<
 *                 self.pp += 1
 *                 self.pp_fwd += 1
 */
    __pyx_t_1 = (__pyx_v_is_proper_pair != 0);
    if (__pyx_t_1) {

      /* "pysamstats/opt.pyx":167
 *             self.fwd += 1
 *             if is_proper_pair:
 *                 self.pp += 1             # <<<<<<<<<<<<<<
 *                 self.pp_fwd += 1
 * 
 */
      __pyx_v_self->pp = (__pyx_v_self->pp + 1);

      /* "pysamstats/opt.pyx":168
 *             if is_proper_pair:
 *                 self.pp += 1
 *                 self.pp_fwd += 1             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __pyx_v_self->pp_fwd = (__pyx_v_self->pp_fwd + 1);

      /* "pysamstats/opt.pyx":166
 *         else:
 *             self.fwd += 1
 *             if is_proper_pair:             # <<<<<<<<<<<<<<
 *                 self.pp += 1
 *                 self.pp_fwd += 1
 */
    }
  }
  __pyx_L3:;

  /* "pysamstats/opt.pyx":157
 *         self.all = self.fwd = self.rev = self.pp = self.pp_fwd = self.pp_rev = 0
 * 
 *     cdef void incr(self, bint is_reverse, bint is_proper_pair):             # <<<<<<<<<<<<<<
 *         self.all += 1
 *         if is_reverse:
 */

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

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_13CountPpStrand_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pysamstats_3opt_13CountPpStrand_4__reduce_cython__[] = "CountPpStrand.__reduce_cython__(self)";
static PyObject *__pyx_pw_10pysamstats_3opt_13CountPpStrand_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_13CountPpStrand_4__reduce_cython__(((struct __pyx_obj_10pysamstats_3opt_CountPpStrand *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pysamstats_3opt_13CountPpStrand_4__reduce_cython__(struct __pyx_obj_10pysamstats_3opt_CountPpStrand *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  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;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_t_9;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self.all, self.fwd, self.pp, self.pp_fwd, self.pp_rev, self.rev)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->all); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->fwd); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_self->pp); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_self->pp_fwd); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_self->pp_rev); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_self->rev); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = PyTuple_New(6); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_7, 4, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_7, 5, __pyx_t_6);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_6 = 0;
  __pyx_v_state = ((PyObject*)__pyx_t_7);
  __pyx_t_7 = 0;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self.all, self.fwd, self.pp, self.pp_fwd, self.pp_rev, self.rev)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         state += (_dict,)
 */
  __pyx_t_7 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_v__dict = __pyx_t_7;
  __pyx_t_7 = 0;

  /* "(tree fragment)":7
 *     state = (self.all, self.fwd, self.pp, self.pp_fwd, self.pp_rev, self.rev)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
  __pyx_t_8 = (__pyx_v__dict != Py_None);
  __pyx_t_9 = (__pyx_t_8 != 0);
  if (__pyx_t_9) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
 */
    __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v__dict);
    __pyx_t_6 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_6));
    __pyx_t_6 = 0;

    /* "(tree fragment)":9
 *     if _dict is not None:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = False
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = (self.all, self.fwd, self.pp, self.pp_fwd, self.pp_rev, self.rev)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
    goto __pyx_L3;
  }

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = False             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_CountPpStrand, (type(self), 0x6e74246, None), state
 */
  /*else*/ {
    __pyx_v_use_setstate = 0;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_CountPpStrand, (type(self), 0x6e74246, None), state
 *     else:
 */
  __pyx_t_9 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_9) {

    /* "(tree fragment)":13
 *         use_setstate = False
 *     if use_setstate:
 *         return __pyx_unpickle_CountPpStrand, (type(self), 0x6e74246, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_CountPpStrand, (type(self), 0x6e74246, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_pyx_unpickle_CountPpStrand); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_115819078);
    __Pyx_GIVEREF(__pyx_int_115819078);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_int_115819078);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_7, 2, Py_None);
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_7);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
    __pyx_t_6 = 0;
    __pyx_t_7 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_CountPpStrand, (type(self), 0x6e74246, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_CountPpStrand, (type(self), 0x6e74246, None), state
 *     else:
 *         return __pyx_unpickle_CountPpStrand, (type(self), 0x6e74246, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_CountPpStrand__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_CountPpStrand); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_115819078);
    __Pyx_GIVEREF(__pyx_int_115819078);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_int_115819078);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_v_state);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_7);
    __pyx_t_5 = 0;
    __pyx_t_7 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

  /* 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_7);
  __Pyx_AddTraceback("pysamstats.opt.CountPpStrand.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_CountPpStrand, (type(self), 0x6e74246, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_CountPpStrand__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_13CountPpStrand_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_10pysamstats_3opt_13CountPpStrand_6__setstate_cython__[] = "CountPpStrand.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_10pysamstats_3opt_13CountPpStrand_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_13CountPpStrand_6__setstate_cython__(((struct __pyx_obj_10pysamstats_3opt_CountPpStrand *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_10pysamstats_3opt_13CountPpStrand_6__setstate_cython__(struct __pyx_obj_10pysamstats_3opt_CountPpStrand *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_CountPpStrand, (type(self), 0x6e74246, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_CountPpStrand__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
 */
  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_10pysamstats_3opt___pyx_unpickle_CountPpStrand__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_CountPpStrand, (type(self), 0x6e74246, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_CountPpStrand__set_state(self, __pyx_state)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysamstats.opt.CountPpStrand.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":177
 *         CountPpStrand reads
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.reads = CountPpStrand()
 *         self.reset()
 */

/* Python wrapper */
static int __pyx_pw_10pysamstats_3opt_14CoverageStrand_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_10pysamstats_3opt_14CoverageStrand_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
  __pyx_r = __pyx_pf_10pysamstats_3opt_14CoverageStrand___init__(((struct __pyx_obj_10pysamstats_3opt_CoverageStrand *)__pyx_v_self));

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

static int __pyx_pf_10pysamstats_3opt_14CoverageStrand___init__(struct __pyx_obj_10pysamstats_3opt_CoverageStrand *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "pysamstats/opt.pyx":178
 * 
 *     def __init__(self):
 *         self.reads = CountPpStrand()             # <<<<<<<<<<<<<<
 *         self.reset()
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_CountPpStrand)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 178, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->reads);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->reads));
  __pyx_v_self->reads = ((struct __pyx_obj_10pysamstats_3opt_CountPpStrand *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":179
 *     def __init__(self):
 *         self.reads = CountPpStrand()
 *         self.reset()             # <<<<<<<<<<<<<<
 * 
 *     def reset(self):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 179, __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, 179, __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;

  /* "pysamstats/opt.pyx":177
 *         CountPpStrand reads
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.reads = CountPpStrand()
 *         self.reset()
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysamstats.opt.CoverageStrand.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":181
 *         self.reset()
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         self.reads.reset()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_14CoverageStrand_3reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pysamstats_3opt_14CoverageStrand_2reset[] = "CoverageStrand.reset(self)";
static PyObject *__pyx_pw_10pysamstats_3opt_14CoverageStrand_3reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reset (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_14CoverageStrand_2reset(((struct __pyx_obj_10pysamstats_3opt_CoverageStrand *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pysamstats_3opt_14CoverageStrand_2reset(struct __pyx_obj_10pysamstats_3opt_CoverageStrand *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("reset", 0);

  /* "pysamstats/opt.pyx":182
 * 
 *     def reset(self):
 *         self.reads.reset()             # <<<<<<<<<<<<<<
 * 
 *     cdef void recv(self, bam_pileup1_t* read, PileupColumn col, bytes refbase):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->reads), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 182, __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, 182, __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;

  /* "pysamstats/opt.pyx":181
 *         self.reset()
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         self.reads.reset()
 * 
 */

  /* 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_AddTraceback("pysamstats.opt.CoverageStrand.reset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":184
 *         self.reads.reset()
 * 
 *     cdef void recv(self, bam_pileup1_t* read, PileupColumn col, bytes refbase):             # <<<<<<<<<<<<<<
 *         cdef:
 *             uint32_t flag
 */

static void __pyx_f_10pysamstats_3opt_14CoverageStrand_recv(struct __pyx_obj_10pysamstats_3opt_CoverageStrand *__pyx_v_self, bam_pileup1_t *__pyx_v_read, CYTHON_UNUSED struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn *__pyx_v_col, CYTHON_UNUSED PyObject *__pyx_v_refbase) {
  uint32_t __pyx_v_flag;
  int __pyx_v_is_proper_pair;
  int __pyx_v_is_reverse;
  __Pyx_RefNannyDeclarations
  uint16_t __pyx_t_1;
  __Pyx_RefNannySetupContext("recv", 0);

  /* "pysamstats/opt.pyx":191
 * 
 *         # convenience variables
 *         flag = read.b.core.flag             # <<<<<<<<<<<<<<
 *         is_reverse = <bint>(flag & BAM_FREVERSE)
 *         is_proper_pair = <bint>(flag & BAM_FPROPER_PAIR)
 */
  __pyx_t_1 = __pyx_v_read->b->core.flag;
  __pyx_v_flag = __pyx_t_1;

  /* "pysamstats/opt.pyx":192
 *         # convenience variables
 *         flag = read.b.core.flag
 *         is_reverse = <bint>(flag & BAM_FREVERSE)             # <<<<<<<<<<<<<<
 *         is_proper_pair = <bint>(flag & BAM_FPROPER_PAIR)
 * 
 */
  __pyx_v_is_reverse = ((__pyx_v_flag & 16) != 0);

  /* "pysamstats/opt.pyx":193
 *         flag = read.b.core.flag
 *         is_reverse = <bint>(flag & BAM_FREVERSE)
 *         is_proper_pair = <bint>(flag & BAM_FPROPER_PAIR)             # <<<<<<<<<<<<<<
 * 
 *         # do the counting
 */
  __pyx_v_is_proper_pair = ((__pyx_v_flag & 2) != 0);

  /* "pysamstats/opt.pyx":196
 * 
 *         # do the counting
 *         self.reads.incr(is_reverse, is_proper_pair)             # <<<<<<<<<<<<<<
 * 
 *     cdef dict rec(self, chrom, pos, FastaFile fafile, bytes refbase):
 */
  ((struct __pyx_vtabstruct_10pysamstats_3opt_CountPpStrand *)__pyx_v_self->reads->__pyx_vtab)->incr(__pyx_v_self->reads, __pyx_v_is_reverse, __pyx_v_is_proper_pair);

  /* "pysamstats/opt.pyx":184
 *         self.reads.reset()
 * 
 *     cdef void recv(self, bam_pileup1_t* read, PileupColumn col, bytes refbase):             # <<<<<<<<<<<<<<
 *         cdef:
 *             uint32_t flag
 */

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

/* "pysamstats/opt.pyx":198
 *         self.reads.incr(is_reverse, is_proper_pair)
 * 
 *     cdef dict rec(self, chrom, pos, FastaFile fafile, bytes refbase):             # <<<<<<<<<<<<<<
 * 
 *         # make record
 */

static PyObject *__pyx_f_10pysamstats_3opt_14CoverageStrand_rec(struct __pyx_obj_10pysamstats_3opt_CoverageStrand *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_chrom, CYTHON_UNUSED PyObject *__pyx_v_pos, CYTHON_UNUSED struct __pyx_obj_5pysam_9libcfaidx_FastaFile *__pyx_v_fafile, CYTHON_UNUSED PyObject *__pyx_v_refbase) {
  PyObject *__pyx_v_rec = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("rec", 0);

  /* "pysamstats/opt.pyx":201
 * 
 *         # make record
 *         rec = {'reads_all': self.reads.all,             # <<<<<<<<<<<<<<
 *                'reads_fwd': self.reads.fwd,
 *                'reads_rev': self.reads.rev,
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 201, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->reads->all); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 201, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_all, __pyx_t_2) < 0) __PYX_ERR(0, 201, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":202
 *         # make record
 *         rec = {'reads_all': self.reads.all,
 *                'reads_fwd': self.reads.fwd,             # <<<<<<<<<<<<<<
 *                'reads_rev': self.reads.rev,
 *                'reads_pp': self.reads.pp,
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->reads->fwd); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_fwd, __pyx_t_2) < 0) __PYX_ERR(0, 201, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":203
 *         rec = {'reads_all': self.reads.all,
 *                'reads_fwd': self.reads.fwd,
 *                'reads_rev': self.reads.rev,             # <<<<<<<<<<<<<<
 *                'reads_pp': self.reads.pp,
 *                'reads_pp_fwd': self.reads.pp_fwd,
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->reads->rev); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_rev, __pyx_t_2) < 0) __PYX_ERR(0, 201, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":204
 *                'reads_fwd': self.reads.fwd,
 *                'reads_rev': self.reads.rev,
 *                'reads_pp': self.reads.pp,             # <<<<<<<<<<<<<<
 *                'reads_pp_fwd': self.reads.pp_fwd,
 *                'reads_pp_rev': self.reads.pp_rev}
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->reads->pp); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 204, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_pp, __pyx_t_2) < 0) __PYX_ERR(0, 201, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":205
 *                'reads_rev': self.reads.rev,
 *                'reads_pp': self.reads.pp,
 *                'reads_pp_fwd': self.reads.pp_fwd,             # <<<<<<<<<<<<<<
 *                'reads_pp_rev': self.reads.pp_rev}
 * 
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->reads->pp_fwd); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 205, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_pp_fwd, __pyx_t_2) < 0) __PYX_ERR(0, 201, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":206
 *                'reads_pp': self.reads.pp,
 *                'reads_pp_fwd': self.reads.pp_fwd,
 *                'reads_pp_rev': self.reads.pp_rev}             # <<<<<<<<<<<<<<
 * 
 *         # reset counters
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->reads->pp_rev); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 206, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_pp_rev, __pyx_t_2) < 0) __PYX_ERR(0, 201, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_rec = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":209
 * 
 *         # reset counters
 *         self.reset()             # <<<<<<<<<<<<<<
 * 
 *         return rec
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 209, __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, 209, __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;

  /* "pysamstats/opt.pyx":211
 *         self.reset()
 * 
 *         return rec             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_rec);
  __pyx_r = __pyx_v_rec;
  goto __pyx_L0;

  /* "pysamstats/opt.pyx":198
 *         self.reads.incr(is_reverse, is_proper_pair)
 * 
 *     cdef dict rec(self, chrom, pos, FastaFile fafile, bytes refbase):             # <<<<<<<<<<<<<<
 * 
 *         # make record
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysamstats.opt.CoverageStrand.rec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rec);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_14CoverageStrand_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pysamstats_3opt_14CoverageStrand_4__reduce_cython__[] = "CoverageStrand.__reduce_cython__(self)";
static PyObject *__pyx_pw_10pysamstats_3opt_14CoverageStrand_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_14CoverageStrand_4__reduce_cython__(((struct __pyx_obj_10pysamstats_3opt_CoverageStrand *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pysamstats_3opt_14CoverageStrand_4__reduce_cython__(struct __pyx_obj_10pysamstats_3opt_CoverageStrand *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  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;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self.reads,)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->reads));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->reads));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self->reads));
  __pyx_v_state = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self.reads,)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         state += (_dict,)
 */
  __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__dict = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":7
 *     state = (self.reads,)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
  __pyx_t_2 = (__pyx_v__dict != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
 */
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
    __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "(tree fragment)":9
 *     if _dict is not None:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = self.reads is not None
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = (self.reads,)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
    goto __pyx_L3;
  }

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = self.reads is not None             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_CoverageStrand, (type(self), 0x0fb9cf5, None), state
 */
  /*else*/ {
    __pyx_t_3 = (((PyObject *)__pyx_v_self->reads) != Py_None);
    __pyx_v_use_setstate = __pyx_t_3;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.reads is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_CoverageStrand, (type(self), 0x0fb9cf5, None), state
 *     else:
 */
  __pyx_t_3 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":13
 *         use_setstate = self.reads is not None
 *     if use_setstate:
 *         return __pyx_unpickle_CoverageStrand, (type(self), 0x0fb9cf5, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_CoverageStrand, (type(self), 0x0fb9cf5, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_CoverageStrand); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_16489717);
    __Pyx_GIVEREF(__pyx_int_16489717);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_16489717);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.reads is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_CoverageStrand, (type(self), 0x0fb9cf5, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_CoverageStrand, (type(self), 0x0fb9cf5, None), state
 *     else:
 *         return __pyx_unpickle_CoverageStrand, (type(self), 0x0fb9cf5, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_CoverageStrand__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_CoverageStrand); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_16489717);
    __Pyx_GIVEREF(__pyx_int_16489717);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_16489717);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
    __pyx_t_5 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pysamstats.opt.CoverageStrand.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_CoverageStrand, (type(self), 0x0fb9cf5, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_CoverageStrand__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_14CoverageStrand_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_10pysamstats_3opt_14CoverageStrand_6__setstate_cython__[] = "CoverageStrand.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_10pysamstats_3opt_14CoverageStrand_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_14CoverageStrand_6__setstate_cython__(((struct __pyx_obj_10pysamstats_3opt_CoverageStrand *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_10pysamstats_3opt_14CoverageStrand_6__setstate_cython__(struct __pyx_obj_10pysamstats_3opt_CoverageStrand *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_CoverageStrand, (type(self), 0x0fb9cf5, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_CoverageStrand__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
 */
  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_10pysamstats_3opt___pyx_unpickle_CoverageStrand__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_CoverageStrand, (type(self), 0x0fb9cf5, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_CoverageStrand__set_state(self, __pyx_state)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysamstats.opt.CoverageStrand.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":232
 *         int reads_duplicate
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.reset()
 * 
 */

/* Python wrapper */
static int __pyx_pw_10pysamstats_3opt_11CoverageExt_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_10pysamstats_3opt_11CoverageExt_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
  __pyx_r = __pyx_pf_10pysamstats_3opt_11CoverageExt___init__(((struct __pyx_obj_10pysamstats_3opt_CoverageExt *)__pyx_v_self));

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

static int __pyx_pf_10pysamstats_3opt_11CoverageExt___init__(struct __pyx_obj_10pysamstats_3opt_CoverageExt *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "pysamstats/opt.pyx":233
 * 
 *     def __init__(self):
 *         self.reset()             # <<<<<<<<<<<<<<
 * 
 *     def reset(self):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 233, __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, 233, __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;

  /* "pysamstats/opt.pyx":232
 *         int reads_duplicate
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.reset()
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysamstats.opt.CoverageExt.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":235
 *         self.reset()
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         self.reads_all = 0
 *         self.reads_pp = 0
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_11CoverageExt_3reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pysamstats_3opt_11CoverageExt_2reset[] = "CoverageExt.reset(self)";
static PyObject *__pyx_pw_10pysamstats_3opt_11CoverageExt_3reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reset (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_11CoverageExt_2reset(((struct __pyx_obj_10pysamstats_3opt_CoverageExt *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pysamstats_3opt_11CoverageExt_2reset(struct __pyx_obj_10pysamstats_3opt_CoverageExt *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reset", 0);

  /* "pysamstats/opt.pyx":236
 * 
 *     def reset(self):
 *         self.reads_all = 0             # <<<<<<<<<<<<<<
 *         self.reads_pp = 0
 *         self.reads_mate_unmapped = 0
 */
  __pyx_v_self->reads_all = 0;

  /* "pysamstats/opt.pyx":237
 *     def reset(self):
 *         self.reads_all = 0
 *         self.reads_pp = 0             # <<<<<<<<<<<<<<
 *         self.reads_mate_unmapped = 0
 *         self.reads_mate_other_chr = 0
 */
  __pyx_v_self->reads_pp = 0;

  /* "pysamstats/opt.pyx":238
 *         self.reads_all = 0
 *         self.reads_pp = 0
 *         self.reads_mate_unmapped = 0             # <<<<<<<<<<<<<<
 *         self.reads_mate_other_chr = 0
 *         self.reads_mate_same_strand = 0
 */
  __pyx_v_self->reads_mate_unmapped = 0;

  /* "pysamstats/opt.pyx":239
 *         self.reads_pp = 0
 *         self.reads_mate_unmapped = 0
 *         self.reads_mate_other_chr = 0             # <<<<<<<<<<<<<<
 *         self.reads_mate_same_strand = 0
 *         self.reads_faceaway = 0
 */
  __pyx_v_self->reads_mate_other_chr = 0;

  /* "pysamstats/opt.pyx":240
 *         self.reads_mate_unmapped = 0
 *         self.reads_mate_other_chr = 0
 *         self.reads_mate_same_strand = 0             # <<<<<<<<<<<<<<
 *         self.reads_faceaway = 0
 *         self.reads_softclipped = 0
 */
  __pyx_v_self->reads_mate_same_strand = 0;

  /* "pysamstats/opt.pyx":241
 *         self.reads_mate_other_chr = 0
 *         self.reads_mate_same_strand = 0
 *         self.reads_faceaway = 0             # <<<<<<<<<<<<<<
 *         self.reads_softclipped = 0
 *         self.reads_duplicate = 0
 */
  __pyx_v_self->reads_faceaway = 0;

  /* "pysamstats/opt.pyx":242
 *         self.reads_mate_same_strand = 0
 *         self.reads_faceaway = 0
 *         self.reads_softclipped = 0             # <<<<<<<<<<<<<<
 *         self.reads_duplicate = 0
 * 
 */
  __pyx_v_self->reads_softclipped = 0;

  /* "pysamstats/opt.pyx":243
 *         self.reads_faceaway = 0
 *         self.reads_softclipped = 0
 *         self.reads_duplicate = 0             # <<<<<<<<<<<<<<
 * 
 *     cdef void recv(self, bam_pileup1_t* read, PileupColumn col, bytes refbase):
 */
  __pyx_v_self->reads_duplicate = 0;

  /* "pysamstats/opt.pyx":235
 *         self.reset()
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         self.reads_all = 0
 *         self.reads_pp = 0
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":245
 *         self.reads_duplicate = 0
 * 
 *     cdef void recv(self, bam_pileup1_t* read, PileupColumn col, bytes refbase):             # <<<<<<<<<<<<<<
 *         cdef:
 *             uint32_t flag
 */

static void __pyx_f_10pysamstats_3opt_11CoverageExt_recv(struct __pyx_obj_10pysamstats_3opt_CoverageExt *__pyx_v_self, bam_pileup1_t *__pyx_v_read, struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn *__pyx_v_col, CYTHON_UNUSED PyObject *__pyx_v_refbase) {
  uint32_t __pyx_v_flag;
  int __pyx_v_is_proper_pair;
  int __pyx_v_is_reverse;
  int __pyx_v_is_duplicate;
  int __pyx_v_mate_is_reverse;
  int __pyx_v_tlen;
  int __pyx_v_mate_is_unmapped;
  __Pyx_RefNannyDeclarations
  uint16_t __pyx_t_1;
  int32_t __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("recv", 0);

  /* "pysamstats/opt.pyx":256
 * 
 *         # convenience variables
 *         flag = read.b.core.flag             # <<<<<<<<<<<<<<
 *         is_reverse = <bint>(flag & BAM_FREVERSE)
 *         is_proper_pair = <bint>(flag & BAM_FPROPER_PAIR)
 */
  __pyx_t_1 = __pyx_v_read->b->core.flag;
  __pyx_v_flag = __pyx_t_1;

  /* "pysamstats/opt.pyx":257
 *         # convenience variables
 *         flag = read.b.core.flag
 *         is_reverse = <bint>(flag & BAM_FREVERSE)             # <<<<<<<<<<<<<<
 *         is_proper_pair = <bint>(flag & BAM_FPROPER_PAIR)
 *         is_duplicate = <bint>(flag & BAM_FDUP)
 */
  __pyx_v_is_reverse = ((__pyx_v_flag & 16) != 0);

  /* "pysamstats/opt.pyx":258
 *         flag = read.b.core.flag
 *         is_reverse = <bint>(flag & BAM_FREVERSE)
 *         is_proper_pair = <bint>(flag & BAM_FPROPER_PAIR)             # <<<<<<<<<<<<<<
 *         is_duplicate = <bint>(flag & BAM_FDUP)
 *         mate_is_unmapped = <bint>(flag & BAM_FMUNMAP)
 */
  __pyx_v_is_proper_pair = ((__pyx_v_flag & 2) != 0);

  /* "pysamstats/opt.pyx":259
 *         is_reverse = <bint>(flag & BAM_FREVERSE)
 *         is_proper_pair = <bint>(flag & BAM_FPROPER_PAIR)
 *         is_duplicate = <bint>(flag & BAM_FDUP)             # <<<<<<<<<<<<<<
 *         mate_is_unmapped = <bint>(flag & BAM_FMUNMAP)
 *         mate_is_reverse = <bint>(flag & BAM_FMREVERSE)
 */
  __pyx_v_is_duplicate = ((__pyx_v_flag & 0x400) != 0);

  /* "pysamstats/opt.pyx":260
 *         is_proper_pair = <bint>(flag & BAM_FPROPER_PAIR)
 *         is_duplicate = <bint>(flag & BAM_FDUP)
 *         mate_is_unmapped = <bint>(flag & BAM_FMUNMAP)             # <<<<<<<<<<<<<<
 *         mate_is_reverse = <bint>(flag & BAM_FMREVERSE)
 *         tlen = read.b.core.isize
 */
  __pyx_v_mate_is_unmapped = ((__pyx_v_flag & 8) != 0);

  /* "pysamstats/opt.pyx":261
 *         is_duplicate = <bint>(flag & BAM_FDUP)
 *         mate_is_unmapped = <bint>(flag & BAM_FMUNMAP)
 *         mate_is_reverse = <bint>(flag & BAM_FMREVERSE)             # <<<<<<<<<<<<<<
 *         tlen = read.b.core.isize
 * 
 */
  __pyx_v_mate_is_reverse = ((__pyx_v_flag & 32) != 0);

  /* "pysamstats/opt.pyx":262
 *         mate_is_unmapped = <bint>(flag & BAM_FMUNMAP)
 *         mate_is_reverse = <bint>(flag & BAM_FMREVERSE)
 *         tlen = read.b.core.isize             # <<<<<<<<<<<<<<
 * 
 *         # do the counting
 */
  __pyx_t_2 = __pyx_v_read->b->core.isize;
  __pyx_v_tlen = __pyx_t_2;

  /* "pysamstats/opt.pyx":265
 * 
 *         # do the counting
 *         self.reads_all += 1             # <<<<<<<<<<<<<<
 *         if is_duplicate:
 *             self.reads_duplicate += 1
 */
  __pyx_v_self->reads_all = (__pyx_v_self->reads_all + 1);

  /* "pysamstats/opt.pyx":266
 *         # do the counting
 *         self.reads_all += 1
 *         if is_duplicate:             # <<<<<<<<<<<<<<
 *             self.reads_duplicate += 1
 *         if is_proper_pair:
 */
  __pyx_t_3 = (__pyx_v_is_duplicate != 0);
  if (__pyx_t_3) {

    /* "pysamstats/opt.pyx":267
 *         self.reads_all += 1
 *         if is_duplicate:
 *             self.reads_duplicate += 1             # <<<<<<<<<<<<<<
 *         if is_proper_pair:
 *             self.reads_pp += 1
 */
    __pyx_v_self->reads_duplicate = (__pyx_v_self->reads_duplicate + 1);

    /* "pysamstats/opt.pyx":266
 *         # do the counting
 *         self.reads_all += 1
 *         if is_duplicate:             # <<<<<<<<<<<<<<
 *             self.reads_duplicate += 1
 *         if is_proper_pair:
 */
  }

  /* "pysamstats/opt.pyx":268
 *         if is_duplicate:
 *             self.reads_duplicate += 1
 *         if is_proper_pair:             # <<<<<<<<<<<<<<
 *             self.reads_pp += 1
 *         if mate_is_unmapped:
 */
  __pyx_t_3 = (__pyx_v_is_proper_pair != 0);
  if (__pyx_t_3) {

    /* "pysamstats/opt.pyx":269
 *             self.reads_duplicate += 1
 *         if is_proper_pair:
 *             self.reads_pp += 1             # <<<<<<<<<<<<<<
 *         if mate_is_unmapped:
 *             self.reads_mate_unmapped += 1
 */
    __pyx_v_self->reads_pp = (__pyx_v_self->reads_pp + 1);

    /* "pysamstats/opt.pyx":268
 *         if is_duplicate:
 *             self.reads_duplicate += 1
 *         if is_proper_pair:             # <<<<<<<<<<<<<<
 *             self.reads_pp += 1
 *         if mate_is_unmapped:
 */
  }

  /* "pysamstats/opt.pyx":270
 *         if is_proper_pair:
 *             self.reads_pp += 1
 *         if mate_is_unmapped:             # <<<<<<<<<<<<<<
 *             self.reads_mate_unmapped += 1
 *         elif col.tid != read.b.core.mtid:
 */
  __pyx_t_3 = (__pyx_v_mate_is_unmapped != 0);
  if (__pyx_t_3) {

    /* "pysamstats/opt.pyx":271
 *             self.reads_pp += 1
 *         if mate_is_unmapped:
 *             self.reads_mate_unmapped += 1             # <<<<<<<<<<<<<<
 *         elif col.tid != read.b.core.mtid:
 *             self.reads_mate_other_chr += 1
 */
    __pyx_v_self->reads_mate_unmapped = (__pyx_v_self->reads_mate_unmapped + 1);

    /* "pysamstats/opt.pyx":270
 *         if is_proper_pair:
 *             self.reads_pp += 1
 *         if mate_is_unmapped:             # <<<<<<<<<<<<<<
 *             self.reads_mate_unmapped += 1
 *         elif col.tid != read.b.core.mtid:
 */
    goto __pyx_L5;
  }

  /* "pysamstats/opt.pyx":272
 *         if mate_is_unmapped:
 *             self.reads_mate_unmapped += 1
 *         elif col.tid != read.b.core.mtid:             # <<<<<<<<<<<<<<
 *             self.reads_mate_other_chr += 1
 *         elif (is_reverse and mate_is_reverse) or (not is_reverse and not mate_is_reverse):
 */
  __pyx_t_3 = ((__pyx_v_col->tid != __pyx_v_read->b->core.mtid) != 0);
  if (__pyx_t_3) {

    /* "pysamstats/opt.pyx":273
 *             self.reads_mate_unmapped += 1
 *         elif col.tid != read.b.core.mtid:
 *             self.reads_mate_other_chr += 1             # <<<<<<<<<<<<<<
 *         elif (is_reverse and mate_is_reverse) or (not is_reverse and not mate_is_reverse):
 *             self.reads_mate_same_strand += 1
 */
    __pyx_v_self->reads_mate_other_chr = (__pyx_v_self->reads_mate_other_chr + 1);

    /* "pysamstats/opt.pyx":272
 *         if mate_is_unmapped:
 *             self.reads_mate_unmapped += 1
 *         elif col.tid != read.b.core.mtid:             # <<<<<<<<<<<<<<
 *             self.reads_mate_other_chr += 1
 *         elif (is_reverse and mate_is_reverse) or (not is_reverse and not mate_is_reverse):
 */
    goto __pyx_L5;
  }

  /* "pysamstats/opt.pyx":274
 *         elif col.tid != read.b.core.mtid:
 *             self.reads_mate_other_chr += 1
 *         elif (is_reverse and mate_is_reverse) or (not is_reverse and not mate_is_reverse):             # <<<<<<<<<<<<<<
 *             self.reads_mate_same_strand += 1
 *         elif (is_reverse and tlen > 0) or (not is_reverse and tlen < 0):
 */
  __pyx_t_4 = (__pyx_v_is_reverse != 0);
  if (!__pyx_t_4) {
    goto __pyx_L7_next_or;
  } else {
  }
  __pyx_t_4 = (__pyx_v_mate_is_reverse != 0);
  if (!__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_L7_next_or:;
  __pyx_t_4 = ((!(__pyx_v_is_reverse != 0)) != 0);
  if (__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_4 = ((!(__pyx_v_mate_is_reverse != 0)) != 0);
  __pyx_t_3 = __pyx_t_4;
  __pyx_L6_bool_binop_done:;
  if (__pyx_t_3) {

    /* "pysamstats/opt.pyx":275
 *             self.reads_mate_other_chr += 1
 *         elif (is_reverse and mate_is_reverse) or (not is_reverse and not mate_is_reverse):
 *             self.reads_mate_same_strand += 1             # <<<<<<<<<<<<<<
 *         elif (is_reverse and tlen > 0) or (not is_reverse and tlen < 0):
 *             self.reads_faceaway += 1
 */
    __pyx_v_self->reads_mate_same_strand = (__pyx_v_self->reads_mate_same_strand + 1);

    /* "pysamstats/opt.pyx":274
 *         elif col.tid != read.b.core.mtid:
 *             self.reads_mate_other_chr += 1
 *         elif (is_reverse and mate_is_reverse) or (not is_reverse and not mate_is_reverse):             # <<<<<<<<<<<<<<
 *             self.reads_mate_same_strand += 1
 *         elif (is_reverse and tlen > 0) or (not is_reverse and tlen < 0):
 */
    goto __pyx_L5;
  }

  /* "pysamstats/opt.pyx":276
 *         elif (is_reverse and mate_is_reverse) or (not is_reverse and not mate_is_reverse):
 *             self.reads_mate_same_strand += 1
 *         elif (is_reverse and tlen > 0) or (not is_reverse and tlen < 0):             # <<<<<<<<<<<<<<
 *             self.reads_faceaway += 1
 *         if is_softclipped(read.b):
 */
  __pyx_t_4 = (__pyx_v_is_reverse != 0);
  if (!__pyx_t_4) {
    goto __pyx_L11_next_or;
  } else {
  }
  __pyx_t_4 = ((__pyx_v_tlen > 0) != 0);
  if (!__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L10_bool_binop_done;
  }
  __pyx_L11_next_or:;
  __pyx_t_4 = ((!(__pyx_v_is_reverse != 0)) != 0);
  if (__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L10_bool_binop_done;
  }
  __pyx_t_4 = ((__pyx_v_tlen < 0) != 0);
  __pyx_t_3 = __pyx_t_4;
  __pyx_L10_bool_binop_done:;
  if (__pyx_t_3) {

    /* "pysamstats/opt.pyx":277
 *             self.reads_mate_same_strand += 1
 *         elif (is_reverse and tlen > 0) or (not is_reverse and tlen < 0):
 *             self.reads_faceaway += 1             # <<<<<<<<<<<<<<
 *         if is_softclipped(read.b):
 *             self.reads_softclipped += 1
 */
    __pyx_v_self->reads_faceaway = (__pyx_v_self->reads_faceaway + 1);

    /* "pysamstats/opt.pyx":276
 *         elif (is_reverse and mate_is_reverse) or (not is_reverse and not mate_is_reverse):
 *             self.reads_mate_same_strand += 1
 *         elif (is_reverse and tlen > 0) or (not is_reverse and tlen < 0):             # <<<<<<<<<<<<<<
 *             self.reads_faceaway += 1
 *         if is_softclipped(read.b):
 */
  }
  __pyx_L5:;

  /* "pysamstats/opt.pyx":278
 *         elif (is_reverse and tlen > 0) or (not is_reverse and tlen < 0):
 *             self.reads_faceaway += 1
 *         if is_softclipped(read.b):             # <<<<<<<<<<<<<<
 *             self.reads_softclipped += 1
 * 
 */
  __pyx_t_3 = (__pyx_f_10pysamstats_3opt_is_softclipped(__pyx_v_read->b) != 0);
  if (__pyx_t_3) {

    /* "pysamstats/opt.pyx":279
 *             self.reads_faceaway += 1
 *         if is_softclipped(read.b):
 *             self.reads_softclipped += 1             # <<<<<<<<<<<<<<
 * 
 *     cdef dict rec(self, chrom, pos, FastaFile fafile, bytes refbase):
 */
    __pyx_v_self->reads_softclipped = (__pyx_v_self->reads_softclipped + 1);

    /* "pysamstats/opt.pyx":278
 *         elif (is_reverse and tlen > 0) or (not is_reverse and tlen < 0):
 *             self.reads_faceaway += 1
 *         if is_softclipped(read.b):             # <<<<<<<<<<<<<<
 *             self.reads_softclipped += 1
 * 
 */
  }

  /* "pysamstats/opt.pyx":245
 *         self.reads_duplicate = 0
 * 
 *     cdef void recv(self, bam_pileup1_t* read, PileupColumn col, bytes refbase):             # <<<<<<<<<<<<<<
 *         cdef:
 *             uint32_t flag
 */

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

/* "pysamstats/opt.pyx":281
 *             self.reads_softclipped += 1
 * 
 *     cdef dict rec(self, chrom, pos, FastaFile fafile, bytes refbase):             # <<<<<<<<<<<<<<
 * 
 *         # make record
 */

static PyObject *__pyx_f_10pysamstats_3opt_11CoverageExt_rec(struct __pyx_obj_10pysamstats_3opt_CoverageExt *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_chrom, CYTHON_UNUSED PyObject *__pyx_v_pos, CYTHON_UNUSED struct __pyx_obj_5pysam_9libcfaidx_FastaFile *__pyx_v_fafile, CYTHON_UNUSED PyObject *__pyx_v_refbase) {
  PyObject *__pyx_v_rec = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("rec", 0);

  /* "pysamstats/opt.pyx":284
 * 
 *         # make record
 *         rec = {'reads_all': self.reads_all,             # <<<<<<<<<<<<<<
 *                'reads_pp': self.reads_pp,
 *                'reads_mate_unmapped': self.reads_mate_unmapped,
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->reads_all); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_all, __pyx_t_2) < 0) __PYX_ERR(0, 284, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":285
 *         # make record
 *         rec = {'reads_all': self.reads_all,
 *                'reads_pp': self.reads_pp,             # <<<<<<<<<<<<<<
 *                'reads_mate_unmapped': self.reads_mate_unmapped,
 *                'reads_mate_other_chr': self.reads_mate_other_chr,
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->reads_pp); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 285, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_pp, __pyx_t_2) < 0) __PYX_ERR(0, 284, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":286
 *         rec = {'reads_all': self.reads_all,
 *                'reads_pp': self.reads_pp,
 *                'reads_mate_unmapped': self.reads_mate_unmapped,             # <<<<<<<<<<<<<<
 *                'reads_mate_other_chr': self.reads_mate_other_chr,
 *                'reads_mate_same_strand': self.reads_mate_same_strand,
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->reads_mate_unmapped); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 286, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_mate_unmapped, __pyx_t_2) < 0) __PYX_ERR(0, 284, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":287
 *                'reads_pp': self.reads_pp,
 *                'reads_mate_unmapped': self.reads_mate_unmapped,
 *                'reads_mate_other_chr': self.reads_mate_other_chr,             # <<<<<<<<<<<<<<
 *                'reads_mate_same_strand': self.reads_mate_same_strand,
 *                'reads_faceaway': self.reads_faceaway,
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->reads_mate_other_chr); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 287, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_mate_other_chr, __pyx_t_2) < 0) __PYX_ERR(0, 284, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":288
 *                'reads_mate_unmapped': self.reads_mate_unmapped,
 *                'reads_mate_other_chr': self.reads_mate_other_chr,
 *                'reads_mate_same_strand': self.reads_mate_same_strand,             # <<<<<<<<<<<<<<
 *                'reads_faceaway': self.reads_faceaway,
 *                'reads_softclipped': self.reads_softclipped,
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->reads_mate_same_strand); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_mate_same_strand, __pyx_t_2) < 0) __PYX_ERR(0, 284, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":289
 *                'reads_mate_other_chr': self.reads_mate_other_chr,
 *                'reads_mate_same_strand': self.reads_mate_same_strand,
 *                'reads_faceaway': self.reads_faceaway,             # <<<<<<<<<<<<<<
 *                'reads_softclipped': self.reads_softclipped,
 *                'reads_duplicate': self.reads_duplicate}
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->reads_faceaway); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 289, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_faceaway, __pyx_t_2) < 0) __PYX_ERR(0, 284, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":290
 *                'reads_mate_same_strand': self.reads_mate_same_strand,
 *                'reads_faceaway': self.reads_faceaway,
 *                'reads_softclipped': self.reads_softclipped,             # <<<<<<<<<<<<<<
 *                'reads_duplicate': self.reads_duplicate}
 * 
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->reads_softclipped); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 290, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_softclipped, __pyx_t_2) < 0) __PYX_ERR(0, 284, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":291
 *                'reads_faceaway': self.reads_faceaway,
 *                'reads_softclipped': self.reads_softclipped,
 *                'reads_duplicate': self.reads_duplicate}             # <<<<<<<<<<<<<<
 * 
 *         # reset counters
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->reads_duplicate); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 291, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_duplicate, __pyx_t_2) < 0) __PYX_ERR(0, 284, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_rec = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":294
 * 
 *         # reset counters
 *         self.reset()             # <<<<<<<<<<<<<<
 * 
 *         return rec
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 294, __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, 294, __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;

  /* "pysamstats/opt.pyx":296
 *         self.reset()
 * 
 *         return rec             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_rec);
  __pyx_r = __pyx_v_rec;
  goto __pyx_L0;

  /* "pysamstats/opt.pyx":281
 *             self.reads_softclipped += 1
 * 
 *     cdef dict rec(self, chrom, pos, FastaFile fafile, bytes refbase):             # <<<<<<<<<<<<<<
 * 
 *         # make record
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysamstats.opt.CoverageExt.rec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rec);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_11CoverageExt_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pysamstats_3opt_11CoverageExt_4__reduce_cython__[] = "CoverageExt.__reduce_cython__(self)";
static PyObject *__pyx_pw_10pysamstats_3opt_11CoverageExt_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_11CoverageExt_4__reduce_cython__(((struct __pyx_obj_10pysamstats_3opt_CoverageExt *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pysamstats_3opt_11CoverageExt_4__reduce_cython__(struct __pyx_obj_10pysamstats_3opt_CoverageExt *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  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;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_t_11;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self.reads_all, self.reads_duplicate, self.reads_faceaway, self.reads_mate_other_chr, self.reads_mate_same_strand, self.reads_mate_unmapped, self.reads_pp, self.reads_softclipped)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->reads_all); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->reads_duplicate); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_self->reads_faceaway); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_self->reads_mate_other_chr); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_self->reads_mate_same_strand); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_self->reads_mate_unmapped); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_self->reads_pp); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_self->reads_softclipped); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = PyTuple_New(8); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_9, 3, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_9, 4, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_9, 5, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_9, 6, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_9, 7, __pyx_t_8);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_6 = 0;
  __pyx_t_7 = 0;
  __pyx_t_8 = 0;
  __pyx_v_state = ((PyObject*)__pyx_t_9);
  __pyx_t_9 = 0;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self.reads_all, self.reads_duplicate, self.reads_faceaway, self.reads_mate_other_chr, self.reads_mate_same_strand, self.reads_mate_unmapped, self.reads_pp, self.reads_softclipped)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         state += (_dict,)
 */
  __pyx_t_9 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_v__dict = __pyx_t_9;
  __pyx_t_9 = 0;

  /* "(tree fragment)":7
 *     state = (self.reads_all, self.reads_duplicate, self.reads_faceaway, self.reads_mate_other_chr, self.reads_mate_same_strand, self.reads_mate_unmapped, self.reads_pp, self.reads_softclipped)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
  __pyx_t_10 = (__pyx_v__dict != Py_None);
  __pyx_t_11 = (__pyx_t_10 != 0);
  if (__pyx_t_11) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
 */
    __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v__dict);
    __pyx_t_8 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_8));
    __pyx_t_8 = 0;

    /* "(tree fragment)":9
 *     if _dict is not None:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = False
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = (self.reads_all, self.reads_duplicate, self.reads_faceaway, self.reads_mate_other_chr, self.reads_mate_same_strand, self.reads_mate_unmapped, self.reads_pp, self.reads_softclipped)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
    goto __pyx_L3;
  }

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = False             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_CoverageExt, (type(self), 0xdc660eb, None), state
 */
  /*else*/ {
    __pyx_v_use_setstate = 0;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_CoverageExt, (type(self), 0xdc660eb, None), state
 *     else:
 */
  __pyx_t_11 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_11) {

    /* "(tree fragment)":13
 *         use_setstate = False
 *     if use_setstate:
 *         return __pyx_unpickle_CoverageExt, (type(self), 0xdc660eb, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_CoverageExt, (type(self), 0xdc660eb, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_pyx_unpickle_CoverageExt); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_231104747);
    __Pyx_GIVEREF(__pyx_int_231104747);
    PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_int_231104747);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_9, 2, Py_None);
    __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_9);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_v_state);
    __pyx_t_8 = 0;
    __pyx_t_9 = 0;
    __pyx_r = __pyx_t_7;
    __pyx_t_7 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_CoverageExt, (type(self), 0xdc660eb, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_CoverageExt, (type(self), 0xdc660eb, None), state
 *     else:
 *         return __pyx_unpickle_CoverageExt, (type(self), 0xdc660eb, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_CoverageExt__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_pyx_unpickle_CoverageExt); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_231104747);
    __Pyx_GIVEREF(__pyx_int_231104747);
    PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_int_231104747);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_v_state);
    __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_9);
    __pyx_t_7 = 0;
    __pyx_t_9 = 0;
    __pyx_r = __pyx_t_8;
    __pyx_t_8 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

  /* 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_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("pysamstats.opt.CoverageExt.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_CoverageExt, (type(self), 0xdc660eb, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_CoverageExt__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_11CoverageExt_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_10pysamstats_3opt_11CoverageExt_6__setstate_cython__[] = "CoverageExt.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_10pysamstats_3opt_11CoverageExt_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_11CoverageExt_6__setstate_cython__(((struct __pyx_obj_10pysamstats_3opt_CoverageExt *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_10pysamstats_3opt_11CoverageExt_6__setstate_cython__(struct __pyx_obj_10pysamstats_3opt_CoverageExt *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_CoverageExt, (type(self), 0xdc660eb, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_CoverageExt__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
 */
  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_10pysamstats_3opt___pyx_unpickle_CoverageExt__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_CoverageExt, (type(self), 0xdc660eb, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_CoverageExt__set_state(self, __pyx_state)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysamstats.opt.CoverageExt.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":309
 *         int all, fwd, rev
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.reset()
 * 
 */

/* Python wrapper */
static int __pyx_pw_10pysamstats_3opt_11CountStrand_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_10pysamstats_3opt_11CountStrand_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
  __pyx_r = __pyx_pf_10pysamstats_3opt_11CountStrand___init__(((struct __pyx_obj_10pysamstats_3opt_CountStrand *)__pyx_v_self));

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

static int __pyx_pf_10pysamstats_3opt_11CountStrand___init__(struct __pyx_obj_10pysamstats_3opt_CountStrand *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "pysamstats/opt.pyx":310
 * 
 *     def __init__(self):
 *         self.reset()             # <<<<<<<<<<<<<<
 * 
 *     def reset(self):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 310, __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, 310, __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;

  /* "pysamstats/opt.pyx":309
 *         int all, fwd, rev
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.reset()
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysamstats.opt.CountStrand.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":312
 *         self.reset()
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         self.all = self.fwd = self.rev = 0
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_11CountStrand_3reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pysamstats_3opt_11CountStrand_2reset[] = "CountStrand.reset(self)";
static PyObject *__pyx_pw_10pysamstats_3opt_11CountStrand_3reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reset (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_11CountStrand_2reset(((struct __pyx_obj_10pysamstats_3opt_CountStrand *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pysamstats_3opt_11CountStrand_2reset(struct __pyx_obj_10pysamstats_3opt_CountStrand *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reset", 0);

  /* "pysamstats/opt.pyx":313
 * 
 *     def reset(self):
 *         self.all = self.fwd = self.rev = 0             # <<<<<<<<<<<<<<
 * 
 *     cdef void incr(self, bint is_reverse):
 */
  __pyx_v_self->all = 0;
  __pyx_v_self->fwd = 0;
  __pyx_v_self->rev = 0;

  /* "pysamstats/opt.pyx":312
 *         self.reset()
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         self.all = self.fwd = self.rev = 0
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":315
 *         self.all = self.fwd = self.rev = 0
 * 
 *     cdef void incr(self, bint is_reverse):             # <<<<<<<<<<<<<<
 *         self.all += 1
 *         if is_reverse:
 */

static void __pyx_f_10pysamstats_3opt_11CountStrand_incr(struct __pyx_obj_10pysamstats_3opt_CountStrand *__pyx_v_self, int __pyx_v_is_reverse) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("incr", 0);

  /* "pysamstats/opt.pyx":316
 * 
 *     cdef void incr(self, bint is_reverse):
 *         self.all += 1             # <<<<<<<<<<<<<<
 *         if is_reverse:
 *             self.rev += 1
 */
  __pyx_v_self->all = (__pyx_v_self->all + 1);

  /* "pysamstats/opt.pyx":317
 *     cdef void incr(self, bint is_reverse):
 *         self.all += 1
 *         if is_reverse:             # <<<<<<<<<<<<<<
 *             self.rev += 1
 *         else:
 */
  __pyx_t_1 = (__pyx_v_is_reverse != 0);
  if (__pyx_t_1) {

    /* "pysamstats/opt.pyx":318
 *         self.all += 1
 *         if is_reverse:
 *             self.rev += 1             # <<<<<<<<<<<<<<
 *         else:
 *             self.fwd += 1
 */
    __pyx_v_self->rev = (__pyx_v_self->rev + 1);

    /* "pysamstats/opt.pyx":317
 *     cdef void incr(self, bint is_reverse):
 *         self.all += 1
 *         if is_reverse:             # <<<<<<<<<<<<<<
 *             self.rev += 1
 *         else:
 */
    goto __pyx_L3;
  }

  /* "pysamstats/opt.pyx":320
 *             self.rev += 1
 *         else:
 *             self.fwd += 1             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*else*/ {
    __pyx_v_self->fwd = (__pyx_v_self->fwd + 1);
  }
  __pyx_L3:;

  /* "pysamstats/opt.pyx":315
 *         self.all = self.fwd = self.rev = 0
 * 
 *     cdef void incr(self, bint is_reverse):             # <<<<<<<<<<<<<<
 *         self.all += 1
 *         if is_reverse:
 */

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

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_11CountStrand_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pysamstats_3opt_11CountStrand_4__reduce_cython__[] = "CountStrand.__reduce_cython__(self)";
static PyObject *__pyx_pw_10pysamstats_3opt_11CountStrand_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_11CountStrand_4__reduce_cython__(((struct __pyx_obj_10pysamstats_3opt_CountStrand *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pysamstats_3opt_11CountStrand_4__reduce_cython__(struct __pyx_obj_10pysamstats_3opt_CountStrand *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  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;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self.all, self.fwd, self.rev)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->all); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->fwd); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_self->rev); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_v_state = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self.all, self.fwd, self.rev)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         state += (_dict,)
 */
  __pyx_t_4 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v__dict = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "(tree fragment)":7
 *     state = (self.all, self.fwd, self.rev)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
  __pyx_t_5 = (__pyx_v__dict != Py_None);
  __pyx_t_6 = (__pyx_t_5 != 0);
  if (__pyx_t_6) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
 */
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v__dict);
    __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "(tree fragment)":9
 *     if _dict is not None:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = False
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = (self.all, self.fwd, self.rev)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
    goto __pyx_L3;
  }

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = False             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_CountStrand, (type(self), 0x0931b2d, None), state
 */
  /*else*/ {
    __pyx_v_use_setstate = 0;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_CountStrand, (type(self), 0x0931b2d, None), state
 *     else:
 */
  __pyx_t_6 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_6) {

    /* "(tree fragment)":13
 *         use_setstate = False
 *     if use_setstate:
 *         return __pyx_unpickle_CountStrand, (type(self), 0x0931b2d, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_CountStrand, (type(self), 0x0931b2d, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pyx_unpickle_CountStrand); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_9640749);
    __Pyx_GIVEREF(__pyx_int_9640749);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_9640749);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_4, 2, Py_None);
    __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_state);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_CountStrand, (type(self), 0x0931b2d, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_CountStrand, (type(self), 0x0931b2d, None), state
 *     else:
 *         return __pyx_unpickle_CountStrand, (type(self), 0x0931b2d, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_CountStrand__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pyx_unpickle_CountStrand); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_9640749);
    __Pyx_GIVEREF(__pyx_int_9640749);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_9640749);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_state);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4);
    __pyx_t_2 = 0;
    __pyx_t_4 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pysamstats.opt.CountStrand.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_CountStrand, (type(self), 0x0931b2d, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_CountStrand__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_11CountStrand_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_10pysamstats_3opt_11CountStrand_6__setstate_cython__[] = "CountStrand.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_10pysamstats_3opt_11CountStrand_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_11CountStrand_6__setstate_cython__(((struct __pyx_obj_10pysamstats_3opt_CountStrand *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_10pysamstats_3opt_11CountStrand_6__setstate_cython__(struct __pyx_obj_10pysamstats_3opt_CountStrand *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_CountStrand, (type(self), 0x0931b2d, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_CountStrand__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
 */
  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_10pysamstats_3opt___pyx_unpickle_CountStrand__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_CountStrand, (type(self), 0x0931b2d, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_CountStrand__set_state(self, __pyx_state)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysamstats.opt.CountStrand.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":336
 *         CountStrand duplicate
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.all = CountStrand()
 *         self.pp = CountStrand()
 */

/* Python wrapper */
static int __pyx_pw_10pysamstats_3opt_17CoverageExtStrand_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_10pysamstats_3opt_17CoverageExtStrand_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
  __pyx_r = __pyx_pf_10pysamstats_3opt_17CoverageExtStrand___init__(((struct __pyx_obj_10pysamstats_3opt_CoverageExtStrand *)__pyx_v_self));

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

static int __pyx_pf_10pysamstats_3opt_17CoverageExtStrand___init__(struct __pyx_obj_10pysamstats_3opt_CoverageExtStrand *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "pysamstats/opt.pyx":337
 * 
 *     def __init__(self):
 *         self.all = CountStrand()             # <<<<<<<<<<<<<<
 *         self.pp = CountStrand()
 *         self.mate_unmapped = CountStrand()
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_CountStrand)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 337, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->all);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->all));
  __pyx_v_self->all = ((struct __pyx_obj_10pysamstats_3opt_CountStrand *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":338
 *     def __init__(self):
 *         self.all = CountStrand()
 *         self.pp = CountStrand()             # <<<<<<<<<<<<<<
 *         self.mate_unmapped = CountStrand()
 *         self.mate_other_chr = CountStrand()
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_CountStrand)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 338, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->pp);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->pp));
  __pyx_v_self->pp = ((struct __pyx_obj_10pysamstats_3opt_CountStrand *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":339
 *         self.all = CountStrand()
 *         self.pp = CountStrand()
 *         self.mate_unmapped = CountStrand()             # <<<<<<<<<<<<<<
 *         self.mate_other_chr = CountStrand()
 *         self.same_strand = CountStrand()
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_CountStrand)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 339, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->mate_unmapped);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->mate_unmapped));
  __pyx_v_self->mate_unmapped = ((struct __pyx_obj_10pysamstats_3opt_CountStrand *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":340
 *         self.pp = CountStrand()
 *         self.mate_unmapped = CountStrand()
 *         self.mate_other_chr = CountStrand()             # <<<<<<<<<<<<<<
 *         self.same_strand = CountStrand()
 *         self.faceaway = CountStrand()
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_CountStrand)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 340, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->mate_other_chr);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->mate_other_chr));
  __pyx_v_self->mate_other_chr = ((struct __pyx_obj_10pysamstats_3opt_CountStrand *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":341
 *         self.mate_unmapped = CountStrand()
 *         self.mate_other_chr = CountStrand()
 *         self.same_strand = CountStrand()             # <<<<<<<<<<<<<<
 *         self.faceaway = CountStrand()
 *         self.softclipped = CountStrand()
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_CountStrand)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 341, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->same_strand);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->same_strand));
  __pyx_v_self->same_strand = ((struct __pyx_obj_10pysamstats_3opt_CountStrand *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":342
 *         self.mate_other_chr = CountStrand()
 *         self.same_strand = CountStrand()
 *         self.faceaway = CountStrand()             # <<<<<<<<<<<<<<
 *         self.softclipped = CountStrand()
 *         self.duplicate = CountStrand()
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_CountStrand)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 342, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->faceaway);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->faceaway));
  __pyx_v_self->faceaway = ((struct __pyx_obj_10pysamstats_3opt_CountStrand *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":343
 *         self.same_strand = CountStrand()
 *         self.faceaway = CountStrand()
 *         self.softclipped = CountStrand()             # <<<<<<<<<<<<<<
 *         self.duplicate = CountStrand()
 *         self.reset()
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_CountStrand)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 343, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->softclipped);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->softclipped));
  __pyx_v_self->softclipped = ((struct __pyx_obj_10pysamstats_3opt_CountStrand *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":344
 *         self.faceaway = CountStrand()
 *         self.softclipped = CountStrand()
 *         self.duplicate = CountStrand()             # <<<<<<<<<<<<<<
 *         self.reset()
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_CountStrand)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 344, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->duplicate);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->duplicate));
  __pyx_v_self->duplicate = ((struct __pyx_obj_10pysamstats_3opt_CountStrand *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":345
 *         self.softclipped = CountStrand()
 *         self.duplicate = CountStrand()
 *         self.reset()             # <<<<<<<<<<<<<<
 * 
 *     def reset(self):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 345, __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, 345, __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;

  /* "pysamstats/opt.pyx":336
 *         CountStrand duplicate
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.all = CountStrand()
 *         self.pp = CountStrand()
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysamstats.opt.CoverageExtStrand.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":347
 *         self.reset()
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         self.all.reset()
 *         self.pp.reset()
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_17CoverageExtStrand_3reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pysamstats_3opt_17CoverageExtStrand_2reset[] = "CoverageExtStrand.reset(self)";
static PyObject *__pyx_pw_10pysamstats_3opt_17CoverageExtStrand_3reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reset (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_17CoverageExtStrand_2reset(((struct __pyx_obj_10pysamstats_3opt_CoverageExtStrand *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pysamstats_3opt_17CoverageExtStrand_2reset(struct __pyx_obj_10pysamstats_3opt_CoverageExtStrand *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("reset", 0);

  /* "pysamstats/opt.pyx":348
 * 
 *     def reset(self):
 *         self.all.reset()             # <<<<<<<<<<<<<<
 *         self.pp.reset()
 *         self.mate_unmapped.reset()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->all), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 348, __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, 348, __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;

  /* "pysamstats/opt.pyx":349
 *     def reset(self):
 *         self.all.reset()
 *         self.pp.reset()             # <<<<<<<<<<<<<<
 *         self.mate_unmapped.reset()
 *         self.mate_other_chr.reset()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->pp), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 349, __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, 349, __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;

  /* "pysamstats/opt.pyx":350
 *         self.all.reset()
 *         self.pp.reset()
 *         self.mate_unmapped.reset()             # <<<<<<<<<<<<<<
 *         self.mate_other_chr.reset()
 *         self.same_strand.reset()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->mate_unmapped), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 350, __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, 350, __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;

  /* "pysamstats/opt.pyx":351
 *         self.pp.reset()
 *         self.mate_unmapped.reset()
 *         self.mate_other_chr.reset()             # <<<<<<<<<<<<<<
 *         self.same_strand.reset()
 *         self.faceaway.reset()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->mate_other_chr), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 351, __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, 351, __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;

  /* "pysamstats/opt.pyx":352
 *         self.mate_unmapped.reset()
 *         self.mate_other_chr.reset()
 *         self.same_strand.reset()             # <<<<<<<<<<<<<<
 *         self.faceaway.reset()
 *         self.softclipped.reset()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->same_strand), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 352, __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, 352, __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;

  /* "pysamstats/opt.pyx":353
 *         self.mate_other_chr.reset()
 *         self.same_strand.reset()
 *         self.faceaway.reset()             # <<<<<<<<<<<<<<
 *         self.softclipped.reset()
 *         self.duplicate.reset()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->faceaway), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 353, __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, 353, __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;

  /* "pysamstats/opt.pyx":354
 *         self.same_strand.reset()
 *         self.faceaway.reset()
 *         self.softclipped.reset()             # <<<<<<<<<<<<<<
 *         self.duplicate.reset()
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->softclipped), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 354, __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, 354, __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;

  /* "pysamstats/opt.pyx":355
 *         self.faceaway.reset()
 *         self.softclipped.reset()
 *         self.duplicate.reset()             # <<<<<<<<<<<<<<
 * 
 *     cdef void recv(self, bam_pileup1_t* read, PileupColumn col, bytes refbase):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->duplicate), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 355, __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, 355, __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;

  /* "pysamstats/opt.pyx":347
 *         self.reset()
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         self.all.reset()
 *         self.pp.reset()
 */

  /* 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_AddTraceback("pysamstats.opt.CoverageExtStrand.reset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":357
 *         self.duplicate.reset()
 * 
 *     cdef void recv(self, bam_pileup1_t* read, PileupColumn col, bytes refbase):             # <<<<<<<<<<<<<<
 *         cdef:
 *             uint32_t flag
 */

static void __pyx_f_10pysamstats_3opt_17CoverageExtStrand_recv(struct __pyx_obj_10pysamstats_3opt_CoverageExtStrand *__pyx_v_self, bam_pileup1_t *__pyx_v_read, struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn *__pyx_v_col, CYTHON_UNUSED PyObject *__pyx_v_refbase) {
  uint32_t __pyx_v_flag;
  int __pyx_v_is_proper_pair;
  int __pyx_v_is_reverse;
  int __pyx_v_is_duplicate;
  int __pyx_v_mate_is_reverse;
  int __pyx_v_tlen;
  int __pyx_v_mate_is_unmapped;
  __Pyx_RefNannyDeclarations
  uint16_t __pyx_t_1;
  int32_t __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("recv", 0);

  /* "pysamstats/opt.pyx":368
 * 
 *         # convenience variables
 *         flag = read.b.core.flag             # <<<<<<<<<<<<<<
 *         is_reverse = <bint>(flag & BAM_FREVERSE)
 *         is_proper_pair = <bint>(flag & BAM_FPROPER_PAIR)
 */
  __pyx_t_1 = __pyx_v_read->b->core.flag;
  __pyx_v_flag = __pyx_t_1;

  /* "pysamstats/opt.pyx":369
 *         # convenience variables
 *         flag = read.b.core.flag
 *         is_reverse = <bint>(flag & BAM_FREVERSE)             # <<<<<<<<<<<<<<
 *         is_proper_pair = <bint>(flag & BAM_FPROPER_PAIR)
 *         is_duplicate = <bint>(flag & BAM_FDUP)
 */
  __pyx_v_is_reverse = ((__pyx_v_flag & 16) != 0);

  /* "pysamstats/opt.pyx":370
 *         flag = read.b.core.flag
 *         is_reverse = <bint>(flag & BAM_FREVERSE)
 *         is_proper_pair = <bint>(flag & BAM_FPROPER_PAIR)             # <<<<<<<<<<<<<<
 *         is_duplicate = <bint>(flag & BAM_FDUP)
 *         mate_is_unmapped = <bint>(flag & BAM_FMUNMAP)
 */
  __pyx_v_is_proper_pair = ((__pyx_v_flag & 2) != 0);

  /* "pysamstats/opt.pyx":371
 *         is_reverse = <bint>(flag & BAM_FREVERSE)
 *         is_proper_pair = <bint>(flag & BAM_FPROPER_PAIR)
 *         is_duplicate = <bint>(flag & BAM_FDUP)             # <<<<<<<<<<<<<<
 *         mate_is_unmapped = <bint>(flag & BAM_FMUNMAP)
 *         mate_is_reverse = <bint>(flag & BAM_FMREVERSE)
 */
  __pyx_v_is_duplicate = ((__pyx_v_flag & 0x400) != 0);

  /* "pysamstats/opt.pyx":372
 *         is_proper_pair = <bint>(flag & BAM_FPROPER_PAIR)
 *         is_duplicate = <bint>(flag & BAM_FDUP)
 *         mate_is_unmapped = <bint>(flag & BAM_FMUNMAP)             # <<<<<<<<<<<<<<
 *         mate_is_reverse = <bint>(flag & BAM_FMREVERSE)
 *         tlen = read.b.core.isize
 */
  __pyx_v_mate_is_unmapped = ((__pyx_v_flag & 8) != 0);

  /* "pysamstats/opt.pyx":373
 *         is_duplicate = <bint>(flag & BAM_FDUP)
 *         mate_is_unmapped = <bint>(flag & BAM_FMUNMAP)
 *         mate_is_reverse = <bint>(flag & BAM_FMREVERSE)             # <<<<<<<<<<<<<<
 *         tlen = read.b.core.isize
 * 
 */
  __pyx_v_mate_is_reverse = ((__pyx_v_flag & 32) != 0);

  /* "pysamstats/opt.pyx":374
 *         mate_is_unmapped = <bint>(flag & BAM_FMUNMAP)
 *         mate_is_reverse = <bint>(flag & BAM_FMREVERSE)
 *         tlen = read.b.core.isize             # <<<<<<<<<<<<<<
 * 
 *         # do the counting
 */
  __pyx_t_2 = __pyx_v_read->b->core.isize;
  __pyx_v_tlen = __pyx_t_2;

  /* "pysamstats/opt.pyx":377
 * 
 *         # do the counting
 *         self.all.incr(is_reverse)             # <<<<<<<<<<<<<<
 *         if is_proper_pair:
 *             self.pp.incr(is_reverse)
 */
  ((struct __pyx_vtabstruct_10pysamstats_3opt_CountStrand *)__pyx_v_self->all->__pyx_vtab)->incr(__pyx_v_self->all, __pyx_v_is_reverse);

  /* "pysamstats/opt.pyx":378
 *         # do the counting
 *         self.all.incr(is_reverse)
 *         if is_proper_pair:             # <<<<<<<<<<<<<<
 *             self.pp.incr(is_reverse)
 *         if mate_is_unmapped:
 */
  __pyx_t_3 = (__pyx_v_is_proper_pair != 0);
  if (__pyx_t_3) {

    /* "pysamstats/opt.pyx":379
 *         self.all.incr(is_reverse)
 *         if is_proper_pair:
 *             self.pp.incr(is_reverse)             # <<<<<<<<<<<<<<
 *         if mate_is_unmapped:
 *             self.mate_unmapped.incr(is_reverse)
 */
    ((struct __pyx_vtabstruct_10pysamstats_3opt_CountStrand *)__pyx_v_self->pp->__pyx_vtab)->incr(__pyx_v_self->pp, __pyx_v_is_reverse);

    /* "pysamstats/opt.pyx":378
 *         # do the counting
 *         self.all.incr(is_reverse)
 *         if is_proper_pair:             # <<<<<<<<<<<<<<
 *             self.pp.incr(is_reverse)
 *         if mate_is_unmapped:
 */
  }

  /* "pysamstats/opt.pyx":380
 *         if is_proper_pair:
 *             self.pp.incr(is_reverse)
 *         if mate_is_unmapped:             # <<<<<<<<<<<<<<
 *             self.mate_unmapped.incr(is_reverse)
 *         elif col.tid != read.b.core.mtid:
 */
  __pyx_t_3 = (__pyx_v_mate_is_unmapped != 0);
  if (__pyx_t_3) {

    /* "pysamstats/opt.pyx":381
 *             self.pp.incr(is_reverse)
 *         if mate_is_unmapped:
 *             self.mate_unmapped.incr(is_reverse)             # <<<<<<<<<<<<<<
 *         elif col.tid != read.b.core.mtid:
 *             self.mate_other_chr.incr(is_reverse)
 */
    ((struct __pyx_vtabstruct_10pysamstats_3opt_CountStrand *)__pyx_v_self->mate_unmapped->__pyx_vtab)->incr(__pyx_v_self->mate_unmapped, __pyx_v_is_reverse);

    /* "pysamstats/opt.pyx":380
 *         if is_proper_pair:
 *             self.pp.incr(is_reverse)
 *         if mate_is_unmapped:             # <<<<<<<<<<<<<<
 *             self.mate_unmapped.incr(is_reverse)
 *         elif col.tid != read.b.core.mtid:
 */
    goto __pyx_L4;
  }

  /* "pysamstats/opt.pyx":382
 *         if mate_is_unmapped:
 *             self.mate_unmapped.incr(is_reverse)
 *         elif col.tid != read.b.core.mtid:             # <<<<<<<<<<<<<<
 *             self.mate_other_chr.incr(is_reverse)
 *         elif is_reverse and mate_is_reverse:
 */
  __pyx_t_3 = ((__pyx_v_col->tid != __pyx_v_read->b->core.mtid) != 0);
  if (__pyx_t_3) {

    /* "pysamstats/opt.pyx":383
 *             self.mate_unmapped.incr(is_reverse)
 *         elif col.tid != read.b.core.mtid:
 *             self.mate_other_chr.incr(is_reverse)             # <<<<<<<<<<<<<<
 *         elif is_reverse and mate_is_reverse:
 *             self.same_strand.incr(is_reverse)
 */
    ((struct __pyx_vtabstruct_10pysamstats_3opt_CountStrand *)__pyx_v_self->mate_other_chr->__pyx_vtab)->incr(__pyx_v_self->mate_other_chr, __pyx_v_is_reverse);

    /* "pysamstats/opt.pyx":382
 *         if mate_is_unmapped:
 *             self.mate_unmapped.incr(is_reverse)
 *         elif col.tid != read.b.core.mtid:             # <<<<<<<<<<<<<<
 *             self.mate_other_chr.incr(is_reverse)
 *         elif is_reverse and mate_is_reverse:
 */
    goto __pyx_L4;
  }

  /* "pysamstats/opt.pyx":384
 *         elif col.tid != read.b.core.mtid:
 *             self.mate_other_chr.incr(is_reverse)
 *         elif is_reverse and mate_is_reverse:             # <<<<<<<<<<<<<<
 *             self.same_strand.incr(is_reverse)
 *         elif not is_reverse and not mate_is_reverse:
 */
  __pyx_t_4 = (__pyx_v_is_reverse != 0);
  if (__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_4 = (__pyx_v_mate_is_reverse != 0);
  __pyx_t_3 = __pyx_t_4;
  __pyx_L5_bool_binop_done:;
  if (__pyx_t_3) {

    /* "pysamstats/opt.pyx":385
 *             self.mate_other_chr.incr(is_reverse)
 *         elif is_reverse and mate_is_reverse:
 *             self.same_strand.incr(is_reverse)             # <<<<<<<<<<<<<<
 *         elif not is_reverse and not mate_is_reverse:
 *             self.same_strand.incr(is_reverse)
 */
    ((struct __pyx_vtabstruct_10pysamstats_3opt_CountStrand *)__pyx_v_self->same_strand->__pyx_vtab)->incr(__pyx_v_self->same_strand, __pyx_v_is_reverse);

    /* "pysamstats/opt.pyx":384
 *         elif col.tid != read.b.core.mtid:
 *             self.mate_other_chr.incr(is_reverse)
 *         elif is_reverse and mate_is_reverse:             # <<<<<<<<<<<<<<
 *             self.same_strand.incr(is_reverse)
 *         elif not is_reverse and not mate_is_reverse:
 */
    goto __pyx_L4;
  }

  /* "pysamstats/opt.pyx":386
 *         elif is_reverse and mate_is_reverse:
 *             self.same_strand.incr(is_reverse)
 *         elif not is_reverse and not mate_is_reverse:             # <<<<<<<<<<<<<<
 *             self.same_strand.incr(is_reverse)
 *         elif (is_reverse and tlen > 0) or (not is_reverse and tlen < 0):
 */
  __pyx_t_4 = ((!(__pyx_v_is_reverse != 0)) != 0);
  if (__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L7_bool_binop_done;
  }
  __pyx_t_4 = ((!(__pyx_v_mate_is_reverse != 0)) != 0);
  __pyx_t_3 = __pyx_t_4;
  __pyx_L7_bool_binop_done:;
  if (__pyx_t_3) {

    /* "pysamstats/opt.pyx":387
 *             self.same_strand.incr(is_reverse)
 *         elif not is_reverse and not mate_is_reverse:
 *             self.same_strand.incr(is_reverse)             # <<<<<<<<<<<<<<
 *         elif (is_reverse and tlen > 0) or (not is_reverse and tlen < 0):
 *             self.faceaway.incr(is_reverse)
 */
    ((struct __pyx_vtabstruct_10pysamstats_3opt_CountStrand *)__pyx_v_self->same_strand->__pyx_vtab)->incr(__pyx_v_self->same_strand, __pyx_v_is_reverse);

    /* "pysamstats/opt.pyx":386
 *         elif is_reverse and mate_is_reverse:
 *             self.same_strand.incr(is_reverse)
 *         elif not is_reverse and not mate_is_reverse:             # <<<<<<<<<<<<<<
 *             self.same_strand.incr(is_reverse)
 *         elif (is_reverse and tlen > 0) or (not is_reverse and tlen < 0):
 */
    goto __pyx_L4;
  }

  /* "pysamstats/opt.pyx":388
 *         elif not is_reverse and not mate_is_reverse:
 *             self.same_strand.incr(is_reverse)
 *         elif (is_reverse and tlen > 0) or (not is_reverse and tlen < 0):             # <<<<<<<<<<<<<<
 *             self.faceaway.incr(is_reverse)
 *         if is_softclipped(read.b):
 */
  __pyx_t_4 = (__pyx_v_is_reverse != 0);
  if (!__pyx_t_4) {
    goto __pyx_L10_next_or;
  } else {
  }
  __pyx_t_4 = ((__pyx_v_tlen > 0) != 0);
  if (!__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L9_bool_binop_done;
  }
  __pyx_L10_next_or:;
  __pyx_t_4 = ((!(__pyx_v_is_reverse != 0)) != 0);
  if (__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L9_bool_binop_done;
  }
  __pyx_t_4 = ((__pyx_v_tlen < 0) != 0);
  __pyx_t_3 = __pyx_t_4;
  __pyx_L9_bool_binop_done:;
  if (__pyx_t_3) {

    /* "pysamstats/opt.pyx":389
 *             self.same_strand.incr(is_reverse)
 *         elif (is_reverse and tlen > 0) or (not is_reverse and tlen < 0):
 *             self.faceaway.incr(is_reverse)             # <<<<<<<<<<<<<<
 *         if is_softclipped(read.b):
 *             self.softclipped.incr(is_reverse)
 */
    ((struct __pyx_vtabstruct_10pysamstats_3opt_CountStrand *)__pyx_v_self->faceaway->__pyx_vtab)->incr(__pyx_v_self->faceaway, __pyx_v_is_reverse);

    /* "pysamstats/opt.pyx":388
 *         elif not is_reverse and not mate_is_reverse:
 *             self.same_strand.incr(is_reverse)
 *         elif (is_reverse and tlen > 0) or (not is_reverse and tlen < 0):             # <<<<<<<<<<<<<<
 *             self.faceaway.incr(is_reverse)
 *         if is_softclipped(read.b):
 */
  }
  __pyx_L4:;

  /* "pysamstats/opt.pyx":390
 *         elif (is_reverse and tlen > 0) or (not is_reverse and tlen < 0):
 *             self.faceaway.incr(is_reverse)
 *         if is_softclipped(read.b):             # <<<<<<<<<<<<<<
 *             self.softclipped.incr(is_reverse)
 *         if is_duplicate:
 */
  __pyx_t_3 = (__pyx_f_10pysamstats_3opt_is_softclipped(__pyx_v_read->b) != 0);
  if (__pyx_t_3) {

    /* "pysamstats/opt.pyx":391
 *             self.faceaway.incr(is_reverse)
 *         if is_softclipped(read.b):
 *             self.softclipped.incr(is_reverse)             # <<<<<<<<<<<<<<
 *         if is_duplicate:
 *             self.duplicate.incr(is_reverse)
 */
    ((struct __pyx_vtabstruct_10pysamstats_3opt_CountStrand *)__pyx_v_self->softclipped->__pyx_vtab)->incr(__pyx_v_self->softclipped, __pyx_v_is_reverse);

    /* "pysamstats/opt.pyx":390
 *         elif (is_reverse and tlen > 0) or (not is_reverse and tlen < 0):
 *             self.faceaway.incr(is_reverse)
 *         if is_softclipped(read.b):             # <<<<<<<<<<<<<<
 *             self.softclipped.incr(is_reverse)
 *         if is_duplicate:
 */
  }

  /* "pysamstats/opt.pyx":392
 *         if is_softclipped(read.b):
 *             self.softclipped.incr(is_reverse)
 *         if is_duplicate:             # <<<<<<<<<<<<<<
 *             self.duplicate.incr(is_reverse)
 * 
 */
  __pyx_t_3 = (__pyx_v_is_duplicate != 0);
  if (__pyx_t_3) {

    /* "pysamstats/opt.pyx":393
 *             self.softclipped.incr(is_reverse)
 *         if is_duplicate:
 *             self.duplicate.incr(is_reverse)             # <<<<<<<<<<<<<<
 * 
 *     cdef dict rec(self, chrom, pos, FastaFile fafile, bytes refbase):
 */
    ((struct __pyx_vtabstruct_10pysamstats_3opt_CountStrand *)__pyx_v_self->duplicate->__pyx_vtab)->incr(__pyx_v_self->duplicate, __pyx_v_is_reverse);

    /* "pysamstats/opt.pyx":392
 *         if is_softclipped(read.b):
 *             self.softclipped.incr(is_reverse)
 *         if is_duplicate:             # <<<<<<<<<<<<<<
 *             self.duplicate.incr(is_reverse)
 * 
 */
  }

  /* "pysamstats/opt.pyx":357
 *         self.duplicate.reset()
 * 
 *     cdef void recv(self, bam_pileup1_t* read, PileupColumn col, bytes refbase):             # <<<<<<<<<<<<<<
 *         cdef:
 *             uint32_t flag
 */

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

/* "pysamstats/opt.pyx":395
 *             self.duplicate.incr(is_reverse)
 * 
 *     cdef dict rec(self, chrom, pos, FastaFile fafile, bytes refbase):             # <<<<<<<<<<<<<<
 * 
 *         # make record
 */

static PyObject *__pyx_f_10pysamstats_3opt_17CoverageExtStrand_rec(struct __pyx_obj_10pysamstats_3opt_CoverageExtStrand *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_chrom, CYTHON_UNUSED PyObject *__pyx_v_pos, CYTHON_UNUSED struct __pyx_obj_5pysam_9libcfaidx_FastaFile *__pyx_v_fafile, CYTHON_UNUSED PyObject *__pyx_v_refbase) {
  PyObject *__pyx_v_rec = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("rec", 0);

  /* "pysamstats/opt.pyx":398
 * 
 *         # make record
 *         rec = {'reads_all': self.all.all,             # <<<<<<<<<<<<<<
 *                'reads_fwd': self.all.fwd,
 *                'reads_rev': self.all.rev,
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(24); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 398, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->all->all); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 398, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_all, __pyx_t_2) < 0) __PYX_ERR(0, 398, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":399
 *         # make record
 *         rec = {'reads_all': self.all.all,
 *                'reads_fwd': self.all.fwd,             # <<<<<<<<<<<<<<
 *                'reads_rev': self.all.rev,
 *                'reads_pp': self.pp.all,
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->all->fwd); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 399, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_fwd, __pyx_t_2) < 0) __PYX_ERR(0, 398, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":400
 *         rec = {'reads_all': self.all.all,
 *                'reads_fwd': self.all.fwd,
 *                'reads_rev': self.all.rev,             # <<<<<<<<<<<<<<
 *                'reads_pp': self.pp.all,
 *                'reads_pp_fwd': self.pp.fwd,
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->all->rev); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 400, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_rev, __pyx_t_2) < 0) __PYX_ERR(0, 398, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":401
 *                'reads_fwd': self.all.fwd,
 *                'reads_rev': self.all.rev,
 *                'reads_pp': self.pp.all,             # <<<<<<<<<<<<<<
 *                'reads_pp_fwd': self.pp.fwd,
 *                'reads_pp_rev': self.pp.rev,
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->pp->all); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 401, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_pp, __pyx_t_2) < 0) __PYX_ERR(0, 398, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":402
 *                'reads_rev': self.all.rev,
 *                'reads_pp': self.pp.all,
 *                'reads_pp_fwd': self.pp.fwd,             # <<<<<<<<<<<<<<
 *                'reads_pp_rev': self.pp.rev,
 *                'reads_mate_unmapped': self.mate_unmapped.all,
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->pp->fwd); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 402, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_pp_fwd, __pyx_t_2) < 0) __PYX_ERR(0, 398, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":403
 *                'reads_pp': self.pp.all,
 *                'reads_pp_fwd': self.pp.fwd,
 *                'reads_pp_rev': self.pp.rev,             # <<<<<<<<<<<<<<
 *                'reads_mate_unmapped': self.mate_unmapped.all,
 *                'reads_mate_unmapped_fwd': self.mate_unmapped.fwd,
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->pp->rev); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 403, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_pp_rev, __pyx_t_2) < 0) __PYX_ERR(0, 398, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":404
 *                'reads_pp_fwd': self.pp.fwd,
 *                'reads_pp_rev': self.pp.rev,
 *                'reads_mate_unmapped': self.mate_unmapped.all,             # <<<<<<<<<<<<<<
 *                'reads_mate_unmapped_fwd': self.mate_unmapped.fwd,
 *                'reads_mate_unmapped_rev': self.mate_unmapped.rev,
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->mate_unmapped->all); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 404, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_mate_unmapped, __pyx_t_2) < 0) __PYX_ERR(0, 398, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":405
 *                'reads_pp_rev': self.pp.rev,
 *                'reads_mate_unmapped': self.mate_unmapped.all,
 *                'reads_mate_unmapped_fwd': self.mate_unmapped.fwd,             # <<<<<<<<<<<<<<
 *                'reads_mate_unmapped_rev': self.mate_unmapped.rev,
 *                'reads_mate_other_chr': self.mate_other_chr.all,
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->mate_unmapped->fwd); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 405, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_mate_unmapped_fwd, __pyx_t_2) < 0) __PYX_ERR(0, 398, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":406
 *                'reads_mate_unmapped': self.mate_unmapped.all,
 *                'reads_mate_unmapped_fwd': self.mate_unmapped.fwd,
 *                'reads_mate_unmapped_rev': self.mate_unmapped.rev,             # <<<<<<<<<<<<<<
 *                'reads_mate_other_chr': self.mate_other_chr.all,
 *                'reads_mate_other_chr_fwd': self.mate_other_chr.fwd,
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->mate_unmapped->rev); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 406, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_mate_unmapped_rev, __pyx_t_2) < 0) __PYX_ERR(0, 398, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":407
 *                'reads_mate_unmapped_fwd': self.mate_unmapped.fwd,
 *                'reads_mate_unmapped_rev': self.mate_unmapped.rev,
 *                'reads_mate_other_chr': self.mate_other_chr.all,             # <<<<<<<<<<<<<<
 *                'reads_mate_other_chr_fwd': self.mate_other_chr.fwd,
 *                'reads_mate_other_chr_rev': self.mate_other_chr.rev,
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->mate_other_chr->all); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 407, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_mate_other_chr, __pyx_t_2) < 0) __PYX_ERR(0, 398, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":408
 *                'reads_mate_unmapped_rev': self.mate_unmapped.rev,
 *                'reads_mate_other_chr': self.mate_other_chr.all,
 *                'reads_mate_other_chr_fwd': self.mate_other_chr.fwd,             # <<<<<<<<<<<<<<
 *                'reads_mate_other_chr_rev': self.mate_other_chr.rev,
 *                'reads_mate_same_strand': self.same_strand.all,
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->mate_other_chr->fwd); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 408, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_mate_other_chr_fwd, __pyx_t_2) < 0) __PYX_ERR(0, 398, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":409
 *                'reads_mate_other_chr': self.mate_other_chr.all,
 *                'reads_mate_other_chr_fwd': self.mate_other_chr.fwd,
 *                'reads_mate_other_chr_rev': self.mate_other_chr.rev,             # <<<<<<<<<<<<<<
 *                'reads_mate_same_strand': self.same_strand.all,
 *                'reads_mate_same_strand_fwd': self.same_strand.fwd,
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->mate_other_chr->rev); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 409, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_mate_other_chr_rev, __pyx_t_2) < 0) __PYX_ERR(0, 398, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":410
 *                'reads_mate_other_chr_fwd': self.mate_other_chr.fwd,
 *                'reads_mate_other_chr_rev': self.mate_other_chr.rev,
 *                'reads_mate_same_strand': self.same_strand.all,             # <<<<<<<<<<<<<<
 *                'reads_mate_same_strand_fwd': self.same_strand.fwd,
 *                'reads_mate_same_strand_rev': self.same_strand.rev,
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->same_strand->all); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 410, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_mate_same_strand, __pyx_t_2) < 0) __PYX_ERR(0, 398, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":411
 *                'reads_mate_other_chr_rev': self.mate_other_chr.rev,
 *                'reads_mate_same_strand': self.same_strand.all,
 *                'reads_mate_same_strand_fwd': self.same_strand.fwd,             # <<<<<<<<<<<<<<
 *                'reads_mate_same_strand_rev': self.same_strand.rev,
 *                'reads_faceaway': self.faceaway.all,
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->same_strand->fwd); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 411, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_mate_same_strand_fwd, __pyx_t_2) < 0) __PYX_ERR(0, 398, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":412
 *                'reads_mate_same_strand': self.same_strand.all,
 *                'reads_mate_same_strand_fwd': self.same_strand.fwd,
 *                'reads_mate_same_strand_rev': self.same_strand.rev,             # <<<<<<<<<<<<<<
 *                'reads_faceaway': self.faceaway.all,
 *                'reads_faceaway_fwd': self.faceaway.fwd,
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->same_strand->rev); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 412, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_mate_same_strand_rev, __pyx_t_2) < 0) __PYX_ERR(0, 398, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":413
 *                'reads_mate_same_strand_fwd': self.same_strand.fwd,
 *                'reads_mate_same_strand_rev': self.same_strand.rev,
 *                'reads_faceaway': self.faceaway.all,             # <<<<<<<<<<<<<<
 *                'reads_faceaway_fwd': self.faceaway.fwd,
 *                'reads_faceaway_rev': self.faceaway.rev,
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->faceaway->all); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 413, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_faceaway, __pyx_t_2) < 0) __PYX_ERR(0, 398, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":414
 *                'reads_mate_same_strand_rev': self.same_strand.rev,
 *                'reads_faceaway': self.faceaway.all,
 *                'reads_faceaway_fwd': self.faceaway.fwd,             # <<<<<<<<<<<<<<
 *                'reads_faceaway_rev': self.faceaway.rev,
 *                'reads_softclipped': self.softclipped.all,
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->faceaway->fwd); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 414, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_faceaway_fwd, __pyx_t_2) < 0) __PYX_ERR(0, 398, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":415
 *                'reads_faceaway': self.faceaway.all,
 *                'reads_faceaway_fwd': self.faceaway.fwd,
 *                'reads_faceaway_rev': self.faceaway.rev,             # <<<<<<<<<<<<<<
 *                'reads_softclipped': self.softclipped.all,
 *                'reads_softclipped_fwd': self.softclipped.fwd,
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->faceaway->rev); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 415, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_faceaway_rev, __pyx_t_2) < 0) __PYX_ERR(0, 398, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":416
 *                'reads_faceaway_fwd': self.faceaway.fwd,
 *                'reads_faceaway_rev': self.faceaway.rev,
 *                'reads_softclipped': self.softclipped.all,             # <<<<<<<<<<<<<<
 *                'reads_softclipped_fwd': self.softclipped.fwd,
 *                'reads_softclipped_rev': self.softclipped.rev,
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->softclipped->all); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 416, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_softclipped, __pyx_t_2) < 0) __PYX_ERR(0, 398, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":417
 *                'reads_faceaway_rev': self.faceaway.rev,
 *                'reads_softclipped': self.softclipped.all,
 *                'reads_softclipped_fwd': self.softclipped.fwd,             # <<<<<<<<<<<<<<
 *                'reads_softclipped_rev': self.softclipped.rev,
 *                'reads_duplicate': self.duplicate.all,
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->softclipped->fwd); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 417, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_softclipped_fwd, __pyx_t_2) < 0) __PYX_ERR(0, 398, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":418
 *                'reads_softclipped': self.softclipped.all,
 *                'reads_softclipped_fwd': self.softclipped.fwd,
 *                'reads_softclipped_rev': self.softclipped.rev,             # <<<<<<<<<<<<<<
 *                'reads_duplicate': self.duplicate.all,
 *                'reads_duplicate_fwd': self.duplicate.fwd,
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->softclipped->rev); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 418, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_softclipped_rev, __pyx_t_2) < 0) __PYX_ERR(0, 398, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":419
 *                'reads_softclipped_fwd': self.softclipped.fwd,
 *                'reads_softclipped_rev': self.softclipped.rev,
 *                'reads_duplicate': self.duplicate.all,             # <<<<<<<<<<<<<<
 *                'reads_duplicate_fwd': self.duplicate.fwd,
 *                'reads_duplicate_rev': self.duplicate.rev}
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->duplicate->all); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 419, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_duplicate, __pyx_t_2) < 0) __PYX_ERR(0, 398, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":420
 *                'reads_softclipped_rev': self.softclipped.rev,
 *                'reads_duplicate': self.duplicate.all,
 *                'reads_duplicate_fwd': self.duplicate.fwd,             # <<<<<<<<<<<<<<
 *                'reads_duplicate_rev': self.duplicate.rev}
 * 
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->duplicate->fwd); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 420, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_duplicate_fwd, __pyx_t_2) < 0) __PYX_ERR(0, 398, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":421
 *                'reads_duplicate': self.duplicate.all,
 *                'reads_duplicate_fwd': self.duplicate.fwd,
 *                'reads_duplicate_rev': self.duplicate.rev}             # <<<<<<<<<<<<<<
 * 
 *         # reset counters
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->duplicate->rev); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 421, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_duplicate_rev, __pyx_t_2) < 0) __PYX_ERR(0, 398, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_rec = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":424
 * 
 *         # reset counters
 *         self.reset()             # <<<<<<<<<<<<<<
 * 
 *         return rec
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 424, __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, 424, __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;

  /* "pysamstats/opt.pyx":426
 *         self.reset()
 * 
 *         return rec             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_rec);
  __pyx_r = __pyx_v_rec;
  goto __pyx_L0;

  /* "pysamstats/opt.pyx":395
 *             self.duplicate.incr(is_reverse)
 * 
 *     cdef dict rec(self, chrom, pos, FastaFile fafile, bytes refbase):             # <<<<<<<<<<<<<<
 * 
 *         # make record
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysamstats.opt.CoverageExtStrand.rec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rec);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_17CoverageExtStrand_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pysamstats_3opt_17CoverageExtStrand_4__reduce_cython__[] = "CoverageExtStrand.__reduce_cython__(self)";
static PyObject *__pyx_pw_10pysamstats_3opt_17CoverageExtStrand_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_17CoverageExtStrand_4__reduce_cython__(((struct __pyx_obj_10pysamstats_3opt_CoverageExtStrand *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pysamstats_3opt_17CoverageExtStrand_4__reduce_cython__(struct __pyx_obj_10pysamstats_3opt_CoverageExtStrand *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self.all, self.duplicate, self.faceaway, self.mate_other_chr, self.mate_unmapped, self.pp, self.same_strand, self.softclipped)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __pyx_t_1 = PyTuple_New(8); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->all));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->all));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self->all));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->duplicate));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->duplicate));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self->duplicate));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->faceaway));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->faceaway));
  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_self->faceaway));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->mate_other_chr));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->mate_other_chr));
  PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_v_self->mate_other_chr));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->mate_unmapped));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->mate_unmapped));
  PyTuple_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_v_self->mate_unmapped));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->pp));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->pp));
  PyTuple_SET_ITEM(__pyx_t_1, 5, ((PyObject *)__pyx_v_self->pp));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->same_strand));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->same_strand));
  PyTuple_SET_ITEM(__pyx_t_1, 6, ((PyObject *)__pyx_v_self->same_strand));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->softclipped));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->softclipped));
  PyTuple_SET_ITEM(__pyx_t_1, 7, ((PyObject *)__pyx_v_self->softclipped));
  __pyx_v_state = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self.all, self.duplicate, self.faceaway, self.mate_other_chr, self.mate_unmapped, self.pp, self.same_strand, self.softclipped)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         state += (_dict,)
 */
  __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__dict = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":7
 *     state = (self.all, self.duplicate, self.faceaway, self.mate_other_chr, self.mate_unmapped, self.pp, self.same_strand, self.softclipped)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
  __pyx_t_2 = (__pyx_v__dict != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
 */
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
    __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "(tree fragment)":9
 *     if _dict is not None:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = self.all is not None or self.duplicate is not None or self.faceaway is not None or self.mate_other_chr is not None or self.mate_unmapped is not None or self.pp is not None or self.same_strand is not None or self.softclipped is not None
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = (self.all, self.duplicate, self.faceaway, self.mate_other_chr, self.mate_unmapped, self.pp, self.same_strand, self.softclipped)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
    goto __pyx_L3;
  }

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = self.all is not None or self.duplicate is not None or self.faceaway is not None or self.mate_other_chr is not None or self.mate_unmapped is not None or self.pp is not None or self.same_strand is not None or self.softclipped is not None             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_CoverageExtStrand, (type(self), 0xc0c6edb, None), state
 */
  /*else*/ {
    __pyx_t_2 = (((PyObject *)__pyx_v_self->all) != Py_None);
    __pyx_t_5 = (__pyx_t_2 != 0);
    if (!__pyx_t_5) {
    } else {
      __pyx_t_3 = __pyx_t_5;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_5 = (((PyObject *)__pyx_v_self->duplicate) != Py_None);
    __pyx_t_2 = (__pyx_t_5 != 0);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_3 = __pyx_t_2;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_2 = (((PyObject *)__pyx_v_self->faceaway) != Py_None);
    __pyx_t_5 = (__pyx_t_2 != 0);
    if (!__pyx_t_5) {
    } else {
      __pyx_t_3 = __pyx_t_5;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_5 = (((PyObject *)__pyx_v_self->mate_other_chr) != Py_None);
    __pyx_t_2 = (__pyx_t_5 != 0);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_3 = __pyx_t_2;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_2 = (((PyObject *)__pyx_v_self->mate_unmapped) != Py_None);
    __pyx_t_5 = (__pyx_t_2 != 0);
    if (!__pyx_t_5) {
    } else {
      __pyx_t_3 = __pyx_t_5;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_5 = (((PyObject *)__pyx_v_self->pp) != Py_None);
    __pyx_t_2 = (__pyx_t_5 != 0);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_3 = __pyx_t_2;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_2 = (((PyObject *)__pyx_v_self->same_strand) != Py_None);
    __pyx_t_5 = (__pyx_t_2 != 0);
    if (!__pyx_t_5) {
    } else {
      __pyx_t_3 = __pyx_t_5;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_5 = (((PyObject *)__pyx_v_self->softclipped) != Py_None);
    __pyx_t_2 = (__pyx_t_5 != 0);
    __pyx_t_3 = __pyx_t_2;
    __pyx_L4_bool_binop_done:;
    __pyx_v_use_setstate = __pyx_t_3;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.all is not None or self.duplicate is not None or self.faceaway is not None or self.mate_other_chr is not None or self.mate_unmapped is not None or self.pp is not None or self.same_strand is not None or self.softclipped is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_CoverageExtStrand, (type(self), 0xc0c6edb, None), state
 *     else:
 */
  __pyx_t_3 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":13
 *         use_setstate = self.all is not None or self.duplicate is not None or self.faceaway is not None or self.mate_other_chr is not None or self.mate_unmapped is not None or self.pp is not None or self.same_strand is not None or self.softclipped is not None
 *     if use_setstate:
 *         return __pyx_unpickle_CoverageExtStrand, (type(self), 0xc0c6edb, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_CoverageExtStrand, (type(self), 0xc0c6edb, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_CoverageExtStrand); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_202141403);
    __Pyx_GIVEREF(__pyx_int_202141403);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_202141403);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
    __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_state);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.all is not None or self.duplicate is not None or self.faceaway is not None or self.mate_other_chr is not None or self.mate_unmapped is not None or self.pp is not None or self.same_strand is not None or self.softclipped is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_CoverageExtStrand, (type(self), 0xc0c6edb, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_CoverageExtStrand, (type(self), 0xc0c6edb, None), state
 *     else:
 *         return __pyx_unpickle_CoverageExtStrand, (type(self), 0xc0c6edb, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_CoverageExtStrand__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_pyx_unpickle_CoverageExtStrand); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_202141403);
    __Pyx_GIVEREF(__pyx_int_202141403);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_202141403);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
    __pyx_t_6 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pysamstats.opt.CoverageExtStrand.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_CoverageExtStrand, (type(self), 0xc0c6edb, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_CoverageExtStrand__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_17CoverageExtStrand_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_10pysamstats_3opt_17CoverageExtStrand_6__setstate_cython__[] = "CoverageExtStrand.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_10pysamstats_3opt_17CoverageExtStrand_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_17CoverageExtStrand_6__setstate_cython__(((struct __pyx_obj_10pysamstats_3opt_CoverageExtStrand *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_10pysamstats_3opt_17CoverageExtStrand_6__setstate_cython__(struct __pyx_obj_10pysamstats_3opt_CoverageExtStrand *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_CoverageExtStrand, (type(self), 0xc0c6edb, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_CoverageExtStrand__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
 */
  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_10pysamstats_3opt___pyx_unpickle_CoverageExtStrand__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_CoverageExtStrand, (type(self), 0xc0c6edb, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_CoverageExtStrand__set_state(self, __pyx_state)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysamstats.opt.CoverageExtStrand.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":449
 *         CountPp N
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.reads = CountPp()
 *         self.matches = CountPp()
 */

/* Python wrapper */
static int __pyx_pw_10pysamstats_3opt_9Variation_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_10pysamstats_3opt_9Variation_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
  __pyx_r = __pyx_pf_10pysamstats_3opt_9Variation___init__(((struct __pyx_obj_10pysamstats_3opt_Variation *)__pyx_v_self));

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

static int __pyx_pf_10pysamstats_3opt_9Variation___init__(struct __pyx_obj_10pysamstats_3opt_Variation *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "pysamstats/opt.pyx":450
 * 
 *     def __init__(self):
 *         self.reads = CountPp()             # <<<<<<<<<<<<<<
 *         self.matches = CountPp()
 *         self.mismatches = CountPp()
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_CountPp)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 450, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->reads);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->reads));
  __pyx_v_self->reads = ((struct __pyx_obj_10pysamstats_3opt_CountPp *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":451
 *     def __init__(self):
 *         self.reads = CountPp()
 *         self.matches = CountPp()             # <<<<<<<<<<<<<<
 *         self.mismatches = CountPp()
 *         self.deletions = CountPp()
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_CountPp)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 451, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->matches);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->matches));
  __pyx_v_self->matches = ((struct __pyx_obj_10pysamstats_3opt_CountPp *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":452
 *         self.reads = CountPp()
 *         self.matches = CountPp()
 *         self.mismatches = CountPp()             # <<<<<<<<<<<<<<
 *         self.deletions = CountPp()
 *         self.insertions = CountPp()
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_CountPp)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 452, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->mismatches);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->mismatches));
  __pyx_v_self->mismatches = ((struct __pyx_obj_10pysamstats_3opt_CountPp *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":453
 *         self.matches = CountPp()
 *         self.mismatches = CountPp()
 *         self.deletions = CountPp()             # <<<<<<<<<<<<<<
 *         self.insertions = CountPp()
 *         self.A = CountPp()
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_CountPp)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 453, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->deletions);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->deletions));
  __pyx_v_self->deletions = ((struct __pyx_obj_10pysamstats_3opt_CountPp *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":454
 *         self.mismatches = CountPp()
 *         self.deletions = CountPp()
 *         self.insertions = CountPp()             # <<<<<<<<<<<<<<
 *         self.A = CountPp()
 *         self.C = CountPp()
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_CountPp)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 454, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->insertions);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->insertions));
  __pyx_v_self->insertions = ((struct __pyx_obj_10pysamstats_3opt_CountPp *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":455
 *         self.deletions = CountPp()
 *         self.insertions = CountPp()
 *         self.A = CountPp()             # <<<<<<<<<<<<<<
 *         self.C = CountPp()
 *         self.T = CountPp()
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_CountPp)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 455, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->A);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->A));
  __pyx_v_self->A = ((struct __pyx_obj_10pysamstats_3opt_CountPp *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":456
 *         self.insertions = CountPp()
 *         self.A = CountPp()
 *         self.C = CountPp()             # <<<<<<<<<<<<<<
 *         self.T = CountPp()
 *         self.G = CountPp()
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_CountPp)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 456, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->C);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->C));
  __pyx_v_self->C = ((struct __pyx_obj_10pysamstats_3opt_CountPp *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":457
 *         self.A = CountPp()
 *         self.C = CountPp()
 *         self.T = CountPp()             # <<<<<<<<<<<<<<
 *         self.G = CountPp()
 *         self.N = CountPp()
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_CountPp)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 457, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->T);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->T));
  __pyx_v_self->T = ((struct __pyx_obj_10pysamstats_3opt_CountPp *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":458
 *         self.C = CountPp()
 *         self.T = CountPp()
 *         self.G = CountPp()             # <<<<<<<<<<<<<<
 *         self.N = CountPp()
 *         self.reset()
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_CountPp)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 458, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->G);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->G));
  __pyx_v_self->G = ((struct __pyx_obj_10pysamstats_3opt_CountPp *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":459
 *         self.T = CountPp()
 *         self.G = CountPp()
 *         self.N = CountPp()             # <<<<<<<<<<<<<<
 *         self.reset()
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_CountPp)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 459, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->N);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->N));
  __pyx_v_self->N = ((struct __pyx_obj_10pysamstats_3opt_CountPp *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":460
 *         self.G = CountPp()
 *         self.N = CountPp()
 *         self.reset()             # <<<<<<<<<<<<<<
 * 
 *     def reset(self):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 460, __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, 460, __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;

  /* "pysamstats/opt.pyx":449
 *         CountPp N
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.reads = CountPp()
 *         self.matches = CountPp()
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysamstats.opt.Variation.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":462
 *         self.reset()
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         self.reads.reset()
 *         self.matches.reset()
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_9Variation_3reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pysamstats_3opt_9Variation_2reset[] = "Variation.reset(self)";
static PyObject *__pyx_pw_10pysamstats_3opt_9Variation_3reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reset (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_9Variation_2reset(((struct __pyx_obj_10pysamstats_3opt_Variation *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pysamstats_3opt_9Variation_2reset(struct __pyx_obj_10pysamstats_3opt_Variation *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("reset", 0);

  /* "pysamstats/opt.pyx":463
 * 
 *     def reset(self):
 *         self.reads.reset()             # <<<<<<<<<<<<<<
 *         self.matches.reset()
 *         self.mismatches.reset()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->reads), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 463, __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, 463, __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;

  /* "pysamstats/opt.pyx":464
 *     def reset(self):
 *         self.reads.reset()
 *         self.matches.reset()             # <<<<<<<<<<<<<<
 *         self.mismatches.reset()
 *         self.deletions.reset()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->matches), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 464, __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, 464, __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;

  /* "pysamstats/opt.pyx":465
 *         self.reads.reset()
 *         self.matches.reset()
 *         self.mismatches.reset()             # <<<<<<<<<<<<<<
 *         self.deletions.reset()
 *         self.insertions.reset()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->mismatches), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 465, __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, 465, __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;

  /* "pysamstats/opt.pyx":466
 *         self.matches.reset()
 *         self.mismatches.reset()
 *         self.deletions.reset()             # <<<<<<<<<<<<<<
 *         self.insertions.reset()
 *         self.A.reset()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->deletions), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 466, __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, 466, __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;

  /* "pysamstats/opt.pyx":467
 *         self.mismatches.reset()
 *         self.deletions.reset()
 *         self.insertions.reset()             # <<<<<<<<<<<<<<
 *         self.A.reset()
 *         self.C.reset()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->insertions), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 467, __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, 467, __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;

  /* "pysamstats/opt.pyx":468
 *         self.deletions.reset()
 *         self.insertions.reset()
 *         self.A.reset()             # <<<<<<<<<<<<<<
 *         self.C.reset()
 *         self.T.reset()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->A), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 468, __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, 468, __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;

  /* "pysamstats/opt.pyx":469
 *         self.insertions.reset()
 *         self.A.reset()
 *         self.C.reset()             # <<<<<<<<<<<<<<
 *         self.T.reset()
 *         self.G.reset()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->C), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 469, __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, 469, __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;

  /* "pysamstats/opt.pyx":470
 *         self.A.reset()
 *         self.C.reset()
 *         self.T.reset()             # <<<<<<<<<<<<<<
 *         self.G.reset()
 *         self.N.reset()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->T), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 470, __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, 470, __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;

  /* "pysamstats/opt.pyx":471
 *         self.C.reset()
 *         self.T.reset()
 *         self.G.reset()             # <<<<<<<<<<<<<<
 *         self.N.reset()
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->G), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 471, __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, 471, __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;

  /* "pysamstats/opt.pyx":472
 *         self.T.reset()
 *         self.G.reset()
 *         self.N.reset()             # <<<<<<<<<<<<<<
 * 
 *     cdef void recv(self, bam_pileup1_t* read, PileupColumn col, bytes refbase):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->N), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 472, __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, 472, __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;

  /* "pysamstats/opt.pyx":462
 *         self.reset()
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         self.reads.reset()
 *         self.matches.reset()
 */

  /* 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_AddTraceback("pysamstats.opt.Variation.reset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":474
 *         self.N.reset()
 * 
 *     cdef void recv(self, bam_pileup1_t* read, PileupColumn col, bytes refbase):             # <<<<<<<<<<<<<<
 *         cdef:
 *             uint32_t flag
 */

static void __pyx_f_10pysamstats_3opt_9Variation_recv(struct __pyx_obj_10pysamstats_3opt_Variation *__pyx_v_self, bam_pileup1_t *__pyx_v_read, CYTHON_UNUSED struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn *__pyx_v_col, PyObject *__pyx_v_refbase) {
  uint32_t __pyx_v_flag;
  int __pyx_v_is_proper_pair;
  PyObject *__pyx_v_alnbase = 0;
  __Pyx_RefNannyDeclarations
  uint16_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("recv", 0);

  /* "pysamstats/opt.pyx":481
 * 
 *         # convenience variables
 *         flag = read.b.core.flag             # <<<<<<<<<<<<<<
 *         is_proper_pair = <bint>(flag & BAM_FPROPER_PAIR)
 * 
 */
  __pyx_t_1 = __pyx_v_read->b->core.flag;
  __pyx_v_flag = __pyx_t_1;

  /* "pysamstats/opt.pyx":482
 *         # convenience variables
 *         flag = read.b.core.flag
 *         is_proper_pair = <bint>(flag & BAM_FPROPER_PAIR)             # <<<<<<<<<<<<<<
 * 
 *         # do the counting
 */
  __pyx_v_is_proper_pair = ((__pyx_v_flag & 2) != 0);

  /* "pysamstats/opt.pyx":485
 * 
 *         # do the counting
 *         self.reads.incr(is_proper_pair)             # <<<<<<<<<<<<<<
 *         if read.is_del:
 *             if not read.is_refskip:
 */
  ((struct __pyx_vtabstruct_10pysamstats_3opt_CountPp *)__pyx_v_self->reads->__pyx_vtab)->incr(__pyx_v_self->reads, __pyx_v_is_proper_pair);

  /* "pysamstats/opt.pyx":486
 *         # do the counting
 *         self.reads.incr(is_proper_pair)
 *         if read.is_del:             # <<<<<<<<<<<<<<
 *             if not read.is_refskip:
 *                 self.deletions.incr(is_proper_pair)
 */
  __pyx_t_2 = (__pyx_v_read->is_del != 0);
  if (__pyx_t_2) {

    /* "pysamstats/opt.pyx":487
 *         self.reads.incr(is_proper_pair)
 *         if read.is_del:
 *             if not read.is_refskip:             # <<<<<<<<<<<<<<
 *                 self.deletions.incr(is_proper_pair)
 *         else:
 */
    __pyx_t_2 = ((!(__pyx_v_read->is_refskip != 0)) != 0);
    if (__pyx_t_2) {

      /* "pysamstats/opt.pyx":488
 *         if read.is_del:
 *             if not read.is_refskip:
 *                 self.deletions.incr(is_proper_pair)             # <<<<<<<<<<<<<<
 *         else:
 *             alnbase = get_seq_base(read.b, read.qpos)
 */
      ((struct __pyx_vtabstruct_10pysamstats_3opt_CountPp *)__pyx_v_self->deletions->__pyx_vtab)->incr(__pyx_v_self->deletions, __pyx_v_is_proper_pair);

      /* "pysamstats/opt.pyx":487
 *         self.reads.incr(is_proper_pair)
 *         if read.is_del:
 *             if not read.is_refskip:             # <<<<<<<<<<<<<<
 *                 self.deletions.incr(is_proper_pair)
 *         else:
 */
    }

    /* "pysamstats/opt.pyx":486
 *         # do the counting
 *         self.reads.incr(is_proper_pair)
 *         if read.is_del:             # <<<<<<<<<<<<<<
 *             if not read.is_refskip:
 *                 self.deletions.incr(is_proper_pair)
 */
    goto __pyx_L3;
  }

  /* "pysamstats/opt.pyx":490
 *                 self.deletions.incr(is_proper_pair)
 *         else:
 *             alnbase = get_seq_base(read.b, read.qpos)             # <<<<<<<<<<<<<<
 *             if alnbase == b'A':
 *                 self.A.incr(is_proper_pair)
 */
  /*else*/ {
    __pyx_t_3 = __pyx_f_10pysamstats_3opt_get_seq_base(__pyx_v_read->b, __pyx_v_read->qpos); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 490, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(0, 490, __pyx_L1_error)
    __pyx_v_alnbase = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "pysamstats/opt.pyx":491
 *         else:
 *             alnbase = get_seq_base(read.b, read.qpos)
 *             if alnbase == b'A':             # <<<<<<<<<<<<<<
 *                 self.A.incr(is_proper_pair)
 *             elif alnbase == b'T':
 */
    __pyx_t_2 = (__Pyx_PyBytes_Equals(__pyx_v_alnbase, __pyx_n_b_A, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 491, __pyx_L1_error)
    __pyx_t_4 = (__pyx_t_2 != 0);
    if (__pyx_t_4) {

      /* "pysamstats/opt.pyx":492
 *             alnbase = get_seq_base(read.b, read.qpos)
 *             if alnbase == b'A':
 *                 self.A.incr(is_proper_pair)             # <<<<<<<<<<<<<<
 *             elif alnbase == b'T':
 *                 self.T.incr(is_proper_pair)
 */
      ((struct __pyx_vtabstruct_10pysamstats_3opt_CountPp *)__pyx_v_self->A->__pyx_vtab)->incr(__pyx_v_self->A, __pyx_v_is_proper_pair);

      /* "pysamstats/opt.pyx":491
 *         else:
 *             alnbase = get_seq_base(read.b, read.qpos)
 *             if alnbase == b'A':             # <<<<<<<<<<<<<<
 *                 self.A.incr(is_proper_pair)
 *             elif alnbase == b'T':
 */
      goto __pyx_L5;
    }

    /* "pysamstats/opt.pyx":493
 *             if alnbase == b'A':
 *                 self.A.incr(is_proper_pair)
 *             elif alnbase == b'T':             # <<<<<<<<<<<<<<
 *                 self.T.incr(is_proper_pair)
 *             elif alnbase == b'C':
 */
    __pyx_t_4 = (__Pyx_PyBytes_Equals(__pyx_v_alnbase, __pyx_n_b_T, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 493, __pyx_L1_error)
    __pyx_t_2 = (__pyx_t_4 != 0);
    if (__pyx_t_2) {

      /* "pysamstats/opt.pyx":494
 *                 self.A.incr(is_proper_pair)
 *             elif alnbase == b'T':
 *                 self.T.incr(is_proper_pair)             # <<<<<<<<<<<<<<
 *             elif alnbase == b'C':
 *                 self.C.incr(is_proper_pair)
 */
      ((struct __pyx_vtabstruct_10pysamstats_3opt_CountPp *)__pyx_v_self->T->__pyx_vtab)->incr(__pyx_v_self->T, __pyx_v_is_proper_pair);

      /* "pysamstats/opt.pyx":493
 *             if alnbase == b'A':
 *                 self.A.incr(is_proper_pair)
 *             elif alnbase == b'T':             # <<<<<<<<<<<<<<
 *                 self.T.incr(is_proper_pair)
 *             elif alnbase == b'C':
 */
      goto __pyx_L5;
    }

    /* "pysamstats/opt.pyx":495
 *             elif alnbase == b'T':
 *                 self.T.incr(is_proper_pair)
 *             elif alnbase == b'C':             # <<<<<<<<<<<<<<
 *                 self.C.incr(is_proper_pair)
 *             elif alnbase == b'G':
 */
    __pyx_t_2 = (__Pyx_PyBytes_Equals(__pyx_v_alnbase, __pyx_n_b_C, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 495, __pyx_L1_error)
    __pyx_t_4 = (__pyx_t_2 != 0);
    if (__pyx_t_4) {

      /* "pysamstats/opt.pyx":496
 *                 self.T.incr(is_proper_pair)
 *             elif alnbase == b'C':
 *                 self.C.incr(is_proper_pair)             # <<<<<<<<<<<<<<
 *             elif alnbase == b'G':
 *                 self.G.incr(is_proper_pair)
 */
      ((struct __pyx_vtabstruct_10pysamstats_3opt_CountPp *)__pyx_v_self->C->__pyx_vtab)->incr(__pyx_v_self->C, __pyx_v_is_proper_pair);

      /* "pysamstats/opt.pyx":495
 *             elif alnbase == b'T':
 *                 self.T.incr(is_proper_pair)
 *             elif alnbase == b'C':             # <<<<<<<<<<<<<<
 *                 self.C.incr(is_proper_pair)
 *             elif alnbase == b'G':
 */
      goto __pyx_L5;
    }

    /* "pysamstats/opt.pyx":497
 *             elif alnbase == b'C':
 *                 self.C.incr(is_proper_pair)
 *             elif alnbase == b'G':             # <<<<<<<<<<<<<<
 *                 self.G.incr(is_proper_pair)
 *             elif alnbase == b'N':
 */
    __pyx_t_4 = (__Pyx_PyBytes_Equals(__pyx_v_alnbase, __pyx_n_b_G, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 497, __pyx_L1_error)
    __pyx_t_2 = (__pyx_t_4 != 0);
    if (__pyx_t_2) {

      /* "pysamstats/opt.pyx":498
 *                 self.C.incr(is_proper_pair)
 *             elif alnbase == b'G':
 *                 self.G.incr(is_proper_pair)             # <<<<<<<<<<<<<<
 *             elif alnbase == b'N':
 *                 self.N.incr(is_proper_pair)
 */
      ((struct __pyx_vtabstruct_10pysamstats_3opt_CountPp *)__pyx_v_self->G->__pyx_vtab)->incr(__pyx_v_self->G, __pyx_v_is_proper_pair);

      /* "pysamstats/opt.pyx":497
 *             elif alnbase == b'C':
 *                 self.C.incr(is_proper_pair)
 *             elif alnbase == b'G':             # <<<<<<<<<<<<<<
 *                 self.G.incr(is_proper_pair)
 *             elif alnbase == b'N':
 */
      goto __pyx_L5;
    }

    /* "pysamstats/opt.pyx":499
 *             elif alnbase == b'G':
 *                 self.G.incr(is_proper_pair)
 *             elif alnbase == b'N':             # <<<<<<<<<<<<<<
 *                 self.N.incr(is_proper_pair)
 *             if read.indel > 0:
 */
    __pyx_t_2 = (__Pyx_PyBytes_Equals(__pyx_v_alnbase, __pyx_n_b_N, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 499, __pyx_L1_error)
    __pyx_t_4 = (__pyx_t_2 != 0);
    if (__pyx_t_4) {

      /* "pysamstats/opt.pyx":500
 *                 self.G.incr(is_proper_pair)
 *             elif alnbase == b'N':
 *                 self.N.incr(is_proper_pair)             # <<<<<<<<<<<<<<
 *             if read.indel > 0:
 *                 self.insertions.incr(is_proper_pair)
 */
      ((struct __pyx_vtabstruct_10pysamstats_3opt_CountPp *)__pyx_v_self->N->__pyx_vtab)->incr(__pyx_v_self->N, __pyx_v_is_proper_pair);

      /* "pysamstats/opt.pyx":499
 *             elif alnbase == b'G':
 *                 self.G.incr(is_proper_pair)
 *             elif alnbase == b'N':             # <<<<<<<<<<<<<<
 *                 self.N.incr(is_proper_pair)
 *             if read.indel > 0:
 */
    }
    __pyx_L5:;

    /* "pysamstats/opt.pyx":501
 *             elif alnbase == b'N':
 *                 self.N.incr(is_proper_pair)
 *             if read.indel > 0:             # <<<<<<<<<<<<<<
 *                 self.insertions.incr(is_proper_pair)
 *             if alnbase == refbase:
 */
    __pyx_t_4 = ((__pyx_v_read->indel > 0) != 0);
    if (__pyx_t_4) {

      /* "pysamstats/opt.pyx":502
 *                 self.N.incr(is_proper_pair)
 *             if read.indel > 0:
 *                 self.insertions.incr(is_proper_pair)             # <<<<<<<<<<<<<<
 *             if alnbase == refbase:
 *                 self.matches.incr(is_proper_pair)
 */
      ((struct __pyx_vtabstruct_10pysamstats_3opt_CountPp *)__pyx_v_self->insertions->__pyx_vtab)->incr(__pyx_v_self->insertions, __pyx_v_is_proper_pair);

      /* "pysamstats/opt.pyx":501
 *             elif alnbase == b'N':
 *                 self.N.incr(is_proper_pair)
 *             if read.indel > 0:             # <<<<<<<<<<<<<<
 *                 self.insertions.incr(is_proper_pair)
 *             if alnbase == refbase:
 */
    }

    /* "pysamstats/opt.pyx":503
 *             if read.indel > 0:
 *                 self.insertions.incr(is_proper_pair)
 *             if alnbase == refbase:             # <<<<<<<<<<<<<<
 *                 self.matches.incr(is_proper_pair)
 *             else:
 */
    __pyx_t_4 = (__Pyx_PyBytes_Equals(__pyx_v_alnbase, __pyx_v_refbase, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 503, __pyx_L1_error)
    __pyx_t_2 = (__pyx_t_4 != 0);
    if (__pyx_t_2) {

      /* "pysamstats/opt.pyx":504
 *                 self.insertions.incr(is_proper_pair)
 *             if alnbase == refbase:
 *                 self.matches.incr(is_proper_pair)             # <<<<<<<<<<<<<<
 *             else:
 *                 self.mismatches.incr(is_proper_pair)
 */
      ((struct __pyx_vtabstruct_10pysamstats_3opt_CountPp *)__pyx_v_self->matches->__pyx_vtab)->incr(__pyx_v_self->matches, __pyx_v_is_proper_pair);

      /* "pysamstats/opt.pyx":503
 *             if read.indel > 0:
 *                 self.insertions.incr(is_proper_pair)
 *             if alnbase == refbase:             # <<<<<<<<<<<<<<
 *                 self.matches.incr(is_proper_pair)
 *             else:
 */
      goto __pyx_L7;
    }

    /* "pysamstats/opt.pyx":506
 *                 self.matches.incr(is_proper_pair)
 *             else:
 *                 self.mismatches.incr(is_proper_pair)             # <<<<<<<<<<<<<<
 * 
 *     cdef dict rec(self, chrom, pos, FastaFile fafile, bytes refbase):
 */
    /*else*/ {
      ((struct __pyx_vtabstruct_10pysamstats_3opt_CountPp *)__pyx_v_self->mismatches->__pyx_vtab)->incr(__pyx_v_self->mismatches, __pyx_v_is_proper_pair);
    }
    __pyx_L7:;
  }
  __pyx_L3:;

  /* "pysamstats/opt.pyx":474
 *         self.N.reset()
 * 
 *     cdef void recv(self, bam_pileup1_t* read, PileupColumn col, bytes refbase):             # <<<<<<<<<<<<<<
 *         cdef:
 *             uint32_t flag
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_WriteUnraisable("pysamstats.opt.Variation.recv", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_alnbase);
  __Pyx_RefNannyFinishContext();
}

/* "pysamstats/opt.pyx":508
 *                 self.mismatches.incr(is_proper_pair)
 * 
 *     cdef dict rec(self, chrom, pos, FastaFile fafile, bytes refbase):             # <<<<<<<<<<<<<<
 * 
 *         # make record
 */

static PyObject *__pyx_f_10pysamstats_3opt_9Variation_rec(struct __pyx_obj_10pysamstats_3opt_Variation *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_chrom, CYTHON_UNUSED PyObject *__pyx_v_pos, CYTHON_UNUSED struct __pyx_obj_5pysam_9libcfaidx_FastaFile *__pyx_v_fafile, PyObject *__pyx_v_refbase) {
  PyObject *__pyx_v_ref = NULL;
  PyObject *__pyx_v_rec = 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;
  __Pyx_RefNannySetupContext("rec", 0);

  /* "pysamstats/opt.pyx":511
 * 
 *         # make record
 *         if PY2:             # <<<<<<<<<<<<<<
 *             ref = refbase
 *         else:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_PY2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 511, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 511, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "pysamstats/opt.pyx":512
 *         # make record
 *         if PY2:
 *             ref = refbase             # <<<<<<<<<<<<<<
 *         else:
 *             ref = str(refbase, 'ascii')
 */
    __Pyx_INCREF(__pyx_v_refbase);
    __pyx_v_ref = __pyx_v_refbase;

    /* "pysamstats/opt.pyx":511
 * 
 *         # make record
 *         if PY2:             # <<<<<<<<<<<<<<
 *             ref = refbase
 *         else:
 */
    goto __pyx_L3;
  }

  /* "pysamstats/opt.pyx":514
 *             ref = refbase
 *         else:
 *             ref = str(refbase, 'ascii')             # <<<<<<<<<<<<<<
 *         rec = {'ref': ref,
 *                'reads_all': self.reads.all,
 */
  /*else*/ {
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 514, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v_refbase);
    __Pyx_GIVEREF(__pyx_v_refbase);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_refbase);
    __Pyx_INCREF(__pyx_n_s_ascii);
    __Pyx_GIVEREF(__pyx_n_s_ascii);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_ascii);
    __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 514, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_ref = __pyx_t_3;
    __pyx_t_3 = 0;
  }
  __pyx_L3:;

  /* "pysamstats/opt.pyx":515
 *         else:
 *             ref = str(refbase, 'ascii')
 *         rec = {'ref': ref,             # <<<<<<<<<<<<<<
 *                'reads_all': self.reads.all,
 *                'reads_pp': self.reads.pp,
 */
  __pyx_t_3 = __Pyx_PyDict_NewPresized(21); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 515, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_ref, __pyx_v_ref) < 0) __PYX_ERR(0, 515, __pyx_L1_error)

  /* "pysamstats/opt.pyx":516
 *             ref = str(refbase, 'ascii')
 *         rec = {'ref': ref,
 *                'reads_all': self.reads.all,             # <<<<<<<<<<<<<<
 *                'reads_pp': self.reads.pp,
 *                'matches': self.matches.all,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->reads->all); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 516, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_reads_all, __pyx_t_1) < 0) __PYX_ERR(0, 515, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":517
 *         rec = {'ref': ref,
 *                'reads_all': self.reads.all,
 *                'reads_pp': self.reads.pp,             # <<<<<<<<<<<<<<
 *                'matches': self.matches.all,
 *                'matches_pp': self.matches.pp,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->reads->pp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 517, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_reads_pp, __pyx_t_1) < 0) __PYX_ERR(0, 515, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":518
 *                'reads_all': self.reads.all,
 *                'reads_pp': self.reads.pp,
 *                'matches': self.matches.all,             # <<<<<<<<<<<<<<
 *                'matches_pp': self.matches.pp,
 *                'mismatches': self.mismatches.all,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->matches->all); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 518, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_matches, __pyx_t_1) < 0) __PYX_ERR(0, 515, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":519
 *                'reads_pp': self.reads.pp,
 *                'matches': self.matches.all,
 *                'matches_pp': self.matches.pp,             # <<<<<<<<<<<<<<
 *                'mismatches': self.mismatches.all,
 *                'mismatches_pp': self.mismatches.pp,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->matches->pp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 519, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_matches_pp, __pyx_t_1) < 0) __PYX_ERR(0, 515, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":520
 *                'matches': self.matches.all,
 *                'matches_pp': self.matches.pp,
 *                'mismatches': self.mismatches.all,             # <<<<<<<<<<<<<<
 *                'mismatches_pp': self.mismatches.pp,
 *                'deletions': self.deletions.all,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->mismatches->all); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 520, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_mismatches, __pyx_t_1) < 0) __PYX_ERR(0, 515, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":521
 *                'matches_pp': self.matches.pp,
 *                'mismatches': self.mismatches.all,
 *                'mismatches_pp': self.mismatches.pp,             # <<<<<<<<<<<<<<
 *                'deletions': self.deletions.all,
 *                'deletions_pp': self.deletions.pp,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->mismatches->pp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 521, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_mismatches_pp, __pyx_t_1) < 0) __PYX_ERR(0, 515, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":522
 *                'mismatches': self.mismatches.all,
 *                'mismatches_pp': self.mismatches.pp,
 *                'deletions': self.deletions.all,             # <<<<<<<<<<<<<<
 *                'deletions_pp': self.deletions.pp,
 *                'insertions': self.insertions.all,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->deletions->all); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 522, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_deletions, __pyx_t_1) < 0) __PYX_ERR(0, 515, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":523
 *                'mismatches_pp': self.mismatches.pp,
 *                'deletions': self.deletions.all,
 *                'deletions_pp': self.deletions.pp,             # <<<<<<<<<<<<<<
 *                'insertions': self.insertions.all,
 *                'insertions_pp': self.insertions.pp,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->deletions->pp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 523, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_deletions_pp, __pyx_t_1) < 0) __PYX_ERR(0, 515, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":524
 *                'deletions': self.deletions.all,
 *                'deletions_pp': self.deletions.pp,
 *                'insertions': self.insertions.all,             # <<<<<<<<<<<<<<
 *                'insertions_pp': self.insertions.pp,
 *                'A': self.A.all, 'A_pp': self.A.pp,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->insertions->all); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 524, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_insertions, __pyx_t_1) < 0) __PYX_ERR(0, 515, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":525
 *                'deletions_pp': self.deletions.pp,
 *                'insertions': self.insertions.all,
 *                'insertions_pp': self.insertions.pp,             # <<<<<<<<<<<<<<
 *                'A': self.A.all, 'A_pp': self.A.pp,
 *                'C': self.C.all, 'C_pp': self.C.pp,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->insertions->pp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 525, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_insertions_pp, __pyx_t_1) < 0) __PYX_ERR(0, 515, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":526
 *                'insertions': self.insertions.all,
 *                'insertions_pp': self.insertions.pp,
 *                'A': self.A.all, 'A_pp': self.A.pp,             # <<<<<<<<<<<<<<
 *                'C': self.C.all, 'C_pp': self.C.pp,
 *                'T': self.T.all, 'T_pp': self.T.pp,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->A->all); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 526, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_A, __pyx_t_1) < 0) __PYX_ERR(0, 515, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->A->pp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 526, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_A_pp, __pyx_t_1) < 0) __PYX_ERR(0, 515, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":527
 *                'insertions_pp': self.insertions.pp,
 *                'A': self.A.all, 'A_pp': self.A.pp,
 *                'C': self.C.all, 'C_pp': self.C.pp,             # <<<<<<<<<<<<<<
 *                'T': self.T.all, 'T_pp': self.T.pp,
 *                'G': self.G.all, 'G_pp': self.G.pp,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->C->all); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 527, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_C, __pyx_t_1) < 0) __PYX_ERR(0, 515, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->C->pp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 527, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_C_pp, __pyx_t_1) < 0) __PYX_ERR(0, 515, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":528
 *                'A': self.A.all, 'A_pp': self.A.pp,
 *                'C': self.C.all, 'C_pp': self.C.pp,
 *                'T': self.T.all, 'T_pp': self.T.pp,             # <<<<<<<<<<<<<<
 *                'G': self.G.all, 'G_pp': self.G.pp,
 *                'N': self.N.all, 'N_pp': self.N.pp}
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->T->all); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 528, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_T, __pyx_t_1) < 0) __PYX_ERR(0, 515, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->T->pp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 528, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_T_pp, __pyx_t_1) < 0) __PYX_ERR(0, 515, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":529
 *                'C': self.C.all, 'C_pp': self.C.pp,
 *                'T': self.T.all, 'T_pp': self.T.pp,
 *                'G': self.G.all, 'G_pp': self.G.pp,             # <<<<<<<<<<<<<<
 *                'N': self.N.all, 'N_pp': self.N.pp}
 * 
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->G->all); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 529, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_G, __pyx_t_1) < 0) __PYX_ERR(0, 515, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->G->pp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 529, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_G_pp, __pyx_t_1) < 0) __PYX_ERR(0, 515, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":530
 *                'T': self.T.all, 'T_pp': self.T.pp,
 *                'G': self.G.all, 'G_pp': self.G.pp,
 *                'N': self.N.all, 'N_pp': self.N.pp}             # <<<<<<<<<<<<<<
 * 
 *         # reset counters
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->N->all); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 530, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_N, __pyx_t_1) < 0) __PYX_ERR(0, 515, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->N->pp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 530, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_N_pp, __pyx_t_1) < 0) __PYX_ERR(0, 515, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_rec = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pysamstats/opt.pyx":533
 * 
 *         # reset counters
 *         self.reset()             # <<<<<<<<<<<<<<
 * 
 *         return rec
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reset); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 533, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(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_CallOneArg(__pyx_t_1, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 533, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pysamstats/opt.pyx":535
 *         self.reset()
 * 
 *         return rec             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_rec);
  __pyx_r = __pyx_v_rec;
  goto __pyx_L0;

  /* "pysamstats/opt.pyx":508
 *                 self.mismatches.incr(is_proper_pair)
 * 
 *     cdef dict rec(self, chrom, pos, FastaFile fafile, bytes refbase):             # <<<<<<<<<<<<<<
 * 
 *         # make record
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pysamstats.opt.Variation.rec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ref);
  __Pyx_XDECREF(__pyx_v_rec);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_9Variation_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pysamstats_3opt_9Variation_4__reduce_cython__[] = "Variation.__reduce_cython__(self)";
static PyObject *__pyx_pw_10pysamstats_3opt_9Variation_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_9Variation_4__reduce_cython__(((struct __pyx_obj_10pysamstats_3opt_Variation *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pysamstats_3opt_9Variation_4__reduce_cython__(struct __pyx_obj_10pysamstats_3opt_Variation *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self.A, self.C, self.G, self.N, self.T, self.deletions, self.insertions, self.matches, self.mismatches, self.reads)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __pyx_t_1 = PyTuple_New(10); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->A));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->A));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self->A));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->C));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->C));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self->C));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->G));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->G));
  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_self->G));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->N));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->N));
  PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_v_self->N));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->T));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->T));
  PyTuple_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_v_self->T));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->deletions));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->deletions));
  PyTuple_SET_ITEM(__pyx_t_1, 5, ((PyObject *)__pyx_v_self->deletions));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->insertions));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->insertions));
  PyTuple_SET_ITEM(__pyx_t_1, 6, ((PyObject *)__pyx_v_self->insertions));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->matches));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->matches));
  PyTuple_SET_ITEM(__pyx_t_1, 7, ((PyObject *)__pyx_v_self->matches));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->mismatches));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->mismatches));
  PyTuple_SET_ITEM(__pyx_t_1, 8, ((PyObject *)__pyx_v_self->mismatches));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->reads));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->reads));
  PyTuple_SET_ITEM(__pyx_t_1, 9, ((PyObject *)__pyx_v_self->reads));
  __pyx_v_state = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self.A, self.C, self.G, self.N, self.T, self.deletions, self.insertions, self.matches, self.mismatches, self.reads)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         state += (_dict,)
 */
  __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__dict = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":7
 *     state = (self.A, self.C, self.G, self.N, self.T, self.deletions, self.insertions, self.matches, self.mismatches, self.reads)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
  __pyx_t_2 = (__pyx_v__dict != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
 */
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
    __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "(tree fragment)":9
 *     if _dict is not None:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = self.A is not None or self.C is not None or self.G is not None or self.N is not None or self.T is not None or self.deletions is not None or self.insertions is not None or self.matches is not None or self.mismatches is not None or self.reads is not None
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = (self.A, self.C, self.G, self.N, self.T, self.deletions, self.insertions, self.matches, self.mismatches, self.reads)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
    goto __pyx_L3;
  }

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = self.A is not None or self.C is not None or self.G is not None or self.N is not None or self.T is not None or self.deletions is not None or self.insertions is not None or self.matches is not None or self.mismatches is not None or self.reads is not None             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_Variation, (type(self), 0x5c4b584, None), state
 */
  /*else*/ {
    __pyx_t_2 = (((PyObject *)__pyx_v_self->A) != Py_None);
    __pyx_t_5 = (__pyx_t_2 != 0);
    if (!__pyx_t_5) {
    } else {
      __pyx_t_3 = __pyx_t_5;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_5 = (((PyObject *)__pyx_v_self->C) != Py_None);
    __pyx_t_2 = (__pyx_t_5 != 0);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_3 = __pyx_t_2;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_2 = (((PyObject *)__pyx_v_self->G) != Py_None);
    __pyx_t_5 = (__pyx_t_2 != 0);
    if (!__pyx_t_5) {
    } else {
      __pyx_t_3 = __pyx_t_5;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_5 = (((PyObject *)__pyx_v_self->N) != Py_None);
    __pyx_t_2 = (__pyx_t_5 != 0);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_3 = __pyx_t_2;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_2 = (((PyObject *)__pyx_v_self->T) != Py_None);
    __pyx_t_5 = (__pyx_t_2 != 0);
    if (!__pyx_t_5) {
    } else {
      __pyx_t_3 = __pyx_t_5;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_5 = (((PyObject *)__pyx_v_self->deletions) != Py_None);
    __pyx_t_2 = (__pyx_t_5 != 0);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_3 = __pyx_t_2;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_2 = (((PyObject *)__pyx_v_self->insertions) != Py_None);
    __pyx_t_5 = (__pyx_t_2 != 0);
    if (!__pyx_t_5) {
    } else {
      __pyx_t_3 = __pyx_t_5;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_5 = (((PyObject *)__pyx_v_self->matches) != Py_None);
    __pyx_t_2 = (__pyx_t_5 != 0);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_3 = __pyx_t_2;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_2 = (((PyObject *)__pyx_v_self->mismatches) != Py_None);
    __pyx_t_5 = (__pyx_t_2 != 0);
    if (!__pyx_t_5) {
    } else {
      __pyx_t_3 = __pyx_t_5;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_5 = (((PyObject *)__pyx_v_self->reads) != Py_None);
    __pyx_t_2 = (__pyx_t_5 != 0);
    __pyx_t_3 = __pyx_t_2;
    __pyx_L4_bool_binop_done:;
    __pyx_v_use_setstate = __pyx_t_3;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.A is not None or self.C is not None or self.G is not None or self.N is not None or self.T is not None or self.deletions is not None or self.insertions is not None or self.matches is not None or self.mismatches is not None or self.reads is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_Variation, (type(self), 0x5c4b584, None), state
 *     else:
 */
  __pyx_t_3 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":13
 *         use_setstate = self.A is not None or self.C is not None or self.G is not None or self.N is not None or self.T is not None or self.deletions is not None or self.insertions is not None or self.matches is not None or self.mismatches is not None or self.reads is not None
 *     if use_setstate:
 *         return __pyx_unpickle_Variation, (type(self), 0x5c4b584, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_Variation, (type(self), 0x5c4b584, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_Variation); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_96777604);
    __Pyx_GIVEREF(__pyx_int_96777604);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_96777604);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
    __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_state);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.A is not None or self.C is not None or self.G is not None or self.N is not None or self.T is not None or self.deletions is not None or self.insertions is not None or self.matches is not None or self.mismatches is not None or self.reads is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_Variation, (type(self), 0x5c4b584, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_Variation, (type(self), 0x5c4b584, None), state
 *     else:
 *         return __pyx_unpickle_Variation, (type(self), 0x5c4b584, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_Variation__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_pyx_unpickle_Variation); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_96777604);
    __Pyx_GIVEREF(__pyx_int_96777604);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_96777604);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
    __pyx_t_6 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pysamstats.opt.Variation.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_Variation, (type(self), 0x5c4b584, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_Variation__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_9Variation_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_10pysamstats_3opt_9Variation_6__setstate_cython__[] = "Variation.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_10pysamstats_3opt_9Variation_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_9Variation_6__setstate_cython__(((struct __pyx_obj_10pysamstats_3opt_Variation *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_10pysamstats_3opt_9Variation_6__setstate_cython__(struct __pyx_obj_10pysamstats_3opt_Variation *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_Variation, (type(self), 0x5c4b584, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_Variation__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
 */
  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_10pysamstats_3opt___pyx_unpickle_Variation__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_Variation, (type(self), 0x5c4b584, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_Variation__set_state(self, __pyx_state)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysamstats.opt.Variation.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":558
 *         CountPpStrand N
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.reads = CountPpStrand()
 *         self.matches = CountPpStrand()
 */

/* Python wrapper */
static int __pyx_pw_10pysamstats_3opt_15VariationStrand_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_10pysamstats_3opt_15VariationStrand_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
  __pyx_r = __pyx_pf_10pysamstats_3opt_15VariationStrand___init__(((struct __pyx_obj_10pysamstats_3opt_VariationStrand *)__pyx_v_self));

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

static int __pyx_pf_10pysamstats_3opt_15VariationStrand___init__(struct __pyx_obj_10pysamstats_3opt_VariationStrand *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "pysamstats/opt.pyx":559
 * 
 *     def __init__(self):
 *         self.reads = CountPpStrand()             # <<<<<<<<<<<<<<
 *         self.matches = CountPpStrand()
 *         self.mismatches = CountPpStrand()
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_CountPpStrand)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 559, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->reads);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->reads));
  __pyx_v_self->reads = ((struct __pyx_obj_10pysamstats_3opt_CountPpStrand *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":560
 *     def __init__(self):
 *         self.reads = CountPpStrand()
 *         self.matches = CountPpStrand()             # <<<<<<<<<<<<<<
 *         self.mismatches = CountPpStrand()
 *         self.deletions = CountPpStrand()
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_CountPpStrand)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 560, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->matches);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->matches));
  __pyx_v_self->matches = ((struct __pyx_obj_10pysamstats_3opt_CountPpStrand *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":561
 *         self.reads = CountPpStrand()
 *         self.matches = CountPpStrand()
 *         self.mismatches = CountPpStrand()             # <<<<<<<<<<<<<<
 *         self.deletions = CountPpStrand()
 *         self.insertions = CountPpStrand()
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_CountPpStrand)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 561, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->mismatches);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->mismatches));
  __pyx_v_self->mismatches = ((struct __pyx_obj_10pysamstats_3opt_CountPpStrand *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":562
 *         self.matches = CountPpStrand()
 *         self.mismatches = CountPpStrand()
 *         self.deletions = CountPpStrand()             # <<<<<<<<<<<<<<
 *         self.insertions = CountPpStrand()
 *         self.A = CountPpStrand()
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_CountPpStrand)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 562, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->deletions);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->deletions));
  __pyx_v_self->deletions = ((struct __pyx_obj_10pysamstats_3opt_CountPpStrand *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":563
 *         self.mismatches = CountPpStrand()
 *         self.deletions = CountPpStrand()
 *         self.insertions = CountPpStrand()             # <<<<<<<<<<<<<<
 *         self.A = CountPpStrand()
 *         self.C = CountPpStrand()
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_CountPpStrand)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 563, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->insertions);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->insertions));
  __pyx_v_self->insertions = ((struct __pyx_obj_10pysamstats_3opt_CountPpStrand *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":564
 *         self.deletions = CountPpStrand()
 *         self.insertions = CountPpStrand()
 *         self.A = CountPpStrand()             # <<<<<<<<<<<<<<
 *         self.C = CountPpStrand()
 *         self.T = CountPpStrand()
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_CountPpStrand)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 564, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->A);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->A));
  __pyx_v_self->A = ((struct __pyx_obj_10pysamstats_3opt_CountPpStrand *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":565
 *         self.insertions = CountPpStrand()
 *         self.A = CountPpStrand()
 *         self.C = CountPpStrand()             # <<<<<<<<<<<<<<
 *         self.T = CountPpStrand()
 *         self.G = CountPpStrand()
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_CountPpStrand)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 565, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->C);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->C));
  __pyx_v_self->C = ((struct __pyx_obj_10pysamstats_3opt_CountPpStrand *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":566
 *         self.A = CountPpStrand()
 *         self.C = CountPpStrand()
 *         self.T = CountPpStrand()             # <<<<<<<<<<<<<<
 *         self.G = CountPpStrand()
 *         self.N = CountPpStrand()
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_CountPpStrand)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 566, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->T);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->T));
  __pyx_v_self->T = ((struct __pyx_obj_10pysamstats_3opt_CountPpStrand *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":567
 *         self.C = CountPpStrand()
 *         self.T = CountPpStrand()
 *         self.G = CountPpStrand()             # <<<<<<<<<<<<<<
 *         self.N = CountPpStrand()
 *         self.reset()
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_CountPpStrand)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 567, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->G);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->G));
  __pyx_v_self->G = ((struct __pyx_obj_10pysamstats_3opt_CountPpStrand *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":568
 *         self.T = CountPpStrand()
 *         self.G = CountPpStrand()
 *         self.N = CountPpStrand()             # <<<<<<<<<<<<<<
 *         self.reset()
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_CountPpStrand)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 568, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->N);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->N));
  __pyx_v_self->N = ((struct __pyx_obj_10pysamstats_3opt_CountPpStrand *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":569
 *         self.G = CountPpStrand()
 *         self.N = CountPpStrand()
 *         self.reset()             # <<<<<<<<<<<<<<
 * 
 *     def reset(self):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 569, __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, 569, __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;

  /* "pysamstats/opt.pyx":558
 *         CountPpStrand N
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.reads = CountPpStrand()
 *         self.matches = CountPpStrand()
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysamstats.opt.VariationStrand.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":571
 *         self.reset()
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         self.reads.reset()
 *         self.matches.reset()
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_15VariationStrand_3reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pysamstats_3opt_15VariationStrand_2reset[] = "VariationStrand.reset(self)";
static PyObject *__pyx_pw_10pysamstats_3opt_15VariationStrand_3reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reset (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_15VariationStrand_2reset(((struct __pyx_obj_10pysamstats_3opt_VariationStrand *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pysamstats_3opt_15VariationStrand_2reset(struct __pyx_obj_10pysamstats_3opt_VariationStrand *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("reset", 0);

  /* "pysamstats/opt.pyx":572
 * 
 *     def reset(self):
 *         self.reads.reset()             # <<<<<<<<<<<<<<
 *         self.matches.reset()
 *         self.mismatches.reset()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->reads), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 572, __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, 572, __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;

  /* "pysamstats/opt.pyx":573
 *     def reset(self):
 *         self.reads.reset()
 *         self.matches.reset()             # <<<<<<<<<<<<<<
 *         self.mismatches.reset()
 *         self.deletions.reset()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->matches), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 573, __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, 573, __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;

  /* "pysamstats/opt.pyx":574
 *         self.reads.reset()
 *         self.matches.reset()
 *         self.mismatches.reset()             # <<<<<<<<<<<<<<
 *         self.deletions.reset()
 *         self.insertions.reset()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->mismatches), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 574, __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, 574, __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;

  /* "pysamstats/opt.pyx":575
 *         self.matches.reset()
 *         self.mismatches.reset()
 *         self.deletions.reset()             # <<<<<<<<<<<<<<
 *         self.insertions.reset()
 *         self.A.reset()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->deletions), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 575, __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, 575, __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;

  /* "pysamstats/opt.pyx":576
 *         self.mismatches.reset()
 *         self.deletions.reset()
 *         self.insertions.reset()             # <<<<<<<<<<<<<<
 *         self.A.reset()
 *         self.T.reset()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->insertions), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 576, __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, 576, __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;

  /* "pysamstats/opt.pyx":577
 *         self.deletions.reset()
 *         self.insertions.reset()
 *         self.A.reset()             # <<<<<<<<<<<<<<
 *         self.T.reset()
 *         self.C.reset()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->A), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 577, __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, 577, __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;

  /* "pysamstats/opt.pyx":578
 *         self.insertions.reset()
 *         self.A.reset()
 *         self.T.reset()             # <<<<<<<<<<<<<<
 *         self.C.reset()
 *         self.G.reset()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->T), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 578, __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, 578, __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;

  /* "pysamstats/opt.pyx":579
 *         self.A.reset()
 *         self.T.reset()
 *         self.C.reset()             # <<<<<<<<<<<<<<
 *         self.G.reset()
 *         self.N.reset()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->C), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 579, __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, 579, __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;

  /* "pysamstats/opt.pyx":580
 *         self.T.reset()
 *         self.C.reset()
 *         self.G.reset()             # <<<<<<<<<<<<<<
 *         self.N.reset()
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->G), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 580, __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, 580, __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;

  /* "pysamstats/opt.pyx":581
 *         self.C.reset()
 *         self.G.reset()
 *         self.N.reset()             # <<<<<<<<<<<<<<
 * 
 *     cdef void recv(self, bam_pileup1_t* read, PileupColumn col, bytes refbase):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->N), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 581, __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, 581, __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;

  /* "pysamstats/opt.pyx":571
 *         self.reset()
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         self.reads.reset()
 *         self.matches.reset()
 */

  /* 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_AddTraceback("pysamstats.opt.VariationStrand.reset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":583
 *         self.N.reset()
 * 
 *     cdef void recv(self, bam_pileup1_t* read, PileupColumn col, bytes refbase):             # <<<<<<<<<<<<<<
 *         cdef:
 *             uint32_t flag
 */

static void __pyx_f_10pysamstats_3opt_15VariationStrand_recv(struct __pyx_obj_10pysamstats_3opt_VariationStrand *__pyx_v_self, bam_pileup1_t *__pyx_v_read, CYTHON_UNUSED struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn *__pyx_v_col, PyObject *__pyx_v_refbase) {
  uint32_t __pyx_v_flag;
  int __pyx_v_is_proper_pair;
  PyObject *__pyx_v_alnbase = 0;
  int __pyx_v_is_reverse;
  __Pyx_RefNannyDeclarations
  uint16_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("recv", 0);

  /* "pysamstats/opt.pyx":590
 * 
 *         # convenience variables
 *         flag = read.b.core.flag             # <<<<<<<<<<<<<<
 *         is_proper_pair = <bint>(flag & BAM_FPROPER_PAIR)
 *         is_reverse = <bint>(flag & BAM_FREVERSE)
 */
  __pyx_t_1 = __pyx_v_read->b->core.flag;
  __pyx_v_flag = __pyx_t_1;

  /* "pysamstats/opt.pyx":591
 *         # convenience variables
 *         flag = read.b.core.flag
 *         is_proper_pair = <bint>(flag & BAM_FPROPER_PAIR)             # <<<<<<<<<<<<<<
 *         is_reverse = <bint>(flag & BAM_FREVERSE)
 * 
 */
  __pyx_v_is_proper_pair = ((__pyx_v_flag & 2) != 0);

  /* "pysamstats/opt.pyx":592
 *         flag = read.b.core.flag
 *         is_proper_pair = <bint>(flag & BAM_FPROPER_PAIR)
 *         is_reverse = <bint>(flag & BAM_FREVERSE)             # <<<<<<<<<<<<<<
 * 
 *         # do the counting
 */
  __pyx_v_is_reverse = ((__pyx_v_flag & 16) != 0);

  /* "pysamstats/opt.pyx":595
 * 
 *         # do the counting
 *         self.reads.incr(is_reverse, is_proper_pair)             # <<<<<<<<<<<<<<
 *         if read.is_del:
 *             if not read.is_refskip:
 */
  ((struct __pyx_vtabstruct_10pysamstats_3opt_CountPpStrand *)__pyx_v_self->reads->__pyx_vtab)->incr(__pyx_v_self->reads, __pyx_v_is_reverse, __pyx_v_is_proper_pair);

  /* "pysamstats/opt.pyx":596
 *         # do the counting
 *         self.reads.incr(is_reverse, is_proper_pair)
 *         if read.is_del:             # <<<<<<<<<<<<<<
 *             if not read.is_refskip:
 *                 self.deletions.incr(is_reverse, is_proper_pair)
 */
  __pyx_t_2 = (__pyx_v_read->is_del != 0);
  if (__pyx_t_2) {

    /* "pysamstats/opt.pyx":597
 *         self.reads.incr(is_reverse, is_proper_pair)
 *         if read.is_del:
 *             if not read.is_refskip:             # <<<<<<<<<<<<<<
 *                 self.deletions.incr(is_reverse, is_proper_pair)
 *         else:
 */
    __pyx_t_2 = ((!(__pyx_v_read->is_refskip != 0)) != 0);
    if (__pyx_t_2) {

      /* "pysamstats/opt.pyx":598
 *         if read.is_del:
 *             if not read.is_refskip:
 *                 self.deletions.incr(is_reverse, is_proper_pair)             # <<<<<<<<<<<<<<
 *         else:
 *             alnbase = get_seq_base(read.b, read.qpos)
 */
      ((struct __pyx_vtabstruct_10pysamstats_3opt_CountPpStrand *)__pyx_v_self->deletions->__pyx_vtab)->incr(__pyx_v_self->deletions, __pyx_v_is_reverse, __pyx_v_is_proper_pair);

      /* "pysamstats/opt.pyx":597
 *         self.reads.incr(is_reverse, is_proper_pair)
 *         if read.is_del:
 *             if not read.is_refskip:             # <<<<<<<<<<<<<<
 *                 self.deletions.incr(is_reverse, is_proper_pair)
 *         else:
 */
    }

    /* "pysamstats/opt.pyx":596
 *         # do the counting
 *         self.reads.incr(is_reverse, is_proper_pair)
 *         if read.is_del:             # <<<<<<<<<<<<<<
 *             if not read.is_refskip:
 *                 self.deletions.incr(is_reverse, is_proper_pair)
 */
    goto __pyx_L3;
  }

  /* "pysamstats/opt.pyx":600
 *                 self.deletions.incr(is_reverse, is_proper_pair)
 *         else:
 *             alnbase = get_seq_base(read.b, read.qpos)             # <<<<<<<<<<<<<<
 *             if alnbase == b'A':
 *                 self.A.incr(is_reverse, is_proper_pair)
 */
  /*else*/ {
    __pyx_t_3 = __pyx_f_10pysamstats_3opt_get_seq_base(__pyx_v_read->b, __pyx_v_read->qpos); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 600, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(0, 600, __pyx_L1_error)
    __pyx_v_alnbase = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "pysamstats/opt.pyx":601
 *         else:
 *             alnbase = get_seq_base(read.b, read.qpos)
 *             if alnbase == b'A':             # <<<<<<<<<<<<<<
 *                 self.A.incr(is_reverse, is_proper_pair)
 *             elif alnbase == b'T':
 */
    __pyx_t_2 = (__Pyx_PyBytes_Equals(__pyx_v_alnbase, __pyx_n_b_A, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 601, __pyx_L1_error)
    __pyx_t_4 = (__pyx_t_2 != 0);
    if (__pyx_t_4) {

      /* "pysamstats/opt.pyx":602
 *             alnbase = get_seq_base(read.b, read.qpos)
 *             if alnbase == b'A':
 *                 self.A.incr(is_reverse, is_proper_pair)             # <<<<<<<<<<<<<<
 *             elif alnbase == b'T':
 *                 self.T.incr(is_reverse, is_proper_pair)
 */
      ((struct __pyx_vtabstruct_10pysamstats_3opt_CountPpStrand *)__pyx_v_self->A->__pyx_vtab)->incr(__pyx_v_self->A, __pyx_v_is_reverse, __pyx_v_is_proper_pair);

      /* "pysamstats/opt.pyx":601
 *         else:
 *             alnbase = get_seq_base(read.b, read.qpos)
 *             if alnbase == b'A':             # <<<<<<<<<<<<<<
 *                 self.A.incr(is_reverse, is_proper_pair)
 *             elif alnbase == b'T':
 */
      goto __pyx_L5;
    }

    /* "pysamstats/opt.pyx":603
 *             if alnbase == b'A':
 *                 self.A.incr(is_reverse, is_proper_pair)
 *             elif alnbase == b'T':             # <<<<<<<<<<<<<<
 *                 self.T.incr(is_reverse, is_proper_pair)
 *             elif alnbase == b'C':
 */
    __pyx_t_4 = (__Pyx_PyBytes_Equals(__pyx_v_alnbase, __pyx_n_b_T, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 603, __pyx_L1_error)
    __pyx_t_2 = (__pyx_t_4 != 0);
    if (__pyx_t_2) {

      /* "pysamstats/opt.pyx":604
 *                 self.A.incr(is_reverse, is_proper_pair)
 *             elif alnbase == b'T':
 *                 self.T.incr(is_reverse, is_proper_pair)             # <<<<<<<<<<<<<<
 *             elif alnbase == b'C':
 *                 self.C.incr(is_reverse, is_proper_pair)
 */
      ((struct __pyx_vtabstruct_10pysamstats_3opt_CountPpStrand *)__pyx_v_self->T->__pyx_vtab)->incr(__pyx_v_self->T, __pyx_v_is_reverse, __pyx_v_is_proper_pair);

      /* "pysamstats/opt.pyx":603
 *             if alnbase == b'A':
 *                 self.A.incr(is_reverse, is_proper_pair)
 *             elif alnbase == b'T':             # <<<<<<<<<<<<<<
 *                 self.T.incr(is_reverse, is_proper_pair)
 *             elif alnbase == b'C':
 */
      goto __pyx_L5;
    }

    /* "pysamstats/opt.pyx":605
 *             elif alnbase == b'T':
 *                 self.T.incr(is_reverse, is_proper_pair)
 *             elif alnbase == b'C':             # <<<<<<<<<<<<<<
 *                 self.C.incr(is_reverse, is_proper_pair)
 *             elif alnbase == b'G':
 */
    __pyx_t_2 = (__Pyx_PyBytes_Equals(__pyx_v_alnbase, __pyx_n_b_C, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 605, __pyx_L1_error)
    __pyx_t_4 = (__pyx_t_2 != 0);
    if (__pyx_t_4) {

      /* "pysamstats/opt.pyx":606
 *                 self.T.incr(is_reverse, is_proper_pair)
 *             elif alnbase == b'C':
 *                 self.C.incr(is_reverse, is_proper_pair)             # <<<<<<<<<<<<<<
 *             elif alnbase == b'G':
 *                 self.G.incr(is_reverse, is_proper_pair)
 */
      ((struct __pyx_vtabstruct_10pysamstats_3opt_CountPpStrand *)__pyx_v_self->C->__pyx_vtab)->incr(__pyx_v_self->C, __pyx_v_is_reverse, __pyx_v_is_proper_pair);

      /* "pysamstats/opt.pyx":605
 *             elif alnbase == b'T':
 *                 self.T.incr(is_reverse, is_proper_pair)
 *             elif alnbase == b'C':             # <<<<<<<<<<<<<<
 *                 self.C.incr(is_reverse, is_proper_pair)
 *             elif alnbase == b'G':
 */
      goto __pyx_L5;
    }

    /* "pysamstats/opt.pyx":607
 *             elif alnbase == b'C':
 *                 self.C.incr(is_reverse, is_proper_pair)
 *             elif alnbase == b'G':             # <<<<<<<<<<<<<<
 *                 self.G.incr(is_reverse, is_proper_pair)
 *             elif alnbase == b'N':
 */
    __pyx_t_4 = (__Pyx_PyBytes_Equals(__pyx_v_alnbase, __pyx_n_b_G, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 607, __pyx_L1_error)
    __pyx_t_2 = (__pyx_t_4 != 0);
    if (__pyx_t_2) {

      /* "pysamstats/opt.pyx":608
 *                 self.C.incr(is_reverse, is_proper_pair)
 *             elif alnbase == b'G':
 *                 self.G.incr(is_reverse, is_proper_pair)             # <<<<<<<<<<<<<<
 *             elif alnbase == b'N':
 *                 self.N.incr(is_reverse, is_proper_pair)
 */
      ((struct __pyx_vtabstruct_10pysamstats_3opt_CountPpStrand *)__pyx_v_self->G->__pyx_vtab)->incr(__pyx_v_self->G, __pyx_v_is_reverse, __pyx_v_is_proper_pair);

      /* "pysamstats/opt.pyx":607
 *             elif alnbase == b'C':
 *                 self.C.incr(is_reverse, is_proper_pair)
 *             elif alnbase == b'G':             # <<<<<<<<<<<<<<
 *                 self.G.incr(is_reverse, is_proper_pair)
 *             elif alnbase == b'N':
 */
      goto __pyx_L5;
    }

    /* "pysamstats/opt.pyx":609
 *             elif alnbase == b'G':
 *                 self.G.incr(is_reverse, is_proper_pair)
 *             elif alnbase == b'N':             # <<<<<<<<<<<<<<
 *                 self.N.incr(is_reverse, is_proper_pair)
 *             if read.indel > 0:
 */
    __pyx_t_2 = (__Pyx_PyBytes_Equals(__pyx_v_alnbase, __pyx_n_b_N, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 609, __pyx_L1_error)
    __pyx_t_4 = (__pyx_t_2 != 0);
    if (__pyx_t_4) {

      /* "pysamstats/opt.pyx":610
 *                 self.G.incr(is_reverse, is_proper_pair)
 *             elif alnbase == b'N':
 *                 self.N.incr(is_reverse, is_proper_pair)             # <<<<<<<<<<<<<<
 *             if read.indel > 0:
 *                 self.insertions.incr(is_reverse, is_proper_pair)
 */
      ((struct __pyx_vtabstruct_10pysamstats_3opt_CountPpStrand *)__pyx_v_self->N->__pyx_vtab)->incr(__pyx_v_self->N, __pyx_v_is_reverse, __pyx_v_is_proper_pair);

      /* "pysamstats/opt.pyx":609
 *             elif alnbase == b'G':
 *                 self.G.incr(is_reverse, is_proper_pair)
 *             elif alnbase == b'N':             # <<<<<<<<<<<<<<
 *                 self.N.incr(is_reverse, is_proper_pair)
 *             if read.indel > 0:
 */
    }
    __pyx_L5:;

    /* "pysamstats/opt.pyx":611
 *             elif alnbase == b'N':
 *                 self.N.incr(is_reverse, is_proper_pair)
 *             if read.indel > 0:             # <<<<<<<<<<<<<<
 *                 self.insertions.incr(is_reverse, is_proper_pair)
 *             if alnbase == refbase:
 */
    __pyx_t_4 = ((__pyx_v_read->indel > 0) != 0);
    if (__pyx_t_4) {

      /* "pysamstats/opt.pyx":612
 *                 self.N.incr(is_reverse, is_proper_pair)
 *             if read.indel > 0:
 *                 self.insertions.incr(is_reverse, is_proper_pair)             # <<<<<<<<<<<<<<
 *             if alnbase == refbase:
 *                 self.matches.incr(is_reverse, is_proper_pair)
 */
      ((struct __pyx_vtabstruct_10pysamstats_3opt_CountPpStrand *)__pyx_v_self->insertions->__pyx_vtab)->incr(__pyx_v_self->insertions, __pyx_v_is_reverse, __pyx_v_is_proper_pair);

      /* "pysamstats/opt.pyx":611
 *             elif alnbase == b'N':
 *                 self.N.incr(is_reverse, is_proper_pair)
 *             if read.indel > 0:             # <<<<<<<<<<<<<<
 *                 self.insertions.incr(is_reverse, is_proper_pair)
 *             if alnbase == refbase:
 */
    }

    /* "pysamstats/opt.pyx":613
 *             if read.indel > 0:
 *                 self.insertions.incr(is_reverse, is_proper_pair)
 *             if alnbase == refbase:             # <<<<<<<<<<<<<<
 *                 self.matches.incr(is_reverse, is_proper_pair)
 *             else:
 */
    __pyx_t_4 = (__Pyx_PyBytes_Equals(__pyx_v_alnbase, __pyx_v_refbase, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 613, __pyx_L1_error)
    __pyx_t_2 = (__pyx_t_4 != 0);
    if (__pyx_t_2) {

      /* "pysamstats/opt.pyx":614
 *                 self.insertions.incr(is_reverse, is_proper_pair)
 *             if alnbase == refbase:
 *                 self.matches.incr(is_reverse, is_proper_pair)             # <<<<<<<<<<<<<<
 *             else:
 *                 self.mismatches.incr(is_reverse, is_proper_pair)
 */
      ((struct __pyx_vtabstruct_10pysamstats_3opt_CountPpStrand *)__pyx_v_self->matches->__pyx_vtab)->incr(__pyx_v_self->matches, __pyx_v_is_reverse, __pyx_v_is_proper_pair);

      /* "pysamstats/opt.pyx":613
 *             if read.indel > 0:
 *                 self.insertions.incr(is_reverse, is_proper_pair)
 *             if alnbase == refbase:             # <<<<<<<<<<<<<<
 *                 self.matches.incr(is_reverse, is_proper_pair)
 *             else:
 */
      goto __pyx_L7;
    }

    /* "pysamstats/opt.pyx":616
 *                 self.matches.incr(is_reverse, is_proper_pair)
 *             else:
 *                 self.mismatches.incr(is_reverse, is_proper_pair)             # <<<<<<<<<<<<<<
 * 
 *     cdef dict rec(self, chrom, pos, FastaFile fafile, bytes refbase):
 */
    /*else*/ {
      ((struct __pyx_vtabstruct_10pysamstats_3opt_CountPpStrand *)__pyx_v_self->mismatches->__pyx_vtab)->incr(__pyx_v_self->mismatches, __pyx_v_is_reverse, __pyx_v_is_proper_pair);
    }
    __pyx_L7:;
  }
  __pyx_L3:;

  /* "pysamstats/opt.pyx":583
 *         self.N.reset()
 * 
 *     cdef void recv(self, bam_pileup1_t* read, PileupColumn col, bytes refbase):             # <<<<<<<<<<<<<<
 *         cdef:
 *             uint32_t flag
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_WriteUnraisable("pysamstats.opt.VariationStrand.recv", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_alnbase);
  __Pyx_RefNannyFinishContext();
}

/* "pysamstats/opt.pyx":618
 *                 self.mismatches.incr(is_reverse, is_proper_pair)
 * 
 *     cdef dict rec(self, chrom, pos, FastaFile fafile, bytes refbase):             # <<<<<<<<<<<<<<
 * 
 *         # make record
 */

static PyObject *__pyx_f_10pysamstats_3opt_15VariationStrand_rec(struct __pyx_obj_10pysamstats_3opt_VariationStrand *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_chrom, CYTHON_UNUSED PyObject *__pyx_v_pos, CYTHON_UNUSED struct __pyx_obj_5pysam_9libcfaidx_FastaFile *__pyx_v_fafile, PyObject *__pyx_v_refbase) {
  PyObject *__pyx_v_ref = NULL;
  PyObject *__pyx_v_rec = 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;
  __Pyx_RefNannySetupContext("rec", 0);

  /* "pysamstats/opt.pyx":621
 * 
 *         # make record
 *         if PY2:             # <<<<<<<<<<<<<<
 *             ref = refbase
 *         else:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_PY2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 621, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 621, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "pysamstats/opt.pyx":622
 *         # make record
 *         if PY2:
 *             ref = refbase             # <<<<<<<<<<<<<<
 *         else:
 *             ref = str(refbase, 'ascii')
 */
    __Pyx_INCREF(__pyx_v_refbase);
    __pyx_v_ref = __pyx_v_refbase;

    /* "pysamstats/opt.pyx":621
 * 
 *         # make record
 *         if PY2:             # <<<<<<<<<<<<<<
 *             ref = refbase
 *         else:
 */
    goto __pyx_L3;
  }

  /* "pysamstats/opt.pyx":624
 *             ref = refbase
 *         else:
 *             ref = str(refbase, 'ascii')             # <<<<<<<<<<<<<<
 *         rec = {'ref': ref,
 *                'reads_all': self.reads.all,
 */
  /*else*/ {
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 624, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v_refbase);
    __Pyx_GIVEREF(__pyx_v_refbase);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_refbase);
    __Pyx_INCREF(__pyx_n_s_ascii);
    __Pyx_GIVEREF(__pyx_n_s_ascii);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_ascii);
    __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 624, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_ref = __pyx_t_3;
    __pyx_t_3 = 0;
  }
  __pyx_L3:;

  /* "pysamstats/opt.pyx":625
 *         else:
 *             ref = str(refbase, 'ascii')
 *         rec = {'ref': ref,             # <<<<<<<<<<<<<<
 *                'reads_all': self.reads.all,
 *                'reads_fwd': self.reads.fwd,
 */
  __pyx_t_3 = __Pyx_PyDict_NewPresized(61); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_ref, __pyx_v_ref) < 0) __PYX_ERR(0, 625, __pyx_L1_error)

  /* "pysamstats/opt.pyx":626
 *             ref = str(refbase, 'ascii')
 *         rec = {'ref': ref,
 *                'reads_all': self.reads.all,             # <<<<<<<<<<<<<<
 *                'reads_fwd': self.reads.fwd,
 *                'reads_rev': self.reads.rev,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->reads->all); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 626, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_reads_all, __pyx_t_1) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":627
 *         rec = {'ref': ref,
 *                'reads_all': self.reads.all,
 *                'reads_fwd': self.reads.fwd,             # <<<<<<<<<<<<<<
 *                'reads_rev': self.reads.rev,
 *                'reads_pp': self.reads.pp,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->reads->fwd); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 627, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_reads_fwd, __pyx_t_1) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":628
 *                'reads_all': self.reads.all,
 *                'reads_fwd': self.reads.fwd,
 *                'reads_rev': self.reads.rev,             # <<<<<<<<<<<<<<
 *                'reads_pp': self.reads.pp,
 *                'reads_pp_fwd': self.reads.pp_fwd,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->reads->rev); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 628, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_reads_rev, __pyx_t_1) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":629
 *                'reads_fwd': self.reads.fwd,
 *                'reads_rev': self.reads.rev,
 *                'reads_pp': self.reads.pp,             # <<<<<<<<<<<<<<
 *                'reads_pp_fwd': self.reads.pp_fwd,
 *                'reads_pp_rev': self.reads.pp_rev,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->reads->pp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 629, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_reads_pp, __pyx_t_1) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":630
 *                'reads_rev': self.reads.rev,
 *                'reads_pp': self.reads.pp,
 *                'reads_pp_fwd': self.reads.pp_fwd,             # <<<<<<<<<<<<<<
 *                'reads_pp_rev': self.reads.pp_rev,
 *                'matches': self.matches.all,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->reads->pp_fwd); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 630, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_reads_pp_fwd, __pyx_t_1) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":631
 *                'reads_pp': self.reads.pp,
 *                'reads_pp_fwd': self.reads.pp_fwd,
 *                'reads_pp_rev': self.reads.pp_rev,             # <<<<<<<<<<<<<<
 *                'matches': self.matches.all,
 *                'matches_fwd': self.matches.fwd,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->reads->pp_rev); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 631, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_reads_pp_rev, __pyx_t_1) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":632
 *                'reads_pp_fwd': self.reads.pp_fwd,
 *                'reads_pp_rev': self.reads.pp_rev,
 *                'matches': self.matches.all,             # <<<<<<<<<<<<<<
 *                'matches_fwd': self.matches.fwd,
 *                'matches_rev': self.matches.rev,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->matches->all); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 632, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_matches, __pyx_t_1) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":633
 *                'reads_pp_rev': self.reads.pp_rev,
 *                'matches': self.matches.all,
 *                'matches_fwd': self.matches.fwd,             # <<<<<<<<<<<<<<
 *                'matches_rev': self.matches.rev,
 *                'matches_pp': self.matches.pp,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->matches->fwd); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 633, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_matches_fwd, __pyx_t_1) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":634
 *                'matches': self.matches.all,
 *                'matches_fwd': self.matches.fwd,
 *                'matches_rev': self.matches.rev,             # <<<<<<<<<<<<<<
 *                'matches_pp': self.matches.pp,
 *                'matches_pp_fwd': self.matches.pp_fwd,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->matches->rev); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 634, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_matches_rev, __pyx_t_1) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":635
 *                'matches_fwd': self.matches.fwd,
 *                'matches_rev': self.matches.rev,
 *                'matches_pp': self.matches.pp,             # <<<<<<<<<<<<<<
 *                'matches_pp_fwd': self.matches.pp_fwd,
 *                'matches_pp_rev': self.matches.pp_rev,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->matches->pp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 635, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_matches_pp, __pyx_t_1) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":636
 *                'matches_rev': self.matches.rev,
 *                'matches_pp': self.matches.pp,
 *                'matches_pp_fwd': self.matches.pp_fwd,             # <<<<<<<<<<<<<<
 *                'matches_pp_rev': self.matches.pp_rev,
 *                'mismatches': self.mismatches.all,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->matches->pp_fwd); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 636, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_matches_pp_fwd, __pyx_t_1) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":637
 *                'matches_pp': self.matches.pp,
 *                'matches_pp_fwd': self.matches.pp_fwd,
 *                'matches_pp_rev': self.matches.pp_rev,             # <<<<<<<<<<<<<<
 *                'mismatches': self.mismatches.all,
 *                'mismatches_fwd': self.mismatches.fwd,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->matches->pp_rev); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 637, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_matches_pp_rev, __pyx_t_1) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":638
 *                'matches_pp_fwd': self.matches.pp_fwd,
 *                'matches_pp_rev': self.matches.pp_rev,
 *                'mismatches': self.mismatches.all,             # <<<<<<<<<<<<<<
 *                'mismatches_fwd': self.mismatches.fwd,
 *                'mismatches_rev': self.mismatches.rev,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->mismatches->all); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 638, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_mismatches, __pyx_t_1) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":639
 *                'matches_pp_rev': self.matches.pp_rev,
 *                'mismatches': self.mismatches.all,
 *                'mismatches_fwd': self.mismatches.fwd,             # <<<<<<<<<<<<<<
 *                'mismatches_rev': self.mismatches.rev,
 *                'mismatches_pp': self.mismatches.pp,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->mismatches->fwd); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 639, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_mismatches_fwd, __pyx_t_1) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":640
 *                'mismatches': self.mismatches.all,
 *                'mismatches_fwd': self.mismatches.fwd,
 *                'mismatches_rev': self.mismatches.rev,             # <<<<<<<<<<<<<<
 *                'mismatches_pp': self.mismatches.pp,
 *                'mismatches_pp_fwd': self.mismatches.pp_fwd,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->mismatches->rev); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 640, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_mismatches_rev, __pyx_t_1) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":641
 *                'mismatches_fwd': self.mismatches.fwd,
 *                'mismatches_rev': self.mismatches.rev,
 *                'mismatches_pp': self.mismatches.pp,             # <<<<<<<<<<<<<<
 *                'mismatches_pp_fwd': self.mismatches.pp_fwd,
 *                'mismatches_pp_rev': self.mismatches.pp_rev,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->mismatches->pp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 641, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_mismatches_pp, __pyx_t_1) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":642
 *                'mismatches_rev': self.mismatches.rev,
 *                'mismatches_pp': self.mismatches.pp,
 *                'mismatches_pp_fwd': self.mismatches.pp_fwd,             # <<<<<<<<<<<<<<
 *                'mismatches_pp_rev': self.mismatches.pp_rev,
 *                'deletions': self.deletions.all,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->mismatches->pp_fwd); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 642, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_mismatches_pp_fwd, __pyx_t_1) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":643
 *                'mismatches_pp': self.mismatches.pp,
 *                'mismatches_pp_fwd': self.mismatches.pp_fwd,
 *                'mismatches_pp_rev': self.mismatches.pp_rev,             # <<<<<<<<<<<<<<
 *                'deletions': self.deletions.all,
 *                'deletions_fwd': self.deletions.fwd,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->mismatches->pp_rev); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 643, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_mismatches_pp_rev, __pyx_t_1) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":644
 *                'mismatches_pp_fwd': self.mismatches.pp_fwd,
 *                'mismatches_pp_rev': self.mismatches.pp_rev,
 *                'deletions': self.deletions.all,             # <<<<<<<<<<<<<<
 *                'deletions_fwd': self.deletions.fwd,
 *                'deletions_rev': self.deletions.rev,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->deletions->all); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 644, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_deletions, __pyx_t_1) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":645
 *                'mismatches_pp_rev': self.mismatches.pp_rev,
 *                'deletions': self.deletions.all,
 *                'deletions_fwd': self.deletions.fwd,             # <<<<<<<<<<<<<<
 *                'deletions_rev': self.deletions.rev,
 *                'deletions_pp': self.deletions.pp,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->deletions->fwd); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 645, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_deletions_fwd, __pyx_t_1) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":646
 *                'deletions': self.deletions.all,
 *                'deletions_fwd': self.deletions.fwd,
 *                'deletions_rev': self.deletions.rev,             # <<<<<<<<<<<<<<
 *                'deletions_pp': self.deletions.pp,
 *                'deletions_pp_fwd': self.deletions.pp_fwd,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->deletions->rev); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 646, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_deletions_rev, __pyx_t_1) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":647
 *                'deletions_fwd': self.deletions.fwd,
 *                'deletions_rev': self.deletions.rev,
 *                'deletions_pp': self.deletions.pp,             # <<<<<<<<<<<<<<
 *                'deletions_pp_fwd': self.deletions.pp_fwd,
 *                'deletions_pp_rev': self.deletions.pp_rev,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->deletions->pp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 647, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_deletions_pp, __pyx_t_1) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":648
 *                'deletions_rev': self.deletions.rev,
 *                'deletions_pp': self.deletions.pp,
 *                'deletions_pp_fwd': self.deletions.pp_fwd,             # <<<<<<<<<<<<<<
 *                'deletions_pp_rev': self.deletions.pp_rev,
 *                'insertions': self.insertions.all,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->deletions->pp_fwd); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 648, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_deletions_pp_fwd, __pyx_t_1) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":649
 *                'deletions_pp': self.deletions.pp,
 *                'deletions_pp_fwd': self.deletions.pp_fwd,
 *                'deletions_pp_rev': self.deletions.pp_rev,             # <<<<<<<<<<<<<<
 *                'insertions': self.insertions.all,
 *                'insertions_fwd': self.insertions.fwd,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->deletions->pp_rev); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 649, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_deletions_pp_rev, __pyx_t_1) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":650
 *                'deletions_pp_fwd': self.deletions.pp_fwd,
 *                'deletions_pp_rev': self.deletions.pp_rev,
 *                'insertions': self.insertions.all,             # <<<<<<<<<<<<<<
 *                'insertions_fwd': self.insertions.fwd,
 *                'insertions_rev': self.insertions.rev,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->insertions->all); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 650, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_insertions, __pyx_t_1) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":651
 *                'deletions_pp_rev': self.deletions.pp_rev,
 *                'insertions': self.insertions.all,
 *                'insertions_fwd': self.insertions.fwd,             # <<<<<<<<<<<<<<
 *                'insertions_rev': self.insertions.rev,
 *                'insertions_pp': self.insertions.pp,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->insertions->fwd); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 651, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_insertions_fwd, __pyx_t_1) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":652
 *                'insertions': self.insertions.all,
 *                'insertions_fwd': self.insertions.fwd,
 *                'insertions_rev': self.insertions.rev,             # <<<<<<<<<<<<<<
 *                'insertions_pp': self.insertions.pp,
 *                'insertions_pp_fwd': self.insertions.pp_fwd,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->insertions->rev); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 652, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_insertions_rev, __pyx_t_1) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":653
 *                'insertions_fwd': self.insertions.fwd,
 *                'insertions_rev': self.insertions.rev,
 *                'insertions_pp': self.insertions.pp,             # <<<<<<<<<<<<<<
 *                'insertions_pp_fwd': self.insertions.pp_fwd,
 *                'insertions_pp_rev': self.insertions.pp_rev,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->insertions->pp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 653, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_insertions_pp, __pyx_t_1) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":654
 *                'insertions_rev': self.insertions.rev,
 *                'insertions_pp': self.insertions.pp,
 *                'insertions_pp_fwd': self.insertions.pp_fwd,             # <<<<<<<<<<<<<<
 *                'insertions_pp_rev': self.insertions.pp_rev,
 *                'A': self.A.all, 'A_fwd': self.A.fwd, 'A_rev': self.A.rev,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->insertions->pp_fwd); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 654, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_insertions_pp_fwd, __pyx_t_1) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":655
 *                'insertions_pp': self.insertions.pp,
 *                'insertions_pp_fwd': self.insertions.pp_fwd,
 *                'insertions_pp_rev': self.insertions.pp_rev,             # <<<<<<<<<<<<<<
 *                'A': self.A.all, 'A_fwd': self.A.fwd, 'A_rev': self.A.rev,
 *                'A_pp': self.A.pp, 'A_pp_fwd': self.A.pp_fwd, 'A_pp_rev': self.A.pp_rev,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->insertions->pp_rev); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 655, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_insertions_pp_rev, __pyx_t_1) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":656
 *                'insertions_pp_fwd': self.insertions.pp_fwd,
 *                'insertions_pp_rev': self.insertions.pp_rev,
 *                'A': self.A.all, 'A_fwd': self.A.fwd, 'A_rev': self.A.rev,             # <<<<<<<<<<<<<<
 *                'A_pp': self.A.pp, 'A_pp_fwd': self.A.pp_fwd, 'A_pp_rev': self.A.pp_rev,
 *                'C': self.C.all, 'C_fwd': self.C.fwd, 'C_rev': self.C.rev,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->A->all); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 656, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_A, __pyx_t_1) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->A->fwd); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 656, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_A_fwd, __pyx_t_1) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->A->rev); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 656, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_A_rev, __pyx_t_1) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":657
 *                'insertions_pp_rev': self.insertions.pp_rev,
 *                'A': self.A.all, 'A_fwd': self.A.fwd, 'A_rev': self.A.rev,
 *                'A_pp': self.A.pp, 'A_pp_fwd': self.A.pp_fwd, 'A_pp_rev': self.A.pp_rev,             # <<<<<<<<<<<<<<
 *                'C': self.C.all, 'C_fwd': self.C.fwd, 'C_rev': self.C.rev,
 *                'C_pp': self.C.pp, 'C_pp_fwd': self.C.pp_fwd, 'C_pp_rev': self.C.pp_rev,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->A->pp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 657, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_A_pp, __pyx_t_1) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->A->pp_fwd); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 657, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_A_pp_fwd, __pyx_t_1) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->A->pp_rev); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 657, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_A_pp_rev, __pyx_t_1) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":658
 *                'A': self.A.all, 'A_fwd': self.A.fwd, 'A_rev': self.A.rev,
 *                'A_pp': self.A.pp, 'A_pp_fwd': self.A.pp_fwd, 'A_pp_rev': self.A.pp_rev,
 *                'C': self.C.all, 'C_fwd': self.C.fwd, 'C_rev': self.C.rev,             # <<<<<<<<<<<<<<
 *                'C_pp': self.C.pp, 'C_pp_fwd': self.C.pp_fwd, 'C_pp_rev': self.C.pp_rev,
 *                'T': self.T.all, 'T_fwd': self.T.fwd, 'T_rev': self.T.rev,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->C->all); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 658, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_C, __pyx_t_1) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->C->fwd); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 658, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_C_fwd, __pyx_t_1) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->C->rev); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 658, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_C_rev, __pyx_t_1) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":659
 *                'A_pp': self.A.pp, 'A_pp_fwd': self.A.pp_fwd, 'A_pp_rev': self.A.pp_rev,
 *                'C': self.C.all, 'C_fwd': self.C.fwd, 'C_rev': self.C.rev,
 *                'C_pp': self.C.pp, 'C_pp_fwd': self.C.pp_fwd, 'C_pp_rev': self.C.pp_rev,             # <<<<<<<<<<<<<<
 *                'T': self.T.all, 'T_fwd': self.T.fwd, 'T_rev': self.T.rev,
 *                'T_pp': self.T.pp, 'T_pp_fwd': self.T.pp_fwd, 'T_pp_rev': self.T.pp_rev,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->C->pp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 659, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_C_pp, __pyx_t_1) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->C->pp_fwd); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 659, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_C_pp_fwd, __pyx_t_1) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->C->pp_rev); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 659, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_C_pp_rev, __pyx_t_1) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":660
 *                'C': self.C.all, 'C_fwd': self.C.fwd, 'C_rev': self.C.rev,
 *                'C_pp': self.C.pp, 'C_pp_fwd': self.C.pp_fwd, 'C_pp_rev': self.C.pp_rev,
 *                'T': self.T.all, 'T_fwd': self.T.fwd, 'T_rev': self.T.rev,             # <<<<<<<<<<<<<<
 *                'T_pp': self.T.pp, 'T_pp_fwd': self.T.pp_fwd, 'T_pp_rev': self.T.pp_rev,
 *                'G': self.G.all, 'G_fwd': self.G.fwd, 'G_rev': self.G.rev,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->T->all); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 660, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_T, __pyx_t_1) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->T->fwd); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 660, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_T_fwd, __pyx_t_1) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->T->rev); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 660, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_T_rev, __pyx_t_1) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":661
 *                'C_pp': self.C.pp, 'C_pp_fwd': self.C.pp_fwd, 'C_pp_rev': self.C.pp_rev,
 *                'T': self.T.all, 'T_fwd': self.T.fwd, 'T_rev': self.T.rev,
 *                'T_pp': self.T.pp, 'T_pp_fwd': self.T.pp_fwd, 'T_pp_rev': self.T.pp_rev,             # <<<<<<<<<<<<<<
 *                'G': self.G.all, 'G_fwd': self.G.fwd, 'G_rev': self.G.rev,
 *                'G_pp': self.G.pp, 'G_pp_fwd': self.G.pp_fwd, 'G_pp_rev': self.G.pp_rev,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->T->pp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 661, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_T_pp, __pyx_t_1) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->T->pp_fwd); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 661, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_T_pp_fwd, __pyx_t_1) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->T->pp_rev); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 661, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_T_pp_rev, __pyx_t_1) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":662
 *                'T': self.T.all, 'T_fwd': self.T.fwd, 'T_rev': self.T.rev,
 *                'T_pp': self.T.pp, 'T_pp_fwd': self.T.pp_fwd, 'T_pp_rev': self.T.pp_rev,
 *                'G': self.G.all, 'G_fwd': self.G.fwd, 'G_rev': self.G.rev,             # <<<<<<<<<<<<<<
 *                'G_pp': self.G.pp, 'G_pp_fwd': self.G.pp_fwd, 'G_pp_rev': self.G.pp_rev,
 *                'N': self.N.all, 'N_fwd': self.N.fwd, 'N_rev': self.N.rev,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->G->all); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 662, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_G, __pyx_t_1) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->G->fwd); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 662, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_G_fwd, __pyx_t_1) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->G->rev); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 662, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_G_rev, __pyx_t_1) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":663
 *                'T_pp': self.T.pp, 'T_pp_fwd': self.T.pp_fwd, 'T_pp_rev': self.T.pp_rev,
 *                'G': self.G.all, 'G_fwd': self.G.fwd, 'G_rev': self.G.rev,
 *                'G_pp': self.G.pp, 'G_pp_fwd': self.G.pp_fwd, 'G_pp_rev': self.G.pp_rev,             # <<<<<<<<<<<<<<
 *                'N': self.N.all, 'N_fwd': self.N.fwd, 'N_rev': self.N.rev,
 *                'N_pp': self.N.pp, 'N_pp_fwd': self.N.pp_fwd, 'N_pp_rev': self.N.pp_rev}
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->G->pp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 663, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_G_pp, __pyx_t_1) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->G->pp_fwd); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 663, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_G_pp_fwd, __pyx_t_1) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->G->pp_rev); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 663, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_G_pp_rev, __pyx_t_1) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":664
 *                'G': self.G.all, 'G_fwd': self.G.fwd, 'G_rev': self.G.rev,
 *                'G_pp': self.G.pp, 'G_pp_fwd': self.G.pp_fwd, 'G_pp_rev': self.G.pp_rev,
 *                'N': self.N.all, 'N_fwd': self.N.fwd, 'N_rev': self.N.rev,             # <<<<<<<<<<<<<<
 *                'N_pp': self.N.pp, 'N_pp_fwd': self.N.pp_fwd, 'N_pp_rev': self.N.pp_rev}
 * 
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->N->all); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 664, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_N, __pyx_t_1) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->N->fwd); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 664, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_N_fwd, __pyx_t_1) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->N->rev); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 664, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_N_rev, __pyx_t_1) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":665
 *                'G_pp': self.G.pp, 'G_pp_fwd': self.G.pp_fwd, 'G_pp_rev': self.G.pp_rev,
 *                'N': self.N.all, 'N_fwd': self.N.fwd, 'N_rev': self.N.rev,
 *                'N_pp': self.N.pp, 'N_pp_fwd': self.N.pp_fwd, 'N_pp_rev': self.N.pp_rev}             # <<<<<<<<<<<<<<
 * 
 *         # reset counters
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->N->pp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 665, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_N_pp, __pyx_t_1) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->N->pp_fwd); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 665, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_N_pp_fwd, __pyx_t_1) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->N->pp_rev); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 665, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_N_pp_rev, __pyx_t_1) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_rec = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pysamstats/opt.pyx":668
 * 
 *         # reset counters
 *         self.reset()             # <<<<<<<<<<<<<<
 * 
 *         return rec
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reset); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 668, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(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_CallOneArg(__pyx_t_1, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 668, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pysamstats/opt.pyx":670
 *         self.reset()
 * 
 *         return rec             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_rec);
  __pyx_r = __pyx_v_rec;
  goto __pyx_L0;

  /* "pysamstats/opt.pyx":618
 *                 self.mismatches.incr(is_reverse, is_proper_pair)
 * 
 *     cdef dict rec(self, chrom, pos, FastaFile fafile, bytes refbase):             # <<<<<<<<<<<<<<
 * 
 *         # make record
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pysamstats.opt.VariationStrand.rec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ref);
  __Pyx_XDECREF(__pyx_v_rec);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_15VariationStrand_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pysamstats_3opt_15VariationStrand_4__reduce_cython__[] = "VariationStrand.__reduce_cython__(self)";
static PyObject *__pyx_pw_10pysamstats_3opt_15VariationStrand_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_15VariationStrand_4__reduce_cython__(((struct __pyx_obj_10pysamstats_3opt_VariationStrand *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pysamstats_3opt_15VariationStrand_4__reduce_cython__(struct __pyx_obj_10pysamstats_3opt_VariationStrand *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self.A, self.C, self.G, self.N, self.T, self.deletions, self.insertions, self.matches, self.mismatches, self.reads)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __pyx_t_1 = PyTuple_New(10); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->A));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->A));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self->A));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->C));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->C));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self->C));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->G));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->G));
  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_self->G));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->N));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->N));
  PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_v_self->N));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->T));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->T));
  PyTuple_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_v_self->T));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->deletions));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->deletions));
  PyTuple_SET_ITEM(__pyx_t_1, 5, ((PyObject *)__pyx_v_self->deletions));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->insertions));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->insertions));
  PyTuple_SET_ITEM(__pyx_t_1, 6, ((PyObject *)__pyx_v_self->insertions));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->matches));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->matches));
  PyTuple_SET_ITEM(__pyx_t_1, 7, ((PyObject *)__pyx_v_self->matches));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->mismatches));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->mismatches));
  PyTuple_SET_ITEM(__pyx_t_1, 8, ((PyObject *)__pyx_v_self->mismatches));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->reads));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->reads));
  PyTuple_SET_ITEM(__pyx_t_1, 9, ((PyObject *)__pyx_v_self->reads));
  __pyx_v_state = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self.A, self.C, self.G, self.N, self.T, self.deletions, self.insertions, self.matches, self.mismatches, self.reads)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         state += (_dict,)
 */
  __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__dict = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":7
 *     state = (self.A, self.C, self.G, self.N, self.T, self.deletions, self.insertions, self.matches, self.mismatches, self.reads)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
  __pyx_t_2 = (__pyx_v__dict != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
 */
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
    __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "(tree fragment)":9
 *     if _dict is not None:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = self.A is not None or self.C is not None or self.G is not None or self.N is not None or self.T is not None or self.deletions is not None or self.insertions is not None or self.matches is not None or self.mismatches is not None or self.reads is not None
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = (self.A, self.C, self.G, self.N, self.T, self.deletions, self.insertions, self.matches, self.mismatches, self.reads)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
    goto __pyx_L3;
  }

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = self.A is not None or self.C is not None or self.G is not None or self.N is not None or self.T is not None or self.deletions is not None or self.insertions is not None or self.matches is not None or self.mismatches is not None or self.reads is not None             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_VariationStrand, (type(self), 0x5c4b584, None), state
 */
  /*else*/ {
    __pyx_t_2 = (((PyObject *)__pyx_v_self->A) != Py_None);
    __pyx_t_5 = (__pyx_t_2 != 0);
    if (!__pyx_t_5) {
    } else {
      __pyx_t_3 = __pyx_t_5;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_5 = (((PyObject *)__pyx_v_self->C) != Py_None);
    __pyx_t_2 = (__pyx_t_5 != 0);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_3 = __pyx_t_2;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_2 = (((PyObject *)__pyx_v_self->G) != Py_None);
    __pyx_t_5 = (__pyx_t_2 != 0);
    if (!__pyx_t_5) {
    } else {
      __pyx_t_3 = __pyx_t_5;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_5 = (((PyObject *)__pyx_v_self->N) != Py_None);
    __pyx_t_2 = (__pyx_t_5 != 0);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_3 = __pyx_t_2;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_2 = (((PyObject *)__pyx_v_self->T) != Py_None);
    __pyx_t_5 = (__pyx_t_2 != 0);
    if (!__pyx_t_5) {
    } else {
      __pyx_t_3 = __pyx_t_5;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_5 = (((PyObject *)__pyx_v_self->deletions) != Py_None);
    __pyx_t_2 = (__pyx_t_5 != 0);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_3 = __pyx_t_2;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_2 = (((PyObject *)__pyx_v_self->insertions) != Py_None);
    __pyx_t_5 = (__pyx_t_2 != 0);
    if (!__pyx_t_5) {
    } else {
      __pyx_t_3 = __pyx_t_5;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_5 = (((PyObject *)__pyx_v_self->matches) != Py_None);
    __pyx_t_2 = (__pyx_t_5 != 0);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_3 = __pyx_t_2;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_2 = (((PyObject *)__pyx_v_self->mismatches) != Py_None);
    __pyx_t_5 = (__pyx_t_2 != 0);
    if (!__pyx_t_5) {
    } else {
      __pyx_t_3 = __pyx_t_5;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_5 = (((PyObject *)__pyx_v_self->reads) != Py_None);
    __pyx_t_2 = (__pyx_t_5 != 0);
    __pyx_t_3 = __pyx_t_2;
    __pyx_L4_bool_binop_done:;
    __pyx_v_use_setstate = __pyx_t_3;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.A is not None or self.C is not None or self.G is not None or self.N is not None or self.T is not None or self.deletions is not None or self.insertions is not None or self.matches is not None or self.mismatches is not None or self.reads is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_VariationStrand, (type(self), 0x5c4b584, None), state
 *     else:
 */
  __pyx_t_3 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":13
 *         use_setstate = self.A is not None or self.C is not None or self.G is not None or self.N is not None or self.T is not None or self.deletions is not None or self.insertions is not None or self.matches is not None or self.mismatches is not None or self.reads is not None
 *     if use_setstate:
 *         return __pyx_unpickle_VariationStrand, (type(self), 0x5c4b584, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_VariationStrand, (type(self), 0x5c4b584, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_VariationStrand); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_96777604);
    __Pyx_GIVEREF(__pyx_int_96777604);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_96777604);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
    __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_state);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.A is not None or self.C is not None or self.G is not None or self.N is not None or self.T is not None or self.deletions is not None or self.insertions is not None or self.matches is not None or self.mismatches is not None or self.reads is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_VariationStrand, (type(self), 0x5c4b584, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_VariationStrand, (type(self), 0x5c4b584, None), state
 *     else:
 *         return __pyx_unpickle_VariationStrand, (type(self), 0x5c4b584, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_VariationStrand__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_pyx_unpickle_VariationStrand); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_96777604);
    __Pyx_GIVEREF(__pyx_int_96777604);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_96777604);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
    __pyx_t_6 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pysamstats.opt.VariationStrand.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_VariationStrand, (type(self), 0x5c4b584, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_VariationStrand__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_15VariationStrand_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_10pysamstats_3opt_15VariationStrand_6__setstate_cython__[] = "VariationStrand.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_10pysamstats_3opt_15VariationStrand_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_15VariationStrand_6__setstate_cython__(((struct __pyx_obj_10pysamstats_3opt_VariationStrand *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_10pysamstats_3opt_15VariationStrand_6__setstate_cython__(struct __pyx_obj_10pysamstats_3opt_VariationStrand *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_VariationStrand, (type(self), 0x5c4b584, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_VariationStrand__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
 */
  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_10pysamstats_3opt___pyx_unpickle_VariationStrand__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_VariationStrand, (type(self), 0x5c4b584, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_VariationStrand__set_state(self, __pyx_state)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysamstats.opt.VariationStrand.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":690
 *         int64_t sq  # sum of squares
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.reset()
 * 
 */

/* Python wrapper */
static int __pyx_pw_10pysamstats_3opt_10TlenHelper_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_10pysamstats_3opt_10TlenHelper_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
  __pyx_r = __pyx_pf_10pysamstats_3opt_10TlenHelper___init__(((struct __pyx_obj_10pysamstats_3opt_TlenHelper *)__pyx_v_self));

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

static int __pyx_pf_10pysamstats_3opt_10TlenHelper___init__(struct __pyx_obj_10pysamstats_3opt_TlenHelper *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "pysamstats/opt.pyx":691
 * 
 *     def __init__(self):
 *         self.reset()             # <<<<<<<<<<<<<<
 * 
 *     def reset(self):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 691, __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, 691, __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;

  /* "pysamstats/opt.pyx":690
 *         int64_t sq  # sum of squares
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.reset()
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysamstats.opt.TlenHelper.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":693
 *         self.reset()
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         self.n = 0
 *         self.m = 0
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_10TlenHelper_3reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pysamstats_3opt_10TlenHelper_2reset[] = "TlenHelper.reset(self)";
static PyObject *__pyx_pw_10pysamstats_3opt_10TlenHelper_3reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reset (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_10TlenHelper_2reset(((struct __pyx_obj_10pysamstats_3opt_TlenHelper *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pysamstats_3opt_10TlenHelper_2reset(struct __pyx_obj_10pysamstats_3opt_TlenHelper *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reset", 0);

  /* "pysamstats/opt.pyx":694
 * 
 *     def reset(self):
 *         self.n = 0             # <<<<<<<<<<<<<<
 *         self.m = 0
 *         self.m2 = 0
 */
  __pyx_v_self->n = 0;

  /* "pysamstats/opt.pyx":695
 *     def reset(self):
 *         self.n = 0
 *         self.m = 0             # <<<<<<<<<<<<<<
 *         self.m2 = 0
 *         self.d = 0
 */
  __pyx_v_self->m = 0.0;

  /* "pysamstats/opt.pyx":696
 *         self.n = 0
 *         self.m = 0
 *         self.m2 = 0             # <<<<<<<<<<<<<<
 *         self.d = 0
 *         self.d2 = 0
 */
  __pyx_v_self->m2 = 0.0;

  /* "pysamstats/opt.pyx":697
 *         self.m = 0
 *         self.m2 = 0
 *         self.d = 0             # <<<<<<<<<<<<<<
 *         self.d2 = 0
 *         self.s = 0
 */
  __pyx_v_self->d = 0.0;

  /* "pysamstats/opt.pyx":698
 *         self.m2 = 0
 *         self.d = 0
 *         self.d2 = 0             # <<<<<<<<<<<<<<
 *         self.s = 0
 *         self.sq = 0
 */
  __pyx_v_self->d2 = 0.0;

  /* "pysamstats/opt.pyx":699
 *         self.d = 0
 *         self.d2 = 0
 *         self.s = 0             # <<<<<<<<<<<<<<
 *         self.sq = 0
 * 
 */
  __pyx_v_self->s = 0;

  /* "pysamstats/opt.pyx":700
 *         self.d2 = 0
 *         self.s = 0
 *         self.sq = 0             # <<<<<<<<<<<<<<
 * 
 *     cdef void update(self, int64_t x):
 */
  __pyx_v_self->sq = 0;

  /* "pysamstats/opt.pyx":693
 *         self.reset()
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         self.n = 0
 *         self.m = 0
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":702
 *         self.sq = 0
 * 
 *     cdef void update(self, int64_t x):             # <<<<<<<<<<<<<<
 *         self.n += 1
 *         self.s += x
 */

static void __pyx_f_10pysamstats_3opt_10TlenHelper_update(struct __pyx_obj_10pysamstats_3opt_TlenHelper *__pyx_v_self, int64_t __pyx_v_x) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("update", 0);

  /* "pysamstats/opt.pyx":703
 * 
 *     cdef void update(self, int64_t x):
 *         self.n += 1             # <<<<<<<<<<<<<<
 *         self.s += x
 *         self.sq += x ** 2
 */
  __pyx_v_self->n = (__pyx_v_self->n + 1);

  /* "pysamstats/opt.pyx":704
 *     cdef void update(self, int64_t x):
 *         self.n += 1
 *         self.s += x             # <<<<<<<<<<<<<<
 *         self.sq += x ** 2
 *         self.d = x - self.m
 */
  __pyx_v_self->s = (__pyx_v_self->s + __pyx_v_x);

  /* "pysamstats/opt.pyx":705
 *         self.n += 1
 *         self.s += x
 *         self.sq += x ** 2             # <<<<<<<<<<<<<<
 *         self.d = x - self.m
 *         self.m += self.d / self.n
 */
  __pyx_v_self->sq = (__pyx_v_self->sq + __Pyx_pow_int64_t(__pyx_v_x, 2));

  /* "pysamstats/opt.pyx":706
 *         self.s += x
 *         self.sq += x ** 2
 *         self.d = x - self.m             # <<<<<<<<<<<<<<
 *         self.m += self.d / self.n
 *         self.d2 = x - self.m
 */
  __pyx_v_self->d = (__pyx_v_x - __pyx_v_self->m);

  /* "pysamstats/opt.pyx":707
 *         self.sq += x ** 2
 *         self.d = x - self.m
 *         self.m += self.d / self.n             # <<<<<<<<<<<<<<
 *         self.d2 = x - self.m
 *         self.m2 += self.d * self.d2
 */
  if (unlikely(__pyx_v_self->n == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    __PYX_ERR(0, 707, __pyx_L1_error)
  }
  __pyx_v_self->m = (__pyx_v_self->m + (__pyx_v_self->d / ((double)__pyx_v_self->n)));

  /* "pysamstats/opt.pyx":708
 *         self.d = x - self.m
 *         self.m += self.d / self.n
 *         self.d2 = x - self.m             # <<<<<<<<<<<<<<
 *         self.m2 += self.d * self.d2
 * 
 */
  __pyx_v_self->d2 = (__pyx_v_x - __pyx_v_self->m);

  /* "pysamstats/opt.pyx":709
 *         self.m += self.d / self.n
 *         self.d2 = x - self.m
 *         self.m2 += self.d * self.d2             # <<<<<<<<<<<<<<
 * 
 *     def variance(self):
 */
  __pyx_v_self->m2 = (__pyx_v_self->m2 + (__pyx_v_self->d * __pyx_v_self->d2));

  /* "pysamstats/opt.pyx":702
 *         self.sq = 0
 * 
 *     cdef void update(self, int64_t x):             # <<<<<<<<<<<<<<
 *         self.n += 1
 *         self.s += x
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("pysamstats.opt.TlenHelper.update", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "pysamstats/opt.pyx":711
 *         self.m2 += self.d * self.d2
 * 
 *     def variance(self):             # <<<<<<<<<<<<<<
 *         if self.n < 2:
 *             return 0
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_10TlenHelper_5variance(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pysamstats_3opt_10TlenHelper_4variance[] = "TlenHelper.variance(self)";
static PyObject *__pyx_pw_10pysamstats_3opt_10TlenHelper_5variance(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("variance (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_10TlenHelper_4variance(((struct __pyx_obj_10pysamstats_3opt_TlenHelper *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pysamstats_3opt_10TlenHelper_4variance(struct __pyx_obj_10pysamstats_3opt_TlenHelper *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  long __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("variance", 0);

  /* "pysamstats/opt.pyx":712
 * 
 *     def variance(self):
 *         if self.n < 2:             # <<<<<<<<<<<<<<
 *             return 0
 *         else:
 */
  __pyx_t_1 = ((__pyx_v_self->n < 2) != 0);
  if (__pyx_t_1) {

    /* "pysamstats/opt.pyx":713
 *     def variance(self):
 *         if self.n < 2:
 *             return 0             # <<<<<<<<<<<<<<
 *         else:
 *             return int(round(self.m2 / (self.n - 1)))
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_int_0);
    __pyx_r = __pyx_int_0;
    goto __pyx_L0;

    /* "pysamstats/opt.pyx":712
 * 
 *     def variance(self):
 *         if self.n < 2:             # <<<<<<<<<<<<<<
 *             return 0
 *         else:
 */
  }

  /* "pysamstats/opt.pyx":715
 *             return 0
 *         else:
 *             return int(round(self.m2 / (self.n - 1)))             # <<<<<<<<<<<<<<
 * 
 *     def std(self):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_round); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 715, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = (__pyx_v_self->n - 1);
    if (unlikely(__pyx_t_4 == 0)) {
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      __PYX_ERR(0, 715, __pyx_L1_error)
    }
    __pyx_t_5 = PyFloat_FromDouble((__pyx_v_self->m2 / ((double)__pyx_t_4))); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 715, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 715, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyNumber_Int(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 715, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "pysamstats/opt.pyx":711
 *         self.m2 += self.d * self.d2
 * 
 *     def variance(self):             # <<<<<<<<<<<<<<
 *         if self.n < 2:
 *             return 0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pysamstats.opt.TlenHelper.variance", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":717
 *             return int(round(self.m2 / (self.n - 1)))
 * 
 *     def std(self):             # <<<<<<<<<<<<<<
 *         if self.n < 2:
 *             return 0
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_10TlenHelper_7std(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pysamstats_3opt_10TlenHelper_6std[] = "TlenHelper.std(self)";
static PyObject *__pyx_pw_10pysamstats_3opt_10TlenHelper_7std(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("std (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_10TlenHelper_6std(((struct __pyx_obj_10pysamstats_3opt_TlenHelper *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pysamstats_3opt_10TlenHelper_6std(struct __pyx_obj_10pysamstats_3opt_TlenHelper *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  long __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("std", 0);

  /* "pysamstats/opt.pyx":718
 * 
 *     def std(self):
 *         if self.n < 2:             # <<<<<<<<<<<<<<
 *             return 0
 *         else:
 */
  __pyx_t_1 = ((__pyx_v_self->n < 2) != 0);
  if (__pyx_t_1) {

    /* "pysamstats/opt.pyx":719
 *     def std(self):
 *         if self.n < 2:
 *             return 0             # <<<<<<<<<<<<<<
 *         else:
 *             return int(round(sqrt(self.m2 / (self.n - 1))))
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_int_0);
    __pyx_r = __pyx_int_0;
    goto __pyx_L0;

    /* "pysamstats/opt.pyx":718
 * 
 *     def std(self):
 *         if self.n < 2:             # <<<<<<<<<<<<<<
 *             return 0
 *         else:
 */
  }

  /* "pysamstats/opt.pyx":721
 *             return 0
 *         else:
 *             return int(round(sqrt(self.m2 / (self.n - 1))))             # <<<<<<<<<<<<<<
 * 
 *     def mean(self):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_round); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 721, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = (__pyx_v_self->n - 1);
    if (unlikely(__pyx_t_4 == 0)) {
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      __PYX_ERR(0, 721, __pyx_L1_error)
    }
    __pyx_t_5 = PyFloat_FromDouble(sqrt((__pyx_v_self->m2 / ((double)__pyx_t_4)))); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 721, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 721, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyNumber_Int(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 721, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "pysamstats/opt.pyx":717
 *             return int(round(self.m2 / (self.n - 1)))
 * 
 *     def std(self):             # <<<<<<<<<<<<<<
 *         if self.n < 2:
 *             return 0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pysamstats.opt.TlenHelper.std", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":723
 *             return int(round(sqrt(self.m2 / (self.n - 1))))
 * 
 *     def mean(self):             # <<<<<<<<<<<<<<
 *         return mean(self.s, self.n)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_10TlenHelper_9mean(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pysamstats_3opt_10TlenHelper_8mean[] = "TlenHelper.mean(self)";
static PyObject *__pyx_pw_10pysamstats_3opt_10TlenHelper_9mean(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mean (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_10TlenHelper_8mean(((struct __pyx_obj_10pysamstats_3opt_TlenHelper *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pysamstats_3opt_10TlenHelper_8mean(struct __pyx_obj_10pysamstats_3opt_TlenHelper *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("mean", 0);

  /* "pysamstats/opt.pyx":724
 * 
 *     def mean(self):
 *         return mean(self.s, self.n)             # <<<<<<<<<<<<<<
 * 
 *     def rms(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_mean); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 724, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_int64_t(__pyx_v_self->s); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 724, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_v_self->n); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 724, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 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_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_3, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 724, __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_4); __pyx_t_4 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_3, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 724, __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_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 724, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_4);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 724, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pysamstats/opt.pyx":723
 *             return int(round(sqrt(self.m2 / (self.n - 1))))
 * 
 *     def mean(self):             # <<<<<<<<<<<<<<
 *         return mean(self.s, self.n)
 * 
 */

  /* 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_7);
  __Pyx_AddTraceback("pysamstats.opt.TlenHelper.mean", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":726
 *         return mean(self.s, self.n)
 * 
 *     def rms(self):             # <<<<<<<<<<<<<<
 *         return rootmean(self.sq, self.n)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_10TlenHelper_11rms(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pysamstats_3opt_10TlenHelper_10rms[] = "TlenHelper.rms(self)";
static PyObject *__pyx_pw_10pysamstats_3opt_10TlenHelper_11rms(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rms (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_10TlenHelper_10rms(((struct __pyx_obj_10pysamstats_3opt_TlenHelper *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pysamstats_3opt_10TlenHelper_10rms(struct __pyx_obj_10pysamstats_3opt_TlenHelper *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("rms", 0);

  /* "pysamstats/opt.pyx":727
 * 
 *     def rms(self):
 *         return rootmean(self.sq, self.n)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_rootmean); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 727, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_int64_t(__pyx_v_self->sq); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 727, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_v_self->n); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 727, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 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_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_3, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 727, __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_4); __pyx_t_4 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_3, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 727, __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_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 727, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_4);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 727, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pysamstats/opt.pyx":726
 *         return mean(self.s, self.n)
 * 
 *     def rms(self):             # <<<<<<<<<<<<<<
 *         return rootmean(self.sq, self.n)
 * 
 */

  /* 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_7);
  __Pyx_AddTraceback("pysamstats.opt.TlenHelper.rms", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_10TlenHelper_13__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pysamstats_3opt_10TlenHelper_12__reduce_cython__[] = "TlenHelper.__reduce_cython__(self)";
static PyObject *__pyx_pw_10pysamstats_3opt_10TlenHelper_13__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_10TlenHelper_12__reduce_cython__(((struct __pyx_obj_10pysamstats_3opt_TlenHelper *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pysamstats_3opt_10TlenHelper_12__reduce_cython__(struct __pyx_obj_10pysamstats_3opt_TlenHelper *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  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;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  int __pyx_t_10;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self.d, self.d2, self.m, self.m2, self.n, self.s, self.sq)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->d2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->m); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_self->m2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_self->n); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyInt_From_int64_t(__pyx_v_self->s); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = __Pyx_PyInt_From_int64_t(__pyx_v_self->sq); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = PyTuple_New(7); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_8, 4, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_8, 5, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_8, 6, __pyx_t_7);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_6 = 0;
  __pyx_t_7 = 0;
  __pyx_v_state = ((PyObject*)__pyx_t_8);
  __pyx_t_8 = 0;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self.d, self.d2, self.m, self.m2, self.n, self.s, self.sq)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         state += (_dict,)
 */
  __pyx_t_8 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_v__dict = __pyx_t_8;
  __pyx_t_8 = 0;

  /* "(tree fragment)":7
 *     state = (self.d, self.d2, self.m, self.m2, self.n, self.s, self.sq)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
  __pyx_t_9 = (__pyx_v__dict != Py_None);
  __pyx_t_10 = (__pyx_t_9 != 0);
  if (__pyx_t_10) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
 */
    __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v__dict);
    __pyx_t_7 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_7));
    __pyx_t_7 = 0;

    /* "(tree fragment)":9
 *     if _dict is not None:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = False
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = (self.d, self.d2, self.m, self.m2, self.n, self.s, self.sq)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
    goto __pyx_L3;
  }

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = False             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_TlenHelper, (type(self), 0x2efd474, None), state
 */
  /*else*/ {
    __pyx_v_use_setstate = 0;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_TlenHelper, (type(self), 0x2efd474, None), state
 *     else:
 */
  __pyx_t_10 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_10) {

    /* "(tree fragment)":13
 *         use_setstate = False
 *     if use_setstate:
 *         return __pyx_unpickle_TlenHelper, (type(self), 0x2efd474, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_TlenHelper, (type(self), 0x2efd474, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_pyx_unpickle_TlenHelper); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_49271924);
    __Pyx_GIVEREF(__pyx_int_49271924);
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_int_49271924);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_8, 2, Py_None);
    __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_8);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_state);
    __pyx_t_7 = 0;
    __pyx_t_8 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_TlenHelper, (type(self), 0x2efd474, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_TlenHelper, (type(self), 0x2efd474, None), state
 *     else:
 *         return __pyx_unpickle_TlenHelper, (type(self), 0x2efd474, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_TlenHelper__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_pyx_unpickle_TlenHelper); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_49271924);
    __Pyx_GIVEREF(__pyx_int_49271924);
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_int_49271924);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_v_state);
    __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_8);
    __pyx_t_6 = 0;
    __pyx_t_8 = 0;
    __pyx_r = __pyx_t_7;
    __pyx_t_7 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

  /* 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_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pysamstats.opt.TlenHelper.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_TlenHelper, (type(self), 0x2efd474, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_TlenHelper__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_10TlenHelper_15__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_10pysamstats_3opt_10TlenHelper_14__setstate_cython__[] = "TlenHelper.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_10pysamstats_3opt_10TlenHelper_15__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_10TlenHelper_14__setstate_cython__(((struct __pyx_obj_10pysamstats_3opt_TlenHelper *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_10pysamstats_3opt_10TlenHelper_14__setstate_cython__(struct __pyx_obj_10pysamstats_3opt_TlenHelper *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_TlenHelper, (type(self), 0x2efd474, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_TlenHelper__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
 */
  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_10pysamstats_3opt___pyx_unpickle_TlenHelper__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_TlenHelper, (type(self), 0x2efd474, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_TlenHelper__set_state(self, __pyx_state)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysamstats.opt.TlenHelper.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":738
 *         TlenHelper tlen_pp
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.tlen = TlenHelper()
 *         self.tlen_pp = TlenHelper()
 */

/* Python wrapper */
static int __pyx_pw_10pysamstats_3opt_4Tlen_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_10pysamstats_3opt_4Tlen_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
  __pyx_r = __pyx_pf_10pysamstats_3opt_4Tlen___init__(((struct __pyx_obj_10pysamstats_3opt_Tlen *)__pyx_v_self));

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

static int __pyx_pf_10pysamstats_3opt_4Tlen___init__(struct __pyx_obj_10pysamstats_3opt_Tlen *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "pysamstats/opt.pyx":739
 * 
 *     def __init__(self):
 *         self.tlen = TlenHelper()             # <<<<<<<<<<<<<<
 *         self.tlen_pp = TlenHelper()
 *         self.reset()
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_TlenHelper)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 739, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->tlen);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->tlen));
  __pyx_v_self->tlen = ((struct __pyx_obj_10pysamstats_3opt_TlenHelper *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":740
 *     def __init__(self):
 *         self.tlen = TlenHelper()
 *         self.tlen_pp = TlenHelper()             # <<<<<<<<<<<<<<
 *         self.reset()
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_TlenHelper)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 740, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->tlen_pp);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->tlen_pp));
  __pyx_v_self->tlen_pp = ((struct __pyx_obj_10pysamstats_3opt_TlenHelper *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":741
 *         self.tlen = TlenHelper()
 *         self.tlen_pp = TlenHelper()
 *         self.reset()             # <<<<<<<<<<<<<<
 * 
 *     def reset(self):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 741, __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, 741, __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;

  /* "pysamstats/opt.pyx":738
 *         TlenHelper tlen_pp
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.tlen = TlenHelper()
 *         self.tlen_pp = TlenHelper()
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysamstats.opt.Tlen.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":743
 *         self.reset()
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         self.reads_all = 0
 *         self.tlen.reset()
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_4Tlen_3reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pysamstats_3opt_4Tlen_2reset[] = "Tlen.reset(self)";
static PyObject *__pyx_pw_10pysamstats_3opt_4Tlen_3reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reset (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_4Tlen_2reset(((struct __pyx_obj_10pysamstats_3opt_Tlen *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pysamstats_3opt_4Tlen_2reset(struct __pyx_obj_10pysamstats_3opt_Tlen *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("reset", 0);

  /* "pysamstats/opt.pyx":744
 * 
 *     def reset(self):
 *         self.reads_all = 0             # <<<<<<<<<<<<<<
 *         self.tlen.reset()
 *         self.tlen_pp.reset()
 */
  __pyx_v_self->reads_all = 0;

  /* "pysamstats/opt.pyx":745
 *     def reset(self):
 *         self.reads_all = 0
 *         self.tlen.reset()             # <<<<<<<<<<<<<<
 *         self.tlen_pp.reset()
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->tlen), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 745, __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, 745, __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;

  /* "pysamstats/opt.pyx":746
 *         self.reads_all = 0
 *         self.tlen.reset()
 *         self.tlen_pp.reset()             # <<<<<<<<<<<<<<
 * 
 *     cdef void recv(self, bam_pileup1_t* read, PileupColumn col, bytes refbase):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->tlen_pp), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 746, __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, 746, __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;

  /* "pysamstats/opt.pyx":743
 *         self.reset()
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         self.reads_all = 0
 *         self.tlen.reset()
 */

  /* 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_AddTraceback("pysamstats.opt.Tlen.reset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":748
 *         self.tlen_pp.reset()
 * 
 *     cdef void recv(self, bam_pileup1_t* read, PileupColumn col, bytes refbase):             # <<<<<<<<<<<<<<
 *         cdef:
 *             uint32_t flag
 */

static void __pyx_f_10pysamstats_3opt_4Tlen_recv(struct __pyx_obj_10pysamstats_3opt_Tlen *__pyx_v_self, bam_pileup1_t *__pyx_v_read, CYTHON_UNUSED struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn *__pyx_v_col, CYTHON_UNUSED PyObject *__pyx_v_refbase) {
  uint32_t __pyx_v_flag;
  int __pyx_v_is_proper_pair;
  int __pyx_v_mate_other_chr;
  int64_t __pyx_v_tlen;
  int __pyx_v_mate_is_unmapped;
  __Pyx_RefNannyDeclarations
  uint16_t __pyx_t_1;
  int32_t __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("recv", 0);

  /* "pysamstats/opt.pyx":757
 * 
 *         # convenience variables
 *         flag = read.b.core.flag             # <<<<<<<<<<<<<<
 *         is_proper_pair = <bint>(flag & BAM_FPROPER_PAIR)
 *         mate_is_unmapped = <bint>(flag & BAM_FMUNMAP)
 */
  __pyx_t_1 = __pyx_v_read->b->core.flag;
  __pyx_v_flag = __pyx_t_1;

  /* "pysamstats/opt.pyx":758
 *         # convenience variables
 *         flag = read.b.core.flag
 *         is_proper_pair = <bint>(flag & BAM_FPROPER_PAIR)             # <<<<<<<<<<<<<<
 *         mate_is_unmapped = <bint>(flag & BAM_FMUNMAP)
 *         mate_other_chr = <bint>(read.b.core.tid != read.b.core.mtid)
 */
  __pyx_v_is_proper_pair = ((__pyx_v_flag & 2) != 0);

  /* "pysamstats/opt.pyx":759
 *         flag = read.b.core.flag
 *         is_proper_pair = <bint>(flag & BAM_FPROPER_PAIR)
 *         mate_is_unmapped = <bint>(flag & BAM_FMUNMAP)             # <<<<<<<<<<<<<<
 *         mate_other_chr = <bint>(read.b.core.tid != read.b.core.mtid)
 *         tlen = read.b.core.isize
 */
  __pyx_v_mate_is_unmapped = ((__pyx_v_flag & 8) != 0);

  /* "pysamstats/opt.pyx":760
 *         is_proper_pair = <bint>(flag & BAM_FPROPER_PAIR)
 *         mate_is_unmapped = <bint>(flag & BAM_FMUNMAP)
 *         mate_other_chr = <bint>(read.b.core.tid != read.b.core.mtid)             # <<<<<<<<<<<<<<
 *         tlen = read.b.core.isize
 * 
 */
  __pyx_v_mate_other_chr = ((__pyx_v_read->b->core.tid != __pyx_v_read->b->core.mtid) != 0);

  /* "pysamstats/opt.pyx":761
 *         mate_is_unmapped = <bint>(flag & BAM_FMUNMAP)
 *         mate_other_chr = <bint>(read.b.core.tid != read.b.core.mtid)
 *         tlen = read.b.core.isize             # <<<<<<<<<<<<<<
 * 
 *         # do the counting
 */
  __pyx_t_2 = __pyx_v_read->b->core.isize;
  __pyx_v_tlen = __pyx_t_2;

  /* "pysamstats/opt.pyx":764
 * 
 *         # do the counting
 *         self.reads_all += 1             # <<<<<<<<<<<<<<
 *         # N.B. insert size is only meaningful if mate is mapped to same chromosome
 *         if not mate_is_unmapped and not mate_other_chr:
 */
  __pyx_v_self->reads_all = (__pyx_v_self->reads_all + 1);

  /* "pysamstats/opt.pyx":766
 *         self.reads_all += 1
 *         # N.B. insert size is only meaningful if mate is mapped to same chromosome
 *         if not mate_is_unmapped and not mate_other_chr:             # <<<<<<<<<<<<<<
 *             self.tlen.update(tlen)
 *         if is_proper_pair:
 */
  __pyx_t_4 = ((!(__pyx_v_mate_is_unmapped != 0)) != 0);
  if (__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = ((!(__pyx_v_mate_other_chr != 0)) != 0);
  __pyx_t_3 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_3) {

    /* "pysamstats/opt.pyx":767
 *         # N.B. insert size is only meaningful if mate is mapped to same chromosome
 *         if not mate_is_unmapped and not mate_other_chr:
 *             self.tlen.update(tlen)             # <<<<<<<<<<<<<<
 *         if is_proper_pair:
 *             self.tlen_pp.update(tlen)
 */
    ((struct __pyx_vtabstruct_10pysamstats_3opt_TlenHelper *)__pyx_v_self->tlen->__pyx_vtab)->update(__pyx_v_self->tlen, __pyx_v_tlen);

    /* "pysamstats/opt.pyx":766
 *         self.reads_all += 1
 *         # N.B. insert size is only meaningful if mate is mapped to same chromosome
 *         if not mate_is_unmapped and not mate_other_chr:             # <<<<<<<<<<<<<<
 *             self.tlen.update(tlen)
 *         if is_proper_pair:
 */
  }

  /* "pysamstats/opt.pyx":768
 *         if not mate_is_unmapped and not mate_other_chr:
 *             self.tlen.update(tlen)
 *         if is_proper_pair:             # <<<<<<<<<<<<<<
 *             self.tlen_pp.update(tlen)
 * 
 */
  __pyx_t_3 = (__pyx_v_is_proper_pair != 0);
  if (__pyx_t_3) {

    /* "pysamstats/opt.pyx":769
 *             self.tlen.update(tlen)
 *         if is_proper_pair:
 *             self.tlen_pp.update(tlen)             # <<<<<<<<<<<<<<
 * 
 *     cdef dict rec(self, chrom, pos, FastaFile fafile, bytes refbase):
 */
    ((struct __pyx_vtabstruct_10pysamstats_3opt_TlenHelper *)__pyx_v_self->tlen_pp->__pyx_vtab)->update(__pyx_v_self->tlen_pp, __pyx_v_tlen);

    /* "pysamstats/opt.pyx":768
 *         if not mate_is_unmapped and not mate_other_chr:
 *             self.tlen.update(tlen)
 *         if is_proper_pair:             # <<<<<<<<<<<<<<
 *             self.tlen_pp.update(tlen)
 * 
 */
  }

  /* "pysamstats/opt.pyx":748
 *         self.tlen_pp.reset()
 * 
 *     cdef void recv(self, bam_pileup1_t* read, PileupColumn col, bytes refbase):             # <<<<<<<<<<<<<<
 *         cdef:
 *             uint32_t flag
 */

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

/* "pysamstats/opt.pyx":771
 *             self.tlen_pp.update(tlen)
 * 
 *     cdef dict rec(self, chrom, pos, FastaFile fafile, bytes refbase):             # <<<<<<<<<<<<<<
 * 
 *         # make record
 */

static PyObject *__pyx_f_10pysamstats_3opt_4Tlen_rec(struct __pyx_obj_10pysamstats_3opt_Tlen *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_chrom, CYTHON_UNUSED PyObject *__pyx_v_pos, CYTHON_UNUSED struct __pyx_obj_5pysam_9libcfaidx_FastaFile *__pyx_v_fafile, CYTHON_UNUSED PyObject *__pyx_v_refbase) {
  PyObject *__pyx_v_rec = 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;
  __Pyx_RefNannySetupContext("rec", 0);

  /* "pysamstats/opt.pyx":774
 * 
 *         # make record
 *         rec = {'reads_all': self.reads_all,             # <<<<<<<<<<<<<<
 *                'reads_paired': self.tlen.n,
 *                'reads_pp': self.tlen_pp.n,
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->reads_all); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_all, __pyx_t_2) < 0) __PYX_ERR(0, 774, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":775
 *         # make record
 *         rec = {'reads_all': self.reads_all,
 *                'reads_paired': self.tlen.n,             # <<<<<<<<<<<<<<
 *                'reads_pp': self.tlen_pp.n,
 *                'mean_tlen': self.tlen.mean(),
 */
  __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v_self->tlen->n); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 775, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_paired, __pyx_t_2) < 0) __PYX_ERR(0, 774, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":776
 *         rec = {'reads_all': self.reads_all,
 *                'reads_paired': self.tlen.n,
 *                'reads_pp': self.tlen_pp.n,             # <<<<<<<<<<<<<<
 *                'mean_tlen': self.tlen.mean(),
 *                'mean_tlen_pp': self.tlen_pp.mean(),
 */
  __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v_self->tlen_pp->n); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 776, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_pp, __pyx_t_2) < 0) __PYX_ERR(0, 774, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":777
 *                'reads_paired': self.tlen.n,
 *                'reads_pp': self.tlen_pp.n,
 *                'mean_tlen': self.tlen.mean(),             # <<<<<<<<<<<<<<
 *                'mean_tlen_pp': self.tlen_pp.mean(),
 *                'rms_tlen': self.tlen.rms(),
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->tlen), __pyx_n_s_mean); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 777, __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_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 777, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_mean_tlen, __pyx_t_2) < 0) __PYX_ERR(0, 774, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":778
 *                'reads_pp': self.tlen_pp.n,
 *                'mean_tlen': self.tlen.mean(),
 *                'mean_tlen_pp': self.tlen_pp.mean(),             # <<<<<<<<<<<<<<
 *                'rms_tlen': self.tlen.rms(),
 *                'rms_tlen_pp': self.tlen_pp.rms(),
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->tlen_pp), __pyx_n_s_mean); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 778, __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_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 778, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_mean_tlen_pp, __pyx_t_2) < 0) __PYX_ERR(0, 774, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":779
 *                'mean_tlen': self.tlen.mean(),
 *                'mean_tlen_pp': self.tlen_pp.mean(),
 *                'rms_tlen': self.tlen.rms(),             # <<<<<<<<<<<<<<
 *                'rms_tlen_pp': self.tlen_pp.rms(),
 *                'std_tlen': self.tlen.std(),
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->tlen), __pyx_n_s_rms); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 779, __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_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 779, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_rms_tlen, __pyx_t_2) < 0) __PYX_ERR(0, 774, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":780
 *                'mean_tlen_pp': self.tlen_pp.mean(),
 *                'rms_tlen': self.tlen.rms(),
 *                'rms_tlen_pp': self.tlen_pp.rms(),             # <<<<<<<<<<<<<<
 *                'std_tlen': self.tlen.std(),
 *                'std_tlen_pp': self.tlen_pp.std()}
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->tlen_pp), __pyx_n_s_rms); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 780, __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_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 780, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_rms_tlen_pp, __pyx_t_2) < 0) __PYX_ERR(0, 774, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":781
 *                'rms_tlen': self.tlen.rms(),
 *                'rms_tlen_pp': self.tlen_pp.rms(),
 *                'std_tlen': self.tlen.std(),             # <<<<<<<<<<<<<<
 *                'std_tlen_pp': self.tlen_pp.std()}
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->tlen), __pyx_n_s_std); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 781, __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_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 781, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_std_tlen, __pyx_t_2) < 0) __PYX_ERR(0, 774, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":782
 *                'rms_tlen_pp': self.tlen_pp.rms(),
 *                'std_tlen': self.tlen.std(),
 *                'std_tlen_pp': self.tlen_pp.std()}             # <<<<<<<<<<<<<<
 * 
 *         # reset counters
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->tlen_pp), __pyx_n_s_std); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 782, __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_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 782, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_std_tlen_pp, __pyx_t_2) < 0) __PYX_ERR(0, 774, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_rec = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":785
 * 
 *         # reset counters
 *         self.reset()             # <<<<<<<<<<<<<<
 * 
 *         return rec
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 785, __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, 785, __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;

  /* "pysamstats/opt.pyx":787
 *         self.reset()
 * 
 *         return rec             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_rec);
  __pyx_r = __pyx_v_rec;
  goto __pyx_L0;

  /* "pysamstats/opt.pyx":771
 *             self.tlen_pp.update(tlen)
 * 
 *     cdef dict rec(self, chrom, pos, FastaFile fafile, bytes refbase):             # <<<<<<<<<<<<<<
 * 
 *         # make record
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pysamstats.opt.Tlen.rec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rec);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_4Tlen_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pysamstats_3opt_4Tlen_4__reduce_cython__[] = "Tlen.__reduce_cython__(self)";
static PyObject *__pyx_pw_10pysamstats_3opt_4Tlen_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_4Tlen_4__reduce_cython__(((struct __pyx_obj_10pysamstats_3opt_Tlen *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pysamstats_3opt_4Tlen_4__reduce_cython__(struct __pyx_obj_10pysamstats_3opt_Tlen *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self.reads_all, self.tlen, self.tlen_pp)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->reads_all); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->tlen));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->tlen));
  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self->tlen));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->tlen_pp));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->tlen_pp));
  PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_v_self->tlen_pp));
  __pyx_t_1 = 0;
  __pyx_v_state = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self.reads_all, self.tlen, self.tlen_pp)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         state += (_dict,)
 */
  __pyx_t_2 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v__dict = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "(tree fragment)":7
 *     state = (self.reads_all, self.tlen, self.tlen_pp)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
  __pyx_t_3 = (__pyx_v__dict != Py_None);
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
 */
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v__dict);
    __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_1));
    __pyx_t_1 = 0;

    /* "(tree fragment)":9
 *     if _dict is not None:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = self.tlen is not None or self.tlen_pp is not None
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = (self.reads_all, self.tlen, self.tlen_pp)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
    goto __pyx_L3;
  }

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = self.tlen is not None or self.tlen_pp is not None             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_Tlen, (type(self), 0x2c18efa, None), state
 */
  /*else*/ {
    __pyx_t_3 = (((PyObject *)__pyx_v_self->tlen) != Py_None);
    __pyx_t_5 = (__pyx_t_3 != 0);
    if (!__pyx_t_5) {
    } else {
      __pyx_t_4 = __pyx_t_5;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_5 = (((PyObject *)__pyx_v_self->tlen_pp) != Py_None);
    __pyx_t_3 = (__pyx_t_5 != 0);
    __pyx_t_4 = __pyx_t_3;
    __pyx_L4_bool_binop_done:;
    __pyx_v_use_setstate = __pyx_t_4;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.tlen is not None or self.tlen_pp is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_Tlen, (type(self), 0x2c18efa, None), state
 *     else:
 */
  __pyx_t_4 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_4) {

    /* "(tree fragment)":13
 *         use_setstate = self.tlen is not None or self.tlen_pp is not None
 *     if use_setstate:
 *         return __pyx_unpickle_Tlen, (type(self), 0x2c18efa, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_Tlen, (type(self), 0x2c18efa, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pyx_unpickle_Tlen); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_46239482);
    __Pyx_GIVEREF(__pyx_int_46239482);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_46239482);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_2, 2, Py_None);
    __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_2);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_state);
    __pyx_t_1 = 0;
    __pyx_t_2 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.tlen is not None or self.tlen_pp is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_Tlen, (type(self), 0x2c18efa, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_Tlen, (type(self), 0x2c18efa, None), state
 *     else:
 *         return __pyx_unpickle_Tlen, (type(self), 0x2c18efa, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_Tlen__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_pyx_unpickle_Tlen); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_46239482);
    __Pyx_GIVEREF(__pyx_int_46239482);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_46239482);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_state);
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2);
    __pyx_t_6 = 0;
    __pyx_t_2 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pysamstats.opt.Tlen.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_Tlen, (type(self), 0x2c18efa, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_Tlen__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_4Tlen_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_10pysamstats_3opt_4Tlen_6__setstate_cython__[] = "Tlen.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_10pysamstats_3opt_4Tlen_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_4Tlen_6__setstate_cython__(((struct __pyx_obj_10pysamstats_3opt_Tlen *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_10pysamstats_3opt_4Tlen_6__setstate_cython__(struct __pyx_obj_10pysamstats_3opt_Tlen *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_Tlen, (type(self), 0x2c18efa, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_Tlen__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
 */
  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_10pysamstats_3opt___pyx_unpickle_Tlen__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_Tlen, (type(self), 0x2c18efa, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_Tlen__set_state(self, __pyx_state)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysamstats.opt.Tlen.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":809
 *         TlenHelper tlen_pp_rev
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.tlen = TlenHelper()
 *         self.tlen_fwd = TlenHelper()
 */

/* Python wrapper */
static int __pyx_pw_10pysamstats_3opt_10TlenStrand_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_10pysamstats_3opt_10TlenStrand_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
  __pyx_r = __pyx_pf_10pysamstats_3opt_10TlenStrand___init__(((struct __pyx_obj_10pysamstats_3opt_TlenStrand *)__pyx_v_self));

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

static int __pyx_pf_10pysamstats_3opt_10TlenStrand___init__(struct __pyx_obj_10pysamstats_3opt_TlenStrand *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "pysamstats/opt.pyx":810
 * 
 *     def __init__(self):
 *         self.tlen = TlenHelper()             # <<<<<<<<<<<<<<
 *         self.tlen_fwd = TlenHelper()
 *         self.tlen_rev = TlenHelper()
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_TlenHelper)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 810, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->tlen);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->tlen));
  __pyx_v_self->tlen = ((struct __pyx_obj_10pysamstats_3opt_TlenHelper *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":811
 *     def __init__(self):
 *         self.tlen = TlenHelper()
 *         self.tlen_fwd = TlenHelper()             # <<<<<<<<<<<<<<
 *         self.tlen_rev = TlenHelper()
 *         self.tlen_pp = TlenHelper()
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_TlenHelper)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 811, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->tlen_fwd);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->tlen_fwd));
  __pyx_v_self->tlen_fwd = ((struct __pyx_obj_10pysamstats_3opt_TlenHelper *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":812
 *         self.tlen = TlenHelper()
 *         self.tlen_fwd = TlenHelper()
 *         self.tlen_rev = TlenHelper()             # <<<<<<<<<<<<<<
 *         self.tlen_pp = TlenHelper()
 *         self.tlen_pp_fwd = TlenHelper()
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_TlenHelper)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 812, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->tlen_rev);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->tlen_rev));
  __pyx_v_self->tlen_rev = ((struct __pyx_obj_10pysamstats_3opt_TlenHelper *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":813
 *         self.tlen_fwd = TlenHelper()
 *         self.tlen_rev = TlenHelper()
 *         self.tlen_pp = TlenHelper()             # <<<<<<<<<<<<<<
 *         self.tlen_pp_fwd = TlenHelper()
 *         self.tlen_pp_rev = TlenHelper()
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_TlenHelper)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 813, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->tlen_pp);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->tlen_pp));
  __pyx_v_self->tlen_pp = ((struct __pyx_obj_10pysamstats_3opt_TlenHelper *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":814
 *         self.tlen_rev = TlenHelper()
 *         self.tlen_pp = TlenHelper()
 *         self.tlen_pp_fwd = TlenHelper()             # <<<<<<<<<<<<<<
 *         self.tlen_pp_rev = TlenHelper()
 *         self.reset()
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_TlenHelper)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 814, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->tlen_pp_fwd);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->tlen_pp_fwd));
  __pyx_v_self->tlen_pp_fwd = ((struct __pyx_obj_10pysamstats_3opt_TlenHelper *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":815
 *         self.tlen_pp = TlenHelper()
 *         self.tlen_pp_fwd = TlenHelper()
 *         self.tlen_pp_rev = TlenHelper()             # <<<<<<<<<<<<<<
 *         self.reset()
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_TlenHelper)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 815, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->tlen_pp_rev);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->tlen_pp_rev));
  __pyx_v_self->tlen_pp_rev = ((struct __pyx_obj_10pysamstats_3opt_TlenHelper *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":816
 *         self.tlen_pp_fwd = TlenHelper()
 *         self.tlen_pp_rev = TlenHelper()
 *         self.reset()             # <<<<<<<<<<<<<<
 * 
 *     def reset(self):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 816, __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, 816, __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;

  /* "pysamstats/opt.pyx":809
 *         TlenHelper tlen_pp_rev
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.tlen = TlenHelper()
 *         self.tlen_fwd = TlenHelper()
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysamstats.opt.TlenStrand.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":818
 *         self.reset()
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         self.reads_all = 0
 *         self.reads_fwd = 0
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_10TlenStrand_3reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pysamstats_3opt_10TlenStrand_2reset[] = "TlenStrand.reset(self)";
static PyObject *__pyx_pw_10pysamstats_3opt_10TlenStrand_3reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reset (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_10TlenStrand_2reset(((struct __pyx_obj_10pysamstats_3opt_TlenStrand *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pysamstats_3opt_10TlenStrand_2reset(struct __pyx_obj_10pysamstats_3opt_TlenStrand *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("reset", 0);

  /* "pysamstats/opt.pyx":819
 * 
 *     def reset(self):
 *         self.reads_all = 0             # <<<<<<<<<<<<<<
 *         self.reads_fwd = 0
 *         self.reads_rev = 0
 */
  __pyx_v_self->reads_all = 0;

  /* "pysamstats/opt.pyx":820
 *     def reset(self):
 *         self.reads_all = 0
 *         self.reads_fwd = 0             # <<<<<<<<<<<<<<
 *         self.reads_rev = 0
 *         self.tlen.reset()
 */
  __pyx_v_self->reads_fwd = 0;

  /* "pysamstats/opt.pyx":821
 *         self.reads_all = 0
 *         self.reads_fwd = 0
 *         self.reads_rev = 0             # <<<<<<<<<<<<<<
 *         self.tlen.reset()
 *         self.tlen_fwd.reset()
 */
  __pyx_v_self->reads_rev = 0;

  /* "pysamstats/opt.pyx":822
 *         self.reads_fwd = 0
 *         self.reads_rev = 0
 *         self.tlen.reset()             # <<<<<<<<<<<<<<
 *         self.tlen_fwd.reset()
 *         self.tlen_rev.reset()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->tlen), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 822, __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, 822, __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;

  /* "pysamstats/opt.pyx":823
 *         self.reads_rev = 0
 *         self.tlen.reset()
 *         self.tlen_fwd.reset()             # <<<<<<<<<<<<<<
 *         self.tlen_rev.reset()
 *         self.tlen_pp.reset()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->tlen_fwd), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 823, __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, 823, __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;

  /* "pysamstats/opt.pyx":824
 *         self.tlen.reset()
 *         self.tlen_fwd.reset()
 *         self.tlen_rev.reset()             # <<<<<<<<<<<<<<
 *         self.tlen_pp.reset()
 *         self.tlen_pp_fwd.reset()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->tlen_rev), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 824, __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, 824, __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;

  /* "pysamstats/opt.pyx":825
 *         self.tlen_fwd.reset()
 *         self.tlen_rev.reset()
 *         self.tlen_pp.reset()             # <<<<<<<<<<<<<<
 *         self.tlen_pp_fwd.reset()
 *         self.tlen_pp_rev.reset()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->tlen_pp), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 825, __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, 825, __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;

  /* "pysamstats/opt.pyx":826
 *         self.tlen_rev.reset()
 *         self.tlen_pp.reset()
 *         self.tlen_pp_fwd.reset()             # <<<<<<<<<<<<<<
 *         self.tlen_pp_rev.reset()
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->tlen_pp_fwd), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 826, __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, 826, __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;

  /* "pysamstats/opt.pyx":827
 *         self.tlen_pp.reset()
 *         self.tlen_pp_fwd.reset()
 *         self.tlen_pp_rev.reset()             # <<<<<<<<<<<<<<
 * 
 *     cdef void recv(self, bam_pileup1_t* read, PileupColumn col, bytes refbase):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->tlen_pp_rev), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 827, __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, 827, __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;

  /* "pysamstats/opt.pyx":818
 *         self.reset()
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         self.reads_all = 0
 *         self.reads_fwd = 0
 */

  /* 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_AddTraceback("pysamstats.opt.TlenStrand.reset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":829
 *         self.tlen_pp_rev.reset()
 * 
 *     cdef void recv(self, bam_pileup1_t* read, PileupColumn col, bytes refbase):             # <<<<<<<<<<<<<<
 *         cdef:
 *             uint32_t flag
 */

static void __pyx_f_10pysamstats_3opt_10TlenStrand_recv(struct __pyx_obj_10pysamstats_3opt_TlenStrand *__pyx_v_self, bam_pileup1_t *__pyx_v_read, CYTHON_UNUSED struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn *__pyx_v_col, CYTHON_UNUSED PyObject *__pyx_v_refbase) {
  uint32_t __pyx_v_flag;
  int __pyx_v_is_proper_pair;
  int __pyx_v_is_reverse;
  int __pyx_v_mate_other_chr;
  int64_t __pyx_v_tlen;
  int __pyx_v_mate_is_unmapped;
  __Pyx_RefNannyDeclarations
  uint16_t __pyx_t_1;
  int32_t __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("recv", 0);

  /* "pysamstats/opt.pyx":839
 * 
 *         # convenience variables
 *         flag = read.b.core.flag             # <<<<<<<<<<<<<<
 *         is_proper_pair = <bint>(flag & BAM_FPROPER_PAIR)
 *         is_reverse = <bint>(flag & BAM_FREVERSE)
 */
  __pyx_t_1 = __pyx_v_read->b->core.flag;
  __pyx_v_flag = __pyx_t_1;

  /* "pysamstats/opt.pyx":840
 *         # convenience variables
 *         flag = read.b.core.flag
 *         is_proper_pair = <bint>(flag & BAM_FPROPER_PAIR)             # <<<<<<<<<<<<<<
 *         is_reverse = <bint>(flag & BAM_FREVERSE)
 *         mate_is_unmapped = <bint>(flag & BAM_FMUNMAP)
 */
  __pyx_v_is_proper_pair = ((__pyx_v_flag & 2) != 0);

  /* "pysamstats/opt.pyx":841
 *         flag = read.b.core.flag
 *         is_proper_pair = <bint>(flag & BAM_FPROPER_PAIR)
 *         is_reverse = <bint>(flag & BAM_FREVERSE)             # <<<<<<<<<<<<<<
 *         mate_is_unmapped = <bint>(flag & BAM_FMUNMAP)
 *         mate_other_chr = <bint>(read.b.core.tid != read.b.core.mtid)
 */
  __pyx_v_is_reverse = ((__pyx_v_flag & 16) != 0);

  /* "pysamstats/opt.pyx":842
 *         is_proper_pair = <bint>(flag & BAM_FPROPER_PAIR)
 *         is_reverse = <bint>(flag & BAM_FREVERSE)
 *         mate_is_unmapped = <bint>(flag & BAM_FMUNMAP)             # <<<<<<<<<<<<<<
 *         mate_other_chr = <bint>(read.b.core.tid != read.b.core.mtid)
 *         tlen = read.b.core.isize
 */
  __pyx_v_mate_is_unmapped = ((__pyx_v_flag & 8) != 0);

  /* "pysamstats/opt.pyx":843
 *         is_reverse = <bint>(flag & BAM_FREVERSE)
 *         mate_is_unmapped = <bint>(flag & BAM_FMUNMAP)
 *         mate_other_chr = <bint>(read.b.core.tid != read.b.core.mtid)             # <<<<<<<<<<<<<<
 *         tlen = read.b.core.isize
 * 
 */
  __pyx_v_mate_other_chr = ((__pyx_v_read->b->core.tid != __pyx_v_read->b->core.mtid) != 0);

  /* "pysamstats/opt.pyx":844
 *         mate_is_unmapped = <bint>(flag & BAM_FMUNMAP)
 *         mate_other_chr = <bint>(read.b.core.tid != read.b.core.mtid)
 *         tlen = read.b.core.isize             # <<<<<<<<<<<<<<
 * 
 *         # do the counting
 */
  __pyx_t_2 = __pyx_v_read->b->core.isize;
  __pyx_v_tlen = __pyx_t_2;

  /* "pysamstats/opt.pyx":847
 * 
 *         # do the counting
 *         self.reads_all += 1             # <<<<<<<<<<<<<<
 *         if is_reverse:
 *             self.reads_rev += 1
 */
  __pyx_v_self->reads_all = (__pyx_v_self->reads_all + 1);

  /* "pysamstats/opt.pyx":848
 *         # do the counting
 *         self.reads_all += 1
 *         if is_reverse:             # <<<<<<<<<<<<<<
 *             self.reads_rev += 1
 *         else:
 */
  __pyx_t_3 = (__pyx_v_is_reverse != 0);
  if (__pyx_t_3) {

    /* "pysamstats/opt.pyx":849
 *         self.reads_all += 1
 *         if is_reverse:
 *             self.reads_rev += 1             # <<<<<<<<<<<<<<
 *         else:
 *             self.reads_fwd += 1
 */
    __pyx_v_self->reads_rev = (__pyx_v_self->reads_rev + 1);

    /* "pysamstats/opt.pyx":848
 *         # do the counting
 *         self.reads_all += 1
 *         if is_reverse:             # <<<<<<<<<<<<<<
 *             self.reads_rev += 1
 *         else:
 */
    goto __pyx_L3;
  }

  /* "pysamstats/opt.pyx":851
 *             self.reads_rev += 1
 *         else:
 *             self.reads_fwd += 1             # <<<<<<<<<<<<<<
 * 
 *         # N.B. insert size is only meaningful if mate is mapped to same chromosome
 */
  /*else*/ {
    __pyx_v_self->reads_fwd = (__pyx_v_self->reads_fwd + 1);
  }
  __pyx_L3:;

  /* "pysamstats/opt.pyx":854
 * 
 *         # N.B. insert size is only meaningful if mate is mapped to same chromosome
 *         if not mate_is_unmapped and not mate_other_chr:             # <<<<<<<<<<<<<<
 *             self.tlen.update(tlen)
 *             if is_reverse:
 */
  __pyx_t_4 = ((!(__pyx_v_mate_is_unmapped != 0)) != 0);
  if (__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_4 = ((!(__pyx_v_mate_other_chr != 0)) != 0);
  __pyx_t_3 = __pyx_t_4;
  __pyx_L5_bool_binop_done:;
  if (__pyx_t_3) {

    /* "pysamstats/opt.pyx":855
 *         # N.B. insert size is only meaningful if mate is mapped to same chromosome
 *         if not mate_is_unmapped and not mate_other_chr:
 *             self.tlen.update(tlen)             # <<<<<<<<<<<<<<
 *             if is_reverse:
 *                 self.tlen_rev.update(tlen)
 */
    ((struct __pyx_vtabstruct_10pysamstats_3opt_TlenHelper *)__pyx_v_self->tlen->__pyx_vtab)->update(__pyx_v_self->tlen, __pyx_v_tlen);

    /* "pysamstats/opt.pyx":856
 *         if not mate_is_unmapped and not mate_other_chr:
 *             self.tlen.update(tlen)
 *             if is_reverse:             # <<<<<<<<<<<<<<
 *                 self.tlen_rev.update(tlen)
 *             else:
 */
    __pyx_t_3 = (__pyx_v_is_reverse != 0);
    if (__pyx_t_3) {

      /* "pysamstats/opt.pyx":857
 *             self.tlen.update(tlen)
 *             if is_reverse:
 *                 self.tlen_rev.update(tlen)             # <<<<<<<<<<<<<<
 *             else:
 *                 self.tlen_fwd.update(tlen)
 */
      ((struct __pyx_vtabstruct_10pysamstats_3opt_TlenHelper *)__pyx_v_self->tlen_rev->__pyx_vtab)->update(__pyx_v_self->tlen_rev, __pyx_v_tlen);

      /* "pysamstats/opt.pyx":856
 *         if not mate_is_unmapped and not mate_other_chr:
 *             self.tlen.update(tlen)
 *             if is_reverse:             # <<<<<<<<<<<<<<
 *                 self.tlen_rev.update(tlen)
 *             else:
 */
      goto __pyx_L7;
    }

    /* "pysamstats/opt.pyx":859
 *                 self.tlen_rev.update(tlen)
 *             else:
 *                 self.tlen_fwd.update(tlen)             # <<<<<<<<<<<<<<
 *         if is_proper_pair:
 *             self.tlen_pp.update(tlen)
 */
    /*else*/ {
      ((struct __pyx_vtabstruct_10pysamstats_3opt_TlenHelper *)__pyx_v_self->tlen_fwd->__pyx_vtab)->update(__pyx_v_self->tlen_fwd, __pyx_v_tlen);
    }
    __pyx_L7:;

    /* "pysamstats/opt.pyx":854
 * 
 *         # N.B. insert size is only meaningful if mate is mapped to same chromosome
 *         if not mate_is_unmapped and not mate_other_chr:             # <<<<<<<<<<<<<<
 *             self.tlen.update(tlen)
 *             if is_reverse:
 */
  }

  /* "pysamstats/opt.pyx":860
 *             else:
 *                 self.tlen_fwd.update(tlen)
 *         if is_proper_pair:             # <<<<<<<<<<<<<<
 *             self.tlen_pp.update(tlen)
 *             if is_reverse:
 */
  __pyx_t_3 = (__pyx_v_is_proper_pair != 0);
  if (__pyx_t_3) {

    /* "pysamstats/opt.pyx":861
 *                 self.tlen_fwd.update(tlen)
 *         if is_proper_pair:
 *             self.tlen_pp.update(tlen)             # <<<<<<<<<<<<<<
 *             if is_reverse:
 *                 self.tlen_pp_rev.update(tlen)
 */
    ((struct __pyx_vtabstruct_10pysamstats_3opt_TlenHelper *)__pyx_v_self->tlen_pp->__pyx_vtab)->update(__pyx_v_self->tlen_pp, __pyx_v_tlen);

    /* "pysamstats/opt.pyx":862
 *         if is_proper_pair:
 *             self.tlen_pp.update(tlen)
 *             if is_reverse:             # <<<<<<<<<<<<<<
 *                 self.tlen_pp_rev.update(tlen)
 *             else:
 */
    __pyx_t_3 = (__pyx_v_is_reverse != 0);
    if (__pyx_t_3) {

      /* "pysamstats/opt.pyx":863
 *             self.tlen_pp.update(tlen)
 *             if is_reverse:
 *                 self.tlen_pp_rev.update(tlen)             # <<<<<<<<<<<<<<
 *             else:
 *                 self.tlen_pp_fwd.update(tlen)
 */
      ((struct __pyx_vtabstruct_10pysamstats_3opt_TlenHelper *)__pyx_v_self->tlen_pp_rev->__pyx_vtab)->update(__pyx_v_self->tlen_pp_rev, __pyx_v_tlen);

      /* "pysamstats/opt.pyx":862
 *         if is_proper_pair:
 *             self.tlen_pp.update(tlen)
 *             if is_reverse:             # <<<<<<<<<<<<<<
 *                 self.tlen_pp_rev.update(tlen)
 *             else:
 */
      goto __pyx_L9;
    }

    /* "pysamstats/opt.pyx":865
 *                 self.tlen_pp_rev.update(tlen)
 *             else:
 *                 self.tlen_pp_fwd.update(tlen)             # <<<<<<<<<<<<<<
 * 
 *     cdef dict rec(self, chrom, pos, FastaFile fafile, bytes refbase):
 */
    /*else*/ {
      ((struct __pyx_vtabstruct_10pysamstats_3opt_TlenHelper *)__pyx_v_self->tlen_pp_fwd->__pyx_vtab)->update(__pyx_v_self->tlen_pp_fwd, __pyx_v_tlen);
    }
    __pyx_L9:;

    /* "pysamstats/opt.pyx":860
 *             else:
 *                 self.tlen_fwd.update(tlen)
 *         if is_proper_pair:             # <<<<<<<<<<<<<<
 *             self.tlen_pp.update(tlen)
 *             if is_reverse:
 */
  }

  /* "pysamstats/opt.pyx":829
 *         self.tlen_pp_rev.reset()
 * 
 *     cdef void recv(self, bam_pileup1_t* read, PileupColumn col, bytes refbase):             # <<<<<<<<<<<<<<
 *         cdef:
 *             uint32_t flag
 */

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

/* "pysamstats/opt.pyx":867
 *                 self.tlen_pp_fwd.update(tlen)
 * 
 *     cdef dict rec(self, chrom, pos, FastaFile fafile, bytes refbase):             # <<<<<<<<<<<<<<
 * 
 *         # make record
 */

static PyObject *__pyx_f_10pysamstats_3opt_10TlenStrand_rec(struct __pyx_obj_10pysamstats_3opt_TlenStrand *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_chrom, CYTHON_UNUSED PyObject *__pyx_v_pos, CYTHON_UNUSED struct __pyx_obj_5pysam_9libcfaidx_FastaFile *__pyx_v_fafile, CYTHON_UNUSED PyObject *__pyx_v_refbase) {
  PyObject *__pyx_v_rec = 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;
  __Pyx_RefNannySetupContext("rec", 0);

  /* "pysamstats/opt.pyx":871
 *         # make record
 *         rec = {
 *             'reads_all': self.reads_all,             # <<<<<<<<<<<<<<
 *             'reads_fwd': self.reads_fwd,
 *             'reads_rev': self.reads_rev,
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(27); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 871, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->reads_all); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 871, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_all, __pyx_t_2) < 0) __PYX_ERR(0, 871, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":872
 *         rec = {
 *             'reads_all': self.reads_all,
 *             'reads_fwd': self.reads_fwd,             # <<<<<<<<<<<<<<
 *             'reads_rev': self.reads_rev,
 *             'reads_paired': self.tlen.n,
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->reads_fwd); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 872, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_fwd, __pyx_t_2) < 0) __PYX_ERR(0, 871, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":873
 *             'reads_all': self.reads_all,
 *             'reads_fwd': self.reads_fwd,
 *             'reads_rev': self.reads_rev,             # <<<<<<<<<<<<<<
 *             'reads_paired': self.tlen.n,
 *             'reads_paired_fwd': self.tlen_fwd.n,
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->reads_rev); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 873, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_rev, __pyx_t_2) < 0) __PYX_ERR(0, 871, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":874
 *             'reads_fwd': self.reads_fwd,
 *             'reads_rev': self.reads_rev,
 *             'reads_paired': self.tlen.n,             # <<<<<<<<<<<<<<
 *             'reads_paired_fwd': self.tlen_fwd.n,
 *             'reads_paired_rev': self.tlen_rev.n,
 */
  __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v_self->tlen->n); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 874, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_paired, __pyx_t_2) < 0) __PYX_ERR(0, 871, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":875
 *             'reads_rev': self.reads_rev,
 *             'reads_paired': self.tlen.n,
 *             'reads_paired_fwd': self.tlen_fwd.n,             # <<<<<<<<<<<<<<
 *             'reads_paired_rev': self.tlen_rev.n,
 *             'reads_pp': self.tlen_pp.n,
 */
  __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v_self->tlen_fwd->n); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 875, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_paired_fwd, __pyx_t_2) < 0) __PYX_ERR(0, 871, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":876
 *             'reads_paired': self.tlen.n,
 *             'reads_paired_fwd': self.tlen_fwd.n,
 *             'reads_paired_rev': self.tlen_rev.n,             # <<<<<<<<<<<<<<
 *             'reads_pp': self.tlen_pp.n,
 *             'reads_pp_fwd': self.tlen_pp_fwd.n,
 */
  __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v_self->tlen_rev->n); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 876, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_paired_rev, __pyx_t_2) < 0) __PYX_ERR(0, 871, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":877
 *             'reads_paired_fwd': self.tlen_fwd.n,
 *             'reads_paired_rev': self.tlen_rev.n,
 *             'reads_pp': self.tlen_pp.n,             # <<<<<<<<<<<<<<
 *             'reads_pp_fwd': self.tlen_pp_fwd.n,
 *             'reads_pp_rev': self.tlen_pp_rev.n,
 */
  __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v_self->tlen_pp->n); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 877, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_pp, __pyx_t_2) < 0) __PYX_ERR(0, 871, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":878
 *             'reads_paired_rev': self.tlen_rev.n,
 *             'reads_pp': self.tlen_pp.n,
 *             'reads_pp_fwd': self.tlen_pp_fwd.n,             # <<<<<<<<<<<<<<
 *             'reads_pp_rev': self.tlen_pp_rev.n,
 *             'mean_tlen': self.tlen.mean(),
 */
  __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v_self->tlen_pp_fwd->n); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 878, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_pp_fwd, __pyx_t_2) < 0) __PYX_ERR(0, 871, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":879
 *             'reads_pp': self.tlen_pp.n,
 *             'reads_pp_fwd': self.tlen_pp_fwd.n,
 *             'reads_pp_rev': self.tlen_pp_rev.n,             # <<<<<<<<<<<<<<
 *             'mean_tlen': self.tlen.mean(),
 *             'mean_tlen_fwd': self.tlen_fwd.mean(),
 */
  __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v_self->tlen_pp_rev->n); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 879, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_pp_rev, __pyx_t_2) < 0) __PYX_ERR(0, 871, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":880
 *             'reads_pp_fwd': self.tlen_pp_fwd.n,
 *             'reads_pp_rev': self.tlen_pp_rev.n,
 *             'mean_tlen': self.tlen.mean(),             # <<<<<<<<<<<<<<
 *             'mean_tlen_fwd': self.tlen_fwd.mean(),
 *             'mean_tlen_rev': self.tlen_rev.mean(),
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->tlen), __pyx_n_s_mean); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 880, __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_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 880, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_mean_tlen, __pyx_t_2) < 0) __PYX_ERR(0, 871, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":881
 *             'reads_pp_rev': self.tlen_pp_rev.n,
 *             'mean_tlen': self.tlen.mean(),
 *             'mean_tlen_fwd': self.tlen_fwd.mean(),             # <<<<<<<<<<<<<<
 *             'mean_tlen_rev': self.tlen_rev.mean(),
 *             'mean_tlen_pp': self.tlen_pp.mean(),
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->tlen_fwd), __pyx_n_s_mean); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 881, __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_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 881, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_mean_tlen_fwd, __pyx_t_2) < 0) __PYX_ERR(0, 871, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":882
 *             'mean_tlen': self.tlen.mean(),
 *             'mean_tlen_fwd': self.tlen_fwd.mean(),
 *             'mean_tlen_rev': self.tlen_rev.mean(),             # <<<<<<<<<<<<<<
 *             'mean_tlen_pp': self.tlen_pp.mean(),
 *             'mean_tlen_pp_fwd': self.tlen_pp_fwd.mean(),
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->tlen_rev), __pyx_n_s_mean); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 882, __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_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 882, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_mean_tlen_rev, __pyx_t_2) < 0) __PYX_ERR(0, 871, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":883
 *             'mean_tlen_fwd': self.tlen_fwd.mean(),
 *             'mean_tlen_rev': self.tlen_rev.mean(),
 *             'mean_tlen_pp': self.tlen_pp.mean(),             # <<<<<<<<<<<<<<
 *             'mean_tlen_pp_fwd': self.tlen_pp_fwd.mean(),
 *             'mean_tlen_pp_rev': self.tlen_pp_rev.mean(),
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->tlen_pp), __pyx_n_s_mean); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 883, __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_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 883, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_mean_tlen_pp, __pyx_t_2) < 0) __PYX_ERR(0, 871, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":884
 *             'mean_tlen_rev': self.tlen_rev.mean(),
 *             'mean_tlen_pp': self.tlen_pp.mean(),
 *             'mean_tlen_pp_fwd': self.tlen_pp_fwd.mean(),             # <<<<<<<<<<<<<<
 *             'mean_tlen_pp_rev': self.tlen_pp_rev.mean(),
 *             'rms_tlen': self.tlen.rms(),
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->tlen_pp_fwd), __pyx_n_s_mean); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 884, __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_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 884, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_mean_tlen_pp_fwd, __pyx_t_2) < 0) __PYX_ERR(0, 871, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":885
 *             'mean_tlen_pp': self.tlen_pp.mean(),
 *             'mean_tlen_pp_fwd': self.tlen_pp_fwd.mean(),
 *             'mean_tlen_pp_rev': self.tlen_pp_rev.mean(),             # <<<<<<<<<<<<<<
 *             'rms_tlen': self.tlen.rms(),
 *             'rms_tlen_fwd': self.tlen_fwd.rms(),
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->tlen_pp_rev), __pyx_n_s_mean); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 885, __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_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 885, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_mean_tlen_pp_rev, __pyx_t_2) < 0) __PYX_ERR(0, 871, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":886
 *             'mean_tlen_pp_fwd': self.tlen_pp_fwd.mean(),
 *             'mean_tlen_pp_rev': self.tlen_pp_rev.mean(),
 *             'rms_tlen': self.tlen.rms(),             # <<<<<<<<<<<<<<
 *             'rms_tlen_fwd': self.tlen_fwd.rms(),
 *             'rms_tlen_rev': self.tlen_rev.rms(),
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->tlen), __pyx_n_s_rms); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 886, __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_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 886, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_rms_tlen, __pyx_t_2) < 0) __PYX_ERR(0, 871, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":887
 *             'mean_tlen_pp_rev': self.tlen_pp_rev.mean(),
 *             'rms_tlen': self.tlen.rms(),
 *             'rms_tlen_fwd': self.tlen_fwd.rms(),             # <<<<<<<<<<<<<<
 *             'rms_tlen_rev': self.tlen_rev.rms(),
 *             'rms_tlen_pp': self.tlen_pp.rms(),
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->tlen_fwd), __pyx_n_s_rms); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 887, __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_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 887, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_rms_tlen_fwd, __pyx_t_2) < 0) __PYX_ERR(0, 871, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":888
 *             'rms_tlen': self.tlen.rms(),
 *             'rms_tlen_fwd': self.tlen_fwd.rms(),
 *             'rms_tlen_rev': self.tlen_rev.rms(),             # <<<<<<<<<<<<<<
 *             'rms_tlen_pp': self.tlen_pp.rms(),
 *             'rms_tlen_pp_fwd': self.tlen_pp_fwd.rms(),
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->tlen_rev), __pyx_n_s_rms); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 888, __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_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 888, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_rms_tlen_rev, __pyx_t_2) < 0) __PYX_ERR(0, 871, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":889
 *             'rms_tlen_fwd': self.tlen_fwd.rms(),
 *             'rms_tlen_rev': self.tlen_rev.rms(),
 *             'rms_tlen_pp': self.tlen_pp.rms(),             # <<<<<<<<<<<<<<
 *             'rms_tlen_pp_fwd': self.tlen_pp_fwd.rms(),
 *             'rms_tlen_pp_rev': self.tlen_pp_rev.rms(),
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->tlen_pp), __pyx_n_s_rms); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 889, __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_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 889, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_rms_tlen_pp, __pyx_t_2) < 0) __PYX_ERR(0, 871, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":890
 *             'rms_tlen_rev': self.tlen_rev.rms(),
 *             'rms_tlen_pp': self.tlen_pp.rms(),
 *             'rms_tlen_pp_fwd': self.tlen_pp_fwd.rms(),             # <<<<<<<<<<<<<<
 *             'rms_tlen_pp_rev': self.tlen_pp_rev.rms(),
 *             'std_tlen': self.tlen.std(),
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->tlen_pp_fwd), __pyx_n_s_rms); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 890, __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_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 890, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_rms_tlen_pp_fwd, __pyx_t_2) < 0) __PYX_ERR(0, 871, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":891
 *             'rms_tlen_pp': self.tlen_pp.rms(),
 *             'rms_tlen_pp_fwd': self.tlen_pp_fwd.rms(),
 *             'rms_tlen_pp_rev': self.tlen_pp_rev.rms(),             # <<<<<<<<<<<<<<
 *             'std_tlen': self.tlen.std(),
 *             'std_tlen_fwd': self.tlen_fwd.std(),
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->tlen_pp_rev), __pyx_n_s_rms); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 891, __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_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 891, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_rms_tlen_pp_rev, __pyx_t_2) < 0) __PYX_ERR(0, 871, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":892
 *             'rms_tlen_pp_fwd': self.tlen_pp_fwd.rms(),
 *             'rms_tlen_pp_rev': self.tlen_pp_rev.rms(),
 *             'std_tlen': self.tlen.std(),             # <<<<<<<<<<<<<<
 *             'std_tlen_fwd': self.tlen_fwd.std(),
 *             'std_tlen_rev': self.tlen_rev.std(),
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->tlen), __pyx_n_s_std); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 892, __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_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 892, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_std_tlen, __pyx_t_2) < 0) __PYX_ERR(0, 871, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":893
 *             'rms_tlen_pp_rev': self.tlen_pp_rev.rms(),
 *             'std_tlen': self.tlen.std(),
 *             'std_tlen_fwd': self.tlen_fwd.std(),             # <<<<<<<<<<<<<<
 *             'std_tlen_rev': self.tlen_rev.std(),
 *             'std_tlen_pp': self.tlen_pp.std(),
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->tlen_fwd), __pyx_n_s_std); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 893, __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_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 893, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_std_tlen_fwd, __pyx_t_2) < 0) __PYX_ERR(0, 871, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":894
 *             'std_tlen': self.tlen.std(),
 *             'std_tlen_fwd': self.tlen_fwd.std(),
 *             'std_tlen_rev': self.tlen_rev.std(),             # <<<<<<<<<<<<<<
 *             'std_tlen_pp': self.tlen_pp.std(),
 *             'std_tlen_pp_fwd': self.tlen_pp_fwd.std(),
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->tlen_rev), __pyx_n_s_std); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 894, __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_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 894, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_std_tlen_rev, __pyx_t_2) < 0) __PYX_ERR(0, 871, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":895
 *             'std_tlen_fwd': self.tlen_fwd.std(),
 *             'std_tlen_rev': self.tlen_rev.std(),
 *             'std_tlen_pp': self.tlen_pp.std(),             # <<<<<<<<<<<<<<
 *             'std_tlen_pp_fwd': self.tlen_pp_fwd.std(),
 *             'std_tlen_pp_rev': self.tlen_pp_rev.std(),
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->tlen_pp), __pyx_n_s_std); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 895, __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_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 895, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_std_tlen_pp, __pyx_t_2) < 0) __PYX_ERR(0, 871, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":896
 *             'std_tlen_rev': self.tlen_rev.std(),
 *             'std_tlen_pp': self.tlen_pp.std(),
 *             'std_tlen_pp_fwd': self.tlen_pp_fwd.std(),             # <<<<<<<<<<<<<<
 *             'std_tlen_pp_rev': self.tlen_pp_rev.std(),
 *         }
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->tlen_pp_fwd), __pyx_n_s_std); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 896, __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_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 896, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_std_tlen_pp_fwd, __pyx_t_2) < 0) __PYX_ERR(0, 871, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":897
 *             'std_tlen_pp': self.tlen_pp.std(),
 *             'std_tlen_pp_fwd': self.tlen_pp_fwd.std(),
 *             'std_tlen_pp_rev': self.tlen_pp_rev.std(),             # <<<<<<<<<<<<<<
 *         }
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->tlen_pp_rev), __pyx_n_s_std); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 897, __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_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 897, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_std_tlen_pp_rev, __pyx_t_2) < 0) __PYX_ERR(0, 871, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_rec = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":901
 * 
 *         # reset counters
 *         self.reset()             # <<<<<<<<<<<<<<
 * 
 *         return rec
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 901, __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, 901, __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;

  /* "pysamstats/opt.pyx":903
 *         self.reset()
 * 
 *         return rec             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_rec);
  __pyx_r = __pyx_v_rec;
  goto __pyx_L0;

  /* "pysamstats/opt.pyx":867
 *                 self.tlen_pp_fwd.update(tlen)
 * 
 *     cdef dict rec(self, chrom, pos, FastaFile fafile, bytes refbase):             # <<<<<<<<<<<<<<
 * 
 *         # make record
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pysamstats.opt.TlenStrand.rec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rec);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_10TlenStrand_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pysamstats_3opt_10TlenStrand_4__reduce_cython__[] = "TlenStrand.__reduce_cython__(self)";
static PyObject *__pyx_pw_10pysamstats_3opt_10TlenStrand_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_10TlenStrand_4__reduce_cython__(((struct __pyx_obj_10pysamstats_3opt_TlenStrand *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pysamstats_3opt_10TlenStrand_4__reduce_cython__(struct __pyx_obj_10pysamstats_3opt_TlenStrand *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  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;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self.reads_all, self.reads_fwd, self.reads_rev, self.tlen, self.tlen_fwd, self.tlen_pp, self.tlen_pp_fwd, self.tlen_pp_rev, self.tlen_rev)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->reads_all); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->reads_fwd); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_self->reads_rev); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(9); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->tlen));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->tlen));
  PyTuple_SET_ITEM(__pyx_t_4, 3, ((PyObject *)__pyx_v_self->tlen));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->tlen_fwd));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->tlen_fwd));
  PyTuple_SET_ITEM(__pyx_t_4, 4, ((PyObject *)__pyx_v_self->tlen_fwd));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->tlen_pp));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->tlen_pp));
  PyTuple_SET_ITEM(__pyx_t_4, 5, ((PyObject *)__pyx_v_self->tlen_pp));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->tlen_pp_fwd));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->tlen_pp_fwd));
  PyTuple_SET_ITEM(__pyx_t_4, 6, ((PyObject *)__pyx_v_self->tlen_pp_fwd));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->tlen_pp_rev));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->tlen_pp_rev));
  PyTuple_SET_ITEM(__pyx_t_4, 7, ((PyObject *)__pyx_v_self->tlen_pp_rev));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->tlen_rev));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->tlen_rev));
  PyTuple_SET_ITEM(__pyx_t_4, 8, ((PyObject *)__pyx_v_self->tlen_rev));
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_v_state = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self.reads_all, self.reads_fwd, self.reads_rev, self.tlen, self.tlen_fwd, self.tlen_pp, self.tlen_pp_fwd, self.tlen_pp_rev, self.tlen_rev)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         state += (_dict,)
 */
  __pyx_t_4 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v__dict = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "(tree fragment)":7
 *     state = (self.reads_all, self.reads_fwd, self.reads_rev, self.tlen, self.tlen_fwd, self.tlen_pp, self.tlen_pp_fwd, self.tlen_pp_rev, self.tlen_rev)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
  __pyx_t_5 = (__pyx_v__dict != Py_None);
  __pyx_t_6 = (__pyx_t_5 != 0);
  if (__pyx_t_6) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
 */
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v__dict);
    __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "(tree fragment)":9
 *     if _dict is not None:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = self.tlen is not None or self.tlen_fwd is not None or self.tlen_pp is not None or self.tlen_pp_fwd is not None or self.tlen_pp_rev is not None or self.tlen_rev is not None
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = (self.reads_all, self.reads_fwd, self.reads_rev, self.tlen, self.tlen_fwd, self.tlen_pp, self.tlen_pp_fwd, self.tlen_pp_rev, self.tlen_rev)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
    goto __pyx_L3;
  }

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = self.tlen is not None or self.tlen_fwd is not None or self.tlen_pp is not None or self.tlen_pp_fwd is not None or self.tlen_pp_rev is not None or self.tlen_rev is not None             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_TlenStrand, (type(self), 0x6319d44, None), state
 */
  /*else*/ {
    __pyx_t_5 = (((PyObject *)__pyx_v_self->tlen) != Py_None);
    __pyx_t_7 = (__pyx_t_5 != 0);
    if (!__pyx_t_7) {
    } else {
      __pyx_t_6 = __pyx_t_7;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_7 = (((PyObject *)__pyx_v_self->tlen_fwd) != Py_None);
    __pyx_t_5 = (__pyx_t_7 != 0);
    if (!__pyx_t_5) {
    } else {
      __pyx_t_6 = __pyx_t_5;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_5 = (((PyObject *)__pyx_v_self->tlen_pp) != Py_None);
    __pyx_t_7 = (__pyx_t_5 != 0);
    if (!__pyx_t_7) {
    } else {
      __pyx_t_6 = __pyx_t_7;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_7 = (((PyObject *)__pyx_v_self->tlen_pp_fwd) != Py_None);
    __pyx_t_5 = (__pyx_t_7 != 0);
    if (!__pyx_t_5) {
    } else {
      __pyx_t_6 = __pyx_t_5;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_5 = (((PyObject *)__pyx_v_self->tlen_pp_rev) != Py_None);
    __pyx_t_7 = (__pyx_t_5 != 0);
    if (!__pyx_t_7) {
    } else {
      __pyx_t_6 = __pyx_t_7;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_7 = (((PyObject *)__pyx_v_self->tlen_rev) != Py_None);
    __pyx_t_5 = (__pyx_t_7 != 0);
    __pyx_t_6 = __pyx_t_5;
    __pyx_L4_bool_binop_done:;
    __pyx_v_use_setstate = __pyx_t_6;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.tlen is not None or self.tlen_fwd is not None or self.tlen_pp is not None or self.tlen_pp_fwd is not None or self.tlen_pp_rev is not None or self.tlen_rev is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_TlenStrand, (type(self), 0x6319d44, None), state
 *     else:
 */
  __pyx_t_6 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_6) {

    /* "(tree fragment)":13
 *         use_setstate = self.tlen is not None or self.tlen_fwd is not None or self.tlen_pp is not None or self.tlen_pp_fwd is not None or self.tlen_pp_rev is not None or self.tlen_rev is not None
 *     if use_setstate:
 *         return __pyx_unpickle_TlenStrand, (type(self), 0x6319d44, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_TlenStrand, (type(self), 0x6319d44, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pyx_unpickle_TlenStrand); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_103914820);
    __Pyx_GIVEREF(__pyx_int_103914820);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_103914820);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_4, 2, Py_None);
    __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_state);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.tlen is not None or self.tlen_fwd is not None or self.tlen_pp is not None or self.tlen_pp_fwd is not None or self.tlen_pp_rev is not None or self.tlen_rev is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_TlenStrand, (type(self), 0x6319d44, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_TlenStrand, (type(self), 0x6319d44, None), state
 *     else:
 *         return __pyx_unpickle_TlenStrand, (type(self), 0x6319d44, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_TlenStrand__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pyx_unpickle_TlenStrand); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_103914820);
    __Pyx_GIVEREF(__pyx_int_103914820);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_103914820);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_state);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4);
    __pyx_t_2 = 0;
    __pyx_t_4 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pysamstats.opt.TlenStrand.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_TlenStrand, (type(self), 0x6319d44, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_TlenStrand__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_10TlenStrand_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_10pysamstats_3opt_10TlenStrand_6__setstate_cython__[] = "TlenStrand.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_10pysamstats_3opt_10TlenStrand_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_10TlenStrand_6__setstate_cython__(((struct __pyx_obj_10pysamstats_3opt_TlenStrand *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_10pysamstats_3opt_10TlenStrand_6__setstate_cython__(struct __pyx_obj_10pysamstats_3opt_TlenStrand *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_TlenStrand, (type(self), 0x6319d44, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_TlenStrand__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
 */
  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_10pysamstats_3opt___pyx_unpickle_TlenStrand__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_TlenStrand, (type(self), 0x6319d44, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_TlenStrand__set_state(self, __pyx_state)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysamstats.opt.TlenStrand.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":919
 *         uint64_t sqsum
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.reset()
 * 
 */

/* Python wrapper */
static int __pyx_pw_10pysamstats_3opt_10MapqHelper_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_10pysamstats_3opt_10MapqHelper_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
  __pyx_r = __pyx_pf_10pysamstats_3opt_10MapqHelper___init__(((struct __pyx_obj_10pysamstats_3opt_MapqHelper *)__pyx_v_self));

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

static int __pyx_pf_10pysamstats_3opt_10MapqHelper___init__(struct __pyx_obj_10pysamstats_3opt_MapqHelper *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "pysamstats/opt.pyx":920
 * 
 *     def __init__(self):
 *         self.reset()             # <<<<<<<<<<<<<<
 * 
 *     def reset(self):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 920, __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, 920, __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;

  /* "pysamstats/opt.pyx":919
 *         uint64_t sqsum
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.reset()
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysamstats.opt.MapqHelper.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":922
 *         self.reset()
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         self.n = 0
 *         self.nz = 0
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_10MapqHelper_3reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pysamstats_3opt_10MapqHelper_2reset[] = "MapqHelper.reset(self)";
static PyObject *__pyx_pw_10pysamstats_3opt_10MapqHelper_3reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reset (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_10MapqHelper_2reset(((struct __pyx_obj_10pysamstats_3opt_MapqHelper *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pysamstats_3opt_10MapqHelper_2reset(struct __pyx_obj_10pysamstats_3opt_MapqHelper *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reset", 0);

  /* "pysamstats/opt.pyx":923
 * 
 *     def reset(self):
 *         self.n = 0             # <<<<<<<<<<<<<<
 *         self.nz = 0
 *         self.max = 0
 */
  __pyx_v_self->n = 0;

  /* "pysamstats/opt.pyx":924
 *     def reset(self):
 *         self.n = 0
 *         self.nz = 0             # <<<<<<<<<<<<<<
 *         self.max = 0
 *         self.sqsum = 0
 */
  __pyx_v_self->nz = 0;

  /* "pysamstats/opt.pyx":925
 *         self.n = 0
 *         self.nz = 0
 *         self.max = 0             # <<<<<<<<<<<<<<
 *         self.sqsum = 0
 * 
 */
  __pyx_v_self->max = 0;

  /* "pysamstats/opt.pyx":926
 *         self.nz = 0
 *         self.max = 0
 *         self.sqsum = 0             # <<<<<<<<<<<<<<
 * 
 *     cdef void update(self, uint64_t mapq):
 */
  __pyx_v_self->sqsum = 0;

  /* "pysamstats/opt.pyx":922
 *         self.reset()
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         self.n = 0
 *         self.nz = 0
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":928
 *         self.sqsum = 0
 * 
 *     cdef void update(self, uint64_t mapq):             # <<<<<<<<<<<<<<
 *         self.n += 1
 *         if mapq == 0:
 */

static void __pyx_f_10pysamstats_3opt_10MapqHelper_update(struct __pyx_obj_10pysamstats_3opt_MapqHelper *__pyx_v_self, uint64_t __pyx_v_mapq) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("update", 0);

  /* "pysamstats/opt.pyx":929
 * 
 *     cdef void update(self, uint64_t mapq):
 *         self.n += 1             # <<<<<<<<<<<<<<
 *         if mapq == 0:
 *             self.nz += 1
 */
  __pyx_v_self->n = (__pyx_v_self->n + 1);

  /* "pysamstats/opt.pyx":930
 *     cdef void update(self, uint64_t mapq):
 *         self.n += 1
 *         if mapq == 0:             # <<<<<<<<<<<<<<
 *             self.nz += 1
 *         if mapq > self.max:
 */
  __pyx_t_1 = ((__pyx_v_mapq == 0) != 0);
  if (__pyx_t_1) {

    /* "pysamstats/opt.pyx":931
 *         self.n += 1
 *         if mapq == 0:
 *             self.nz += 1             # <<<<<<<<<<<<<<
 *         if mapq > self.max:
 *             self.max = mapq
 */
    __pyx_v_self->nz = (__pyx_v_self->nz + 1);

    /* "pysamstats/opt.pyx":930
 *     cdef void update(self, uint64_t mapq):
 *         self.n += 1
 *         if mapq == 0:             # <<<<<<<<<<<<<<
 *             self.nz += 1
 *         if mapq > self.max:
 */
  }

  /* "pysamstats/opt.pyx":932
 *         if mapq == 0:
 *             self.nz += 1
 *         if mapq > self.max:             # <<<<<<<<<<<<<<
 *             self.max = mapq
 *         self.sqsum += mapq**2
 */
  __pyx_t_1 = ((__pyx_v_mapq > __pyx_v_self->max) != 0);
  if (__pyx_t_1) {

    /* "pysamstats/opt.pyx":933
 *             self.nz += 1
 *         if mapq > self.max:
 *             self.max = mapq             # <<<<<<<<<<<<<<
 *         self.sqsum += mapq**2
 * 
 */
    __pyx_v_self->max = __pyx_v_mapq;

    /* "pysamstats/opt.pyx":932
 *         if mapq == 0:
 *             self.nz += 1
 *         if mapq > self.max:             # <<<<<<<<<<<<<<
 *             self.max = mapq
 *         self.sqsum += mapq**2
 */
  }

  /* "pysamstats/opt.pyx":934
 *         if mapq > self.max:
 *             self.max = mapq
 *         self.sqsum += mapq**2             # <<<<<<<<<<<<<<
 * 
 *     def rms(self):
 */
  __pyx_v_self->sqsum = (__pyx_v_self->sqsum + __Pyx_pow_uint64_t(__pyx_v_mapq, 2));

  /* "pysamstats/opt.pyx":928
 *         self.sqsum = 0
 * 
 *     cdef void update(self, uint64_t mapq):             # <<<<<<<<<<<<<<
 *         self.n += 1
 *         if mapq == 0:
 */

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

/* "pysamstats/opt.pyx":936
 *         self.sqsum += mapq**2
 * 
 *     def rms(self):             # <<<<<<<<<<<<<<
 *         return rootmean(self.sqsum, self.n)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_10MapqHelper_5rms(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pysamstats_3opt_10MapqHelper_4rms[] = "MapqHelper.rms(self)";
static PyObject *__pyx_pw_10pysamstats_3opt_10MapqHelper_5rms(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rms (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_10MapqHelper_4rms(((struct __pyx_obj_10pysamstats_3opt_MapqHelper *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pysamstats_3opt_10MapqHelper_4rms(struct __pyx_obj_10pysamstats_3opt_MapqHelper *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("rms", 0);

  /* "pysamstats/opt.pyx":937
 * 
 *     def rms(self):
 *         return rootmean(self.sqsum, self.n)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_rootmean); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 937, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_uint64_t(__pyx_v_self->sqsum); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 937, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_self->n); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 937, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 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_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_3, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 937, __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_4); __pyx_t_4 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_3, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 937, __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_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 937, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_4);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 937, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pysamstats/opt.pyx":936
 *         self.sqsum += mapq**2
 * 
 *     def rms(self):             # <<<<<<<<<<<<<<
 *         return rootmean(self.sqsum, self.n)
 * 
 */

  /* 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_7);
  __Pyx_AddTraceback("pysamstats.opt.MapqHelper.rms", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_10MapqHelper_7__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pysamstats_3opt_10MapqHelper_6__reduce_cython__[] = "MapqHelper.__reduce_cython__(self)";
static PyObject *__pyx_pw_10pysamstats_3opt_10MapqHelper_7__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_10MapqHelper_6__reduce_cython__(((struct __pyx_obj_10pysamstats_3opt_MapqHelper *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pysamstats_3opt_10MapqHelper_6__reduce_cython__(struct __pyx_obj_10pysamstats_3opt_MapqHelper *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self.max, self.n, self.nz, self.sqsum)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __pyx_t_1 = __Pyx_PyInt_From_uint64_t(__pyx_v_self->max); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->n); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_self->nz); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyInt_From_uint64_t(__pyx_v_self->sqsum); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_v_state = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self.max, self.n, self.nz, self.sqsum)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         state += (_dict,)
 */
  __pyx_t_5 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_v__dict = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "(tree fragment)":7
 *     state = (self.max, self.n, self.nz, self.sqsum)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
  __pyx_t_6 = (__pyx_v__dict != Py_None);
  __pyx_t_7 = (__pyx_t_6 != 0);
  if (__pyx_t_7) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
 */
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v__dict);
    __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "(tree fragment)":9
 *     if _dict is not None:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = False
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = (self.max, self.n, self.nz, self.sqsum)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
    goto __pyx_L3;
  }

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = False             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_MapqHelper, (type(self), 0x2b98d68, None), state
 */
  /*else*/ {
    __pyx_v_use_setstate = 0;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_MapqHelper, (type(self), 0x2b98d68, None), state
 *     else:
 */
  __pyx_t_7 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_7) {

    /* "(tree fragment)":13
 *         use_setstate = False
 *     if use_setstate:
 *         return __pyx_unpickle_MapqHelper, (type(self), 0x2b98d68, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_MapqHelper, (type(self), 0x2b98d68, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_MapqHelper); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_45714792);
    __Pyx_GIVEREF(__pyx_int_45714792);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_int_45714792);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_5, 2, Py_None);
    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_state);
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_MapqHelper, (type(self), 0x2b98d68, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_MapqHelper, (type(self), 0x2b98d68, None), state
 *     else:
 *         return __pyx_unpickle_MapqHelper, (type(self), 0x2b98d68, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_MapqHelper__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pyx_unpickle_MapqHelper); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_45714792);
    __Pyx_GIVEREF(__pyx_int_45714792);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_int_45714792);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5);
    __pyx_t_3 = 0;
    __pyx_t_5 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pysamstats.opt.MapqHelper.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_MapqHelper, (type(self), 0x2b98d68, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_MapqHelper__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_10MapqHelper_9__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_10pysamstats_3opt_10MapqHelper_8__setstate_cython__[] = "MapqHelper.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_10pysamstats_3opt_10MapqHelper_9__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_10MapqHelper_8__setstate_cython__(((struct __pyx_obj_10pysamstats_3opt_MapqHelper *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_10pysamstats_3opt_10MapqHelper_8__setstate_cython__(struct __pyx_obj_10pysamstats_3opt_MapqHelper *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_MapqHelper, (type(self), 0x2b98d68, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_MapqHelper__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
 */
  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_10pysamstats_3opt___pyx_unpickle_MapqHelper__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_MapqHelper, (type(self), 0x2b98d68, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_MapqHelper__set_state(self, __pyx_state)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysamstats.opt.MapqHelper.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":947
 *         MapqHelper pp
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.all = MapqHelper()
 *         self.pp = MapqHelper()
 */

/* Python wrapper */
static int __pyx_pw_10pysamstats_3opt_4Mapq_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_10pysamstats_3opt_4Mapq_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
  __pyx_r = __pyx_pf_10pysamstats_3opt_4Mapq___init__(((struct __pyx_obj_10pysamstats_3opt_Mapq *)__pyx_v_self));

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

static int __pyx_pf_10pysamstats_3opt_4Mapq___init__(struct __pyx_obj_10pysamstats_3opt_Mapq *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "pysamstats/opt.pyx":948
 * 
 *     def __init__(self):
 *         self.all = MapqHelper()             # <<<<<<<<<<<<<<
 *         self.pp = MapqHelper()
 *         self.reset()
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_MapqHelper)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 948, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->all);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->all));
  __pyx_v_self->all = ((struct __pyx_obj_10pysamstats_3opt_MapqHelper *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":949
 *     def __init__(self):
 *         self.all = MapqHelper()
 *         self.pp = MapqHelper()             # <<<<<<<<<<<<<<
 *         self.reset()
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_MapqHelper)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 949, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->pp);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->pp));
  __pyx_v_self->pp = ((struct __pyx_obj_10pysamstats_3opt_MapqHelper *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":950
 *         self.all = MapqHelper()
 *         self.pp = MapqHelper()
 *         self.reset()             # <<<<<<<<<<<<<<
 * 
 *     def reset(self):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 950, __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, 950, __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;

  /* "pysamstats/opt.pyx":947
 *         MapqHelper pp
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.all = MapqHelper()
 *         self.pp = MapqHelper()
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysamstats.opt.Mapq.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":952
 *         self.reset()
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         self.all.reset()
 *         self.pp.reset()
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_4Mapq_3reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pysamstats_3opt_4Mapq_2reset[] = "Mapq.reset(self)";
static PyObject *__pyx_pw_10pysamstats_3opt_4Mapq_3reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reset (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_4Mapq_2reset(((struct __pyx_obj_10pysamstats_3opt_Mapq *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pysamstats_3opt_4Mapq_2reset(struct __pyx_obj_10pysamstats_3opt_Mapq *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("reset", 0);

  /* "pysamstats/opt.pyx":953
 * 
 *     def reset(self):
 *         self.all.reset()             # <<<<<<<<<<<<<<
 *         self.pp.reset()
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->all), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 953, __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, 953, __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;

  /* "pysamstats/opt.pyx":954
 *     def reset(self):
 *         self.all.reset()
 *         self.pp.reset()             # <<<<<<<<<<<<<<
 * 
 *     cdef void recv(self, bam_pileup1_t* read, PileupColumn col, bytes refbase):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->pp), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 954, __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, 954, __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;

  /* "pysamstats/opt.pyx":952
 *         self.reset()
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         self.all.reset()
 *         self.pp.reset()
 */

  /* 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_AddTraceback("pysamstats.opt.Mapq.reset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":956
 *         self.pp.reset()
 * 
 *     cdef void recv(self, bam_pileup1_t* read, PileupColumn col, bytes refbase):             # <<<<<<<<<<<<<<
 *         cdef:
 *             uint32_t flag
 */

static void __pyx_f_10pysamstats_3opt_4Mapq_recv(struct __pyx_obj_10pysamstats_3opt_Mapq *__pyx_v_self, bam_pileup1_t *__pyx_v_read, CYTHON_UNUSED struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn *__pyx_v_col, CYTHON_UNUSED PyObject *__pyx_v_refbase) {
  uint32_t __pyx_v_flag;
  int __pyx_v_is_proper_pair;
  uint64_t __pyx_v_mapq;
  __Pyx_RefNannyDeclarations
  uint16_t __pyx_t_1;
  uint8_t __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("recv", 0);

  /* "pysamstats/opt.pyx":964
 * 
 *         # convenience variables
 *         flag = read.b.core.flag             # <<<<<<<<<<<<<<
 *         is_proper_pair = <bint>(flag & BAM_FPROPER_PAIR)
 * 
 */
  __pyx_t_1 = __pyx_v_read->b->core.flag;
  __pyx_v_flag = __pyx_t_1;

  /* "pysamstats/opt.pyx":965
 *         # convenience variables
 *         flag = read.b.core.flag
 *         is_proper_pair = <bint>(flag & BAM_FPROPER_PAIR)             # <<<<<<<<<<<<<<
 * 
 *         # do the counting
 */
  __pyx_v_is_proper_pair = ((__pyx_v_flag & 2) != 0);

  /* "pysamstats/opt.pyx":968
 * 
 *         # do the counting
 *         mapq = read.b.core.qual             # <<<<<<<<<<<<<<
 *         self.all.update(mapq)
 *         if is_proper_pair:
 */
  __pyx_t_2 = __pyx_v_read->b->core.qual;
  __pyx_v_mapq = __pyx_t_2;

  /* "pysamstats/opt.pyx":969
 *         # do the counting
 *         mapq = read.b.core.qual
 *         self.all.update(mapq)             # <<<<<<<<<<<<<<
 *         if is_proper_pair:
 *             self.pp.update(mapq)
 */
  ((struct __pyx_vtabstruct_10pysamstats_3opt_MapqHelper *)__pyx_v_self->all->__pyx_vtab)->update(__pyx_v_self->all, __pyx_v_mapq);

  /* "pysamstats/opt.pyx":970
 *         mapq = read.b.core.qual
 *         self.all.update(mapq)
 *         if is_proper_pair:             # <<<<<<<<<<<<<<
 *             self.pp.update(mapq)
 * 
 */
  __pyx_t_3 = (__pyx_v_is_proper_pair != 0);
  if (__pyx_t_3) {

    /* "pysamstats/opt.pyx":971
 *         self.all.update(mapq)
 *         if is_proper_pair:
 *             self.pp.update(mapq)             # <<<<<<<<<<<<<<
 * 
 *     cdef dict rec(self, chrom, pos, FastaFile fafile, bytes refbase):
 */
    ((struct __pyx_vtabstruct_10pysamstats_3opt_MapqHelper *)__pyx_v_self->pp->__pyx_vtab)->update(__pyx_v_self->pp, __pyx_v_mapq);

    /* "pysamstats/opt.pyx":970
 *         mapq = read.b.core.qual
 *         self.all.update(mapq)
 *         if is_proper_pair:             # <<<<<<<<<<<<<<
 *             self.pp.update(mapq)
 * 
 */
  }

  /* "pysamstats/opt.pyx":956
 *         self.pp.reset()
 * 
 *     cdef void recv(self, bam_pileup1_t* read, PileupColumn col, bytes refbase):             # <<<<<<<<<<<<<<
 *         cdef:
 *             uint32_t flag
 */

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

/* "pysamstats/opt.pyx":973
 *             self.pp.update(mapq)
 * 
 *     cdef dict rec(self, chrom, pos, FastaFile fafile, bytes refbase):             # <<<<<<<<<<<<<<
 * 
 *         # make record
 */

static PyObject *__pyx_f_10pysamstats_3opt_4Mapq_rec(struct __pyx_obj_10pysamstats_3opt_Mapq *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_chrom, CYTHON_UNUSED PyObject *__pyx_v_pos, CYTHON_UNUSED struct __pyx_obj_5pysam_9libcfaidx_FastaFile *__pyx_v_fafile, CYTHON_UNUSED PyObject *__pyx_v_refbase) {
  PyObject *__pyx_v_rec = 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;
  __Pyx_RefNannySetupContext("rec", 0);

  /* "pysamstats/opt.pyx":976
 * 
 *         # make record
 *         rec = {'reads_all': self.all.n,             # <<<<<<<<<<<<<<
 *                'reads_pp': self.pp.n,
 *                'reads_mapq0': self.all.nz,
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 976, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->all->n); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 976, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_all, __pyx_t_2) < 0) __PYX_ERR(0, 976, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":977
 *         # make record
 *         rec = {'reads_all': self.all.n,
 *                'reads_pp': self.pp.n,             # <<<<<<<<<<<<<<
 *                'reads_mapq0': self.all.nz,
 *                'reads_mapq0_pp': self.pp.nz,
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->pp->n); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 977, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_pp, __pyx_t_2) < 0) __PYX_ERR(0, 976, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":978
 *         rec = {'reads_all': self.all.n,
 *                'reads_pp': self.pp.n,
 *                'reads_mapq0': self.all.nz,             # <<<<<<<<<<<<<<
 *                'reads_mapq0_pp': self.pp.nz,
 *                'rms_mapq': self.all.rms(),
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->all->nz); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 978, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_mapq0, __pyx_t_2) < 0) __PYX_ERR(0, 976, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":979
 *                'reads_pp': self.pp.n,
 *                'reads_mapq0': self.all.nz,
 *                'reads_mapq0_pp': self.pp.nz,             # <<<<<<<<<<<<<<
 *                'rms_mapq': self.all.rms(),
 *                'rms_mapq_pp': self.pp.rms(),
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->pp->nz); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 979, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_mapq0_pp, __pyx_t_2) < 0) __PYX_ERR(0, 976, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":980
 *                'reads_mapq0': self.all.nz,
 *                'reads_mapq0_pp': self.pp.nz,
 *                'rms_mapq': self.all.rms(),             # <<<<<<<<<<<<<<
 *                'rms_mapq_pp': self.pp.rms(),
 *                'max_mapq': self.all.max,
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->all), __pyx_n_s_rms); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 980, __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_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 980, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_rms_mapq, __pyx_t_2) < 0) __PYX_ERR(0, 976, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":981
 *                'reads_mapq0_pp': self.pp.nz,
 *                'rms_mapq': self.all.rms(),
 *                'rms_mapq_pp': self.pp.rms(),             # <<<<<<<<<<<<<<
 *                'max_mapq': self.all.max,
 *                'max_mapq_pp': self.pp.max}
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->pp), __pyx_n_s_rms); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 981, __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_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 981, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_rms_mapq_pp, __pyx_t_2) < 0) __PYX_ERR(0, 976, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":982
 *                'rms_mapq': self.all.rms(),
 *                'rms_mapq_pp': self.pp.rms(),
 *                'max_mapq': self.all.max,             # <<<<<<<<<<<<<<
 *                'max_mapq_pp': self.pp.max}
 * 
 */
  __pyx_t_2 = __Pyx_PyInt_From_uint64_t(__pyx_v_self->all->max); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 982, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_max_mapq, __pyx_t_2) < 0) __PYX_ERR(0, 976, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":983
 *                'rms_mapq_pp': self.pp.rms(),
 *                'max_mapq': self.all.max,
 *                'max_mapq_pp': self.pp.max}             # <<<<<<<<<<<<<<
 * 
 *         # reset counters
 */
  __pyx_t_2 = __Pyx_PyInt_From_uint64_t(__pyx_v_self->pp->max); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 983, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_max_mapq_pp, __pyx_t_2) < 0) __PYX_ERR(0, 976, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_rec = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":986
 * 
 *         # reset counters
 *         self.reset()             # <<<<<<<<<<<<<<
 * 
 *         return rec
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 986, __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, 986, __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;

  /* "pysamstats/opt.pyx":988
 *         self.reset()
 * 
 *         return rec             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_rec);
  __pyx_r = __pyx_v_rec;
  goto __pyx_L0;

  /* "pysamstats/opt.pyx":973
 *             self.pp.update(mapq)
 * 
 *     cdef dict rec(self, chrom, pos, FastaFile fafile, bytes refbase):             # <<<<<<<<<<<<<<
 * 
 *         # make record
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pysamstats.opt.Mapq.rec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rec);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_4Mapq_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pysamstats_3opt_4Mapq_4__reduce_cython__[] = "Mapq.__reduce_cython__(self)";
static PyObject *__pyx_pw_10pysamstats_3opt_4Mapq_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_4Mapq_4__reduce_cython__(((struct __pyx_obj_10pysamstats_3opt_Mapq *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pysamstats_3opt_4Mapq_4__reduce_cython__(struct __pyx_obj_10pysamstats_3opt_Mapq *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self.all, self.pp)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->all));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->all));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self->all));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->pp));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->pp));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self->pp));
  __pyx_v_state = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self.all, self.pp)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         state += (_dict,)
 */
  __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__dict = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":7
 *     state = (self.all, self.pp)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
  __pyx_t_2 = (__pyx_v__dict != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
 */
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
    __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "(tree fragment)":9
 *     if _dict is not None:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = self.all is not None or self.pp is not None
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = (self.all, self.pp)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
    goto __pyx_L3;
  }

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = self.all is not None or self.pp is not None             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_Mapq, (type(self), 0x145977c, None), state
 */
  /*else*/ {
    __pyx_t_2 = (((PyObject *)__pyx_v_self->all) != Py_None);
    __pyx_t_5 = (__pyx_t_2 != 0);
    if (!__pyx_t_5) {
    } else {
      __pyx_t_3 = __pyx_t_5;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_5 = (((PyObject *)__pyx_v_self->pp) != Py_None);
    __pyx_t_2 = (__pyx_t_5 != 0);
    __pyx_t_3 = __pyx_t_2;
    __pyx_L4_bool_binop_done:;
    __pyx_v_use_setstate = __pyx_t_3;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.all is not None or self.pp is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_Mapq, (type(self), 0x145977c, None), state
 *     else:
 */
  __pyx_t_3 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":13
 *         use_setstate = self.all is not None or self.pp is not None
 *     if use_setstate:
 *         return __pyx_unpickle_Mapq, (type(self), 0x145977c, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_Mapq, (type(self), 0x145977c, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_Mapq); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_21337980);
    __Pyx_GIVEREF(__pyx_int_21337980);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_21337980);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
    __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_state);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.all is not None or self.pp is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_Mapq, (type(self), 0x145977c, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_Mapq, (type(self), 0x145977c, None), state
 *     else:
 *         return __pyx_unpickle_Mapq, (type(self), 0x145977c, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_Mapq__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_pyx_unpickle_Mapq); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_21337980);
    __Pyx_GIVEREF(__pyx_int_21337980);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_21337980);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
    __pyx_t_6 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pysamstats.opt.Mapq.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_Mapq, (type(self), 0x145977c, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_Mapq__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_4Mapq_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_10pysamstats_3opt_4Mapq_6__setstate_cython__[] = "Mapq.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_10pysamstats_3opt_4Mapq_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_4Mapq_6__setstate_cython__(((struct __pyx_obj_10pysamstats_3opt_Mapq *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_10pysamstats_3opt_4Mapq_6__setstate_cython__(struct __pyx_obj_10pysamstats_3opt_Mapq *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_Mapq, (type(self), 0x145977c, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_Mapq__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
 */
  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_10pysamstats_3opt___pyx_unpickle_Mapq__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_Mapq, (type(self), 0x145977c, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_Mapq__set_state(self, __pyx_state)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysamstats.opt.Mapq.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":1007
 *         MapqHelper pp_rev
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.all = MapqHelper()
 *         self.fwd = MapqHelper()
 */

/* Python wrapper */
static int __pyx_pw_10pysamstats_3opt_10MapqStrand_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_10pysamstats_3opt_10MapqStrand_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
  __pyx_r = __pyx_pf_10pysamstats_3opt_10MapqStrand___init__(((struct __pyx_obj_10pysamstats_3opt_MapqStrand *)__pyx_v_self));

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

static int __pyx_pf_10pysamstats_3opt_10MapqStrand___init__(struct __pyx_obj_10pysamstats_3opt_MapqStrand *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "pysamstats/opt.pyx":1008
 * 
 *     def __init__(self):
 *         self.all = MapqHelper()             # <<<<<<<<<<<<<<
 *         self.fwd = MapqHelper()
 *         self.rev = MapqHelper()
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_MapqHelper)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1008, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->all);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->all));
  __pyx_v_self->all = ((struct __pyx_obj_10pysamstats_3opt_MapqHelper *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1009
 *     def __init__(self):
 *         self.all = MapqHelper()
 *         self.fwd = MapqHelper()             # <<<<<<<<<<<<<<
 *         self.rev = MapqHelper()
 *         self.pp = MapqHelper()
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_MapqHelper)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1009, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->fwd);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->fwd));
  __pyx_v_self->fwd = ((struct __pyx_obj_10pysamstats_3opt_MapqHelper *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1010
 *         self.all = MapqHelper()
 *         self.fwd = MapqHelper()
 *         self.rev = MapqHelper()             # <<<<<<<<<<<<<<
 *         self.pp = MapqHelper()
 *         self.pp_fwd = MapqHelper()
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_MapqHelper)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1010, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->rev);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->rev));
  __pyx_v_self->rev = ((struct __pyx_obj_10pysamstats_3opt_MapqHelper *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1011
 *         self.fwd = MapqHelper()
 *         self.rev = MapqHelper()
 *         self.pp = MapqHelper()             # <<<<<<<<<<<<<<
 *         self.pp_fwd = MapqHelper()
 *         self.pp_rev = MapqHelper()
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_MapqHelper)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1011, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->pp);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->pp));
  __pyx_v_self->pp = ((struct __pyx_obj_10pysamstats_3opt_MapqHelper *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1012
 *         self.rev = MapqHelper()
 *         self.pp = MapqHelper()
 *         self.pp_fwd = MapqHelper()             # <<<<<<<<<<<<<<
 *         self.pp_rev = MapqHelper()
 *         self.reset()
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_MapqHelper)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1012, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->pp_fwd);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->pp_fwd));
  __pyx_v_self->pp_fwd = ((struct __pyx_obj_10pysamstats_3opt_MapqHelper *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1013
 *         self.pp = MapqHelper()
 *         self.pp_fwd = MapqHelper()
 *         self.pp_rev = MapqHelper()             # <<<<<<<<<<<<<<
 *         self.reset()
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_MapqHelper)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1013, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->pp_rev);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->pp_rev));
  __pyx_v_self->pp_rev = ((struct __pyx_obj_10pysamstats_3opt_MapqHelper *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1014
 *         self.pp_fwd = MapqHelper()
 *         self.pp_rev = MapqHelper()
 *         self.reset()             # <<<<<<<<<<<<<<
 * 
 *     def reset(self):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1014, __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, 1014, __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;

  /* "pysamstats/opt.pyx":1007
 *         MapqHelper pp_rev
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.all = MapqHelper()
 *         self.fwd = MapqHelper()
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysamstats.opt.MapqStrand.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":1016
 *         self.reset()
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         self.all.reset()
 *         self.fwd.reset()
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_10MapqStrand_3reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pysamstats_3opt_10MapqStrand_2reset[] = "MapqStrand.reset(self)";
static PyObject *__pyx_pw_10pysamstats_3opt_10MapqStrand_3reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reset (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_10MapqStrand_2reset(((struct __pyx_obj_10pysamstats_3opt_MapqStrand *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pysamstats_3opt_10MapqStrand_2reset(struct __pyx_obj_10pysamstats_3opt_MapqStrand *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("reset", 0);

  /* "pysamstats/opt.pyx":1017
 * 
 *     def reset(self):
 *         self.all.reset()             # <<<<<<<<<<<<<<
 *         self.fwd.reset()
 *         self.rev.reset()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->all), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1017, __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, 1017, __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;

  /* "pysamstats/opt.pyx":1018
 *     def reset(self):
 *         self.all.reset()
 *         self.fwd.reset()             # <<<<<<<<<<<<<<
 *         self.rev.reset()
 *         self.pp.reset()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->fwd), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1018, __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, 1018, __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;

  /* "pysamstats/opt.pyx":1019
 *         self.all.reset()
 *         self.fwd.reset()
 *         self.rev.reset()             # <<<<<<<<<<<<<<
 *         self.pp.reset()
 *         self.pp_fwd.reset()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->rev), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1019, __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, 1019, __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;

  /* "pysamstats/opt.pyx":1020
 *         self.fwd.reset()
 *         self.rev.reset()
 *         self.pp.reset()             # <<<<<<<<<<<<<<
 *         self.pp_fwd.reset()
 *         self.pp_rev.reset()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->pp), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1020, __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, 1020, __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;

  /* "pysamstats/opt.pyx":1021
 *         self.rev.reset()
 *         self.pp.reset()
 *         self.pp_fwd.reset()             # <<<<<<<<<<<<<<
 *         self.pp_rev.reset()
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->pp_fwd), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1021, __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, 1021, __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;

  /* "pysamstats/opt.pyx":1022
 *         self.pp.reset()
 *         self.pp_fwd.reset()
 *         self.pp_rev.reset()             # <<<<<<<<<<<<<<
 * 
 *     cdef void recv(self, bam_pileup1_t* read, PileupColumn col, bytes refbase):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->pp_rev), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1022, __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, 1022, __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;

  /* "pysamstats/opt.pyx":1016
 *         self.reset()
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         self.all.reset()
 *         self.fwd.reset()
 */

  /* 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_AddTraceback("pysamstats.opt.MapqStrand.reset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":1024
 *         self.pp_rev.reset()
 * 
 *     cdef void recv(self, bam_pileup1_t* read, PileupColumn col, bytes refbase):             # <<<<<<<<<<<<<<
 *         cdef:
 *             uint32_t flag
 */

static void __pyx_f_10pysamstats_3opt_10MapqStrand_recv(struct __pyx_obj_10pysamstats_3opt_MapqStrand *__pyx_v_self, bam_pileup1_t *__pyx_v_read, CYTHON_UNUSED struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn *__pyx_v_col, CYTHON_UNUSED PyObject *__pyx_v_refbase) {
  uint32_t __pyx_v_flag;
  int __pyx_v_is_proper_pair;
  int __pyx_v_is_reverse;
  uint64_t __pyx_v_mapq;
  __Pyx_RefNannyDeclarations
  uint16_t __pyx_t_1;
  uint8_t __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("recv", 0);

  /* "pysamstats/opt.pyx":1033
 * 
 *         # convenience variables
 *         flag = read.b.core.flag             # <<<<<<<<<<<<<<
 *         is_proper_pair = <bint>(flag & BAM_FPROPER_PAIR)
 *         is_reverse = <bint>(flag & BAM_FREVERSE)
 */
  __pyx_t_1 = __pyx_v_read->b->core.flag;
  __pyx_v_flag = __pyx_t_1;

  /* "pysamstats/opt.pyx":1034
 *         # convenience variables
 *         flag = read.b.core.flag
 *         is_proper_pair = <bint>(flag & BAM_FPROPER_PAIR)             # <<<<<<<<<<<<<<
 *         is_reverse = <bint>(flag & BAM_FREVERSE)
 * 
 */
  __pyx_v_is_proper_pair = ((__pyx_v_flag & 2) != 0);

  /* "pysamstats/opt.pyx":1035
 *         flag = read.b.core.flag
 *         is_proper_pair = <bint>(flag & BAM_FPROPER_PAIR)
 *         is_reverse = <bint>(flag & BAM_FREVERSE)             # <<<<<<<<<<<<<<
 * 
 *         # do the counting
 */
  __pyx_v_is_reverse = ((__pyx_v_flag & 16) != 0);

  /* "pysamstats/opt.pyx":1038
 * 
 *         # do the counting
 *         mapq = read.b.core.qual             # <<<<<<<<<<<<<<
 *         self.all.update(mapq)
 *         if is_reverse:
 */
  __pyx_t_2 = __pyx_v_read->b->core.qual;
  __pyx_v_mapq = __pyx_t_2;

  /* "pysamstats/opt.pyx":1039
 *         # do the counting
 *         mapq = read.b.core.qual
 *         self.all.update(mapq)             # <<<<<<<<<<<<<<
 *         if is_reverse:
 *             self.rev.update(mapq)
 */
  ((struct __pyx_vtabstruct_10pysamstats_3opt_MapqHelper *)__pyx_v_self->all->__pyx_vtab)->update(__pyx_v_self->all, __pyx_v_mapq);

  /* "pysamstats/opt.pyx":1040
 *         mapq = read.b.core.qual
 *         self.all.update(mapq)
 *         if is_reverse:             # <<<<<<<<<<<<<<
 *             self.rev.update(mapq)
 *         else:
 */
  __pyx_t_3 = (__pyx_v_is_reverse != 0);
  if (__pyx_t_3) {

    /* "pysamstats/opt.pyx":1041
 *         self.all.update(mapq)
 *         if is_reverse:
 *             self.rev.update(mapq)             # <<<<<<<<<<<<<<
 *         else:
 *             self.fwd.update(mapq)
 */
    ((struct __pyx_vtabstruct_10pysamstats_3opt_MapqHelper *)__pyx_v_self->rev->__pyx_vtab)->update(__pyx_v_self->rev, __pyx_v_mapq);

    /* "pysamstats/opt.pyx":1040
 *         mapq = read.b.core.qual
 *         self.all.update(mapq)
 *         if is_reverse:             # <<<<<<<<<<<<<<
 *             self.rev.update(mapq)
 *         else:
 */
    goto __pyx_L3;
  }

  /* "pysamstats/opt.pyx":1043
 *             self.rev.update(mapq)
 *         else:
 *             self.fwd.update(mapq)             # <<<<<<<<<<<<<<
 *         if is_proper_pair:
 *             self.pp.update(mapq)
 */
  /*else*/ {
    ((struct __pyx_vtabstruct_10pysamstats_3opt_MapqHelper *)__pyx_v_self->fwd->__pyx_vtab)->update(__pyx_v_self->fwd, __pyx_v_mapq);
  }
  __pyx_L3:;

  /* "pysamstats/opt.pyx":1044
 *         else:
 *             self.fwd.update(mapq)
 *         if is_proper_pair:             # <<<<<<<<<<<<<<
 *             self.pp.update(mapq)
 *             if is_reverse:
 */
  __pyx_t_3 = (__pyx_v_is_proper_pair != 0);
  if (__pyx_t_3) {

    /* "pysamstats/opt.pyx":1045
 *             self.fwd.update(mapq)
 *         if is_proper_pair:
 *             self.pp.update(mapq)             # <<<<<<<<<<<<<<
 *             if is_reverse:
 *                 self.pp_rev.update(mapq)
 */
    ((struct __pyx_vtabstruct_10pysamstats_3opt_MapqHelper *)__pyx_v_self->pp->__pyx_vtab)->update(__pyx_v_self->pp, __pyx_v_mapq);

    /* "pysamstats/opt.pyx":1046
 *         if is_proper_pair:
 *             self.pp.update(mapq)
 *             if is_reverse:             # <<<<<<<<<<<<<<
 *                 self.pp_rev.update(mapq)
 *             else:
 */
    __pyx_t_3 = (__pyx_v_is_reverse != 0);
    if (__pyx_t_3) {

      /* "pysamstats/opt.pyx":1047
 *             self.pp.update(mapq)
 *             if is_reverse:
 *                 self.pp_rev.update(mapq)             # <<<<<<<<<<<<<<
 *             else:
 *                 self.pp_fwd.update(mapq)
 */
      ((struct __pyx_vtabstruct_10pysamstats_3opt_MapqHelper *)__pyx_v_self->pp_rev->__pyx_vtab)->update(__pyx_v_self->pp_rev, __pyx_v_mapq);

      /* "pysamstats/opt.pyx":1046
 *         if is_proper_pair:
 *             self.pp.update(mapq)
 *             if is_reverse:             # <<<<<<<<<<<<<<
 *                 self.pp_rev.update(mapq)
 *             else:
 */
      goto __pyx_L5;
    }

    /* "pysamstats/opt.pyx":1049
 *                 self.pp_rev.update(mapq)
 *             else:
 *                 self.pp_fwd.update(mapq)             # <<<<<<<<<<<<<<
 * 
 *     cdef dict rec(self, chrom, pos, FastaFile fafile, bytes refbase):
 */
    /*else*/ {
      ((struct __pyx_vtabstruct_10pysamstats_3opt_MapqHelper *)__pyx_v_self->pp_fwd->__pyx_vtab)->update(__pyx_v_self->pp_fwd, __pyx_v_mapq);
    }
    __pyx_L5:;

    /* "pysamstats/opt.pyx":1044
 *         else:
 *             self.fwd.update(mapq)
 *         if is_proper_pair:             # <<<<<<<<<<<<<<
 *             self.pp.update(mapq)
 *             if is_reverse:
 */
  }

  /* "pysamstats/opt.pyx":1024
 *         self.pp_rev.reset()
 * 
 *     cdef void recv(self, bam_pileup1_t* read, PileupColumn col, bytes refbase):             # <<<<<<<<<<<<<<
 *         cdef:
 *             uint32_t flag
 */

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

/* "pysamstats/opt.pyx":1051
 *                 self.pp_fwd.update(mapq)
 * 
 *     cdef dict rec(self, chrom, pos, FastaFile fafile, bytes refbase):             # <<<<<<<<<<<<<<
 * 
 *         # make record
 */

static PyObject *__pyx_f_10pysamstats_3opt_10MapqStrand_rec(struct __pyx_obj_10pysamstats_3opt_MapqStrand *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_chrom, CYTHON_UNUSED PyObject *__pyx_v_pos, CYTHON_UNUSED struct __pyx_obj_5pysam_9libcfaidx_FastaFile *__pyx_v_fafile, CYTHON_UNUSED PyObject *__pyx_v_refbase) {
  PyObject *__pyx_v_rec = 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;
  __Pyx_RefNannySetupContext("rec", 0);

  /* "pysamstats/opt.pyx":1055
 *         # make record
 *         rec = {
 *             'reads_all': self.all.n,             # <<<<<<<<<<<<<<
 *             'reads_fwd': self.fwd.n,
 *             'reads_rev': self.rev.n,
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(24); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1055, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->all->n); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1055, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_all, __pyx_t_2) < 0) __PYX_ERR(0, 1055, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":1056
 *         rec = {
 *             'reads_all': self.all.n,
 *             'reads_fwd': self.fwd.n,             # <<<<<<<<<<<<<<
 *             'reads_rev': self.rev.n,
 *             'reads_pp': self.pp.n,
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->fwd->n); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1056, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_fwd, __pyx_t_2) < 0) __PYX_ERR(0, 1055, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":1057
 *             'reads_all': self.all.n,
 *             'reads_fwd': self.fwd.n,
 *             'reads_rev': self.rev.n,             # <<<<<<<<<<<<<<
 *             'reads_pp': self.pp.n,
 *             'reads_pp_fwd': self.pp_fwd.n,
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->rev->n); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1057, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_rev, __pyx_t_2) < 0) __PYX_ERR(0, 1055, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":1058
 *             'reads_fwd': self.fwd.n,
 *             'reads_rev': self.rev.n,
 *             'reads_pp': self.pp.n,             # <<<<<<<<<<<<<<
 *             'reads_pp_fwd': self.pp_fwd.n,
 *             'reads_pp_rev': self.pp_rev.n,
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->pp->n); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1058, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_pp, __pyx_t_2) < 0) __PYX_ERR(0, 1055, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":1059
 *             'reads_rev': self.rev.n,
 *             'reads_pp': self.pp.n,
 *             'reads_pp_fwd': self.pp_fwd.n,             # <<<<<<<<<<<<<<
 *             'reads_pp_rev': self.pp_rev.n,
 *             'reads_mapq0': self.all.nz,
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->pp_fwd->n); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1059, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_pp_fwd, __pyx_t_2) < 0) __PYX_ERR(0, 1055, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":1060
 *             'reads_pp': self.pp.n,
 *             'reads_pp_fwd': self.pp_fwd.n,
 *             'reads_pp_rev': self.pp_rev.n,             # <<<<<<<<<<<<<<
 *             'reads_mapq0': self.all.nz,
 *             'reads_mapq0_fwd': self.fwd.nz,
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->pp_rev->n); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1060, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_pp_rev, __pyx_t_2) < 0) __PYX_ERR(0, 1055, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":1061
 *             'reads_pp_fwd': self.pp_fwd.n,
 *             'reads_pp_rev': self.pp_rev.n,
 *             'reads_mapq0': self.all.nz,             # <<<<<<<<<<<<<<
 *             'reads_mapq0_fwd': self.fwd.nz,
 *             'reads_mapq0_rev': self.rev.nz,
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->all->nz); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1061, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_mapq0, __pyx_t_2) < 0) __PYX_ERR(0, 1055, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":1062
 *             'reads_pp_rev': self.pp_rev.n,
 *             'reads_mapq0': self.all.nz,
 *             'reads_mapq0_fwd': self.fwd.nz,             # <<<<<<<<<<<<<<
 *             'reads_mapq0_rev': self.rev.nz,
 *             'reads_mapq0_pp': self.pp.nz,
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->fwd->nz); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1062, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_mapq0_fwd, __pyx_t_2) < 0) __PYX_ERR(0, 1055, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":1063
 *             'reads_mapq0': self.all.nz,
 *             'reads_mapq0_fwd': self.fwd.nz,
 *             'reads_mapq0_rev': self.rev.nz,             # <<<<<<<<<<<<<<
 *             'reads_mapq0_pp': self.pp.nz,
 *             'reads_mapq0_pp_fwd': self.pp_fwd.nz,
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->rev->nz); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1063, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_mapq0_rev, __pyx_t_2) < 0) __PYX_ERR(0, 1055, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":1064
 *             'reads_mapq0_fwd': self.fwd.nz,
 *             'reads_mapq0_rev': self.rev.nz,
 *             'reads_mapq0_pp': self.pp.nz,             # <<<<<<<<<<<<<<
 *             'reads_mapq0_pp_fwd': self.pp_fwd.nz,
 *             'reads_mapq0_pp_rev': self.pp_rev.nz,
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->pp->nz); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1064, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_mapq0_pp, __pyx_t_2) < 0) __PYX_ERR(0, 1055, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":1065
 *             'reads_mapq0_rev': self.rev.nz,
 *             'reads_mapq0_pp': self.pp.nz,
 *             'reads_mapq0_pp_fwd': self.pp_fwd.nz,             # <<<<<<<<<<<<<<
 *             'reads_mapq0_pp_rev': self.pp_rev.nz,
 *             'rms_mapq': self.all.rms(),
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->pp_fwd->nz); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1065, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_mapq0_pp_fwd, __pyx_t_2) < 0) __PYX_ERR(0, 1055, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":1066
 *             'reads_mapq0_pp': self.pp.nz,
 *             'reads_mapq0_pp_fwd': self.pp_fwd.nz,
 *             'reads_mapq0_pp_rev': self.pp_rev.nz,             # <<<<<<<<<<<<<<
 *             'rms_mapq': self.all.rms(),
 *             'rms_mapq_fwd': self.fwd.rms(),
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->pp_rev->nz); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1066, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_mapq0_pp_rev, __pyx_t_2) < 0) __PYX_ERR(0, 1055, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":1067
 *             'reads_mapq0_pp_fwd': self.pp_fwd.nz,
 *             'reads_mapq0_pp_rev': self.pp_rev.nz,
 *             'rms_mapq': self.all.rms(),             # <<<<<<<<<<<<<<
 *             'rms_mapq_fwd': self.fwd.rms(),
 *             'rms_mapq_rev': self.rev.rms(),
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->all), __pyx_n_s_rms); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1067, __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_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1067, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_rms_mapq, __pyx_t_2) < 0) __PYX_ERR(0, 1055, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":1068
 *             'reads_mapq0_pp_rev': self.pp_rev.nz,
 *             'rms_mapq': self.all.rms(),
 *             'rms_mapq_fwd': self.fwd.rms(),             # <<<<<<<<<<<<<<
 *             'rms_mapq_rev': self.rev.rms(),
 *             'rms_mapq_pp': self.pp.rms(),
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->fwd), __pyx_n_s_rms); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1068, __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_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1068, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_rms_mapq_fwd, __pyx_t_2) < 0) __PYX_ERR(0, 1055, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":1069
 *             'rms_mapq': self.all.rms(),
 *             'rms_mapq_fwd': self.fwd.rms(),
 *             'rms_mapq_rev': self.rev.rms(),             # <<<<<<<<<<<<<<
 *             'rms_mapq_pp': self.pp.rms(),
 *             'rms_mapq_pp_fwd': self.pp_fwd.rms(),
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->rev), __pyx_n_s_rms); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1069, __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_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1069, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_rms_mapq_rev, __pyx_t_2) < 0) __PYX_ERR(0, 1055, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":1070
 *             'rms_mapq_fwd': self.fwd.rms(),
 *             'rms_mapq_rev': self.rev.rms(),
 *             'rms_mapq_pp': self.pp.rms(),             # <<<<<<<<<<<<<<
 *             'rms_mapq_pp_fwd': self.pp_fwd.rms(),
 *             'rms_mapq_pp_rev': self.pp_rev.rms(),
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->pp), __pyx_n_s_rms); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1070, __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_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1070, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_rms_mapq_pp, __pyx_t_2) < 0) __PYX_ERR(0, 1055, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":1071
 *             'rms_mapq_rev': self.rev.rms(),
 *             'rms_mapq_pp': self.pp.rms(),
 *             'rms_mapq_pp_fwd': self.pp_fwd.rms(),             # <<<<<<<<<<<<<<
 *             'rms_mapq_pp_rev': self.pp_rev.rms(),
 *             'max_mapq': self.all.max,
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->pp_fwd), __pyx_n_s_rms); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1071, __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_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1071, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_rms_mapq_pp_fwd, __pyx_t_2) < 0) __PYX_ERR(0, 1055, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":1072
 *             'rms_mapq_pp': self.pp.rms(),
 *             'rms_mapq_pp_fwd': self.pp_fwd.rms(),
 *             'rms_mapq_pp_rev': self.pp_rev.rms(),             # <<<<<<<<<<<<<<
 *             'max_mapq': self.all.max,
 *             'max_mapq_fwd': self.fwd.max,
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->pp_rev), __pyx_n_s_rms); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1072, __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_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1072, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_rms_mapq_pp_rev, __pyx_t_2) < 0) __PYX_ERR(0, 1055, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":1073
 *             'rms_mapq_pp_fwd': self.pp_fwd.rms(),
 *             'rms_mapq_pp_rev': self.pp_rev.rms(),
 *             'max_mapq': self.all.max,             # <<<<<<<<<<<<<<
 *             'max_mapq_fwd': self.fwd.max,
 *             'max_mapq_rev': self.rev.max,
 */
  __pyx_t_2 = __Pyx_PyInt_From_uint64_t(__pyx_v_self->all->max); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1073, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_max_mapq, __pyx_t_2) < 0) __PYX_ERR(0, 1055, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":1074
 *             'rms_mapq_pp_rev': self.pp_rev.rms(),
 *             'max_mapq': self.all.max,
 *             'max_mapq_fwd': self.fwd.max,             # <<<<<<<<<<<<<<
 *             'max_mapq_rev': self.rev.max,
 *             'max_mapq_pp': self.pp.max,
 */
  __pyx_t_2 = __Pyx_PyInt_From_uint64_t(__pyx_v_self->fwd->max); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1074, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_max_mapq_fwd, __pyx_t_2) < 0) __PYX_ERR(0, 1055, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":1075
 *             'max_mapq': self.all.max,
 *             'max_mapq_fwd': self.fwd.max,
 *             'max_mapq_rev': self.rev.max,             # <<<<<<<<<<<<<<
 *             'max_mapq_pp': self.pp.max,
 *             'max_mapq_pp_fwd': self.pp_fwd.max,
 */
  __pyx_t_2 = __Pyx_PyInt_From_uint64_t(__pyx_v_self->rev->max); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1075, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_max_mapq_rev, __pyx_t_2) < 0) __PYX_ERR(0, 1055, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":1076
 *             'max_mapq_fwd': self.fwd.max,
 *             'max_mapq_rev': self.rev.max,
 *             'max_mapq_pp': self.pp.max,             # <<<<<<<<<<<<<<
 *             'max_mapq_pp_fwd': self.pp_fwd.max,
 *             'max_mapq_pp_rev': self.pp_rev.max,
 */
  __pyx_t_2 = __Pyx_PyInt_From_uint64_t(__pyx_v_self->pp->max); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1076, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_max_mapq_pp, __pyx_t_2) < 0) __PYX_ERR(0, 1055, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":1077
 *             'max_mapq_rev': self.rev.max,
 *             'max_mapq_pp': self.pp.max,
 *             'max_mapq_pp_fwd': self.pp_fwd.max,             # <<<<<<<<<<<<<<
 *             'max_mapq_pp_rev': self.pp_rev.max,
 *         }
 */
  __pyx_t_2 = __Pyx_PyInt_From_uint64_t(__pyx_v_self->pp_fwd->max); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1077, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_max_mapq_pp_fwd, __pyx_t_2) < 0) __PYX_ERR(0, 1055, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":1078
 *             'max_mapq_pp': self.pp.max,
 *             'max_mapq_pp_fwd': self.pp_fwd.max,
 *             'max_mapq_pp_rev': self.pp_rev.max,             # <<<<<<<<<<<<<<
 *         }
 * 
 */
  __pyx_t_2 = __Pyx_PyInt_From_uint64_t(__pyx_v_self->pp_rev->max); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1078, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_max_mapq_pp_rev, __pyx_t_2) < 0) __PYX_ERR(0, 1055, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_rec = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1082
 * 
 *         # reset counters
 *         self.reset()             # <<<<<<<<<<<<<<
 * 
 *         return rec
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1082, __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, 1082, __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;

  /* "pysamstats/opt.pyx":1084
 *         self.reset()
 * 
 *         return rec             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_rec);
  __pyx_r = __pyx_v_rec;
  goto __pyx_L0;

  /* "pysamstats/opt.pyx":1051
 *                 self.pp_fwd.update(mapq)
 * 
 *     cdef dict rec(self, chrom, pos, FastaFile fafile, bytes refbase):             # <<<<<<<<<<<<<<
 * 
 *         # make record
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pysamstats.opt.MapqStrand.rec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rec);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_10MapqStrand_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pysamstats_3opt_10MapqStrand_4__reduce_cython__[] = "MapqStrand.__reduce_cython__(self)";
static PyObject *__pyx_pw_10pysamstats_3opt_10MapqStrand_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_10MapqStrand_4__reduce_cython__(((struct __pyx_obj_10pysamstats_3opt_MapqStrand *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pysamstats_3opt_10MapqStrand_4__reduce_cython__(struct __pyx_obj_10pysamstats_3opt_MapqStrand *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self.all, self.fwd, self.pp, self.pp_fwd, self.pp_rev, self.rev)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __pyx_t_1 = PyTuple_New(6); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->all));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->all));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self->all));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->fwd));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->fwd));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self->fwd));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->pp));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->pp));
  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_self->pp));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->pp_fwd));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->pp_fwd));
  PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_v_self->pp_fwd));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->pp_rev));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->pp_rev));
  PyTuple_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_v_self->pp_rev));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->rev));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->rev));
  PyTuple_SET_ITEM(__pyx_t_1, 5, ((PyObject *)__pyx_v_self->rev));
  __pyx_v_state = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self.all, self.fwd, self.pp, self.pp_fwd, self.pp_rev, self.rev)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         state += (_dict,)
 */
  __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__dict = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":7
 *     state = (self.all, self.fwd, self.pp, self.pp_fwd, self.pp_rev, self.rev)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
  __pyx_t_2 = (__pyx_v__dict != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
 */
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
    __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "(tree fragment)":9
 *     if _dict is not None:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = self.all is not None or self.fwd is not None or self.pp is not None or self.pp_fwd is not None or self.pp_rev is not None or self.rev is not None
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = (self.all, self.fwd, self.pp, self.pp_fwd, self.pp_rev, self.rev)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
    goto __pyx_L3;
  }

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = self.all is not None or self.fwd is not None or self.pp is not None or self.pp_fwd is not None or self.pp_rev is not None or self.rev is not None             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_MapqStrand, (type(self), 0x6e74246, None), state
 */
  /*else*/ {
    __pyx_t_2 = (((PyObject *)__pyx_v_self->all) != Py_None);
    __pyx_t_5 = (__pyx_t_2 != 0);
    if (!__pyx_t_5) {
    } else {
      __pyx_t_3 = __pyx_t_5;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_5 = (((PyObject *)__pyx_v_self->fwd) != Py_None);
    __pyx_t_2 = (__pyx_t_5 != 0);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_3 = __pyx_t_2;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_2 = (((PyObject *)__pyx_v_self->pp) != Py_None);
    __pyx_t_5 = (__pyx_t_2 != 0);
    if (!__pyx_t_5) {
    } else {
      __pyx_t_3 = __pyx_t_5;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_5 = (((PyObject *)__pyx_v_self->pp_fwd) != Py_None);
    __pyx_t_2 = (__pyx_t_5 != 0);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_3 = __pyx_t_2;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_2 = (((PyObject *)__pyx_v_self->pp_rev) != Py_None);
    __pyx_t_5 = (__pyx_t_2 != 0);
    if (!__pyx_t_5) {
    } else {
      __pyx_t_3 = __pyx_t_5;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_5 = (((PyObject *)__pyx_v_self->rev) != Py_None);
    __pyx_t_2 = (__pyx_t_5 != 0);
    __pyx_t_3 = __pyx_t_2;
    __pyx_L4_bool_binop_done:;
    __pyx_v_use_setstate = __pyx_t_3;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.all is not None or self.fwd is not None or self.pp is not None or self.pp_fwd is not None or self.pp_rev is not None or self.rev is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_MapqStrand, (type(self), 0x6e74246, None), state
 *     else:
 */
  __pyx_t_3 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":13
 *         use_setstate = self.all is not None or self.fwd is not None or self.pp is not None or self.pp_fwd is not None or self.pp_rev is not None or self.rev is not None
 *     if use_setstate:
 *         return __pyx_unpickle_MapqStrand, (type(self), 0x6e74246, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_MapqStrand, (type(self), 0x6e74246, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_MapqStrand); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_115819078);
    __Pyx_GIVEREF(__pyx_int_115819078);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_115819078);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
    __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_state);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.all is not None or self.fwd is not None or self.pp is not None or self.pp_fwd is not None or self.pp_rev is not None or self.rev is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_MapqStrand, (type(self), 0x6e74246, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_MapqStrand, (type(self), 0x6e74246, None), state
 *     else:
 *         return __pyx_unpickle_MapqStrand, (type(self), 0x6e74246, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_MapqStrand__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_pyx_unpickle_MapqStrand); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_115819078);
    __Pyx_GIVEREF(__pyx_int_115819078);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_115819078);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
    __pyx_t_6 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pysamstats.opt.MapqStrand.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_MapqStrand, (type(self), 0x6e74246, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_MapqStrand__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_10MapqStrand_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_10pysamstats_3opt_10MapqStrand_6__setstate_cython__[] = "MapqStrand.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_10pysamstats_3opt_10MapqStrand_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_10MapqStrand_6__setstate_cython__(((struct __pyx_obj_10pysamstats_3opt_MapqStrand *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_10pysamstats_3opt_10MapqStrand_6__setstate_cython__(struct __pyx_obj_10pysamstats_3opt_MapqStrand *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_MapqStrand, (type(self), 0x6e74246, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_MapqStrand__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
 */
  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_10pysamstats_3opt___pyx_unpickle_MapqStrand__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_MapqStrand, (type(self), 0x6e74246, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_MapqStrand__set_state(self, __pyx_state)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysamstats.opt.MapqStrand.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":1100
 *         uint64_t sqsum
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.reset()
 * 
 */

/* Python wrapper */
static int __pyx_pw_10pysamstats_3opt_11BaseqHelper_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_10pysamstats_3opt_11BaseqHelper_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
  __pyx_r = __pyx_pf_10pysamstats_3opt_11BaseqHelper___init__(((struct __pyx_obj_10pysamstats_3opt_BaseqHelper *)__pyx_v_self));

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

static int __pyx_pf_10pysamstats_3opt_11BaseqHelper___init__(struct __pyx_obj_10pysamstats_3opt_BaseqHelper *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "pysamstats/opt.pyx":1101
 * 
 *     def __init__(self):
 *         self.reset()             # <<<<<<<<<<<<<<
 * 
 *     def reset(self):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1101, __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, 1101, __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;

  /* "pysamstats/opt.pyx":1100
 *         uint64_t sqsum
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.reset()
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysamstats.opt.BaseqHelper.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":1103
 *         self.reset()
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         self.n = 0
 *         self.n_nodel = 0
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_11BaseqHelper_3reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pysamstats_3opt_11BaseqHelper_2reset[] = "BaseqHelper.reset(self)";
static PyObject *__pyx_pw_10pysamstats_3opt_11BaseqHelper_3reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reset (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_11BaseqHelper_2reset(((struct __pyx_obj_10pysamstats_3opt_BaseqHelper *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pysamstats_3opt_11BaseqHelper_2reset(struct __pyx_obj_10pysamstats_3opt_BaseqHelper *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reset", 0);

  /* "pysamstats/opt.pyx":1104
 * 
 *     def reset(self):
 *         self.n = 0             # <<<<<<<<<<<<<<
 *         self.n_nodel = 0
 *         self.sqsum = 0
 */
  __pyx_v_self->n = 0;

  /* "pysamstats/opt.pyx":1105
 *     def reset(self):
 *         self.n = 0
 *         self.n_nodel = 0             # <<<<<<<<<<<<<<
 *         self.sqsum = 0
 * 
 */
  __pyx_v_self->n_nodel = 0;

  /* "pysamstats/opt.pyx":1106
 *         self.n = 0
 *         self.n_nodel = 0
 *         self.sqsum = 0             # <<<<<<<<<<<<<<
 * 
 *     cdef void update(self, int64_t baseq_squared):
 */
  __pyx_v_self->sqsum = 0;

  /* "pysamstats/opt.pyx":1103
 *         self.reset()
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         self.n = 0
 *         self.n_nodel = 0
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":1108
 *         self.sqsum = 0
 * 
 *     cdef void update(self, int64_t baseq_squared):             # <<<<<<<<<<<<<<
 *         self.n += 1
 *         if baseq_squared >= 0:
 */

static void __pyx_f_10pysamstats_3opt_11BaseqHelper_update(struct __pyx_obj_10pysamstats_3opt_BaseqHelper *__pyx_v_self, int64_t __pyx_v_baseq_squared) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("update", 0);

  /* "pysamstats/opt.pyx":1109
 * 
 *     cdef void update(self, int64_t baseq_squared):
 *         self.n += 1             # <<<<<<<<<<<<<<
 *         if baseq_squared >= 0:
 *             self.n_nodel += 1
 */
  __pyx_v_self->n = (__pyx_v_self->n + 1);

  /* "pysamstats/opt.pyx":1110
 *     cdef void update(self, int64_t baseq_squared):
 *         self.n += 1
 *         if baseq_squared >= 0:             # <<<<<<<<<<<<<<
 *             self.n_nodel += 1
 *             self.sqsum += baseq_squared
 */
  __pyx_t_1 = ((__pyx_v_baseq_squared >= 0) != 0);
  if (__pyx_t_1) {

    /* "pysamstats/opt.pyx":1111
 *         self.n += 1
 *         if baseq_squared >= 0:
 *             self.n_nodel += 1             # <<<<<<<<<<<<<<
 *             self.sqsum += baseq_squared
 * 
 */
    __pyx_v_self->n_nodel = (__pyx_v_self->n_nodel + 1);

    /* "pysamstats/opt.pyx":1112
 *         if baseq_squared >= 0:
 *             self.n_nodel += 1
 *             self.sqsum += baseq_squared             # <<<<<<<<<<<<<<
 * 
 *     def rms(self):
 */
    __pyx_v_self->sqsum = (__pyx_v_self->sqsum + __pyx_v_baseq_squared);

    /* "pysamstats/opt.pyx":1110
 *     cdef void update(self, int64_t baseq_squared):
 *         self.n += 1
 *         if baseq_squared >= 0:             # <<<<<<<<<<<<<<
 *             self.n_nodel += 1
 *             self.sqsum += baseq_squared
 */
  }

  /* "pysamstats/opt.pyx":1108
 *         self.sqsum = 0
 * 
 *     cdef void update(self, int64_t baseq_squared):             # <<<<<<<<<<<<<<
 *         self.n += 1
 *         if baseq_squared >= 0:
 */

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

/* "pysamstats/opt.pyx":1114
 *             self.sqsum += baseq_squared
 * 
 *     def rms(self):             # <<<<<<<<<<<<<<
 *         return rootmean(self.sqsum, self.n_nodel)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_11BaseqHelper_5rms(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pysamstats_3opt_11BaseqHelper_4rms[] = "BaseqHelper.rms(self)";
static PyObject *__pyx_pw_10pysamstats_3opt_11BaseqHelper_5rms(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rms (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_11BaseqHelper_4rms(((struct __pyx_obj_10pysamstats_3opt_BaseqHelper *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pysamstats_3opt_11BaseqHelper_4rms(struct __pyx_obj_10pysamstats_3opt_BaseqHelper *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("rms", 0);

  /* "pysamstats/opt.pyx":1115
 * 
 *     def rms(self):
 *         return rootmean(self.sqsum, self.n_nodel)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_rootmean); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1115, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_uint64_t(__pyx_v_self->sqsum); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1115, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_self->n_nodel); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1115, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 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_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_3, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1115, __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_4); __pyx_t_4 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_3, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1115, __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_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1115, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_4);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1115, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pysamstats/opt.pyx":1114
 *             self.sqsum += baseq_squared
 * 
 *     def rms(self):             # <<<<<<<<<<<<<<
 *         return rootmean(self.sqsum, self.n_nodel)
 * 
 */

  /* 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_7);
  __Pyx_AddTraceback("pysamstats.opt.BaseqHelper.rms", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_11BaseqHelper_7__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pysamstats_3opt_11BaseqHelper_6__reduce_cython__[] = "BaseqHelper.__reduce_cython__(self)";
static PyObject *__pyx_pw_10pysamstats_3opt_11BaseqHelper_7__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_11BaseqHelper_6__reduce_cython__(((struct __pyx_obj_10pysamstats_3opt_BaseqHelper *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pysamstats_3opt_11BaseqHelper_6__reduce_cython__(struct __pyx_obj_10pysamstats_3opt_BaseqHelper *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  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;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self.n, self.n_nodel, self.sqsum)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->n); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->n_nodel); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_uint64_t(__pyx_v_self->sqsum); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_v_state = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self.n, self.n_nodel, self.sqsum)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         state += (_dict,)
 */
  __pyx_t_4 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v__dict = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "(tree fragment)":7
 *     state = (self.n, self.n_nodel, self.sqsum)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
  __pyx_t_5 = (__pyx_v__dict != Py_None);
  __pyx_t_6 = (__pyx_t_5 != 0);
  if (__pyx_t_6) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
 */
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v__dict);
    __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "(tree fragment)":9
 *     if _dict is not None:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = False
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = (self.n, self.n_nodel, self.sqsum)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
    goto __pyx_L3;
  }

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = False             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_BaseqHelper, (type(self), 0x4ce10ab, None), state
 */
  /*else*/ {
    __pyx_v_use_setstate = 0;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_BaseqHelper, (type(self), 0x4ce10ab, None), state
 *     else:
 */
  __pyx_t_6 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_6) {

    /* "(tree fragment)":13
 *         use_setstate = False
 *     if use_setstate:
 *         return __pyx_unpickle_BaseqHelper, (type(self), 0x4ce10ab, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_BaseqHelper, (type(self), 0x4ce10ab, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pyx_unpickle_BaseqHelper); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_80613547);
    __Pyx_GIVEREF(__pyx_int_80613547);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_80613547);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_4, 2, Py_None);
    __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_state);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_BaseqHelper, (type(self), 0x4ce10ab, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_BaseqHelper, (type(self), 0x4ce10ab, None), state
 *     else:
 *         return __pyx_unpickle_BaseqHelper, (type(self), 0x4ce10ab, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_BaseqHelper__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pyx_unpickle_BaseqHelper); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_80613547);
    __Pyx_GIVEREF(__pyx_int_80613547);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_80613547);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_state);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4);
    __pyx_t_2 = 0;
    __pyx_t_4 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pysamstats.opt.BaseqHelper.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_BaseqHelper, (type(self), 0x4ce10ab, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_BaseqHelper__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_11BaseqHelper_9__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_10pysamstats_3opt_11BaseqHelper_8__setstate_cython__[] = "BaseqHelper.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_10pysamstats_3opt_11BaseqHelper_9__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_11BaseqHelper_8__setstate_cython__(((struct __pyx_obj_10pysamstats_3opt_BaseqHelper *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_10pysamstats_3opt_11BaseqHelper_8__setstate_cython__(struct __pyx_obj_10pysamstats_3opt_BaseqHelper *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_BaseqHelper, (type(self), 0x4ce10ab, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_BaseqHelper__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
 */
  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_10pysamstats_3opt___pyx_unpickle_BaseqHelper__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_BaseqHelper, (type(self), 0x4ce10ab, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_BaseqHelper__set_state(self, __pyx_state)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysamstats.opt.BaseqHelper.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":1125
 *         BaseqHelper pp
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.all = BaseqHelper()
 *         self.pp = BaseqHelper()
 */

/* Python wrapper */
static int __pyx_pw_10pysamstats_3opt_13BaseqPpHelper_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_10pysamstats_3opt_13BaseqPpHelper_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
  __pyx_r = __pyx_pf_10pysamstats_3opt_13BaseqPpHelper___init__(((struct __pyx_obj_10pysamstats_3opt_BaseqPpHelper *)__pyx_v_self));

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

static int __pyx_pf_10pysamstats_3opt_13BaseqPpHelper___init__(struct __pyx_obj_10pysamstats_3opt_BaseqPpHelper *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "pysamstats/opt.pyx":1126
 * 
 *     def __init__(self):
 *         self.all = BaseqHelper()             # <<<<<<<<<<<<<<
 *         self.pp = BaseqHelper()
 *         self.reset()
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_BaseqHelper)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1126, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->all);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->all));
  __pyx_v_self->all = ((struct __pyx_obj_10pysamstats_3opt_BaseqHelper *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1127
 *     def __init__(self):
 *         self.all = BaseqHelper()
 *         self.pp = BaseqHelper()             # <<<<<<<<<<<<<<
 *         self.reset()
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_BaseqHelper)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1127, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->pp);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->pp));
  __pyx_v_self->pp = ((struct __pyx_obj_10pysamstats_3opt_BaseqHelper *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1128
 *         self.all = BaseqHelper()
 *         self.pp = BaseqHelper()
 *         self.reset()             # <<<<<<<<<<<<<<
 * 
 *     def reset(self):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1128, __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, 1128, __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;

  /* "pysamstats/opt.pyx":1125
 *         BaseqHelper pp
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.all = BaseqHelper()
 *         self.pp = BaseqHelper()
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysamstats.opt.BaseqPpHelper.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":1130
 *         self.reset()
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         self.all.reset()
 *         self.pp.reset()
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_13BaseqPpHelper_3reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pysamstats_3opt_13BaseqPpHelper_2reset[] = "BaseqPpHelper.reset(self)";
static PyObject *__pyx_pw_10pysamstats_3opt_13BaseqPpHelper_3reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reset (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_13BaseqPpHelper_2reset(((struct __pyx_obj_10pysamstats_3opt_BaseqPpHelper *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pysamstats_3opt_13BaseqPpHelper_2reset(struct __pyx_obj_10pysamstats_3opt_BaseqPpHelper *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("reset", 0);

  /* "pysamstats/opt.pyx":1131
 * 
 *     def reset(self):
 *         self.all.reset()             # <<<<<<<<<<<<<<
 *         self.pp.reset()
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->all), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1131, __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, 1131, __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;

  /* "pysamstats/opt.pyx":1132
 *     def reset(self):
 *         self.all.reset()
 *         self.pp.reset()             # <<<<<<<<<<<<<<
 * 
 *     cdef void update(self, int64_t baseq_squared, bint is_proper_pair):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->pp), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1132, __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, 1132, __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;

  /* "pysamstats/opt.pyx":1130
 *         self.reset()
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         self.all.reset()
 *         self.pp.reset()
 */

  /* 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_AddTraceback("pysamstats.opt.BaseqPpHelper.reset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":1134
 *         self.pp.reset()
 * 
 *     cdef void update(self, int64_t baseq_squared, bint is_proper_pair):             # <<<<<<<<<<<<<<
 *         self.all.update(baseq_squared)
 *         if is_proper_pair:
 */

static void __pyx_f_10pysamstats_3opt_13BaseqPpHelper_update(struct __pyx_obj_10pysamstats_3opt_BaseqPpHelper *__pyx_v_self, int64_t __pyx_v_baseq_squared, int __pyx_v_is_proper_pair) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("update", 0);

  /* "pysamstats/opt.pyx":1135
 * 
 *     cdef void update(self, int64_t baseq_squared, bint is_proper_pair):
 *         self.all.update(baseq_squared)             # <<<<<<<<<<<<<<
 *         if is_proper_pair:
 *             self.pp.update(baseq_squared)
 */
  ((struct __pyx_vtabstruct_10pysamstats_3opt_BaseqHelper *)__pyx_v_self->all->__pyx_vtab)->update(__pyx_v_self->all, __pyx_v_baseq_squared);

  /* "pysamstats/opt.pyx":1136
 *     cdef void update(self, int64_t baseq_squared, bint is_proper_pair):
 *         self.all.update(baseq_squared)
 *         if is_proper_pair:             # <<<<<<<<<<<<<<
 *             self.pp.update(baseq_squared)
 * 
 */
  __pyx_t_1 = (__pyx_v_is_proper_pair != 0);
  if (__pyx_t_1) {

    /* "pysamstats/opt.pyx":1137
 *         self.all.update(baseq_squared)
 *         if is_proper_pair:
 *             self.pp.update(baseq_squared)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    ((struct __pyx_vtabstruct_10pysamstats_3opt_BaseqHelper *)__pyx_v_self->pp->__pyx_vtab)->update(__pyx_v_self->pp, __pyx_v_baseq_squared);

    /* "pysamstats/opt.pyx":1136
 *     cdef void update(self, int64_t baseq_squared, bint is_proper_pair):
 *         self.all.update(baseq_squared)
 *         if is_proper_pair:             # <<<<<<<<<<<<<<
 *             self.pp.update(baseq_squared)
 * 
 */
  }

  /* "pysamstats/opt.pyx":1134
 *         self.pp.reset()
 * 
 *     cdef void update(self, int64_t baseq_squared, bint is_proper_pair):             # <<<<<<<<<<<<<<
 *         self.all.update(baseq_squared)
 *         if is_proper_pair:
 */

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

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_13BaseqPpHelper_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pysamstats_3opt_13BaseqPpHelper_4__reduce_cython__[] = "BaseqPpHelper.__reduce_cython__(self)";
static PyObject *__pyx_pw_10pysamstats_3opt_13BaseqPpHelper_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_13BaseqPpHelper_4__reduce_cython__(((struct __pyx_obj_10pysamstats_3opt_BaseqPpHelper *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pysamstats_3opt_13BaseqPpHelper_4__reduce_cython__(struct __pyx_obj_10pysamstats_3opt_BaseqPpHelper *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self.all, self.pp)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->all));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->all));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self->all));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->pp));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->pp));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self->pp));
  __pyx_v_state = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self.all, self.pp)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         state += (_dict,)
 */
  __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__dict = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":7
 *     state = (self.all, self.pp)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
  __pyx_t_2 = (__pyx_v__dict != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
 */
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
    __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "(tree fragment)":9
 *     if _dict is not None:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = self.all is not None or self.pp is not None
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = (self.all, self.pp)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
    goto __pyx_L3;
  }

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = self.all is not None or self.pp is not None             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_BaseqPpHelper, (type(self), 0x145977c, None), state
 */
  /*else*/ {
    __pyx_t_2 = (((PyObject *)__pyx_v_self->all) != Py_None);
    __pyx_t_5 = (__pyx_t_2 != 0);
    if (!__pyx_t_5) {
    } else {
      __pyx_t_3 = __pyx_t_5;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_5 = (((PyObject *)__pyx_v_self->pp) != Py_None);
    __pyx_t_2 = (__pyx_t_5 != 0);
    __pyx_t_3 = __pyx_t_2;
    __pyx_L4_bool_binop_done:;
    __pyx_v_use_setstate = __pyx_t_3;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.all is not None or self.pp is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_BaseqPpHelper, (type(self), 0x145977c, None), state
 *     else:
 */
  __pyx_t_3 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":13
 *         use_setstate = self.all is not None or self.pp is not None
 *     if use_setstate:
 *         return __pyx_unpickle_BaseqPpHelper, (type(self), 0x145977c, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_BaseqPpHelper, (type(self), 0x145977c, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_BaseqPpHelper); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_21337980);
    __Pyx_GIVEREF(__pyx_int_21337980);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_21337980);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
    __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_state);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.all is not None or self.pp is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_BaseqPpHelper, (type(self), 0x145977c, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_BaseqPpHelper, (type(self), 0x145977c, None), state
 *     else:
 *         return __pyx_unpickle_BaseqPpHelper, (type(self), 0x145977c, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_BaseqPpHelper__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_pyx_unpickle_BaseqPpHelper); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_21337980);
    __Pyx_GIVEREF(__pyx_int_21337980);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_21337980);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
    __pyx_t_6 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pysamstats.opt.BaseqPpHelper.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_BaseqPpHelper, (type(self), 0x145977c, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_BaseqPpHelper__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_13BaseqPpHelper_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_10pysamstats_3opt_13BaseqPpHelper_6__setstate_cython__[] = "BaseqPpHelper.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_10pysamstats_3opt_13BaseqPpHelper_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_13BaseqPpHelper_6__setstate_cython__(((struct __pyx_obj_10pysamstats_3opt_BaseqPpHelper *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_10pysamstats_3opt_13BaseqPpHelper_6__setstate_cython__(struct __pyx_obj_10pysamstats_3opt_BaseqPpHelper *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_BaseqPpHelper, (type(self), 0x145977c, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_BaseqPpHelper__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
 */
  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_10pysamstats_3opt___pyx_unpickle_BaseqPpHelper__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_BaseqPpHelper, (type(self), 0x145977c, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_BaseqPpHelper__set_state(self, __pyx_state)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysamstats.opt.BaseqPpHelper.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":1146
 *         BaseqPpHelper helper
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.helper = BaseqPpHelper()
 *         self.reset()
 */

/* Python wrapper */
static int __pyx_pw_10pysamstats_3opt_5Baseq_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_10pysamstats_3opt_5Baseq_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
  __pyx_r = __pyx_pf_10pysamstats_3opt_5Baseq___init__(((struct __pyx_obj_10pysamstats_3opt_Baseq *)__pyx_v_self));

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

static int __pyx_pf_10pysamstats_3opt_5Baseq___init__(struct __pyx_obj_10pysamstats_3opt_Baseq *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "pysamstats/opt.pyx":1147
 * 
 *     def __init__(self):
 *         self.helper = BaseqPpHelper()             # <<<<<<<<<<<<<<
 *         self.reset()
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_BaseqPpHelper)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1147, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->helper);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->helper));
  __pyx_v_self->helper = ((struct __pyx_obj_10pysamstats_3opt_BaseqPpHelper *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1148
 *     def __init__(self):
 *         self.helper = BaseqPpHelper()
 *         self.reset()             # <<<<<<<<<<<<<<
 * 
 *     def reset(self):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1148, __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, 1148, __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;

  /* "pysamstats/opt.pyx":1146
 *         BaseqPpHelper helper
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.helper = BaseqPpHelper()
 *         self.reset()
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysamstats.opt.Baseq.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":1150
 *         self.reset()
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         self.helper.reset()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_5Baseq_3reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pysamstats_3opt_5Baseq_2reset[] = "Baseq.reset(self)";
static PyObject *__pyx_pw_10pysamstats_3opt_5Baseq_3reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reset (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_5Baseq_2reset(((struct __pyx_obj_10pysamstats_3opt_Baseq *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pysamstats_3opt_5Baseq_2reset(struct __pyx_obj_10pysamstats_3opt_Baseq *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("reset", 0);

  /* "pysamstats/opt.pyx":1151
 * 
 *     def reset(self):
 *         self.helper.reset()             # <<<<<<<<<<<<<<
 * 
 *     cdef void recv(self, bam_pileup1_t* read, PileupColumn col, bytes refbase):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->helper), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1151, __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, 1151, __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;

  /* "pysamstats/opt.pyx":1150
 *         self.reset()
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         self.helper.reset()
 * 
 */

  /* 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_AddTraceback("pysamstats.opt.Baseq.reset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":1153
 *         self.helper.reset()
 * 
 *     cdef void recv(self, bam_pileup1_t* read, PileupColumn col, bytes refbase):             # <<<<<<<<<<<<<<
 *         cdef:
 *             uint32_t flag
 */

static void __pyx_f_10pysamstats_3opt_5Baseq_recv(struct __pyx_obj_10pysamstats_3opt_Baseq *__pyx_v_self, bam_pileup1_t *__pyx_v_read, CYTHON_UNUSED struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn *__pyx_v_col, CYTHON_UNUSED PyObject *__pyx_v_refbase) {
  uint32_t __pyx_v_flag;
  int __pyx_v_is_proper_pair;
  int64_t __pyx_v_baseq;
  int64_t __pyx_v_baseq_squared;
  __Pyx_RefNannyDeclarations
  uint16_t __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("recv", 0);

  /* "pysamstats/opt.pyx":1157
 *             uint32_t flag
 *             bint is_proper_pair
 *             int64_t baseq = -1             # <<<<<<<<<<<<<<
 *             int64_t baseq_squared = -1
 * 
 */
  __pyx_v_baseq = -1L;

  /* "pysamstats/opt.pyx":1158
 *             bint is_proper_pair
 *             int64_t baseq = -1
 *             int64_t baseq_squared = -1             # <<<<<<<<<<<<<<
 * 
 *         # convenience variables
 */
  __pyx_v_baseq_squared = -1L;

  /* "pysamstats/opt.pyx":1161
 * 
 *         # convenience variables
 *         flag = read.b.core.flag             # <<<<<<<<<<<<<<
 *         is_proper_pair = <bint>(flag & BAM_FPROPER_PAIR)
 * 
 */
  __pyx_t_1 = __pyx_v_read->b->core.flag;
  __pyx_v_flag = __pyx_t_1;

  /* "pysamstats/opt.pyx":1162
 *         # convenience variables
 *         flag = read.b.core.flag
 *         is_proper_pair = <bint>(flag & BAM_FPROPER_PAIR)             # <<<<<<<<<<<<<<
 * 
 *         # do the counting
 */
  __pyx_v_is_proper_pair = ((__pyx_v_flag & 2) != 0);

  /* "pysamstats/opt.pyx":1165
 * 
 *         # do the counting
 *         if not read.is_del:             # <<<<<<<<<<<<<<
 *             baseq = pysam_bam_get_qual(read.b)[read.qpos]
 *             baseq_squared = baseq**2
 */
  __pyx_t_2 = ((!(__pyx_v_read->is_del != 0)) != 0);
  if (__pyx_t_2) {

    /* "pysamstats/opt.pyx":1166
 *         # do the counting
 *         if not read.is_del:
 *             baseq = pysam_bam_get_qual(read.b)[read.qpos]             # <<<<<<<<<<<<<<
 *             baseq_squared = baseq**2
 * 
 */
    __pyx_v_baseq = (pysam_bam_get_qual(__pyx_v_read->b)[__pyx_v_read->qpos]);

    /* "pysamstats/opt.pyx":1167
 *         if not read.is_del:
 *             baseq = pysam_bam_get_qual(read.b)[read.qpos]
 *             baseq_squared = baseq**2             # <<<<<<<<<<<<<<
 * 
 *         self.helper.update(baseq_squared, is_proper_pair)
 */
    __pyx_v_baseq_squared = __Pyx_pow_int64_t(__pyx_v_baseq, 2);

    /* "pysamstats/opt.pyx":1165
 * 
 *         # do the counting
 *         if not read.is_del:             # <<<<<<<<<<<<<<
 *             baseq = pysam_bam_get_qual(read.b)[read.qpos]
 *             baseq_squared = baseq**2
 */
  }

  /* "pysamstats/opt.pyx":1169
 *             baseq_squared = baseq**2
 * 
 *         self.helper.update(baseq_squared, is_proper_pair)             # <<<<<<<<<<<<<<
 * 
 *     cdef dict rec(self, chrom, pos, FastaFile fafile, bytes refbase):
 */
  ((struct __pyx_vtabstruct_10pysamstats_3opt_BaseqPpHelper *)__pyx_v_self->helper->__pyx_vtab)->update(__pyx_v_self->helper, __pyx_v_baseq_squared, __pyx_v_is_proper_pair);

  /* "pysamstats/opt.pyx":1153
 *         self.helper.reset()
 * 
 *     cdef void recv(self, bam_pileup1_t* read, PileupColumn col, bytes refbase):             # <<<<<<<<<<<<<<
 *         cdef:
 *             uint32_t flag
 */

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

/* "pysamstats/opt.pyx":1171
 *         self.helper.update(baseq_squared, is_proper_pair)
 * 
 *     cdef dict rec(self, chrom, pos, FastaFile fafile, bytes refbase):             # <<<<<<<<<<<<<<
 * 
 *         # make record
 */

static PyObject *__pyx_f_10pysamstats_3opt_5Baseq_rec(struct __pyx_obj_10pysamstats_3opt_Baseq *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_chrom, CYTHON_UNUSED PyObject *__pyx_v_pos, CYTHON_UNUSED struct __pyx_obj_5pysam_9libcfaidx_FastaFile *__pyx_v_fafile, CYTHON_UNUSED PyObject *__pyx_v_refbase) {
  PyObject *__pyx_v_rec = 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;
  __Pyx_RefNannySetupContext("rec", 0);

  /* "pysamstats/opt.pyx":1175
 *         # make record
 *         rec = {
 *             'reads_all': self.helper.all.n,             # <<<<<<<<<<<<<<
 *             'reads_pp': self.helper.pp.n,
 *             'rms_baseq': self.helper.all.rms(),
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1175, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->helper->all->n); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1175, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_all, __pyx_t_2) < 0) __PYX_ERR(0, 1175, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":1176
 *         rec = {
 *             'reads_all': self.helper.all.n,
 *             'reads_pp': self.helper.pp.n,             # <<<<<<<<<<<<<<
 *             'rms_baseq': self.helper.all.rms(),
 *             'rms_baseq_pp': self.helper.pp.rms(),
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->helper->pp->n); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1176, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_pp, __pyx_t_2) < 0) __PYX_ERR(0, 1175, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":1177
 *             'reads_all': self.helper.all.n,
 *             'reads_pp': self.helper.pp.n,
 *             'rms_baseq': self.helper.all.rms(),             # <<<<<<<<<<<<<<
 *             'rms_baseq_pp': self.helper.pp.rms(),
 *         }
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->helper->all), __pyx_n_s_rms); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1177, __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_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1177, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_rms_baseq, __pyx_t_2) < 0) __PYX_ERR(0, 1175, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":1178
 *             'reads_pp': self.helper.pp.n,
 *             'rms_baseq': self.helper.all.rms(),
 *             'rms_baseq_pp': self.helper.pp.rms(),             # <<<<<<<<<<<<<<
 *         }
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->helper->pp), __pyx_n_s_rms); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1178, __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_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1178, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_rms_baseq_pp, __pyx_t_2) < 0) __PYX_ERR(0, 1175, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_rec = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1182
 * 
 *         # reset counters
 *         self.reset()             # <<<<<<<<<<<<<<
 * 
 *         return rec
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1182, __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, 1182, __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;

  /* "pysamstats/opt.pyx":1184
 *         self.reset()
 * 
 *         return rec             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_rec);
  __pyx_r = __pyx_v_rec;
  goto __pyx_L0;

  /* "pysamstats/opt.pyx":1171
 *         self.helper.update(baseq_squared, is_proper_pair)
 * 
 *     cdef dict rec(self, chrom, pos, FastaFile fafile, bytes refbase):             # <<<<<<<<<<<<<<
 * 
 *         # make record
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pysamstats.opt.Baseq.rec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rec);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_5Baseq_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pysamstats_3opt_5Baseq_4__reduce_cython__[] = "Baseq.__reduce_cython__(self)";
static PyObject *__pyx_pw_10pysamstats_3opt_5Baseq_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_5Baseq_4__reduce_cython__(((struct __pyx_obj_10pysamstats_3opt_Baseq *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pysamstats_3opt_5Baseq_4__reduce_cython__(struct __pyx_obj_10pysamstats_3opt_Baseq *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  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;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self.helper,)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->helper));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->helper));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self->helper));
  __pyx_v_state = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self.helper,)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         state += (_dict,)
 */
  __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__dict = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":7
 *     state = (self.helper,)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
  __pyx_t_2 = (__pyx_v__dict != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
 */
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
    __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "(tree fragment)":9
 *     if _dict is not None:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = self.helper is not None
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = (self.helper,)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
    goto __pyx_L3;
  }

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = self.helper is not None             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_Baseq, (type(self), 0xfde5d67, None), state
 */
  /*else*/ {
    __pyx_t_3 = (((PyObject *)__pyx_v_self->helper) != Py_None);
    __pyx_v_use_setstate = __pyx_t_3;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.helper is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_Baseq, (type(self), 0xfde5d67, None), state
 *     else:
 */
  __pyx_t_3 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":13
 *         use_setstate = self.helper is not None
 *     if use_setstate:
 *         return __pyx_unpickle_Baseq, (type(self), 0xfde5d67, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_Baseq, (type(self), 0xfde5d67, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_Baseq); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_266231143);
    __Pyx_GIVEREF(__pyx_int_266231143);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_266231143);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.helper is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_Baseq, (type(self), 0xfde5d67, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_Baseq, (type(self), 0xfde5d67, None), state
 *     else:
 *         return __pyx_unpickle_Baseq, (type(self), 0xfde5d67, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_Baseq__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_Baseq); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_266231143);
    __Pyx_GIVEREF(__pyx_int_266231143);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_266231143);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
    __pyx_t_5 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pysamstats.opt.Baseq.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_Baseq, (type(self), 0xfde5d67, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_Baseq__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_5Baseq_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_10pysamstats_3opt_5Baseq_6__setstate_cython__[] = "Baseq.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_10pysamstats_3opt_5Baseq_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_5Baseq_6__setstate_cython__(((struct __pyx_obj_10pysamstats_3opt_Baseq *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_10pysamstats_3opt_5Baseq_6__setstate_cython__(struct __pyx_obj_10pysamstats_3opt_Baseq *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_Baseq, (type(self), 0xfde5d67, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_Baseq__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
 */
  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_10pysamstats_3opt___pyx_unpickle_Baseq__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_Baseq, (type(self), 0xfde5d67, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_Baseq__set_state(self, __pyx_state)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysamstats.opt.Baseq.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":1198
 *         BaseqHelper pp_rev
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.all = BaseqHelper()
 *         self.fwd = BaseqHelper()
 */

/* Python wrapper */
static int __pyx_pw_10pysamstats_3opt_19BaseqStrandPpHelper_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_10pysamstats_3opt_19BaseqStrandPpHelper_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
  __pyx_r = __pyx_pf_10pysamstats_3opt_19BaseqStrandPpHelper___init__(((struct __pyx_obj_10pysamstats_3opt_BaseqStrandPpHelper *)__pyx_v_self));

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

static int __pyx_pf_10pysamstats_3opt_19BaseqStrandPpHelper___init__(struct __pyx_obj_10pysamstats_3opt_BaseqStrandPpHelper *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "pysamstats/opt.pyx":1199
 * 
 *     def __init__(self):
 *         self.all = BaseqHelper()             # <<<<<<<<<<<<<<
 *         self.fwd = BaseqHelper()
 *         self.rev = BaseqHelper()
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_BaseqHelper)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->all);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->all));
  __pyx_v_self->all = ((struct __pyx_obj_10pysamstats_3opt_BaseqHelper *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1200
 *     def __init__(self):
 *         self.all = BaseqHelper()
 *         self.fwd = BaseqHelper()             # <<<<<<<<<<<<<<
 *         self.rev = BaseqHelper()
 *         self.pp = BaseqHelper()
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_BaseqHelper)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1200, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->fwd);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->fwd));
  __pyx_v_self->fwd = ((struct __pyx_obj_10pysamstats_3opt_BaseqHelper *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1201
 *         self.all = BaseqHelper()
 *         self.fwd = BaseqHelper()
 *         self.rev = BaseqHelper()             # <<<<<<<<<<<<<<
 *         self.pp = BaseqHelper()
 *         self.pp_fwd = BaseqHelper()
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_BaseqHelper)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1201, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->rev);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->rev));
  __pyx_v_self->rev = ((struct __pyx_obj_10pysamstats_3opt_BaseqHelper *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1202
 *         self.fwd = BaseqHelper()
 *         self.rev = BaseqHelper()
 *         self.pp = BaseqHelper()             # <<<<<<<<<<<<<<
 *         self.pp_fwd = BaseqHelper()
 *         self.pp_rev = BaseqHelper()
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_BaseqHelper)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->pp);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->pp));
  __pyx_v_self->pp = ((struct __pyx_obj_10pysamstats_3opt_BaseqHelper *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1203
 *         self.rev = BaseqHelper()
 *         self.pp = BaseqHelper()
 *         self.pp_fwd = BaseqHelper()             # <<<<<<<<<<<<<<
 *         self.pp_rev = BaseqHelper()
 *         self.reset()
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_BaseqHelper)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->pp_fwd);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->pp_fwd));
  __pyx_v_self->pp_fwd = ((struct __pyx_obj_10pysamstats_3opt_BaseqHelper *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1204
 *         self.pp = BaseqHelper()
 *         self.pp_fwd = BaseqHelper()
 *         self.pp_rev = BaseqHelper()             # <<<<<<<<<<<<<<
 *         self.reset()
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_BaseqHelper)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1204, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->pp_rev);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->pp_rev));
  __pyx_v_self->pp_rev = ((struct __pyx_obj_10pysamstats_3opt_BaseqHelper *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1205
 *         self.pp_fwd = BaseqHelper()
 *         self.pp_rev = BaseqHelper()
 *         self.reset()             # <<<<<<<<<<<<<<
 * 
 *     def reset(self):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1205, __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, 1205, __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;

  /* "pysamstats/opt.pyx":1198
 *         BaseqHelper pp_rev
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.all = BaseqHelper()
 *         self.fwd = BaseqHelper()
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysamstats.opt.BaseqStrandPpHelper.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":1207
 *         self.reset()
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         self.all.reset()
 *         self.fwd.reset()
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_19BaseqStrandPpHelper_3reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pysamstats_3opt_19BaseqStrandPpHelper_2reset[] = "BaseqStrandPpHelper.reset(self)";
static PyObject *__pyx_pw_10pysamstats_3opt_19BaseqStrandPpHelper_3reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reset (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_19BaseqStrandPpHelper_2reset(((struct __pyx_obj_10pysamstats_3opt_BaseqStrandPpHelper *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pysamstats_3opt_19BaseqStrandPpHelper_2reset(struct __pyx_obj_10pysamstats_3opt_BaseqStrandPpHelper *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("reset", 0);

  /* "pysamstats/opt.pyx":1208
 * 
 *     def reset(self):
 *         self.all.reset()             # <<<<<<<<<<<<<<
 *         self.fwd.reset()
 *         self.rev.reset()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->all), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1208, __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, 1208, __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;

  /* "pysamstats/opt.pyx":1209
 *     def reset(self):
 *         self.all.reset()
 *         self.fwd.reset()             # <<<<<<<<<<<<<<
 *         self.rev.reset()
 *         self.pp.reset()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->fwd), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1209, __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, 1209, __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;

  /* "pysamstats/opt.pyx":1210
 *         self.all.reset()
 *         self.fwd.reset()
 *         self.rev.reset()             # <<<<<<<<<<<<<<
 *         self.pp.reset()
 *         self.pp_fwd.reset()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->rev), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1210, __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, 1210, __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;

  /* "pysamstats/opt.pyx":1211
 *         self.fwd.reset()
 *         self.rev.reset()
 *         self.pp.reset()             # <<<<<<<<<<<<<<
 *         self.pp_fwd.reset()
 *         self.pp_rev.reset()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->pp), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1211, __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, 1211, __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;

  /* "pysamstats/opt.pyx":1212
 *         self.rev.reset()
 *         self.pp.reset()
 *         self.pp_fwd.reset()             # <<<<<<<<<<<<<<
 *         self.pp_rev.reset()
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->pp_fwd), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1212, __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, 1212, __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;

  /* "pysamstats/opt.pyx":1213
 *         self.pp.reset()
 *         self.pp_fwd.reset()
 *         self.pp_rev.reset()             # <<<<<<<<<<<<<<
 * 
 *     cdef void update(self, int64_t baseq_squared, bint is_proper_pair, bint is_reverse):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->pp_rev), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1213, __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, 1213, __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;

  /* "pysamstats/opt.pyx":1207
 *         self.reset()
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         self.all.reset()
 *         self.fwd.reset()
 */

  /* 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_AddTraceback("pysamstats.opt.BaseqStrandPpHelper.reset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":1215
 *         self.pp_rev.reset()
 * 
 *     cdef void update(self, int64_t baseq_squared, bint is_proper_pair, bint is_reverse):             # <<<<<<<<<<<<<<
 *         self.all.update(baseq_squared)
 *         if is_reverse:
 */

static void __pyx_f_10pysamstats_3opt_19BaseqStrandPpHelper_update(struct __pyx_obj_10pysamstats_3opt_BaseqStrandPpHelper *__pyx_v_self, int64_t __pyx_v_baseq_squared, int __pyx_v_is_proper_pair, int __pyx_v_is_reverse) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("update", 0);

  /* "pysamstats/opt.pyx":1216
 * 
 *     cdef void update(self, int64_t baseq_squared, bint is_proper_pair, bint is_reverse):
 *         self.all.update(baseq_squared)             # <<<<<<<<<<<<<<
 *         if is_reverse:
 *             self.rev.update(baseq_squared)
 */
  ((struct __pyx_vtabstruct_10pysamstats_3opt_BaseqHelper *)__pyx_v_self->all->__pyx_vtab)->update(__pyx_v_self->all, __pyx_v_baseq_squared);

  /* "pysamstats/opt.pyx":1217
 *     cdef void update(self, int64_t baseq_squared, bint is_proper_pair, bint is_reverse):
 *         self.all.update(baseq_squared)
 *         if is_reverse:             # <<<<<<<<<<<<<<
 *             self.rev.update(baseq_squared)
 *         else:
 */
  __pyx_t_1 = (__pyx_v_is_reverse != 0);
  if (__pyx_t_1) {

    /* "pysamstats/opt.pyx":1218
 *         self.all.update(baseq_squared)
 *         if is_reverse:
 *             self.rev.update(baseq_squared)             # <<<<<<<<<<<<<<
 *         else:
 *             self.fwd.update(baseq_squared)
 */
    ((struct __pyx_vtabstruct_10pysamstats_3opt_BaseqHelper *)__pyx_v_self->rev->__pyx_vtab)->update(__pyx_v_self->rev, __pyx_v_baseq_squared);

    /* "pysamstats/opt.pyx":1217
 *     cdef void update(self, int64_t baseq_squared, bint is_proper_pair, bint is_reverse):
 *         self.all.update(baseq_squared)
 *         if is_reverse:             # <<<<<<<<<<<<<<
 *             self.rev.update(baseq_squared)
 *         else:
 */
    goto __pyx_L3;
  }

  /* "pysamstats/opt.pyx":1220
 *             self.rev.update(baseq_squared)
 *         else:
 *             self.fwd.update(baseq_squared)             # <<<<<<<<<<<<<<
 *         if is_proper_pair:
 *             self.pp.update(baseq_squared)
 */
  /*else*/ {
    ((struct __pyx_vtabstruct_10pysamstats_3opt_BaseqHelper *)__pyx_v_self->fwd->__pyx_vtab)->update(__pyx_v_self->fwd, __pyx_v_baseq_squared);
  }
  __pyx_L3:;

  /* "pysamstats/opt.pyx":1221
 *         else:
 *             self.fwd.update(baseq_squared)
 *         if is_proper_pair:             # <<<<<<<<<<<<<<
 *             self.pp.update(baseq_squared)
 *             if is_reverse:
 */
  __pyx_t_1 = (__pyx_v_is_proper_pair != 0);
  if (__pyx_t_1) {

    /* "pysamstats/opt.pyx":1222
 *             self.fwd.update(baseq_squared)
 *         if is_proper_pair:
 *             self.pp.update(baseq_squared)             # <<<<<<<<<<<<<<
 *             if is_reverse:
 *                 self.pp_rev.update(baseq_squared)
 */
    ((struct __pyx_vtabstruct_10pysamstats_3opt_BaseqHelper *)__pyx_v_self->pp->__pyx_vtab)->update(__pyx_v_self->pp, __pyx_v_baseq_squared);

    /* "pysamstats/opt.pyx":1223
 *         if is_proper_pair:
 *             self.pp.update(baseq_squared)
 *             if is_reverse:             # <<<<<<<<<<<<<<
 *                 self.pp_rev.update(baseq_squared)
 *             else:
 */
    __pyx_t_1 = (__pyx_v_is_reverse != 0);
    if (__pyx_t_1) {

      /* "pysamstats/opt.pyx":1224
 *             self.pp.update(baseq_squared)
 *             if is_reverse:
 *                 self.pp_rev.update(baseq_squared)             # <<<<<<<<<<<<<<
 *             else:
 *                 self.pp_fwd.update(baseq_squared)
 */
      ((struct __pyx_vtabstruct_10pysamstats_3opt_BaseqHelper *)__pyx_v_self->pp_rev->__pyx_vtab)->update(__pyx_v_self->pp_rev, __pyx_v_baseq_squared);

      /* "pysamstats/opt.pyx":1223
 *         if is_proper_pair:
 *             self.pp.update(baseq_squared)
 *             if is_reverse:             # <<<<<<<<<<<<<<
 *                 self.pp_rev.update(baseq_squared)
 *             else:
 */
      goto __pyx_L5;
    }

    /* "pysamstats/opt.pyx":1226
 *                 self.pp_rev.update(baseq_squared)
 *             else:
 *                 self.pp_fwd.update(baseq_squared)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    /*else*/ {
      ((struct __pyx_vtabstruct_10pysamstats_3opt_BaseqHelper *)__pyx_v_self->pp_fwd->__pyx_vtab)->update(__pyx_v_self->pp_fwd, __pyx_v_baseq_squared);
    }
    __pyx_L5:;

    /* "pysamstats/opt.pyx":1221
 *         else:
 *             self.fwd.update(baseq_squared)
 *         if is_proper_pair:             # <<<<<<<<<<<<<<
 *             self.pp.update(baseq_squared)
 *             if is_reverse:
 */
  }

  /* "pysamstats/opt.pyx":1215
 *         self.pp_rev.reset()
 * 
 *     cdef void update(self, int64_t baseq_squared, bint is_proper_pair, bint is_reverse):             # <<<<<<<<<<<<<<
 *         self.all.update(baseq_squared)
 *         if is_reverse:
 */

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

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_19BaseqStrandPpHelper_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pysamstats_3opt_19BaseqStrandPpHelper_4__reduce_cython__[] = "BaseqStrandPpHelper.__reduce_cython__(self)";
static PyObject *__pyx_pw_10pysamstats_3opt_19BaseqStrandPpHelper_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_19BaseqStrandPpHelper_4__reduce_cython__(((struct __pyx_obj_10pysamstats_3opt_BaseqStrandPpHelper *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pysamstats_3opt_19BaseqStrandPpHelper_4__reduce_cython__(struct __pyx_obj_10pysamstats_3opt_BaseqStrandPpHelper *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self.all, self.fwd, self.pp, self.pp_fwd, self.pp_rev, self.rev)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __pyx_t_1 = PyTuple_New(6); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->all));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->all));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self->all));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->fwd));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->fwd));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self->fwd));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->pp));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->pp));
  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_self->pp));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->pp_fwd));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->pp_fwd));
  PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_v_self->pp_fwd));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->pp_rev));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->pp_rev));
  PyTuple_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_v_self->pp_rev));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->rev));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->rev));
  PyTuple_SET_ITEM(__pyx_t_1, 5, ((PyObject *)__pyx_v_self->rev));
  __pyx_v_state = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self.all, self.fwd, self.pp, self.pp_fwd, self.pp_rev, self.rev)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         state += (_dict,)
 */
  __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__dict = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":7
 *     state = (self.all, self.fwd, self.pp, self.pp_fwd, self.pp_rev, self.rev)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
  __pyx_t_2 = (__pyx_v__dict != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
 */
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
    __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "(tree fragment)":9
 *     if _dict is not None:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = self.all is not None or self.fwd is not None or self.pp is not None or self.pp_fwd is not None or self.pp_rev is not None or self.rev is not None
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = (self.all, self.fwd, self.pp, self.pp_fwd, self.pp_rev, self.rev)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
    goto __pyx_L3;
  }

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = self.all is not None or self.fwd is not None or self.pp is not None or self.pp_fwd is not None or self.pp_rev is not None or self.rev is not None             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_BaseqStrandPpHelper, (type(self), 0x6e74246, None), state
 */
  /*else*/ {
    __pyx_t_2 = (((PyObject *)__pyx_v_self->all) != Py_None);
    __pyx_t_5 = (__pyx_t_2 != 0);
    if (!__pyx_t_5) {
    } else {
      __pyx_t_3 = __pyx_t_5;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_5 = (((PyObject *)__pyx_v_self->fwd) != Py_None);
    __pyx_t_2 = (__pyx_t_5 != 0);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_3 = __pyx_t_2;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_2 = (((PyObject *)__pyx_v_self->pp) != Py_None);
    __pyx_t_5 = (__pyx_t_2 != 0);
    if (!__pyx_t_5) {
    } else {
      __pyx_t_3 = __pyx_t_5;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_5 = (((PyObject *)__pyx_v_self->pp_fwd) != Py_None);
    __pyx_t_2 = (__pyx_t_5 != 0);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_3 = __pyx_t_2;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_2 = (((PyObject *)__pyx_v_self->pp_rev) != Py_None);
    __pyx_t_5 = (__pyx_t_2 != 0);
    if (!__pyx_t_5) {
    } else {
      __pyx_t_3 = __pyx_t_5;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_5 = (((PyObject *)__pyx_v_self->rev) != Py_None);
    __pyx_t_2 = (__pyx_t_5 != 0);
    __pyx_t_3 = __pyx_t_2;
    __pyx_L4_bool_binop_done:;
    __pyx_v_use_setstate = __pyx_t_3;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.all is not None or self.fwd is not None or self.pp is not None or self.pp_fwd is not None or self.pp_rev is not None or self.rev is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_BaseqStrandPpHelper, (type(self), 0x6e74246, None), state
 *     else:
 */
  __pyx_t_3 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":13
 *         use_setstate = self.all is not None or self.fwd is not None or self.pp is not None or self.pp_fwd is not None or self.pp_rev is not None or self.rev is not None
 *     if use_setstate:
 *         return __pyx_unpickle_BaseqStrandPpHelper, (type(self), 0x6e74246, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_BaseqStrandPpHelper, (type(self), 0x6e74246, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_BaseqStrandPpHelp); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_115819078);
    __Pyx_GIVEREF(__pyx_int_115819078);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_115819078);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
    __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_state);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.all is not None or self.fwd is not None or self.pp is not None or self.pp_fwd is not None or self.pp_rev is not None or self.rev is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_BaseqStrandPpHelper, (type(self), 0x6e74246, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_BaseqStrandPpHelper, (type(self), 0x6e74246, None), state
 *     else:
 *         return __pyx_unpickle_BaseqStrandPpHelper, (type(self), 0x6e74246, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_BaseqStrandPpHelper__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_pyx_unpickle_BaseqStrandPpHelp); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_115819078);
    __Pyx_GIVEREF(__pyx_int_115819078);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_115819078);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
    __pyx_t_6 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pysamstats.opt.BaseqStrandPpHelper.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_BaseqStrandPpHelper, (type(self), 0x6e74246, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_BaseqStrandPpHelper__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_19BaseqStrandPpHelper_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_10pysamstats_3opt_19BaseqStrandPpHelper_6__setstate_cython__[] = "BaseqStrandPpHelper.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_10pysamstats_3opt_19BaseqStrandPpHelper_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_19BaseqStrandPpHelper_6__setstate_cython__(((struct __pyx_obj_10pysamstats_3opt_BaseqStrandPpHelper *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_10pysamstats_3opt_19BaseqStrandPpHelper_6__setstate_cython__(struct __pyx_obj_10pysamstats_3opt_BaseqStrandPpHelper *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_BaseqStrandPpHelper, (type(self), 0x6e74246, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_BaseqStrandPpHelper__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
 */
  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_10pysamstats_3opt___pyx_unpickle_BaseqStrandPpHelper__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_BaseqStrandPpHelper, (type(self), 0x6e74246, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_BaseqStrandPpHelper__set_state(self, __pyx_state)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysamstats.opt.BaseqStrandPpHelper.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":1235
 *         BaseqStrandPpHelper helper
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.helper = BaseqStrandPpHelper()
 *         self.reset()
 */

/* Python wrapper */
static int __pyx_pw_10pysamstats_3opt_11BaseqStrand_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_10pysamstats_3opt_11BaseqStrand_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
  __pyx_r = __pyx_pf_10pysamstats_3opt_11BaseqStrand___init__(((struct __pyx_obj_10pysamstats_3opt_BaseqStrand *)__pyx_v_self));

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

static int __pyx_pf_10pysamstats_3opt_11BaseqStrand___init__(struct __pyx_obj_10pysamstats_3opt_BaseqStrand *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "pysamstats/opt.pyx":1236
 * 
 *     def __init__(self):
 *         self.helper = BaseqStrandPpHelper()             # <<<<<<<<<<<<<<
 *         self.reset()
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_BaseqStrandPpHelper)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1236, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->helper);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->helper));
  __pyx_v_self->helper = ((struct __pyx_obj_10pysamstats_3opt_BaseqStrandPpHelper *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1237
 *     def __init__(self):
 *         self.helper = BaseqStrandPpHelper()
 *         self.reset()             # <<<<<<<<<<<<<<
 * 
 *     def reset(self):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1237, __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, 1237, __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;

  /* "pysamstats/opt.pyx":1235
 *         BaseqStrandPpHelper helper
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.helper = BaseqStrandPpHelper()
 *         self.reset()
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysamstats.opt.BaseqStrand.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":1239
 *         self.reset()
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         self.helper.reset()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_11BaseqStrand_3reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pysamstats_3opt_11BaseqStrand_2reset[] = "BaseqStrand.reset(self)";
static PyObject *__pyx_pw_10pysamstats_3opt_11BaseqStrand_3reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reset (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_11BaseqStrand_2reset(((struct __pyx_obj_10pysamstats_3opt_BaseqStrand *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pysamstats_3opt_11BaseqStrand_2reset(struct __pyx_obj_10pysamstats_3opt_BaseqStrand *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("reset", 0);

  /* "pysamstats/opt.pyx":1240
 * 
 *     def reset(self):
 *         self.helper.reset()             # <<<<<<<<<<<<<<
 * 
 *     cdef void recv(self, bam_pileup1_t* read, PileupColumn col, bytes refbase):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->helper), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1240, __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, 1240, __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;

  /* "pysamstats/opt.pyx":1239
 *         self.reset()
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         self.helper.reset()
 * 
 */

  /* 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_AddTraceback("pysamstats.opt.BaseqStrand.reset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":1242
 *         self.helper.reset()
 * 
 *     cdef void recv(self, bam_pileup1_t* read, PileupColumn col, bytes refbase):             # <<<<<<<<<<<<<<
 *         cdef:
 *             uint32_t flag
 */

static void __pyx_f_10pysamstats_3opt_11BaseqStrand_recv(struct __pyx_obj_10pysamstats_3opt_BaseqStrand *__pyx_v_self, bam_pileup1_t *__pyx_v_read, CYTHON_UNUSED struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn *__pyx_v_col, CYTHON_UNUSED PyObject *__pyx_v_refbase) {
  uint32_t __pyx_v_flag;
  int __pyx_v_is_proper_pair;
  int __pyx_v_is_reverse;
  int64_t __pyx_v_baseq;
  int64_t __pyx_v_baseq_squared;
  __Pyx_RefNannyDeclarations
  uint16_t __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("recv", 0);

  /* "pysamstats/opt.pyx":1247
 *             bint is_proper_pair
 *             bint is_reverse
 *             int64_t baseq = -1             # <<<<<<<<<<<<<<
 *             int64_t baseq_squared = -1
 * 
 */
  __pyx_v_baseq = -1L;

  /* "pysamstats/opt.pyx":1248
 *             bint is_reverse
 *             int64_t baseq = -1
 *             int64_t baseq_squared = -1             # <<<<<<<<<<<<<<
 * 
 *         # convenience variables
 */
  __pyx_v_baseq_squared = -1L;

  /* "pysamstats/opt.pyx":1251
 * 
 *         # convenience variables
 *         flag = read.b.core.flag             # <<<<<<<<<<<<<<
 *         is_proper_pair = <bint>(flag & BAM_FPROPER_PAIR)
 *         is_reverse = <bint>(flag & BAM_FREVERSE)
 */
  __pyx_t_1 = __pyx_v_read->b->core.flag;
  __pyx_v_flag = __pyx_t_1;

  /* "pysamstats/opt.pyx":1252
 *         # convenience variables
 *         flag = read.b.core.flag
 *         is_proper_pair = <bint>(flag & BAM_FPROPER_PAIR)             # <<<<<<<<<<<<<<
 *         is_reverse = <bint>(flag & BAM_FREVERSE)
 * 
 */
  __pyx_v_is_proper_pair = ((__pyx_v_flag & 2) != 0);

  /* "pysamstats/opt.pyx":1253
 *         flag = read.b.core.flag
 *         is_proper_pair = <bint>(flag & BAM_FPROPER_PAIR)
 *         is_reverse = <bint>(flag & BAM_FREVERSE)             # <<<<<<<<<<<<<<
 * 
 *         # do the counting
 */
  __pyx_v_is_reverse = ((__pyx_v_flag & 16) != 0);

  /* "pysamstats/opt.pyx":1256
 * 
 *         # do the counting
 *         if not read.is_del:             # <<<<<<<<<<<<<<
 *             baseq = pysam_bam_get_qual(read.b)[read.qpos]
 *             baseq_squared = baseq**2
 */
  __pyx_t_2 = ((!(__pyx_v_read->is_del != 0)) != 0);
  if (__pyx_t_2) {

    /* "pysamstats/opt.pyx":1257
 *         # do the counting
 *         if not read.is_del:
 *             baseq = pysam_bam_get_qual(read.b)[read.qpos]             # <<<<<<<<<<<<<<
 *             baseq_squared = baseq**2
 * 
 */
    __pyx_v_baseq = (pysam_bam_get_qual(__pyx_v_read->b)[__pyx_v_read->qpos]);

    /* "pysamstats/opt.pyx":1258
 *         if not read.is_del:
 *             baseq = pysam_bam_get_qual(read.b)[read.qpos]
 *             baseq_squared = baseq**2             # <<<<<<<<<<<<<<
 * 
 *         self.helper.update(baseq_squared, is_proper_pair, is_reverse)
 */
    __pyx_v_baseq_squared = __Pyx_pow_int64_t(__pyx_v_baseq, 2);

    /* "pysamstats/opt.pyx":1256
 * 
 *         # do the counting
 *         if not read.is_del:             # <<<<<<<<<<<<<<
 *             baseq = pysam_bam_get_qual(read.b)[read.qpos]
 *             baseq_squared = baseq**2
 */
  }

  /* "pysamstats/opt.pyx":1260
 *             baseq_squared = baseq**2
 * 
 *         self.helper.update(baseq_squared, is_proper_pair, is_reverse)             # <<<<<<<<<<<<<<
 * 
 *     cdef dict rec(self, chrom, pos, FastaFile fafile, bytes refbase):
 */
  ((struct __pyx_vtabstruct_10pysamstats_3opt_BaseqStrandPpHelper *)__pyx_v_self->helper->__pyx_vtab)->update(__pyx_v_self->helper, __pyx_v_baseq_squared, __pyx_v_is_proper_pair, __pyx_v_is_reverse);

  /* "pysamstats/opt.pyx":1242
 *         self.helper.reset()
 * 
 *     cdef void recv(self, bam_pileup1_t* read, PileupColumn col, bytes refbase):             # <<<<<<<<<<<<<<
 *         cdef:
 *             uint32_t flag
 */

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

/* "pysamstats/opt.pyx":1262
 *         self.helper.update(baseq_squared, is_proper_pair, is_reverse)
 * 
 *     cdef dict rec(self, chrom, pos, FastaFile fafile, bytes refbase):             # <<<<<<<<<<<<<<
 * 
 *         # make record
 */

static PyObject *__pyx_f_10pysamstats_3opt_11BaseqStrand_rec(struct __pyx_obj_10pysamstats_3opt_BaseqStrand *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_chrom, CYTHON_UNUSED PyObject *__pyx_v_pos, CYTHON_UNUSED struct __pyx_obj_5pysam_9libcfaidx_FastaFile *__pyx_v_fafile, CYTHON_UNUSED PyObject *__pyx_v_refbase) {
  PyObject *__pyx_v_rec = 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;
  __Pyx_RefNannySetupContext("rec", 0);

  /* "pysamstats/opt.pyx":1266
 *         # make record
 *         rec = {
 *             'reads_all': self.helper.all.n,             # <<<<<<<<<<<<<<
 *             'reads_fwd': self.helper.fwd.n,
 *             'reads_rev': self.helper.rev.n,
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1266, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->helper->all->n); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1266, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_all, __pyx_t_2) < 0) __PYX_ERR(0, 1266, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":1267
 *         rec = {
 *             'reads_all': self.helper.all.n,
 *             'reads_fwd': self.helper.fwd.n,             # <<<<<<<<<<<<<<
 *             'reads_rev': self.helper.rev.n,
 *             'reads_pp': self.helper.pp.n,
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->helper->fwd->n); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1267, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_fwd, __pyx_t_2) < 0) __PYX_ERR(0, 1266, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":1268
 *             'reads_all': self.helper.all.n,
 *             'reads_fwd': self.helper.fwd.n,
 *             'reads_rev': self.helper.rev.n,             # <<<<<<<<<<<<<<
 *             'reads_pp': self.helper.pp.n,
 *             'reads_pp_fwd': self.helper.pp_fwd.n,
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->helper->rev->n); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1268, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_rev, __pyx_t_2) < 0) __PYX_ERR(0, 1266, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":1269
 *             'reads_fwd': self.helper.fwd.n,
 *             'reads_rev': self.helper.rev.n,
 *             'reads_pp': self.helper.pp.n,             # <<<<<<<<<<<<<<
 *             'reads_pp_fwd': self.helper.pp_fwd.n,
 *             'reads_pp_rev': self.helper.pp_rev.n,
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->helper->pp->n); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1269, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_pp, __pyx_t_2) < 0) __PYX_ERR(0, 1266, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":1270
 *             'reads_rev': self.helper.rev.n,
 *             'reads_pp': self.helper.pp.n,
 *             'reads_pp_fwd': self.helper.pp_fwd.n,             # <<<<<<<<<<<<<<
 *             'reads_pp_rev': self.helper.pp_rev.n,
 *             'rms_baseq': self.helper.all.rms(),
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->helper->pp_fwd->n); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1270, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_pp_fwd, __pyx_t_2) < 0) __PYX_ERR(0, 1266, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":1271
 *             'reads_pp': self.helper.pp.n,
 *             'reads_pp_fwd': self.helper.pp_fwd.n,
 *             'reads_pp_rev': self.helper.pp_rev.n,             # <<<<<<<<<<<<<<
 *             'rms_baseq': self.helper.all.rms(),
 *             'rms_baseq_fwd': self.helper.fwd.rms(),
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->helper->pp_rev->n); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1271, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_pp_rev, __pyx_t_2) < 0) __PYX_ERR(0, 1266, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":1272
 *             'reads_pp_fwd': self.helper.pp_fwd.n,
 *             'reads_pp_rev': self.helper.pp_rev.n,
 *             'rms_baseq': self.helper.all.rms(),             # <<<<<<<<<<<<<<
 *             'rms_baseq_fwd': self.helper.fwd.rms(),
 *             'rms_baseq_rev': self.helper.rev.rms(),
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->helper->all), __pyx_n_s_rms); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1272, __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_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1272, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_rms_baseq, __pyx_t_2) < 0) __PYX_ERR(0, 1266, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":1273
 *             'reads_pp_rev': self.helper.pp_rev.n,
 *             'rms_baseq': self.helper.all.rms(),
 *             'rms_baseq_fwd': self.helper.fwd.rms(),             # <<<<<<<<<<<<<<
 *             'rms_baseq_rev': self.helper.rev.rms(),
 *             'rms_baseq_pp': self.helper.pp.rms(),
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->helper->fwd), __pyx_n_s_rms); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1273, __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_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1273, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_rms_baseq_fwd, __pyx_t_2) < 0) __PYX_ERR(0, 1266, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":1274
 *             'rms_baseq': self.helper.all.rms(),
 *             'rms_baseq_fwd': self.helper.fwd.rms(),
 *             'rms_baseq_rev': self.helper.rev.rms(),             # <<<<<<<<<<<<<<
 *             'rms_baseq_pp': self.helper.pp.rms(),
 *             'rms_baseq_pp_fwd': self.helper.pp_fwd.rms(),
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->helper->rev), __pyx_n_s_rms); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1274, __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_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1274, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_rms_baseq_rev, __pyx_t_2) < 0) __PYX_ERR(0, 1266, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":1275
 *             'rms_baseq_fwd': self.helper.fwd.rms(),
 *             'rms_baseq_rev': self.helper.rev.rms(),
 *             'rms_baseq_pp': self.helper.pp.rms(),             # <<<<<<<<<<<<<<
 *             'rms_baseq_pp_fwd': self.helper.pp_fwd.rms(),
 *             'rms_baseq_pp_rev': self.helper.pp_rev.rms(),
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->helper->pp), __pyx_n_s_rms); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1275, __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_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1275, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_rms_baseq_pp, __pyx_t_2) < 0) __PYX_ERR(0, 1266, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":1276
 *             'rms_baseq_rev': self.helper.rev.rms(),
 *             'rms_baseq_pp': self.helper.pp.rms(),
 *             'rms_baseq_pp_fwd': self.helper.pp_fwd.rms(),             # <<<<<<<<<<<<<<
 *             'rms_baseq_pp_rev': self.helper.pp_rev.rms(),
 *         }
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->helper->pp_fwd), __pyx_n_s_rms); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1276, __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_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1276, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_rms_baseq_pp_fwd, __pyx_t_2) < 0) __PYX_ERR(0, 1266, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":1277
 *             'rms_baseq_pp': self.helper.pp.rms(),
 *             'rms_baseq_pp_fwd': self.helper.pp_fwd.rms(),
 *             'rms_baseq_pp_rev': self.helper.pp_rev.rms(),             # <<<<<<<<<<<<<<
 *         }
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->helper->pp_rev), __pyx_n_s_rms); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1277, __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_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1277, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_rms_baseq_pp_rev, __pyx_t_2) < 0) __PYX_ERR(0, 1266, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_rec = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1281
 * 
 *         # reset counters
 *         self.reset()             # <<<<<<<<<<<<<<
 * 
 *         return rec
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1281, __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, 1281, __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;

  /* "pysamstats/opt.pyx":1283
 *         self.reset()
 * 
 *         return rec             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_rec);
  __pyx_r = __pyx_v_rec;
  goto __pyx_L0;

  /* "pysamstats/opt.pyx":1262
 *         self.helper.update(baseq_squared, is_proper_pair, is_reverse)
 * 
 *     cdef dict rec(self, chrom, pos, FastaFile fafile, bytes refbase):             # <<<<<<<<<<<<<<
 * 
 *         # make record
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pysamstats.opt.BaseqStrand.rec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rec);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_11BaseqStrand_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pysamstats_3opt_11BaseqStrand_4__reduce_cython__[] = "BaseqStrand.__reduce_cython__(self)";
static PyObject *__pyx_pw_10pysamstats_3opt_11BaseqStrand_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_11BaseqStrand_4__reduce_cython__(((struct __pyx_obj_10pysamstats_3opt_BaseqStrand *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pysamstats_3opt_11BaseqStrand_4__reduce_cython__(struct __pyx_obj_10pysamstats_3opt_BaseqStrand *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  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;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self.helper,)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->helper));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->helper));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self->helper));
  __pyx_v_state = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self.helper,)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         state += (_dict,)
 */
  __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__dict = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":7
 *     state = (self.helper,)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
  __pyx_t_2 = (__pyx_v__dict != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
 */
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
    __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "(tree fragment)":9
 *     if _dict is not None:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = self.helper is not None
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = (self.helper,)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
    goto __pyx_L3;
  }

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = self.helper is not None             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_BaseqStrand, (type(self), 0xfde5d67, None), state
 */
  /*else*/ {
    __pyx_t_3 = (((PyObject *)__pyx_v_self->helper) != Py_None);
    __pyx_v_use_setstate = __pyx_t_3;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.helper is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_BaseqStrand, (type(self), 0xfde5d67, None), state
 *     else:
 */
  __pyx_t_3 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":13
 *         use_setstate = self.helper is not None
 *     if use_setstate:
 *         return __pyx_unpickle_BaseqStrand, (type(self), 0xfde5d67, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_BaseqStrand, (type(self), 0xfde5d67, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_BaseqStrand); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_266231143);
    __Pyx_GIVEREF(__pyx_int_266231143);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_266231143);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.helper is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_BaseqStrand, (type(self), 0xfde5d67, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_BaseqStrand, (type(self), 0xfde5d67, None), state
 *     else:
 *         return __pyx_unpickle_BaseqStrand, (type(self), 0xfde5d67, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_BaseqStrand__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_BaseqStrand); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_266231143);
    __Pyx_GIVEREF(__pyx_int_266231143);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_266231143);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
    __pyx_t_5 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pysamstats.opt.BaseqStrand.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_BaseqStrand, (type(self), 0xfde5d67, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_BaseqStrand__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_11BaseqStrand_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_10pysamstats_3opt_11BaseqStrand_6__setstate_cython__[] = "BaseqStrand.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_10pysamstats_3opt_11BaseqStrand_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_11BaseqStrand_6__setstate_cython__(((struct __pyx_obj_10pysamstats_3opt_BaseqStrand *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_10pysamstats_3opt_11BaseqStrand_6__setstate_cython__(struct __pyx_obj_10pysamstats_3opt_BaseqStrand *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_BaseqStrand, (type(self), 0xfde5d67, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_BaseqStrand__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
 */
  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_10pysamstats_3opt___pyx_unpickle_BaseqStrand__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_BaseqStrand, (type(self), 0xfde5d67, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_BaseqStrand__set_state(self, __pyx_state)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysamstats.opt.BaseqStrand.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":1299
 *         BaseqPpHelper mismatches
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.all = BaseqPpHelper()
 *         self.matches = BaseqPpHelper()
 */

/* Python wrapper */
static int __pyx_pw_10pysamstats_3opt_8BaseqExt_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_10pysamstats_3opt_8BaseqExt_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
  __pyx_r = __pyx_pf_10pysamstats_3opt_8BaseqExt___init__(((struct __pyx_obj_10pysamstats_3opt_BaseqExt *)__pyx_v_self));

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

static int __pyx_pf_10pysamstats_3opt_8BaseqExt___init__(struct __pyx_obj_10pysamstats_3opt_BaseqExt *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "pysamstats/opt.pyx":1300
 * 
 *     def __init__(self):
 *         self.all = BaseqPpHelper()             # <<<<<<<<<<<<<<
 *         self.matches = BaseqPpHelper()
 *         self.mismatches = BaseqPpHelper()
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_BaseqPpHelper)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1300, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->all);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->all));
  __pyx_v_self->all = ((struct __pyx_obj_10pysamstats_3opt_BaseqPpHelper *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1301
 *     def __init__(self):
 *         self.all = BaseqPpHelper()
 *         self.matches = BaseqPpHelper()             # <<<<<<<<<<<<<<
 *         self.mismatches = BaseqPpHelper()
 *         self.reset()
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_BaseqPpHelper)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1301, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->matches);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->matches));
  __pyx_v_self->matches = ((struct __pyx_obj_10pysamstats_3opt_BaseqPpHelper *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1302
 *         self.all = BaseqPpHelper()
 *         self.matches = BaseqPpHelper()
 *         self.mismatches = BaseqPpHelper()             # <<<<<<<<<<<<<<
 *         self.reset()
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_BaseqPpHelper)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1302, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->mismatches);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->mismatches));
  __pyx_v_self->mismatches = ((struct __pyx_obj_10pysamstats_3opt_BaseqPpHelper *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1303
 *         self.matches = BaseqPpHelper()
 *         self.mismatches = BaseqPpHelper()
 *         self.reset()             # <<<<<<<<<<<<<<
 * 
 *     def reset(self):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1303, __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, 1303, __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;

  /* "pysamstats/opt.pyx":1299
 *         BaseqPpHelper mismatches
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.all = BaseqPpHelper()
 *         self.matches = BaseqPpHelper()
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysamstats.opt.BaseqExt.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":1305
 *         self.reset()
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         self.all.reset()
 *         self.matches.reset()
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_8BaseqExt_3reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pysamstats_3opt_8BaseqExt_2reset[] = "BaseqExt.reset(self)";
static PyObject *__pyx_pw_10pysamstats_3opt_8BaseqExt_3reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reset (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_8BaseqExt_2reset(((struct __pyx_obj_10pysamstats_3opt_BaseqExt *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pysamstats_3opt_8BaseqExt_2reset(struct __pyx_obj_10pysamstats_3opt_BaseqExt *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("reset", 0);

  /* "pysamstats/opt.pyx":1306
 * 
 *     def reset(self):
 *         self.all.reset()             # <<<<<<<<<<<<<<
 *         self.matches.reset()
 *         self.mismatches.reset()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->all), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1306, __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, 1306, __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;

  /* "pysamstats/opt.pyx":1307
 *     def reset(self):
 *         self.all.reset()
 *         self.matches.reset()             # <<<<<<<<<<<<<<
 *         self.mismatches.reset()
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->matches), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1307, __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, 1307, __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;

  /* "pysamstats/opt.pyx":1308
 *         self.all.reset()
 *         self.matches.reset()
 *         self.mismatches.reset()             # <<<<<<<<<<<<<<
 * 
 *     cdef void recv(self, bam_pileup1_t* read, PileupColumn col, bytes refbase):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->mismatches), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1308, __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, 1308, __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;

  /* "pysamstats/opt.pyx":1305
 *         self.reset()
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         self.all.reset()
 *         self.matches.reset()
 */

  /* 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_AddTraceback("pysamstats.opt.BaseqExt.reset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":1310
 *         self.mismatches.reset()
 * 
 *     cdef void recv(self, bam_pileup1_t* read, PileupColumn col, bytes refbase):             # <<<<<<<<<<<<<<
 *         cdef:
 *             uint32_t flag
 */

static void __pyx_f_10pysamstats_3opt_8BaseqExt_recv(struct __pyx_obj_10pysamstats_3opt_BaseqExt *__pyx_v_self, bam_pileup1_t *__pyx_v_read, CYTHON_UNUSED struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn *__pyx_v_col, PyObject *__pyx_v_refbase) {
  uint32_t __pyx_v_flag;
  int __pyx_v_is_proper_pair;
  CYTHON_UNUSED int __pyx_v_is_reverse;
  int64_t __pyx_v_baseq;
  int64_t __pyx_v_baseq_squared;
  PyObject *__pyx_v_alnbase = 0;
  __Pyx_RefNannyDeclarations
  uint16_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("recv", 0);

  /* "pysamstats/opt.pyx":1315
 *             bint is_proper_pair
 *             bint is_reverse
 *             int64_t baseq = -1             # <<<<<<<<<<<<<<
 *             int64_t baseq_squared = -1
 *             bytes alnbase
 */
  __pyx_v_baseq = -1L;

  /* "pysamstats/opt.pyx":1316
 *             bint is_reverse
 *             int64_t baseq = -1
 *             int64_t baseq_squared = -1             # <<<<<<<<<<<<<<
 *             bytes alnbase
 * 
 */
  __pyx_v_baseq_squared = -1L;

  /* "pysamstats/opt.pyx":1320
 * 
 *         # convenience variables
 *         flag = read.b.core.flag             # <<<<<<<<<<<<<<
 *         is_proper_pair = <bint>(flag & BAM_FPROPER_PAIR)
 *         is_reverse = <bint>(flag & BAM_FREVERSE)
 */
  __pyx_t_1 = __pyx_v_read->b->core.flag;
  __pyx_v_flag = __pyx_t_1;

  /* "pysamstats/opt.pyx":1321
 *         # convenience variables
 *         flag = read.b.core.flag
 *         is_proper_pair = <bint>(flag & BAM_FPROPER_PAIR)             # <<<<<<<<<<<<<<
 *         is_reverse = <bint>(flag & BAM_FREVERSE)
 * 
 */
  __pyx_v_is_proper_pair = ((__pyx_v_flag & 2) != 0);

  /* "pysamstats/opt.pyx":1322
 *         flag = read.b.core.flag
 *         is_proper_pair = <bint>(flag & BAM_FPROPER_PAIR)
 *         is_reverse = <bint>(flag & BAM_FREVERSE)             # <<<<<<<<<<<<<<
 * 
 *         # do the counting
 */
  __pyx_v_is_reverse = ((__pyx_v_flag & 16) != 0);

  /* "pysamstats/opt.pyx":1325
 * 
 *         # do the counting
 *         if not read.is_del:             # <<<<<<<<<<<<<<
 *             baseq = pysam_bam_get_qual(read.b)[read.qpos]
 *             baseq_squared = baseq**2
 */
  __pyx_t_2 = ((!(__pyx_v_read->is_del != 0)) != 0);
  if (__pyx_t_2) {

    /* "pysamstats/opt.pyx":1326
 *         # do the counting
 *         if not read.is_del:
 *             baseq = pysam_bam_get_qual(read.b)[read.qpos]             # <<<<<<<<<<<<<<
 *             baseq_squared = baseq**2
 * 
 */
    __pyx_v_baseq = (pysam_bam_get_qual(__pyx_v_read->b)[__pyx_v_read->qpos]);

    /* "pysamstats/opt.pyx":1327
 *         if not read.is_del:
 *             baseq = pysam_bam_get_qual(read.b)[read.qpos]
 *             baseq_squared = baseq**2             # <<<<<<<<<<<<<<
 * 
 *         self.all.update(baseq_squared, is_proper_pair)
 */
    __pyx_v_baseq_squared = __Pyx_pow_int64_t(__pyx_v_baseq, 2);

    /* "pysamstats/opt.pyx":1325
 * 
 *         # do the counting
 *         if not read.is_del:             # <<<<<<<<<<<<<<
 *             baseq = pysam_bam_get_qual(read.b)[read.qpos]
 *             baseq_squared = baseq**2
 */
  }

  /* "pysamstats/opt.pyx":1329
 *             baseq_squared = baseq**2
 * 
 *         self.all.update(baseq_squared, is_proper_pair)             # <<<<<<<<<<<<<<
 *         if not read.is_del:
 *             alnbase = get_seq_base(read.b, read.qpos)
 */
  ((struct __pyx_vtabstruct_10pysamstats_3opt_BaseqPpHelper *)__pyx_v_self->all->__pyx_vtab)->update(__pyx_v_self->all, __pyx_v_baseq_squared, __pyx_v_is_proper_pair);

  /* "pysamstats/opt.pyx":1330
 * 
 *         self.all.update(baseq_squared, is_proper_pair)
 *         if not read.is_del:             # <<<<<<<<<<<<<<
 *             alnbase = get_seq_base(read.b, read.qpos)
 *             if alnbase == refbase:
 */
  __pyx_t_2 = ((!(__pyx_v_read->is_del != 0)) != 0);
  if (__pyx_t_2) {

    /* "pysamstats/opt.pyx":1331
 *         self.all.update(baseq_squared, is_proper_pair)
 *         if not read.is_del:
 *             alnbase = get_seq_base(read.b, read.qpos)             # <<<<<<<<<<<<<<
 *             if alnbase == refbase:
 *                 self.matches.update(baseq_squared, is_proper_pair)
 */
    __pyx_t_3 = __pyx_f_10pysamstats_3opt_get_seq_base(__pyx_v_read->b, __pyx_v_read->qpos); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1331, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(0, 1331, __pyx_L1_error)
    __pyx_v_alnbase = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "pysamstats/opt.pyx":1332
 *         if not read.is_del:
 *             alnbase = get_seq_base(read.b, read.qpos)
 *             if alnbase == refbase:             # <<<<<<<<<<<<<<
 *                 self.matches.update(baseq_squared, is_proper_pair)
 *             else:
 */
    __pyx_t_2 = (__Pyx_PyBytes_Equals(__pyx_v_alnbase, __pyx_v_refbase, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1332, __pyx_L1_error)
    __pyx_t_4 = (__pyx_t_2 != 0);
    if (__pyx_t_4) {

      /* "pysamstats/opt.pyx":1333
 *             alnbase = get_seq_base(read.b, read.qpos)
 *             if alnbase == refbase:
 *                 self.matches.update(baseq_squared, is_proper_pair)             # <<<<<<<<<<<<<<
 *             else:
 *                 self.mismatches.update(baseq_squared, is_proper_pair)
 */
      ((struct __pyx_vtabstruct_10pysamstats_3opt_BaseqPpHelper *)__pyx_v_self->matches->__pyx_vtab)->update(__pyx_v_self->matches, __pyx_v_baseq_squared, __pyx_v_is_proper_pair);

      /* "pysamstats/opt.pyx":1332
 *         if not read.is_del:
 *             alnbase = get_seq_base(read.b, read.qpos)
 *             if alnbase == refbase:             # <<<<<<<<<<<<<<
 *                 self.matches.update(baseq_squared, is_proper_pair)
 *             else:
 */
      goto __pyx_L5;
    }

    /* "pysamstats/opt.pyx":1335
 *                 self.matches.update(baseq_squared, is_proper_pair)
 *             else:
 *                 self.mismatches.update(baseq_squared, is_proper_pair)             # <<<<<<<<<<<<<<
 * 
 *     cdef dict rec(self, chrom, pos, FastaFile fafile, bytes refbase):
 */
    /*else*/ {
      ((struct __pyx_vtabstruct_10pysamstats_3opt_BaseqPpHelper *)__pyx_v_self->mismatches->__pyx_vtab)->update(__pyx_v_self->mismatches, __pyx_v_baseq_squared, __pyx_v_is_proper_pair);
    }
    __pyx_L5:;

    /* "pysamstats/opt.pyx":1330
 * 
 *         self.all.update(baseq_squared, is_proper_pair)
 *         if not read.is_del:             # <<<<<<<<<<<<<<
 *             alnbase = get_seq_base(read.b, read.qpos)
 *             if alnbase == refbase:
 */
  }

  /* "pysamstats/opt.pyx":1310
 *         self.mismatches.reset()
 * 
 *     cdef void recv(self, bam_pileup1_t* read, PileupColumn col, bytes refbase):             # <<<<<<<<<<<<<<
 *         cdef:
 *             uint32_t flag
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_WriteUnraisable("pysamstats.opt.BaseqExt.recv", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_alnbase);
  __Pyx_RefNannyFinishContext();
}

/* "pysamstats/opt.pyx":1337
 *                 self.mismatches.update(baseq_squared, is_proper_pair)
 * 
 *     cdef dict rec(self, chrom, pos, FastaFile fafile, bytes refbase):             # <<<<<<<<<<<<<<
 * 
 *         # make record
 */

static PyObject *__pyx_f_10pysamstats_3opt_8BaseqExt_rec(struct __pyx_obj_10pysamstats_3opt_BaseqExt *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_chrom, CYTHON_UNUSED PyObject *__pyx_v_pos, CYTHON_UNUSED struct __pyx_obj_5pysam_9libcfaidx_FastaFile *__pyx_v_fafile, PyObject *__pyx_v_refbase) {
  PyObject *__pyx_v_ref = NULL;
  PyObject *__pyx_v_rec = 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;
  __Pyx_RefNannySetupContext("rec", 0);

  /* "pysamstats/opt.pyx":1340
 * 
 *         # make record
 *         if PY2:             # <<<<<<<<<<<<<<
 *             ref = refbase
 *         else:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_PY2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1340, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1340, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "pysamstats/opt.pyx":1341
 *         # make record
 *         if PY2:
 *             ref = refbase             # <<<<<<<<<<<<<<
 *         else:
 *             ref = str(refbase, 'ascii')
 */
    __Pyx_INCREF(__pyx_v_refbase);
    __pyx_v_ref = __pyx_v_refbase;

    /* "pysamstats/opt.pyx":1340
 * 
 *         # make record
 *         if PY2:             # <<<<<<<<<<<<<<
 *             ref = refbase
 *         else:
 */
    goto __pyx_L3;
  }

  /* "pysamstats/opt.pyx":1343
 *             ref = refbase
 *         else:
 *             ref = str(refbase, 'ascii')             # <<<<<<<<<<<<<<
 *         rec = {
 *             'ref': ref,
 */
  /*else*/ {
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1343, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v_refbase);
    __Pyx_GIVEREF(__pyx_v_refbase);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_refbase);
    __Pyx_INCREF(__pyx_n_s_ascii);
    __Pyx_GIVEREF(__pyx_n_s_ascii);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_ascii);
    __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1343, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_ref = __pyx_t_3;
    __pyx_t_3 = 0;
  }
  __pyx_L3:;

  /* "pysamstats/opt.pyx":1345
 *             ref = str(refbase, 'ascii')
 *         rec = {
 *             'ref': ref,             # <<<<<<<<<<<<<<
 *             'reads_all': self.all.all.n,
 *             'reads_pp': self.all.pp.n,
 */
  __pyx_t_3 = __Pyx_PyDict_NewPresized(13); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1345, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_ref, __pyx_v_ref) < 0) __PYX_ERR(0, 1345, __pyx_L1_error)

  /* "pysamstats/opt.pyx":1346
 *         rec = {
 *             'ref': ref,
 *             'reads_all': self.all.all.n,             # <<<<<<<<<<<<<<
 *             'reads_pp': self.all.pp.n,
 *             'matches': self.matches.all.n,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->all->all->n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1346, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_reads_all, __pyx_t_1) < 0) __PYX_ERR(0, 1345, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1347
 *             'ref': ref,
 *             'reads_all': self.all.all.n,
 *             'reads_pp': self.all.pp.n,             # <<<<<<<<<<<<<<
 *             'matches': self.matches.all.n,
 *             'matches_pp': self.matches.pp.n,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->all->pp->n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1347, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_reads_pp, __pyx_t_1) < 0) __PYX_ERR(0, 1345, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1348
 *             'reads_all': self.all.all.n,
 *             'reads_pp': self.all.pp.n,
 *             'matches': self.matches.all.n,             # <<<<<<<<<<<<<<
 *             'matches_pp': self.matches.pp.n,
 *             'mismatches': self.mismatches.all.n,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->matches->all->n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1348, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_matches, __pyx_t_1) < 0) __PYX_ERR(0, 1345, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1349
 *             'reads_pp': self.all.pp.n,
 *             'matches': self.matches.all.n,
 *             'matches_pp': self.matches.pp.n,             # <<<<<<<<<<<<<<
 *             'mismatches': self.mismatches.all.n,
 *             'mismatches_pp': self.mismatches.pp.n,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->matches->pp->n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1349, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_matches_pp, __pyx_t_1) < 0) __PYX_ERR(0, 1345, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1350
 *             'matches': self.matches.all.n,
 *             'matches_pp': self.matches.pp.n,
 *             'mismatches': self.mismatches.all.n,             # <<<<<<<<<<<<<<
 *             'mismatches_pp': self.mismatches.pp.n,
 *             'rms_baseq': self.all.all.rms(),
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->mismatches->all->n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1350, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_mismatches, __pyx_t_1) < 0) __PYX_ERR(0, 1345, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1351
 *             'matches_pp': self.matches.pp.n,
 *             'mismatches': self.mismatches.all.n,
 *             'mismatches_pp': self.mismatches.pp.n,             # <<<<<<<<<<<<<<
 *             'rms_baseq': self.all.all.rms(),
 *             'rms_baseq_pp': self.all.pp.rms(),
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->mismatches->pp->n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1351, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_mismatches_pp, __pyx_t_1) < 0) __PYX_ERR(0, 1345, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1352
 *             'mismatches': self.mismatches.all.n,
 *             'mismatches_pp': self.mismatches.pp.n,
 *             'rms_baseq': self.all.all.rms(),             # <<<<<<<<<<<<<<
 *             'rms_baseq_pp': self.all.pp.rms(),
 *             'rms_baseq_matches': self.matches.all.rms(),
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->all->all), __pyx_n_s_rms); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1352, __pyx_L1_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_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1352, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_rms_baseq, __pyx_t_1) < 0) __PYX_ERR(0, 1345, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1353
 *             'mismatches_pp': self.mismatches.pp.n,
 *             'rms_baseq': self.all.all.rms(),
 *             'rms_baseq_pp': self.all.pp.rms(),             # <<<<<<<<<<<<<<
 *             'rms_baseq_matches': self.matches.all.rms(),
 *             'rms_baseq_matches_pp': self.matches.pp.rms(),
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->all->pp), __pyx_n_s_rms); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1353, __pyx_L1_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_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1353, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_rms_baseq_pp, __pyx_t_1) < 0) __PYX_ERR(0, 1345, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1354
 *             'rms_baseq': self.all.all.rms(),
 *             'rms_baseq_pp': self.all.pp.rms(),
 *             'rms_baseq_matches': self.matches.all.rms(),             # <<<<<<<<<<<<<<
 *             'rms_baseq_matches_pp': self.matches.pp.rms(),
 *             'rms_baseq_mismatches': self.mismatches.all.rms(),
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->matches->all), __pyx_n_s_rms); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1354, __pyx_L1_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_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1354, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_rms_baseq_matches, __pyx_t_1) < 0) __PYX_ERR(0, 1345, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1355
 *             'rms_baseq_pp': self.all.pp.rms(),
 *             'rms_baseq_matches': self.matches.all.rms(),
 *             'rms_baseq_matches_pp': self.matches.pp.rms(),             # <<<<<<<<<<<<<<
 *             'rms_baseq_mismatches': self.mismatches.all.rms(),
 *             'rms_baseq_mismatches_pp': self.mismatches.pp.rms(),
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->matches->pp), __pyx_n_s_rms); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1355, __pyx_L1_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_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1355, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_rms_baseq_matches_pp, __pyx_t_1) < 0) __PYX_ERR(0, 1345, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1356
 *             'rms_baseq_matches': self.matches.all.rms(),
 *             'rms_baseq_matches_pp': self.matches.pp.rms(),
 *             'rms_baseq_mismatches': self.mismatches.all.rms(),             # <<<<<<<<<<<<<<
 *             'rms_baseq_mismatches_pp': self.mismatches.pp.rms(),
 *         }
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->mismatches->all), __pyx_n_s_rms); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1356, __pyx_L1_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_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1356, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_rms_baseq_mismatches, __pyx_t_1) < 0) __PYX_ERR(0, 1345, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1357
 *             'rms_baseq_matches_pp': self.matches.pp.rms(),
 *             'rms_baseq_mismatches': self.mismatches.all.rms(),
 *             'rms_baseq_mismatches_pp': self.mismatches.pp.rms(),             # <<<<<<<<<<<<<<
 *         }
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->mismatches->pp), __pyx_n_s_rms); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1357, __pyx_L1_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_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1357, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_rms_baseq_mismatches_pp, __pyx_t_1) < 0) __PYX_ERR(0, 1345, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_rec = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pysamstats/opt.pyx":1361
 * 
 *         # reset counters
 *         self.reset()             # <<<<<<<<<<<<<<
 * 
 *         return rec
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reset); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1361, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(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_CallOneArg(__pyx_t_1, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1361, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pysamstats/opt.pyx":1363
 *         self.reset()
 * 
 *         return rec             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_rec);
  __pyx_r = __pyx_v_rec;
  goto __pyx_L0;

  /* "pysamstats/opt.pyx":1337
 *                 self.mismatches.update(baseq_squared, is_proper_pair)
 * 
 *     cdef dict rec(self, chrom, pos, FastaFile fafile, bytes refbase):             # <<<<<<<<<<<<<<
 * 
 *         # make record
 */

  /* 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_AddTraceback("pysamstats.opt.BaseqExt.rec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ref);
  __Pyx_XDECREF(__pyx_v_rec);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_8BaseqExt_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pysamstats_3opt_8BaseqExt_4__reduce_cython__[] = "BaseqExt.__reduce_cython__(self)";
static PyObject *__pyx_pw_10pysamstats_3opt_8BaseqExt_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_8BaseqExt_4__reduce_cython__(((struct __pyx_obj_10pysamstats_3opt_BaseqExt *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pysamstats_3opt_8BaseqExt_4__reduce_cython__(struct __pyx_obj_10pysamstats_3opt_BaseqExt *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self.all, self.matches, self.mismatches)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->all));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->all));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self->all));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->matches));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->matches));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self->matches));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->mismatches));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->mismatches));
  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_self->mismatches));
  __pyx_v_state = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self.all, self.matches, self.mismatches)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         state += (_dict,)
 */
  __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__dict = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":7
 *     state = (self.all, self.matches, self.mismatches)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
  __pyx_t_2 = (__pyx_v__dict != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
 */
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
    __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "(tree fragment)":9
 *     if _dict is not None:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = self.all is not None or self.matches is not None or self.mismatches is not None
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = (self.all, self.matches, self.mismatches)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
    goto __pyx_L3;
  }

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = self.all is not None or self.matches is not None or self.mismatches is not None             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_BaseqExt, (type(self), 0xbc518eb, None), state
 */
  /*else*/ {
    __pyx_t_2 = (((PyObject *)__pyx_v_self->all) != Py_None);
    __pyx_t_5 = (__pyx_t_2 != 0);
    if (!__pyx_t_5) {
    } else {
      __pyx_t_3 = __pyx_t_5;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_5 = (((PyObject *)__pyx_v_self->matches) != Py_None);
    __pyx_t_2 = (__pyx_t_5 != 0);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_3 = __pyx_t_2;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_2 = (((PyObject *)__pyx_v_self->mismatches) != Py_None);
    __pyx_t_5 = (__pyx_t_2 != 0);
    __pyx_t_3 = __pyx_t_5;
    __pyx_L4_bool_binop_done:;
    __pyx_v_use_setstate = __pyx_t_3;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.all is not None or self.matches is not None or self.mismatches is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_BaseqExt, (type(self), 0xbc518eb, None), state
 *     else:
 */
  __pyx_t_3 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":13
 *         use_setstate = self.all is not None or self.matches is not None or self.mismatches is not None
 *     if use_setstate:
 *         return __pyx_unpickle_BaseqExt, (type(self), 0xbc518eb, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_BaseqExt, (type(self), 0xbc518eb, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_BaseqExt); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_197466347);
    __Pyx_GIVEREF(__pyx_int_197466347);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_197466347);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
    __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_state);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.all is not None or self.matches is not None or self.mismatches is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_BaseqExt, (type(self), 0xbc518eb, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_BaseqExt, (type(self), 0xbc518eb, None), state
 *     else:
 *         return __pyx_unpickle_BaseqExt, (type(self), 0xbc518eb, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_BaseqExt__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_pyx_unpickle_BaseqExt); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_197466347);
    __Pyx_GIVEREF(__pyx_int_197466347);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_197466347);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
    __pyx_t_6 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pysamstats.opt.BaseqExt.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_BaseqExt, (type(self), 0xbc518eb, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_BaseqExt__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_8BaseqExt_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_10pysamstats_3opt_8BaseqExt_6__setstate_cython__[] = "BaseqExt.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_10pysamstats_3opt_8BaseqExt_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_8BaseqExt_6__setstate_cython__(((struct __pyx_obj_10pysamstats_3opt_BaseqExt *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_10pysamstats_3opt_8BaseqExt_6__setstate_cython__(struct __pyx_obj_10pysamstats_3opt_BaseqExt *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_BaseqExt, (type(self), 0xbc518eb, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_BaseqExt__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
 */
  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_10pysamstats_3opt___pyx_unpickle_BaseqExt__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_BaseqExt, (type(self), 0xbc518eb, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_BaseqExt__set_state(self, __pyx_state)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysamstats.opt.BaseqExt.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":1374
 *         BaseqStrandPpHelper mismatches
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.all = BaseqStrandPpHelper()
 *         self.matches = BaseqStrandPpHelper()
 */

/* Python wrapper */
static int __pyx_pw_10pysamstats_3opt_14BaseqExtStrand_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_10pysamstats_3opt_14BaseqExtStrand_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
  __pyx_r = __pyx_pf_10pysamstats_3opt_14BaseqExtStrand___init__(((struct __pyx_obj_10pysamstats_3opt_BaseqExtStrand *)__pyx_v_self));

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

static int __pyx_pf_10pysamstats_3opt_14BaseqExtStrand___init__(struct __pyx_obj_10pysamstats_3opt_BaseqExtStrand *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "pysamstats/opt.pyx":1375
 * 
 *     def __init__(self):
 *         self.all = BaseqStrandPpHelper()             # <<<<<<<<<<<<<<
 *         self.matches = BaseqStrandPpHelper()
 *         self.mismatches = BaseqStrandPpHelper()
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_BaseqStrandPpHelper)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1375, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->all);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->all));
  __pyx_v_self->all = ((struct __pyx_obj_10pysamstats_3opt_BaseqStrandPpHelper *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1376
 *     def __init__(self):
 *         self.all = BaseqStrandPpHelper()
 *         self.matches = BaseqStrandPpHelper()             # <<<<<<<<<<<<<<
 *         self.mismatches = BaseqStrandPpHelper()
 *         self.reset()
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_BaseqStrandPpHelper)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1376, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->matches);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->matches));
  __pyx_v_self->matches = ((struct __pyx_obj_10pysamstats_3opt_BaseqStrandPpHelper *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1377
 *         self.all = BaseqStrandPpHelper()
 *         self.matches = BaseqStrandPpHelper()
 *         self.mismatches = BaseqStrandPpHelper()             # <<<<<<<<<<<<<<
 *         self.reset()
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_BaseqStrandPpHelper)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1377, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->mismatches);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->mismatches));
  __pyx_v_self->mismatches = ((struct __pyx_obj_10pysamstats_3opt_BaseqStrandPpHelper *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1378
 *         self.matches = BaseqStrandPpHelper()
 *         self.mismatches = BaseqStrandPpHelper()
 *         self.reset()             # <<<<<<<<<<<<<<
 * 
 *     def reset(self):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1378, __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, 1378, __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;

  /* "pysamstats/opt.pyx":1374
 *         BaseqStrandPpHelper mismatches
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.all = BaseqStrandPpHelper()
 *         self.matches = BaseqStrandPpHelper()
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysamstats.opt.BaseqExtStrand.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":1380
 *         self.reset()
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         self.all.reset()
 *         self.matches.reset()
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_14BaseqExtStrand_3reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pysamstats_3opt_14BaseqExtStrand_2reset[] = "BaseqExtStrand.reset(self)";
static PyObject *__pyx_pw_10pysamstats_3opt_14BaseqExtStrand_3reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reset (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_14BaseqExtStrand_2reset(((struct __pyx_obj_10pysamstats_3opt_BaseqExtStrand *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pysamstats_3opt_14BaseqExtStrand_2reset(struct __pyx_obj_10pysamstats_3opt_BaseqExtStrand *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("reset", 0);

  /* "pysamstats/opt.pyx":1381
 * 
 *     def reset(self):
 *         self.all.reset()             # <<<<<<<<<<<<<<
 *         self.matches.reset()
 *         self.mismatches.reset()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->all), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1381, __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, 1381, __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;

  /* "pysamstats/opt.pyx":1382
 *     def reset(self):
 *         self.all.reset()
 *         self.matches.reset()             # <<<<<<<<<<<<<<
 *         self.mismatches.reset()
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->matches), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1382, __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, 1382, __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;

  /* "pysamstats/opt.pyx":1383
 *         self.all.reset()
 *         self.matches.reset()
 *         self.mismatches.reset()             # <<<<<<<<<<<<<<
 * 
 *     cdef void recv(self, bam_pileup1_t* read, PileupColumn col, bytes refbase):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->mismatches), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1383, __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, 1383, __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;

  /* "pysamstats/opt.pyx":1380
 *         self.reset()
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         self.all.reset()
 *         self.matches.reset()
 */

  /* 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_AddTraceback("pysamstats.opt.BaseqExtStrand.reset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":1385
 *         self.mismatches.reset()
 * 
 *     cdef void recv(self, bam_pileup1_t* read, PileupColumn col, bytes refbase):             # <<<<<<<<<<<<<<
 *         cdef:
 *             uint32_t flag
 */

static void __pyx_f_10pysamstats_3opt_14BaseqExtStrand_recv(struct __pyx_obj_10pysamstats_3opt_BaseqExtStrand *__pyx_v_self, bam_pileup1_t *__pyx_v_read, CYTHON_UNUSED struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn *__pyx_v_col, PyObject *__pyx_v_refbase) {
  uint32_t __pyx_v_flag;
  int __pyx_v_is_proper_pair;
  int __pyx_v_is_reverse;
  int64_t __pyx_v_baseq;
  int64_t __pyx_v_baseq_squared;
  PyObject *__pyx_v_alnbase = 0;
  __Pyx_RefNannyDeclarations
  uint16_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("recv", 0);

  /* "pysamstats/opt.pyx":1390
 *             bint is_proper_pair
 *             bint is_reverse
 *             int64_t baseq = -1             # <<<<<<<<<<<<<<
 *             int64_t baseq_squared = -1
 *             bytes alnbase
 */
  __pyx_v_baseq = -1L;

  /* "pysamstats/opt.pyx":1391
 *             bint is_reverse
 *             int64_t baseq = -1
 *             int64_t baseq_squared = -1             # <<<<<<<<<<<<<<
 *             bytes alnbase
 * 
 */
  __pyx_v_baseq_squared = -1L;

  /* "pysamstats/opt.pyx":1395
 * 
 *         # convenience variables
 *         flag = read.b.core.flag             # <<<<<<<<<<<<<<
 *         is_proper_pair = <bint>(flag & BAM_FPROPER_PAIR)
 *         is_reverse = <bint>(flag & BAM_FREVERSE)
 */
  __pyx_t_1 = __pyx_v_read->b->core.flag;
  __pyx_v_flag = __pyx_t_1;

  /* "pysamstats/opt.pyx":1396
 *         # convenience variables
 *         flag = read.b.core.flag
 *         is_proper_pair = <bint>(flag & BAM_FPROPER_PAIR)             # <<<<<<<<<<<<<<
 *         is_reverse = <bint>(flag & BAM_FREVERSE)
 * 
 */
  __pyx_v_is_proper_pair = ((__pyx_v_flag & 2) != 0);

  /* "pysamstats/opt.pyx":1397
 *         flag = read.b.core.flag
 *         is_proper_pair = <bint>(flag & BAM_FPROPER_PAIR)
 *         is_reverse = <bint>(flag & BAM_FREVERSE)             # <<<<<<<<<<<<<<
 * 
 *         # do the counting
 */
  __pyx_v_is_reverse = ((__pyx_v_flag & 16) != 0);

  /* "pysamstats/opt.pyx":1400
 * 
 *         # do the counting
 *         if not read.is_del:             # <<<<<<<<<<<<<<
 *             baseq = pysam_bam_get_qual(read.b)[read.qpos]
 *             baseq_squared = baseq**2
 */
  __pyx_t_2 = ((!(__pyx_v_read->is_del != 0)) != 0);
  if (__pyx_t_2) {

    /* "pysamstats/opt.pyx":1401
 *         # do the counting
 *         if not read.is_del:
 *             baseq = pysam_bam_get_qual(read.b)[read.qpos]             # <<<<<<<<<<<<<<
 *             baseq_squared = baseq**2
 * 
 */
    __pyx_v_baseq = (pysam_bam_get_qual(__pyx_v_read->b)[__pyx_v_read->qpos]);

    /* "pysamstats/opt.pyx":1402
 *         if not read.is_del:
 *             baseq = pysam_bam_get_qual(read.b)[read.qpos]
 *             baseq_squared = baseq**2             # <<<<<<<<<<<<<<
 * 
 *         self.all.update(baseq_squared, is_proper_pair, is_reverse)
 */
    __pyx_v_baseq_squared = __Pyx_pow_int64_t(__pyx_v_baseq, 2);

    /* "pysamstats/opt.pyx":1400
 * 
 *         # do the counting
 *         if not read.is_del:             # <<<<<<<<<<<<<<
 *             baseq = pysam_bam_get_qual(read.b)[read.qpos]
 *             baseq_squared = baseq**2
 */
  }

  /* "pysamstats/opt.pyx":1404
 *             baseq_squared = baseq**2
 * 
 *         self.all.update(baseq_squared, is_proper_pair, is_reverse)             # <<<<<<<<<<<<<<
 *         if not read.is_del:
 *             alnbase = get_seq_base(read.b, read.qpos)
 */
  ((struct __pyx_vtabstruct_10pysamstats_3opt_BaseqStrandPpHelper *)__pyx_v_self->all->__pyx_vtab)->update(__pyx_v_self->all, __pyx_v_baseq_squared, __pyx_v_is_proper_pair, __pyx_v_is_reverse);

  /* "pysamstats/opt.pyx":1405
 * 
 *         self.all.update(baseq_squared, is_proper_pair, is_reverse)
 *         if not read.is_del:             # <<<<<<<<<<<<<<
 *             alnbase = get_seq_base(read.b, read.qpos)
 *             if alnbase == refbase:
 */
  __pyx_t_2 = ((!(__pyx_v_read->is_del != 0)) != 0);
  if (__pyx_t_2) {

    /* "pysamstats/opt.pyx":1406
 *         self.all.update(baseq_squared, is_proper_pair, is_reverse)
 *         if not read.is_del:
 *             alnbase = get_seq_base(read.b, read.qpos)             # <<<<<<<<<<<<<<
 *             if alnbase == refbase:
 *                 self.matches.update(baseq_squared, is_proper_pair, is_reverse)
 */
    __pyx_t_3 = __pyx_f_10pysamstats_3opt_get_seq_base(__pyx_v_read->b, __pyx_v_read->qpos); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1406, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(0, 1406, __pyx_L1_error)
    __pyx_v_alnbase = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "pysamstats/opt.pyx":1407
 *         if not read.is_del:
 *             alnbase = get_seq_base(read.b, read.qpos)
 *             if alnbase == refbase:             # <<<<<<<<<<<<<<
 *                 self.matches.update(baseq_squared, is_proper_pair, is_reverse)
 *             else:
 */
    __pyx_t_2 = (__Pyx_PyBytes_Equals(__pyx_v_alnbase, __pyx_v_refbase, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1407, __pyx_L1_error)
    __pyx_t_4 = (__pyx_t_2 != 0);
    if (__pyx_t_4) {

      /* "pysamstats/opt.pyx":1408
 *             alnbase = get_seq_base(read.b, read.qpos)
 *             if alnbase == refbase:
 *                 self.matches.update(baseq_squared, is_proper_pair, is_reverse)             # <<<<<<<<<<<<<<
 *             else:
 *                 self.mismatches.update(baseq_squared, is_proper_pair, is_reverse)
 */
      ((struct __pyx_vtabstruct_10pysamstats_3opt_BaseqStrandPpHelper *)__pyx_v_self->matches->__pyx_vtab)->update(__pyx_v_self->matches, __pyx_v_baseq_squared, __pyx_v_is_proper_pair, __pyx_v_is_reverse);

      /* "pysamstats/opt.pyx":1407
 *         if not read.is_del:
 *             alnbase = get_seq_base(read.b, read.qpos)
 *             if alnbase == refbase:             # <<<<<<<<<<<<<<
 *                 self.matches.update(baseq_squared, is_proper_pair, is_reverse)
 *             else:
 */
      goto __pyx_L5;
    }

    /* "pysamstats/opt.pyx":1410
 *                 self.matches.update(baseq_squared, is_proper_pair, is_reverse)
 *             else:
 *                 self.mismatches.update(baseq_squared, is_proper_pair, is_reverse)             # <<<<<<<<<<<<<<
 * 
 *     cdef dict rec(self, chrom, pos, FastaFile fafile, bytes refbase):
 */
    /*else*/ {
      ((struct __pyx_vtabstruct_10pysamstats_3opt_BaseqStrandPpHelper *)__pyx_v_self->mismatches->__pyx_vtab)->update(__pyx_v_self->mismatches, __pyx_v_baseq_squared, __pyx_v_is_proper_pair, __pyx_v_is_reverse);
    }
    __pyx_L5:;

    /* "pysamstats/opt.pyx":1405
 * 
 *         self.all.update(baseq_squared, is_proper_pair, is_reverse)
 *         if not read.is_del:             # <<<<<<<<<<<<<<
 *             alnbase = get_seq_base(read.b, read.qpos)
 *             if alnbase == refbase:
 */
  }

  /* "pysamstats/opt.pyx":1385
 *         self.mismatches.reset()
 * 
 *     cdef void recv(self, bam_pileup1_t* read, PileupColumn col, bytes refbase):             # <<<<<<<<<<<<<<
 *         cdef:
 *             uint32_t flag
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_WriteUnraisable("pysamstats.opt.BaseqExtStrand.recv", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_alnbase);
  __Pyx_RefNannyFinishContext();
}

/* "pysamstats/opt.pyx":1412
 *                 self.mismatches.update(baseq_squared, is_proper_pair, is_reverse)
 * 
 *     cdef dict rec(self, chrom, pos, FastaFile fafile, bytes refbase):             # <<<<<<<<<<<<<<
 * 
 *         # make record
 */

static PyObject *__pyx_f_10pysamstats_3opt_14BaseqExtStrand_rec(struct __pyx_obj_10pysamstats_3opt_BaseqExtStrand *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_chrom, CYTHON_UNUSED PyObject *__pyx_v_pos, CYTHON_UNUSED struct __pyx_obj_5pysam_9libcfaidx_FastaFile *__pyx_v_fafile, PyObject *__pyx_v_refbase) {
  PyObject *__pyx_v_ref = NULL;
  PyObject *__pyx_v_rec = 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;
  __Pyx_RefNannySetupContext("rec", 0);

  /* "pysamstats/opt.pyx":1415
 * 
 *         # make record
 *         if PY2:             # <<<<<<<<<<<<<<
 *             ref = refbase
 *         else:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_PY2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1415, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1415, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "pysamstats/opt.pyx":1416
 *         # make record
 *         if PY2:
 *             ref = refbase             # <<<<<<<<<<<<<<
 *         else:
 *             ref = str(refbase, 'ascii')
 */
    __Pyx_INCREF(__pyx_v_refbase);
    __pyx_v_ref = __pyx_v_refbase;

    /* "pysamstats/opt.pyx":1415
 * 
 *         # make record
 *         if PY2:             # <<<<<<<<<<<<<<
 *             ref = refbase
 *         else:
 */
    goto __pyx_L3;
  }

  /* "pysamstats/opt.pyx":1418
 *             ref = refbase
 *         else:
 *             ref = str(refbase, 'ascii')             # <<<<<<<<<<<<<<
 *         rec = {
 *             'ref': ref,
 */
  /*else*/ {
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1418, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v_refbase);
    __Pyx_GIVEREF(__pyx_v_refbase);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_refbase);
    __Pyx_INCREF(__pyx_n_s_ascii);
    __Pyx_GIVEREF(__pyx_n_s_ascii);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_ascii);
    __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1418, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_ref = __pyx_t_3;
    __pyx_t_3 = 0;
  }
  __pyx_L3:;

  /* "pysamstats/opt.pyx":1420
 *             ref = str(refbase, 'ascii')
 *         rec = {
 *             'ref': ref,             # <<<<<<<<<<<<<<
 *             'reads_all': self.all.all.n,
 *             'reads_fwd': self.all.fwd.n,
 */
  __pyx_t_3 = __Pyx_PyDict_NewPresized(37); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1420, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_ref, __pyx_v_ref) < 0) __PYX_ERR(0, 1420, __pyx_L1_error)

  /* "pysamstats/opt.pyx":1421
 *         rec = {
 *             'ref': ref,
 *             'reads_all': self.all.all.n,             # <<<<<<<<<<<<<<
 *             'reads_fwd': self.all.fwd.n,
 *             'reads_rev': self.all.rev.n,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->all->all->n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1421, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_reads_all, __pyx_t_1) < 0) __PYX_ERR(0, 1420, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1422
 *             'ref': ref,
 *             'reads_all': self.all.all.n,
 *             'reads_fwd': self.all.fwd.n,             # <<<<<<<<<<<<<<
 *             'reads_rev': self.all.rev.n,
 *             'reads_pp': self.all.pp.n,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->all->fwd->n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1422, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_reads_fwd, __pyx_t_1) < 0) __PYX_ERR(0, 1420, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1423
 *             'reads_all': self.all.all.n,
 *             'reads_fwd': self.all.fwd.n,
 *             'reads_rev': self.all.rev.n,             # <<<<<<<<<<<<<<
 *             'reads_pp': self.all.pp.n,
 *             'reads_pp_fwd': self.all.pp_fwd.n,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->all->rev->n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1423, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_reads_rev, __pyx_t_1) < 0) __PYX_ERR(0, 1420, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1424
 *             'reads_fwd': self.all.fwd.n,
 *             'reads_rev': self.all.rev.n,
 *             'reads_pp': self.all.pp.n,             # <<<<<<<<<<<<<<
 *             'reads_pp_fwd': self.all.pp_fwd.n,
 *             'reads_pp_rev': self.all.pp_rev.n,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->all->pp->n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1424, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_reads_pp, __pyx_t_1) < 0) __PYX_ERR(0, 1420, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1425
 *             'reads_rev': self.all.rev.n,
 *             'reads_pp': self.all.pp.n,
 *             'reads_pp_fwd': self.all.pp_fwd.n,             # <<<<<<<<<<<<<<
 *             'reads_pp_rev': self.all.pp_rev.n,
 *             'matches': self.matches.all.n,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->all->pp_fwd->n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1425, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_reads_pp_fwd, __pyx_t_1) < 0) __PYX_ERR(0, 1420, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1426
 *             'reads_pp': self.all.pp.n,
 *             'reads_pp_fwd': self.all.pp_fwd.n,
 *             'reads_pp_rev': self.all.pp_rev.n,             # <<<<<<<<<<<<<<
 *             'matches': self.matches.all.n,
 *             'matches_fwd': self.matches.fwd.n,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->all->pp_rev->n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1426, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_reads_pp_rev, __pyx_t_1) < 0) __PYX_ERR(0, 1420, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1427
 *             'reads_pp_fwd': self.all.pp_fwd.n,
 *             'reads_pp_rev': self.all.pp_rev.n,
 *             'matches': self.matches.all.n,             # <<<<<<<<<<<<<<
 *             'matches_fwd': self.matches.fwd.n,
 *             'matches_rev': self.matches.rev.n,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->matches->all->n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1427, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_matches, __pyx_t_1) < 0) __PYX_ERR(0, 1420, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1428
 *             'reads_pp_rev': self.all.pp_rev.n,
 *             'matches': self.matches.all.n,
 *             'matches_fwd': self.matches.fwd.n,             # <<<<<<<<<<<<<<
 *             'matches_rev': self.matches.rev.n,
 *             'matches_pp': self.matches.pp.n,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->matches->fwd->n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1428, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_matches_fwd, __pyx_t_1) < 0) __PYX_ERR(0, 1420, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1429
 *             'matches': self.matches.all.n,
 *             'matches_fwd': self.matches.fwd.n,
 *             'matches_rev': self.matches.rev.n,             # <<<<<<<<<<<<<<
 *             'matches_pp': self.matches.pp.n,
 *             'matches_pp_fwd': self.matches.pp_fwd.n,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->matches->rev->n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1429, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_matches_rev, __pyx_t_1) < 0) __PYX_ERR(0, 1420, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1430
 *             'matches_fwd': self.matches.fwd.n,
 *             'matches_rev': self.matches.rev.n,
 *             'matches_pp': self.matches.pp.n,             # <<<<<<<<<<<<<<
 *             'matches_pp_fwd': self.matches.pp_fwd.n,
 *             'matches_pp_rev': self.matches.pp_rev.n,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->matches->pp->n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1430, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_matches_pp, __pyx_t_1) < 0) __PYX_ERR(0, 1420, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1431
 *             'matches_rev': self.matches.rev.n,
 *             'matches_pp': self.matches.pp.n,
 *             'matches_pp_fwd': self.matches.pp_fwd.n,             # <<<<<<<<<<<<<<
 *             'matches_pp_rev': self.matches.pp_rev.n,
 *             'mismatches': self.mismatches.all.n,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->matches->pp_fwd->n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1431, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_matches_pp_fwd, __pyx_t_1) < 0) __PYX_ERR(0, 1420, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1432
 *             'matches_pp': self.matches.pp.n,
 *             'matches_pp_fwd': self.matches.pp_fwd.n,
 *             'matches_pp_rev': self.matches.pp_rev.n,             # <<<<<<<<<<<<<<
 *             'mismatches': self.mismatches.all.n,
 *             'mismatches_fwd': self.mismatches.fwd.n,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->matches->pp_rev->n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1432, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_matches_pp_rev, __pyx_t_1) < 0) __PYX_ERR(0, 1420, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1433
 *             'matches_pp_fwd': self.matches.pp_fwd.n,
 *             'matches_pp_rev': self.matches.pp_rev.n,
 *             'mismatches': self.mismatches.all.n,             # <<<<<<<<<<<<<<
 *             'mismatches_fwd': self.mismatches.fwd.n,
 *             'mismatches_rev': self.mismatches.rev.n,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->mismatches->all->n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1433, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_mismatches, __pyx_t_1) < 0) __PYX_ERR(0, 1420, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1434
 *             'matches_pp_rev': self.matches.pp_rev.n,
 *             'mismatches': self.mismatches.all.n,
 *             'mismatches_fwd': self.mismatches.fwd.n,             # <<<<<<<<<<<<<<
 *             'mismatches_rev': self.mismatches.rev.n,
 *             'mismatches_pp': self.mismatches.pp.n,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->mismatches->fwd->n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1434, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_mismatches_fwd, __pyx_t_1) < 0) __PYX_ERR(0, 1420, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1435
 *             'mismatches': self.mismatches.all.n,
 *             'mismatches_fwd': self.mismatches.fwd.n,
 *             'mismatches_rev': self.mismatches.rev.n,             # <<<<<<<<<<<<<<
 *             'mismatches_pp': self.mismatches.pp.n,
 *             'mismatches_pp_fwd': self.mismatches.pp_fwd.n,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->mismatches->rev->n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1435, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_mismatches_rev, __pyx_t_1) < 0) __PYX_ERR(0, 1420, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1436
 *             'mismatches_fwd': self.mismatches.fwd.n,
 *             'mismatches_rev': self.mismatches.rev.n,
 *             'mismatches_pp': self.mismatches.pp.n,             # <<<<<<<<<<<<<<
 *             'mismatches_pp_fwd': self.mismatches.pp_fwd.n,
 *             'mismatches_pp_rev': self.mismatches.pp_rev.n,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->mismatches->pp->n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1436, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_mismatches_pp, __pyx_t_1) < 0) __PYX_ERR(0, 1420, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1437
 *             'mismatches_rev': self.mismatches.rev.n,
 *             'mismatches_pp': self.mismatches.pp.n,
 *             'mismatches_pp_fwd': self.mismatches.pp_fwd.n,             # <<<<<<<<<<<<<<
 *             'mismatches_pp_rev': self.mismatches.pp_rev.n,
 *             'rms_baseq': self.all.all.rms(),
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->mismatches->pp_fwd->n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1437, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_mismatches_pp_fwd, __pyx_t_1) < 0) __PYX_ERR(0, 1420, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1438
 *             'mismatches_pp': self.mismatches.pp.n,
 *             'mismatches_pp_fwd': self.mismatches.pp_fwd.n,
 *             'mismatches_pp_rev': self.mismatches.pp_rev.n,             # <<<<<<<<<<<<<<
 *             'rms_baseq': self.all.all.rms(),
 *             'rms_baseq_fwd': self.all.fwd.rms(),
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->mismatches->pp_rev->n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1438, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_mismatches_pp_rev, __pyx_t_1) < 0) __PYX_ERR(0, 1420, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1439
 *             'mismatches_pp_fwd': self.mismatches.pp_fwd.n,
 *             'mismatches_pp_rev': self.mismatches.pp_rev.n,
 *             'rms_baseq': self.all.all.rms(),             # <<<<<<<<<<<<<<
 *             'rms_baseq_fwd': self.all.fwd.rms(),
 *             'rms_baseq_rev': self.all.rev.rms(),
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->all->all), __pyx_n_s_rms); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1439, __pyx_L1_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_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1439, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_rms_baseq, __pyx_t_1) < 0) __PYX_ERR(0, 1420, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1440
 *             'mismatches_pp_rev': self.mismatches.pp_rev.n,
 *             'rms_baseq': self.all.all.rms(),
 *             'rms_baseq_fwd': self.all.fwd.rms(),             # <<<<<<<<<<<<<<
 *             'rms_baseq_rev': self.all.rev.rms(),
 *             'rms_baseq_pp': self.all.pp.rms(),
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->all->fwd), __pyx_n_s_rms); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1440, __pyx_L1_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_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1440, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_rms_baseq_fwd, __pyx_t_1) < 0) __PYX_ERR(0, 1420, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1441
 *             'rms_baseq': self.all.all.rms(),
 *             'rms_baseq_fwd': self.all.fwd.rms(),
 *             'rms_baseq_rev': self.all.rev.rms(),             # <<<<<<<<<<<<<<
 *             'rms_baseq_pp': self.all.pp.rms(),
 *             'rms_baseq_pp_fwd': self.all.pp_fwd.rms(),
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->all->rev), __pyx_n_s_rms); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1441, __pyx_L1_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_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1441, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_rms_baseq_rev, __pyx_t_1) < 0) __PYX_ERR(0, 1420, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1442
 *             'rms_baseq_fwd': self.all.fwd.rms(),
 *             'rms_baseq_rev': self.all.rev.rms(),
 *             'rms_baseq_pp': self.all.pp.rms(),             # <<<<<<<<<<<<<<
 *             'rms_baseq_pp_fwd': self.all.pp_fwd.rms(),
 *             'rms_baseq_pp_rev': self.all.pp_rev.rms(),
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->all->pp), __pyx_n_s_rms); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1442, __pyx_L1_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_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1442, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_rms_baseq_pp, __pyx_t_1) < 0) __PYX_ERR(0, 1420, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1443
 *             'rms_baseq_rev': self.all.rev.rms(),
 *             'rms_baseq_pp': self.all.pp.rms(),
 *             'rms_baseq_pp_fwd': self.all.pp_fwd.rms(),             # <<<<<<<<<<<<<<
 *             'rms_baseq_pp_rev': self.all.pp_rev.rms(),
 *             'rms_baseq_matches': self.matches.all.rms(),
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->all->pp_fwd), __pyx_n_s_rms); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1443, __pyx_L1_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_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1443, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_rms_baseq_pp_fwd, __pyx_t_1) < 0) __PYX_ERR(0, 1420, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1444
 *             'rms_baseq_pp': self.all.pp.rms(),
 *             'rms_baseq_pp_fwd': self.all.pp_fwd.rms(),
 *             'rms_baseq_pp_rev': self.all.pp_rev.rms(),             # <<<<<<<<<<<<<<
 *             'rms_baseq_matches': self.matches.all.rms(),
 *             'rms_baseq_matches_fwd': self.matches.fwd.rms(),
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->all->pp_rev), __pyx_n_s_rms); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1444, __pyx_L1_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_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1444, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_rms_baseq_pp_rev, __pyx_t_1) < 0) __PYX_ERR(0, 1420, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1445
 *             'rms_baseq_pp_fwd': self.all.pp_fwd.rms(),
 *             'rms_baseq_pp_rev': self.all.pp_rev.rms(),
 *             'rms_baseq_matches': self.matches.all.rms(),             # <<<<<<<<<<<<<<
 *             'rms_baseq_matches_fwd': self.matches.fwd.rms(),
 *             'rms_baseq_matches_rev': self.matches.rev.rms(),
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->matches->all), __pyx_n_s_rms); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1445, __pyx_L1_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_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1445, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_rms_baseq_matches, __pyx_t_1) < 0) __PYX_ERR(0, 1420, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1446
 *             'rms_baseq_pp_rev': self.all.pp_rev.rms(),
 *             'rms_baseq_matches': self.matches.all.rms(),
 *             'rms_baseq_matches_fwd': self.matches.fwd.rms(),             # <<<<<<<<<<<<<<
 *             'rms_baseq_matches_rev': self.matches.rev.rms(),
 *             'rms_baseq_matches_pp': self.matches.pp.rms(),
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->matches->fwd), __pyx_n_s_rms); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1446, __pyx_L1_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_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1446, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_rms_baseq_matches_fwd, __pyx_t_1) < 0) __PYX_ERR(0, 1420, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1447
 *             'rms_baseq_matches': self.matches.all.rms(),
 *             'rms_baseq_matches_fwd': self.matches.fwd.rms(),
 *             'rms_baseq_matches_rev': self.matches.rev.rms(),             # <<<<<<<<<<<<<<
 *             'rms_baseq_matches_pp': self.matches.pp.rms(),
 *             'rms_baseq_matches_pp_fwd': self.matches.pp_fwd.rms(),
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->matches->rev), __pyx_n_s_rms); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1447, __pyx_L1_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_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1447, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_rms_baseq_matches_rev, __pyx_t_1) < 0) __PYX_ERR(0, 1420, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1448
 *             'rms_baseq_matches_fwd': self.matches.fwd.rms(),
 *             'rms_baseq_matches_rev': self.matches.rev.rms(),
 *             'rms_baseq_matches_pp': self.matches.pp.rms(),             # <<<<<<<<<<<<<<
 *             'rms_baseq_matches_pp_fwd': self.matches.pp_fwd.rms(),
 *             'rms_baseq_matches_pp_rev': self.matches.pp_rev.rms(),
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->matches->pp), __pyx_n_s_rms); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1448, __pyx_L1_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_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1448, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_rms_baseq_matches_pp, __pyx_t_1) < 0) __PYX_ERR(0, 1420, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1449
 *             'rms_baseq_matches_rev': self.matches.rev.rms(),
 *             'rms_baseq_matches_pp': self.matches.pp.rms(),
 *             'rms_baseq_matches_pp_fwd': self.matches.pp_fwd.rms(),             # <<<<<<<<<<<<<<
 *             'rms_baseq_matches_pp_rev': self.matches.pp_rev.rms(),
 *             'rms_baseq_mismatches': self.mismatches.all.rms(),
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->matches->pp_fwd), __pyx_n_s_rms); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1449, __pyx_L1_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_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1449, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_rms_baseq_matches_pp_fwd, __pyx_t_1) < 0) __PYX_ERR(0, 1420, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1450
 *             'rms_baseq_matches_pp': self.matches.pp.rms(),
 *             'rms_baseq_matches_pp_fwd': self.matches.pp_fwd.rms(),
 *             'rms_baseq_matches_pp_rev': self.matches.pp_rev.rms(),             # <<<<<<<<<<<<<<
 *             'rms_baseq_mismatches': self.mismatches.all.rms(),
 *             'rms_baseq_mismatches_fwd': self.mismatches.fwd.rms(),
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->matches->pp_rev), __pyx_n_s_rms); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1450, __pyx_L1_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_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1450, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_rms_baseq_matches_pp_rev, __pyx_t_1) < 0) __PYX_ERR(0, 1420, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1451
 *             'rms_baseq_matches_pp_fwd': self.matches.pp_fwd.rms(),
 *             'rms_baseq_matches_pp_rev': self.matches.pp_rev.rms(),
 *             'rms_baseq_mismatches': self.mismatches.all.rms(),             # <<<<<<<<<<<<<<
 *             'rms_baseq_mismatches_fwd': self.mismatches.fwd.rms(),
 *             'rms_baseq_mismatches_rev': self.mismatches.rev.rms(),
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->mismatches->all), __pyx_n_s_rms); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1451, __pyx_L1_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_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1451, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_rms_baseq_mismatches, __pyx_t_1) < 0) __PYX_ERR(0, 1420, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1452
 *             'rms_baseq_matches_pp_rev': self.matches.pp_rev.rms(),
 *             'rms_baseq_mismatches': self.mismatches.all.rms(),
 *             'rms_baseq_mismatches_fwd': self.mismatches.fwd.rms(),             # <<<<<<<<<<<<<<
 *             'rms_baseq_mismatches_rev': self.mismatches.rev.rms(),
 *             'rms_baseq_mismatches_pp': self.mismatches.pp.rms(),
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->mismatches->fwd), __pyx_n_s_rms); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1452, __pyx_L1_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_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1452, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_rms_baseq_mismatches_fwd, __pyx_t_1) < 0) __PYX_ERR(0, 1420, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1453
 *             'rms_baseq_mismatches': self.mismatches.all.rms(),
 *             'rms_baseq_mismatches_fwd': self.mismatches.fwd.rms(),
 *             'rms_baseq_mismatches_rev': self.mismatches.rev.rms(),             # <<<<<<<<<<<<<<
 *             'rms_baseq_mismatches_pp': self.mismatches.pp.rms(),
 *             'rms_baseq_mismatches_pp_fwd': self.mismatches.pp_fwd.rms(),
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->mismatches->rev), __pyx_n_s_rms); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1453, __pyx_L1_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_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1453, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_rms_baseq_mismatches_rev, __pyx_t_1) < 0) __PYX_ERR(0, 1420, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1454
 *             'rms_baseq_mismatches_fwd': self.mismatches.fwd.rms(),
 *             'rms_baseq_mismatches_rev': self.mismatches.rev.rms(),
 *             'rms_baseq_mismatches_pp': self.mismatches.pp.rms(),             # <<<<<<<<<<<<<<
 *             'rms_baseq_mismatches_pp_fwd': self.mismatches.pp_fwd.rms(),
 *             'rms_baseq_mismatches_pp_rev': self.mismatches.pp_rev.rms(),
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->mismatches->pp), __pyx_n_s_rms); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1454, __pyx_L1_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_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1454, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_rms_baseq_mismatches_pp, __pyx_t_1) < 0) __PYX_ERR(0, 1420, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1455
 *             'rms_baseq_mismatches_rev': self.mismatches.rev.rms(),
 *             'rms_baseq_mismatches_pp': self.mismatches.pp.rms(),
 *             'rms_baseq_mismatches_pp_fwd': self.mismatches.pp_fwd.rms(),             # <<<<<<<<<<<<<<
 *             'rms_baseq_mismatches_pp_rev': self.mismatches.pp_rev.rms(),
 *         }
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->mismatches->pp_fwd), __pyx_n_s_rms); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1455, __pyx_L1_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_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1455, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_rms_baseq_mismatches_pp_fwd, __pyx_t_1) < 0) __PYX_ERR(0, 1420, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1456
 *             'rms_baseq_mismatches_pp': self.mismatches.pp.rms(),
 *             'rms_baseq_mismatches_pp_fwd': self.mismatches.pp_fwd.rms(),
 *             'rms_baseq_mismatches_pp_rev': self.mismatches.pp_rev.rms(),             # <<<<<<<<<<<<<<
 *         }
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->mismatches->pp_rev), __pyx_n_s_rms); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1456, __pyx_L1_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_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1456, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_rms_baseq_mismatches_pp_rev, __pyx_t_1) < 0) __PYX_ERR(0, 1420, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_rec = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pysamstats/opt.pyx":1460
 * 
 *         # reset counters
 *         self.reset()             # <<<<<<<<<<<<<<
 * 
 *         return rec
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reset); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1460, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(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_CallOneArg(__pyx_t_1, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1460, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pysamstats/opt.pyx":1462
 *         self.reset()
 * 
 *         return rec             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_rec);
  __pyx_r = __pyx_v_rec;
  goto __pyx_L0;

  /* "pysamstats/opt.pyx":1412
 *                 self.mismatches.update(baseq_squared, is_proper_pair, is_reverse)
 * 
 *     cdef dict rec(self, chrom, pos, FastaFile fafile, bytes refbase):             # <<<<<<<<<<<<<<
 * 
 *         # make record
 */

  /* 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_AddTraceback("pysamstats.opt.BaseqExtStrand.rec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ref);
  __Pyx_XDECREF(__pyx_v_rec);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_14BaseqExtStrand_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pysamstats_3opt_14BaseqExtStrand_4__reduce_cython__[] = "BaseqExtStrand.__reduce_cython__(self)";
static PyObject *__pyx_pw_10pysamstats_3opt_14BaseqExtStrand_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_14BaseqExtStrand_4__reduce_cython__(((struct __pyx_obj_10pysamstats_3opt_BaseqExtStrand *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pysamstats_3opt_14BaseqExtStrand_4__reduce_cython__(struct __pyx_obj_10pysamstats_3opt_BaseqExtStrand *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self.all, self.matches, self.mismatches)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->all));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->all));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self->all));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->matches));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->matches));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self->matches));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->mismatches));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->mismatches));
  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_self->mismatches));
  __pyx_v_state = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self.all, self.matches, self.mismatches)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         state += (_dict,)
 */
  __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__dict = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":7
 *     state = (self.all, self.matches, self.mismatches)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
  __pyx_t_2 = (__pyx_v__dict != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
 */
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
    __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "(tree fragment)":9
 *     if _dict is not None:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = self.all is not None or self.matches is not None or self.mismatches is not None
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = (self.all, self.matches, self.mismatches)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
    goto __pyx_L3;
  }

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = self.all is not None or self.matches is not None or self.mismatches is not None             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_BaseqExtStrand, (type(self), 0xbc518eb, None), state
 */
  /*else*/ {
    __pyx_t_2 = (((PyObject *)__pyx_v_self->all) != Py_None);
    __pyx_t_5 = (__pyx_t_2 != 0);
    if (!__pyx_t_5) {
    } else {
      __pyx_t_3 = __pyx_t_5;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_5 = (((PyObject *)__pyx_v_self->matches) != Py_None);
    __pyx_t_2 = (__pyx_t_5 != 0);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_3 = __pyx_t_2;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_2 = (((PyObject *)__pyx_v_self->mismatches) != Py_None);
    __pyx_t_5 = (__pyx_t_2 != 0);
    __pyx_t_3 = __pyx_t_5;
    __pyx_L4_bool_binop_done:;
    __pyx_v_use_setstate = __pyx_t_3;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.all is not None or self.matches is not None or self.mismatches is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_BaseqExtStrand, (type(self), 0xbc518eb, None), state
 *     else:
 */
  __pyx_t_3 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":13
 *         use_setstate = self.all is not None or self.matches is not None or self.mismatches is not None
 *     if use_setstate:
 *         return __pyx_unpickle_BaseqExtStrand, (type(self), 0xbc518eb, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_BaseqExtStrand, (type(self), 0xbc518eb, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_BaseqExtStrand); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_197466347);
    __Pyx_GIVEREF(__pyx_int_197466347);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_197466347);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
    __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_state);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.all is not None or self.matches is not None or self.mismatches is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_BaseqExtStrand, (type(self), 0xbc518eb, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_BaseqExtStrand, (type(self), 0xbc518eb, None), state
 *     else:
 *         return __pyx_unpickle_BaseqExtStrand, (type(self), 0xbc518eb, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_BaseqExtStrand__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_pyx_unpickle_BaseqExtStrand); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_197466347);
    __Pyx_GIVEREF(__pyx_int_197466347);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_197466347);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
    __pyx_t_6 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pysamstats.opt.BaseqExtStrand.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_BaseqExtStrand, (type(self), 0xbc518eb, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_BaseqExtStrand__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_14BaseqExtStrand_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_10pysamstats_3opt_14BaseqExtStrand_6__setstate_cython__[] = "BaseqExtStrand.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_10pysamstats_3opt_14BaseqExtStrand_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_14BaseqExtStrand_6__setstate_cython__(((struct __pyx_obj_10pysamstats_3opt_BaseqExtStrand *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_10pysamstats_3opt_14BaseqExtStrand_6__setstate_cython__(struct __pyx_obj_10pysamstats_3opt_BaseqExtStrand *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_BaseqExtStrand, (type(self), 0xbc518eb, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_BaseqExtStrand__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
 */
  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_10pysamstats_3opt___pyx_unpickle_BaseqExtStrand__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_BaseqExtStrand, (type(self), 0xbc518eb, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_BaseqExtStrand__set_state(self, __pyx_state)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysamstats.opt.BaseqExtStrand.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":1477
 *         int window_size, window_offset
 * 
 *     def __init__(self, window_size, window_offset):             # <<<<<<<<<<<<<<
 *         self.window_size = window_size
 *         if window_offset is None:
 */

/* Python wrapper */
static int __pyx_pw_10pysamstats_3opt_10CoverageGC_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_10pysamstats_3opt_10CoverageGC_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_window_size = 0;
  PyObject *__pyx_v_window_offset = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_window_size,&__pyx_n_s_window_offset,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_window_size)) != 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_window_offset)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 1477, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 1477, __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_window_size = values[0];
    __pyx_v_window_offset = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1477, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysamstats.opt.CoverageGC.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_10pysamstats_3opt_10CoverageGC___init__(((struct __pyx_obj_10pysamstats_3opt_CoverageGC *)__pyx_v_self), __pyx_v_window_size, __pyx_v_window_offset);

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

static int __pyx_pf_10pysamstats_3opt_10CoverageGC___init__(struct __pyx_obj_10pysamstats_3opt_CoverageGC *__pyx_v_self, PyObject *__pyx_v_window_size, PyObject *__pyx_v_window_offset) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_INCREF(__pyx_v_window_offset);

  /* "pysamstats/opt.pyx":1478
 * 
 *     def __init__(self, window_size, window_offset):
 *         self.window_size = window_size             # <<<<<<<<<<<<<<
 *         if window_offset is None:
 *             window_offset = window_size // 2
 */
  __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_window_size); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1478, __pyx_L1_error)
  __pyx_v_self->window_size = __pyx_t_1;

  /* "pysamstats/opt.pyx":1479
 *     def __init__(self, window_size, window_offset):
 *         self.window_size = window_size
 *         if window_offset is None:             # <<<<<<<<<<<<<<
 *             window_offset = window_size // 2
 *         self.window_offset = window_offset
 */
  __pyx_t_2 = (__pyx_v_window_offset == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "pysamstats/opt.pyx":1480
 *         self.window_size = window_size
 *         if window_offset is None:
 *             window_offset = window_size // 2             # <<<<<<<<<<<<<<
 *         self.window_offset = window_offset
 *         self.reads = CountPp()
 */
    __pyx_t_4 = __Pyx_PyInt_FloorDivideObjC(__pyx_v_window_size, __pyx_int_2, 2, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1480, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v_window_offset, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "pysamstats/opt.pyx":1479
 *     def __init__(self, window_size, window_offset):
 *         self.window_size = window_size
 *         if window_offset is None:             # <<<<<<<<<<<<<<
 *             window_offset = window_size // 2
 *         self.window_offset = window_offset
 */
  }

  /* "pysamstats/opt.pyx":1481
 *         if window_offset is None:
 *             window_offset = window_size // 2
 *         self.window_offset = window_offset             # <<<<<<<<<<<<<<
 *         self.reads = CountPp()
 *         self.reset()
 */
  __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_window_offset); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1481, __pyx_L1_error)
  __pyx_v_self->window_offset = __pyx_t_1;

  /* "pysamstats/opt.pyx":1482
 *             window_offset = window_size // 2
 *         self.window_offset = window_offset
 *         self.reads = CountPp()             # <<<<<<<<<<<<<<
 *         self.reset()
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pysamstats_3opt_CountPp)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1482, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_GOTREF(__pyx_v_self->reads);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->reads));
  __pyx_v_self->reads = ((struct __pyx_obj_10pysamstats_3opt_CountPp *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "pysamstats/opt.pyx":1483
 *         self.window_offset = window_offset
 *         self.reads = CountPp()
 *         self.reset()             # <<<<<<<<<<<<<<
 * 
 *     def reset(self):
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reset); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1483, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1483, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysamstats/opt.pyx":1477
 *         int window_size, window_offset
 * 
 *     def __init__(self, window_size, window_offset):             # <<<<<<<<<<<<<<
 *         self.window_size = window_size
 *         if window_offset is None:
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pysamstats.opt.CoverageGC.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_window_offset);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":1485
 *         self.reset()
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         self.reads.reset()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_10CoverageGC_3reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pysamstats_3opt_10CoverageGC_2reset[] = "CoverageGC.reset(self)";
static PyObject *__pyx_pw_10pysamstats_3opt_10CoverageGC_3reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reset (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_10CoverageGC_2reset(((struct __pyx_obj_10pysamstats_3opt_CoverageGC *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pysamstats_3opt_10CoverageGC_2reset(struct __pyx_obj_10pysamstats_3opt_CoverageGC *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("reset", 0);

  /* "pysamstats/opt.pyx":1486
 * 
 *     def reset(self):
 *         self.reads.reset()             # <<<<<<<<<<<<<<
 * 
 *     cdef void recv(self, bam_pileup1_t* read, PileupColumn col, bytes refbase):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->reads), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1486, __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, 1486, __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;

  /* "pysamstats/opt.pyx":1485
 *         self.reset()
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         self.reads.reset()
 * 
 */

  /* 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_AddTraceback("pysamstats.opt.CoverageGC.reset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":1488
 *         self.reads.reset()
 * 
 *     cdef void recv(self, bam_pileup1_t* read, PileupColumn col, bytes refbase):             # <<<<<<<<<<<<<<
 *         cdef:
 *             bint is_proper_pair
 */

static void __pyx_f_10pysamstats_3opt_10CoverageGC_recv(struct __pyx_obj_10pysamstats_3opt_CoverageGC *__pyx_v_self, bam_pileup1_t *__pyx_v_read, CYTHON_UNUSED struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn *__pyx_v_col, CYTHON_UNUSED PyObject *__pyx_v_refbase) {
  int __pyx_v_is_proper_pair;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("recv", 0);

  /* "pysamstats/opt.pyx":1493
 * 
 *         # convenience variables
 *         is_proper_pair = <bint>(read.b.core.flag & BAM_FPROPER_PAIR)             # <<<<<<<<<<<<<<
 * 
 *         # do the counting
 */
  __pyx_v_is_proper_pair = ((__pyx_v_read->b->core.flag & 2) != 0);

  /* "pysamstats/opt.pyx":1496
 * 
 *         # do the counting
 *         self.reads.incr(is_proper_pair)             # <<<<<<<<<<<<<<
 * 
 *     cdef dict rec(self, chrom, pos, FastaFile fafile, bytes refbase):
 */
  ((struct __pyx_vtabstruct_10pysamstats_3opt_CountPp *)__pyx_v_self->reads->__pyx_vtab)->incr(__pyx_v_self->reads, __pyx_v_is_proper_pair);

  /* "pysamstats/opt.pyx":1488
 *         self.reads.reset()
 * 
 *     cdef void recv(self, bam_pileup1_t* read, PileupColumn col, bytes refbase):             # <<<<<<<<<<<<<<
 *         cdef:
 *             bint is_proper_pair
 */

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

/* "pysamstats/opt.pyx":1498
 *         self.reads.incr(is_proper_pair)
 * 
 *     cdef dict rec(self, chrom, pos, FastaFile fafile, bytes refbase):             # <<<<<<<<<<<<<<
 * 
 *         # compute GC
 */

static PyObject *__pyx_f_10pysamstats_3opt_10CoverageGC_rec(struct __pyx_obj_10pysamstats_3opt_CoverageGC *__pyx_v_self, PyObject *__pyx_v_chrom, PyObject *__pyx_v_pos, struct __pyx_obj_5pysam_9libcfaidx_FastaFile *__pyx_v_fafile, CYTHON_UNUSED PyObject *__pyx_v_refbase) {
  PyObject *__pyx_v_ref_window_start = NULL;
  PyObject *__pyx_v_ref_window_end = NULL;
  PyObject *__pyx_v_ref_window = NULL;
  long __pyx_v_gc;
  PyObject *__pyx_v_rec = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  Py_ssize_t __pyx_t_8;
  __Pyx_RefNannySetupContext("rec", 0);

  /* "pysamstats/opt.pyx":1501
 * 
 *         # compute GC
 *         ref_window_start = pos - self.window_offset             # <<<<<<<<<<<<<<
 *         ref_window_end = ref_window_start + self.window_size
 *         if ref_window_start < 0:
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->window_offset); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1501, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyNumber_Subtract(__pyx_v_pos, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1501, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_ref_window_start = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":1502
 *         # compute GC
 *         ref_window_start = pos - self.window_offset
 *         ref_window_end = ref_window_start + self.window_size             # <<<<<<<<<<<<<<
 *         if ref_window_start < 0:
 *             ref_window_start = 0
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->window_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1502, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyNumber_Add(__pyx_v_ref_window_start, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1502, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_ref_window_end = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1503
 *         ref_window_start = pos - self.window_offset
 *         ref_window_end = ref_window_start + self.window_size
 *         if ref_window_start < 0:             # <<<<<<<<<<<<<<
 *             ref_window_start = 0
 *         ref_window = fafile.fetch(chrom, ref_window_start, ref_window_end).lower()
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_ref_window_start, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1503, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1503, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_3) {

    /* "pysamstats/opt.pyx":1504
 *         ref_window_end = ref_window_start + self.window_size
 *         if ref_window_start < 0:
 *             ref_window_start = 0             # <<<<<<<<<<<<<<
 *         ref_window = fafile.fetch(chrom, ref_window_start, ref_window_end).lower()
 *         if len(ref_window) == 0:
 */
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_DECREF_SET(__pyx_v_ref_window_start, __pyx_int_0);

    /* "pysamstats/opt.pyx":1503
 *         ref_window_start = pos - self.window_offset
 *         ref_window_end = ref_window_start + self.window_size
 *         if ref_window_start < 0:             # <<<<<<<<<<<<<<
 *             ref_window_start = 0
 *         ref_window = fafile.fetch(chrom, ref_window_start, ref_window_end).lower()
 */
  }

  /* "pysamstats/opt.pyx":1505
 *         if ref_window_start < 0:
 *             ref_window_start = 0
 *         ref_window = fafile.fetch(chrom, ref_window_start, ref_window_end).lower()             # <<<<<<<<<<<<<<
 *         if len(ref_window) == 0:
 *             gc = -1
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_fafile), __pyx_n_s_fetch); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1505, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  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_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_v_chrom, __pyx_v_ref_window_start, __pyx_v_ref_window_end};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1505, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_v_chrom, __pyx_v_ref_window_start, __pyx_v_ref_window_end};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1505, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1505, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_INCREF(__pyx_v_chrom);
    __Pyx_GIVEREF(__pyx_v_chrom);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_chrom);
    __Pyx_INCREF(__pyx_v_ref_window_start);
    __Pyx_GIVEREF(__pyx_v_ref_window_start);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_ref_window_start);
    __Pyx_INCREF(__pyx_v_ref_window_end);
    __Pyx_GIVEREF(__pyx_v_ref_window_end);
    PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_v_ref_window_end);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1505, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_lower); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1505, __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_CallOneArg(__pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1505, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_ref_window = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1506
 *             ref_window_start = 0
 *         ref_window = fafile.fetch(chrom, ref_window_start, ref_window_end).lower()
 *         if len(ref_window) == 0:             # <<<<<<<<<<<<<<
 *             gc = -1
 *         else:
 */
  __pyx_t_8 = PyObject_Length(__pyx_v_ref_window); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1506, __pyx_L1_error)
  __pyx_t_3 = ((__pyx_t_8 == 0) != 0);
  if (__pyx_t_3) {

    /* "pysamstats/opt.pyx":1507
 *         ref_window = fafile.fetch(chrom, ref_window_start, ref_window_end).lower()
 *         if len(ref_window) == 0:
 *             gc = -1             # <<<<<<<<<<<<<<
 *         else:
 *             gc = gc_content(ref_window)
 */
    __pyx_v_gc = -1L;

    /* "pysamstats/opt.pyx":1506
 *             ref_window_start = 0
 *         ref_window = fafile.fetch(chrom, ref_window_start, ref_window_end).lower()
 *         if len(ref_window) == 0:             # <<<<<<<<<<<<<<
 *             gc = -1
 *         else:
 */
    goto __pyx_L4;
  }

  /* "pysamstats/opt.pyx":1509
 *             gc = -1
 *         else:
 *             gc = gc_content(ref_window)             # <<<<<<<<<<<<<<
 * 
 *         # make record
 */
  /*else*/ {
    __pyx_t_6 = __pyx_f_10pysamstats_3opt_gc_content(__pyx_v_ref_window); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 1509, __pyx_L1_error)
    __pyx_v_gc = __pyx_t_6;
  }
  __pyx_L4:;

  /* "pysamstats/opt.pyx":1512
 * 
 *         # make record
 *         rec = {'reads_all': self.reads.all,             # <<<<<<<<<<<<<<
 *                'reads_pp': self.reads.pp,
 *                'gc': gc}
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1512, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_self->reads->all); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1512, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_all, __pyx_t_4) < 0) __PYX_ERR(0, 1512, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysamstats/opt.pyx":1513
 *         # make record
 *         rec = {'reads_all': self.reads.all,
 *                'reads_pp': self.reads.pp,             # <<<<<<<<<<<<<<
 *                'gc': gc}
 * 
 */
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_self->reads->pp); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1513, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_pp, __pyx_t_4) < 0) __PYX_ERR(0, 1512, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysamstats/opt.pyx":1514
 *         rec = {'reads_all': self.reads.all,
 *                'reads_pp': self.reads.pp,
 *                'gc': gc}             # <<<<<<<<<<<<<<
 * 
 *         # reset counters
 */
  __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_v_gc); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1514, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_gc, __pyx_t_4) < 0) __PYX_ERR(0, 1512, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_rec = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1517
 * 
 *         # reset counters
 *         self.reset()             # <<<<<<<<<<<<<<
 * 
 *         return rec
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reset); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1517, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __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_CallOneArg(__pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1517, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1519
 *         self.reset()
 * 
 *         return rec             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_rec);
  __pyx_r = __pyx_v_rec;
  goto __pyx_L0;

  /* "pysamstats/opt.pyx":1498
 *         self.reads.incr(is_proper_pair)
 * 
 *     cdef dict rec(self, chrom, pos, FastaFile fafile, bytes refbase):             # <<<<<<<<<<<<<<
 * 
 *         # compute GC
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pysamstats.opt.CoverageGC.rec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ref_window_start);
  __Pyx_XDECREF(__pyx_v_ref_window_end);
  __Pyx_XDECREF(__pyx_v_ref_window);
  __Pyx_XDECREF(__pyx_v_rec);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_10CoverageGC_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pysamstats_3opt_10CoverageGC_4__reduce_cython__[] = "CoverageGC.__reduce_cython__(self)";
static PyObject *__pyx_pw_10pysamstats_3opt_10CoverageGC_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_10CoverageGC_4__reduce_cython__(((struct __pyx_obj_10pysamstats_3opt_CoverageGC *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pysamstats_3opt_10CoverageGC_4__reduce_cython__(struct __pyx_obj_10pysamstats_3opt_CoverageGC *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  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;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self.reads, self.window_offset, self.window_size)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->window_offset); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->window_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->reads));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->reads));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self->reads));
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_v_state = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self.reads, self.window_offset, self.window_size)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         state += (_dict,)
 */
  __pyx_t_3 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v__dict = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":7
 *     state = (self.reads, self.window_offset, self.window_size)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
  __pyx_t_4 = (__pyx_v__dict != Py_None);
  __pyx_t_5 = (__pyx_t_4 != 0);
  if (__pyx_t_5) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v__dict);
    __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "(tree fragment)":9
 *     if _dict is not None:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = self.reads is not None
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = (self.reads, self.window_offset, self.window_size)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
    goto __pyx_L3;
  }

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = self.reads is not None             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_CoverageGC, (type(self), 0xad19be7, None), state
 */
  /*else*/ {
    __pyx_t_5 = (((PyObject *)__pyx_v_self->reads) != Py_None);
    __pyx_v_use_setstate = __pyx_t_5;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.reads is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_CoverageGC, (type(self), 0xad19be7, None), state
 *     else:
 */
  __pyx_t_5 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_5) {

    /* "(tree fragment)":13
 *         use_setstate = self.reads is not None
 *     if use_setstate:
 *         return __pyx_unpickle_CoverageGC, (type(self), 0xad19be7, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_CoverageGC, (type(self), 0xad19be7, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pyx_unpickle_CoverageGC); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_181509095);
    __Pyx_GIVEREF(__pyx_int_181509095);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_181509095);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_3, 2, Py_None);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
    __pyx_t_2 = 0;
    __pyx_t_3 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.reads is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_CoverageGC, (type(self), 0xad19be7, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_CoverageGC, (type(self), 0xad19be7, None), state
 *     else:
 *         return __pyx_unpickle_CoverageGC, (type(self), 0xad19be7, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_CoverageGC__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pyx_unpickle_CoverageGC); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_181509095);
    __Pyx_GIVEREF(__pyx_int_181509095);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_181509095);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_state);
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
    __pyx_t_1 = 0;
    __pyx_t_3 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysamstats.opt.CoverageGC.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_CoverageGC, (type(self), 0xad19be7, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_CoverageGC__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_10CoverageGC_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_10pysamstats_3opt_10CoverageGC_6__setstate_cython__[] = "CoverageGC.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_10pysamstats_3opt_10CoverageGC_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_10CoverageGC_6__setstate_cython__(((struct __pyx_obj_10pysamstats_3opt_CoverageGC *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_10pysamstats_3opt_10CoverageGC_6__setstate_cython__(struct __pyx_obj_10pysamstats_3opt_CoverageGC *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_CoverageGC, (type(self), 0xad19be7, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_CoverageGC__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
 */
  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_10pysamstats_3opt___pyx_unpickle_CoverageGC__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_CoverageGC, (type(self), 0xad19be7, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_CoverageGC__set_state(self, __pyx_state)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysamstats.opt.CoverageGC.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":1527
 * 
 * 
 * cdef int gc_content(ref_window) except -1:             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t i, n
 *     cdef char* seq
 */

static int __pyx_f_10pysamstats_3opt_gc_content(PyObject *__pyx_v_ref_window) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_n;
  char *__pyx_v_seq;
  int __pyx_v_gc_count;
  PyObject *__pyx_v_gc = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  char *__pyx_t_7;
  Py_ssize_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  double __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  __Pyx_RefNannySetupContext("gc_content", 0);
  __Pyx_INCREF(__pyx_v_ref_window);

  /* "pysamstats/opt.pyx":1530
 *     cdef Py_ssize_t i, n
 *     cdef char* seq
 *     cdef int gc_count = 0             # <<<<<<<<<<<<<<
 *     n = len(ref_window)
 *     if not PY2:
 */
  __pyx_v_gc_count = 0;

  /* "pysamstats/opt.pyx":1531
 *     cdef char* seq
 *     cdef int gc_count = 0
 *     n = len(ref_window)             # <<<<<<<<<<<<<<
 *     if not PY2:
 *         ref_window = ref_window.encode('ascii')
 */
  __pyx_t_1 = PyObject_Length(__pyx_v_ref_window); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1531, __pyx_L1_error)
  __pyx_v_n = __pyx_t_1;

  /* "pysamstats/opt.pyx":1532
 *     cdef int gc_count = 0
 *     n = len(ref_window)
 *     if not PY2:             # <<<<<<<<<<<<<<
 *         ref_window = ref_window.encode('ascii')
 *     seq = ref_window
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_PY2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1532, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1532, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = ((!__pyx_t_3) != 0);
  if (__pyx_t_4) {

    /* "pysamstats/opt.pyx":1533
 *     n = len(ref_window)
 *     if not PY2:
 *         ref_window = ref_window.encode('ascii')             # <<<<<<<<<<<<<<
 *     seq = ref_window
 *     for i in range(n):
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_ref_window, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1533, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_n_s_ascii) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_n_s_ascii);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1533, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF_SET(__pyx_v_ref_window, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "pysamstats/opt.pyx":1532
 *     cdef int gc_count = 0
 *     n = len(ref_window)
 *     if not PY2:             # <<<<<<<<<<<<<<
 *         ref_window = ref_window.encode('ascii')
 *     seq = ref_window
 */
  }

  /* "pysamstats/opt.pyx":1534
 *     if not PY2:
 *         ref_window = ref_window.encode('ascii')
 *     seq = ref_window             # <<<<<<<<<<<<<<
 *     for i in range(n):
 *         if seq[i] == b'g' or seq[i] == b'c':
 */
  __pyx_t_7 = __Pyx_PyObject_AsWritableString(__pyx_v_ref_window); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(0, 1534, __pyx_L1_error)
  __pyx_v_seq = __pyx_t_7;

  /* "pysamstats/opt.pyx":1535
 *         ref_window = ref_window.encode('ascii')
 *     seq = ref_window
 *     for i in range(n):             # <<<<<<<<<<<<<<
 *         if seq[i] == b'g' or seq[i] == b'c':
 *             gc_count += 1
 */
  __pyx_t_1 = __pyx_v_n;
  __pyx_t_8 = __pyx_t_1;
  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
    __pyx_v_i = __pyx_t_9;

    /* "pysamstats/opt.pyx":1536
 *     seq = ref_window
 *     for i in range(n):
 *         if seq[i] == b'g' or seq[i] == b'c':             # <<<<<<<<<<<<<<
 *             gc_count += 1
 *     gc = int(round(gc_count * 100. / n))
 */
    __pyx_t_3 = (((__pyx_v_seq[__pyx_v_i]) == 'g') != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_4 = __pyx_t_3;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_3 = (((__pyx_v_seq[__pyx_v_i]) == 'c') != 0);
    __pyx_t_4 = __pyx_t_3;
    __pyx_L7_bool_binop_done:;
    if (__pyx_t_4) {

      /* "pysamstats/opt.pyx":1537
 *     for i in range(n):
 *         if seq[i] == b'g' or seq[i] == b'c':
 *             gc_count += 1             # <<<<<<<<<<<<<<
 *     gc = int(round(gc_count * 100. / n))
 *     return gc
 */
      __pyx_v_gc_count = (__pyx_v_gc_count + 1);

      /* "pysamstats/opt.pyx":1536
 *     seq = ref_window
 *     for i in range(n):
 *         if seq[i] == b'g' or seq[i] == b'c':             # <<<<<<<<<<<<<<
 *             gc_count += 1
 *     gc = int(round(gc_count * 100. / n))
 */
    }
  }

  /* "pysamstats/opt.pyx":1538
 *         if seq[i] == b'g' or seq[i] == b'c':
 *             gc_count += 1
 *     gc = int(round(gc_count * 100. / n))             # <<<<<<<<<<<<<<
 *     return gc
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_round); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1538, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_10 = (__pyx_v_gc_count * 100.);
  if (unlikely(__pyx_v_n == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    __PYX_ERR(0, 1538, __pyx_L1_error)
  }
  __pyx_t_6 = PyFloat_FromDouble((__pyx_t_10 / ((double)__pyx_v_n))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1538, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_11 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_11)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_11);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_2 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_11, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6);
  __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1538, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyNumber_Int(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1538, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_gc = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "pysamstats/opt.pyx":1539
 *             gc_count += 1
 *     gc = int(round(gc_count * 100. / n))
 *     return gc             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_12 = __Pyx_PyInt_As_int(__pyx_v_gc); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1539, __pyx_L1_error)
  __pyx_r = __pyx_t_12;
  goto __pyx_L0;

  /* "pysamstats/opt.pyx":1527
 * 
 * 
 * cdef int gc_content(ref_window) except -1:             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t i, n
 *     cdef char* seq
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("pysamstats.opt.gc_content", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_gc);
  __Pyx_XDECREF(__pyx_v_ref_window);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":1544
 * cdef class BinnedStat(object):
 * 
 *     cdef dict rec(self, chrom, bin_start, bin_end, FastaFile fafile):             # <<<<<<<<<<<<<<
 *         return dict()
 * 
 */

static PyObject *__pyx_f_10pysamstats_3opt_10BinnedStat_rec(CYTHON_UNUSED struct __pyx_obj_10pysamstats_3opt_BinnedStat *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_chrom, CYTHON_UNUSED PyObject *__pyx_v_bin_start, CYTHON_UNUSED PyObject *__pyx_v_bin_end, CYTHON_UNUSED struct __pyx_obj_5pysam_9libcfaidx_FastaFile *__pyx_v_fafile) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("rec", 0);

  /* "pysamstats/opt.pyx":1545
 * 
 *     cdef dict rec(self, chrom, bin_start, bin_end, FastaFile fafile):
 *         return dict()             # <<<<<<<<<<<<<<
 * 
 *     cdef void recv(self, bam1_t* b):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1545, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pysamstats/opt.pyx":1544
 * cdef class BinnedStat(object):
 * 
 *     cdef dict rec(self, chrom, bin_start, bin_end, FastaFile fafile):             # <<<<<<<<<<<<<<
 *         return dict()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysamstats.opt.BinnedStat.rec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":1547
 *         return dict()
 * 
 *     cdef void recv(self, bam1_t* b):             # <<<<<<<<<<<<<<
 *         pass
 * 
 */

static void __pyx_f_10pysamstats_3opt_10BinnedStat_recv(CYTHON_UNUSED struct __pyx_obj_10pysamstats_3opt_BinnedStat *__pyx_v_self, CYTHON_UNUSED bam1_t *__pyx_v_b) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("recv", 0);

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

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_10BinnedStat_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pysamstats_3opt_10BinnedStat___reduce_cython__[] = "BinnedStat.__reduce_cython__(self)";
static PyObject *__pyx_pw_10pysamstats_3opt_10BinnedStat_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_10BinnedStat___reduce_cython__(((struct __pyx_obj_10pysamstats_3opt_BinnedStat *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pysamstats_3opt_10BinnedStat___reduce_cython__(struct __pyx_obj_10pysamstats_3opt_BinnedStat *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  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;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = ()             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __Pyx_INCREF(__pyx_empty_tuple);
  __pyx_v_state = __pyx_empty_tuple;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = ()
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         state += (_dict,)
 */
  __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__dict = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":7
 *     state = ()
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
  __pyx_t_2 = (__pyx_v__dict != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
 */
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
    __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "(tree fragment)":9
 *     if _dict is not None:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = False
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = ()
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
    goto __pyx_L3;
  }

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = False             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_BinnedStat, (type(self), 0xd41d8cd, None), state
 */
  /*else*/ {
    __pyx_v_use_setstate = 0;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_BinnedStat, (type(self), 0xd41d8cd, None), state
 *     else:
 */
  __pyx_t_3 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":13
 *         use_setstate = False
 *     if use_setstate:
 *         return __pyx_unpickle_BinnedStat, (type(self), 0xd41d8cd, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_BinnedStat, (type(self), 0xd41d8cd, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_BinnedStat); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_222419149);
    __Pyx_GIVEREF(__pyx_int_222419149);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_222419149);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_BinnedStat, (type(self), 0xd41d8cd, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_BinnedStat, (type(self), 0xd41d8cd, None), state
 *     else:
 *         return __pyx_unpickle_BinnedStat, (type(self), 0xd41d8cd, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_BinnedStat__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_BinnedStat); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_222419149);
    __Pyx_GIVEREF(__pyx_int_222419149);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_222419149);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
    __pyx_t_5 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pysamstats.opt.BinnedStat.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_BinnedStat, (type(self), 0xd41d8cd, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_BinnedStat__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_10BinnedStat_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_10pysamstats_3opt_10BinnedStat_2__setstate_cython__[] = "BinnedStat.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_10pysamstats_3opt_10BinnedStat_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_10BinnedStat_2__setstate_cython__(((struct __pyx_obj_10pysamstats_3opt_BinnedStat *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_10pysamstats_3opt_10BinnedStat_2__setstate_cython__(struct __pyx_obj_10pysamstats_3opt_BinnedStat *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_BinnedStat, (type(self), 0xd41d8cd, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_BinnedStat__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
 */
  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_10pysamstats_3opt___pyx_unpickle_BinnedStat__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_BinnedStat, (type(self), 0xd41d8cd, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_BinnedStat__set_state(self, __pyx_state)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysamstats.opt.BinnedStat.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":1555
 *     cdef int reads_all, reads_pp
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.reads_all = self.reads_pp = 0
 * 
 */

/* Python wrapper */
static int __pyx_pw_10pysamstats_3opt_14CoverageBinned_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_10pysamstats_3opt_14CoverageBinned_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
  __pyx_r = __pyx_pf_10pysamstats_3opt_14CoverageBinned___init__(((struct __pyx_obj_10pysamstats_3opt_CoverageBinned *)__pyx_v_self));

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

static int __pyx_pf_10pysamstats_3opt_14CoverageBinned___init__(struct __pyx_obj_10pysamstats_3opt_CoverageBinned *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "pysamstats/opt.pyx":1556
 * 
 *     def __init__(self):
 *         self.reads_all = self.reads_pp = 0             # <<<<<<<<<<<<<<
 * 
 *     cdef dict rec(self, chrom, bin_start, bin_end, FastaFile fafile):
 */
  __pyx_v_self->reads_all = 0;
  __pyx_v_self->reads_pp = 0;

  /* "pysamstats/opt.pyx":1555
 *     cdef int reads_all, reads_pp
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.reads_all = self.reads_pp = 0
 * 
 */

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

/* "pysamstats/opt.pyx":1558
 *         self.reads_all = self.reads_pp = 0
 * 
 *     cdef dict rec(self, chrom, bin_start, bin_end, FastaFile fafile):             # <<<<<<<<<<<<<<
 * 
 *         # determine %GC
 */

static PyObject *__pyx_f_10pysamstats_3opt_14CoverageBinned_rec(struct __pyx_obj_10pysamstats_3opt_CoverageBinned *__pyx_v_self, PyObject *__pyx_v_chrom, PyObject *__pyx_v_bin_start, PyObject *__pyx_v_bin_end, struct __pyx_obj_5pysam_9libcfaidx_FastaFile *__pyx_v_fafile) {
  PyObject *__pyx_v_ref_window = NULL;
  int __pyx_v_gc;
  PyObject *__pyx_v_rec = 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;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("rec", 0);

  /* "pysamstats/opt.pyx":1561
 * 
 *         # determine %GC
 *         ref_window = fafile.fetch(chrom, bin_start, bin_end).lower()             # <<<<<<<<<<<<<<
 *         gc = gc_content(ref_window)
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_fafile), __pyx_n_s_fetch); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1561, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 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_5 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_chrom, __pyx_v_bin_start, __pyx_v_bin_end};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1561, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_chrom, __pyx_v_bin_start, __pyx_v_bin_end};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1561, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1561, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_INCREF(__pyx_v_chrom);
    __Pyx_GIVEREF(__pyx_v_chrom);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_chrom);
    __Pyx_INCREF(__pyx_v_bin_start);
    __Pyx_GIVEREF(__pyx_v_bin_start);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_bin_start);
    __Pyx_INCREF(__pyx_v_bin_end);
    __Pyx_GIVEREF(__pyx_v_bin_end);
    PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, __pyx_v_bin_end);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1561, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_lower); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1561, __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 && likely(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_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1561, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_ref_window = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1562
 *         # determine %GC
 *         ref_window = fafile.fetch(chrom, bin_start, bin_end).lower()
 *         gc = gc_content(ref_window)             # <<<<<<<<<<<<<<
 * 
 *         # make record for bin
 */
  __pyx_t_5 = __pyx_f_10pysamstats_3opt_gc_content(__pyx_v_ref_window); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 1562, __pyx_L1_error)
  __pyx_v_gc = __pyx_t_5;

  /* "pysamstats/opt.pyx":1565
 * 
 *         # make record for bin
 *         rec = {'gc': gc,             # <<<<<<<<<<<<<<
 *                'reads_all': self.reads_all,
 *                'reads_pp': self.reads_pp}
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1565, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_gc); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1565, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_gc, __pyx_t_3) < 0) __PYX_ERR(0, 1565, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pysamstats/opt.pyx":1566
 *         # make record for bin
 *         rec = {'gc': gc,
 *                'reads_all': self.reads_all,             # <<<<<<<<<<<<<<
 *                'reads_pp': self.reads_pp}
 * 
 */
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_self->reads_all); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1566, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_all, __pyx_t_3) < 0) __PYX_ERR(0, 1565, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pysamstats/opt.pyx":1567
 *         rec = {'gc': gc,
 *                'reads_all': self.reads_all,
 *                'reads_pp': self.reads_pp}             # <<<<<<<<<<<<<<
 * 
 *         # reset counters
 */
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_self->reads_pp); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1567, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_pp, __pyx_t_3) < 0) __PYX_ERR(0, 1565, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_rec = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1570
 * 
 *         # reset counters
 *         self.reads_all = self.reads_pp = 0             # <<<<<<<<<<<<<<
 * 
 *         return rec
 */
  __pyx_v_self->reads_all = 0;
  __pyx_v_self->reads_pp = 0;

  /* "pysamstats/opt.pyx":1572
 *         self.reads_all = self.reads_pp = 0
 * 
 *         return rec             # <<<<<<<<<<<<<<
 * 
 *     cdef void recv(self, bam1_t* b):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_rec);
  __pyx_r = __pyx_v_rec;
  goto __pyx_L0;

  /* "pysamstats/opt.pyx":1558
 *         self.reads_all = self.reads_pp = 0
 * 
 *     cdef dict rec(self, chrom, bin_start, bin_end, FastaFile fafile):             # <<<<<<<<<<<<<<
 * 
 *         # determine %GC
 */

  /* 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_6);
  __Pyx_AddTraceback("pysamstats.opt.CoverageBinned.rec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ref_window);
  __Pyx_XDECREF(__pyx_v_rec);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":1574
 *         return rec
 * 
 *     cdef void recv(self, bam1_t* b):             # <<<<<<<<<<<<<<
 *         cdef uint32_t flag
 *         cdef bint is_unmapped
 */

static void __pyx_f_10pysamstats_3opt_14CoverageBinned_recv(struct __pyx_obj_10pysamstats_3opt_CoverageBinned *__pyx_v_self, bam1_t *__pyx_v_b) {
  uint32_t __pyx_v_flag;
  int __pyx_v_is_unmapped;
  int __pyx_v_is_proper_pair;
  __Pyx_RefNannyDeclarations
  uint16_t __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("recv", 0);

  /* "pysamstats/opt.pyx":1578
 *         cdef bint is_unmapped
 *         cdef bint is_proper_pair
 *         flag = b.core.flag             # <<<<<<<<<<<<<<
 *         is_unmapped = <bint>(flag & BAM_FUNMAP)
 *         if not is_unmapped:
 */
  __pyx_t_1 = __pyx_v_b->core.flag;
  __pyx_v_flag = __pyx_t_1;

  /* "pysamstats/opt.pyx":1579
 *         cdef bint is_proper_pair
 *         flag = b.core.flag
 *         is_unmapped = <bint>(flag & BAM_FUNMAP)             # <<<<<<<<<<<<<<
 *         if not is_unmapped:
 *             self.reads_all += 1
 */
  __pyx_v_is_unmapped = ((__pyx_v_flag & 4) != 0);

  /* "pysamstats/opt.pyx":1580
 *         flag = b.core.flag
 *         is_unmapped = <bint>(flag & BAM_FUNMAP)
 *         if not is_unmapped:             # <<<<<<<<<<<<<<
 *             self.reads_all += 1
 *             is_proper_pair = <bint>(flag & BAM_FPROPER_PAIR)
 */
  __pyx_t_2 = ((!(__pyx_v_is_unmapped != 0)) != 0);
  if (__pyx_t_2) {

    /* "pysamstats/opt.pyx":1581
 *         is_unmapped = <bint>(flag & BAM_FUNMAP)
 *         if not is_unmapped:
 *             self.reads_all += 1             # <<<<<<<<<<<<<<
 *             is_proper_pair = <bint>(flag & BAM_FPROPER_PAIR)
 *             if is_proper_pair:
 */
    __pyx_v_self->reads_all = (__pyx_v_self->reads_all + 1);

    /* "pysamstats/opt.pyx":1582
 *         if not is_unmapped:
 *             self.reads_all += 1
 *             is_proper_pair = <bint>(flag & BAM_FPROPER_PAIR)             # <<<<<<<<<<<<<<
 *             if is_proper_pair:
 *                 self.reads_pp += 1
 */
    __pyx_v_is_proper_pair = ((__pyx_v_flag & 2) != 0);

    /* "pysamstats/opt.pyx":1583
 *             self.reads_all += 1
 *             is_proper_pair = <bint>(flag & BAM_FPROPER_PAIR)
 *             if is_proper_pair:             # <<<<<<<<<<<<<<
 *                 self.reads_pp += 1
 * 
 */
    __pyx_t_2 = (__pyx_v_is_proper_pair != 0);
    if (__pyx_t_2) {

      /* "pysamstats/opt.pyx":1584
 *             is_proper_pair = <bint>(flag & BAM_FPROPER_PAIR)
 *             if is_proper_pair:
 *                 self.reads_pp += 1             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __pyx_v_self->reads_pp = (__pyx_v_self->reads_pp + 1);

      /* "pysamstats/opt.pyx":1583
 *             self.reads_all += 1
 *             is_proper_pair = <bint>(flag & BAM_FPROPER_PAIR)
 *             if is_proper_pair:             # <<<<<<<<<<<<<<
 *                 self.reads_pp += 1
 * 
 */
    }

    /* "pysamstats/opt.pyx":1580
 *         flag = b.core.flag
 *         is_unmapped = <bint>(flag & BAM_FUNMAP)
 *         if not is_unmapped:             # <<<<<<<<<<<<<<
 *             self.reads_all += 1
 *             is_proper_pair = <bint>(flag & BAM_FPROPER_PAIR)
 */
  }

  /* "pysamstats/opt.pyx":1574
 *         return rec
 * 
 *     cdef void recv(self, bam1_t* b):             # <<<<<<<<<<<<<<
 *         cdef uint32_t flag
 *         cdef bint is_unmapped
 */

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

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_14CoverageBinned_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pysamstats_3opt_14CoverageBinned_2__reduce_cython__[] = "CoverageBinned.__reduce_cython__(self)";
static PyObject *__pyx_pw_10pysamstats_3opt_14CoverageBinned_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_14CoverageBinned_2__reduce_cython__(((struct __pyx_obj_10pysamstats_3opt_CoverageBinned *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pysamstats_3opt_14CoverageBinned_2__reduce_cython__(struct __pyx_obj_10pysamstats_3opt_CoverageBinned *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  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;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self.reads_all, self.reads_pp)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->reads_all); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->reads_pp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_v_state = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self.reads_all, self.reads_pp)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         state += (_dict,)
 */
  __pyx_t_3 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v__dict = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":7
 *     state = (self.reads_all, self.reads_pp)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
  __pyx_t_4 = (__pyx_v__dict != Py_None);
  __pyx_t_5 = (__pyx_t_4 != 0);
  if (__pyx_t_5) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v__dict);
    __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "(tree fragment)":9
 *     if _dict is not None:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = False
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = (self.reads_all, self.reads_pp)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
    goto __pyx_L3;
  }

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = False             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_CoverageBinned, (type(self), 0xce7bb01, None), state
 */
  /*else*/ {
    __pyx_v_use_setstate = 0;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_CoverageBinned, (type(self), 0xce7bb01, None), state
 *     else:
 */
  __pyx_t_5 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_5) {

    /* "(tree fragment)":13
 *         use_setstate = False
 *     if use_setstate:
 *         return __pyx_unpickle_CoverageBinned, (type(self), 0xce7bb01, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_CoverageBinned, (type(self), 0xce7bb01, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pyx_unpickle_CoverageBinned); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_216513281);
    __Pyx_GIVEREF(__pyx_int_216513281);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_216513281);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_3, 2, Py_None);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
    __pyx_t_2 = 0;
    __pyx_t_3 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_CoverageBinned, (type(self), 0xce7bb01, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_CoverageBinned, (type(self), 0xce7bb01, None), state
 *     else:
 *         return __pyx_unpickle_CoverageBinned, (type(self), 0xce7bb01, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_CoverageBinned__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pyx_unpickle_CoverageBinned); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_216513281);
    __Pyx_GIVEREF(__pyx_int_216513281);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_216513281);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_state);
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
    __pyx_t_1 = 0;
    __pyx_t_3 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysamstats.opt.CoverageBinned.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_CoverageBinned, (type(self), 0xce7bb01, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_CoverageBinned__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_14CoverageBinned_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_10pysamstats_3opt_14CoverageBinned_4__setstate_cython__[] = "CoverageBinned.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_10pysamstats_3opt_14CoverageBinned_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_14CoverageBinned_4__setstate_cython__(((struct __pyx_obj_10pysamstats_3opt_CoverageBinned *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_10pysamstats_3opt_14CoverageBinned_4__setstate_cython__(struct __pyx_obj_10pysamstats_3opt_CoverageBinned *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_CoverageBinned, (type(self), 0xce7bb01, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_CoverageBinned__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
 */
  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_10pysamstats_3opt___pyx_unpickle_CoverageBinned__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_CoverageBinned, (type(self), 0xce7bb01, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_CoverageBinned__set_state(self, __pyx_state)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysamstats.opt.CoverageBinned.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":1598
 *         reads_duplicate
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.reads_all = self.reads_pp = self.reads_mate_unmapped \
 *             = self.reads_mate_other_chr = self.reads_mate_same_strand\
 */

/* Python wrapper */
static int __pyx_pw_10pysamstats_3opt_17CoverageExtBinned_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_10pysamstats_3opt_17CoverageExtBinned_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
  __pyx_r = __pyx_pf_10pysamstats_3opt_17CoverageExtBinned___init__(((struct __pyx_obj_10pysamstats_3opt_CoverageExtBinned *)__pyx_v_self));

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

static int __pyx_pf_10pysamstats_3opt_17CoverageExtBinned___init__(struct __pyx_obj_10pysamstats_3opt_CoverageExtBinned *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "pysamstats/opt.pyx":1599
 * 
 *     def __init__(self):
 *         self.reads_all = self.reads_pp = self.reads_mate_unmapped \             # <<<<<<<<<<<<<<
 *             = self.reads_mate_other_chr = self.reads_mate_same_strand\
 *             = self.reads_faceaway = self.reads_softclipped \
 */
  __pyx_v_self->reads_all = 0;
  __pyx_v_self->reads_pp = 0;
  __pyx_v_self->reads_mate_unmapped = 0;

  /* "pysamstats/opt.pyx":1600
 *     def __init__(self):
 *         self.reads_all = self.reads_pp = self.reads_mate_unmapped \
 *             = self.reads_mate_other_chr = self.reads_mate_same_strand\             # <<<<<<<<<<<<<<
 *             = self.reads_faceaway = self.reads_softclipped \
 *             = self.reads_duplicate = 0
 */
  __pyx_v_self->reads_mate_other_chr = 0;
  __pyx_v_self->reads_mate_same_strand = 0;

  /* "pysamstats/opt.pyx":1601
 *         self.reads_all = self.reads_pp = self.reads_mate_unmapped \
 *             = self.reads_mate_other_chr = self.reads_mate_same_strand\
 *             = self.reads_faceaway = self.reads_softclipped \             # <<<<<<<<<<<<<<
 *             = self.reads_duplicate = 0
 * 
 */
  __pyx_v_self->reads_faceaway = 0;
  __pyx_v_self->reads_softclipped = 0;

  /* "pysamstats/opt.pyx":1602
 *             = self.reads_mate_other_chr = self.reads_mate_same_strand\
 *             = self.reads_faceaway = self.reads_softclipped \
 *             = self.reads_duplicate = 0             # <<<<<<<<<<<<<<
 * 
 *     cdef dict rec(self, chrom, bin_start, bin_end, FastaFile fafile):
 */
  __pyx_v_self->reads_duplicate = 0;

  /* "pysamstats/opt.pyx":1598
 *         reads_duplicate
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.reads_all = self.reads_pp = self.reads_mate_unmapped \
 *             = self.reads_mate_other_chr = self.reads_mate_same_strand\
 */

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

/* "pysamstats/opt.pyx":1604
 *             = self.reads_duplicate = 0
 * 
 *     cdef dict rec(self, chrom, bin_start, bin_end, FastaFile fafile):             # <<<<<<<<<<<<<<
 * 
 *         # determine %GC
 */

static PyObject *__pyx_f_10pysamstats_3opt_17CoverageExtBinned_rec(struct __pyx_obj_10pysamstats_3opt_CoverageExtBinned *__pyx_v_self, PyObject *__pyx_v_chrom, PyObject *__pyx_v_bin_start, PyObject *__pyx_v_bin_end, struct __pyx_obj_5pysam_9libcfaidx_FastaFile *__pyx_v_fafile) {
  PyObject *__pyx_v_ref_window = NULL;
  int __pyx_v_gc;
  PyObject *__pyx_v_rec = 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;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("rec", 0);

  /* "pysamstats/opt.pyx":1607
 * 
 *         # determine %GC
 *         ref_window = fafile.fetch(chrom, bin_start, bin_end).lower()             # <<<<<<<<<<<<<<
 *         gc = gc_content(ref_window)
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_fafile), __pyx_n_s_fetch); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1607, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 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_5 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_chrom, __pyx_v_bin_start, __pyx_v_bin_end};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1607, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_chrom, __pyx_v_bin_start, __pyx_v_bin_end};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1607, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1607, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_INCREF(__pyx_v_chrom);
    __Pyx_GIVEREF(__pyx_v_chrom);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_chrom);
    __Pyx_INCREF(__pyx_v_bin_start);
    __Pyx_GIVEREF(__pyx_v_bin_start);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_bin_start);
    __Pyx_INCREF(__pyx_v_bin_end);
    __Pyx_GIVEREF(__pyx_v_bin_end);
    PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, __pyx_v_bin_end);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1607, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_lower); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1607, __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 && likely(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_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1607, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_ref_window = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1608
 *         # determine %GC
 *         ref_window = fafile.fetch(chrom, bin_start, bin_end).lower()
 *         gc = gc_content(ref_window)             # <<<<<<<<<<<<<<
 * 
 *         # make record for bin
 */
  __pyx_t_5 = __pyx_f_10pysamstats_3opt_gc_content(__pyx_v_ref_window); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 1608, __pyx_L1_error)
  __pyx_v_gc = __pyx_t_5;

  /* "pysamstats/opt.pyx":1611
 * 
 *         # make record for bin
 *         rec = {'gc': gc,             # <<<<<<<<<<<<<<
 *                'reads_all': self.reads_all,
 *                'reads_pp': self.reads_pp,
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1611, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_gc); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1611, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_gc, __pyx_t_3) < 0) __PYX_ERR(0, 1611, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pysamstats/opt.pyx":1612
 *         # make record for bin
 *         rec = {'gc': gc,
 *                'reads_all': self.reads_all,             # <<<<<<<<<<<<<<
 *                'reads_pp': self.reads_pp,
 *                'reads_mate_unmapped': self.reads_mate_unmapped,
 */
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_self->reads_all); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1612, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_all, __pyx_t_3) < 0) __PYX_ERR(0, 1611, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pysamstats/opt.pyx":1613
 *         rec = {'gc': gc,
 *                'reads_all': self.reads_all,
 *                'reads_pp': self.reads_pp,             # <<<<<<<<<<<<<<
 *                'reads_mate_unmapped': self.reads_mate_unmapped,
 *                'reads_mate_other_chr': self.reads_mate_other_chr,
 */
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_self->reads_pp); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1613, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_pp, __pyx_t_3) < 0) __PYX_ERR(0, 1611, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pysamstats/opt.pyx":1614
 *                'reads_all': self.reads_all,
 *                'reads_pp': self.reads_pp,
 *                'reads_mate_unmapped': self.reads_mate_unmapped,             # <<<<<<<<<<<<<<
 *                'reads_mate_other_chr': self.reads_mate_other_chr,
 *                'reads_mate_same_strand': self.reads_mate_same_strand,
 */
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_self->reads_mate_unmapped); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1614, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_mate_unmapped, __pyx_t_3) < 0) __PYX_ERR(0, 1611, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pysamstats/opt.pyx":1615
 *                'reads_pp': self.reads_pp,
 *                'reads_mate_unmapped': self.reads_mate_unmapped,
 *                'reads_mate_other_chr': self.reads_mate_other_chr,             # <<<<<<<<<<<<<<
 *                'reads_mate_same_strand': self.reads_mate_same_strand,
 *                'reads_faceaway': self.reads_faceaway,
 */
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_self->reads_mate_other_chr); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1615, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_mate_other_chr, __pyx_t_3) < 0) __PYX_ERR(0, 1611, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pysamstats/opt.pyx":1616
 *                'reads_mate_unmapped': self.reads_mate_unmapped,
 *                'reads_mate_other_chr': self.reads_mate_other_chr,
 *                'reads_mate_same_strand': self.reads_mate_same_strand,             # <<<<<<<<<<<<<<
 *                'reads_faceaway': self.reads_faceaway,
 *                'reads_softclipped': self.reads_softclipped,
 */
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_self->reads_mate_same_strand); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1616, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_mate_same_strand, __pyx_t_3) < 0) __PYX_ERR(0, 1611, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pysamstats/opt.pyx":1617
 *                'reads_mate_other_chr': self.reads_mate_other_chr,
 *                'reads_mate_same_strand': self.reads_mate_same_strand,
 *                'reads_faceaway': self.reads_faceaway,             # <<<<<<<<<<<<<<
 *                'reads_softclipped': self.reads_softclipped,
 *                'reads_duplicate': self.reads_duplicate}
 */
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_self->reads_faceaway); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1617, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_faceaway, __pyx_t_3) < 0) __PYX_ERR(0, 1611, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pysamstats/opt.pyx":1618
 *                'reads_mate_same_strand': self.reads_mate_same_strand,
 *                'reads_faceaway': self.reads_faceaway,
 *                'reads_softclipped': self.reads_softclipped,             # <<<<<<<<<<<<<<
 *                'reads_duplicate': self.reads_duplicate}
 * 
 */
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_self->reads_softclipped); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1618, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_softclipped, __pyx_t_3) < 0) __PYX_ERR(0, 1611, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pysamstats/opt.pyx":1619
 *                'reads_faceaway': self.reads_faceaway,
 *                'reads_softclipped': self.reads_softclipped,
 *                'reads_duplicate': self.reads_duplicate}             # <<<<<<<<<<<<<<
 * 
 *         # reset counters
 */
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_self->reads_duplicate); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1619, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_duplicate, __pyx_t_3) < 0) __PYX_ERR(0, 1611, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_rec = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1622
 * 
 *         # reset counters
 *         self.reads_all = self.reads_pp = self.reads_mate_unmapped \             # <<<<<<<<<<<<<<
 *             = self.reads_mate_other_chr = self.reads_mate_same_strand\
 *             = self.reads_faceaway = self.reads_softclipped \
 */
  __pyx_v_self->reads_all = 0;
  __pyx_v_self->reads_pp = 0;
  __pyx_v_self->reads_mate_unmapped = 0;

  /* "pysamstats/opt.pyx":1623
 *         # reset counters
 *         self.reads_all = self.reads_pp = self.reads_mate_unmapped \
 *             = self.reads_mate_other_chr = self.reads_mate_same_strand\             # <<<<<<<<<<<<<<
 *             = self.reads_faceaway = self.reads_softclipped \
 *             = self.reads_duplicate = 0
 */
  __pyx_v_self->reads_mate_other_chr = 0;
  __pyx_v_self->reads_mate_same_strand = 0;

  /* "pysamstats/opt.pyx":1624
 *         self.reads_all = self.reads_pp = self.reads_mate_unmapped \
 *             = self.reads_mate_other_chr = self.reads_mate_same_strand\
 *             = self.reads_faceaway = self.reads_softclipped \             # <<<<<<<<<<<<<<
 *             = self.reads_duplicate = 0
 * 
 */
  __pyx_v_self->reads_faceaway = 0;
  __pyx_v_self->reads_softclipped = 0;

  /* "pysamstats/opt.pyx":1625
 *             = self.reads_mate_other_chr = self.reads_mate_same_strand\
 *             = self.reads_faceaway = self.reads_softclipped \
 *             = self.reads_duplicate = 0             # <<<<<<<<<<<<<<
 * 
 *         return rec
 */
  __pyx_v_self->reads_duplicate = 0;

  /* "pysamstats/opt.pyx":1627
 *             = self.reads_duplicate = 0
 * 
 *         return rec             # <<<<<<<<<<<<<<
 * 
 *     cdef void recv(self, bam1_t* b):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_rec);
  __pyx_r = __pyx_v_rec;
  goto __pyx_L0;

  /* "pysamstats/opt.pyx":1604
 *             = self.reads_duplicate = 0
 * 
 *     cdef dict rec(self, chrom, bin_start, bin_end, FastaFile fafile):             # <<<<<<<<<<<<<<
 * 
 *         # determine %GC
 */

  /* 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_6);
  __Pyx_AddTraceback("pysamstats.opt.CoverageExtBinned.rec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ref_window);
  __Pyx_XDECREF(__pyx_v_rec);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":1629
 *         return rec
 * 
 *     cdef void recv(self, bam1_t* b):             # <<<<<<<<<<<<<<
 *         cdef uint32_t flag
 *         cdef bint is_unmapped
 */

static void __pyx_f_10pysamstats_3opt_17CoverageExtBinned_recv(struct __pyx_obj_10pysamstats_3opt_CoverageExtBinned *__pyx_v_self, bam1_t *__pyx_v_b) {
  uint32_t __pyx_v_flag;
  int __pyx_v_is_unmapped;
  int __pyx_v_is_reverse;
  int __pyx_v_is_proper_pair;
  int __pyx_v_is_duplicate;
  int __pyx_v_mate_is_reverse;
  int __pyx_v_tlen;
  int __pyx_v_mate_is_unmapped;
  __Pyx_RefNannyDeclarations
  uint16_t __pyx_t_1;
  int __pyx_t_2;
  int32_t __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("recv", 0);

  /* "pysamstats/opt.pyx":1638
 *         cdef bint mate_is_reverse
 *         cdef int tlen
 *         flag = b.core.flag             # <<<<<<<<<<<<<<
 *         is_unmapped = <bint>(flag & BAM_FUNMAP)
 *         if not is_unmapped:
 */
  __pyx_t_1 = __pyx_v_b->core.flag;
  __pyx_v_flag = __pyx_t_1;

  /* "pysamstats/opt.pyx":1639
 *         cdef int tlen
 *         flag = b.core.flag
 *         is_unmapped = <bint>(flag & BAM_FUNMAP)             # <<<<<<<<<<<<<<
 *         if not is_unmapped:
 *             self.reads_all += 1
 */
  __pyx_v_is_unmapped = ((__pyx_v_flag & 4) != 0);

  /* "pysamstats/opt.pyx":1640
 *         flag = b.core.flag
 *         is_unmapped = <bint>(flag & BAM_FUNMAP)
 *         if not is_unmapped:             # <<<<<<<<<<<<<<
 *             self.reads_all += 1
 *             is_reverse = <bint>(flag & BAM_FREVERSE)
 */
  __pyx_t_2 = ((!(__pyx_v_is_unmapped != 0)) != 0);
  if (__pyx_t_2) {

    /* "pysamstats/opt.pyx":1641
 *         is_unmapped = <bint>(flag & BAM_FUNMAP)
 *         if not is_unmapped:
 *             self.reads_all += 1             # <<<<<<<<<<<<<<
 *             is_reverse = <bint>(flag & BAM_FREVERSE)
 *             is_proper_pair = <bint>(flag & BAM_FPROPER_PAIR)
 */
    __pyx_v_self->reads_all = (__pyx_v_self->reads_all + 1);

    /* "pysamstats/opt.pyx":1642
 *         if not is_unmapped:
 *             self.reads_all += 1
 *             is_reverse = <bint>(flag & BAM_FREVERSE)             # <<<<<<<<<<<<<<
 *             is_proper_pair = <bint>(flag & BAM_FPROPER_PAIR)
 *             is_duplicate = <bint>(flag & BAM_FDUP)
 */
    __pyx_v_is_reverse = ((__pyx_v_flag & 16) != 0);

    /* "pysamstats/opt.pyx":1643
 *             self.reads_all += 1
 *             is_reverse = <bint>(flag & BAM_FREVERSE)
 *             is_proper_pair = <bint>(flag & BAM_FPROPER_PAIR)             # <<<<<<<<<<<<<<
 *             is_duplicate = <bint>(flag & BAM_FDUP)
 *             mate_is_unmapped = <bint>(flag & BAM_FMUNMAP)
 */
    __pyx_v_is_proper_pair = ((__pyx_v_flag & 2) != 0);

    /* "pysamstats/opt.pyx":1644
 *             is_reverse = <bint>(flag & BAM_FREVERSE)
 *             is_proper_pair = <bint>(flag & BAM_FPROPER_PAIR)
 *             is_duplicate = <bint>(flag & BAM_FDUP)             # <<<<<<<<<<<<<<
 *             mate_is_unmapped = <bint>(flag & BAM_FMUNMAP)
 *             mate_is_reverse = <bint>(flag & BAM_FMREVERSE)
 */
    __pyx_v_is_duplicate = ((__pyx_v_flag & 0x400) != 0);

    /* "pysamstats/opt.pyx":1645
 *             is_proper_pair = <bint>(flag & BAM_FPROPER_PAIR)
 *             is_duplicate = <bint>(flag & BAM_FDUP)
 *             mate_is_unmapped = <bint>(flag & BAM_FMUNMAP)             # <<<<<<<<<<<<<<
 *             mate_is_reverse = <bint>(flag & BAM_FMREVERSE)
 *             tlen = b.core.isize
 */
    __pyx_v_mate_is_unmapped = ((__pyx_v_flag & 8) != 0);

    /* "pysamstats/opt.pyx":1646
 *             is_duplicate = <bint>(flag & BAM_FDUP)
 *             mate_is_unmapped = <bint>(flag & BAM_FMUNMAP)
 *             mate_is_reverse = <bint>(flag & BAM_FMREVERSE)             # <<<<<<<<<<<<<<
 *             tlen = b.core.isize
 *             if is_duplicate:
 */
    __pyx_v_mate_is_reverse = ((__pyx_v_flag & 32) != 0);

    /* "pysamstats/opt.pyx":1647
 *             mate_is_unmapped = <bint>(flag & BAM_FMUNMAP)
 *             mate_is_reverse = <bint>(flag & BAM_FMREVERSE)
 *             tlen = b.core.isize             # <<<<<<<<<<<<<<
 *             if is_duplicate:
 *                 self.reads_duplicate += 1
 */
    __pyx_t_3 = __pyx_v_b->core.isize;
    __pyx_v_tlen = __pyx_t_3;

    /* "pysamstats/opt.pyx":1648
 *             mate_is_reverse = <bint>(flag & BAM_FMREVERSE)
 *             tlen = b.core.isize
 *             if is_duplicate:             # <<<<<<<<<<<<<<
 *                 self.reads_duplicate += 1
 *             if is_proper_pair:
 */
    __pyx_t_2 = (__pyx_v_is_duplicate != 0);
    if (__pyx_t_2) {

      /* "pysamstats/opt.pyx":1649
 *             tlen = b.core.isize
 *             if is_duplicate:
 *                 self.reads_duplicate += 1             # <<<<<<<<<<<<<<
 *             if is_proper_pair:
 *                 self.reads_pp += 1
 */
      __pyx_v_self->reads_duplicate = (__pyx_v_self->reads_duplicate + 1);

      /* "pysamstats/opt.pyx":1648
 *             mate_is_reverse = <bint>(flag & BAM_FMREVERSE)
 *             tlen = b.core.isize
 *             if is_duplicate:             # <<<<<<<<<<<<<<
 *                 self.reads_duplicate += 1
 *             if is_proper_pair:
 */
    }

    /* "pysamstats/opt.pyx":1650
 *             if is_duplicate:
 *                 self.reads_duplicate += 1
 *             if is_proper_pair:             # <<<<<<<<<<<<<<
 *                 self.reads_pp += 1
 *             if mate_is_unmapped:
 */
    __pyx_t_2 = (__pyx_v_is_proper_pair != 0);
    if (__pyx_t_2) {

      /* "pysamstats/opt.pyx":1651
 *                 self.reads_duplicate += 1
 *             if is_proper_pair:
 *                 self.reads_pp += 1             # <<<<<<<<<<<<<<
 *             if mate_is_unmapped:
 *                 self.reads_mate_unmapped += 1
 */
      __pyx_v_self->reads_pp = (__pyx_v_self->reads_pp + 1);

      /* "pysamstats/opt.pyx":1650
 *             if is_duplicate:
 *                 self.reads_duplicate += 1
 *             if is_proper_pair:             # <<<<<<<<<<<<<<
 *                 self.reads_pp += 1
 *             if mate_is_unmapped:
 */
    }

    /* "pysamstats/opt.pyx":1652
 *             if is_proper_pair:
 *                 self.reads_pp += 1
 *             if mate_is_unmapped:             # <<<<<<<<<<<<<<
 *                 self.reads_mate_unmapped += 1
 *             elif b.core.tid != b.core.mtid:
 */
    __pyx_t_2 = (__pyx_v_mate_is_unmapped != 0);
    if (__pyx_t_2) {

      /* "pysamstats/opt.pyx":1653
 *                 self.reads_pp += 1
 *             if mate_is_unmapped:
 *                 self.reads_mate_unmapped += 1             # <<<<<<<<<<<<<<
 *             elif b.core.tid != b.core.mtid:
 *                 self.reads_mate_other_chr += 1
 */
      __pyx_v_self->reads_mate_unmapped = (__pyx_v_self->reads_mate_unmapped + 1);

      /* "pysamstats/opt.pyx":1652
 *             if is_proper_pair:
 *                 self.reads_pp += 1
 *             if mate_is_unmapped:             # <<<<<<<<<<<<<<
 *                 self.reads_mate_unmapped += 1
 *             elif b.core.tid != b.core.mtid:
 */
      goto __pyx_L6;
    }

    /* "pysamstats/opt.pyx":1654
 *             if mate_is_unmapped:
 *                 self.reads_mate_unmapped += 1
 *             elif b.core.tid != b.core.mtid:             # <<<<<<<<<<<<<<
 *                 self.reads_mate_other_chr += 1
 *             elif (is_reverse and mate_is_reverse) \
 */
    __pyx_t_2 = ((__pyx_v_b->core.tid != __pyx_v_b->core.mtid) != 0);
    if (__pyx_t_2) {

      /* "pysamstats/opt.pyx":1655
 *                 self.reads_mate_unmapped += 1
 *             elif b.core.tid != b.core.mtid:
 *                 self.reads_mate_other_chr += 1             # <<<<<<<<<<<<<<
 *             elif (is_reverse and mate_is_reverse) \
 *                     or (not is_reverse and not mate_is_reverse):
 */
      __pyx_v_self->reads_mate_other_chr = (__pyx_v_self->reads_mate_other_chr + 1);

      /* "pysamstats/opt.pyx":1654
 *             if mate_is_unmapped:
 *                 self.reads_mate_unmapped += 1
 *             elif b.core.tid != b.core.mtid:             # <<<<<<<<<<<<<<
 *                 self.reads_mate_other_chr += 1
 *             elif (is_reverse and mate_is_reverse) \
 */
      goto __pyx_L6;
    }

    /* "pysamstats/opt.pyx":1656
 *             elif b.core.tid != b.core.mtid:
 *                 self.reads_mate_other_chr += 1
 *             elif (is_reverse and mate_is_reverse) \             # <<<<<<<<<<<<<<
 *                     or (not is_reverse and not mate_is_reverse):
 *                 self.reads_mate_same_strand += 1
 */
    __pyx_t_4 = (__pyx_v_is_reverse != 0);
    if (!__pyx_t_4) {
      goto __pyx_L8_next_or;
    } else {
    }
    __pyx_t_4 = (__pyx_v_mate_is_reverse != 0);
    if (!__pyx_t_4) {
    } else {
      __pyx_t_2 = __pyx_t_4;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_L8_next_or:;

    /* "pysamstats/opt.pyx":1657
 *                 self.reads_mate_other_chr += 1
 *             elif (is_reverse and mate_is_reverse) \
 *                     or (not is_reverse and not mate_is_reverse):             # <<<<<<<<<<<<<<
 *                 self.reads_mate_same_strand += 1
 *             elif (is_reverse and tlen > 0) or (not is_reverse and tlen < 0):
 */
    __pyx_t_4 = ((!(__pyx_v_is_reverse != 0)) != 0);
    if (__pyx_t_4) {
    } else {
      __pyx_t_2 = __pyx_t_4;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_4 = ((!(__pyx_v_mate_is_reverse != 0)) != 0);
    __pyx_t_2 = __pyx_t_4;
    __pyx_L7_bool_binop_done:;

    /* "pysamstats/opt.pyx":1656
 *             elif b.core.tid != b.core.mtid:
 *                 self.reads_mate_other_chr += 1
 *             elif (is_reverse and mate_is_reverse) \             # <<<<<<<<<<<<<<
 *                     or (not is_reverse and not mate_is_reverse):
 *                 self.reads_mate_same_strand += 1
 */
    if (__pyx_t_2) {

      /* "pysamstats/opt.pyx":1658
 *             elif (is_reverse and mate_is_reverse) \
 *                     or (not is_reverse and not mate_is_reverse):
 *                 self.reads_mate_same_strand += 1             # <<<<<<<<<<<<<<
 *             elif (is_reverse and tlen > 0) or (not is_reverse and tlen < 0):
 *                 self.reads_faceaway += 1
 */
      __pyx_v_self->reads_mate_same_strand = (__pyx_v_self->reads_mate_same_strand + 1);

      /* "pysamstats/opt.pyx":1656
 *             elif b.core.tid != b.core.mtid:
 *                 self.reads_mate_other_chr += 1
 *             elif (is_reverse and mate_is_reverse) \             # <<<<<<<<<<<<<<
 *                     or (not is_reverse and not mate_is_reverse):
 *                 self.reads_mate_same_strand += 1
 */
      goto __pyx_L6;
    }

    /* "pysamstats/opt.pyx":1659
 *                     or (not is_reverse and not mate_is_reverse):
 *                 self.reads_mate_same_strand += 1
 *             elif (is_reverse and tlen > 0) or (not is_reverse and tlen < 0):             # <<<<<<<<<<<<<<
 *                 self.reads_faceaway += 1
 *             if is_softclipped(b):
 */
    __pyx_t_4 = (__pyx_v_is_reverse != 0);
    if (!__pyx_t_4) {
      goto __pyx_L12_next_or;
    } else {
    }
    __pyx_t_4 = ((__pyx_v_tlen > 0) != 0);
    if (!__pyx_t_4) {
    } else {
      __pyx_t_2 = __pyx_t_4;
      goto __pyx_L11_bool_binop_done;
    }
    __pyx_L12_next_or:;
    __pyx_t_4 = ((!(__pyx_v_is_reverse != 0)) != 0);
    if (__pyx_t_4) {
    } else {
      __pyx_t_2 = __pyx_t_4;
      goto __pyx_L11_bool_binop_done;
    }
    __pyx_t_4 = ((__pyx_v_tlen < 0) != 0);
    __pyx_t_2 = __pyx_t_4;
    __pyx_L11_bool_binop_done:;
    if (__pyx_t_2) {

      /* "pysamstats/opt.pyx":1660
 *                 self.reads_mate_same_strand += 1
 *             elif (is_reverse and tlen > 0) or (not is_reverse and tlen < 0):
 *                 self.reads_faceaway += 1             # <<<<<<<<<<<<<<
 *             if is_softclipped(b):
 *                 self.reads_softclipped += 1
 */
      __pyx_v_self->reads_faceaway = (__pyx_v_self->reads_faceaway + 1);

      /* "pysamstats/opt.pyx":1659
 *                     or (not is_reverse and not mate_is_reverse):
 *                 self.reads_mate_same_strand += 1
 *             elif (is_reverse and tlen > 0) or (not is_reverse and tlen < 0):             # <<<<<<<<<<<<<<
 *                 self.reads_faceaway += 1
 *             if is_softclipped(b):
 */
    }
    __pyx_L6:;

    /* "pysamstats/opt.pyx":1661
 *             elif (is_reverse and tlen > 0) or (not is_reverse and tlen < 0):
 *                 self.reads_faceaway += 1
 *             if is_softclipped(b):             # <<<<<<<<<<<<<<
 *                 self.reads_softclipped += 1
 * 
 */
    __pyx_t_2 = (__pyx_f_10pysamstats_3opt_is_softclipped(__pyx_v_b) != 0);
    if (__pyx_t_2) {

      /* "pysamstats/opt.pyx":1662
 *                 self.reads_faceaway += 1
 *             if is_softclipped(b):
 *                 self.reads_softclipped += 1             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __pyx_v_self->reads_softclipped = (__pyx_v_self->reads_softclipped + 1);

      /* "pysamstats/opt.pyx":1661
 *             elif (is_reverse and tlen > 0) or (not is_reverse and tlen < 0):
 *                 self.reads_faceaway += 1
 *             if is_softclipped(b):             # <<<<<<<<<<<<<<
 *                 self.reads_softclipped += 1
 * 
 */
    }

    /* "pysamstats/opt.pyx":1640
 *         flag = b.core.flag
 *         is_unmapped = <bint>(flag & BAM_FUNMAP)
 *         if not is_unmapped:             # <<<<<<<<<<<<<<
 *             self.reads_all += 1
 *             is_reverse = <bint>(flag & BAM_FREVERSE)
 */
  }

  /* "pysamstats/opt.pyx":1629
 *         return rec
 * 
 *     cdef void recv(self, bam1_t* b):             # <<<<<<<<<<<<<<
 *         cdef uint32_t flag
 *         cdef bint is_unmapped
 */

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

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_17CoverageExtBinned_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pysamstats_3opt_17CoverageExtBinned_2__reduce_cython__[] = "CoverageExtBinned.__reduce_cython__(self)";
static PyObject *__pyx_pw_10pysamstats_3opt_17CoverageExtBinned_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_17CoverageExtBinned_2__reduce_cython__(((struct __pyx_obj_10pysamstats_3opt_CoverageExtBinned *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pysamstats_3opt_17CoverageExtBinned_2__reduce_cython__(struct __pyx_obj_10pysamstats_3opt_CoverageExtBinned *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  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;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_t_11;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self.reads_all, self.reads_duplicate, self.reads_faceaway, self.reads_mate_other_chr, self.reads_mate_same_strand, self.reads_mate_unmapped, self.reads_pp, self.reads_softclipped)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->reads_all); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->reads_duplicate); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_self->reads_faceaway); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_self->reads_mate_other_chr); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_self->reads_mate_same_strand); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_self->reads_mate_unmapped); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_self->reads_pp); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_self->reads_softclipped); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = PyTuple_New(8); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_9, 3, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_9, 4, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_9, 5, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_9, 6, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_9, 7, __pyx_t_8);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_6 = 0;
  __pyx_t_7 = 0;
  __pyx_t_8 = 0;
  __pyx_v_state = ((PyObject*)__pyx_t_9);
  __pyx_t_9 = 0;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self.reads_all, self.reads_duplicate, self.reads_faceaway, self.reads_mate_other_chr, self.reads_mate_same_strand, self.reads_mate_unmapped, self.reads_pp, self.reads_softclipped)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         state += (_dict,)
 */
  __pyx_t_9 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_v__dict = __pyx_t_9;
  __pyx_t_9 = 0;

  /* "(tree fragment)":7
 *     state = (self.reads_all, self.reads_duplicate, self.reads_faceaway, self.reads_mate_other_chr, self.reads_mate_same_strand, self.reads_mate_unmapped, self.reads_pp, self.reads_softclipped)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
  __pyx_t_10 = (__pyx_v__dict != Py_None);
  __pyx_t_11 = (__pyx_t_10 != 0);
  if (__pyx_t_11) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
 */
    __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v__dict);
    __pyx_t_8 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_8));
    __pyx_t_8 = 0;

    /* "(tree fragment)":9
 *     if _dict is not None:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = False
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = (self.reads_all, self.reads_duplicate, self.reads_faceaway, self.reads_mate_other_chr, self.reads_mate_same_strand, self.reads_mate_unmapped, self.reads_pp, self.reads_softclipped)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
    goto __pyx_L3;
  }

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = False             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_CoverageExtBinned, (type(self), 0xdc660eb, None), state
 */
  /*else*/ {
    __pyx_v_use_setstate = 0;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_CoverageExtBinned, (type(self), 0xdc660eb, None), state
 *     else:
 */
  __pyx_t_11 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_11) {

    /* "(tree fragment)":13
 *         use_setstate = False
 *     if use_setstate:
 *         return __pyx_unpickle_CoverageExtBinned, (type(self), 0xdc660eb, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_CoverageExtBinned, (type(self), 0xdc660eb, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_pyx_unpickle_CoverageExtBinned); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_231104747);
    __Pyx_GIVEREF(__pyx_int_231104747);
    PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_int_231104747);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_9, 2, Py_None);
    __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_9);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_v_state);
    __pyx_t_8 = 0;
    __pyx_t_9 = 0;
    __pyx_r = __pyx_t_7;
    __pyx_t_7 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_CoverageExtBinned, (type(self), 0xdc660eb, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_CoverageExtBinned, (type(self), 0xdc660eb, None), state
 *     else:
 *         return __pyx_unpickle_CoverageExtBinned, (type(self), 0xdc660eb, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_CoverageExtBinned__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_pyx_unpickle_CoverageExtBinned); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_231104747);
    __Pyx_GIVEREF(__pyx_int_231104747);
    PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_int_231104747);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_v_state);
    __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_9);
    __pyx_t_7 = 0;
    __pyx_t_9 = 0;
    __pyx_r = __pyx_t_8;
    __pyx_t_8 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

  /* 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_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("pysamstats.opt.CoverageExtBinned.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_CoverageExtBinned, (type(self), 0xdc660eb, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_CoverageExtBinned__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_17CoverageExtBinned_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_10pysamstats_3opt_17CoverageExtBinned_4__setstate_cython__[] = "CoverageExtBinned.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_10pysamstats_3opt_17CoverageExtBinned_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_17CoverageExtBinned_4__setstate_cython__(((struct __pyx_obj_10pysamstats_3opt_CoverageExtBinned *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_10pysamstats_3opt_17CoverageExtBinned_4__setstate_cython__(struct __pyx_obj_10pysamstats_3opt_CoverageExtBinned *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_CoverageExtBinned, (type(self), 0xdc660eb, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_CoverageExtBinned__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
 */
  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_10pysamstats_3opt___pyx_unpickle_CoverageExtBinned__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_CoverageExtBinned, (type(self), 0xdc660eb, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_CoverageExtBinned__set_state(self, __pyx_state)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysamstats.opt.CoverageExtBinned.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":1675
 *     cdef uint64_t mapq, mapq_squared_sum
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.reads_all = self.reads_mapq0 = self.mapq_squared_sum = 0
 * 
 */

/* Python wrapper */
static int __pyx_pw_10pysamstats_3opt_10MapqBinned_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_10pysamstats_3opt_10MapqBinned_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
  __pyx_r = __pyx_pf_10pysamstats_3opt_10MapqBinned___init__(((struct __pyx_obj_10pysamstats_3opt_MapqBinned *)__pyx_v_self));

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

static int __pyx_pf_10pysamstats_3opt_10MapqBinned___init__(struct __pyx_obj_10pysamstats_3opt_MapqBinned *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "pysamstats/opt.pyx":1676
 * 
 *     def __init__(self):
 *         self.reads_all = self.reads_mapq0 = self.mapq_squared_sum = 0             # <<<<<<<<<<<<<<
 * 
 *     cdef dict rec(self, chrom, bin_start, bin_end, FastaFile fafile):
 */
  __pyx_v_self->reads_all = 0;
  __pyx_v_self->reads_mapq0 = 0;
  __pyx_v_self->mapq_squared_sum = 0;

  /* "pysamstats/opt.pyx":1675
 *     cdef uint64_t mapq, mapq_squared_sum
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.reads_all = self.reads_mapq0 = self.mapq_squared_sum = 0
 * 
 */

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

/* "pysamstats/opt.pyx":1678
 *         self.reads_all = self.reads_mapq0 = self.mapq_squared_sum = 0
 * 
 *     cdef dict rec(self, chrom, bin_start, bin_end, FastaFile fafile):             # <<<<<<<<<<<<<<
 * 
 *         # make record for bin
 */

static PyObject *__pyx_f_10pysamstats_3opt_10MapqBinned_rec(struct __pyx_obj_10pysamstats_3opt_MapqBinned *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_chrom, CYTHON_UNUSED PyObject *__pyx_v_bin_start, CYTHON_UNUSED PyObject *__pyx_v_bin_end, CYTHON_UNUSED struct __pyx_obj_5pysam_9libcfaidx_FastaFile *__pyx_v_fafile) {
  PyObject *__pyx_v_rec = 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;
  __Pyx_RefNannySetupContext("rec", 0);

  /* "pysamstats/opt.pyx":1681
 * 
 *         # make record for bin
 *         rec = {'reads_all': self.reads_all,             # <<<<<<<<<<<<<<
 *                'reads_mapq0': self.reads_mapq0,
 *                'rms_mapq': rootmean(self.mapq_squared_sum, self.reads_all)}
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1681, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->reads_all); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1681, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_all, __pyx_t_2) < 0) __PYX_ERR(0, 1681, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":1682
 *         # make record for bin
 *         rec = {'reads_all': self.reads_all,
 *                'reads_mapq0': self.reads_mapq0,             # <<<<<<<<<<<<<<
 *                'rms_mapq': rootmean(self.mapq_squared_sum, self.reads_all)}
 * 
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->reads_mapq0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1682, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_mapq0, __pyx_t_2) < 0) __PYX_ERR(0, 1681, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":1683
 *         rec = {'reads_all': self.reads_all,
 *                'reads_mapq0': self.reads_mapq0,
 *                'rms_mapq': rootmean(self.mapq_squared_sum, self.reads_all)}             # <<<<<<<<<<<<<<
 * 
 *         # reset counters
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_rootmean); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1683, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyInt_From_uint64_t(__pyx_v_self->mapq_squared_sum); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1683, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_self->reads_all); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1683, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_4, __pyx_t_5};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1683, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_4, __pyx_t_5};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1683, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  {
    __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1683, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_5);
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1683, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_rms_mapq, __pyx_t_2) < 0) __PYX_ERR(0, 1681, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_rec = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1686
 * 
 *         # reset counters
 *         self.reads_all = self.reads_mapq0 = self.mapq_squared_sum = 0             # <<<<<<<<<<<<<<
 * 
 *         return rec
 */
  __pyx_v_self->reads_all = 0;
  __pyx_v_self->reads_mapq0 = 0;
  __pyx_v_self->mapq_squared_sum = 0;

  /* "pysamstats/opt.pyx":1688
 *         self.reads_all = self.reads_mapq0 = self.mapq_squared_sum = 0
 * 
 *         return rec             # <<<<<<<<<<<<<<
 * 
 *     cdef void recv(self, bam1_t* b):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_rec);
  __pyx_r = __pyx_v_rec;
  goto __pyx_L0;

  /* "pysamstats/opt.pyx":1678
 *         self.reads_all = self.reads_mapq0 = self.mapq_squared_sum = 0
 * 
 *     cdef dict rec(self, chrom, bin_start, bin_end, FastaFile fafile):             # <<<<<<<<<<<<<<
 * 
 *         # make record for bin
 */

  /* 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("pysamstats.opt.MapqBinned.rec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rec);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":1690
 *         return rec
 * 
 *     cdef void recv(self, bam1_t* b):             # <<<<<<<<<<<<<<
 *         cdef uint32_t flag
 *         cdef bint is_unmapped
 */

static void __pyx_f_10pysamstats_3opt_10MapqBinned_recv(struct __pyx_obj_10pysamstats_3opt_MapqBinned *__pyx_v_self, bam1_t *__pyx_v_b) {
  uint32_t __pyx_v_flag;
  int __pyx_v_is_unmapped;
  uint64_t __pyx_v_mapq;
  uint64_t __pyx_v_mapq_squared;
  __Pyx_RefNannyDeclarations
  uint16_t __pyx_t_1;
  int __pyx_t_2;
  uint8_t __pyx_t_3;
  __Pyx_RefNannySetupContext("recv", 0);

  /* "pysamstats/opt.pyx":1695
 *         cdef uint64_t mapq
 *         cdef uint64_t mapq_squared
 *         flag = b.core.flag             # <<<<<<<<<<<<<<
 *         is_unmapped = <bint>(flag & BAM_FUNMAP)
 *         if not is_unmapped:
 */
  __pyx_t_1 = __pyx_v_b->core.flag;
  __pyx_v_flag = __pyx_t_1;

  /* "pysamstats/opt.pyx":1696
 *         cdef uint64_t mapq_squared
 *         flag = b.core.flag
 *         is_unmapped = <bint>(flag & BAM_FUNMAP)             # <<<<<<<<<<<<<<
 *         if not is_unmapped:
 *             self.reads_all += 1
 */
  __pyx_v_is_unmapped = ((__pyx_v_flag & 4) != 0);

  /* "pysamstats/opt.pyx":1697
 *         flag = b.core.flag
 *         is_unmapped = <bint>(flag & BAM_FUNMAP)
 *         if not is_unmapped:             # <<<<<<<<<<<<<<
 *             self.reads_all += 1
 *             mapq = b.core.qual
 */
  __pyx_t_2 = ((!(__pyx_v_is_unmapped != 0)) != 0);
  if (__pyx_t_2) {

    /* "pysamstats/opt.pyx":1698
 *         is_unmapped = <bint>(flag & BAM_FUNMAP)
 *         if not is_unmapped:
 *             self.reads_all += 1             # <<<<<<<<<<<<<<
 *             mapq = b.core.qual
 *             mapq_squared = mapq**2
 */
    __pyx_v_self->reads_all = (__pyx_v_self->reads_all + 1);

    /* "pysamstats/opt.pyx":1699
 *         if not is_unmapped:
 *             self.reads_all += 1
 *             mapq = b.core.qual             # <<<<<<<<<<<<<<
 *             mapq_squared = mapq**2
 *             self.mapq_squared_sum += mapq_squared
 */
    __pyx_t_3 = __pyx_v_b->core.qual;
    __pyx_v_mapq = __pyx_t_3;

    /* "pysamstats/opt.pyx":1700
 *             self.reads_all += 1
 *             mapq = b.core.qual
 *             mapq_squared = mapq**2             # <<<<<<<<<<<<<<
 *             self.mapq_squared_sum += mapq_squared
 *             if mapq == 0:
 */
    __pyx_v_mapq_squared = __Pyx_pow_uint64_t(__pyx_v_mapq, 2);

    /* "pysamstats/opt.pyx":1701
 *             mapq = b.core.qual
 *             mapq_squared = mapq**2
 *             self.mapq_squared_sum += mapq_squared             # <<<<<<<<<<<<<<
 *             if mapq == 0:
 *                 self.reads_mapq0 += 1
 */
    __pyx_v_self->mapq_squared_sum = (__pyx_v_self->mapq_squared_sum + __pyx_v_mapq_squared);

    /* "pysamstats/opt.pyx":1702
 *             mapq_squared = mapq**2
 *             self.mapq_squared_sum += mapq_squared
 *             if mapq == 0:             # <<<<<<<<<<<<<<
 *                 self.reads_mapq0 += 1
 * 
 */
    __pyx_t_2 = ((__pyx_v_mapq == 0) != 0);
    if (__pyx_t_2) {

      /* "pysamstats/opt.pyx":1703
 *             self.mapq_squared_sum += mapq_squared
 *             if mapq == 0:
 *                 self.reads_mapq0 += 1             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __pyx_v_self->reads_mapq0 = (__pyx_v_self->reads_mapq0 + 1);

      /* "pysamstats/opt.pyx":1702
 *             mapq_squared = mapq**2
 *             self.mapq_squared_sum += mapq_squared
 *             if mapq == 0:             # <<<<<<<<<<<<<<
 *                 self.reads_mapq0 += 1
 * 
 */
    }

    /* "pysamstats/opt.pyx":1697
 *         flag = b.core.flag
 *         is_unmapped = <bint>(flag & BAM_FUNMAP)
 *         if not is_unmapped:             # <<<<<<<<<<<<<<
 *             self.reads_all += 1
 *             mapq = b.core.qual
 */
  }

  /* "pysamstats/opt.pyx":1690
 *         return rec
 * 
 *     cdef void recv(self, bam1_t* b):             # <<<<<<<<<<<<<<
 *         cdef uint32_t flag
 *         cdef bint is_unmapped
 */

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

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_10MapqBinned_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pysamstats_3opt_10MapqBinned_2__reduce_cython__[] = "MapqBinned.__reduce_cython__(self)";
static PyObject *__pyx_pw_10pysamstats_3opt_10MapqBinned_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_10MapqBinned_2__reduce_cython__(((struct __pyx_obj_10pysamstats_3opt_MapqBinned *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pysamstats_3opt_10MapqBinned_2__reduce_cython__(struct __pyx_obj_10pysamstats_3opt_MapqBinned *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self.mapq, self.mapq_squared_sum, self.reads_all, self.reads_mapq0)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __pyx_t_1 = __Pyx_PyInt_From_uint64_t(__pyx_v_self->mapq); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_From_uint64_t(__pyx_v_self->mapq_squared_sum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_self->reads_all); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_self->reads_mapq0); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_v_state = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self.mapq, self.mapq_squared_sum, self.reads_all, self.reads_mapq0)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         state += (_dict,)
 */
  __pyx_t_5 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_v__dict = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "(tree fragment)":7
 *     state = (self.mapq, self.mapq_squared_sum, self.reads_all, self.reads_mapq0)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
  __pyx_t_6 = (__pyx_v__dict != Py_None);
  __pyx_t_7 = (__pyx_t_6 != 0);
  if (__pyx_t_7) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
 */
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v__dict);
    __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "(tree fragment)":9
 *     if _dict is not None:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = False
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = (self.mapq, self.mapq_squared_sum, self.reads_all, self.reads_mapq0)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
    goto __pyx_L3;
  }

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = False             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_MapqBinned, (type(self), 0x3af741f, None), state
 */
  /*else*/ {
    __pyx_v_use_setstate = 0;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_MapqBinned, (type(self), 0x3af741f, None), state
 *     else:
 */
  __pyx_t_7 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_7) {

    /* "(tree fragment)":13
 *         use_setstate = False
 *     if use_setstate:
 *         return __pyx_unpickle_MapqBinned, (type(self), 0x3af741f, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_MapqBinned, (type(self), 0x3af741f, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_MapqBinned); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_61830175);
    __Pyx_GIVEREF(__pyx_int_61830175);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_int_61830175);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_5, 2, Py_None);
    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_state);
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_MapqBinned, (type(self), 0x3af741f, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_MapqBinned, (type(self), 0x3af741f, None), state
 *     else:
 *         return __pyx_unpickle_MapqBinned, (type(self), 0x3af741f, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_MapqBinned__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pyx_unpickle_MapqBinned); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_61830175);
    __Pyx_GIVEREF(__pyx_int_61830175);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_int_61830175);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5);
    __pyx_t_3 = 0;
    __pyx_t_5 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pysamstats.opt.MapqBinned.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_MapqBinned, (type(self), 0x3af741f, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_MapqBinned__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_10MapqBinned_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_10pysamstats_3opt_10MapqBinned_4__setstate_cython__[] = "MapqBinned.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_10pysamstats_3opt_10MapqBinned_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_10MapqBinned_4__setstate_cython__(((struct __pyx_obj_10pysamstats_3opt_MapqBinned *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_10pysamstats_3opt_10MapqBinned_4__setstate_cython__(struct __pyx_obj_10pysamstats_3opt_MapqBinned *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_MapqBinned, (type(self), 0x3af741f, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_MapqBinned__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
 */
  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_10pysamstats_3opt___pyx_unpickle_MapqBinned__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_MapqBinned, (type(self), 0x3af741f, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_MapqBinned__set_state(self, __pyx_state)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysamstats.opt.MapqBinned.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":1715
 *     cdef int reads_all, M, I, D, N, S, H, P, EQ, X
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.reads_all = self.M = self.I = self.D = self.N = self.S = self.H\
 *             = self.P = self.EQ = self.X = 0
 */

/* Python wrapper */
static int __pyx_pw_10pysamstats_3opt_15AlignmentBinned_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_10pysamstats_3opt_15AlignmentBinned_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
  __pyx_r = __pyx_pf_10pysamstats_3opt_15AlignmentBinned___init__(((struct __pyx_obj_10pysamstats_3opt_AlignmentBinned *)__pyx_v_self));

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

static int __pyx_pf_10pysamstats_3opt_15AlignmentBinned___init__(struct __pyx_obj_10pysamstats_3opt_AlignmentBinned *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "pysamstats/opt.pyx":1716
 * 
 *     def __init__(self):
 *         self.reads_all = self.M = self.I = self.D = self.N = self.S = self.H\             # <<<<<<<<<<<<<<
 *             = self.P = self.EQ = self.X = 0
 * 
 */
  __pyx_v_self->reads_all = 0;
  __pyx_v_self->M = 0;
  __pyx_v_self->I = 0;
  __pyx_v_self->D = 0;
  __pyx_v_self->N = 0;
  __pyx_v_self->S = 0;
  __pyx_v_self->H = 0;

  /* "pysamstats/opt.pyx":1717
 *     def __init__(self):
 *         self.reads_all = self.M = self.I = self.D = self.N = self.S = self.H\
 *             = self.P = self.EQ = self.X = 0             # <<<<<<<<<<<<<<
 * 
 *     cdef dict rec(self, chrom, bin_start, bin_end, FastaFile fafile):
 */
  __pyx_v_self->P = 0;
  __pyx_v_self->EQ = 0;
  __pyx_v_self->X = 0;

  /* "pysamstats/opt.pyx":1715
 *     cdef int reads_all, M, I, D, N, S, H, P, EQ, X
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.reads_all = self.M = self.I = self.D = self.N = self.S = self.H\
 *             = self.P = self.EQ = self.X = 0
 */

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

/* "pysamstats/opt.pyx":1719
 *             = self.P = self.EQ = self.X = 0
 * 
 *     cdef dict rec(self, chrom, bin_start, bin_end, FastaFile fafile):             # <<<<<<<<<<<<<<
 * 
 *         # make record for bin
 */

static PyObject *__pyx_f_10pysamstats_3opt_15AlignmentBinned_rec(struct __pyx_obj_10pysamstats_3opt_AlignmentBinned *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_chrom, CYTHON_UNUSED PyObject *__pyx_v_bin_start, CYTHON_UNUSED PyObject *__pyx_v_bin_end, CYTHON_UNUSED struct __pyx_obj_5pysam_9libcfaidx_FastaFile *__pyx_v_fafile) {
  PyObject *__pyx_v_rec = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("rec", 0);

  /* "pysamstats/opt.pyx":1722
 * 
 *         # make record for bin
 *         rec = {'reads_all': self.reads_all,             # <<<<<<<<<<<<<<
 *                'M': self.M, 'I': self.I, 'D': self.D, 'N': self.N, 'S': self.S,
 *                'H': self.H, 'P': self.P, '=': self.EQ, 'X': self.X,
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1722, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->reads_all); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1722, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_all, __pyx_t_2) < 0) __PYX_ERR(0, 1722, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":1723
 *         # make record for bin
 *         rec = {'reads_all': self.reads_all,
 *                'M': self.M, 'I': self.I, 'D': self.D, 'N': self.N, 'S': self.S,             # <<<<<<<<<<<<<<
 *                'H': self.H, 'P': self.P, '=': self.EQ, 'X': self.X,
 *                'bases_all': self.M + self.I + self.S + self.EQ + self.X}
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->M); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1723, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_M, __pyx_t_2) < 0) __PYX_ERR(0, 1722, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->I); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1723, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_I, __pyx_t_2) < 0) __PYX_ERR(0, 1722, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->D); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1723, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_D, __pyx_t_2) < 0) __PYX_ERR(0, 1722, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->N); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1723, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_N, __pyx_t_2) < 0) __PYX_ERR(0, 1722, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->S); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1723, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_S, __pyx_t_2) < 0) __PYX_ERR(0, 1722, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":1724
 *         rec = {'reads_all': self.reads_all,
 *                'M': self.M, 'I': self.I, 'D': self.D, 'N': self.N, 'S': self.S,
 *                'H': self.H, 'P': self.P, '=': self.EQ, 'X': self.X,             # <<<<<<<<<<<<<<
 *                'bases_all': self.M + self.I + self.S + self.EQ + self.X}
 * 
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->H); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1724, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_H, __pyx_t_2) < 0) __PYX_ERR(0, 1722, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->P); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1724, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_P, __pyx_t_2) < 0) __PYX_ERR(0, 1722, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->EQ); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1724, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_, __pyx_t_2) < 0) __PYX_ERR(0, 1722, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->X); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1724, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_X, __pyx_t_2) < 0) __PYX_ERR(0, 1722, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":1725
 *                'M': self.M, 'I': self.I, 'D': self.D, 'N': self.N, 'S': self.S,
 *                'H': self.H, 'P': self.P, '=': self.EQ, 'X': self.X,
 *                'bases_all': self.M + self.I + self.S + self.EQ + self.X}             # <<<<<<<<<<<<<<
 * 
 *         # reset counters
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(((((__pyx_v_self->M + __pyx_v_self->I) + __pyx_v_self->S) + __pyx_v_self->EQ) + __pyx_v_self->X)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1725, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_bases_all, __pyx_t_2) < 0) __PYX_ERR(0, 1722, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_rec = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1728
 * 
 *         # reset counters
 *         self.reads_all = self.M = self.I = self.D = self.N = self.S = self.H\             # <<<<<<<<<<<<<<
 *             = self.P = self.EQ = self.X = 0
 * 
 */
  __pyx_v_self->reads_all = 0;
  __pyx_v_self->M = 0;
  __pyx_v_self->I = 0;
  __pyx_v_self->D = 0;
  __pyx_v_self->N = 0;
  __pyx_v_self->S = 0;
  __pyx_v_self->H = 0;

  /* "pysamstats/opt.pyx":1729
 *         # reset counters
 *         self.reads_all = self.M = self.I = self.D = self.N = self.S = self.H\
 *             = self.P = self.EQ = self.X = 0             # <<<<<<<<<<<<<<
 * 
 *         return rec
 */
  __pyx_v_self->P = 0;
  __pyx_v_self->EQ = 0;
  __pyx_v_self->X = 0;

  /* "pysamstats/opt.pyx":1731
 *             = self.P = self.EQ = self.X = 0
 * 
 *         return rec             # <<<<<<<<<<<<<<
 * 
 *     cdef void recv(self, bam1_t* b):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_rec);
  __pyx_r = __pyx_v_rec;
  goto __pyx_L0;

  /* "pysamstats/opt.pyx":1719
 *             = self.P = self.EQ = self.X = 0
 * 
 *     cdef dict rec(self, chrom, bin_start, bin_end, FastaFile fafile):             # <<<<<<<<<<<<<<
 * 
 *         # make record for bin
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pysamstats.opt.AlignmentBinned.rec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rec);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":1733
 *         return rec
 * 
 *     cdef void recv(self, bam1_t* b):             # <<<<<<<<<<<<<<
 *         cdef uint32_t flag
 *         cdef bint is_unmapped
 */

static void __pyx_f_10pysamstats_3opt_15AlignmentBinned_recv(struct __pyx_obj_10pysamstats_3opt_AlignmentBinned *__pyx_v_self, bam1_t *__pyx_v_b) {
  uint32_t __pyx_v_flag;
  int __pyx_v_is_unmapped;
  int __pyx_v_k;
  int __pyx_v_op;
  int __pyx_v_l;
  uint32_t *__pyx_v_cigar_p;
  __Pyx_RefNannyDeclarations
  uint16_t __pyx_t_1;
  int __pyx_t_2;
  uint32_t __pyx_t_3;
  uint32_t __pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("recv", 0);

  /* "pysamstats/opt.pyx":1737
 *         cdef bint is_unmapped
 *         cdef int k, op, l
 *         flag = b.core.flag             # <<<<<<<<<<<<<<
 *         is_unmapped = <bint>(flag & BAM_FUNMAP)
 *         if not is_unmapped:
 */
  __pyx_t_1 = __pyx_v_b->core.flag;
  __pyx_v_flag = __pyx_t_1;

  /* "pysamstats/opt.pyx":1738
 *         cdef int k, op, l
 *         flag = b.core.flag
 *         is_unmapped = <bint>(flag & BAM_FUNMAP)             # <<<<<<<<<<<<<<
 *         if not is_unmapped:
 *             cigar_p = pysam_bam_get_cigar(b)
 */
  __pyx_v_is_unmapped = ((__pyx_v_flag & 4) != 0);

  /* "pysamstats/opt.pyx":1739
 *         flag = b.core.flag
 *         is_unmapped = <bint>(flag & BAM_FUNMAP)
 *         if not is_unmapped:             # <<<<<<<<<<<<<<
 *             cigar_p = pysam_bam_get_cigar(b)
 *             # cigar = list()
 */
  __pyx_t_2 = ((!(__pyx_v_is_unmapped != 0)) != 0);
  if (__pyx_t_2) {

    /* "pysamstats/opt.pyx":1740
 *         is_unmapped = <bint>(flag & BAM_FUNMAP)
 *         if not is_unmapped:
 *             cigar_p = pysam_bam_get_cigar(b)             # <<<<<<<<<<<<<<
 *             # cigar = list()
 *             for k in range(b.core.n_cigar):
 */
    __pyx_v_cigar_p = pysam_bam_get_cigar(__pyx_v_b);

    /* "pysamstats/opt.pyx":1742
 *             cigar_p = pysam_bam_get_cigar(b)
 *             # cigar = list()
 *             for k in range(b.core.n_cigar):             # <<<<<<<<<<<<<<
 *                 op = cigar_p[k] & BAM_CIGAR_MASK
 *                 l = cigar_p[k] >> BAM_CIGAR_SHIFT
 */
    __pyx_t_3 = __pyx_v_b->core.n_cigar;
    __pyx_t_4 = __pyx_t_3;
    for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
      __pyx_v_k = __pyx_t_5;

      /* "pysamstats/opt.pyx":1743
 *             # cigar = list()
 *             for k in range(b.core.n_cigar):
 *                 op = cigar_p[k] & BAM_CIGAR_MASK             # <<<<<<<<<<<<<<
 *                 l = cigar_p[k] >> BAM_CIGAR_SHIFT
 *                 # cigar.append((op, l))
 */
      __pyx_v_op = ((__pyx_v_cigar_p[__pyx_v_k]) & 15);

      /* "pysamstats/opt.pyx":1744
 *             for k in range(b.core.n_cigar):
 *                 op = cigar_p[k] & BAM_CIGAR_MASK
 *                 l = cigar_p[k] >> BAM_CIGAR_SHIFT             # <<<<<<<<<<<<<<
 *                 # cigar.append((op, l))
 *                 if op == BAM_CMATCH:
 */
      __pyx_v_l = ((__pyx_v_cigar_p[__pyx_v_k]) >> 4);

      /* "pysamstats/opt.pyx":1746
 *                 l = cigar_p[k] >> BAM_CIGAR_SHIFT
 *                 # cigar.append((op, l))
 *                 if op == BAM_CMATCH:             # <<<<<<<<<<<<<<
 *                     self.M += l
 *                 elif op == BAM_CINS:
 */
      switch (__pyx_v_op) {
        case 0:

        /* "pysamstats/opt.pyx":1747
 *                 # cigar.append((op, l))
 *                 if op == BAM_CMATCH:
 *                     self.M += l             # <<<<<<<<<<<<<<
 *                 elif op == BAM_CINS:
 *                     self.I += l
 */
        __pyx_v_self->M = (__pyx_v_self->M + __pyx_v_l);

        /* "pysamstats/opt.pyx":1746
 *                 l = cigar_p[k] >> BAM_CIGAR_SHIFT
 *                 # cigar.append((op, l))
 *                 if op == BAM_CMATCH:             # <<<<<<<<<<<<<<
 *                     self.M += l
 *                 elif op == BAM_CINS:
 */
        break;
        case 1:

        /* "pysamstats/opt.pyx":1749
 *                     self.M += l
 *                 elif op == BAM_CINS:
 *                     self.I += l             # <<<<<<<<<<<<<<
 *                 elif op == BAM_CDEL:
 *                     self.D += l
 */
        __pyx_v_self->I = (__pyx_v_self->I + __pyx_v_l);

        /* "pysamstats/opt.pyx":1748
 *                 if op == BAM_CMATCH:
 *                     self.M += l
 *                 elif op == BAM_CINS:             # <<<<<<<<<<<<<<
 *                     self.I += l
 *                 elif op == BAM_CDEL:
 */
        break;
        case 2:

        /* "pysamstats/opt.pyx":1751
 *                     self.I += l
 *                 elif op == BAM_CDEL:
 *                     self.D += l             # <<<<<<<<<<<<<<
 *                 elif op == BAM_CREF_SKIP:
 *                     self.N += l
 */
        __pyx_v_self->D = (__pyx_v_self->D + __pyx_v_l);

        /* "pysamstats/opt.pyx":1750
 *                 elif op == BAM_CINS:
 *                     self.I += l
 *                 elif op == BAM_CDEL:             # <<<<<<<<<<<<<<
 *                     self.D += l
 *                 elif op == BAM_CREF_SKIP:
 */
        break;
        case 3:

        /* "pysamstats/opt.pyx":1753
 *                     self.D += l
 *                 elif op == BAM_CREF_SKIP:
 *                     self.N += l             # <<<<<<<<<<<<<<
 *                 elif op == BAM_CSOFT_CLIP:
 *                     self.S += l
 */
        __pyx_v_self->N = (__pyx_v_self->N + __pyx_v_l);

        /* "pysamstats/opt.pyx":1752
 *                 elif op == BAM_CDEL:
 *                     self.D += l
 *                 elif op == BAM_CREF_SKIP:             # <<<<<<<<<<<<<<
 *                     self.N += l
 *                 elif op == BAM_CSOFT_CLIP:
 */
        break;
        case 4:

        /* "pysamstats/opt.pyx":1755
 *                     self.N += l
 *                 elif op == BAM_CSOFT_CLIP:
 *                     self.S += l             # <<<<<<<<<<<<<<
 *                 elif op == BAM_CHARD_CLIP:
 *                     self.H += l
 */
        __pyx_v_self->S = (__pyx_v_self->S + __pyx_v_l);

        /* "pysamstats/opt.pyx":1754
 *                 elif op == BAM_CREF_SKIP:
 *                     self.N += l
 *                 elif op == BAM_CSOFT_CLIP:             # <<<<<<<<<<<<<<
 *                     self.S += l
 *                 elif op == BAM_CHARD_CLIP:
 */
        break;
        case 5:

        /* "pysamstats/opt.pyx":1757
 *                     self.S += l
 *                 elif op == BAM_CHARD_CLIP:
 *                     self.H += l             # <<<<<<<<<<<<<<
 *                 elif op == BAM_CPAD:
 *                     self.P += l
 */
        __pyx_v_self->H = (__pyx_v_self->H + __pyx_v_l);

        /* "pysamstats/opt.pyx":1756
 *                 elif op == BAM_CSOFT_CLIP:
 *                     self.S += l
 *                 elif op == BAM_CHARD_CLIP:             # <<<<<<<<<<<<<<
 *                     self.H += l
 *                 elif op == BAM_CPAD:
 */
        break;
        case 6:

        /* "pysamstats/opt.pyx":1759
 *                     self.H += l
 *                 elif op == BAM_CPAD:
 *                     self.P += l             # <<<<<<<<<<<<<<
 *                 elif op == BAM_CEQUAL:
 *                     self.EQ += l
 */
        __pyx_v_self->P = (__pyx_v_self->P + __pyx_v_l);

        /* "pysamstats/opt.pyx":1758
 *                 elif op == BAM_CHARD_CLIP:
 *                     self.H += l
 *                 elif op == BAM_CPAD:             # <<<<<<<<<<<<<<
 *                     self.P += l
 *                 elif op == BAM_CEQUAL:
 */
        break;
        case 7:

        /* "pysamstats/opt.pyx":1761
 *                     self.P += l
 *                 elif op == BAM_CEQUAL:
 *                     self.EQ += l             # <<<<<<<<<<<<<<
 *                 elif op == BAM_CDIFF:
 *                     self.X += l
 */
        __pyx_v_self->EQ = (__pyx_v_self->EQ + __pyx_v_l);

        /* "pysamstats/opt.pyx":1760
 *                 elif op == BAM_CPAD:
 *                     self.P += l
 *                 elif op == BAM_CEQUAL:             # <<<<<<<<<<<<<<
 *                     self.EQ += l
 *                 elif op == BAM_CDIFF:
 */
        break;
        case 8:

        /* "pysamstats/opt.pyx":1763
 *                     self.EQ += l
 *                 elif op == BAM_CDIFF:
 *                     self.X += l             # <<<<<<<<<<<<<<
 *             self.reads_all += 1
 * 
 */
        __pyx_v_self->X = (__pyx_v_self->X + __pyx_v_l);

        /* "pysamstats/opt.pyx":1762
 *                 elif op == BAM_CEQUAL:
 *                     self.EQ += l
 *                 elif op == BAM_CDIFF:             # <<<<<<<<<<<<<<
 *                     self.X += l
 *             self.reads_all += 1
 */
        break;
        default: break;
      }
    }

    /* "pysamstats/opt.pyx":1764
 *                 elif op == BAM_CDIFF:
 *                     self.X += l
 *             self.reads_all += 1             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_v_self->reads_all = (__pyx_v_self->reads_all + 1);

    /* "pysamstats/opt.pyx":1739
 *         flag = b.core.flag
 *         is_unmapped = <bint>(flag & BAM_FUNMAP)
 *         if not is_unmapped:             # <<<<<<<<<<<<<<
 *             cigar_p = pysam_bam_get_cigar(b)
 *             # cigar = list()
 */
  }

  /* "pysamstats/opt.pyx":1733
 *         return rec
 * 
 *     cdef void recv(self, bam1_t* b):             # <<<<<<<<<<<<<<
 *         cdef uint32_t flag
 *         cdef bint is_unmapped
 */

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

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_15AlignmentBinned_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pysamstats_3opt_15AlignmentBinned_2__reduce_cython__[] = "AlignmentBinned.__reduce_cython__(self)";
static PyObject *__pyx_pw_10pysamstats_3opt_15AlignmentBinned_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_15AlignmentBinned_2__reduce_cython__(((struct __pyx_obj_10pysamstats_3opt_AlignmentBinned *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pysamstats_3opt_15AlignmentBinned_2__reduce_cython__(struct __pyx_obj_10pysamstats_3opt_AlignmentBinned *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  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;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  int __pyx_t_13;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self.D, self.EQ, self.H, self.I, self.M, self.N, self.P, self.S, self.X, self.reads_all)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->D); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->EQ); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_self->H); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_self->I); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_self->M); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_self->N); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_self->P); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_self->S); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_self->X); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_self->reads_all); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_11 = PyTuple_New(10); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_11, 3, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_11, 4, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_11, 5, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_11, 6, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_11, 7, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_11, 8, __pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_10);
  PyTuple_SET_ITEM(__pyx_t_11, 9, __pyx_t_10);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_6 = 0;
  __pyx_t_7 = 0;
  __pyx_t_8 = 0;
  __pyx_t_9 = 0;
  __pyx_t_10 = 0;
  __pyx_v_state = ((PyObject*)__pyx_t_11);
  __pyx_t_11 = 0;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self.D, self.EQ, self.H, self.I, self.M, self.N, self.P, self.S, self.X, self.reads_all)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         state += (_dict,)
 */
  __pyx_t_11 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_v__dict = __pyx_t_11;
  __pyx_t_11 = 0;

  /* "(tree fragment)":7
 *     state = (self.D, self.EQ, self.H, self.I, self.M, self.N, self.P, self.S, self.X, self.reads_all)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
  __pyx_t_12 = (__pyx_v__dict != Py_None);
  __pyx_t_13 = (__pyx_t_12 != 0);
  if (__pyx_t_13) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
 */
    __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v__dict);
    __pyx_t_10 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_11); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_10));
    __pyx_t_10 = 0;

    /* "(tree fragment)":9
 *     if _dict is not None:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = False
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = (self.D, self.EQ, self.H, self.I, self.M, self.N, self.P, self.S, self.X, self.reads_all)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
    goto __pyx_L3;
  }

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = False             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_AlignmentBinned, (type(self), 0x6770c51, None), state
 */
  /*else*/ {
    __pyx_v_use_setstate = 0;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_AlignmentBinned, (type(self), 0x6770c51, None), state
 *     else:
 */
  __pyx_t_13 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_13) {

    /* "(tree fragment)":13
 *         use_setstate = False
 *     if use_setstate:
 *         return __pyx_unpickle_AlignmentBinned, (type(self), 0x6770c51, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_AlignmentBinned, (type(self), 0x6770c51, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_pyx_unpickle_AlignmentBinned); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_11, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_108465233);
    __Pyx_GIVEREF(__pyx_int_108465233);
    PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_int_108465233);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_11, 2, Py_None);
    __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_10);
    __Pyx_GIVEREF(__pyx_t_11);
    PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_11);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_v_state);
    __pyx_t_10 = 0;
    __pyx_t_11 = 0;
    __pyx_r = __pyx_t_9;
    __pyx_t_9 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_AlignmentBinned, (type(self), 0x6770c51, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_AlignmentBinned, (type(self), 0x6770c51, None), state
 *     else:
 *         return __pyx_unpickle_AlignmentBinned, (type(self), 0x6770c51, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_AlignmentBinned__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_pyx_unpickle_AlignmentBinned); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_11, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_108465233);
    __Pyx_GIVEREF(__pyx_int_108465233);
    PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_int_108465233);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_v_state);
    __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_11);
    PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_11);
    __pyx_t_9 = 0;
    __pyx_t_11 = 0;
    __pyx_r = __pyx_t_10;
    __pyx_t_10 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

  /* 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_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("pysamstats.opt.AlignmentBinned.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_AlignmentBinned, (type(self), 0x6770c51, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_AlignmentBinned__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_15AlignmentBinned_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_10pysamstats_3opt_15AlignmentBinned_4__setstate_cython__[] = "AlignmentBinned.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_10pysamstats_3opt_15AlignmentBinned_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_15AlignmentBinned_4__setstate_cython__(((struct __pyx_obj_10pysamstats_3opt_AlignmentBinned *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_10pysamstats_3opt_15AlignmentBinned_4__setstate_cython__(struct __pyx_obj_10pysamstats_3opt_AlignmentBinned *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_AlignmentBinned, (type(self), 0x6770c51, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_AlignmentBinned__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
 */
  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_10pysamstats_3opt___pyx_unpickle_AlignmentBinned__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_AlignmentBinned, (type(self), 0x6770c51, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_AlignmentBinned__set_state(self, __pyx_state)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysamstats.opt.AlignmentBinned.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":1781
 *     cdef int64_t tlen_pp_squared_sum
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.tlen_sum = self.tlen_squared_sum = self.tlen_pp_sum = \
 *             self.tlen_pp_squared_sum = self.reads_all = self.reads_pp = 0
 */

/* Python wrapper */
static int __pyx_pw_10pysamstats_3opt_10TlenBinned_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_10pysamstats_3opt_10TlenBinned_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
  __pyx_r = __pyx_pf_10pysamstats_3opt_10TlenBinned___init__(((struct __pyx_obj_10pysamstats_3opt_TlenBinned *)__pyx_v_self));

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

static int __pyx_pf_10pysamstats_3opt_10TlenBinned___init__(struct __pyx_obj_10pysamstats_3opt_TlenBinned *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "pysamstats/opt.pyx":1782
 * 
 *     def __init__(self):
 *         self.tlen_sum = self.tlen_squared_sum = self.tlen_pp_sum = \             # <<<<<<<<<<<<<<
 *             self.tlen_pp_squared_sum = self.reads_all = self.reads_pp = 0
 * 
 */
  __pyx_v_self->tlen_sum = 0;
  __pyx_v_self->tlen_squared_sum = 0;
  __pyx_v_self->tlen_pp_sum = 0;

  /* "pysamstats/opt.pyx":1783
 *     def __init__(self):
 *         self.tlen_sum = self.tlen_squared_sum = self.tlen_pp_sum = \
 *             self.tlen_pp_squared_sum = self.reads_all = self.reads_pp = 0             # <<<<<<<<<<<<<<
 * 
 *     cdef dict rec(self, chrom, bin_start, bin_end, FastaFile fafile):
 */
  __pyx_v_self->tlen_pp_squared_sum = 0;
  __pyx_v_self->reads_all = 0;
  __pyx_v_self->reads_pp = 0;

  /* "pysamstats/opt.pyx":1781
 *     cdef int64_t tlen_pp_squared_sum
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.tlen_sum = self.tlen_squared_sum = self.tlen_pp_sum = \
 *             self.tlen_pp_squared_sum = self.reads_all = self.reads_pp = 0
 */

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

/* "pysamstats/opt.pyx":1785
 *             self.tlen_pp_squared_sum = self.reads_all = self.reads_pp = 0
 * 
 *     cdef dict rec(self, chrom, bin_start, bin_end, FastaFile fafile):             # <<<<<<<<<<<<<<
 * 
 *         # make record for bin
 */

static PyObject *__pyx_f_10pysamstats_3opt_10TlenBinned_rec(struct __pyx_obj_10pysamstats_3opt_TlenBinned *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_chrom, CYTHON_UNUSED PyObject *__pyx_v_bin_start, CYTHON_UNUSED PyObject *__pyx_v_bin_end, CYTHON_UNUSED struct __pyx_obj_5pysam_9libcfaidx_FastaFile *__pyx_v_fafile) {
  PyObject *__pyx_v_rec = 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;
  __Pyx_RefNannySetupContext("rec", 0);

  /* "pysamstats/opt.pyx":1788
 * 
 *         # make record for bin
 *         rec = {'reads_all': self.reads_all, 'reads_pp': self.reads_pp,             # <<<<<<<<<<<<<<
 *                'mean_tlen': mean(self.tlen_sum, self.reads_all),
 *                'mean_tlen_pp': mean(self.tlen_pp_sum, self.reads_pp),
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1788, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->reads_all); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1788, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_all, __pyx_t_2) < 0) __PYX_ERR(0, 1788, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->reads_pp); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1788, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reads_pp, __pyx_t_2) < 0) __PYX_ERR(0, 1788, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":1789
 *         # make record for bin
 *         rec = {'reads_all': self.reads_all, 'reads_pp': self.reads_pp,
 *                'mean_tlen': mean(self.tlen_sum, self.reads_all),             # <<<<<<<<<<<<<<
 *                'mean_tlen_pp': mean(self.tlen_pp_sum, self.reads_pp),
 *                'rms_tlen': rootmean(self.tlen_squared_sum, self.reads_all),
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_mean); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1789, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyInt_From_int64_t(__pyx_v_self->tlen_sum); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1789, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_self->reads_all); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1789, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_4, __pyx_t_5};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1789, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_4, __pyx_t_5};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1789, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  {
    __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1789, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_5);
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1789, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_mean_tlen, __pyx_t_2) < 0) __PYX_ERR(0, 1788, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":1790
 *         rec = {'reads_all': self.reads_all, 'reads_pp': self.reads_pp,
 *                'mean_tlen': mean(self.tlen_sum, self.reads_all),
 *                'mean_tlen_pp': mean(self.tlen_pp_sum, self.reads_pp),             # <<<<<<<<<<<<<<
 *                'rms_tlen': rootmean(self.tlen_squared_sum, self.reads_all),
 *                'rms_tlen_pp': rootmean(self.tlen_pp_squared_sum,
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_mean); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1790, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_8 = __Pyx_PyInt_From_int64_t(__pyx_v_self->tlen_pp_sum); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1790, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_self->reads_pp); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1790, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(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[3] = {__pyx_t_4, __pyx_t_8, __pyx_t_5};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1790, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_8, __pyx_t_5};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1790, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1790, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_7, __pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_7, __pyx_t_5);
    __pyx_t_8 = 0;
    __pyx_t_5 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1790, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_mean_tlen_pp, __pyx_t_2) < 0) __PYX_ERR(0, 1788, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":1791
 *                'mean_tlen': mean(self.tlen_sum, self.reads_all),
 *                'mean_tlen_pp': mean(self.tlen_pp_sum, self.reads_pp),
 *                'rms_tlen': rootmean(self.tlen_squared_sum, self.reads_all),             # <<<<<<<<<<<<<<
 *                'rms_tlen_pp': rootmean(self.tlen_pp_squared_sum,
 *                                        self.reads_pp)}
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_rootmean); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1791, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = __Pyx_PyInt_From_int64_t(__pyx_v_self->tlen_squared_sum); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1791, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_self->reads_all); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1791, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __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[3] = {__pyx_t_8, __pyx_t_6, __pyx_t_5};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1791, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_t_6, __pyx_t_5};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1791, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  {
    __pyx_t_4 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1791, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (__pyx_t_8) {
      __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_8); __pyx_t_8 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_7, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_7, __pyx_t_5);
    __pyx_t_6 = 0;
    __pyx_t_5 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1791, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_rms_tlen, __pyx_t_2) < 0) __PYX_ERR(0, 1788, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":1792
 *                'mean_tlen_pp': mean(self.tlen_pp_sum, self.reads_pp),
 *                'rms_tlen': rootmean(self.tlen_squared_sum, self.reads_all),
 *                'rms_tlen_pp': rootmean(self.tlen_pp_squared_sum,             # <<<<<<<<<<<<<<
 *                                        self.reads_pp)}
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_rootmean); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1792, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyInt_From_int64_t(__pyx_v_self->tlen_pp_squared_sum); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1792, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "pysamstats/opt.pyx":1793
 *                'rms_tlen': rootmean(self.tlen_squared_sum, self.reads_all),
 *                'rms_tlen_pp': rootmean(self.tlen_pp_squared_sum,
 *                                        self.reads_pp)}             # <<<<<<<<<<<<<<
 * 
 *         # reset counters
 */
  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_self->reads_pp); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1793, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_4, __pyx_t_5};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1792, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_4, __pyx_t_5};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1792, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  {
    __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1792, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_5);
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1792, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_rms_tlen_pp, __pyx_t_2) < 0) __PYX_ERR(0, 1788, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_rec = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1796
 * 
 *         # reset counters
 *         self.tlen_sum = self.tlen_squared_sum = self.tlen_pp_sum = \             # <<<<<<<<<<<<<<
 *             self.tlen_pp_squared_sum = self.reads_all = self.reads_pp = 0
 * 
 */
  __pyx_v_self->tlen_sum = 0;
  __pyx_v_self->tlen_squared_sum = 0;
  __pyx_v_self->tlen_pp_sum = 0;

  /* "pysamstats/opt.pyx":1797
 *         # reset counters
 *         self.tlen_sum = self.tlen_squared_sum = self.tlen_pp_sum = \
 *             self.tlen_pp_squared_sum = self.reads_all = self.reads_pp = 0             # <<<<<<<<<<<<<<
 * 
 *         return rec
 */
  __pyx_v_self->tlen_pp_squared_sum = 0;
  __pyx_v_self->reads_all = 0;
  __pyx_v_self->reads_pp = 0;

  /* "pysamstats/opt.pyx":1799
 *             self.tlen_pp_squared_sum = self.reads_all = self.reads_pp = 0
 * 
 *         return rec             # <<<<<<<<<<<<<<
 * 
 *     cdef void recv(self, bam1_t* b):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_rec);
  __pyx_r = __pyx_v_rec;
  goto __pyx_L0;

  /* "pysamstats/opt.pyx":1785
 *             self.tlen_pp_squared_sum = self.reads_all = self.reads_pp = 0
 * 
 *     cdef dict rec(self, chrom, bin_start, bin_end, FastaFile fafile):             # <<<<<<<<<<<<<<
 * 
 *         # make record for bin
 */

  /* 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("pysamstats.opt.TlenBinned.rec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rec);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":1801
 *         return rec
 * 
 *     cdef void recv(self, bam1_t* b):             # <<<<<<<<<<<<<<
 *         cdef uint32_t flag
 *         cdef bint is_unmapped
 */

static void __pyx_f_10pysamstats_3opt_10TlenBinned_recv(struct __pyx_obj_10pysamstats_3opt_TlenBinned *__pyx_v_self, bam1_t *__pyx_v_b) {
  uint32_t __pyx_v_flag;
  int __pyx_v_is_unmapped;
  int __pyx_v_is_proper_pair;
  int64_t __pyx_v_tlen;
  int64_t __pyx_v_tlen_squared;
  __Pyx_RefNannyDeclarations
  uint16_t __pyx_t_1;
  int __pyx_t_2;
  int32_t __pyx_t_3;
  __Pyx_RefNannySetupContext("recv", 0);

  /* "pysamstats/opt.pyx":1807
 *         cdef int64_t tlen
 *         cdef int64_t tlen_squared
 *         flag = b.core.flag             # <<<<<<<<<<<<<<
 *         is_unmapped = <bint>(flag & BAM_FUNMAP)
 *         if not is_unmapped:
 */
  __pyx_t_1 = __pyx_v_b->core.flag;
  __pyx_v_flag = __pyx_t_1;

  /* "pysamstats/opt.pyx":1808
 *         cdef int64_t tlen_squared
 *         flag = b.core.flag
 *         is_unmapped = <bint>(flag & BAM_FUNMAP)             # <<<<<<<<<<<<<<
 *         if not is_unmapped:
 *             self.reads_all += 1
 */
  __pyx_v_is_unmapped = ((__pyx_v_flag & 4) != 0);

  /* "pysamstats/opt.pyx":1809
 *         flag = b.core.flag
 *         is_unmapped = <bint>(flag & BAM_FUNMAP)
 *         if not is_unmapped:             # <<<<<<<<<<<<<<
 *             self.reads_all += 1
 *             tlen = b.core.isize
 */
  __pyx_t_2 = ((!(__pyx_v_is_unmapped != 0)) != 0);
  if (__pyx_t_2) {

    /* "pysamstats/opt.pyx":1810
 *         is_unmapped = <bint>(flag & BAM_FUNMAP)
 *         if not is_unmapped:
 *             self.reads_all += 1             # <<<<<<<<<<<<<<
 *             tlen = b.core.isize
 *             self.tlen_sum += tlen
 */
    __pyx_v_self->reads_all = (__pyx_v_self->reads_all + 1);

    /* "pysamstats/opt.pyx":1811
 *         if not is_unmapped:
 *             self.reads_all += 1
 *             tlen = b.core.isize             # <<<<<<<<<<<<<<
 *             self.tlen_sum += tlen
 *             tlen_squared = tlen**2
 */
    __pyx_t_3 = __pyx_v_b->core.isize;
    __pyx_v_tlen = __pyx_t_3;

    /* "pysamstats/opt.pyx":1812
 *             self.reads_all += 1
 *             tlen = b.core.isize
 *             self.tlen_sum += tlen             # <<<<<<<<<<<<<<
 *             tlen_squared = tlen**2
 *             self.tlen_squared_sum += tlen_squared
 */
    __pyx_v_self->tlen_sum = (__pyx_v_self->tlen_sum + __pyx_v_tlen);

    /* "pysamstats/opt.pyx":1813
 *             tlen = b.core.isize
 *             self.tlen_sum += tlen
 *             tlen_squared = tlen**2             # <<<<<<<<<<<<<<
 *             self.tlen_squared_sum += tlen_squared
 *             is_proper_pair = <bint>(flag & BAM_FPROPER_PAIR)
 */
    __pyx_v_tlen_squared = __Pyx_pow_int64_t(__pyx_v_tlen, 2);

    /* "pysamstats/opt.pyx":1814
 *             self.tlen_sum += tlen
 *             tlen_squared = tlen**2
 *             self.tlen_squared_sum += tlen_squared             # <<<<<<<<<<<<<<
 *             is_proper_pair = <bint>(flag & BAM_FPROPER_PAIR)
 *             if is_proper_pair:
 */
    __pyx_v_self->tlen_squared_sum = (__pyx_v_self->tlen_squared_sum + __pyx_v_tlen_squared);

    /* "pysamstats/opt.pyx":1815
 *             tlen_squared = tlen**2
 *             self.tlen_squared_sum += tlen_squared
 *             is_proper_pair = <bint>(flag & BAM_FPROPER_PAIR)             # <<<<<<<<<<<<<<
 *             if is_proper_pair:
 *                 self.reads_pp += 1
 */
    __pyx_v_is_proper_pair = ((__pyx_v_flag & 2) != 0);

    /* "pysamstats/opt.pyx":1816
 *             self.tlen_squared_sum += tlen_squared
 *             is_proper_pair = <bint>(flag & BAM_FPROPER_PAIR)
 *             if is_proper_pair:             # <<<<<<<<<<<<<<
 *                 self.reads_pp += 1
 *                 self.tlen_pp_sum += tlen
 */
    __pyx_t_2 = (__pyx_v_is_proper_pair != 0);
    if (__pyx_t_2) {

      /* "pysamstats/opt.pyx":1817
 *             is_proper_pair = <bint>(flag & BAM_FPROPER_PAIR)
 *             if is_proper_pair:
 *                 self.reads_pp += 1             # <<<<<<<<<<<<<<
 *                 self.tlen_pp_sum += tlen
 *                 self.tlen_pp_squared_sum += tlen_squared
 */
      __pyx_v_self->reads_pp = (__pyx_v_self->reads_pp + 1);

      /* "pysamstats/opt.pyx":1818
 *             if is_proper_pair:
 *                 self.reads_pp += 1
 *                 self.tlen_pp_sum += tlen             # <<<<<<<<<<<<<<
 *                 self.tlen_pp_squared_sum += tlen_squared
 * 
 */
      __pyx_v_self->tlen_pp_sum = (__pyx_v_self->tlen_pp_sum + __pyx_v_tlen);

      /* "pysamstats/opt.pyx":1819
 *                 self.reads_pp += 1
 *                 self.tlen_pp_sum += tlen
 *                 self.tlen_pp_squared_sum += tlen_squared             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __pyx_v_self->tlen_pp_squared_sum = (__pyx_v_self->tlen_pp_squared_sum + __pyx_v_tlen_squared);

      /* "pysamstats/opt.pyx":1816
 *             self.tlen_squared_sum += tlen_squared
 *             is_proper_pair = <bint>(flag & BAM_FPROPER_PAIR)
 *             if is_proper_pair:             # <<<<<<<<<<<<<<
 *                 self.reads_pp += 1
 *                 self.tlen_pp_sum += tlen
 */
    }

    /* "pysamstats/opt.pyx":1809
 *         flag = b.core.flag
 *         is_unmapped = <bint>(flag & BAM_FUNMAP)
 *         if not is_unmapped:             # <<<<<<<<<<<<<<
 *             self.reads_all += 1
 *             tlen = b.core.isize
 */
  }

  /* "pysamstats/opt.pyx":1801
 *         return rec
 * 
 *     cdef void recv(self, bam1_t* b):             # <<<<<<<<<<<<<<
 *         cdef uint32_t flag
 *         cdef bint is_unmapped
 */

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

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_10TlenBinned_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pysamstats_3opt_10TlenBinned_2__reduce_cython__[] = "TlenBinned.__reduce_cython__(self)";
static PyObject *__pyx_pw_10pysamstats_3opt_10TlenBinned_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_10TlenBinned_2__reduce_cython__(((struct __pyx_obj_10pysamstats_3opt_TlenBinned *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pysamstats_3opt_10TlenBinned_2__reduce_cython__(struct __pyx_obj_10pysamstats_3opt_TlenBinned *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  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;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_t_9;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self.reads_all, self.reads_pp, self.tlen_pp_squared_sum, self.tlen_pp_sum, self.tlen_squared_sum, self.tlen_sum)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->reads_all); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->reads_pp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_int64_t(__pyx_v_self->tlen_pp_squared_sum); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyInt_From_int64_t(__pyx_v_self->tlen_pp_sum); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyInt_From_int64_t(__pyx_v_self->tlen_squared_sum); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyInt_From_int64_t(__pyx_v_self->tlen_sum); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = PyTuple_New(6); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_7, 4, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_7, 5, __pyx_t_6);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_6 = 0;
  __pyx_v_state = ((PyObject*)__pyx_t_7);
  __pyx_t_7 = 0;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self.reads_all, self.reads_pp, self.tlen_pp_squared_sum, self.tlen_pp_sum, self.tlen_squared_sum, self.tlen_sum)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         state += (_dict,)
 */
  __pyx_t_7 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_v__dict = __pyx_t_7;
  __pyx_t_7 = 0;

  /* "(tree fragment)":7
 *     state = (self.reads_all, self.reads_pp, self.tlen_pp_squared_sum, self.tlen_pp_sum, self.tlen_squared_sum, self.tlen_sum)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
  __pyx_t_8 = (__pyx_v__dict != Py_None);
  __pyx_t_9 = (__pyx_t_8 != 0);
  if (__pyx_t_9) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
 */
    __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v__dict);
    __pyx_t_6 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_6));
    __pyx_t_6 = 0;

    /* "(tree fragment)":9
 *     if _dict is not None:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = False
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = (self.reads_all, self.reads_pp, self.tlen_pp_squared_sum, self.tlen_pp_sum, self.tlen_squared_sum, self.tlen_sum)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
    goto __pyx_L3;
  }

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = False             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_TlenBinned, (type(self), 0x87ba974, None), state
 */
  /*else*/ {
    __pyx_v_use_setstate = 0;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_TlenBinned, (type(self), 0x87ba974, None), state
 *     else:
 */
  __pyx_t_9 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_9) {

    /* "(tree fragment)":13
 *         use_setstate = False
 *     if use_setstate:
 *         return __pyx_unpickle_TlenBinned, (type(self), 0x87ba974, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_TlenBinned, (type(self), 0x87ba974, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_pyx_unpickle_TlenBinned); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_142322036);
    __Pyx_GIVEREF(__pyx_int_142322036);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_int_142322036);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_7, 2, Py_None);
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_7);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
    __pyx_t_6 = 0;
    __pyx_t_7 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_TlenBinned, (type(self), 0x87ba974, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_TlenBinned, (type(self), 0x87ba974, None), state
 *     else:
 *         return __pyx_unpickle_TlenBinned, (type(self), 0x87ba974, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_TlenBinned__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_TlenBinned); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_142322036);
    __Pyx_GIVEREF(__pyx_int_142322036);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_int_142322036);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_v_state);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_7);
    __pyx_t_5 = 0;
    __pyx_t_7 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

  /* 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_7);
  __Pyx_AddTraceback("pysamstats.opt.TlenBinned.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_TlenBinned, (type(self), 0x87ba974, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_TlenBinned__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_10TlenBinned_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_10pysamstats_3opt_10TlenBinned_4__setstate_cython__[] = "TlenBinned.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_10pysamstats_3opt_10TlenBinned_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pysamstats_3opt_10TlenBinned_4__setstate_cython__(((struct __pyx_obj_10pysamstats_3opt_TlenBinned *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_10pysamstats_3opt_10TlenBinned_4__setstate_cython__(struct __pyx_obj_10pysamstats_3opt_TlenBinned *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_TlenBinned, (type(self), 0x87ba974, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_TlenBinned__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
 */
  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_10pysamstats_3opt___pyx_unpickle_TlenBinned__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_TlenBinned, (type(self), 0x87ba974, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_TlenBinned__set_state(self, __pyx_state)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysamstats.opt.TlenBinned.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":1827
 * 
 * 
 * def iter_pileup(stat, alignmentfile, fafile, pad, **kwargs):             # <<<<<<<<<<<<<<
 *     """General purpose function to generate statistics, where one record is
 *     generated for each genome position in the selected range, based on a
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_1iter_pileup(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_10pysamstats_3opt_iter_pileup[] = "iter_pileup(stat, alignmentfile, fafile, pad, **kwargs)\nGeneral purpose function to generate statistics, where one record is\n    generated for each genome position in the selected range, based on a\n    pileup column.\n\n    ";
static PyMethodDef __pyx_mdef_10pysamstats_3opt_1iter_pileup = {"iter_pileup", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pysamstats_3opt_1iter_pileup, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pysamstats_3opt_iter_pileup};
static PyObject *__pyx_pw_10pysamstats_3opt_1iter_pileup(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_stat = 0;
  PyObject *__pyx_v_alignmentfile = 0;
  PyObject *__pyx_v_fafile = 0;
  PyObject *__pyx_v_pad = 0;
  PyObject *__pyx_v_kwargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iter_pileup (wrapper)", 0);
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_stat,&__pyx_n_s_alignmentfile,&__pyx_n_s_fafile,&__pyx_n_s_pad,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_stat)) != 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_alignmentfile)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("iter_pileup", 1, 4, 4, 1); __PYX_ERR(0, 1827, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fafile)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("iter_pileup", 1, 4, 4, 2); __PYX_ERR(0, 1827, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pad)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("iter_pileup", 1, 4, 4, 3); __PYX_ERR(0, 1827, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "iter_pileup") < 0)) __PYX_ERR(0, 1827, __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_stat = values[0];
    __pyx_v_alignmentfile = values[1];
    __pyx_v_fafile = values[2];
    __pyx_v_pad = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("iter_pileup", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1827, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("pysamstats.opt.iter_pileup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_10pysamstats_3opt_iter_pileup(__pyx_self, __pyx_v_stat, __pyx_v_alignmentfile, __pyx_v_fafile, __pyx_v_pad, __pyx_v_kwargs);

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

static PyObject *__pyx_pf_10pysamstats_3opt_iter_pileup(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_stat, PyObject *__pyx_v_alignmentfile, PyObject *__pyx_v_fafile, PyObject *__pyx_v_pad, PyObject *__pyx_v_kwargs) {
  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;
  __Pyx_RefNannySetupContext("iter_pileup", 0);
  __Pyx_INCREF(__pyx_v_alignmentfile);
  __Pyx_INCREF(__pyx_v_fafile);

  /* "pysamstats/opt.pyx":1834
 *     """
 * 
 *     if isinstance(alignmentfile, _string_types):             # <<<<<<<<<<<<<<
 *         alignmentfile = AlignmentFile(alignmentfile)
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_string_types); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1834, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_IsInstance(__pyx_v_alignmentfile, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 1834, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "pysamstats/opt.pyx":1835
 * 
 *     if isinstance(alignmentfile, _string_types):
 *         alignmentfile = AlignmentFile(alignmentfile)             # <<<<<<<<<<<<<<
 * 
 *     if isinstance(fafile, _string_types):
 */
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_5pysam_17libcalignmentfile_AlignmentFile), __pyx_v_alignmentfile); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1835, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_alignmentfile, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "pysamstats/opt.pyx":1834
 *     """
 * 
 *     if isinstance(alignmentfile, _string_types):             # <<<<<<<<<<<<<<
 *         alignmentfile = AlignmentFile(alignmentfile)
 * 
 */
  }

  /* "pysamstats/opt.pyx":1837
 *         alignmentfile = AlignmentFile(alignmentfile)
 * 
 *     if isinstance(fafile, _string_types):             # <<<<<<<<<<<<<<
 *         fafile = FastaFile(fafile)
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_string_types); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1837, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_IsInstance(__pyx_v_fafile, __pyx_t_1); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 1837, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {

    /* "pysamstats/opt.pyx":1838
 * 
 *     if isinstance(fafile, _string_types):
 *         fafile = FastaFile(fafile)             # <<<<<<<<<<<<<<
 * 
 *     if pad:
 */
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_5pysam_9libcfaidx_FastaFile), __pyx_v_fafile); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1838, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_fafile, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "pysamstats/opt.pyx":1837
 *         alignmentfile = AlignmentFile(alignmentfile)
 * 
 *     if isinstance(fafile, _string_types):             # <<<<<<<<<<<<<<
 *         fafile = FastaFile(fafile)
 * 
 */
  }

  /* "pysamstats/opt.pyx":1840
 *         fafile = FastaFile(fafile)
 * 
 *     if pad:             # <<<<<<<<<<<<<<
 *         return iter_pileup_padded(stat, alignmentfile=alignmentfile, fafile=fafile, **kwargs)
 *     else:
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_pad); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1840, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "pysamstats/opt.pyx":1841
 * 
 *     if pad:
 *         return iter_pileup_padded(stat, alignmentfile=alignmentfile, fafile=fafile, **kwargs)             # <<<<<<<<<<<<<<
 *     else:
 *         return iter_pileup_default(stat, alignmentfile=alignmentfile, fafile=fafile, **kwargs)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_iter_pileup_padded); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1841, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1841, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_stat);
    __Pyx_GIVEREF(__pyx_v_stat);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_stat);
    __pyx_t_6 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1841, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_alignmentfile, __pyx_v_alignmentfile) < 0) __PYX_ERR(0, 1841, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_fafile, __pyx_v_fafile) < 0) __PYX_ERR(0, 1841, __pyx_L1_error)
    __pyx_t_5 = __pyx_t_6;
    __pyx_t_6 = 0;
    if (__Pyx_MergeKeywords(__pyx_t_5, __pyx_v_kwargs) < 0) __PYX_ERR(0, 1841, __pyx_L1_error)
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1841, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    goto __pyx_L0;

    /* "pysamstats/opt.pyx":1840
 *         fafile = FastaFile(fafile)
 * 
 *     if pad:             # <<<<<<<<<<<<<<
 *         return iter_pileup_padded(stat, alignmentfile=alignmentfile, fafile=fafile, **kwargs)
 *     else:
 */
  }

  /* "pysamstats/opt.pyx":1843
 *         return iter_pileup_padded(stat, alignmentfile=alignmentfile, fafile=fafile, **kwargs)
 *     else:
 *         return iter_pileup_default(stat, alignmentfile=alignmentfile, fafile=fafile, **kwargs)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_iter_pileup_default); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1843, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1843, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_stat);
    __Pyx_GIVEREF(__pyx_v_stat);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_stat);
    __pyx_t_1 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1843, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_alignmentfile, __pyx_v_alignmentfile) < 0) __PYX_ERR(0, 1843, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_fafile, __pyx_v_fafile) < 0) __PYX_ERR(0, 1843, __pyx_L1_error)
    __pyx_t_4 = __pyx_t_1;
    __pyx_t_1 = 0;
    if (__Pyx_MergeKeywords(__pyx_t_4, __pyx_v_kwargs) < 0) __PYX_ERR(0, 1843, __pyx_L1_error)
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1843, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __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_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
  }

  /* "pysamstats/opt.pyx":1827
 * 
 * 
 * def iter_pileup(stat, alignmentfile, fafile, pad, **kwargs):             # <<<<<<<<<<<<<<
 *     """General purpose function to generate statistics, where one record is
 *     generated for each genome position in the selected range, based on a
 */

  /* 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("pysamstats.opt.iter_pileup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_alignmentfile);
  __Pyx_XDECREF(__pyx_v_fafile);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_10pysamstats_3opt_4generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "pysamstats/opt.pyx":1846
 * 
 * 
 * def iter_pileup_default(stat, alignmentfile, fafile, chrom, start, end, one_based, truncate, stepper,             # <<<<<<<<<<<<<<
 *                         max_depth, int min_mapq, int min_baseq, bint no_del, bint no_dup):
 *     cdef:
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_3iter_pileup_default(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_10pysamstats_3opt_2iter_pileup_default[] = "iter_pileup_default(stat, alignmentfile, fafile, chrom, start, end, one_based, truncate, stepper, max_depth, int min_mapq, int min_baseq, bool no_del, bool no_dup)";
static PyMethodDef __pyx_mdef_10pysamstats_3opt_3iter_pileup_default = {"iter_pileup_default", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pysamstats_3opt_3iter_pileup_default, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pysamstats_3opt_2iter_pileup_default};
static PyObject *__pyx_pw_10pysamstats_3opt_3iter_pileup_default(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_stat = 0;
  PyObject *__pyx_v_alignmentfile = 0;
  PyObject *__pyx_v_fafile = 0;
  PyObject *__pyx_v_chrom = 0;
  PyObject *__pyx_v_start = 0;
  PyObject *__pyx_v_end = 0;
  PyObject *__pyx_v_one_based = 0;
  PyObject *__pyx_v_truncate = 0;
  PyObject *__pyx_v_stepper = 0;
  PyObject *__pyx_v_max_depth = 0;
  int __pyx_v_min_mapq;
  int __pyx_v_min_baseq;
  int __pyx_v_no_del;
  int __pyx_v_no_dup;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iter_pileup_default (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_stat,&__pyx_n_s_alignmentfile,&__pyx_n_s_fafile,&__pyx_n_s_chrom,&__pyx_n_s_start,&__pyx_n_s_end,&__pyx_n_s_one_based,&__pyx_n_s_truncate,&__pyx_n_s_stepper,&__pyx_n_s_max_depth,&__pyx_n_s_min_mapq,&__pyx_n_s_min_baseq,&__pyx_n_s_no_del,&__pyx_n_s_no_dup,0};
    PyObject* values[14] = {0,0,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 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
        CYTHON_FALLTHROUGH;
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        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_stat)) != 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_alignmentfile)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("iter_pileup_default", 1, 14, 14, 1); __PYX_ERR(0, 1846, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fafile)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("iter_pileup_default", 1, 14, 14, 2); __PYX_ERR(0, 1846, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_chrom)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("iter_pileup_default", 1, 14, 14, 3); __PYX_ERR(0, 1846, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_start)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("iter_pileup_default", 1, 14, 14, 4); __PYX_ERR(0, 1846, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_end)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("iter_pileup_default", 1, 14, 14, 5); __PYX_ERR(0, 1846, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_one_based)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("iter_pileup_default", 1, 14, 14, 6); __PYX_ERR(0, 1846, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_truncate)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("iter_pileup_default", 1, 14, 14, 7); __PYX_ERR(0, 1846, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_stepper)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("iter_pileup_default", 1, 14, 14, 8); __PYX_ERR(0, 1846, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_depth)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("iter_pileup_default", 1, 14, 14, 9); __PYX_ERR(0, 1846, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_min_mapq)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("iter_pileup_default", 1, 14, 14, 10); __PYX_ERR(0, 1846, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 11:
        if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_min_baseq)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("iter_pileup_default", 1, 14, 14, 11); __PYX_ERR(0, 1846, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 12:
        if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_no_del)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("iter_pileup_default", 1, 14, 14, 12); __PYX_ERR(0, 1846, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 13:
        if (likely((values[13] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_no_dup)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("iter_pileup_default", 1, 14, 14, 13); __PYX_ERR(0, 1846, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "iter_pileup_default") < 0)) __PYX_ERR(0, 1846, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 14) {
      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);
      values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
      values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
    }
    __pyx_v_stat = values[0];
    __pyx_v_alignmentfile = values[1];
    __pyx_v_fafile = values[2];
    __pyx_v_chrom = values[3];
    __pyx_v_start = values[4];
    __pyx_v_end = values[5];
    __pyx_v_one_based = values[6];
    __pyx_v_truncate = values[7];
    __pyx_v_stepper = values[8];
    __pyx_v_max_depth = values[9];
    __pyx_v_min_mapq = __Pyx_PyInt_As_int(values[10]); if (unlikely((__pyx_v_min_mapq == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1847, __pyx_L3_error)
    __pyx_v_min_baseq = __Pyx_PyInt_As_int(values[11]); if (unlikely((__pyx_v_min_baseq == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1847, __pyx_L3_error)
    __pyx_v_no_del = __Pyx_PyObject_IsTrue(values[12]); if (unlikely((__pyx_v_no_del == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1847, __pyx_L3_error)
    __pyx_v_no_dup = __Pyx_PyObject_IsTrue(values[13]); if (unlikely((__pyx_v_no_dup == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1847, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("iter_pileup_default", 1, 14, 14, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1846, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysamstats.opt.iter_pileup_default", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_10pysamstats_3opt_2iter_pileup_default(__pyx_self, __pyx_v_stat, __pyx_v_alignmentfile, __pyx_v_fafile, __pyx_v_chrom, __pyx_v_start, __pyx_v_end, __pyx_v_one_based, __pyx_v_truncate, __pyx_v_stepper, __pyx_v_max_depth, __pyx_v_min_mapq, __pyx_v_min_baseq, __pyx_v_no_del, __pyx_v_no_dup);

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

static PyObject *__pyx_pf_10pysamstats_3opt_2iter_pileup_default(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_stat, PyObject *__pyx_v_alignmentfile, PyObject *__pyx_v_fafile, PyObject *__pyx_v_chrom, PyObject *__pyx_v_start, PyObject *__pyx_v_end, PyObject *__pyx_v_one_based, PyObject *__pyx_v_truncate, PyObject *__pyx_v_stepper, PyObject *__pyx_v_max_depth, int __pyx_v_min_mapq, int __pyx_v_min_baseq, int __pyx_v_no_del, int __pyx_v_no_dup) {
  struct __pyx_obj_10pysamstats_3opt___pyx_scope_struct__iter_pileup_default *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iter_pileup_default", 0);
  __pyx_cur_scope = (struct __pyx_obj_10pysamstats_3opt___pyx_scope_struct__iter_pileup_default *)__pyx_tp_new_10pysamstats_3opt___pyx_scope_struct__iter_pileup_default(__pyx_ptype_10pysamstats_3opt___pyx_scope_struct__iter_pileup_default, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_10pysamstats_3opt___pyx_scope_struct__iter_pileup_default *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1846, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_stat = __pyx_v_stat;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_stat);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_stat);
  __pyx_cur_scope->__pyx_v_alignmentfile = __pyx_v_alignmentfile;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_alignmentfile);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_alignmentfile);
  __pyx_cur_scope->__pyx_v_fafile = __pyx_v_fafile;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_fafile);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_fafile);
  __pyx_cur_scope->__pyx_v_chrom = __pyx_v_chrom;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_chrom);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_chrom);
  __pyx_cur_scope->__pyx_v_start = __pyx_v_start;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_start);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_start);
  __pyx_cur_scope->__pyx_v_end = __pyx_v_end;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_end);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_end);
  __pyx_cur_scope->__pyx_v_one_based = __pyx_v_one_based;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_one_based);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_one_based);
  __pyx_cur_scope->__pyx_v_truncate = __pyx_v_truncate;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_truncate);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_truncate);
  __pyx_cur_scope->__pyx_v_stepper = __pyx_v_stepper;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_stepper);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_stepper);
  __pyx_cur_scope->__pyx_v_max_depth = __pyx_v_max_depth;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_max_depth);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_max_depth);
  __pyx_cur_scope->__pyx_v_min_mapq = __pyx_v_min_mapq;
  __pyx_cur_scope->__pyx_v_min_baseq = __pyx_v_min_baseq;
  __pyx_cur_scope->__pyx_v_no_del = __pyx_v_no_del;
  __pyx_cur_scope->__pyx_v_no_dup = __pyx_v_no_dup;
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_10pysamstats_3opt_4generator, __pyx_codeobj__2, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter_pileup_default, __pyx_n_s_iter_pileup_default, __pyx_n_s_pysamstats_opt); if (unlikely(!gen)) __PYX_ERR(0, 1846, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysamstats.opt.iter_pileup_default", __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_10pysamstats_3opt_4generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_10pysamstats_3opt___pyx_scope_struct__iter_pileup_default *__pyx_cur_scope = ((struct __pyx_obj_10pysamstats_3opt___pyx_scope_struct__iter_pileup_default *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  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 *);
  PyObject *__pyx_t_9 = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iter_pileup_default", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L8_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, 1846, __pyx_L1_error)

  /* "pysamstats/opt.pyx":1852
 * 
 *     # obtain pileup iterator
 *     start, end = normalise_coords(alignmentfile, chrom, start, end, one_based)             # <<<<<<<<<<<<<<
 *     it = alignmentfile.pileup(reference=chrom, start=start, end=end, truncate=truncate, stepper=stepper,
 *                               max_depth=max_depth)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_normalise_coords); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1852, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __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[6] = {__pyx_t_3, __pyx_cur_scope->__pyx_v_alignmentfile, __pyx_cur_scope->__pyx_v_chrom, __pyx_cur_scope->__pyx_v_start, __pyx_cur_scope->__pyx_v_end, __pyx_cur_scope->__pyx_v_one_based};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 5+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1852, __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[6] = {__pyx_t_3, __pyx_cur_scope->__pyx_v_alignmentfile, __pyx_cur_scope->__pyx_v_chrom, __pyx_cur_scope->__pyx_v_start, __pyx_cur_scope->__pyx_v_end, __pyx_cur_scope->__pyx_v_one_based};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 5+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1852, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(5+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1852, __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_cur_scope->__pyx_v_alignmentfile);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_alignmentfile);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_cur_scope->__pyx_v_alignmentfile);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_chrom);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_chrom);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_cur_scope->__pyx_v_chrom);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_start);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_start);
    PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_cur_scope->__pyx_v_start);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_end);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_end);
    PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_4, __pyx_cur_scope->__pyx_v_end);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_one_based);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_one_based);
    PyTuple_SET_ITEM(__pyx_t_5, 4+__pyx_t_4, __pyx_cur_scope->__pyx_v_one_based);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1852, __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, 1852, __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, 1852, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1852, __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, 1852, __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_L4_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_L4_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_3), 2) < 0) __PYX_ERR(0, 1852, __pyx_L1_error)
    __pyx_t_6 = NULL;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L5_unpacking_done;
    __pyx_L4_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, 1852, __pyx_L1_error)
    __pyx_L5_unpacking_done:;
  }
  __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_start);
  __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_start, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_end);
  __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_end, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_5 = 0;

  /* "pysamstats/opt.pyx":1853
 *     # obtain pileup iterator
 *     start, end = normalise_coords(alignmentfile, chrom, start, end, one_based)
 *     it = alignmentfile.pileup(reference=chrom, start=start, end=end, truncate=truncate, stepper=stepper,             # <<<<<<<<<<<<<<
 *                               max_depth=max_depth)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_alignmentfile, __pyx_n_s_pileup); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1853, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyDict_NewPresized(6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1853, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_reference, __pyx_cur_scope->__pyx_v_chrom) < 0) __PYX_ERR(0, 1853, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_start, __pyx_cur_scope->__pyx_v_start) < 0) __PYX_ERR(0, 1853, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_end, __pyx_cur_scope->__pyx_v_end) < 0) __PYX_ERR(0, 1853, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_truncate, __pyx_cur_scope->__pyx_v_truncate) < 0) __PYX_ERR(0, 1853, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_stepper, __pyx_cur_scope->__pyx_v_stepper) < 0) __PYX_ERR(0, 1853, __pyx_L1_error)

  /* "pysamstats/opt.pyx":1854
 *     start, end = normalise_coords(alignmentfile, chrom, start, end, one_based)
 *     it = alignmentfile.pileup(reference=chrom, start=start, end=end, truncate=truncate, stepper=stepper,
 *                               max_depth=max_depth)             # <<<<<<<<<<<<<<
 * 
 *     # iterate over pileup columns
 */
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_max_depth, __pyx_cur_scope->__pyx_v_max_depth) < 0) __PYX_ERR(0, 1853, __pyx_L1_error)

  /* "pysamstats/opt.pyx":1853
 *     # obtain pileup iterator
 *     start, end = normalise_coords(alignmentfile, chrom, start, end, one_based)
 *     it = alignmentfile.pileup(reference=chrom, start=start, end=end, truncate=truncate, stepper=stepper,             # <<<<<<<<<<<<<<
 *                               max_depth=max_depth)
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1853, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_cur_scope->__pyx_v_it = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":1857
 * 
 *     # iterate over pileup columns
 *     for col in it:             # <<<<<<<<<<<<<<
 * 
 *         rec = stat_pileup(stat, col, alignmentfile=alignmentfile, fafile=fafile,
 */
  if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_v_it)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_it)) {
    __pyx_t_2 = __pyx_cur_scope->__pyx_v_it; __Pyx_INCREF(__pyx_t_2); __pyx_t_7 = 0;
    __pyx_t_8 = NULL;
  } else {
    __pyx_t_7 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_it); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1857, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_8 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1857, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_8)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_7 >= 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_7); __Pyx_INCREF(__pyx_t_5); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 1857, __pyx_L1_error)
        #else
        __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1857, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
      } else {
        if (__pyx_t_7 >= 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_7); __Pyx_INCREF(__pyx_t_5); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 1857, __pyx_L1_error)
        #else
        __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1857, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
      }
    } else {
      __pyx_t_5 = __pyx_t_8(__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, 1857, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_5);
    }
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5pysam_18libcalignedsegment_PileupColumn))))) __PYX_ERR(0, 1857, __pyx_L1_error)
    __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_col));
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_col, ((struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn *)__pyx_t_5));
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_5 = 0;

    /* "pysamstats/opt.pyx":1859
 *     for col in it:
 * 
 *         rec = stat_pileup(stat, col, alignmentfile=alignmentfile, fafile=fafile,             # <<<<<<<<<<<<<<
 *                           one_based=one_based, min_mapq=min_mapq, min_baseq=min_baseq,
 *                           no_del=no_del, no_dup=no_dup)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_stat_pileup); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1859, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1859, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_stat);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_stat);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_cur_scope->__pyx_v_stat);
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_col));
    __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_col));
    PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_cur_scope->__pyx_v_col));
    __pyx_t_3 = __Pyx_PyDict_NewPresized(7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1859, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_alignmentfile, __pyx_cur_scope->__pyx_v_alignmentfile) < 0) __PYX_ERR(0, 1859, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_fafile, __pyx_cur_scope->__pyx_v_fafile) < 0) __PYX_ERR(0, 1859, __pyx_L1_error)

    /* "pysamstats/opt.pyx":1860
 * 
 *         rec = stat_pileup(stat, col, alignmentfile=alignmentfile, fafile=fafile,
 *                           one_based=one_based, min_mapq=min_mapq, min_baseq=min_baseq,             # <<<<<<<<<<<<<<
 *                           no_del=no_del, no_dup=no_dup)
 * 
 */
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_one_based, __pyx_cur_scope->__pyx_v_one_based) < 0) __PYX_ERR(0, 1859, __pyx_L1_error)
    __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_min_mapq); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1860, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_min_mapq, __pyx_t_9) < 0) __PYX_ERR(0, 1859, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_min_baseq); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1860, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_min_baseq, __pyx_t_9) < 0) __PYX_ERR(0, 1859, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "pysamstats/opt.pyx":1861
 *         rec = stat_pileup(stat, col, alignmentfile=alignmentfile, fafile=fafile,
 *                           one_based=one_based, min_mapq=min_mapq, min_baseq=min_baseq,
 *                           no_del=no_del, no_dup=no_dup)             # <<<<<<<<<<<<<<
 * 
 *         yield rec
 */
    __pyx_t_9 = __Pyx_PyBool_FromLong(__pyx_cur_scope->__pyx_v_no_del); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1861, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_no_del, __pyx_t_9) < 0) __PYX_ERR(0, 1859, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = __Pyx_PyBool_FromLong(__pyx_cur_scope->__pyx_v_no_dup); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1861, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_no_dup, __pyx_t_9) < 0) __PYX_ERR(0, 1859, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "pysamstats/opt.pyx":1859
 *     for col in it:
 * 
 *         rec = stat_pileup(stat, col, alignmentfile=alignmentfile, fafile=fafile,             # <<<<<<<<<<<<<<
 *                           one_based=one_based, min_mapq=min_mapq, min_baseq=min_baseq,
 *                           no_del=no_del, no_dup=no_dup)
 */
    __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1859, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_rec);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_rec, __pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_9);
    __pyx_t_9 = 0;

    /* "pysamstats/opt.pyx":1863
 *                           no_del=no_del, no_dup=no_dup)
 * 
 *         yield rec             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_rec);
    __pyx_r = __pyx_cur_scope->__pyx_v_rec;
    __Pyx_XGIVEREF(__pyx_t_2);
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_7;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_8;
    __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_L8_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_7 = __pyx_cur_scope->__pyx_t_1;
    __pyx_t_8 = __pyx_cur_scope->__pyx_t_2;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1863, __pyx_L1_error)

    /* "pysamstats/opt.pyx":1857
 * 
 *     # iterate over pileup columns
 *     for col in it:             # <<<<<<<<<<<<<<
 * 
 *         rec = stat_pileup(stat, col, alignmentfile=alignmentfile, fafile=fafile,
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "pysamstats/opt.pyx":1846
 * 
 * 
 * def iter_pileup_default(stat, alignmentfile, fafile, chrom, start, end, one_based, truncate, stepper,             # <<<<<<<<<<<<<<
 *                         max_depth, int min_mapq, int min_baseq, bint no_del, bint no_dup):
 *     cdef:
 */

  /* 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_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("iter_pileup_default", __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;
}

/* "pysamstats/opt.pyx":1866
 * 
 * 
 * def stat_pileup(PileupStat stat,             # <<<<<<<<<<<<<<
 *                 PileupColumn col,
 *                 AlignmentFile alignmentfile,
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_6stat_pileup(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_10pysamstats_3opt_5stat_pileup[] = "stat_pileup(PileupStat stat, PileupColumn col, AlignmentFile alignmentfile, FastaFile fafile, bool one_based, int min_mapq, int min_baseq, bool no_del, bool no_dup)";
static PyMethodDef __pyx_mdef_10pysamstats_3opt_6stat_pileup = {"stat_pileup", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pysamstats_3opt_6stat_pileup, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pysamstats_3opt_5stat_pileup};
static PyObject *__pyx_pw_10pysamstats_3opt_6stat_pileup(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_10pysamstats_3opt_PileupStat *__pyx_v_stat = 0;
  struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn *__pyx_v_col = 0;
  struct __pyx_obj_5pysam_17libcalignmentfile_AlignmentFile *__pyx_v_alignmentfile = 0;
  struct __pyx_obj_5pysam_9libcfaidx_FastaFile *__pyx_v_fafile = 0;
  int __pyx_v_one_based;
  int __pyx_v_min_mapq;
  int __pyx_v_min_baseq;
  int __pyx_v_no_del;
  int __pyx_v_no_dup;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("stat_pileup (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_stat,&__pyx_n_s_col,&__pyx_n_s_alignmentfile,&__pyx_n_s_fafile,&__pyx_n_s_one_based,&__pyx_n_s_min_mapq,&__pyx_n_s_min_baseq,&__pyx_n_s_no_del,&__pyx_n_s_no_dup,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_stat)) != 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_col)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("stat_pileup", 1, 9, 9, 1); __PYX_ERR(0, 1866, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alignmentfile)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("stat_pileup", 1, 9, 9, 2); __PYX_ERR(0, 1866, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fafile)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("stat_pileup", 1, 9, 9, 3); __PYX_ERR(0, 1866, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_one_based)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("stat_pileup", 1, 9, 9, 4); __PYX_ERR(0, 1866, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_min_mapq)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("stat_pileup", 1, 9, 9, 5); __PYX_ERR(0, 1866, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_min_baseq)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("stat_pileup", 1, 9, 9, 6); __PYX_ERR(0, 1866, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_no_del)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("stat_pileup", 1, 9, 9, 7); __PYX_ERR(0, 1866, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_no_dup)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("stat_pileup", 1, 9, 9, 8); __PYX_ERR(0, 1866, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "stat_pileup") < 0)) __PYX_ERR(0, 1866, __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_stat = ((struct __pyx_obj_10pysamstats_3opt_PileupStat *)values[0]);
    __pyx_v_col = ((struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn *)values[1]);
    __pyx_v_alignmentfile = ((struct __pyx_obj_5pysam_17libcalignmentfile_AlignmentFile *)values[2]);
    __pyx_v_fafile = ((struct __pyx_obj_5pysam_9libcfaidx_FastaFile *)values[3]);
    __pyx_v_one_based = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_one_based == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1870, __pyx_L3_error)
    __pyx_v_min_mapq = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_min_mapq == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1871, __pyx_L3_error)
    __pyx_v_min_baseq = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_min_baseq == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1872, __pyx_L3_error)
    __pyx_v_no_del = __Pyx_PyObject_IsTrue(values[7]); if (unlikely((__pyx_v_no_del == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1873, __pyx_L3_error)
    __pyx_v_no_dup = __Pyx_PyObject_IsTrue(values[8]); if (unlikely((__pyx_v_no_dup == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1874, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("stat_pileup", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1866, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysamstats.opt.stat_pileup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_stat), __pyx_ptype_10pysamstats_3opt_PileupStat, 1, "stat", 0))) __PYX_ERR(0, 1866, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_col), __pyx_ptype_5pysam_18libcalignedsegment_PileupColumn, 1, "col", 0))) __PYX_ERR(0, 1867, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_alignmentfile), __pyx_ptype_5pysam_17libcalignmentfile_AlignmentFile, 1, "alignmentfile", 0))) __PYX_ERR(0, 1868, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fafile), __pyx_ptype_5pysam_9libcfaidx_FastaFile, 1, "fafile", 0))) __PYX_ERR(0, 1869, __pyx_L1_error)
  __pyx_r = __pyx_pf_10pysamstats_3opt_5stat_pileup(__pyx_self, __pyx_v_stat, __pyx_v_col, __pyx_v_alignmentfile, __pyx_v_fafile, __pyx_v_one_based, __pyx_v_min_mapq, __pyx_v_min_baseq, __pyx_v_no_del, __pyx_v_no_dup);

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

static PyObject *__pyx_pf_10pysamstats_3opt_5stat_pileup(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_10pysamstats_3opt_PileupStat *__pyx_v_stat, struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn *__pyx_v_col, struct __pyx_obj_5pysam_17libcalignmentfile_AlignmentFile *__pyx_v_alignmentfile, struct __pyx_obj_5pysam_9libcfaidx_FastaFile *__pyx_v_fafile, int __pyx_v_one_based, int __pyx_v_min_mapq, int __pyx_v_min_baseq, int __pyx_v_no_del, int __pyx_v_no_dup) {
  bam_pileup1_t **__pyx_v_plp;
  bam_pileup1_t *__pyx_v_read;
  bam1_t *__pyx_v_b;
  int __pyx_v_i;
  int __pyx_v_n;
  PyObject *__pyx_v_chrom = NULL;
  PyObject *__pyx_v_refbase = NULL;
  PyObject *__pyx_v_rec = NULL;
  long __pyx_v_pos;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  bam_pileup1_t **__pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_t_9;
  bam1_t *__pyx_t_10;
  int __pyx_t_11;
  long __pyx_t_12;
  __Pyx_RefNannySetupContext("stat_pileup", 0);

  /* "pysamstats/opt.pyx":1882
 * 
 *     # setup intermediate variables
 *     n = col.n             # <<<<<<<<<<<<<<
 *     plp = col.plp
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_col), __pyx_n_s_n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1882, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1882, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_n = __pyx_t_2;

  /* "pysamstats/opt.pyx":1883
 *     # setup intermediate variables
 *     n = col.n
 *     plp = col.plp             # <<<<<<<<<<<<<<
 * 
 *     # get current chromosome
 */
  __pyx_t_3 = __pyx_v_col->plp;
  __pyx_v_plp = __pyx_t_3;

  /* "pysamstats/opt.pyx":1886
 * 
 *     # get current chromosome
 *     chrom = alignmentfile.getrname(col.tid)             # <<<<<<<<<<<<<<
 * 
 *     # setup reference base
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_alignmentfile), __pyx_n_s_getrname); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1886, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_col->tid); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1886, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1886, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_chrom = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1889
 * 
 *     # setup reference base
 *     refbase = get_refbase(fafile, chrom, col.pos)             # <<<<<<<<<<<<<<
 * 
 *     # iterate over reads in the column
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_get_refbase); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1889, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_col->pos); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1889, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  __pyx_t_2 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_2 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[4] = {__pyx_t_6, ((PyObject *)__pyx_v_fafile), __pyx_v_chrom, __pyx_t_5};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_2, 3+__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1889, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[4] = {__pyx_t_6, ((PyObject *)__pyx_v_fafile), __pyx_v_chrom, __pyx_t_5};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_2, 3+__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1889, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(3+__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1889, __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(((PyObject *)__pyx_v_fafile));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_fafile));
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_2, ((PyObject *)__pyx_v_fafile));
    __Pyx_INCREF(__pyx_v_chrom);
    __Pyx_GIVEREF(__pyx_v_chrom);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_2, __pyx_v_chrom);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_2, __pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1889, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_refbase = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1892
 * 
 *     # iterate over reads in the column
 *     for i in range(n):             # <<<<<<<<<<<<<<
 *         read = &(plp[0][i])
 *         b = read.b
 */
  __pyx_t_2 = __pyx_v_n;
  __pyx_t_8 = __pyx_t_2;
  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
    __pyx_v_i = __pyx_t_9;

    /* "pysamstats/opt.pyx":1893
 *     # iterate over reads in the column
 *     for i in range(n):
 *         read = &(plp[0][i])             # <<<<<<<<<<<<<<
 *         b = read.b
 * 
 */
    __pyx_v_read = (&((__pyx_v_plp[0])[__pyx_v_i]));

    /* "pysamstats/opt.pyx":1894
 *     for i in range(n):
 *         read = &(plp[0][i])
 *         b = read.b             # <<<<<<<<<<<<<<
 * 
 *         # read filters
 */
    __pyx_t_10 = __pyx_v_read->b;
    __pyx_v_b = __pyx_t_10;

    /* "pysamstats/opt.pyx":1897
 * 
 *         # read filters
 *         if min_mapq > 0:             # <<<<<<<<<<<<<<
 *             if b.core.qual < min_mapq:
 *                 continue
 */
    __pyx_t_11 = ((__pyx_v_min_mapq > 0) != 0);
    if (__pyx_t_11) {

      /* "pysamstats/opt.pyx":1898
 *         # read filters
 *         if min_mapq > 0:
 *             if b.core.qual < min_mapq:             # <<<<<<<<<<<<<<
 *                 continue
 *         if min_baseq > 0:
 */
      __pyx_t_11 = ((__pyx_v_b->core.qual < __pyx_v_min_mapq) != 0);
      if (__pyx_t_11) {

        /* "pysamstats/opt.pyx":1899
 *         if min_mapq > 0:
 *             if b.core.qual < min_mapq:
 *                 continue             # <<<<<<<<<<<<<<
 *         if min_baseq > 0:
 *             if not read.is_del:
 */
        goto __pyx_L3_continue;

        /* "pysamstats/opt.pyx":1898
 *         # read filters
 *         if min_mapq > 0:
 *             if b.core.qual < min_mapq:             # <<<<<<<<<<<<<<
 *                 continue
 *         if min_baseq > 0:
 */
      }

      /* "pysamstats/opt.pyx":1897
 * 
 *         # read filters
 *         if min_mapq > 0:             # <<<<<<<<<<<<<<
 *             if b.core.qual < min_mapq:
 *                 continue
 */
    }

    /* "pysamstats/opt.pyx":1900
 *             if b.core.qual < min_mapq:
 *                 continue
 *         if min_baseq > 0:             # <<<<<<<<<<<<<<
 *             if not read.is_del:
 *                 if pysam_bam_get_qual(read.b)[read.qpos] < min_baseq:
 */
    __pyx_t_11 = ((__pyx_v_min_baseq > 0) != 0);
    if (__pyx_t_11) {

      /* "pysamstats/opt.pyx":1901
 *                 continue
 *         if min_baseq > 0:
 *             if not read.is_del:             # <<<<<<<<<<<<<<
 *                 if pysam_bam_get_qual(read.b)[read.qpos] < min_baseq:
 *                     continue
 */
      __pyx_t_11 = ((!(__pyx_v_read->is_del != 0)) != 0);
      if (__pyx_t_11) {

        /* "pysamstats/opt.pyx":1902
 *         if min_baseq > 0:
 *             if not read.is_del:
 *                 if pysam_bam_get_qual(read.b)[read.qpos] < min_baseq:             # <<<<<<<<<<<<<<
 *                     continue
 *         if no_del:
 */
        __pyx_t_11 = (((pysam_bam_get_qual(__pyx_v_read->b)[__pyx_v_read->qpos]) < __pyx_v_min_baseq) != 0);
        if (__pyx_t_11) {

          /* "pysamstats/opt.pyx":1903
 *             if not read.is_del:
 *                 if pysam_bam_get_qual(read.b)[read.qpos] < min_baseq:
 *                     continue             # <<<<<<<<<<<<<<
 *         if no_del:
 *             if read.is_del:
 */
          goto __pyx_L3_continue;

          /* "pysamstats/opt.pyx":1902
 *         if min_baseq > 0:
 *             if not read.is_del:
 *                 if pysam_bam_get_qual(read.b)[read.qpos] < min_baseq:             # <<<<<<<<<<<<<<
 *                     continue
 *         if no_del:
 */
        }

        /* "pysamstats/opt.pyx":1901
 *                 continue
 *         if min_baseq > 0:
 *             if not read.is_del:             # <<<<<<<<<<<<<<
 *                 if pysam_bam_get_qual(read.b)[read.qpos] < min_baseq:
 *                     continue
 */
      }

      /* "pysamstats/opt.pyx":1900
 *             if b.core.qual < min_mapq:
 *                 continue
 *         if min_baseq > 0:             # <<<<<<<<<<<<<<
 *             if not read.is_del:
 *                 if pysam_bam_get_qual(read.b)[read.qpos] < min_baseq:
 */
    }

    /* "pysamstats/opt.pyx":1904
 *                 if pysam_bam_get_qual(read.b)[read.qpos] < min_baseq:
 *                     continue
 *         if no_del:             # <<<<<<<<<<<<<<
 *             if read.is_del:
 *                 continue
 */
    __pyx_t_11 = (__pyx_v_no_del != 0);
    if (__pyx_t_11) {

      /* "pysamstats/opt.pyx":1905
 *                     continue
 *         if no_del:
 *             if read.is_del:             # <<<<<<<<<<<<<<
 *                 continue
 *         if no_dup:
 */
      __pyx_t_11 = (__pyx_v_read->is_del != 0);
      if (__pyx_t_11) {

        /* "pysamstats/opt.pyx":1906
 *         if no_del:
 *             if read.is_del:
 *                 continue             # <<<<<<<<<<<<<<
 *         if no_dup:
 *             if b.core.flag & BAM_FDUP:
 */
        goto __pyx_L3_continue;

        /* "pysamstats/opt.pyx":1905
 *                     continue
 *         if no_del:
 *             if read.is_del:             # <<<<<<<<<<<<<<
 *                 continue
 *         if no_dup:
 */
      }

      /* "pysamstats/opt.pyx":1904
 *                 if pysam_bam_get_qual(read.b)[read.qpos] < min_baseq:
 *                     continue
 *         if no_del:             # <<<<<<<<<<<<<<
 *             if read.is_del:
 *                 continue
 */
    }

    /* "pysamstats/opt.pyx":1907
 *             if read.is_del:
 *                 continue
 *         if no_dup:             # <<<<<<<<<<<<<<
 *             if b.core.flag & BAM_FDUP:
 *                 continue
 */
    __pyx_t_11 = (__pyx_v_no_dup != 0);
    if (__pyx_t_11) {

      /* "pysamstats/opt.pyx":1908
 *                 continue
 *         if no_dup:
 *             if b.core.flag & BAM_FDUP:             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
      __pyx_t_11 = ((__pyx_v_b->core.flag & 0x400) != 0);
      if (__pyx_t_11) {

        /* "pysamstats/opt.pyx":1909
 *         if no_dup:
 *             if b.core.flag & BAM_FDUP:
 *                 continue             # <<<<<<<<<<<<<<
 * 
 *         # accumulate statistics
 */
        goto __pyx_L3_continue;

        /* "pysamstats/opt.pyx":1908
 *                 continue
 *         if no_dup:
 *             if b.core.flag & BAM_FDUP:             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
      }

      /* "pysamstats/opt.pyx":1907
 *             if read.is_del:
 *                 continue
 *         if no_dup:             # <<<<<<<<<<<<<<
 *             if b.core.flag & BAM_FDUP:
 *                 continue
 */
    }

    /* "pysamstats/opt.pyx":1912
 * 
 *         # accumulate statistics
 *         stat.recv(read, col, refbase)             # <<<<<<<<<<<<<<
 * 
 *     # construct record
 */
    if (!(likely(PyBytes_CheckExact(__pyx_v_refbase))||((__pyx_v_refbase) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_refbase)->tp_name), 0))) __PYX_ERR(0, 1912, __pyx_L1_error)
    ((struct __pyx_vtabstruct_10pysamstats_3opt_PileupStat *)__pyx_v_stat->__pyx_vtab)->recv(__pyx_v_stat, __pyx_v_read, __pyx_v_col, ((PyObject*)__pyx_v_refbase));
    __pyx_L3_continue:;
  }

  /* "pysamstats/opt.pyx":1915
 * 
 *     # construct record
 *     rec = stat.rec(chrom, col.pos, fafile, refbase)             # <<<<<<<<<<<<<<
 *     pos = col.pos + 1 if one_based else col.pos
 *     rec['chrom'] = chrom
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_col->pos); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1915, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyBytes_CheckExact(__pyx_v_refbase))||((__pyx_v_refbase) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_refbase)->tp_name), 0))) __PYX_ERR(0, 1915, __pyx_L1_error)
  __pyx_t_4 = ((struct __pyx_vtabstruct_10pysamstats_3opt_PileupStat *)__pyx_v_stat->__pyx_vtab)->rec(__pyx_v_stat, __pyx_v_chrom, __pyx_t_1, __pyx_v_fafile, ((PyObject*)__pyx_v_refbase)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1915, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_rec = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "pysamstats/opt.pyx":1916
 *     # construct record
 *     rec = stat.rec(chrom, col.pos, fafile, refbase)
 *     pos = col.pos + 1 if one_based else col.pos             # <<<<<<<<<<<<<<
 *     rec['chrom'] = chrom
 *     rec['pos'] = pos
 */
  if ((__pyx_v_one_based != 0)) {
    __pyx_t_12 = (__pyx_v_col->pos + 1);
  } else {
    __pyx_t_12 = __pyx_v_col->pos;
  }
  __pyx_v_pos = __pyx_t_12;

  /* "pysamstats/opt.pyx":1917
 *     rec = stat.rec(chrom, col.pos, fafile, refbase)
 *     pos = col.pos + 1 if one_based else col.pos
 *     rec['chrom'] = chrom             # <<<<<<<<<<<<<<
 *     rec['pos'] = pos
 *     return rec
 */
  if (unlikely(__pyx_v_rec == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 1917, __pyx_L1_error)
  }
  if (unlikely(PyDict_SetItem(__pyx_v_rec, __pyx_n_s_chrom, __pyx_v_chrom) < 0)) __PYX_ERR(0, 1917, __pyx_L1_error)

  /* "pysamstats/opt.pyx":1918
 *     pos = col.pos + 1 if one_based else col.pos
 *     rec['chrom'] = chrom
 *     rec['pos'] = pos             # <<<<<<<<<<<<<<
 *     return rec
 * 
 */
  __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_v_pos); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1918, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (unlikely(__pyx_v_rec == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 1918, __pyx_L1_error)
  }
  if (unlikely(PyDict_SetItem(__pyx_v_rec, __pyx_n_s_pos, __pyx_t_4) < 0)) __PYX_ERR(0, 1918, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysamstats/opt.pyx":1919
 *     rec['chrom'] = chrom
 *     rec['pos'] = pos
 *     return rec             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_rec);
  __pyx_r = __pyx_v_rec;
  goto __pyx_L0;

  /* "pysamstats/opt.pyx":1866
 * 
 * 
 * def stat_pileup(PileupStat stat,             # <<<<<<<<<<<<<<
 *                 PileupColumn col,
 *                 AlignmentFile alignmentfile,
 */

  /* 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_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pysamstats.opt.stat_pileup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_chrom);
  __Pyx_XDECREF(__pyx_v_refbase);
  __Pyx_XDECREF(__pyx_v_rec);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":1922
 * 
 * 
 * def iter_pileup_padded(stat, alignmentfile, fafile, chrom, **kwargs):             # <<<<<<<<<<<<<<
 *     if chrom is not None:
 *         it = iter_pileup_padded_chrom(stat, alignmentfile=alignmentfile, fafile=fafile,
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_8iter_pileup_padded(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_10pysamstats_3opt_7iter_pileup_padded[] = "iter_pileup_padded(stat, alignmentfile, fafile, chrom, **kwargs)";
static PyMethodDef __pyx_mdef_10pysamstats_3opt_8iter_pileup_padded = {"iter_pileup_padded", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pysamstats_3opt_8iter_pileup_padded, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pysamstats_3opt_7iter_pileup_padded};
static PyObject *__pyx_pw_10pysamstats_3opt_8iter_pileup_padded(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_stat = 0;
  PyObject *__pyx_v_alignmentfile = 0;
  PyObject *__pyx_v_fafile = 0;
  PyObject *__pyx_v_chrom = 0;
  PyObject *__pyx_v_kwargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iter_pileup_padded (wrapper)", 0);
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_stat,&__pyx_n_s_alignmentfile,&__pyx_n_s_fafile,&__pyx_n_s_chrom,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_stat)) != 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_alignmentfile)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("iter_pileup_padded", 1, 4, 4, 1); __PYX_ERR(0, 1922, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fafile)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("iter_pileup_padded", 1, 4, 4, 2); __PYX_ERR(0, 1922, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_chrom)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("iter_pileup_padded", 1, 4, 4, 3); __PYX_ERR(0, 1922, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "iter_pileup_padded") < 0)) __PYX_ERR(0, 1922, __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_stat = values[0];
    __pyx_v_alignmentfile = values[1];
    __pyx_v_fafile = values[2];
    __pyx_v_chrom = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("iter_pileup_padded", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1922, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("pysamstats.opt.iter_pileup_padded", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_10pysamstats_3opt_7iter_pileup_padded(__pyx_self, __pyx_v_stat, __pyx_v_alignmentfile, __pyx_v_fafile, __pyx_v_chrom, __pyx_v_kwargs);

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

static PyObject *__pyx_pf_10pysamstats_3opt_7iter_pileup_padded(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_stat, PyObject *__pyx_v_alignmentfile, PyObject *__pyx_v_fafile, PyObject *__pyx_v_chrom, PyObject *__pyx_v_kwargs) {
  PyObject *__pyx_v_it = NULL;
  PyObject *__pyx_v_its = NULL;
  PyObject *__pyx_v_itc = NULL;
  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;
  Py_ssize_t __pyx_t_7;
  PyObject *(*__pyx_t_8)(PyObject *);
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  __Pyx_RefNannySetupContext("iter_pileup_padded", 0);
  __Pyx_INCREF(__pyx_v_chrom);

  /* "pysamstats/opt.pyx":1923
 * 
 * def iter_pileup_padded(stat, alignmentfile, fafile, chrom, **kwargs):
 *     if chrom is not None:             # <<<<<<<<<<<<<<
 *         it = iter_pileup_padded_chrom(stat, alignmentfile=alignmentfile, fafile=fafile,
 *                                       chrom=chrom, **kwargs)
 */
  __pyx_t_1 = (__pyx_v_chrom != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "pysamstats/opt.pyx":1924
 * def iter_pileup_padded(stat, alignmentfile, fafile, chrom, **kwargs):
 *     if chrom is not None:
 *         it = iter_pileup_padded_chrom(stat, alignmentfile=alignmentfile, fafile=fafile,             # <<<<<<<<<<<<<<
 *                                       chrom=chrom, **kwargs)
 *     else:
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_iter_pileup_padded_chrom); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1924, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1924, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_stat);
    __Pyx_GIVEREF(__pyx_v_stat);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_stat);
    __pyx_t_6 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1924, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_alignmentfile, __pyx_v_alignmentfile) < 0) __PYX_ERR(0, 1924, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_fafile, __pyx_v_fafile) < 0) __PYX_ERR(0, 1924, __pyx_L1_error)

    /* "pysamstats/opt.pyx":1925
 *     if chrom is not None:
 *         it = iter_pileup_padded_chrom(stat, alignmentfile=alignmentfile, fafile=fafile,
 *                                       chrom=chrom, **kwargs)             # <<<<<<<<<<<<<<
 *     else:
 *         its = list()
 */
    if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_chrom, __pyx_v_chrom) < 0) __PYX_ERR(0, 1924, __pyx_L1_error)
    __pyx_t_5 = __pyx_t_6;
    __pyx_t_6 = 0;
    if (__Pyx_MergeKeywords(__pyx_t_5, __pyx_v_kwargs) < 0) __PYX_ERR(0, 1925, __pyx_L1_error)

    /* "pysamstats/opt.pyx":1924
 * def iter_pileup_padded(stat, alignmentfile, fafile, chrom, **kwargs):
 *     if chrom is not None:
 *         it = iter_pileup_padded_chrom(stat, alignmentfile=alignmentfile, fafile=fafile,             # <<<<<<<<<<<<<<
 *                                       chrom=chrom, **kwargs)
 *     else:
 */
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1924, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_it = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "pysamstats/opt.pyx":1923
 * 
 * def iter_pileup_padded(stat, alignmentfile, fafile, chrom, **kwargs):
 *     if chrom is not None:             # <<<<<<<<<<<<<<
 *         it = iter_pileup_padded_chrom(stat, alignmentfile=alignmentfile, fafile=fafile,
 *                                       chrom=chrom, **kwargs)
 */
    goto __pyx_L3;
  }

  /* "pysamstats/opt.pyx":1927
 *                                       chrom=chrom, **kwargs)
 *     else:
 *         its = list()             # <<<<<<<<<<<<<<
 *         for chrom in alignmentfile.references:
 *             itc = iter_pileup_padded_chrom(stat, alignmentfile=alignmentfile, fafile=fafile,
 */
  /*else*/ {
    __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1927, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_v_its = ((PyObject*)__pyx_t_6);
    __pyx_t_6 = 0;

    /* "pysamstats/opt.pyx":1928
 *     else:
 *         its = list()
 *         for chrom in alignmentfile.references:             # <<<<<<<<<<<<<<
 *             itc = iter_pileup_padded_chrom(stat, alignmentfile=alignmentfile, fafile=fafile,
 *                                            chrom=chrom, **kwargs)
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_alignmentfile, __pyx_n_s_references); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1928, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (likely(PyList_CheckExact(__pyx_t_6)) || PyTuple_CheckExact(__pyx_t_6)) {
      __pyx_t_5 = __pyx_t_6; __Pyx_INCREF(__pyx_t_5); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
    } else {
      __pyx_t_7 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1928, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_8 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1928, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    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_6 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_7); __Pyx_INCREF(__pyx_t_6); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 1928, __pyx_L1_error)
          #else
          __pyx_t_6 = PySequence_ITEM(__pyx_t_5, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1928, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          #endif
        } else {
          if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_7); __Pyx_INCREF(__pyx_t_6); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 1928, __pyx_L1_error)
          #else
          __pyx_t_6 = PySequence_ITEM(__pyx_t_5, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1928, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          #endif
        }
      } else {
        __pyx_t_6 = __pyx_t_8(__pyx_t_5);
        if (unlikely(!__pyx_t_6)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 1928, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_6);
      }
      __Pyx_DECREF_SET(__pyx_v_chrom, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "pysamstats/opt.pyx":1929
 *         its = list()
 *         for chrom in alignmentfile.references:
 *             itc = iter_pileup_padded_chrom(stat, alignmentfile=alignmentfile, fafile=fafile,             # <<<<<<<<<<<<<<
 *                                            chrom=chrom, **kwargs)
 *             its.append(itc)
 */
      __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_iter_pileup_padded_chrom); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1929, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1929, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_v_stat);
      __Pyx_GIVEREF(__pyx_v_stat);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_stat);
      __pyx_t_9 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1929, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_alignmentfile, __pyx_v_alignmentfile) < 0) __PYX_ERR(0, 1929, __pyx_L1_error)
      if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_fafile, __pyx_v_fafile) < 0) __PYX_ERR(0, 1929, __pyx_L1_error)

      /* "pysamstats/opt.pyx":1930
 *         for chrom in alignmentfile.references:
 *             itc = iter_pileup_padded_chrom(stat, alignmentfile=alignmentfile, fafile=fafile,
 *                                            chrom=chrom, **kwargs)             # <<<<<<<<<<<<<<
 *             its.append(itc)
 *         it = itertools.chain(*its)
 */
      if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_chrom, __pyx_v_chrom) < 0) __PYX_ERR(0, 1929, __pyx_L1_error)
      __pyx_t_3 = __pyx_t_9;
      __pyx_t_9 = 0;
      if (__Pyx_MergeKeywords(__pyx_t_3, __pyx_v_kwargs) < 0) __PYX_ERR(0, 1930, __pyx_L1_error)

      /* "pysamstats/opt.pyx":1929
 *         its = list()
 *         for chrom in alignmentfile.references:
 *             itc = iter_pileup_padded_chrom(stat, alignmentfile=alignmentfile, fafile=fafile,             # <<<<<<<<<<<<<<
 *                                            chrom=chrom, **kwargs)
 *             its.append(itc)
 */
      __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1929, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF_SET(__pyx_v_itc, __pyx_t_9);
      __pyx_t_9 = 0;

      /* "pysamstats/opt.pyx":1931
 *             itc = iter_pileup_padded_chrom(stat, alignmentfile=alignmentfile, fafile=fafile,
 *                                            chrom=chrom, **kwargs)
 *             its.append(itc)             # <<<<<<<<<<<<<<
 *         it = itertools.chain(*its)
 *     return it
 */
      __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_its, __pyx_v_itc); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 1931, __pyx_L1_error)

      /* "pysamstats/opt.pyx":1928
 *     else:
 *         its = list()
 *         for chrom in alignmentfile.references:             # <<<<<<<<<<<<<<
 *             itc = iter_pileup_padded_chrom(stat, alignmentfile=alignmentfile, fafile=fafile,
 *                                            chrom=chrom, **kwargs)
 */
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "pysamstats/opt.pyx":1932
 *                                            chrom=chrom, **kwargs)
 *             its.append(itc)
 *         it = itertools.chain(*its)             # <<<<<<<<<<<<<<
 *     return it
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_itertools); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1932, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_chain); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1932, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PySequence_Tuple(__pyx_v_its); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1932, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1932, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_it = __pyx_t_3;
    __pyx_t_3 = 0;
  }
  __pyx_L3:;

  /* "pysamstats/opt.pyx":1933
 *             its.append(itc)
 *         it = itertools.chain(*its)
 *     return it             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_it);
  __pyx_r = __pyx_v_it;
  goto __pyx_L0;

  /* "pysamstats/opt.pyx":1922
 * 
 * 
 * def iter_pileup_padded(stat, alignmentfile, fafile, chrom, **kwargs):             # <<<<<<<<<<<<<<
 *     if chrom is not None:
 *         it = iter_pileup_padded_chrom(stat, alignmentfile=alignmentfile, fafile=fafile,
 */

  /* 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_9);
  __Pyx_AddTraceback("pysamstats.opt.iter_pileup_padded", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_it);
  __Pyx_XDECREF(__pyx_v_its);
  __Pyx_XDECREF(__pyx_v_itc);
  __Pyx_XDECREF(__pyx_v_chrom);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_10pysamstats_3opt_11generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "pysamstats/opt.pyx":1936
 * 
 * 
 * def iter_pileup_padded_chrom(PileupStat stat, alignmentfile, fafile, chrom, start, end,             # <<<<<<<<<<<<<<
 *                              one_based, truncate, stepper, max_depth, min_mapq, min_baseq, no_del, no_dup):
 *     cdef:
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_10iter_pileup_padded_chrom(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_10pysamstats_3opt_9iter_pileup_padded_chrom[] = "iter_pileup_padded_chrom(PileupStat stat, alignmentfile, fafile, chrom, start, end, one_based, truncate, stepper, max_depth, min_mapq, min_baseq, no_del, no_dup)";
static PyMethodDef __pyx_mdef_10pysamstats_3opt_10iter_pileup_padded_chrom = {"iter_pileup_padded_chrom", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pysamstats_3opt_10iter_pileup_padded_chrom, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pysamstats_3opt_9iter_pileup_padded_chrom};
static PyObject *__pyx_pw_10pysamstats_3opt_10iter_pileup_padded_chrom(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_10pysamstats_3opt_PileupStat *__pyx_v_stat = 0;
  PyObject *__pyx_v_alignmentfile = 0;
  PyObject *__pyx_v_fafile = 0;
  PyObject *__pyx_v_chrom = 0;
  PyObject *__pyx_v_start = 0;
  PyObject *__pyx_v_end = 0;
  PyObject *__pyx_v_one_based = 0;
  PyObject *__pyx_v_truncate = 0;
  PyObject *__pyx_v_stepper = 0;
  PyObject *__pyx_v_max_depth = 0;
  PyObject *__pyx_v_min_mapq = 0;
  PyObject *__pyx_v_min_baseq = 0;
  PyObject *__pyx_v_no_del = 0;
  PyObject *__pyx_v_no_dup = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iter_pileup_padded_chrom (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_stat,&__pyx_n_s_alignmentfile,&__pyx_n_s_fafile,&__pyx_n_s_chrom,&__pyx_n_s_start,&__pyx_n_s_end,&__pyx_n_s_one_based,&__pyx_n_s_truncate,&__pyx_n_s_stepper,&__pyx_n_s_max_depth,&__pyx_n_s_min_mapq,&__pyx_n_s_min_baseq,&__pyx_n_s_no_del,&__pyx_n_s_no_dup,0};
    PyObject* values[14] = {0,0,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 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
        CYTHON_FALLTHROUGH;
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        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_stat)) != 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_alignmentfile)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("iter_pileup_padded_chrom", 1, 14, 14, 1); __PYX_ERR(0, 1936, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fafile)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("iter_pileup_padded_chrom", 1, 14, 14, 2); __PYX_ERR(0, 1936, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_chrom)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("iter_pileup_padded_chrom", 1, 14, 14, 3); __PYX_ERR(0, 1936, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_start)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("iter_pileup_padded_chrom", 1, 14, 14, 4); __PYX_ERR(0, 1936, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_end)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("iter_pileup_padded_chrom", 1, 14, 14, 5); __PYX_ERR(0, 1936, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_one_based)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("iter_pileup_padded_chrom", 1, 14, 14, 6); __PYX_ERR(0, 1936, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_truncate)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("iter_pileup_padded_chrom", 1, 14, 14, 7); __PYX_ERR(0, 1936, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_stepper)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("iter_pileup_padded_chrom", 1, 14, 14, 8); __PYX_ERR(0, 1936, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_depth)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("iter_pileup_padded_chrom", 1, 14, 14, 9); __PYX_ERR(0, 1936, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_min_mapq)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("iter_pileup_padded_chrom", 1, 14, 14, 10); __PYX_ERR(0, 1936, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 11:
        if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_min_baseq)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("iter_pileup_padded_chrom", 1, 14, 14, 11); __PYX_ERR(0, 1936, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 12:
        if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_no_del)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("iter_pileup_padded_chrom", 1, 14, 14, 12); __PYX_ERR(0, 1936, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 13:
        if (likely((values[13] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_no_dup)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("iter_pileup_padded_chrom", 1, 14, 14, 13); __PYX_ERR(0, 1936, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "iter_pileup_padded_chrom") < 0)) __PYX_ERR(0, 1936, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 14) {
      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);
      values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
      values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
    }
    __pyx_v_stat = ((struct __pyx_obj_10pysamstats_3opt_PileupStat *)values[0]);
    __pyx_v_alignmentfile = values[1];
    __pyx_v_fafile = values[2];
    __pyx_v_chrom = values[3];
    __pyx_v_start = values[4];
    __pyx_v_end = values[5];
    __pyx_v_one_based = values[6];
    __pyx_v_truncate = values[7];
    __pyx_v_stepper = values[8];
    __pyx_v_max_depth = values[9];
    __pyx_v_min_mapq = values[10];
    __pyx_v_min_baseq = values[11];
    __pyx_v_no_del = values[12];
    __pyx_v_no_dup = values[13];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("iter_pileup_padded_chrom", 1, 14, 14, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1936, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysamstats.opt.iter_pileup_padded_chrom", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_stat), __pyx_ptype_10pysamstats_3opt_PileupStat, 1, "stat", 0))) __PYX_ERR(0, 1936, __pyx_L1_error)
  __pyx_r = __pyx_pf_10pysamstats_3opt_9iter_pileup_padded_chrom(__pyx_self, __pyx_v_stat, __pyx_v_alignmentfile, __pyx_v_fafile, __pyx_v_chrom, __pyx_v_start, __pyx_v_end, __pyx_v_one_based, __pyx_v_truncate, __pyx_v_stepper, __pyx_v_max_depth, __pyx_v_min_mapq, __pyx_v_min_baseq, __pyx_v_no_del, __pyx_v_no_dup);

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

static PyObject *__pyx_pf_10pysamstats_3opt_9iter_pileup_padded_chrom(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_10pysamstats_3opt_PileupStat *__pyx_v_stat, PyObject *__pyx_v_alignmentfile, PyObject *__pyx_v_fafile, PyObject *__pyx_v_chrom, PyObject *__pyx_v_start, PyObject *__pyx_v_end, PyObject *__pyx_v_one_based, PyObject *__pyx_v_truncate, PyObject *__pyx_v_stepper, PyObject *__pyx_v_max_depth, PyObject *__pyx_v_min_mapq, PyObject *__pyx_v_min_baseq, PyObject *__pyx_v_no_del, PyObject *__pyx_v_no_dup) {
  struct __pyx_obj_10pysamstats_3opt___pyx_scope_struct_1_iter_pileup_padded_chrom *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iter_pileup_padded_chrom", 0);
  __pyx_cur_scope = (struct __pyx_obj_10pysamstats_3opt___pyx_scope_struct_1_iter_pileup_padded_chrom *)__pyx_tp_new_10pysamstats_3opt___pyx_scope_struct_1_iter_pileup_padded_chrom(__pyx_ptype_10pysamstats_3opt___pyx_scope_struct_1_iter_pileup_padded_chrom, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_10pysamstats_3opt___pyx_scope_struct_1_iter_pileup_padded_chrom *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1936, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_stat = __pyx_v_stat;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_stat);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_stat);
  __pyx_cur_scope->__pyx_v_alignmentfile = __pyx_v_alignmentfile;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_alignmentfile);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_alignmentfile);
  __pyx_cur_scope->__pyx_v_fafile = __pyx_v_fafile;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_fafile);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_fafile);
  __pyx_cur_scope->__pyx_v_chrom = __pyx_v_chrom;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_chrom);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_chrom);
  __pyx_cur_scope->__pyx_v_start = __pyx_v_start;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_start);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_start);
  __pyx_cur_scope->__pyx_v_end = __pyx_v_end;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_end);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_end);
  __pyx_cur_scope->__pyx_v_one_based = __pyx_v_one_based;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_one_based);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_one_based);
  __pyx_cur_scope->__pyx_v_truncate = __pyx_v_truncate;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_truncate);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_truncate);
  __pyx_cur_scope->__pyx_v_stepper = __pyx_v_stepper;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_stepper);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_stepper);
  __pyx_cur_scope->__pyx_v_max_depth = __pyx_v_max_depth;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_max_depth);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_max_depth);
  __pyx_cur_scope->__pyx_v_min_mapq = __pyx_v_min_mapq;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_min_mapq);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_min_mapq);
  __pyx_cur_scope->__pyx_v_min_baseq = __pyx_v_min_baseq;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_min_baseq);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_min_baseq);
  __pyx_cur_scope->__pyx_v_no_del = __pyx_v_no_del;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_no_del);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_no_del);
  __pyx_cur_scope->__pyx_v_no_dup = __pyx_v_no_dup;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_no_dup);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_no_dup);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_10pysamstats_3opt_11generator1, __pyx_codeobj__3, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter_pileup_padded_chrom, __pyx_n_s_iter_pileup_padded_chrom, __pyx_n_s_pysamstats_opt); if (unlikely(!gen)) __PYX_ERR(0, 1936, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysamstats.opt.iter_pileup_padded_chrom", __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_10pysamstats_3opt_11generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_10pysamstats_3opt___pyx_scope_struct_1_iter_pileup_padded_chrom *__pyx_cur_scope = ((struct __pyx_obj_10pysamstats_3opt___pyx_scope_struct_1_iter_pileup_padded_chrom *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  Py_ssize_t __pyx_t_8;
  PyObject *(*__pyx_t_9)(PyObject *);
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  long __pyx_t_12;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iter_pileup_padded_chrom", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L10_resume_from_yield;
    case 2: goto __pyx_L11_resume_from_yield;
    case 3: goto __pyx_L14_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, 1936, __pyx_L1_error)

  /* "pysamstats/opt.pyx":1943
 * 
 *     # obtain pileup iterator
 *     assert chrom is not None, 'chromosome is None'             # <<<<<<<<<<<<<<
 *     start, end = normalise_coords(alignmentfile, chrom, start, end, one_based)
 *     it = alignmentfile.pileup(reference=chrom, start=start, end=end, truncate=truncate, stepper=stepper,
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_1 = (__pyx_cur_scope->__pyx_v_chrom != Py_None);
    if (unlikely(!(__pyx_t_1 != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_chromosome_is_None);
      __PYX_ERR(0, 1943, __pyx_L1_error)
    }
  }
  #endif

  /* "pysamstats/opt.pyx":1944
 *     # obtain pileup iterator
 *     assert chrom is not None, 'chromosome is None'
 *     start, end = normalise_coords(alignmentfile, chrom, start, end, one_based)             # <<<<<<<<<<<<<<
 *     it = alignmentfile.pileup(reference=chrom, start=start, end=end, truncate=truncate, stepper=stepper,
 *                               max_depth=max_depth)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_normalise_coords); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1944, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(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_5 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[6] = {__pyx_t_4, __pyx_cur_scope->__pyx_v_alignmentfile, __pyx_cur_scope->__pyx_v_chrom, __pyx_cur_scope->__pyx_v_start, __pyx_cur_scope->__pyx_v_end, __pyx_cur_scope->__pyx_v_one_based};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 5+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1944, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[6] = {__pyx_t_4, __pyx_cur_scope->__pyx_v_alignmentfile, __pyx_cur_scope->__pyx_v_chrom, __pyx_cur_scope->__pyx_v_start, __pyx_cur_scope->__pyx_v_end, __pyx_cur_scope->__pyx_v_one_based};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 5+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1944, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(5+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1944, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_alignmentfile);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_alignmentfile);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_cur_scope->__pyx_v_alignmentfile);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_chrom);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_chrom);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_cur_scope->__pyx_v_chrom);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_start);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_start);
    PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, __pyx_cur_scope->__pyx_v_start);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_end);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_end);
    PyTuple_SET_ITEM(__pyx_t_6, 3+__pyx_t_5, __pyx_cur_scope->__pyx_v_end);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_one_based);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_one_based);
    PyTuple_SET_ITEM(__pyx_t_6, 4+__pyx_t_5, __pyx_cur_scope->__pyx_v_one_based);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1944, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    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, 1944, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_6);
    #else
    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1944, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1944, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1944, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_3 = __pyx_t_7(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L4_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 1; __pyx_t_6 = __pyx_t_7(__pyx_t_4); if (unlikely(!__pyx_t_6)) goto __pyx_L4_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_4), 2) < 0) __PYX_ERR(0, 1944, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L5_unpacking_done;
    __pyx_L4_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 1944, __pyx_L1_error)
    __pyx_L5_unpacking_done:;
  }
  __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_start);
  __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_start, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_end);
  __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_end, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  __pyx_t_6 = 0;

  /* "pysamstats/opt.pyx":1945
 *     assert chrom is not None, 'chromosome is None'
 *     start, end = normalise_coords(alignmentfile, chrom, start, end, one_based)
 *     it = alignmentfile.pileup(reference=chrom, start=start, end=end, truncate=truncate, stepper=stepper,             # <<<<<<<<<<<<<<
 *                               max_depth=max_depth)
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_alignmentfile, __pyx_n_s_pileup); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1945, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = __Pyx_PyDict_NewPresized(6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1945, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_reference, __pyx_cur_scope->__pyx_v_chrom) < 0) __PYX_ERR(0, 1945, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_start, __pyx_cur_scope->__pyx_v_start) < 0) __PYX_ERR(0, 1945, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_end, __pyx_cur_scope->__pyx_v_end) < 0) __PYX_ERR(0, 1945, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_truncate, __pyx_cur_scope->__pyx_v_truncate) < 0) __PYX_ERR(0, 1945, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_stepper, __pyx_cur_scope->__pyx_v_stepper) < 0) __PYX_ERR(0, 1945, __pyx_L1_error)

  /* "pysamstats/opt.pyx":1946
 *     start, end = normalise_coords(alignmentfile, chrom, start, end, one_based)
 *     it = alignmentfile.pileup(reference=chrom, start=start, end=end, truncate=truncate, stepper=stepper,
 *                               max_depth=max_depth)             # <<<<<<<<<<<<<<
 * 
 *     # keep track of current position
 */
  if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_max_depth, __pyx_cur_scope->__pyx_v_max_depth) < 0) __PYX_ERR(0, 1945, __pyx_L1_error)

  /* "pysamstats/opt.pyx":1945
 *     assert chrom is not None, 'chromosome is None'
 *     start, end = normalise_coords(alignmentfile, chrom, start, end, one_based)
 *     it = alignmentfile.pileup(reference=chrom, start=start, end=end, truncate=truncate, stepper=stepper,             # <<<<<<<<<<<<<<
 *                               max_depth=max_depth)
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1945, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_cur_scope->__pyx_v_it = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "pysamstats/opt.pyx":1949
 * 
 *     # keep track of current position
 *     curpos = start             # <<<<<<<<<<<<<<
 * 
 *     # iterate over pileup columns
 */
  __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_cur_scope->__pyx_v_start); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1949, __pyx_L1_error)
  __pyx_cur_scope->__pyx_v_curpos = __pyx_t_5;

  /* "pysamstats/opt.pyx":1952
 * 
 *     # iterate over pileup columns
 *     for col in it:             # <<<<<<<<<<<<<<
 * 
 *         # pad up to next pileup column
 */
  if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_v_it)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_it)) {
    __pyx_t_3 = __pyx_cur_scope->__pyx_v_it; __Pyx_INCREF(__pyx_t_3); __pyx_t_8 = 0;
    __pyx_t_9 = NULL;
  } else {
    __pyx_t_8 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_it); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1952, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_9 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1952, __pyx_L1_error)
  }
  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_6 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_8); __Pyx_INCREF(__pyx_t_6); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 1952, __pyx_L1_error)
        #else
        __pyx_t_6 = PySequence_ITEM(__pyx_t_3, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1952, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        #endif
      } else {
        if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_8); __Pyx_INCREF(__pyx_t_6); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 1952, __pyx_L1_error)
        #else
        __pyx_t_6 = PySequence_ITEM(__pyx_t_3, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1952, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        #endif
      }
    } else {
      __pyx_t_6 = __pyx_t_9(__pyx_t_3);
      if (unlikely(!__pyx_t_6)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 1952, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_6);
    }
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5pysam_18libcalignedsegment_PileupColumn))))) __PYX_ERR(0, 1952, __pyx_L1_error)
    __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_col));
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_col, ((struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn *)__pyx_t_6));
    __Pyx_GIVEREF(__pyx_t_6);
    __pyx_t_6 = 0;

    /* "pysamstats/opt.pyx":1955
 * 
 *         # pad up to next pileup column
 *         while curpos < col.pos:             # <<<<<<<<<<<<<<
 *             # setup reference base
 *             refbase = get_refbase(fafile, chrom, curpos)
 */
    while (1) {
      __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_curpos < __pyx_cur_scope->__pyx_v_col->pos) != 0);
      if (!__pyx_t_1) break;

      /* "pysamstats/opt.pyx":1957
 *         while curpos < col.pos:
 *             # setup reference base
 *             refbase = get_refbase(fafile, chrom, curpos)             # <<<<<<<<<<<<<<
 *             # construct record
 *             rec = stat.rec(chrom, curpos, fafile, refbase)
 */
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_get_refbase); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1957, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_curpos); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1957, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_10 = NULL;
      __pyx_t_5 = 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_5 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[4] = {__pyx_t_10, __pyx_cur_scope->__pyx_v_fafile, __pyx_cur_scope->__pyx_v_chrom, __pyx_t_4};
        __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1957, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[4] = {__pyx_t_10, __pyx_cur_scope->__pyx_v_fafile, __pyx_cur_scope->__pyx_v_chrom, __pyx_t_4};
        __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1957, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else
      #endif
      {
        __pyx_t_11 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1957, __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_INCREF(__pyx_cur_scope->__pyx_v_fafile);
        __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_fafile);
        PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_5, __pyx_cur_scope->__pyx_v_fafile);
        __Pyx_INCREF(__pyx_cur_scope->__pyx_v_chrom);
        __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_chrom);
        PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_5, __pyx_cur_scope->__pyx_v_chrom);
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_11, 2+__pyx_t_5, __pyx_t_4);
        __pyx_t_4 = 0;
        __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_11, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1957, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_refbase);
      __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_refbase, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_6);
      __pyx_t_6 = 0;

      /* "pysamstats/opt.pyx":1959
 *             refbase = get_refbase(fafile, chrom, curpos)
 *             # construct record
 *             rec = stat.rec(chrom, curpos, fafile, refbase)             # <<<<<<<<<<<<<<
 *             rec['chrom'] = chrom
 *             pos = curpos + 1 if one_based else curpos
 */
      __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_curpos); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1959, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (!(likely(((__pyx_cur_scope->__pyx_v_fafile) == Py_None) || likely(__Pyx_TypeTest(__pyx_cur_scope->__pyx_v_fafile, __pyx_ptype_5pysam_9libcfaidx_FastaFile))))) __PYX_ERR(0, 1959, __pyx_L1_error)
      if (!(likely(PyBytes_CheckExact(__pyx_cur_scope->__pyx_v_refbase))||((__pyx_cur_scope->__pyx_v_refbase) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_cur_scope->__pyx_v_refbase)->tp_name), 0))) __PYX_ERR(0, 1959, __pyx_L1_error)
      __pyx_t_2 = ((struct __pyx_vtabstruct_10pysamstats_3opt_PileupStat *)__pyx_cur_scope->__pyx_v_stat->__pyx_vtab)->rec(__pyx_cur_scope->__pyx_v_stat, __pyx_cur_scope->__pyx_v_chrom, __pyx_t_6, ((struct __pyx_obj_5pysam_9libcfaidx_FastaFile *)__pyx_cur_scope->__pyx_v_fafile), ((PyObject*)__pyx_cur_scope->__pyx_v_refbase)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1959, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_rec);
      __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_rec, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_2 = 0;

      /* "pysamstats/opt.pyx":1960
 *             # construct record
 *             rec = stat.rec(chrom, curpos, fafile, refbase)
 *             rec['chrom'] = chrom             # <<<<<<<<<<<<<<
 *             pos = curpos + 1 if one_based else curpos
 *             rec['pos'] = pos
 */
      if (unlikely(PyObject_SetItem(__pyx_cur_scope->__pyx_v_rec, __pyx_n_s_chrom, __pyx_cur_scope->__pyx_v_chrom) < 0)) __PYX_ERR(0, 1960, __pyx_L1_error)

      /* "pysamstats/opt.pyx":1961
 *             rec = stat.rec(chrom, curpos, fafile, refbase)
 *             rec['chrom'] = chrom
 *             pos = curpos + 1 if one_based else curpos             # <<<<<<<<<<<<<<
 *             rec['pos'] = pos
 *             yield rec
 */
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_one_based); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1961, __pyx_L1_error)
      if (__pyx_t_1) {
        __pyx_t_12 = (__pyx_cur_scope->__pyx_v_curpos + 1);
      } else {
        __pyx_t_12 = __pyx_cur_scope->__pyx_v_curpos;
      }
      __pyx_cur_scope->__pyx_v_pos = __pyx_t_12;

      /* "pysamstats/opt.pyx":1962
 *             rec['chrom'] = chrom
 *             pos = curpos + 1 if one_based else curpos
 *             rec['pos'] = pos             # <<<<<<<<<<<<<<
 *             yield rec
 *             curpos += 1
 */
      __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_cur_scope->__pyx_v_pos); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1962, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (unlikely(PyObject_SetItem(__pyx_cur_scope->__pyx_v_rec, __pyx_n_s_pos, __pyx_t_2) < 0)) __PYX_ERR(0, 1962, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "pysamstats/opt.pyx":1963
 *             pos = curpos + 1 if one_based else curpos
 *             rec['pos'] = pos
 *             yield rec             # <<<<<<<<<<<<<<
 *             curpos += 1
 * 
 */
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_rec);
      __pyx_r = __pyx_cur_scope->__pyx_v_rec;
      __Pyx_XGIVEREF(__pyx_t_3);
      __pyx_cur_scope->__pyx_t_0 = __pyx_t_3;
      __pyx_cur_scope->__pyx_t_1 = __pyx_t_8;
      __pyx_cur_scope->__pyx_t_2 = __pyx_t_9;
      __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_L10_resume_from_yield:;
      __pyx_t_3 = __pyx_cur_scope->__pyx_t_0;
      __pyx_cur_scope->__pyx_t_0 = 0;
      __Pyx_XGOTREF(__pyx_t_3);
      __pyx_t_8 = __pyx_cur_scope->__pyx_t_1;
      __pyx_t_9 = __pyx_cur_scope->__pyx_t_2;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1963, __pyx_L1_error)

      /* "pysamstats/opt.pyx":1964
 *             rec['pos'] = pos
 *             yield rec
 *             curpos += 1             # <<<<<<<<<<<<<<
 * 
 *         # construct and yield statistics record for current pileup column
 */
      __pyx_cur_scope->__pyx_v_curpos = (__pyx_cur_scope->__pyx_v_curpos + 1);
    }

    /* "pysamstats/opt.pyx":1967
 * 
 *         # construct and yield statistics record for current pileup column
 *         rec = stat_pileup(stat, col, alignmentfile=alignmentfile, fafile=fafile,             # <<<<<<<<<<<<<<
 *                           one_based=one_based, min_mapq=min_mapq, min_baseq=min_baseq,
 *                           no_del=no_del, no_dup=no_dup)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_stat_pileup); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1967, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1967, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_stat));
    __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_stat));
    PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_stat));
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_col));
    __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_col));
    PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_cur_scope->__pyx_v_col));
    __pyx_t_11 = __Pyx_PyDict_NewPresized(7); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1967, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_alignmentfile, __pyx_cur_scope->__pyx_v_alignmentfile) < 0) __PYX_ERR(0, 1967, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_fafile, __pyx_cur_scope->__pyx_v_fafile) < 0) __PYX_ERR(0, 1967, __pyx_L1_error)

    /* "pysamstats/opt.pyx":1968
 *         # construct and yield statistics record for current pileup column
 *         rec = stat_pileup(stat, col, alignmentfile=alignmentfile, fafile=fafile,
 *                           one_based=one_based, min_mapq=min_mapq, min_baseq=min_baseq,             # <<<<<<<<<<<<<<
 *                           no_del=no_del, no_dup=no_dup)
 *         yield rec
 */
    if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_one_based, __pyx_cur_scope->__pyx_v_one_based) < 0) __PYX_ERR(0, 1967, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_min_mapq, __pyx_cur_scope->__pyx_v_min_mapq) < 0) __PYX_ERR(0, 1967, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_min_baseq, __pyx_cur_scope->__pyx_v_min_baseq) < 0) __PYX_ERR(0, 1967, __pyx_L1_error)

    /* "pysamstats/opt.pyx":1969
 *         rec = stat_pileup(stat, col, alignmentfile=alignmentfile, fafile=fafile,
 *                           one_based=one_based, min_mapq=min_mapq, min_baseq=min_baseq,
 *                           no_del=no_del, no_dup=no_dup)             # <<<<<<<<<<<<<<
 *         yield rec
 * 
 */
    if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_no_del, __pyx_cur_scope->__pyx_v_no_del) < 0) __PYX_ERR(0, 1967, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_no_dup, __pyx_cur_scope->__pyx_v_no_dup) < 0) __PYX_ERR(0, 1967, __pyx_L1_error)

    /* "pysamstats/opt.pyx":1967
 * 
 *         # construct and yield statistics record for current pileup column
 *         rec = stat_pileup(stat, col, alignmentfile=alignmentfile, fafile=fafile,             # <<<<<<<<<<<<<<
 *                           one_based=one_based, min_mapq=min_mapq, min_baseq=min_baseq,
 *                           no_del=no_del, no_dup=no_dup)
 */
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, __pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1967, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_rec);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_rec, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;

    /* "pysamstats/opt.pyx":1970
 *                           one_based=one_based, min_mapq=min_mapq, min_baseq=min_baseq,
 *                           no_del=no_del, no_dup=no_dup)
 *         yield rec             # <<<<<<<<<<<<<<
 * 
 *         # advance current position
 */
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_rec);
    __pyx_r = __pyx_cur_scope->__pyx_v_rec;
    __Pyx_XGIVEREF(__pyx_t_3);
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_3;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_8;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_9;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 2;
    return __pyx_r;
    __pyx_L11_resume_from_yield:;
    __pyx_t_3 = __pyx_cur_scope->__pyx_t_0;
    __pyx_cur_scope->__pyx_t_0 = 0;
    __Pyx_XGOTREF(__pyx_t_3);
    __pyx_t_8 = __pyx_cur_scope->__pyx_t_1;
    __pyx_t_9 = __pyx_cur_scope->__pyx_t_2;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1970, __pyx_L1_error)

    /* "pysamstats/opt.pyx":1973
 * 
 *         # advance current position
 *         curpos = col.pos + 1             # <<<<<<<<<<<<<<
 * 
 *     while curpos < end:
 */
    __pyx_cur_scope->__pyx_v_curpos = (__pyx_cur_scope->__pyx_v_col->pos + 1);

    /* "pysamstats/opt.pyx":1952
 * 
 *     # iterate over pileup columns
 *     for col in it:             # <<<<<<<<<<<<<<
 * 
 *         # pad up to next pileup column
 */
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pysamstats/opt.pyx":1975
 *         curpos = col.pos + 1
 * 
 *     while curpos < end:             # <<<<<<<<<<<<<<
 * 
 *         # pad out to end position
 */
  while (1) {
    __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_curpos); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1975, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_cur_scope->__pyx_v_end, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1975, __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, 1975, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (!__pyx_t_1) break;

    /* "pysamstats/opt.pyx":1978
 * 
 *         # pad out to end position
 *         refbase = get_refbase(fafile, chrom, curpos)             # <<<<<<<<<<<<<<
 *         rec = stat.rec(chrom, curpos, fafile, refbase)
 *         rec['chrom'] = chrom
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_get_refbase); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1978, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_curpos); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1978, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_6 = NULL;
    __pyx_t_5 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_5 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_cur_scope->__pyx_v_fafile, __pyx_cur_scope->__pyx_v_chrom, __pyx_t_11};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1978, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_cur_scope->__pyx_v_fafile, __pyx_cur_scope->__pyx_v_chrom, __pyx_t_11};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1978, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    } else
    #endif
    {
      __pyx_t_2 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1978, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (__pyx_t_6) {
        __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6); __pyx_t_6 = NULL;
      }
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_fafile);
      __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_fafile);
      PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_5, __pyx_cur_scope->__pyx_v_fafile);
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_chrom);
      __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_chrom);
      PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_5, __pyx_cur_scope->__pyx_v_chrom);
      __Pyx_GIVEREF(__pyx_t_11);
      PyTuple_SET_ITEM(__pyx_t_2, 2+__pyx_t_5, __pyx_t_11);
      __pyx_t_11 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1978, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_refbase);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_refbase, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;

    /* "pysamstats/opt.pyx":1979
 *         # pad out to end position
 *         refbase = get_refbase(fafile, chrom, curpos)
 *         rec = stat.rec(chrom, curpos, fafile, refbase)             # <<<<<<<<<<<<<<
 *         rec['chrom'] = chrom
 *         pos = curpos + 1 if one_based else curpos
 */
    __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_curpos); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1979, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (!(likely(((__pyx_cur_scope->__pyx_v_fafile) == Py_None) || likely(__Pyx_TypeTest(__pyx_cur_scope->__pyx_v_fafile, __pyx_ptype_5pysam_9libcfaidx_FastaFile))))) __PYX_ERR(0, 1979, __pyx_L1_error)
    if (!(likely(PyBytes_CheckExact(__pyx_cur_scope->__pyx_v_refbase))||((__pyx_cur_scope->__pyx_v_refbase) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_cur_scope->__pyx_v_refbase)->tp_name), 0))) __PYX_ERR(0, 1979, __pyx_L1_error)
    __pyx_t_3 = ((struct __pyx_vtabstruct_10pysamstats_3opt_PileupStat *)__pyx_cur_scope->__pyx_v_stat->__pyx_vtab)->rec(__pyx_cur_scope->__pyx_v_stat, __pyx_cur_scope->__pyx_v_chrom, __pyx_t_4, ((struct __pyx_obj_5pysam_9libcfaidx_FastaFile *)__pyx_cur_scope->__pyx_v_fafile), ((PyObject*)__pyx_cur_scope->__pyx_v_refbase)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1979, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_rec);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_rec, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;

    /* "pysamstats/opt.pyx":1980
 *         refbase = get_refbase(fafile, chrom, curpos)
 *         rec = stat.rec(chrom, curpos, fafile, refbase)
 *         rec['chrom'] = chrom             # <<<<<<<<<<<<<<
 *         pos = curpos + 1 if one_based else curpos
 *         rec['pos'] = pos
 */
    if (unlikely(PyObject_SetItem(__pyx_cur_scope->__pyx_v_rec, __pyx_n_s_chrom, __pyx_cur_scope->__pyx_v_chrom) < 0)) __PYX_ERR(0, 1980, __pyx_L1_error)

    /* "pysamstats/opt.pyx":1981
 *         rec = stat.rec(chrom, curpos, fafile, refbase)
 *         rec['chrom'] = chrom
 *         pos = curpos + 1 if one_based else curpos             # <<<<<<<<<<<<<<
 *         rec['pos'] = pos
 *         yield rec
 */
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_one_based); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1981, __pyx_L1_error)
    if (__pyx_t_1) {
      __pyx_t_12 = (__pyx_cur_scope->__pyx_v_curpos + 1);
    } else {
      __pyx_t_12 = __pyx_cur_scope->__pyx_v_curpos;
    }
    __pyx_cur_scope->__pyx_v_pos = __pyx_t_12;

    /* "pysamstats/opt.pyx":1982
 *         rec['chrom'] = chrom
 *         pos = curpos + 1 if one_based else curpos
 *         rec['pos'] = pos             # <<<<<<<<<<<<<<
 *         yield rec
 *         curpos += 1
 */
    __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_cur_scope->__pyx_v_pos); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1982, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (unlikely(PyObject_SetItem(__pyx_cur_scope->__pyx_v_rec, __pyx_n_s_pos, __pyx_t_3) < 0)) __PYX_ERR(0, 1982, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "pysamstats/opt.pyx":1983
 *         pos = curpos + 1 if one_based else curpos
 *         rec['pos'] = pos
 *         yield rec             # <<<<<<<<<<<<<<
 *         curpos += 1
 * 
 */
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_rec);
    __pyx_r = __pyx_cur_scope->__pyx_v_rec;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 3;
    return __pyx_r;
    __pyx_L14_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1983, __pyx_L1_error)

    /* "pysamstats/opt.pyx":1984
 *         rec['pos'] = pos
 *         yield rec
 *         curpos += 1             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_cur_scope->__pyx_v_curpos = (__pyx_cur_scope->__pyx_v_curpos + 1);
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "pysamstats/opt.pyx":1936
 * 
 * 
 * def iter_pileup_padded_chrom(PileupStat stat, alignmentfile, fafile, chrom, start, end,             # <<<<<<<<<<<<<<
 *                              one_based, truncate, stepper, max_depth, min_mapq, min_baseq, no_del, no_dup):
 *     cdef:
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("iter_pileup_padded_chrom", __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;
}

/* "pysamstats/opt.pyx":1987
 * 
 * 
 * def get_refbase(fafile, chrom, pos):             # <<<<<<<<<<<<<<
 *     if fafile is not None:
 *         refbase = fafile.fetch(reference=chrom, start=pos, end=pos+1).upper()
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_13get_refbase(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_10pysamstats_3opt_12get_refbase[] = "get_refbase(fafile, chrom, pos)";
static PyMethodDef __pyx_mdef_10pysamstats_3opt_13get_refbase = {"get_refbase", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pysamstats_3opt_13get_refbase, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pysamstats_3opt_12get_refbase};
static PyObject *__pyx_pw_10pysamstats_3opt_13get_refbase(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_fafile = 0;
  PyObject *__pyx_v_chrom = 0;
  PyObject *__pyx_v_pos = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_refbase (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fafile,&__pyx_n_s_chrom,&__pyx_n_s_pos,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_fafile)) != 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_chrom)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("get_refbase", 1, 3, 3, 1); __PYX_ERR(0, 1987, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pos)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("get_refbase", 1, 3, 3, 2); __PYX_ERR(0, 1987, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_refbase") < 0)) __PYX_ERR(0, 1987, __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_fafile = values[0];
    __pyx_v_chrom = values[1];
    __pyx_v_pos = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_refbase", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1987, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysamstats.opt.get_refbase", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_10pysamstats_3opt_12get_refbase(__pyx_self, __pyx_v_fafile, __pyx_v_chrom, __pyx_v_pos);

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

static PyObject *__pyx_pf_10pysamstats_3opt_12get_refbase(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fafile, PyObject *__pyx_v_chrom, PyObject *__pyx_v_pos) {
  PyObject *__pyx_v_refbase = NULL;
  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;
  __Pyx_RefNannySetupContext("get_refbase", 0);

  /* "pysamstats/opt.pyx":1988
 * 
 * def get_refbase(fafile, chrom, pos):
 *     if fafile is not None:             # <<<<<<<<<<<<<<
 *         refbase = fafile.fetch(reference=chrom, start=pos, end=pos+1).upper()
 *         if not PY2:
 */
  __pyx_t_1 = (__pyx_v_fafile != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "pysamstats/opt.pyx":1989
 * def get_refbase(fafile, chrom, pos):
 *     if fafile is not None:
 *         refbase = fafile.fetch(reference=chrom, start=pos, end=pos+1).upper()             # <<<<<<<<<<<<<<
 *         if not PY2:
 *             refbase = refbase.encode('ascii')
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_fafile, __pyx_n_s_fetch); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1989, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1989, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_reference, __pyx_v_chrom) < 0) __PYX_ERR(0, 1989, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_start, __pyx_v_pos) < 0) __PYX_ERR(0, 1989, __pyx_L1_error)
    __pyx_t_6 = __Pyx_PyInt_AddObjC(__pyx_v_pos, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1989, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_end, __pyx_t_6) < 0) __PYX_ERR(0, 1989, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1989, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_upper); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1989, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1989, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_refbase = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "pysamstats/opt.pyx":1990
 *     if fafile is not None:
 *         refbase = fafile.fetch(reference=chrom, start=pos, end=pos+1).upper()
 *         if not PY2:             # <<<<<<<<<<<<<<
 *             refbase = refbase.encode('ascii')
 *     else:
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_PY2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1990, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1990, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_1 = ((!__pyx_t_2) != 0);
    if (__pyx_t_1) {

      /* "pysamstats/opt.pyx":1991
 *         refbase = fafile.fetch(reference=chrom, start=pos, end=pos+1).upper()
 *         if not PY2:
 *             refbase = refbase.encode('ascii')             # <<<<<<<<<<<<<<
 *     else:
 *         refbase = None
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_refbase, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1991, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_n_s_ascii) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_n_s_ascii);
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1991, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF_SET(__pyx_v_refbase, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "pysamstats/opt.pyx":1990
 *     if fafile is not None:
 *         refbase = fafile.fetch(reference=chrom, start=pos, end=pos+1).upper()
 *         if not PY2:             # <<<<<<<<<<<<<<
 *             refbase = refbase.encode('ascii')
 *     else:
 */
    }

    /* "pysamstats/opt.pyx":1988
 * 
 * def get_refbase(fafile, chrom, pos):
 *     if fafile is not None:             # <<<<<<<<<<<<<<
 *         refbase = fafile.fetch(reference=chrom, start=pos, end=pos+1).upper()
 *         if not PY2:
 */
    goto __pyx_L3;
  }

  /* "pysamstats/opt.pyx":1993
 *             refbase = refbase.encode('ascii')
 *     else:
 *         refbase = None             # <<<<<<<<<<<<<<
 *     return refbase
 * 
 */
  /*else*/ {
    __Pyx_INCREF(Py_None);
    __pyx_v_refbase = Py_None;
  }
  __pyx_L3:;

  /* "pysamstats/opt.pyx":1994
 *     else:
 *         refbase = None
 *     return refbase             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_refbase);
  __pyx_r = __pyx_v_refbase;
  goto __pyx_L0;

  /* "pysamstats/opt.pyx":1987
 * 
 * 
 * def get_refbase(fafile, chrom, pos):             # <<<<<<<<<<<<<<
 *     if fafile is not None:
 *         refbase = fafile.fetch(reference=chrom, start=pos, end=pos+1).upper()
 */

  /* 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_AddTraceback("pysamstats.opt.get_refbase", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_refbase);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":1997
 * 
 * 
 * def iter_binned(stat, alignmentfile, fafile, chrom, window_size=300, window_offset=None,             # <<<<<<<<<<<<<<
 *                 **kwargs):
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_15iter_binned(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_10pysamstats_3opt_14iter_binned[] = "iter_binned(stat, alignmentfile, fafile, chrom, window_size=300, window_offset=None, **kwargs)";
static PyMethodDef __pyx_mdef_10pysamstats_3opt_15iter_binned = {"iter_binned", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pysamstats_3opt_15iter_binned, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pysamstats_3opt_14iter_binned};
static PyObject *__pyx_pw_10pysamstats_3opt_15iter_binned(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_stat = 0;
  PyObject *__pyx_v_alignmentfile = 0;
  PyObject *__pyx_v_fafile = 0;
  PyObject *__pyx_v_chrom = 0;
  PyObject *__pyx_v_window_size = 0;
  PyObject *__pyx_v_window_offset = 0;
  PyObject *__pyx_v_kwargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iter_binned (wrapper)", 0);
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_stat,&__pyx_n_s_alignmentfile,&__pyx_n_s_fafile,&__pyx_n_s_chrom,&__pyx_n_s_window_size,&__pyx_n_s_window_offset,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    values[4] = ((PyObject *)__pyx_int_300);
    values[5] = ((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  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_stat)) != 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_alignmentfile)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("iter_binned", 0, 4, 6, 1); __PYX_ERR(0, 1997, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fafile)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("iter_binned", 0, 4, 6, 2); __PYX_ERR(0, 1997, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_chrom)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("iter_binned", 0, 4, 6, 3); __PYX_ERR(0, 1997, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_window_size);
          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_window_offset);
          if (value) { values[5] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "iter_binned") < 0)) __PYX_ERR(0, 1997, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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);
        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_stat = values[0];
    __pyx_v_alignmentfile = values[1];
    __pyx_v_fafile = values[2];
    __pyx_v_chrom = values[3];
    __pyx_v_window_size = values[4];
    __pyx_v_window_offset = values[5];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("iter_binned", 0, 4, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1997, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("pysamstats.opt.iter_binned", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_10pysamstats_3opt_14iter_binned(__pyx_self, __pyx_v_stat, __pyx_v_alignmentfile, __pyx_v_fafile, __pyx_v_chrom, __pyx_v_window_size, __pyx_v_window_offset, __pyx_v_kwargs);

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

static PyObject *__pyx_pf_10pysamstats_3opt_14iter_binned(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_stat, PyObject *__pyx_v_alignmentfile, PyObject *__pyx_v_fafile, PyObject *__pyx_v_chrom, PyObject *__pyx_v_window_size, PyObject *__pyx_v_window_offset, PyObject *__pyx_v_kwargs) {
  PyObject *__pyx_v_its = NULL;
  PyObject *__pyx_v_itc = NULL;
  PyObject *__pyx_v_it = 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;
  Py_ssize_t __pyx_t_5;
  PyObject *(*__pyx_t_6)(PyObject *);
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  __Pyx_RefNannySetupContext("iter_binned", 0);
  __Pyx_INCREF(__pyx_v_alignmentfile);
  __Pyx_INCREF(__pyx_v_fafile);
  __Pyx_INCREF(__pyx_v_chrom);
  __Pyx_INCREF(__pyx_v_window_offset);

  /* "pysamstats/opt.pyx":2000
 *                 **kwargs):
 * 
 *     if isinstance(alignmentfile, _string_types):             # <<<<<<<<<<<<<<
 *         alignmentfile = AlignmentFile(alignmentfile)
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_string_types); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2000, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_IsInstance(__pyx_v_alignmentfile, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 2000, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "pysamstats/opt.pyx":2001
 * 
 *     if isinstance(alignmentfile, _string_types):
 *         alignmentfile = AlignmentFile(alignmentfile)             # <<<<<<<<<<<<<<
 * 
 *     if isinstance(fafile, _string_types):
 */
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_5pysam_17libcalignmentfile_AlignmentFile), __pyx_v_alignmentfile); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2001, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_alignmentfile, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "pysamstats/opt.pyx":2000
 *                 **kwargs):
 * 
 *     if isinstance(alignmentfile, _string_types):             # <<<<<<<<<<<<<<
 *         alignmentfile = AlignmentFile(alignmentfile)
 * 
 */
  }

  /* "pysamstats/opt.pyx":2003
 *         alignmentfile = AlignmentFile(alignmentfile)
 * 
 *     if isinstance(fafile, _string_types):             # <<<<<<<<<<<<<<
 *         fafile = FastaFile(fafile)
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_string_types); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2003, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_IsInstance(__pyx_v_fafile, __pyx_t_1); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 2003, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {

    /* "pysamstats/opt.pyx":2004
 * 
 *     if isinstance(fafile, _string_types):
 *         fafile = FastaFile(fafile)             # <<<<<<<<<<<<<<
 * 
 *     if window_offset is None:
 */
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_5pysam_9libcfaidx_FastaFile), __pyx_v_fafile); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2004, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_fafile, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "pysamstats/opt.pyx":2003
 *         alignmentfile = AlignmentFile(alignmentfile)
 * 
 *     if isinstance(fafile, _string_types):             # <<<<<<<<<<<<<<
 *         fafile = FastaFile(fafile)
 * 
 */
  }

  /* "pysamstats/opt.pyx":2006
 *         fafile = FastaFile(fafile)
 * 
 *     if window_offset is None:             # <<<<<<<<<<<<<<
 *         window_offset = window_size / 2
 * 
 */
  __pyx_t_2 = (__pyx_v_window_offset == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "pysamstats/opt.pyx":2007
 * 
 *     if window_offset is None:
 *         window_offset = window_size / 2             # <<<<<<<<<<<<<<
 * 
 *     if chrom is None:
 */
    __pyx_t_1 = __Pyx_PyInt_TrueDivideObjC(__pyx_v_window_size, __pyx_int_2, 2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2007, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_window_offset, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "pysamstats/opt.pyx":2006
 *         fafile = FastaFile(fafile)
 * 
 *     if window_offset is None:             # <<<<<<<<<<<<<<
 *         window_offset = window_size / 2
 * 
 */
  }

  /* "pysamstats/opt.pyx":2009
 *         window_offset = window_size / 2
 * 
 *     if chrom is None:             # <<<<<<<<<<<<<<
 *         its = list()
 *         for chrom in alignmentfile.references:
 */
  __pyx_t_3 = (__pyx_v_chrom == Py_None);
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {

    /* "pysamstats/opt.pyx":2010
 * 
 *     if chrom is None:
 *         its = list()             # <<<<<<<<<<<<<<
 *         for chrom in alignmentfile.references:
 *             itc = iter_binned_chrom(stat, alignmentfile=alignmentfile, fafile=fafile,
 */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2010, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_its = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "pysamstats/opt.pyx":2011
 *     if chrom is None:
 *         its = list()
 *         for chrom in alignmentfile.references:             # <<<<<<<<<<<<<<
 *             itc = iter_binned_chrom(stat, alignmentfile=alignmentfile, fafile=fafile,
 *                                     chrom=chrom, window_size=window_size,
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_alignmentfile, __pyx_n_s_references); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2011, __pyx_L1_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_5 = 0;
      __pyx_t_6 = NULL;
    } else {
      __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2011, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2011, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    for (;;) {
      if (likely(!__pyx_t_6)) {
        if (likely(PyList_CheckExact(__pyx_t_4))) {
          if (__pyx_t_5 >= 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_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 2011, __pyx_L1_error)
          #else
          __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2011, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          #endif
        } else {
          if (__pyx_t_5 >= 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_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 2011, __pyx_L1_error)
          #else
          __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2011, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          #endif
        }
      } else {
        __pyx_t_1 = __pyx_t_6(__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, 2011, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_DECREF_SET(__pyx_v_chrom, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "pysamstats/opt.pyx":2012
 *         its = list()
 *         for chrom in alignmentfile.references:
 *             itc = iter_binned_chrom(stat, alignmentfile=alignmentfile, fafile=fafile,             # <<<<<<<<<<<<<<
 *                                     chrom=chrom, window_size=window_size,
 *                                     window_offset=window_offset, **kwargs)
 */
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_iter_binned_chrom); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2012, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2012, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_v_stat);
      __Pyx_GIVEREF(__pyx_v_stat);
      PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_stat);
      __pyx_t_9 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2012, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_alignmentfile, __pyx_v_alignmentfile) < 0) __PYX_ERR(0, 2012, __pyx_L1_error)
      if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_fafile, __pyx_v_fafile) < 0) __PYX_ERR(0, 2012, __pyx_L1_error)

      /* "pysamstats/opt.pyx":2013
 *         for chrom in alignmentfile.references:
 *             itc = iter_binned_chrom(stat, alignmentfile=alignmentfile, fafile=fafile,
 *                                     chrom=chrom, window_size=window_size,             # <<<<<<<<<<<<<<
 *                                     window_offset=window_offset, **kwargs)
 *             its.append(itc)
 */
      if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_chrom, __pyx_v_chrom) < 0) __PYX_ERR(0, 2012, __pyx_L1_error)
      if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_window_size, __pyx_v_window_size) < 0) __PYX_ERR(0, 2012, __pyx_L1_error)

      /* "pysamstats/opt.pyx":2014
 *             itc = iter_binned_chrom(stat, alignmentfile=alignmentfile, fafile=fafile,
 *                                     chrom=chrom, window_size=window_size,
 *                                     window_offset=window_offset, **kwargs)             # <<<<<<<<<<<<<<
 *             its.append(itc)
 *         it = itertools.chain(*its)
 */
      if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_window_offset, __pyx_v_window_offset) < 0) __PYX_ERR(0, 2012, __pyx_L1_error)
      __pyx_t_8 = __pyx_t_9;
      __pyx_t_9 = 0;
      if (__Pyx_MergeKeywords(__pyx_t_8, __pyx_v_kwargs) < 0) __PYX_ERR(0, 2014, __pyx_L1_error)

      /* "pysamstats/opt.pyx":2012
 *         its = list()
 *         for chrom in alignmentfile.references:
 *             itc = iter_binned_chrom(stat, alignmentfile=alignmentfile, fafile=fafile,             # <<<<<<<<<<<<<<
 *                                     chrom=chrom, window_size=window_size,
 *                                     window_offset=window_offset, **kwargs)
 */
      __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2012, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF_SET(__pyx_v_itc, __pyx_t_9);
      __pyx_t_9 = 0;

      /* "pysamstats/opt.pyx":2015
 *                                     chrom=chrom, window_size=window_size,
 *                                     window_offset=window_offset, **kwargs)
 *             its.append(itc)             # <<<<<<<<<<<<<<
 *         it = itertools.chain(*its)
 * 
 */
      __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_its, __pyx_v_itc); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 2015, __pyx_L1_error)

      /* "pysamstats/opt.pyx":2011
 *     if chrom is None:
 *         its = list()
 *         for chrom in alignmentfile.references:             # <<<<<<<<<<<<<<
 *             itc = iter_binned_chrom(stat, alignmentfile=alignmentfile, fafile=fafile,
 *                                     chrom=chrom, window_size=window_size,
 */
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "pysamstats/opt.pyx":2016
 *                                     window_offset=window_offset, **kwargs)
 *             its.append(itc)
 *         it = itertools.chain(*its)             # <<<<<<<<<<<<<<
 * 
 *     else:
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_itertools); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2016, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_chain); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2016, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PySequence_Tuple(__pyx_v_its); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2016, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_4, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2016, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_it = __pyx_t_8;
    __pyx_t_8 = 0;

    /* "pysamstats/opt.pyx":2009
 *         window_offset = window_size / 2
 * 
 *     if chrom is None:             # <<<<<<<<<<<<<<
 *         its = list()
 *         for chrom in alignmentfile.references:
 */
    goto __pyx_L6;
  }

  /* "pysamstats/opt.pyx":2019
 * 
 *     else:
 *         it = iter_binned_chrom(stat, alignmentfile=alignmentfile, fafile=fafile,             # <<<<<<<<<<<<<<
 *                                chrom=chrom, window_size=window_size, window_offset=window_offset,
 *                                **kwargs)
 */
  /*else*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_iter_binned_chrom); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2019, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2019, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_stat);
    __Pyx_GIVEREF(__pyx_v_stat);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_stat);
    __pyx_t_7 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2019, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_alignmentfile, __pyx_v_alignmentfile) < 0) __PYX_ERR(0, 2019, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_fafile, __pyx_v_fafile) < 0) __PYX_ERR(0, 2019, __pyx_L1_error)

    /* "pysamstats/opt.pyx":2020
 *     else:
 *         it = iter_binned_chrom(stat, alignmentfile=alignmentfile, fafile=fafile,
 *                                chrom=chrom, window_size=window_size, window_offset=window_offset,             # <<<<<<<<<<<<<<
 *                                **kwargs)
 * 
 */
    if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_chrom, __pyx_v_chrom) < 0) __PYX_ERR(0, 2019, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_window_size, __pyx_v_window_size) < 0) __PYX_ERR(0, 2019, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_window_offset, __pyx_v_window_offset) < 0) __PYX_ERR(0, 2019, __pyx_L1_error)
    __pyx_t_9 = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pysamstats/opt.pyx":2021
 *         it = iter_binned_chrom(stat, alignmentfile=alignmentfile, fafile=fafile,
 *                                chrom=chrom, window_size=window_size, window_offset=window_offset,
 *                                **kwargs)             # <<<<<<<<<<<<<<
 * 
 *     return it
 */
    if (__Pyx_MergeKeywords(__pyx_t_9, __pyx_v_kwargs) < 0) __PYX_ERR(0, 2021, __pyx_L1_error)

    /* "pysamstats/opt.pyx":2019
 * 
 *     else:
 *         it = iter_binned_chrom(stat, alignmentfile=alignmentfile, fafile=fafile,             # <<<<<<<<<<<<<<
 *                                chrom=chrom, window_size=window_size, window_offset=window_offset,
 *                                **kwargs)
 */
    __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_4, __pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2019, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_v_it = __pyx_t_7;
    __pyx_t_7 = 0;
  }
  __pyx_L6:;

  /* "pysamstats/opt.pyx":2023
 *                                **kwargs)
 * 
 *     return it             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_it);
  __pyx_r = __pyx_v_it;
  goto __pyx_L0;

  /* "pysamstats/opt.pyx":1997
 * 
 * 
 * def iter_binned(stat, alignmentfile, fafile, chrom, window_size=300, window_offset=None,             # <<<<<<<<<<<<<<
 *                 **kwargs):
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("pysamstats.opt.iter_binned", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_its);
  __Pyx_XDECREF(__pyx_v_itc);
  __Pyx_XDECREF(__pyx_v_it);
  __Pyx_XDECREF(__pyx_v_alignmentfile);
  __Pyx_XDECREF(__pyx_v_fafile);
  __Pyx_XDECREF(__pyx_v_chrom);
  __Pyx_XDECREF(__pyx_v_window_offset);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_10pysamstats_3opt_18generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "pysamstats/opt.pyx":2026
 * 
 * 
 * def iter_binned_chrom(BinnedStat stat, AlignmentFile alignmentfile, FastaFile fafile,             # <<<<<<<<<<<<<<
 *                       chrom, start, end, one_based, int window_size, int window_offset,
 *                       int min_mapq, int no_dup):
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_17iter_binned_chrom(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_10pysamstats_3opt_16iter_binned_chrom[] = "iter_binned_chrom(BinnedStat stat, AlignmentFile alignmentfile, FastaFile fafile, chrom, start, end, one_based, int window_size, int window_offset, int min_mapq, int no_dup)";
static PyMethodDef __pyx_mdef_10pysamstats_3opt_17iter_binned_chrom = {"iter_binned_chrom", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pysamstats_3opt_17iter_binned_chrom, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pysamstats_3opt_16iter_binned_chrom};
static PyObject *__pyx_pw_10pysamstats_3opt_17iter_binned_chrom(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_10pysamstats_3opt_BinnedStat *__pyx_v_stat = 0;
  struct __pyx_obj_5pysam_17libcalignmentfile_AlignmentFile *__pyx_v_alignmentfile = 0;
  struct __pyx_obj_5pysam_9libcfaidx_FastaFile *__pyx_v_fafile = 0;
  PyObject *__pyx_v_chrom = 0;
  PyObject *__pyx_v_start = 0;
  PyObject *__pyx_v_end = 0;
  PyObject *__pyx_v_one_based = 0;
  int __pyx_v_window_size;
  int __pyx_v_window_offset;
  int __pyx_v_min_mapq;
  int __pyx_v_no_dup;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iter_binned_chrom (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_stat,&__pyx_n_s_alignmentfile,&__pyx_n_s_fafile,&__pyx_n_s_chrom,&__pyx_n_s_start,&__pyx_n_s_end,&__pyx_n_s_one_based,&__pyx_n_s_window_size,&__pyx_n_s_window_offset,&__pyx_n_s_min_mapq,&__pyx_n_s_no_dup,0};
    PyObject* values[11] = {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 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_stat)) != 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_alignmentfile)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("iter_binned_chrom", 1, 11, 11, 1); __PYX_ERR(0, 2026, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fafile)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("iter_binned_chrom", 1, 11, 11, 2); __PYX_ERR(0, 2026, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_chrom)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("iter_binned_chrom", 1, 11, 11, 3); __PYX_ERR(0, 2026, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_start)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("iter_binned_chrom", 1, 11, 11, 4); __PYX_ERR(0, 2026, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_end)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("iter_binned_chrom", 1, 11, 11, 5); __PYX_ERR(0, 2026, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_one_based)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("iter_binned_chrom", 1, 11, 11, 6); __PYX_ERR(0, 2026, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_window_size)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("iter_binned_chrom", 1, 11, 11, 7); __PYX_ERR(0, 2026, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_window_offset)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("iter_binned_chrom", 1, 11, 11, 8); __PYX_ERR(0, 2026, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_min_mapq)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("iter_binned_chrom", 1, 11, 11, 9); __PYX_ERR(0, 2026, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_no_dup)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("iter_binned_chrom", 1, 11, 11, 10); __PYX_ERR(0, 2026, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "iter_binned_chrom") < 0)) __PYX_ERR(0, 2026, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 11) {
      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);
    }
    __pyx_v_stat = ((struct __pyx_obj_10pysamstats_3opt_BinnedStat *)values[0]);
    __pyx_v_alignmentfile = ((struct __pyx_obj_5pysam_17libcalignmentfile_AlignmentFile *)values[1]);
    __pyx_v_fafile = ((struct __pyx_obj_5pysam_9libcfaidx_FastaFile *)values[2]);
    __pyx_v_chrom = values[3];
    __pyx_v_start = values[4];
    __pyx_v_end = values[5];
    __pyx_v_one_based = values[6];
    __pyx_v_window_size = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_window_size == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2027, __pyx_L3_error)
    __pyx_v_window_offset = __Pyx_PyInt_As_int(values[8]); if (unlikely((__pyx_v_window_offset == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2027, __pyx_L3_error)
    __pyx_v_min_mapq = __Pyx_PyInt_As_int(values[9]); if (unlikely((__pyx_v_min_mapq == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2028, __pyx_L3_error)
    __pyx_v_no_dup = __Pyx_PyInt_As_int(values[10]); if (unlikely((__pyx_v_no_dup == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2028, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("iter_binned_chrom", 1, 11, 11, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2026, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysamstats.opt.iter_binned_chrom", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_stat), __pyx_ptype_10pysamstats_3opt_BinnedStat, 1, "stat", 0))) __PYX_ERR(0, 2026, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_alignmentfile), __pyx_ptype_5pysam_17libcalignmentfile_AlignmentFile, 1, "alignmentfile", 0))) __PYX_ERR(0, 2026, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fafile), __pyx_ptype_5pysam_9libcfaidx_FastaFile, 1, "fafile", 0))) __PYX_ERR(0, 2026, __pyx_L1_error)
  __pyx_r = __pyx_pf_10pysamstats_3opt_16iter_binned_chrom(__pyx_self, __pyx_v_stat, __pyx_v_alignmentfile, __pyx_v_fafile, __pyx_v_chrom, __pyx_v_start, __pyx_v_end, __pyx_v_one_based, __pyx_v_window_size, __pyx_v_window_offset, __pyx_v_min_mapq, __pyx_v_no_dup);

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

static PyObject *__pyx_pf_10pysamstats_3opt_16iter_binned_chrom(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_10pysamstats_3opt_BinnedStat *__pyx_v_stat, struct __pyx_obj_5pysam_17libcalignmentfile_AlignmentFile *__pyx_v_alignmentfile, struct __pyx_obj_5pysam_9libcfaidx_FastaFile *__pyx_v_fafile, PyObject *__pyx_v_chrom, PyObject *__pyx_v_start, PyObject *__pyx_v_end, PyObject *__pyx_v_one_based, int __pyx_v_window_size, int __pyx_v_window_offset, int __pyx_v_min_mapq, int __pyx_v_no_dup) {
  struct __pyx_obj_10pysamstats_3opt___pyx_scope_struct_2_iter_binned_chrom *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iter_binned_chrom", 0);
  __pyx_cur_scope = (struct __pyx_obj_10pysamstats_3opt___pyx_scope_struct_2_iter_binned_chrom *)__pyx_tp_new_10pysamstats_3opt___pyx_scope_struct_2_iter_binned_chrom(__pyx_ptype_10pysamstats_3opt___pyx_scope_struct_2_iter_binned_chrom, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_10pysamstats_3opt___pyx_scope_struct_2_iter_binned_chrom *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 2026, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_stat = __pyx_v_stat;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_stat);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_stat);
  __pyx_cur_scope->__pyx_v_alignmentfile = __pyx_v_alignmentfile;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_alignmentfile);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_alignmentfile);
  __pyx_cur_scope->__pyx_v_fafile = __pyx_v_fafile;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_fafile);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_fafile);
  __pyx_cur_scope->__pyx_v_chrom = __pyx_v_chrom;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_chrom);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_chrom);
  __pyx_cur_scope->__pyx_v_start = __pyx_v_start;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_start);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_start);
  __pyx_cur_scope->__pyx_v_end = __pyx_v_end;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_end);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_end);
  __pyx_cur_scope->__pyx_v_one_based = __pyx_v_one_based;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_one_based);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_one_based);
  __pyx_cur_scope->__pyx_v_window_size = __pyx_v_window_size;
  __pyx_cur_scope->__pyx_v_window_offset = __pyx_v_window_offset;
  __pyx_cur_scope->__pyx_v_min_mapq = __pyx_v_min_mapq;
  __pyx_cur_scope->__pyx_v_no_dup = __pyx_v_no_dup;
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_10pysamstats_3opt_18generator2, __pyx_codeobj__4, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter_binned_chrom, __pyx_n_s_iter_binned_chrom, __pyx_n_s_pysamstats_opt); if (unlikely(!gen)) __PYX_ERR(0, 2026, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysamstats.opt.iter_binned_chrom", __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_10pysamstats_3opt_18generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_10pysamstats_3opt___pyx_scope_struct_2_iter_binned_chrom *__pyx_cur_scope = ((struct __pyx_obj_10pysamstats_3opt___pyx_scope_struct_2_iter_binned_chrom *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_t_12;
  bam1_t *__pyx_t_13;
  int __pyx_t_14;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iter_binned_chrom", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L13_resume_from_yield;
    case 2: goto __pyx_L19_resume_from_yield;
    case 3: goto __pyx_L24_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, 2026, __pyx_L1_error)

  /* "pysamstats/opt.pyx":2032
 *     # setup
 * 
 *     assert chrom is not None, 'chromosome is None'             # <<<<<<<<<<<<<<
 *     start, end = normalise_coords(alignmentfile, chrom, start, end, one_based)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_1 = (__pyx_cur_scope->__pyx_v_chrom != Py_None);
    if (unlikely(!(__pyx_t_1 != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_chromosome_is_None);
      __PYX_ERR(0, 2032, __pyx_L1_error)
    }
  }
  #endif

  /* "pysamstats/opt.pyx":2033
 * 
 *     assert chrom is not None, 'chromosome is None'
 *     start, end = normalise_coords(alignmentfile, chrom, start, end, one_based)             # <<<<<<<<<<<<<<
 * 
 *     cdef int rtid, rstart, rend, has_coord, bin_start, bin_end
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_normalise_coords); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2033, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(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_5 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[6] = {__pyx_t_4, ((PyObject *)__pyx_cur_scope->__pyx_v_alignmentfile), __pyx_cur_scope->__pyx_v_chrom, __pyx_cur_scope->__pyx_v_start, __pyx_cur_scope->__pyx_v_end, __pyx_cur_scope->__pyx_v_one_based};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 5+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2033, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[6] = {__pyx_t_4, ((PyObject *)__pyx_cur_scope->__pyx_v_alignmentfile), __pyx_cur_scope->__pyx_v_chrom, __pyx_cur_scope->__pyx_v_start, __pyx_cur_scope->__pyx_v_end, __pyx_cur_scope->__pyx_v_one_based};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 5+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2033, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(5+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2033, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_alignmentfile));
    __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_alignmentfile));
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, ((PyObject *)__pyx_cur_scope->__pyx_v_alignmentfile));
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_chrom);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_chrom);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_cur_scope->__pyx_v_chrom);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_start);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_start);
    PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, __pyx_cur_scope->__pyx_v_start);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_end);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_end);
    PyTuple_SET_ITEM(__pyx_t_6, 3+__pyx_t_5, __pyx_cur_scope->__pyx_v_end);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_one_based);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_one_based);
    PyTuple_SET_ITEM(__pyx_t_6, 4+__pyx_t_5, __pyx_cur_scope->__pyx_v_one_based);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2033, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    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, 2033, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_6);
    #else
    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2033, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2033, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2033, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_3 = __pyx_t_7(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L4_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 1; __pyx_t_6 = __pyx_t_7(__pyx_t_4); if (unlikely(!__pyx_t_6)) goto __pyx_L4_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_4), 2) < 0) __PYX_ERR(0, 2033, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L5_unpacking_done;
    __pyx_L4_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 2033, __pyx_L1_error)
    __pyx_L5_unpacking_done:;
  }
  __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_start);
  __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_start, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_end);
  __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_end, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  __pyx_t_6 = 0;

  /* "pysamstats/opt.pyx":2036
 * 
 *     cdef int rtid, rstart, rend, has_coord, bin_start, bin_end
 *     has_coord, rtid, rstart, rend = alignmentfile.parse_region(chrom, start, end, None)             # <<<<<<<<<<<<<<
 * 
 *     cdef IteratorRowRegion it
 */
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_alignmentfile), __pyx_n_s_parse_region); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2036, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_3 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
      __pyx_t_5 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_6)) {
    PyObject *__pyx_temp[5] = {__pyx_t_3, __pyx_cur_scope->__pyx_v_chrom, __pyx_cur_scope->__pyx_v_start, __pyx_cur_scope->__pyx_v_end, Py_None};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_5, 4+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2036, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
    PyObject *__pyx_temp[5] = {__pyx_t_3, __pyx_cur_scope->__pyx_v_chrom, __pyx_cur_scope->__pyx_v_start, __pyx_cur_scope->__pyx_v_end, Py_None};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_5, 4+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2036, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else
  #endif
  {
    __pyx_t_4 = PyTuple_New(4+__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2036, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_chrom);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_chrom);
    PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_5, __pyx_cur_scope->__pyx_v_chrom);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_start);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_start);
    PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_5, __pyx_cur_scope->__pyx_v_start);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_end);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_end);
    PyTuple_SET_ITEM(__pyx_t_4, 2+__pyx_t_5, __pyx_cur_scope->__pyx_v_end);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_4, 3+__pyx_t_5, Py_None);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2036, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 4)) {
      if (size > 4) __Pyx_RaiseTooManyValuesError(4);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 2036, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_8 = PyTuple_GET_ITEM(sequence, 3); 
    } else {
      __pyx_t_6 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 2); 
      __pyx_t_8 = PyList_GET_ITEM(sequence, 3); 
    }
    __Pyx_INCREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_8);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[4] = {&__pyx_t_6,&__pyx_t_4,&__pyx_t_3,&__pyx_t_8};
      for (i=0; i < 4; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 2036, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    Py_ssize_t index = -1;
    PyObject** temps[4] = {&__pyx_t_6,&__pyx_t_4,&__pyx_t_3,&__pyx_t_8};
    __pyx_t_9 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2036, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_9)->tp_iternext;
    for (index=0; index < 4; index++) {
      PyObject* item = __pyx_t_7(__pyx_t_9); if (unlikely(!item)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_9), 4) < 0) __PYX_ERR(0, 2036, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    goto __pyx_L7_unpacking_done;
    __pyx_L6_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 2036, __pyx_L1_error)
    __pyx_L7_unpacking_done:;
  }
  __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_6); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2036, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2036, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_11 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2036, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_12 = __Pyx_PyInt_As_int(__pyx_t_8); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2036, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_cur_scope->__pyx_v_has_coord = __pyx_t_5;
  __pyx_cur_scope->__pyx_v_rtid = __pyx_t_10;
  __pyx_cur_scope->__pyx_v_rstart = __pyx_t_11;
  __pyx_cur_scope->__pyx_v_rend = __pyx_t_12;

  /* "pysamstats/opt.pyx":2040
 *     cdef IteratorRowRegion it
 *     cdef bam1_t* b
 *     it = IteratorRowRegion(alignmentfile, rtid, rstart, rend, multiple_iterators=False)             # <<<<<<<<<<<<<<
 *     b = it.b
 * 
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_rtid); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2040, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_rstart); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2040, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_rend); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2040, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2040, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_alignmentfile));
  __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_alignmentfile));
  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_alignmentfile));
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_3);
  __pyx_t_2 = 0;
  __pyx_t_8 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2040, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_multiple_iterators, Py_False) < 0) __PYX_ERR(0, 2040, __pyx_L1_error)
  __pyx_t_8 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5pysam_17libcalignmentfile_IteratorRowRegion), __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2040, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_GIVEREF(__pyx_t_8);
  __pyx_cur_scope->__pyx_v_it = ((struct __pyx_obj_5pysam_17libcalignmentfile_IteratorRowRegion *)__pyx_t_8);
  __pyx_t_8 = 0;

  /* "pysamstats/opt.pyx":2041
 *     cdef bam1_t* b
 *     it = IteratorRowRegion(alignmentfile, rtid, rstart, rend, multiple_iterators=False)
 *     b = it.b             # <<<<<<<<<<<<<<
 * 
 *     # setup first bin
 */
  __pyx_t_13 = __pyx_cur_scope->__pyx_v_it->__pyx_base.b;
  __pyx_cur_scope->__pyx_v_b = __pyx_t_13;

  /* "pysamstats/opt.pyx":2044
 * 
 *     # setup first bin
 *     bin_start = rstart             # <<<<<<<<<<<<<<
 *     bin_end = bin_start + window_size
 * 
 */
  __pyx_cur_scope->__pyx_v_bin_start = __pyx_cur_scope->__pyx_v_rstart;

  /* "pysamstats/opt.pyx":2045
 *     # setup first bin
 *     bin_start = rstart
 *     bin_end = bin_start + window_size             # <<<<<<<<<<<<<<
 * 
 *     # iterate over reads
 */
  __pyx_cur_scope->__pyx_v_bin_end = (__pyx_cur_scope->__pyx_v_bin_start + __pyx_cur_scope->__pyx_v_window_size);

  /* "pysamstats/opt.pyx":2048
 * 
 *     # iterate over reads
 *     it.cnext()             # <<<<<<<<<<<<<<
 *     while it.retval > 0:
 *         while b.core.pos > bin_end:  # end of bin
 */
  (void)(((struct __pyx_vtabstruct_5pysam_17libcalignmentfile_IteratorRowRegion *)__pyx_cur_scope->__pyx_v_it->__pyx_vtab)->cnext(__pyx_cur_scope->__pyx_v_it));

  /* "pysamstats/opt.pyx":2049
 *     # iterate over reads
 *     it.cnext()
 *     while it.retval > 0:             # <<<<<<<<<<<<<<
 *         while b.core.pos > bin_end:  # end of bin
 * 
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_it->__pyx_base.retval > 0) != 0);
    if (!__pyx_t_1) break;

    /* "pysamstats/opt.pyx":2050
 *     it.cnext()
 *     while it.retval > 0:
 *         while b.core.pos > bin_end:  # end of bin             # <<<<<<<<<<<<<<
 * 
 *             # yield record for bin
 */
    while (1) {
      __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_b->core.pos > __pyx_cur_scope->__pyx_v_bin_end) != 0);
      if (!__pyx_t_1) break;

      /* "pysamstats/opt.pyx":2053
 * 
 *             # yield record for bin
 *             rec = stat.rec(chrom, bin_start, bin_end, fafile)             # <<<<<<<<<<<<<<
 *             pos = bin_start + window_offset
 *             if one_based:
 */
      __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_bin_start); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2053, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_bin_end); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2053, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = ((struct __pyx_vtabstruct_10pysamstats_3opt_BinnedStat *)__pyx_cur_scope->__pyx_v_stat->__pyx_vtab)->rec(__pyx_cur_scope->__pyx_v_stat, __pyx_cur_scope->__pyx_v_chrom, __pyx_t_8, __pyx_t_3, __pyx_cur_scope->__pyx_v_fafile); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2053, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_rec);
      __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_rec, ((PyObject*)__pyx_t_4));
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_4 = 0;

      /* "pysamstats/opt.pyx":2054
 *             # yield record for bin
 *             rec = stat.rec(chrom, bin_start, bin_end, fafile)
 *             pos = bin_start + window_offset             # <<<<<<<<<<<<<<
 *             if one_based:
 *                 pos += 1
 */
      __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_cur_scope->__pyx_v_bin_start + __pyx_cur_scope->__pyx_v_window_offset)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2054, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_pos);
      __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pos, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_4 = 0;

      /* "pysamstats/opt.pyx":2055
 *             rec = stat.rec(chrom, bin_start, bin_end, fafile)
 *             pos = bin_start + window_offset
 *             if one_based:             # <<<<<<<<<<<<<<
 *                 pos += 1
 *             rec['chrom'] = chrom
 */
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_one_based); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 2055, __pyx_L1_error)
      if (__pyx_t_1) {

        /* "pysamstats/opt.pyx":2056
 *             pos = bin_start + window_offset
 *             if one_based:
 *                 pos += 1             # <<<<<<<<<<<<<<
 *             rec['chrom'] = chrom
 *             rec['pos'] = pos
 */
        __pyx_t_4 = __Pyx_PyInt_AddObjC(__pyx_cur_scope->__pyx_v_pos, __pyx_int_1, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2056, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_pos);
        __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_pos, __pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_4);
        __pyx_t_4 = 0;

        /* "pysamstats/opt.pyx":2055
 *             rec = stat.rec(chrom, bin_start, bin_end, fafile)
 *             pos = bin_start + window_offset
 *             if one_based:             # <<<<<<<<<<<<<<
 *                 pos += 1
 *             rec['chrom'] = chrom
 */
      }

      /* "pysamstats/opt.pyx":2057
 *             if one_based:
 *                 pos += 1
 *             rec['chrom'] = chrom             # <<<<<<<<<<<<<<
 *             rec['pos'] = pos
 *             yield rec
 */
      if (unlikely(__pyx_cur_scope->__pyx_v_rec == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 2057, __pyx_L1_error)
      }
      if (unlikely(PyDict_SetItem(__pyx_cur_scope->__pyx_v_rec, __pyx_n_s_chrom, __pyx_cur_scope->__pyx_v_chrom) < 0)) __PYX_ERR(0, 2057, __pyx_L1_error)

      /* "pysamstats/opt.pyx":2058
 *                 pos += 1
 *             rec['chrom'] = chrom
 *             rec['pos'] = pos             # <<<<<<<<<<<<<<
 *             yield rec
 * 
 */
      if (unlikely(__pyx_cur_scope->__pyx_v_rec == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 2058, __pyx_L1_error)
      }
      if (unlikely(PyDict_SetItem(__pyx_cur_scope->__pyx_v_rec, __pyx_n_s_pos, __pyx_cur_scope->__pyx_v_pos) < 0)) __PYX_ERR(0, 2058, __pyx_L1_error)

      /* "pysamstats/opt.pyx":2059
 *             rec['chrom'] = chrom
 *             rec['pos'] = pos
 *             yield rec             # <<<<<<<<<<<<<<
 * 
 *             # start new bin
 */
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_rec);
      __pyx_r = __pyx_cur_scope->__pyx_v_rec;
      __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_L13_resume_from_yield:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 2059, __pyx_L1_error)

      /* "pysamstats/opt.pyx":2062
 * 
 *             # start new bin
 *             bin_start = bin_end             # <<<<<<<<<<<<<<
 *             bin_end = bin_start + window_size
 * 
 */
      __pyx_cur_scope->__pyx_v_bin_start = __pyx_cur_scope->__pyx_v_bin_end;

      /* "pysamstats/opt.pyx":2063
 *             # start new bin
 *             bin_start = bin_end
 *             bin_end = bin_start + window_size             # <<<<<<<<<<<<<<
 * 
 *         # process current read
 */
      __pyx_cur_scope->__pyx_v_bin_end = (__pyx_cur_scope->__pyx_v_bin_start + __pyx_cur_scope->__pyx_v_window_size);
    }

    /* "pysamstats/opt.pyx":2066
 * 
 *         # process current read
 *         if min_mapq > 0:             # <<<<<<<<<<<<<<
 *             if b.core.qual < min_mapq:
 *                 it.cnext()
 */
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_min_mapq > 0) != 0);
    if (__pyx_t_1) {

      /* "pysamstats/opt.pyx":2067
 *         # process current read
 *         if min_mapq > 0:
 *             if b.core.qual < min_mapq:             # <<<<<<<<<<<<<<
 *                 it.cnext()
 *                 continue
 */
      __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_b->core.qual < __pyx_cur_scope->__pyx_v_min_mapq) != 0);
      if (__pyx_t_1) {

        /* "pysamstats/opt.pyx":2068
 *         if min_mapq > 0:
 *             if b.core.qual < min_mapq:
 *                 it.cnext()             # <<<<<<<<<<<<<<
 *                 continue
 *         if no_dup:
 */
        (void)(((struct __pyx_vtabstruct_5pysam_17libcalignmentfile_IteratorRowRegion *)__pyx_cur_scope->__pyx_v_it->__pyx_vtab)->cnext(__pyx_cur_scope->__pyx_v_it));

        /* "pysamstats/opt.pyx":2069
 *             if b.core.qual < min_mapq:
 *                 it.cnext()
 *                 continue             # <<<<<<<<<<<<<<
 *         if no_dup:
 *             if <bint>(b.core.flag & BAM_FDUP):
 */
        goto __pyx_L8_continue;

        /* "pysamstats/opt.pyx":2067
 *         # process current read
 *         if min_mapq > 0:
 *             if b.core.qual < min_mapq:             # <<<<<<<<<<<<<<
 *                 it.cnext()
 *                 continue
 */
      }

      /* "pysamstats/opt.pyx":2066
 * 
 *         # process current read
 *         if min_mapq > 0:             # <<<<<<<<<<<<<<
 *             if b.core.qual < min_mapq:
 *                 it.cnext()
 */
    }

    /* "pysamstats/opt.pyx":2070
 *                 it.cnext()
 *                 continue
 *         if no_dup:             # <<<<<<<<<<<<<<
 *             if <bint>(b.core.flag & BAM_FDUP):
 *                 it.cnext()
 */
    __pyx_t_1 = (__pyx_cur_scope->__pyx_v_no_dup != 0);
    if (__pyx_t_1) {

      /* "pysamstats/opt.pyx":2071
 *                 continue
 *         if no_dup:
 *             if <bint>(b.core.flag & BAM_FDUP):             # <<<<<<<<<<<<<<
 *                 it.cnext()
 *                 continue
 */
      __pyx_t_1 = (((__pyx_cur_scope->__pyx_v_b->core.flag & 0x400) != 0) != 0);
      if (__pyx_t_1) {

        /* "pysamstats/opt.pyx":2072
 *         if no_dup:
 *             if <bint>(b.core.flag & BAM_FDUP):
 *                 it.cnext()             # <<<<<<<<<<<<<<
 *                 continue
 *         stat.recv(b)
 */
        (void)(((struct __pyx_vtabstruct_5pysam_17libcalignmentfile_IteratorRowRegion *)__pyx_cur_scope->__pyx_v_it->__pyx_vtab)->cnext(__pyx_cur_scope->__pyx_v_it));

        /* "pysamstats/opt.pyx":2073
 *             if <bint>(b.core.flag & BAM_FDUP):
 *                 it.cnext()
 *                 continue             # <<<<<<<<<<<<<<
 *         stat.recv(b)
 * 
 */
        goto __pyx_L8_continue;

        /* "pysamstats/opt.pyx":2071
 *                 continue
 *         if no_dup:
 *             if <bint>(b.core.flag & BAM_FDUP):             # <<<<<<<<<<<<<<
 *                 it.cnext()
 *                 continue
 */
      }

      /* "pysamstats/opt.pyx":2070
 *                 it.cnext()
 *                 continue
 *         if no_dup:             # <<<<<<<<<<<<<<
 *             if <bint>(b.core.flag & BAM_FDUP):
 *                 it.cnext()
 */
    }

    /* "pysamstats/opt.pyx":2074
 *                 it.cnext()
 *                 continue
 *         stat.recv(b)             # <<<<<<<<<<<<<<
 * 
 *         # move iterator on
 */
    ((struct __pyx_vtabstruct_10pysamstats_3opt_BinnedStat *)__pyx_cur_scope->__pyx_v_stat->__pyx_vtab)->recv(__pyx_cur_scope->__pyx_v_stat, __pyx_cur_scope->__pyx_v_b);

    /* "pysamstats/opt.pyx":2077
 * 
 *         # move iterator on
 *         it.cnext()             # <<<<<<<<<<<<<<
 * 
 *     # deal with last non-empty bin
 */
    (void)(((struct __pyx_vtabstruct_5pysam_17libcalignmentfile_IteratorRowRegion *)__pyx_cur_scope->__pyx_v_it->__pyx_vtab)->cnext(__pyx_cur_scope->__pyx_v_it));
    __pyx_L8_continue:;
  }

  /* "pysamstats/opt.pyx":2080
 * 
 *     # deal with last non-empty bin
 *     rec = stat.rec(chrom, bin_start, bin_end, fafile)             # <<<<<<<<<<<<<<
 *     pos = bin_start + window_offset
 *     if one_based:
 */
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_bin_start); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2080, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_bin_end); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2080, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_8 = ((struct __pyx_vtabstruct_10pysamstats_3opt_BinnedStat *)__pyx_cur_scope->__pyx_v_stat->__pyx_vtab)->rec(__pyx_cur_scope->__pyx_v_stat, __pyx_cur_scope->__pyx_v_chrom, __pyx_t_4, __pyx_t_3, __pyx_cur_scope->__pyx_v_fafile); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2080, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_rec);
  __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_rec, ((PyObject*)__pyx_t_8));
  __Pyx_GIVEREF(__pyx_t_8);
  __pyx_t_8 = 0;

  /* "pysamstats/opt.pyx":2081
 *     # deal with last non-empty bin
 *     rec = stat.rec(chrom, bin_start, bin_end, fafile)
 *     pos = bin_start + window_offset             # <<<<<<<<<<<<<<
 *     if one_based:
 *         pos += 1
 */
  __pyx_t_8 = __Pyx_PyInt_From_int((__pyx_cur_scope->__pyx_v_bin_start + __pyx_cur_scope->__pyx_v_window_offset)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2081, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_pos);
  __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pos, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_8);
  __pyx_t_8 = 0;

  /* "pysamstats/opt.pyx":2082
 *     rec = stat.rec(chrom, bin_start, bin_end, fafile)
 *     pos = bin_start + window_offset
 *     if one_based:             # <<<<<<<<<<<<<<
 *         pos += 1
 *     rec['chrom'] = chrom
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_one_based); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 2082, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "pysamstats/opt.pyx":2083
 *     pos = bin_start + window_offset
 *     if one_based:
 *         pos += 1             # <<<<<<<<<<<<<<
 *     rec['chrom'] = chrom
 *     rec['pos'] = pos
 */
    __pyx_t_8 = __Pyx_PyInt_AddObjC(__pyx_cur_scope->__pyx_v_pos, __pyx_int_1, 1, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2083, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_pos);
    __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_pos, __pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_8);
    __pyx_t_8 = 0;

    /* "pysamstats/opt.pyx":2082
 *     rec = stat.rec(chrom, bin_start, bin_end, fafile)
 *     pos = bin_start + window_offset
 *     if one_based:             # <<<<<<<<<<<<<<
 *         pos += 1
 *     rec['chrom'] = chrom
 */
  }

  /* "pysamstats/opt.pyx":2084
 *     if one_based:
 *         pos += 1
 *     rec['chrom'] = chrom             # <<<<<<<<<<<<<<
 *     rec['pos'] = pos
 *     yield rec
 */
  if (unlikely(__pyx_cur_scope->__pyx_v_rec == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 2084, __pyx_L1_error)
  }
  if (unlikely(PyDict_SetItem(__pyx_cur_scope->__pyx_v_rec, __pyx_n_s_chrom, __pyx_cur_scope->__pyx_v_chrom) < 0)) __PYX_ERR(0, 2084, __pyx_L1_error)

  /* "pysamstats/opt.pyx":2085
 *         pos += 1
 *     rec['chrom'] = chrom
 *     rec['pos'] = pos             # <<<<<<<<<<<<<<
 *     yield rec
 * 
 */
  if (unlikely(__pyx_cur_scope->__pyx_v_rec == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 2085, __pyx_L1_error)
  }
  if (unlikely(PyDict_SetItem(__pyx_cur_scope->__pyx_v_rec, __pyx_n_s_pos, __pyx_cur_scope->__pyx_v_pos) < 0)) __PYX_ERR(0, 2085, __pyx_L1_error)

  /* "pysamstats/opt.pyx":2086
 *     rec['chrom'] = chrom
 *     rec['pos'] = pos
 *     yield rec             # <<<<<<<<<<<<<<
 * 
 *     # deal with empty bins up to explicit end
 */
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_rec);
  __pyx_r = __pyx_cur_scope->__pyx_v_rec;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  /* return from generator, yielding value */
  __pyx_generator->resume_label = 2;
  return __pyx_r;
  __pyx_L19_resume_from_yield:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 2086, __pyx_L1_error)

  /* "pysamstats/opt.pyx":2089
 * 
 *     # deal with empty bins up to explicit end
 *     if end is not None:             # <<<<<<<<<<<<<<
 *         while bin_end < end:
 *             # start new bin
 */
  __pyx_t_1 = (__pyx_cur_scope->__pyx_v_end != Py_None);
  __pyx_t_14 = (__pyx_t_1 != 0);
  if (__pyx_t_14) {

    /* "pysamstats/opt.pyx":2090
 *     # deal with empty bins up to explicit end
 *     if end is not None:
 *         while bin_end < end:             # <<<<<<<<<<<<<<
 *             # start new bin
 *             bin_start = bin_end
 */
    while (1) {
      __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_bin_end); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2090, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_3 = PyObject_RichCompare(__pyx_t_8, __pyx_cur_scope->__pyx_v_end, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2090, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 2090, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (!__pyx_t_14) break;

      /* "pysamstats/opt.pyx":2092
 *         while bin_end < end:
 *             # start new bin
 *             bin_start = bin_end             # <<<<<<<<<<<<<<
 *             bin_end = bin_start + window_size
 * 
 */
      __pyx_cur_scope->__pyx_v_bin_start = __pyx_cur_scope->__pyx_v_bin_end;

      /* "pysamstats/opt.pyx":2093
 *             # start new bin
 *             bin_start = bin_end
 *             bin_end = bin_start + window_size             # <<<<<<<<<<<<<<
 * 
 *             # yield record
 */
      __pyx_cur_scope->__pyx_v_bin_end = (__pyx_cur_scope->__pyx_v_bin_start + __pyx_cur_scope->__pyx_v_window_size);

      /* "pysamstats/opt.pyx":2096
 * 
 *             # yield record
 *             rec = stat.rec(chrom, bin_start, bin_end, fafile)             # <<<<<<<<<<<<<<
 *             pos = bin_start + window_offset
 *             if one_based:
 */
      __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_bin_start); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2096, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_bin_end); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2096, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_4 = ((struct __pyx_vtabstruct_10pysamstats_3opt_BinnedStat *)__pyx_cur_scope->__pyx_v_stat->__pyx_vtab)->rec(__pyx_cur_scope->__pyx_v_stat, __pyx_cur_scope->__pyx_v_chrom, __pyx_t_3, __pyx_t_8, __pyx_cur_scope->__pyx_v_fafile); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2096, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_rec);
      __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_rec, ((PyObject*)__pyx_t_4));
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_4 = 0;

      /* "pysamstats/opt.pyx":2097
 *             # yield record
 *             rec = stat.rec(chrom, bin_start, bin_end, fafile)
 *             pos = bin_start + window_offset             # <<<<<<<<<<<<<<
 *             if one_based:
 *                 pos += 1
 */
      __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_cur_scope->__pyx_v_bin_start + __pyx_cur_scope->__pyx_v_window_offset)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2097, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_pos);
      __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_pos, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_4 = 0;

      /* "pysamstats/opt.pyx":2098
 *             rec = stat.rec(chrom, bin_start, bin_end, fafile)
 *             pos = bin_start + window_offset
 *             if one_based:             # <<<<<<<<<<<<<<
 *                 pos += 1
 *             rec['chrom'] = chrom
 */
      __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_one_based); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 2098, __pyx_L1_error)
      if (__pyx_t_14) {

        /* "pysamstats/opt.pyx":2099
 *             pos = bin_start + window_offset
 *             if one_based:
 *                 pos += 1             # <<<<<<<<<<<<<<
 *             rec['chrom'] = chrom
 *             rec['pos'] = pos
 */
        __pyx_t_4 = __Pyx_PyInt_AddObjC(__pyx_cur_scope->__pyx_v_pos, __pyx_int_1, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2099, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_pos);
        __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_pos, __pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_4);
        __pyx_t_4 = 0;

        /* "pysamstats/opt.pyx":2098
 *             rec = stat.rec(chrom, bin_start, bin_end, fafile)
 *             pos = bin_start + window_offset
 *             if one_based:             # <<<<<<<<<<<<<<
 *                 pos += 1
 *             rec['chrom'] = chrom
 */
      }

      /* "pysamstats/opt.pyx":2100
 *             if one_based:
 *                 pos += 1
 *             rec['chrom'] = chrom             # <<<<<<<<<<<<<<
 *             rec['pos'] = pos
 *             yield rec
 */
      if (unlikely(__pyx_cur_scope->__pyx_v_rec == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 2100, __pyx_L1_error)
      }
      if (unlikely(PyDict_SetItem(__pyx_cur_scope->__pyx_v_rec, __pyx_n_s_chrom, __pyx_cur_scope->__pyx_v_chrom) < 0)) __PYX_ERR(0, 2100, __pyx_L1_error)

      /* "pysamstats/opt.pyx":2101
 *                 pos += 1
 *             rec['chrom'] = chrom
 *             rec['pos'] = pos             # <<<<<<<<<<<<<<
 *             yield rec
 * 
 */
      if (unlikely(__pyx_cur_scope->__pyx_v_rec == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 2101, __pyx_L1_error)
      }
      if (unlikely(PyDict_SetItem(__pyx_cur_scope->__pyx_v_rec, __pyx_n_s_pos, __pyx_cur_scope->__pyx_v_pos) < 0)) __PYX_ERR(0, 2101, __pyx_L1_error)

      /* "pysamstats/opt.pyx":2102
 *             rec['chrom'] = chrom
 *             rec['pos'] = pos
 *             yield rec             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_rec);
      __pyx_r = __pyx_cur_scope->__pyx_v_rec;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, yielding value */
      __pyx_generator->resume_label = 3;
      return __pyx_r;
      __pyx_L24_resume_from_yield:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 2102, __pyx_L1_error)
    }

    /* "pysamstats/opt.pyx":2089
 * 
 *     # deal with empty bins up to explicit end
 *     if end is not None:             # <<<<<<<<<<<<<<
 *         while bin_end < end:
 *             # start new bin
 */
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "pysamstats/opt.pyx":2026
 * 
 * 
 * def iter_binned_chrom(BinnedStat stat, AlignmentFile alignmentfile, FastaFile fafile,             # <<<<<<<<<<<<<<
 *                       chrom, start, end, one_based, int window_size, int window_offset,
 *                       int min_mapq, int no_dup):
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("iter_binned_chrom", __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;
}

/* "pysamstats/opt.pyx":2105
 * 
 * 
 * def normalise_coords(AlignmentFile alignmentfile, chrom, start, end, one_based):             # <<<<<<<<<<<<<<
 *     """Convert to zero-based coordinates and deal with unspecified start
 *     and/or end.
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_20normalise_coords(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_10pysamstats_3opt_19normalise_coords[] = "normalise_coords(AlignmentFile alignmentfile, chrom, start, end, one_based)\nConvert to zero-based coordinates and deal with unspecified start\n    and/or end.\n\n    ";
static PyMethodDef __pyx_mdef_10pysamstats_3opt_20normalise_coords = {"normalise_coords", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pysamstats_3opt_20normalise_coords, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pysamstats_3opt_19normalise_coords};
static PyObject *__pyx_pw_10pysamstats_3opt_20normalise_coords(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_5pysam_17libcalignmentfile_AlignmentFile *__pyx_v_alignmentfile = 0;
  PyObject *__pyx_v_chrom = 0;
  PyObject *__pyx_v_start = 0;
  PyObject *__pyx_v_end = 0;
  PyObject *__pyx_v_one_based = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("normalise_coords (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_alignmentfile,&__pyx_n_s_chrom,&__pyx_n_s_start,&__pyx_n_s_end,&__pyx_n_s_one_based,0};
    PyObject* values[5] = {0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        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_alignmentfile)) != 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_chrom)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("normalise_coords", 1, 5, 5, 1); __PYX_ERR(0, 2105, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_start)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("normalise_coords", 1, 5, 5, 2); __PYX_ERR(0, 2105, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_end)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("normalise_coords", 1, 5, 5, 3); __PYX_ERR(0, 2105, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_one_based)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("normalise_coords", 1, 5, 5, 4); __PYX_ERR(0, 2105, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "normalise_coords") < 0)) __PYX_ERR(0, 2105, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
      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);
    }
    __pyx_v_alignmentfile = ((struct __pyx_obj_5pysam_17libcalignmentfile_AlignmentFile *)values[0]);
    __pyx_v_chrom = values[1];
    __pyx_v_start = values[2];
    __pyx_v_end = values[3];
    __pyx_v_one_based = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("normalise_coords", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2105, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysamstats.opt.normalise_coords", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_alignmentfile), __pyx_ptype_5pysam_17libcalignmentfile_AlignmentFile, 1, "alignmentfile", 0))) __PYX_ERR(0, 2105, __pyx_L1_error)
  __pyx_r = __pyx_pf_10pysamstats_3opt_19normalise_coords(__pyx_self, __pyx_v_alignmentfile, __pyx_v_chrom, __pyx_v_start, __pyx_v_end, __pyx_v_one_based);

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

static PyObject *__pyx_pf_10pysamstats_3opt_19normalise_coords(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5pysam_17libcalignmentfile_AlignmentFile *__pyx_v_alignmentfile, PyObject *__pyx_v_chrom, PyObject *__pyx_v_start, PyObject *__pyx_v_end, PyObject *__pyx_v_one_based) {
  PyObject *__pyx_v_chrlen = NULL;
  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;
  __Pyx_RefNannySetupContext("normalise_coords", 0);
  __Pyx_INCREF(__pyx_v_start);
  __Pyx_INCREF(__pyx_v_end);

  /* "pysamstats/opt.pyx":2111
 *     """
 * 
 *     if chrom is None:             # <<<<<<<<<<<<<<
 *         return None, None
 * 
 */
  __pyx_t_1 = (__pyx_v_chrom == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "pysamstats/opt.pyx":2112
 * 
 *     if chrom is None:
 *         return None, None             # <<<<<<<<<<<<<<
 * 
 *     else:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_tuple__5);
    __pyx_r = __pyx_tuple__5;
    goto __pyx_L0;

    /* "pysamstats/opt.pyx":2111
 *     """
 * 
 *     if chrom is None:             # <<<<<<<<<<<<<<
 *         return None, None
 * 
 */
  }

  /* "pysamstats/opt.pyx":2115
 * 
 *     else:
 *         assert chrom in alignmentfile.references, \             # <<<<<<<<<<<<<<
 *             'chromosome not in SAM references: %s' % chrom
 * 
 */
  /*else*/ {
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_alignmentfile), __pyx_n_s_references); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2115, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_v_chrom, __pyx_t_3, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 2115, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!(__pyx_t_2 != 0))) {

        /* "pysamstats/opt.pyx":2116
 *     else:
 *         assert chrom in alignmentfile.references, \
 *             'chromosome not in SAM references: %s' % chrom             # <<<<<<<<<<<<<<
 * 
 *         if one_based:
 */
        __pyx_t_3 = __Pyx_PyString_FormatSafe(__pyx_kp_s_chromosome_not_in_SAM_references, __pyx_v_chrom); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2116, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        PyErr_SetObject(PyExc_AssertionError, __pyx_t_3);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __PYX_ERR(0, 2115, __pyx_L1_error)
      }
    }
    #endif

    /* "pysamstats/opt.pyx":2118
 *             'chromosome not in SAM references: %s' % chrom
 * 
 *         if one_based:             # <<<<<<<<<<<<<<
 *             start = start - 1 if start is not None else None
 *             end = end - 1 if end is not None else None
 */
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_one_based); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 2118, __pyx_L1_error)
    if (__pyx_t_2) {

      /* "pysamstats/opt.pyx":2119
 * 
 *         if one_based:
 *             start = start - 1 if start is not None else None             # <<<<<<<<<<<<<<
 *             end = end - 1 if end is not None else None
 * 
 */
      __pyx_t_2 = (__pyx_v_start != Py_None);
      if ((__pyx_t_2 != 0)) {
        __pyx_t_4 = __Pyx_PyInt_SubtractObjC(__pyx_v_start, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2119, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_3 = __pyx_t_4;
        __pyx_t_4 = 0;
      } else {
        __Pyx_INCREF(Py_None);
        __pyx_t_3 = Py_None;
      }
      __Pyx_DECREF_SET(__pyx_v_start, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "pysamstats/opt.pyx":2120
 *         if one_based:
 *             start = start - 1 if start is not None else None
 *             end = end - 1 if end is not None else None             # <<<<<<<<<<<<<<
 * 
 *         chrlen = alignmentfile.lengths[alignmentfile.references.index(chrom)]
 */
      __pyx_t_2 = (__pyx_v_end != Py_None);
      if ((__pyx_t_2 != 0)) {
        __pyx_t_4 = __Pyx_PyInt_SubtractObjC(__pyx_v_end, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2120, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_3 = __pyx_t_4;
        __pyx_t_4 = 0;
      } else {
        __Pyx_INCREF(Py_None);
        __pyx_t_3 = Py_None;
      }
      __Pyx_DECREF_SET(__pyx_v_end, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "pysamstats/opt.pyx":2118
 *             'chromosome not in SAM references: %s' % chrom
 * 
 *         if one_based:             # <<<<<<<<<<<<<<
 *             start = start - 1 if start is not None else None
 *             end = end - 1 if end is not None else None
 */
    }

    /* "pysamstats/opt.pyx":2122
 *             end = end - 1 if end is not None else None
 * 
 *         chrlen = alignmentfile.lengths[alignmentfile.references.index(chrom)]             # <<<<<<<<<<<<<<
 *         if start is None:
 *             start = 0
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_alignmentfile), __pyx_n_s_lengths); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2122, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_alignmentfile), __pyx_n_s_references); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2122, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_index); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2122, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    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_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_5, __pyx_v_chrom) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_chrom);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2122, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2122, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_chrlen = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "pysamstats/opt.pyx":2123
 * 
 *         chrlen = alignmentfile.lengths[alignmentfile.references.index(chrom)]
 *         if start is None:             # <<<<<<<<<<<<<<
 *             start = 0
 *         if end is None:
 */
    __pyx_t_2 = (__pyx_v_start == Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "pysamstats/opt.pyx":2124
 *         chrlen = alignmentfile.lengths[alignmentfile.references.index(chrom)]
 *         if start is None:
 *             start = 0             # <<<<<<<<<<<<<<
 *         if end is None:
 *             end = chrlen
 */
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_DECREF_SET(__pyx_v_start, __pyx_int_0);

      /* "pysamstats/opt.pyx":2123
 * 
 *         chrlen = alignmentfile.lengths[alignmentfile.references.index(chrom)]
 *         if start is None:             # <<<<<<<<<<<<<<
 *             start = 0
 *         if end is None:
 */
    }

    /* "pysamstats/opt.pyx":2125
 *         if start is None:
 *             start = 0
 *         if end is None:             # <<<<<<<<<<<<<<
 *             end = chrlen
 *         if end > chrlen:
 */
    __pyx_t_1 = (__pyx_v_end == Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {

      /* "pysamstats/opt.pyx":2126
 *             start = 0
 *         if end is None:
 *             end = chrlen             # <<<<<<<<<<<<<<
 *         if end > chrlen:
 *             end = chrlen
 */
      __Pyx_INCREF(__pyx_v_chrlen);
      __Pyx_DECREF_SET(__pyx_v_end, __pyx_v_chrlen);

      /* "pysamstats/opt.pyx":2125
 *         if start is None:
 *             start = 0
 *         if end is None:             # <<<<<<<<<<<<<<
 *             end = chrlen
 *         if end > chrlen:
 */
    }

    /* "pysamstats/opt.pyx":2127
 *         if end is None:
 *             end = chrlen
 *         if end > chrlen:             # <<<<<<<<<<<<<<
 *             end = chrlen
 * 
 */
    __pyx_t_6 = PyObject_RichCompare(__pyx_v_end, __pyx_v_chrlen, Py_GT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2127, __pyx_L1_error)
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 2127, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (__pyx_t_2) {

      /* "pysamstats/opt.pyx":2128
 *             end = chrlen
 *         if end > chrlen:
 *             end = chrlen             # <<<<<<<<<<<<<<
 * 
 *         return start, end
 */
      __Pyx_INCREF(__pyx_v_chrlen);
      __Pyx_DECREF_SET(__pyx_v_end, __pyx_v_chrlen);

      /* "pysamstats/opt.pyx":2127
 *         if end is None:
 *             end = chrlen
 *         if end > chrlen:             # <<<<<<<<<<<<<<
 *             end = chrlen
 * 
 */
    }

    /* "pysamstats/opt.pyx":2130
 *             end = chrlen
 * 
 *         return start, end             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2130, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_v_start);
    __Pyx_GIVEREF(__pyx_v_start);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_start);
    __Pyx_INCREF(__pyx_v_end);
    __Pyx_GIVEREF(__pyx_v_end);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_end);
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    goto __pyx_L0;
  }

  /* "pysamstats/opt.pyx":2105
 * 
 * 
 * def normalise_coords(AlignmentFile alignmentfile, chrom, start, end, one_based):             # <<<<<<<<<<<<<<
 *     """Convert to zero-based coordinates and deal with unspecified start
 *     and/or end.
 */

  /* 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_AddTraceback("pysamstats.opt.normalise_coords", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_chrlen);
  __Pyx_XDECREF(__pyx_v_start);
  __Pyx_XDECREF(__pyx_v_end);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":2133
 * 
 * 
 * cdef inline bint is_softclipped(bam1_t* aln):             # <<<<<<<<<<<<<<
 *     cdef int k
 *     cigar_p = pysam_bam_get_cigar(aln)
 */

static CYTHON_INLINE int __pyx_f_10pysamstats_3opt_is_softclipped(bam1_t *__pyx_v_aln) {
  int __pyx_v_k;
  uint32_t *__pyx_v_cigar_p;
  long __pyx_v_op;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  uint32_t __pyx_t_1;
  uint32_t __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("is_softclipped", 0);

  /* "pysamstats/opt.pyx":2135
 * cdef inline bint is_softclipped(bam1_t* aln):
 *     cdef int k
 *     cigar_p = pysam_bam_get_cigar(aln)             # <<<<<<<<<<<<<<
 *     for k in range(aln.core.n_cigar):
 *         op = cigar_p[k] & BAM_CIGAR_MASK
 */
  __pyx_v_cigar_p = pysam_bam_get_cigar(__pyx_v_aln);

  /* "pysamstats/opt.pyx":2136
 *     cdef int k
 *     cigar_p = pysam_bam_get_cigar(aln)
 *     for k in range(aln.core.n_cigar):             # <<<<<<<<<<<<<<
 *         op = cigar_p[k] & BAM_CIGAR_MASK
 *         if op == BAM_CSOFT_CLIP:
 */
  __pyx_t_1 = __pyx_v_aln->core.n_cigar;
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_k = __pyx_t_3;

    /* "pysamstats/opt.pyx":2137
 *     cigar_p = pysam_bam_get_cigar(aln)
 *     for k in range(aln.core.n_cigar):
 *         op = cigar_p[k] & BAM_CIGAR_MASK             # <<<<<<<<<<<<<<
 *         if op == BAM_CSOFT_CLIP:
 *             return 1
 */
    __pyx_v_op = ((__pyx_v_cigar_p[__pyx_v_k]) & 15);

    /* "pysamstats/opt.pyx":2138
 *     for k in range(aln.core.n_cigar):
 *         op = cigar_p[k] & BAM_CIGAR_MASK
 *         if op == BAM_CSOFT_CLIP:             # <<<<<<<<<<<<<<
 *             return 1
 *     return 0
 */
    __pyx_t_4 = ((__pyx_v_op == 4) != 0);
    if (__pyx_t_4) {

      /* "pysamstats/opt.pyx":2139
 *         op = cigar_p[k] & BAM_CIGAR_MASK
 *         if op == BAM_CSOFT_CLIP:
 *             return 1             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
      __pyx_r = 1;
      goto __pyx_L0;

      /* "pysamstats/opt.pyx":2138
 *     for k in range(aln.core.n_cigar):
 *         op = cigar_p[k] & BAM_CIGAR_MASK
 *         if op == BAM_CSOFT_CLIP:             # <<<<<<<<<<<<<<
 *             return 1
 *     return 0
 */
    }
  }

  /* "pysamstats/opt.pyx":2140
 *         if op == BAM_CSOFT_CLIP:
 *             return 1
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "pysamstats/opt.pyx":2133
 * 
 * 
 * cdef inline bint is_softclipped(bam1_t* aln):             # <<<<<<<<<<<<<<
 *     cdef int k
 *     cigar_p = pysam_bam_get_cigar(aln)
 */

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

/* "pysamstats/opt.pyx":2143
 * 
 * 
 * cdef inline object get_seq_base(bam1_t *src, uint32_t k):             # <<<<<<<<<<<<<<
 *     cdef uint8_t* p
 *     cdef char* s
 */

static CYTHON_INLINE PyObject *__pyx_f_10pysamstats_3opt_get_seq_base(bam1_t *__pyx_v_src, uint32_t __pyx_v_k) {
  uint8_t *__pyx_v_p;
  char *__pyx_v_s;
  PyObject *__pyx_v_seq = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  char *__pyx_t_3;
  __Pyx_RefNannySetupContext("get_seq_base", 0);

  /* "pysamstats/opt.pyx":2147
 *     cdef char* s
 * 
 *     if not src.core.l_qseq:             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
  __pyx_t_1 = ((!(__pyx_v_src->core.l_qseq != 0)) != 0);
  if (__pyx_t_1) {

    /* "pysamstats/opt.pyx":2148
 * 
 *     if not src.core.l_qseq:
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     seq = PyBytes_FromStringAndSize(NULL, 1)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "pysamstats/opt.pyx":2147
 *     cdef char* s
 * 
 *     if not src.core.l_qseq:             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
  }

  /* "pysamstats/opt.pyx":2150
 *         return None
 * 
 *     seq = PyBytes_FromStringAndSize(NULL, 1)             # <<<<<<<<<<<<<<
 *     s   = <char*>seq
 *     p   = pysam_bam_get_seq(src)
 */
  __pyx_t_2 = PyBytes_FromStringAndSize(NULL, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2150, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_seq = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":2151
 * 
 *     seq = PyBytes_FromStringAndSize(NULL, 1)
 *     s   = <char*>seq             # <<<<<<<<<<<<<<
 *     p   = pysam_bam_get_seq(src)
 * 
 */
  if (unlikely(__pyx_v_seq == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(0, 2151, __pyx_L1_error)
  }
  __pyx_t_3 = __Pyx_PyBytes_AsWritableString(__pyx_v_seq); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(0, 2151, __pyx_L1_error)
  __pyx_v_s = ((char *)__pyx_t_3);

  /* "pysamstats/opt.pyx":2152
 *     seq = PyBytes_FromStringAndSize(NULL, 1)
 *     s   = <char*>seq
 *     p   = pysam_bam_get_seq(src)             # <<<<<<<<<<<<<<
 * 
 *     s[0] = bam_nt16_rev_table[p[k//2] >> 4 * (1 - k%2) & 0xf]
 */
  __pyx_v_p = pysam_bam_get_seq(__pyx_v_src);

  /* "pysamstats/opt.pyx":2154
 *     p   = pysam_bam_get_seq(src)
 * 
 *     s[0] = bam_nt16_rev_table[p[k//2] >> 4 * (1 - k%2) & 0xf]             # <<<<<<<<<<<<<<
 * 
 *     return seq
 */
  (__pyx_v_s[0]) = (__pyx_v_10pysamstats_3opt_bam_nt16_rev_table[(((__pyx_v_p[__Pyx_div_long(__pyx_v_k, 2)]) >> (4 * (1 - __Pyx_mod_long(__pyx_v_k, 2)))) & 0xf)]);

  /* "pysamstats/opt.pyx":2156
 *     s[0] = bam_nt16_rev_table[p[k//2] >> 4 * (1 - k%2) & 0xf]
 * 
 *     return seq             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_seq);
  __pyx_r = __pyx_v_seq;
  goto __pyx_L0;

  /* "pysamstats/opt.pyx":2143
 * 
 * 
 * cdef inline object get_seq_base(bam1_t *src, uint32_t k):             # <<<<<<<<<<<<<<
 *     cdef uint8_t* p
 *     cdef char* s
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pysamstats.opt.get_seq_base", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_seq);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":2159
 * 
 * 
 * def rootmean(uint64_t sqsum, int count):             # <<<<<<<<<<<<<<
 *     if count > 0:
 *         return int(round(sqrt(sqsum / count)))
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_22rootmean(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_10pysamstats_3opt_21rootmean[] = "rootmean(uint64_t sqsum, int count)";
static PyMethodDef __pyx_mdef_10pysamstats_3opt_22rootmean = {"rootmean", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pysamstats_3opt_22rootmean, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pysamstats_3opt_21rootmean};
static PyObject *__pyx_pw_10pysamstats_3opt_22rootmean(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  uint64_t __pyx_v_sqsum;
  int __pyx_v_count;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rootmean (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sqsum,&__pyx_n_s_count,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_sqsum)) != 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_count)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rootmean", 1, 2, 2, 1); __PYX_ERR(0, 2159, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rootmean") < 0)) __PYX_ERR(0, 2159, __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_sqsum = __Pyx_PyInt_As_uint64_t(values[0]); if (unlikely((__pyx_v_sqsum == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2159, __pyx_L3_error)
    __pyx_v_count = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_count == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2159, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rootmean", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2159, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysamstats.opt.rootmean", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_10pysamstats_3opt_21rootmean(__pyx_self, __pyx_v_sqsum, __pyx_v_count);

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

static PyObject *__pyx_pf_10pysamstats_3opt_21rootmean(CYTHON_UNUSED PyObject *__pyx_self, uint64_t __pyx_v_sqsum, int __pyx_v_count) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("rootmean", 0);

  /* "pysamstats/opt.pyx":2160
 * 
 * def rootmean(uint64_t sqsum, int count):
 *     if count > 0:             # <<<<<<<<<<<<<<
 *         return int(round(sqrt(sqsum / count)))
 *     else:
 */
  __pyx_t_1 = ((__pyx_v_count > 0) != 0);
  if (__pyx_t_1) {

    /* "pysamstats/opt.pyx":2161
 * def rootmean(uint64_t sqsum, int count):
 *     if count > 0:
 *         return int(round(sqrt(sqsum / count)))             # <<<<<<<<<<<<<<
 *     else:
 *         return 0
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_round); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2161, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (unlikely(__pyx_v_count == 0)) {
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      __PYX_ERR(0, 2161, __pyx_L1_error)
    }
    __pyx_t_4 = PyFloat_FromDouble(sqrt((((double)__pyx_v_sqsum) / ((double)__pyx_v_count)))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2161, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(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_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2161, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyNumber_Int(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2161, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "pysamstats/opt.pyx":2160
 * 
 * def rootmean(uint64_t sqsum, int count):
 *     if count > 0:             # <<<<<<<<<<<<<<
 *         return int(round(sqrt(sqsum / count)))
 *     else:
 */
  }

  /* "pysamstats/opt.pyx":2163
 *         return int(round(sqrt(sqsum / count)))
 *     else:
 *         return 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_int_0);
    __pyx_r = __pyx_int_0;
    goto __pyx_L0;
  }

  /* "pysamstats/opt.pyx":2159
 * 
 * 
 * def rootmean(uint64_t sqsum, int count):             # <<<<<<<<<<<<<<
 *     if count > 0:
 *         return int(round(sqrt(sqsum / count)))
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pysamstats.opt.rootmean", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":2166
 * 
 * 
 * def mean(int64_t total, int count):             # <<<<<<<<<<<<<<
 *     if count > 0:
 *         return int(round(total / count))
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_24mean(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_10pysamstats_3opt_23mean[] = "mean(int64_t total, int count)";
static PyMethodDef __pyx_mdef_10pysamstats_3opt_24mean = {"mean", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pysamstats_3opt_24mean, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pysamstats_3opt_23mean};
static PyObject *__pyx_pw_10pysamstats_3opt_24mean(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int64_t __pyx_v_total;
  int __pyx_v_count;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mean (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_total,&__pyx_n_s_count,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_total)) != 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_count)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mean", 1, 2, 2, 1); __PYX_ERR(0, 2166, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mean") < 0)) __PYX_ERR(0, 2166, __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_total = __Pyx_PyInt_As_int64_t(values[0]); if (unlikely((__pyx_v_total == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2166, __pyx_L3_error)
    __pyx_v_count = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_count == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2166, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mean", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2166, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysamstats.opt.mean", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_10pysamstats_3opt_23mean(__pyx_self, __pyx_v_total, __pyx_v_count);

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

static PyObject *__pyx_pf_10pysamstats_3opt_23mean(CYTHON_UNUSED PyObject *__pyx_self, int64_t __pyx_v_total, int __pyx_v_count) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("mean", 0);

  /* "pysamstats/opt.pyx":2167
 * 
 * def mean(int64_t total, int count):
 *     if count > 0:             # <<<<<<<<<<<<<<
 *         return int(round(total / count))
 *     else:
 */
  __pyx_t_1 = ((__pyx_v_count > 0) != 0);
  if (__pyx_t_1) {

    /* "pysamstats/opt.pyx":2168
 * def mean(int64_t total, int count):
 *     if count > 0:
 *         return int(round(total / count))             # <<<<<<<<<<<<<<
 *     else:
 *         return 0
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_round); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2168, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (unlikely(__pyx_v_count == 0)) {
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      __PYX_ERR(0, 2168, __pyx_L1_error)
    }
    __pyx_t_4 = PyFloat_FromDouble((((double)__pyx_v_total) / ((double)__pyx_v_count))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2168, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(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_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2168, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyNumber_Int(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2168, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "pysamstats/opt.pyx":2167
 * 
 * def mean(int64_t total, int count):
 *     if count > 0:             # <<<<<<<<<<<<<<
 *         return int(round(total / count))
 *     else:
 */
  }

  /* "pysamstats/opt.pyx":2170
 *         return int(round(total / count))
 *     else:
 *         return 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_int_0);
    __pyx_r = __pyx_int_0;
    goto __pyx_L0;
  }

  /* "pysamstats/opt.pyx":2166
 * 
 * 
 * def mean(int64_t total, int count):             # <<<<<<<<<<<<<<
 *     if count > 0:
 *         return int(round(total / count))
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pysamstats.opt.mean", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysamstats/opt.pyx":2176
 * 
 * 
 * def count_reads(AlignmentFile alignmentfile, chrom=None, start=None, end=None):             # <<<<<<<<<<<<<<
 *     cdef IteratorRowRegion it
 *     cdef int n = 0
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_26count_reads(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_10pysamstats_3opt_25count_reads[] = "count_reads(AlignmentFile alignmentfile, chrom=None, start=None, end=None)";
static PyMethodDef __pyx_mdef_10pysamstats_3opt_26count_reads = {"count_reads", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pysamstats_3opt_26count_reads, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pysamstats_3opt_25count_reads};
static PyObject *__pyx_pw_10pysamstats_3opt_26count_reads(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_5pysam_17libcalignmentfile_AlignmentFile *__pyx_v_alignmentfile = 0;
  PyObject *__pyx_v_chrom = 0;
  PyObject *__pyx_v_start = 0;
  PyObject *__pyx_v_end = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("count_reads (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_alignmentfile,&__pyx_n_s_chrom,&__pyx_n_s_start,&__pyx_n_s_end,0};
    PyObject* values[4] = {0,0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    values[3] = ((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  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_alignmentfile)) != 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_chrom);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_start);
          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_end);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "count_reads") < 0)) __PYX_ERR(0, 2176, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_alignmentfile = ((struct __pyx_obj_5pysam_17libcalignmentfile_AlignmentFile *)values[0]);
    __pyx_v_chrom = values[1];
    __pyx_v_start = values[2];
    __pyx_v_end = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("count_reads", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2176, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysamstats.opt.count_reads", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_alignmentfile), __pyx_ptype_5pysam_17libcalignmentfile_AlignmentFile, 1, "alignmentfile", 0))) __PYX_ERR(0, 2176, __pyx_L1_error)
  __pyx_r = __pyx_pf_10pysamstats_3opt_25count_reads(__pyx_self, __pyx_v_alignmentfile, __pyx_v_chrom, __pyx_v_start, __pyx_v_end);

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

static PyObject *__pyx_pf_10pysamstats_3opt_25count_reads(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5pysam_17libcalignmentfile_AlignmentFile *__pyx_v_alignmentfile, PyObject *__pyx_v_chrom, PyObject *__pyx_v_start, PyObject *__pyx_v_end) {
  struct __pyx_obj_5pysam_17libcalignmentfile_IteratorRowRegion *__pyx_v_it = 0;
  int __pyx_v_n;
  CYTHON_UNUSED PyObject *__pyx_v_has_coord = NULL;
  PyObject *__pyx_v_rtid = NULL;
  PyObject *__pyx_v_rstart = NULL;
  PyObject *__pyx_v_rend = 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 *);
  int __pyx_t_9;
  __Pyx_RefNannySetupContext("count_reads", 0);

  /* "pysamstats/opt.pyx":2178
 * def count_reads(AlignmentFile alignmentfile, chrom=None, start=None, end=None):
 *     cdef IteratorRowRegion it
 *     cdef int n = 0             # <<<<<<<<<<<<<<
 *     has_coord, rtid, rstart, rend = alignmentfile.parse_region(chrom, start,
 *                                                                end, None)
 */
  __pyx_v_n = 0;

  /* "pysamstats/opt.pyx":2179
 *     cdef IteratorRowRegion it
 *     cdef int n = 0
 *     has_coord, rtid, rstart, rend = alignmentfile.parse_region(chrom, start,             # <<<<<<<<<<<<<<
 *                                                                end, None)
 *     it = IteratorRowRegion(alignmentfile, rtid, rstart, rend,
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_alignmentfile), __pyx_n_s_parse_region); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2179, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "pysamstats/opt.pyx":2180
 *     cdef int n = 0
 *     has_coord, rtid, rstart, rend = alignmentfile.parse_region(chrom, start,
 *                                                                end, None)             # <<<<<<<<<<<<<<
 *     it = IteratorRowRegion(alignmentfile, rtid, rstart, rend,
 *                            multiple_iterators=False)
 */
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  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_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_3, __pyx_v_chrom, __pyx_v_start, __pyx_v_end, Py_None};
    __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, 2179, __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_chrom, __pyx_v_start, __pyx_v_end, Py_None};
    __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, 2179, __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, 2179, __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_chrom);
    __Pyx_GIVEREF(__pyx_v_chrom);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_chrom);
    __Pyx_INCREF(__pyx_v_start);
    __Pyx_GIVEREF(__pyx_v_start);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_start);
    __Pyx_INCREF(__pyx_v_end);
    __Pyx_GIVEREF(__pyx_v_end);
    PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_v_end);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_4, Py_None);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2179, __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 != 4)) {
      if (size > 4) __Pyx_RaiseTooManyValuesError(4);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 2179, __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); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 3); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 2); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 3); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_6);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_5,&__pyx_t_3,&__pyx_t_6};
      for (i=0; i < 4; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 2179, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_5,&__pyx_t_3,&__pyx_t_6};
    __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2179, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
    for (index=0; index < 4; index++) {
      PyObject* item = __pyx_t_8(__pyx_t_7); if (unlikely(!item)) goto __pyx_L3_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 4) < 0) __PYX_ERR(0, 2179, __pyx_L1_error)
    __pyx_t_8 = NULL;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_8 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 2179, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }

  /* "pysamstats/opt.pyx":2179
 *     cdef IteratorRowRegion it
 *     cdef int n = 0
 *     has_coord, rtid, rstart, rend = alignmentfile.parse_region(chrom, start,             # <<<<<<<<<<<<<<
 *                                                                end, None)
 *     it = IteratorRowRegion(alignmentfile, rtid, rstart, rend,
 */
  __pyx_v_has_coord = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_rtid = __pyx_t_5;
  __pyx_t_5 = 0;
  __pyx_v_rstart = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_rend = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "pysamstats/opt.pyx":2181
 *     has_coord, rtid, rstart, rend = alignmentfile.parse_region(chrom, start,
 *                                                                end, None)
 *     it = IteratorRowRegion(alignmentfile, rtid, rstart, rend,             # <<<<<<<<<<<<<<
 *                            multiple_iterators=False)
 *     while True:
 */
  __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_alignmentfile));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_alignmentfile));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_alignmentfile));
  __Pyx_INCREF(__pyx_v_rtid);
  __Pyx_GIVEREF(__pyx_v_rtid);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_rtid);
  __Pyx_INCREF(__pyx_v_rstart);
  __Pyx_GIVEREF(__pyx_v_rstart);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_rstart);
  __Pyx_INCREF(__pyx_v_rend);
  __Pyx_GIVEREF(__pyx_v_rend);
  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_rend);

  /* "pysamstats/opt.pyx":2182
 *                                                                end, None)
 *     it = IteratorRowRegion(alignmentfile, rtid, rstart, rend,
 *                            multiple_iterators=False)             # <<<<<<<<<<<<<<
 *     while True:
 *         it.cnext()
 */
  __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_multiple_iterators, Py_False) < 0) __PYX_ERR(0, 2182, __pyx_L1_error)

  /* "pysamstats/opt.pyx":2181
 *     has_coord, rtid, rstart, rend = alignmentfile.parse_region(chrom, start,
 *                                                                end, None)
 *     it = IteratorRowRegion(alignmentfile, rtid, rstart, rend,             # <<<<<<<<<<<<<<
 *                            multiple_iterators=False)
 *     while True:
 */
  __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5pysam_17libcalignmentfile_IteratorRowRegion), __pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_v_it = ((struct __pyx_obj_5pysam_17libcalignmentfile_IteratorRowRegion *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pysamstats/opt.pyx":2183
 *     it = IteratorRowRegion(alignmentfile, rtid, rstart, rend,
 *                            multiple_iterators=False)
 *     while True:             # <<<<<<<<<<<<<<
 *         it.cnext()
 *         if it.retval > 0:
 */
  while (1) {

    /* "pysamstats/opt.pyx":2184
 *                            multiple_iterators=False)
 *     while True:
 *         it.cnext()             # <<<<<<<<<<<<<<
 *         if it.retval > 0:
 *             n += 1
 */
    (void)(((struct __pyx_vtabstruct_5pysam_17libcalignmentfile_IteratorRowRegion *)__pyx_v_it->__pyx_vtab)->cnext(__pyx_v_it));

    /* "pysamstats/opt.pyx":2185
 *     while True:
 *         it.cnext()
 *         if it.retval > 0:             # <<<<<<<<<<<<<<
 *             n += 1
 *         else:
 */
    __pyx_t_9 = ((__pyx_v_it->__pyx_base.retval > 0) != 0);
    if (__pyx_t_9) {

      /* "pysamstats/opt.pyx":2186
 *         it.cnext()
 *         if it.retval > 0:
 *             n += 1             # <<<<<<<<<<<<<<
 *         else:
 *             break
 */
      __pyx_v_n = (__pyx_v_n + 1);

      /* "pysamstats/opt.pyx":2185
 *     while True:
 *         it.cnext()
 *         if it.retval > 0:             # <<<<<<<<<<<<<<
 *             n += 1
 *         else:
 */
      goto __pyx_L7;
    }

    /* "pysamstats/opt.pyx":2188
 *             n += 1
 *         else:
 *             break             # <<<<<<<<<<<<<<
 *     return n
 */
    /*else*/ {
      goto __pyx_L6_break;
    }
    __pyx_L7:;
  }
  __pyx_L6_break:;

  /* "pysamstats/opt.pyx":2189
 *         else:
 *             break
 *     return n             # <<<<<<<<<<<<<<
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_n); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2189, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "pysamstats/opt.pyx":2176
 * 
 * 
 * def count_reads(AlignmentFile alignmentfile, chrom=None, start=None, end=None):             # <<<<<<<<<<<<<<
 *     cdef IteratorRowRegion it
 *     cdef int n = 0
 */

  /* 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("pysamstats.opt.count_reads", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_it);
  __Pyx_XDECREF(__pyx_v_has_coord);
  __Pyx_XDECREF(__pyx_v_rtid);
  __Pyx_XDECREF(__pyx_v_rstart);
  __Pyx_XDECREF(__pyx_v_rend);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_PileupStat(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_28__pyx_unpickle_PileupStat(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_10pysamstats_3opt_27__pyx_unpickle_PileupStat[] = "__pyx_unpickle_PileupStat(__pyx_type, long __pyx_checksum, __pyx_state)";
static PyMethodDef __pyx_mdef_10pysamstats_3opt_28__pyx_unpickle_PileupStat = {"__pyx_unpickle_PileupStat", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pysamstats_3opt_28__pyx_unpickle_PileupStat, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pysamstats_3opt_27__pyx_unpickle_PileupStat};
static PyObject *__pyx_pw_10pysamstats_3opt_28__pyx_unpickle_PileupStat(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_PileupStat (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,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_pyx_type)) != 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_pyx_checksum)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_PileupStat", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_PileupStat", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_PileupStat") < 0)) __PYX_ERR(1, 1, __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___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_PileupStat", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_PileupStat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_10pysamstats_3opt_27__pyx_unpickle_PileupStat(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

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

static PyObject *__pyx_pf_10pysamstats_3opt_27__pyx_unpickle_PileupStat(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("__pyx_unpickle_PileupStat", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xd41d8cd:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xd41d8cd) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xd41d8cd:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = PileupStat.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v___pyx_PickleError = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum != 0xd41d8cd:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = PileupStat.__new__(__pyx_type)
 *     if __pyx_state is not None:
 */
    __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xd4, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_v___pyx_PickleError);
    __pyx_t_2 = __pyx_v___pyx_PickleError; __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_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xd41d8cd:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = PileupStat.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_PileupStat__set_state(<PileupStat> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_10pysamstats_3opt_PileupStat), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __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_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v___pyx_result = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = PileupStat.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_PileupStat__set_state(<PileupStat> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
  __pyx_t_6 = (__pyx_t_1 != 0);
  if (__pyx_t_6) {

    /* "(tree fragment)":9
 *     __pyx_result = PileupStat.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_PileupStat__set_state(<PileupStat> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_PileupStat__set_state(PileupStat __pyx_result, tuple __pyx_state):
 */
    if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_10pysamstats_3opt___pyx_unpickle_PileupStat__set_state(((struct __pyx_obj_10pysamstats_3opt_PileupStat *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = PileupStat.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_PileupStat__set_state(<PileupStat> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_PileupStat__set_state(<PileupStat> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_PileupStat__set_state(PileupStat __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_PileupStat(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_PileupStat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_PileupStat__set_state(<PileupStat> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_PileupStat__set_state(PileupStat __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */

static PyObject *__pyx_f_10pysamstats_3opt___pyx_unpickle_PileupStat__set_state(struct __pyx_obj_10pysamstats_3opt_PileupStat *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("__pyx_unpickle_PileupStat__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_PileupStat__set_state(PileupStat __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_2 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(1, 12, __pyx_L1_error)
  __pyx_t_3 = ((__pyx_t_2 > 0) != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 12, __pyx_L1_error)
  __pyx_t_4 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_PileupStat__set_state(PileupStat __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])             # <<<<<<<<<<<<<<
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 13, __pyx_L1_error)
    }
    __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_PileupStat__set_state(PileupStat __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_PileupStat__set_state(<PileupStat> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_PileupStat__set_state(PileupStat __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_PileupStat__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_CountPp(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_30__pyx_unpickle_CountPp(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_10pysamstats_3opt_29__pyx_unpickle_CountPp[] = "__pyx_unpickle_CountPp(__pyx_type, long __pyx_checksum, __pyx_state)";
static PyMethodDef __pyx_mdef_10pysamstats_3opt_30__pyx_unpickle_CountPp = {"__pyx_unpickle_CountPp", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pysamstats_3opt_30__pyx_unpickle_CountPp, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pysamstats_3opt_29__pyx_unpickle_CountPp};
static PyObject *__pyx_pw_10pysamstats_3opt_30__pyx_unpickle_CountPp(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_CountPp (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,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_pyx_type)) != 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_pyx_checksum)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_CountPp", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_CountPp", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_CountPp") < 0)) __PYX_ERR(1, 1, __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___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_CountPp", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_CountPp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_10pysamstats_3opt_29__pyx_unpickle_CountPp(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

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

static PyObject *__pyx_pf_10pysamstats_3opt_29__pyx_unpickle_CountPp(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("__pyx_unpickle_CountPp", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x145977c:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x145977c = (all, pp))" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0x145977c) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x145977c:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x145977c = (all, pp))" % __pyx_checksum)
 *     __pyx_result = CountPp.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v___pyx_PickleError = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum != 0x145977c:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x145977c = (all, pp))" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = CountPp.__new__(__pyx_type)
 *     if __pyx_state is not None:
 */
    __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0x14, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_v___pyx_PickleError);
    __pyx_t_2 = __pyx_v___pyx_PickleError; __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_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x145977c:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x145977c = (all, pp))" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x145977c = (all, pp))" % __pyx_checksum)
 *     __pyx_result = CountPp.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_CountPp__set_state(<CountPp> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_10pysamstats_3opt_CountPp), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __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_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v___pyx_result = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x145977c = (all, pp))" % __pyx_checksum)
 *     __pyx_result = CountPp.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_CountPp__set_state(<CountPp> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
  __pyx_t_6 = (__pyx_t_1 != 0);
  if (__pyx_t_6) {

    /* "(tree fragment)":9
 *     __pyx_result = CountPp.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_CountPp__set_state(<CountPp> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_CountPp__set_state(CountPp __pyx_result, tuple __pyx_state):
 */
    if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_10pysamstats_3opt___pyx_unpickle_CountPp__set_state(((struct __pyx_obj_10pysamstats_3opt_CountPp *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x145977c = (all, pp))" % __pyx_checksum)
 *     __pyx_result = CountPp.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_CountPp__set_state(<CountPp> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_CountPp__set_state(<CountPp> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_CountPp__set_state(CountPp __pyx_result, tuple __pyx_state):
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.pp = __pyx_state[1]
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_CountPp(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_CountPp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_CountPp__set_state(<CountPp> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_CountPp__set_state(CountPp __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.pp = __pyx_state[1]
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):
 */

static PyObject *__pyx_f_10pysamstats_3opt___pyx_unpickle_CountPp__set_state(struct __pyx_obj_10pysamstats_3opt_CountPp *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  Py_ssize_t __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;
  __Pyx_RefNannySetupContext("__pyx_unpickle_CountPp__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_CountPp__set_state(CountPp __pyx_result, tuple __pyx_state):
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.pp = __pyx_state[1]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[2])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->all = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->pp = __pyx_t_2;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_CountPp__set_state(CountPp __pyx_result, tuple __pyx_state):
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.pp = __pyx_state[1]
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[2])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 13, __pyx_L1_error)
  }
  __pyx_t_4 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_5 = ((__pyx_t_4 > 2) != 0);
  if (__pyx_t_5) {
  } else {
    __pyx_t_3 = __pyx_t_5;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_5 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_6 = (__pyx_t_5 != 0);
  __pyx_t_3 = __pyx_t_6;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_3) {

    /* "(tree fragment)":14
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.pp = __pyx_state[1]
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[2])             # <<<<<<<<<<<<<<
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_update); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 14, __pyx_L1_error)
    }
    __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    __pyx_t_1 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_9, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_7);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_CountPp__set_state(CountPp __pyx_result, tuple __pyx_state):
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.pp = __pyx_state[1]
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[2])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_CountPp__set_state(<CountPp> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_CountPp__set_state(CountPp __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.pp = __pyx_state[1]
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):
 */

  /* 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_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_CountPp__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_Coverage(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_32__pyx_unpickle_Coverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_10pysamstats_3opt_31__pyx_unpickle_Coverage[] = "__pyx_unpickle_Coverage(__pyx_type, long __pyx_checksum, __pyx_state)";
static PyMethodDef __pyx_mdef_10pysamstats_3opt_32__pyx_unpickle_Coverage = {"__pyx_unpickle_Coverage", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pysamstats_3opt_32__pyx_unpickle_Coverage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pysamstats_3opt_31__pyx_unpickle_Coverage};
static PyObject *__pyx_pw_10pysamstats_3opt_32__pyx_unpickle_Coverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_Coverage (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,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_pyx_type)) != 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_pyx_checksum)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Coverage", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Coverage", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_Coverage") < 0)) __PYX_ERR(1, 1, __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___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Coverage", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_Coverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_10pysamstats_3opt_31__pyx_unpickle_Coverage(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

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

static PyObject *__pyx_pf_10pysamstats_3opt_31__pyx_unpickle_Coverage(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("__pyx_unpickle_Coverage", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x0fb9cf5:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x0fb9cf5 = (reads))" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0x0fb9cf5) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x0fb9cf5:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x0fb9cf5 = (reads))" % __pyx_checksum)
 *     __pyx_result = Coverage.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v___pyx_PickleError = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum != 0x0fb9cf5:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x0fb9cf5 = (reads))" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = Coverage.__new__(__pyx_type)
 *     if __pyx_state is not None:
 */
    __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0x0f, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_v___pyx_PickleError);
    __pyx_t_2 = __pyx_v___pyx_PickleError; __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_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x0fb9cf5:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x0fb9cf5 = (reads))" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x0fb9cf5 = (reads))" % __pyx_checksum)
 *     __pyx_result = Coverage.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_Coverage__set_state(<Coverage> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_10pysamstats_3opt_Coverage), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __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_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v___pyx_result = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x0fb9cf5 = (reads))" % __pyx_checksum)
 *     __pyx_result = Coverage.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_Coverage__set_state(<Coverage> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
  __pyx_t_6 = (__pyx_t_1 != 0);
  if (__pyx_t_6) {

    /* "(tree fragment)":9
 *     __pyx_result = Coverage.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_Coverage__set_state(<Coverage> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_Coverage__set_state(Coverage __pyx_result, tuple __pyx_state):
 */
    if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_10pysamstats_3opt___pyx_unpickle_Coverage__set_state(((struct __pyx_obj_10pysamstats_3opt_Coverage *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x0fb9cf5 = (reads))" % __pyx_checksum)
 *     __pyx_result = Coverage.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_Coverage__set_state(<Coverage> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_Coverage__set_state(<Coverage> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_Coverage__set_state(Coverage __pyx_result, tuple __pyx_state):
 *     __pyx_result.reads = __pyx_state[0]
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_Coverage(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_Coverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_Coverage__set_state(<Coverage> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_Coverage__set_state(Coverage __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.reads = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 */

static PyObject *__pyx_f_10pysamstats_3opt___pyx_unpickle_Coverage__set_state(struct __pyx_obj_10pysamstats_3opt_Coverage *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("__pyx_unpickle_Coverage__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_Coverage__set_state(Coverage __pyx_result, tuple __pyx_state):
 *     __pyx_result.reads = __pyx_state[0]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[1])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_CountPp))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->reads);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->reads));
  __pyx_v___pyx_result->reads = ((struct __pyx_obj_10pysamstats_3opt_CountPp *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_Coverage__set_state(Coverage __pyx_result, tuple __pyx_state):
 *     __pyx_result.reads = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[1])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 13, __pyx_L1_error)
  }
  __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_4 = ((__pyx_t_3 > 1) != 0);
  if (__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_5 = (__pyx_t_4 != 0);
  __pyx_t_2 = __pyx_t_5;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "(tree fragment)":14
 *     __pyx_result.reads = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[1])             # <<<<<<<<<<<<<<
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 14, __pyx_L1_error)
    }
    __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_Coverage__set_state(Coverage __pyx_result, tuple __pyx_state):
 *     __pyx_result.reads = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[1])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_Coverage__set_state(<Coverage> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_Coverage__set_state(Coverage __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.reads = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 */

  /* 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_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_Coverage__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_CountPpStrand(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_34__pyx_unpickle_CountPpStrand(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_10pysamstats_3opt_33__pyx_unpickle_CountPpStrand[] = "__pyx_unpickle_CountPpStrand(__pyx_type, long __pyx_checksum, __pyx_state)";
static PyMethodDef __pyx_mdef_10pysamstats_3opt_34__pyx_unpickle_CountPpStrand = {"__pyx_unpickle_CountPpStrand", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pysamstats_3opt_34__pyx_unpickle_CountPpStrand, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pysamstats_3opt_33__pyx_unpickle_CountPpStrand};
static PyObject *__pyx_pw_10pysamstats_3opt_34__pyx_unpickle_CountPpStrand(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_CountPpStrand (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,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_pyx_type)) != 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_pyx_checksum)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_CountPpStrand", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_CountPpStrand", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_CountPpStrand") < 0)) __PYX_ERR(1, 1, __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___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_CountPpStrand", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_CountPpStrand", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_10pysamstats_3opt_33__pyx_unpickle_CountPpStrand(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

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

static PyObject *__pyx_pf_10pysamstats_3opt_33__pyx_unpickle_CountPpStrand(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("__pyx_unpickle_CountPpStrand", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x6e74246:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x6e74246 = (all, fwd, pp, pp_fwd, pp_rev, rev))" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0x6e74246) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x6e74246:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x6e74246 = (all, fwd, pp, pp_fwd, pp_rev, rev))" % __pyx_checksum)
 *     __pyx_result = CountPpStrand.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v___pyx_PickleError = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum != 0x6e74246:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x6e74246 = (all, fwd, pp, pp_fwd, pp_rev, rev))" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = CountPpStrand.__new__(__pyx_type)
 *     if __pyx_state is not None:
 */
    __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0x6e, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_v___pyx_PickleError);
    __pyx_t_2 = __pyx_v___pyx_PickleError; __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_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x6e74246:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x6e74246 = (all, fwd, pp, pp_fwd, pp_rev, rev))" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x6e74246 = (all, fwd, pp, pp_fwd, pp_rev, rev))" % __pyx_checksum)
 *     __pyx_result = CountPpStrand.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_CountPpStrand__set_state(<CountPpStrand> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_10pysamstats_3opt_CountPpStrand), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __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_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v___pyx_result = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x6e74246 = (all, fwd, pp, pp_fwd, pp_rev, rev))" % __pyx_checksum)
 *     __pyx_result = CountPpStrand.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_CountPpStrand__set_state(<CountPpStrand> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
  __pyx_t_6 = (__pyx_t_1 != 0);
  if (__pyx_t_6) {

    /* "(tree fragment)":9
 *     __pyx_result = CountPpStrand.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_CountPpStrand__set_state(<CountPpStrand> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_CountPpStrand__set_state(CountPpStrand __pyx_result, tuple __pyx_state):
 */
    if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_10pysamstats_3opt___pyx_unpickle_CountPpStrand__set_state(((struct __pyx_obj_10pysamstats_3opt_CountPpStrand *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x6e74246 = (all, fwd, pp, pp_fwd, pp_rev, rev))" % __pyx_checksum)
 *     __pyx_result = CountPpStrand.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_CountPpStrand__set_state(<CountPpStrand> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_CountPpStrand__set_state(<CountPpStrand> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_CountPpStrand__set_state(CountPpStrand __pyx_result, tuple __pyx_state):
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.fwd = __pyx_state[1]; __pyx_result.pp = __pyx_state[2]; __pyx_result.pp_fwd = __pyx_state[3]; __pyx_result.pp_rev = __pyx_state[4]; __pyx_result.rev = __pyx_state[5]
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_CountPpStrand(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_CountPpStrand", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_CountPpStrand__set_state(<CountPpStrand> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_CountPpStrand__set_state(CountPpStrand __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.fwd = __pyx_state[1]; __pyx_result.pp = __pyx_state[2]; __pyx_result.pp_fwd = __pyx_state[3]; __pyx_result.pp_rev = __pyx_state[4]; __pyx_result.rev = __pyx_state[5]
 *     if len(__pyx_state) > 6 and hasattr(__pyx_result, '__dict__'):
 */

static PyObject *__pyx_f_10pysamstats_3opt___pyx_unpickle_CountPpStrand__set_state(struct __pyx_obj_10pysamstats_3opt_CountPpStrand *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  Py_ssize_t __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;
  __Pyx_RefNannySetupContext("__pyx_unpickle_CountPpStrand__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_CountPpStrand__set_state(CountPpStrand __pyx_result, tuple __pyx_state):
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.fwd = __pyx_state[1]; __pyx_result.pp = __pyx_state[2]; __pyx_result.pp_fwd = __pyx_state[3]; __pyx_result.pp_rev = __pyx_state[4]; __pyx_result.rev = __pyx_state[5]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 6 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[6])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->all = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->fwd = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->pp = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->pp_fwd = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->pp_rev = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 5, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->rev = __pyx_t_2;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_CountPpStrand__set_state(CountPpStrand __pyx_result, tuple __pyx_state):
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.fwd = __pyx_state[1]; __pyx_result.pp = __pyx_state[2]; __pyx_result.pp_fwd = __pyx_state[3]; __pyx_result.pp_rev = __pyx_state[4]; __pyx_result.rev = __pyx_state[5]
 *     if len(__pyx_state) > 6 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[6])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 13, __pyx_L1_error)
  }
  __pyx_t_4 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_5 = ((__pyx_t_4 > 6) != 0);
  if (__pyx_t_5) {
  } else {
    __pyx_t_3 = __pyx_t_5;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_5 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_6 = (__pyx_t_5 != 0);
  __pyx_t_3 = __pyx_t_6;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_3) {

    /* "(tree fragment)":14
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.fwd = __pyx_state[1]; __pyx_result.pp = __pyx_state[2]; __pyx_result.pp_fwd = __pyx_state[3]; __pyx_result.pp_rev = __pyx_state[4]; __pyx_result.rev = __pyx_state[5]
 *     if len(__pyx_state) > 6 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[6])             # <<<<<<<<<<<<<<
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_update); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 14, __pyx_L1_error)
    }
    __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 6, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    __pyx_t_1 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_9, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_7);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_CountPpStrand__set_state(CountPpStrand __pyx_result, tuple __pyx_state):
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.fwd = __pyx_state[1]; __pyx_result.pp = __pyx_state[2]; __pyx_result.pp_fwd = __pyx_state[3]; __pyx_result.pp_rev = __pyx_state[4]; __pyx_result.rev = __pyx_state[5]
 *     if len(__pyx_state) > 6 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[6])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_CountPpStrand__set_state(<CountPpStrand> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_CountPpStrand__set_state(CountPpStrand __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.fwd = __pyx_state[1]; __pyx_result.pp = __pyx_state[2]; __pyx_result.pp_fwd = __pyx_state[3]; __pyx_result.pp_rev = __pyx_state[4]; __pyx_result.rev = __pyx_state[5]
 *     if len(__pyx_state) > 6 and hasattr(__pyx_result, '__dict__'):
 */

  /* 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_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_CountPpStrand__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_CoverageStrand(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_36__pyx_unpickle_CoverageStrand(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_10pysamstats_3opt_35__pyx_unpickle_CoverageStrand[] = "__pyx_unpickle_CoverageStrand(__pyx_type, long __pyx_checksum, __pyx_state)";
static PyMethodDef __pyx_mdef_10pysamstats_3opt_36__pyx_unpickle_CoverageStrand = {"__pyx_unpickle_CoverageStrand", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pysamstats_3opt_36__pyx_unpickle_CoverageStrand, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pysamstats_3opt_35__pyx_unpickle_CoverageStrand};
static PyObject *__pyx_pw_10pysamstats_3opt_36__pyx_unpickle_CoverageStrand(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_CoverageStrand (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,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_pyx_type)) != 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_pyx_checksum)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_CoverageStrand", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_CoverageStrand", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_CoverageStrand") < 0)) __PYX_ERR(1, 1, __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___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_CoverageStrand", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_CoverageStrand", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_10pysamstats_3opt_35__pyx_unpickle_CoverageStrand(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

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

static PyObject *__pyx_pf_10pysamstats_3opt_35__pyx_unpickle_CoverageStrand(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("__pyx_unpickle_CoverageStrand", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x0fb9cf5:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x0fb9cf5 = (reads))" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0x0fb9cf5) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x0fb9cf5:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x0fb9cf5 = (reads))" % __pyx_checksum)
 *     __pyx_result = CoverageStrand.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v___pyx_PickleError = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum != 0x0fb9cf5:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x0fb9cf5 = (reads))" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = CoverageStrand.__new__(__pyx_type)
 *     if __pyx_state is not None:
 */
    __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0x0f, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_v___pyx_PickleError);
    __pyx_t_2 = __pyx_v___pyx_PickleError; __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_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x0fb9cf5:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x0fb9cf5 = (reads))" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x0fb9cf5 = (reads))" % __pyx_checksum)
 *     __pyx_result = CoverageStrand.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_CoverageStrand__set_state(<CoverageStrand> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_10pysamstats_3opt_CoverageStrand), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __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_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v___pyx_result = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x0fb9cf5 = (reads))" % __pyx_checksum)
 *     __pyx_result = CoverageStrand.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_CoverageStrand__set_state(<CoverageStrand> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
  __pyx_t_6 = (__pyx_t_1 != 0);
  if (__pyx_t_6) {

    /* "(tree fragment)":9
 *     __pyx_result = CoverageStrand.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_CoverageStrand__set_state(<CoverageStrand> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_CoverageStrand__set_state(CoverageStrand __pyx_result, tuple __pyx_state):
 */
    if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_10pysamstats_3opt___pyx_unpickle_CoverageStrand__set_state(((struct __pyx_obj_10pysamstats_3opt_CoverageStrand *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x0fb9cf5 = (reads))" % __pyx_checksum)
 *     __pyx_result = CoverageStrand.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_CoverageStrand__set_state(<CoverageStrand> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_CoverageStrand__set_state(<CoverageStrand> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_CoverageStrand__set_state(CoverageStrand __pyx_result, tuple __pyx_state):
 *     __pyx_result.reads = __pyx_state[0]
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_CoverageStrand(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_CoverageStrand", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_CoverageStrand__set_state(<CoverageStrand> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_CoverageStrand__set_state(CoverageStrand __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.reads = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 */

static PyObject *__pyx_f_10pysamstats_3opt___pyx_unpickle_CoverageStrand__set_state(struct __pyx_obj_10pysamstats_3opt_CoverageStrand *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("__pyx_unpickle_CoverageStrand__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_CoverageStrand__set_state(CoverageStrand __pyx_result, tuple __pyx_state):
 *     __pyx_result.reads = __pyx_state[0]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[1])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_CountPpStrand))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->reads);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->reads));
  __pyx_v___pyx_result->reads = ((struct __pyx_obj_10pysamstats_3opt_CountPpStrand *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_CoverageStrand__set_state(CoverageStrand __pyx_result, tuple __pyx_state):
 *     __pyx_result.reads = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[1])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 13, __pyx_L1_error)
  }
  __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_4 = ((__pyx_t_3 > 1) != 0);
  if (__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_5 = (__pyx_t_4 != 0);
  __pyx_t_2 = __pyx_t_5;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "(tree fragment)":14
 *     __pyx_result.reads = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[1])             # <<<<<<<<<<<<<<
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 14, __pyx_L1_error)
    }
    __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_CoverageStrand__set_state(CoverageStrand __pyx_result, tuple __pyx_state):
 *     __pyx_result.reads = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[1])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_CoverageStrand__set_state(<CoverageStrand> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_CoverageStrand__set_state(CoverageStrand __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.reads = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 */

  /* 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_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_CoverageStrand__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_CoverageExt(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_38__pyx_unpickle_CoverageExt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_10pysamstats_3opt_37__pyx_unpickle_CoverageExt[] = "__pyx_unpickle_CoverageExt(__pyx_type, long __pyx_checksum, __pyx_state)";
static PyMethodDef __pyx_mdef_10pysamstats_3opt_38__pyx_unpickle_CoverageExt = {"__pyx_unpickle_CoverageExt", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pysamstats_3opt_38__pyx_unpickle_CoverageExt, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pysamstats_3opt_37__pyx_unpickle_CoverageExt};
static PyObject *__pyx_pw_10pysamstats_3opt_38__pyx_unpickle_CoverageExt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_CoverageExt (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,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_pyx_type)) != 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_pyx_checksum)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_CoverageExt", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_CoverageExt", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_CoverageExt") < 0)) __PYX_ERR(1, 1, __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___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_CoverageExt", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_CoverageExt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_10pysamstats_3opt_37__pyx_unpickle_CoverageExt(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

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

static PyObject *__pyx_pf_10pysamstats_3opt_37__pyx_unpickle_CoverageExt(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("__pyx_unpickle_CoverageExt", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xdc660eb:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xdc660eb = (reads_all, reads_duplicate, reads_faceaway, reads_mate_other_chr, reads_mate_same_strand, reads_mate_unmapped, reads_pp, reads_softclipped))" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xdc660eb) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xdc660eb:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xdc660eb = (reads_all, reads_duplicate, reads_faceaway, reads_mate_other_chr, reads_mate_same_strand, reads_mate_unmapped, reads_pp, reads_softclipped))" % __pyx_checksum)
 *     __pyx_result = CoverageExt.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v___pyx_PickleError = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum != 0xdc660eb:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xdc660eb = (reads_all, reads_duplicate, reads_faceaway, reads_mate_other_chr, reads_mate_same_strand, reads_mate_unmapped, reads_pp, reads_softclipped))" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = CoverageExt.__new__(__pyx_type)
 *     if __pyx_state is not None:
 */
    __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xdc, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_v___pyx_PickleError);
    __pyx_t_2 = __pyx_v___pyx_PickleError; __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_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xdc660eb:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xdc660eb = (reads_all, reads_duplicate, reads_faceaway, reads_mate_other_chr, reads_mate_same_strand, reads_mate_unmapped, reads_pp, reads_softclipped))" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xdc660eb = (reads_all, reads_duplicate, reads_faceaway, reads_mate_other_chr, reads_mate_same_strand, reads_mate_unmapped, reads_pp, reads_softclipped))" % __pyx_checksum)
 *     __pyx_result = CoverageExt.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_CoverageExt__set_state(<CoverageExt> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_10pysamstats_3opt_CoverageExt), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __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_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v___pyx_result = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xdc660eb = (reads_all, reads_duplicate, reads_faceaway, reads_mate_other_chr, reads_mate_same_strand, reads_mate_unmapped, reads_pp, reads_softclipped))" % __pyx_checksum)
 *     __pyx_result = CoverageExt.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_CoverageExt__set_state(<CoverageExt> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
  __pyx_t_6 = (__pyx_t_1 != 0);
  if (__pyx_t_6) {

    /* "(tree fragment)":9
 *     __pyx_result = CoverageExt.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_CoverageExt__set_state(<CoverageExt> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_CoverageExt__set_state(CoverageExt __pyx_result, tuple __pyx_state):
 */
    if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_10pysamstats_3opt___pyx_unpickle_CoverageExt__set_state(((struct __pyx_obj_10pysamstats_3opt_CoverageExt *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xdc660eb = (reads_all, reads_duplicate, reads_faceaway, reads_mate_other_chr, reads_mate_same_strand, reads_mate_unmapped, reads_pp, reads_softclipped))" % __pyx_checksum)
 *     __pyx_result = CoverageExt.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_CoverageExt__set_state(<CoverageExt> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_CoverageExt__set_state(<CoverageExt> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_CoverageExt__set_state(CoverageExt __pyx_result, tuple __pyx_state):
 *     __pyx_result.reads_all = __pyx_state[0]; __pyx_result.reads_duplicate = __pyx_state[1]; __pyx_result.reads_faceaway = __pyx_state[2]; __pyx_result.reads_mate_other_chr = __pyx_state[3]; __pyx_result.reads_mate_same_strand = __pyx_state[4]; __pyx_result.reads_mate_unmapped = __pyx_state[5]; __pyx_result.reads_pp = __pyx_state[6]; __pyx_result.reads_softclipped = __pyx_state[7]
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_CoverageExt(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_CoverageExt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_CoverageExt__set_state(<CoverageExt> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_CoverageExt__set_state(CoverageExt __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.reads_all = __pyx_state[0]; __pyx_result.reads_duplicate = __pyx_state[1]; __pyx_result.reads_faceaway = __pyx_state[2]; __pyx_result.reads_mate_other_chr = __pyx_state[3]; __pyx_result.reads_mate_same_strand = __pyx_state[4]; __pyx_result.reads_mate_unmapped = __pyx_state[5]; __pyx_result.reads_pp = __pyx_state[6]; __pyx_result.reads_softclipped = __pyx_state[7]
 *     if len(__pyx_state) > 8 and hasattr(__pyx_result, '__dict__'):
 */

static PyObject *__pyx_f_10pysamstats_3opt___pyx_unpickle_CoverageExt__set_state(struct __pyx_obj_10pysamstats_3opt_CoverageExt *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  Py_ssize_t __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;
  __Pyx_RefNannySetupContext("__pyx_unpickle_CoverageExt__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_CoverageExt__set_state(CoverageExt __pyx_result, tuple __pyx_state):
 *     __pyx_result.reads_all = __pyx_state[0]; __pyx_result.reads_duplicate = __pyx_state[1]; __pyx_result.reads_faceaway = __pyx_state[2]; __pyx_result.reads_mate_other_chr = __pyx_state[3]; __pyx_result.reads_mate_same_strand = __pyx_state[4]; __pyx_result.reads_mate_unmapped = __pyx_state[5]; __pyx_result.reads_pp = __pyx_state[6]; __pyx_result.reads_softclipped = __pyx_state[7]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 8 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[8])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->reads_all = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->reads_duplicate = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->reads_faceaway = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->reads_mate_other_chr = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->reads_mate_same_strand = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 5, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->reads_mate_unmapped = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 6, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->reads_pp = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 7, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->reads_softclipped = __pyx_t_2;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_CoverageExt__set_state(CoverageExt __pyx_result, tuple __pyx_state):
 *     __pyx_result.reads_all = __pyx_state[0]; __pyx_result.reads_duplicate = __pyx_state[1]; __pyx_result.reads_faceaway = __pyx_state[2]; __pyx_result.reads_mate_other_chr = __pyx_state[3]; __pyx_result.reads_mate_same_strand = __pyx_state[4]; __pyx_result.reads_mate_unmapped = __pyx_state[5]; __pyx_result.reads_pp = __pyx_state[6]; __pyx_result.reads_softclipped = __pyx_state[7]
 *     if len(__pyx_state) > 8 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[8])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 13, __pyx_L1_error)
  }
  __pyx_t_4 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_5 = ((__pyx_t_4 > 8) != 0);
  if (__pyx_t_5) {
  } else {
    __pyx_t_3 = __pyx_t_5;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_5 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_6 = (__pyx_t_5 != 0);
  __pyx_t_3 = __pyx_t_6;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_3) {

    /* "(tree fragment)":14
 *     __pyx_result.reads_all = __pyx_state[0]; __pyx_result.reads_duplicate = __pyx_state[1]; __pyx_result.reads_faceaway = __pyx_state[2]; __pyx_result.reads_mate_other_chr = __pyx_state[3]; __pyx_result.reads_mate_same_strand = __pyx_state[4]; __pyx_result.reads_mate_unmapped = __pyx_state[5]; __pyx_result.reads_pp = __pyx_state[6]; __pyx_result.reads_softclipped = __pyx_state[7]
 *     if len(__pyx_state) > 8 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[8])             # <<<<<<<<<<<<<<
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_update); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 14, __pyx_L1_error)
    }
    __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 8, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    __pyx_t_1 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_9, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_7);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_CoverageExt__set_state(CoverageExt __pyx_result, tuple __pyx_state):
 *     __pyx_result.reads_all = __pyx_state[0]; __pyx_result.reads_duplicate = __pyx_state[1]; __pyx_result.reads_faceaway = __pyx_state[2]; __pyx_result.reads_mate_other_chr = __pyx_state[3]; __pyx_result.reads_mate_same_strand = __pyx_state[4]; __pyx_result.reads_mate_unmapped = __pyx_state[5]; __pyx_result.reads_pp = __pyx_state[6]; __pyx_result.reads_softclipped = __pyx_state[7]
 *     if len(__pyx_state) > 8 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[8])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_CoverageExt__set_state(<CoverageExt> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_CoverageExt__set_state(CoverageExt __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.reads_all = __pyx_state[0]; __pyx_result.reads_duplicate = __pyx_state[1]; __pyx_result.reads_faceaway = __pyx_state[2]; __pyx_result.reads_mate_other_chr = __pyx_state[3]; __pyx_result.reads_mate_same_strand = __pyx_state[4]; __pyx_result.reads_mate_unmapped = __pyx_state[5]; __pyx_result.reads_pp = __pyx_state[6]; __pyx_result.reads_softclipped = __pyx_state[7]
 *     if len(__pyx_state) > 8 and hasattr(__pyx_result, '__dict__'):
 */

  /* 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_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_CoverageExt__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_CountStrand(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_40__pyx_unpickle_CountStrand(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_10pysamstats_3opt_39__pyx_unpickle_CountStrand[] = "__pyx_unpickle_CountStrand(__pyx_type, long __pyx_checksum, __pyx_state)";
static PyMethodDef __pyx_mdef_10pysamstats_3opt_40__pyx_unpickle_CountStrand = {"__pyx_unpickle_CountStrand", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pysamstats_3opt_40__pyx_unpickle_CountStrand, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pysamstats_3opt_39__pyx_unpickle_CountStrand};
static PyObject *__pyx_pw_10pysamstats_3opt_40__pyx_unpickle_CountStrand(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_CountStrand (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,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_pyx_type)) != 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_pyx_checksum)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_CountStrand", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_CountStrand", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_CountStrand") < 0)) __PYX_ERR(1, 1, __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___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_CountStrand", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_CountStrand", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_10pysamstats_3opt_39__pyx_unpickle_CountStrand(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

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

static PyObject *__pyx_pf_10pysamstats_3opt_39__pyx_unpickle_CountStrand(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("__pyx_unpickle_CountStrand", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x0931b2d:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x0931b2d = (all, fwd, rev))" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0x0931b2d) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x0931b2d:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x0931b2d = (all, fwd, rev))" % __pyx_checksum)
 *     __pyx_result = CountStrand.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v___pyx_PickleError = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum != 0x0931b2d:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x0931b2d = (all, fwd, rev))" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = CountStrand.__new__(__pyx_type)
 *     if __pyx_state is not None:
 */
    __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0x09, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_v___pyx_PickleError);
    __pyx_t_2 = __pyx_v___pyx_PickleError; __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_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x0931b2d:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x0931b2d = (all, fwd, rev))" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x0931b2d = (all, fwd, rev))" % __pyx_checksum)
 *     __pyx_result = CountStrand.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_CountStrand__set_state(<CountStrand> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_10pysamstats_3opt_CountStrand), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __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_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v___pyx_result = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x0931b2d = (all, fwd, rev))" % __pyx_checksum)
 *     __pyx_result = CountStrand.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_CountStrand__set_state(<CountStrand> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
  __pyx_t_6 = (__pyx_t_1 != 0);
  if (__pyx_t_6) {

    /* "(tree fragment)":9
 *     __pyx_result = CountStrand.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_CountStrand__set_state(<CountStrand> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_CountStrand__set_state(CountStrand __pyx_result, tuple __pyx_state):
 */
    if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_10pysamstats_3opt___pyx_unpickle_CountStrand__set_state(((struct __pyx_obj_10pysamstats_3opt_CountStrand *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x0931b2d = (all, fwd, rev))" % __pyx_checksum)
 *     __pyx_result = CountStrand.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_CountStrand__set_state(<CountStrand> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_CountStrand__set_state(<CountStrand> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_CountStrand__set_state(CountStrand __pyx_result, tuple __pyx_state):
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.fwd = __pyx_state[1]; __pyx_result.rev = __pyx_state[2]
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_CountStrand(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_CountStrand", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_CountStrand__set_state(<CountStrand> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_CountStrand__set_state(CountStrand __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.fwd = __pyx_state[1]; __pyx_result.rev = __pyx_state[2]
 *     if len(__pyx_state) > 3 and hasattr(__pyx_result, '__dict__'):
 */

static PyObject *__pyx_f_10pysamstats_3opt___pyx_unpickle_CountStrand__set_state(struct __pyx_obj_10pysamstats_3opt_CountStrand *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  Py_ssize_t __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;
  __Pyx_RefNannySetupContext("__pyx_unpickle_CountStrand__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_CountStrand__set_state(CountStrand __pyx_result, tuple __pyx_state):
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.fwd = __pyx_state[1]; __pyx_result.rev = __pyx_state[2]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 3 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[3])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->all = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->fwd = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->rev = __pyx_t_2;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_CountStrand__set_state(CountStrand __pyx_result, tuple __pyx_state):
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.fwd = __pyx_state[1]; __pyx_result.rev = __pyx_state[2]
 *     if len(__pyx_state) > 3 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[3])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 13, __pyx_L1_error)
  }
  __pyx_t_4 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_5 = ((__pyx_t_4 > 3) != 0);
  if (__pyx_t_5) {
  } else {
    __pyx_t_3 = __pyx_t_5;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_5 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_6 = (__pyx_t_5 != 0);
  __pyx_t_3 = __pyx_t_6;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_3) {

    /* "(tree fragment)":14
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.fwd = __pyx_state[1]; __pyx_result.rev = __pyx_state[2]
 *     if len(__pyx_state) > 3 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[3])             # <<<<<<<<<<<<<<
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_update); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 14, __pyx_L1_error)
    }
    __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    __pyx_t_1 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_9, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_7);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_CountStrand__set_state(CountStrand __pyx_result, tuple __pyx_state):
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.fwd = __pyx_state[1]; __pyx_result.rev = __pyx_state[2]
 *     if len(__pyx_state) > 3 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[3])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_CountStrand__set_state(<CountStrand> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_CountStrand__set_state(CountStrand __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.fwd = __pyx_state[1]; __pyx_result.rev = __pyx_state[2]
 *     if len(__pyx_state) > 3 and hasattr(__pyx_result, '__dict__'):
 */

  /* 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_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_CountStrand__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_CoverageExtStrand(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_42__pyx_unpickle_CoverageExtStrand(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_10pysamstats_3opt_41__pyx_unpickle_CoverageExtStrand[] = "__pyx_unpickle_CoverageExtStrand(__pyx_type, long __pyx_checksum, __pyx_state)";
static PyMethodDef __pyx_mdef_10pysamstats_3opt_42__pyx_unpickle_CoverageExtStrand = {"__pyx_unpickle_CoverageExtStrand", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pysamstats_3opt_42__pyx_unpickle_CoverageExtStrand, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pysamstats_3opt_41__pyx_unpickle_CoverageExtStrand};
static PyObject *__pyx_pw_10pysamstats_3opt_42__pyx_unpickle_CoverageExtStrand(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_CoverageExtStrand (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,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_pyx_type)) != 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_pyx_checksum)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_CoverageExtStrand", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_CoverageExtStrand", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_CoverageExtStrand") < 0)) __PYX_ERR(1, 1, __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___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_CoverageExtStrand", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_CoverageExtStrand", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_10pysamstats_3opt_41__pyx_unpickle_CoverageExtStrand(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

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

static PyObject *__pyx_pf_10pysamstats_3opt_41__pyx_unpickle_CoverageExtStrand(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("__pyx_unpickle_CoverageExtStrand", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xc0c6edb:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xc0c6edb = (all, duplicate, faceaway, mate_other_chr, mate_unmapped, pp, same_strand, softclipped))" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xc0c6edb) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xc0c6edb:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xc0c6edb = (all, duplicate, faceaway, mate_other_chr, mate_unmapped, pp, same_strand, softclipped))" % __pyx_checksum)
 *     __pyx_result = CoverageExtStrand.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v___pyx_PickleError = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum != 0xc0c6edb:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xc0c6edb = (all, duplicate, faceaway, mate_other_chr, mate_unmapped, pp, same_strand, softclipped))" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = CoverageExtStrand.__new__(__pyx_type)
 *     if __pyx_state is not None:
 */
    __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xc0, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_v___pyx_PickleError);
    __pyx_t_2 = __pyx_v___pyx_PickleError; __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_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xc0c6edb:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xc0c6edb = (all, duplicate, faceaway, mate_other_chr, mate_unmapped, pp, same_strand, softclipped))" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xc0c6edb = (all, duplicate, faceaway, mate_other_chr, mate_unmapped, pp, same_strand, softclipped))" % __pyx_checksum)
 *     __pyx_result = CoverageExtStrand.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_CoverageExtStrand__set_state(<CoverageExtStrand> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_10pysamstats_3opt_CoverageExtStrand), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __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_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v___pyx_result = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xc0c6edb = (all, duplicate, faceaway, mate_other_chr, mate_unmapped, pp, same_strand, softclipped))" % __pyx_checksum)
 *     __pyx_result = CoverageExtStrand.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_CoverageExtStrand__set_state(<CoverageExtStrand> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
  __pyx_t_6 = (__pyx_t_1 != 0);
  if (__pyx_t_6) {

    /* "(tree fragment)":9
 *     __pyx_result = CoverageExtStrand.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_CoverageExtStrand__set_state(<CoverageExtStrand> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_CoverageExtStrand__set_state(CoverageExtStrand __pyx_result, tuple __pyx_state):
 */
    if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_10pysamstats_3opt___pyx_unpickle_CoverageExtStrand__set_state(((struct __pyx_obj_10pysamstats_3opt_CoverageExtStrand *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xc0c6edb = (all, duplicate, faceaway, mate_other_chr, mate_unmapped, pp, same_strand, softclipped))" % __pyx_checksum)
 *     __pyx_result = CoverageExtStrand.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_CoverageExtStrand__set_state(<CoverageExtStrand> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_CoverageExtStrand__set_state(<CoverageExtStrand> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_CoverageExtStrand__set_state(CoverageExtStrand __pyx_result, tuple __pyx_state):
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.duplicate = __pyx_state[1]; __pyx_result.faceaway = __pyx_state[2]; __pyx_result.mate_other_chr = __pyx_state[3]; __pyx_result.mate_unmapped = __pyx_state[4]; __pyx_result.pp = __pyx_state[5]; __pyx_result.same_strand = __pyx_state[6]; __pyx_result.softclipped = __pyx_state[7]
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_CoverageExtStrand(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_CoverageExtStrand", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_CoverageExtStrand__set_state(<CoverageExtStrand> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_CoverageExtStrand__set_state(CoverageExtStrand __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.duplicate = __pyx_state[1]; __pyx_result.faceaway = __pyx_state[2]; __pyx_result.mate_other_chr = __pyx_state[3]; __pyx_result.mate_unmapped = __pyx_state[4]; __pyx_result.pp = __pyx_state[5]; __pyx_result.same_strand = __pyx_state[6]; __pyx_result.softclipped = __pyx_state[7]
 *     if len(__pyx_state) > 8 and hasattr(__pyx_result, '__dict__'):
 */

static PyObject *__pyx_f_10pysamstats_3opt___pyx_unpickle_CoverageExtStrand__set_state(struct __pyx_obj_10pysamstats_3opt_CoverageExtStrand *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("__pyx_unpickle_CoverageExtStrand__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_CoverageExtStrand__set_state(CoverageExtStrand __pyx_result, tuple __pyx_state):
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.duplicate = __pyx_state[1]; __pyx_result.faceaway = __pyx_state[2]; __pyx_result.mate_other_chr = __pyx_state[3]; __pyx_result.mate_unmapped = __pyx_state[4]; __pyx_result.pp = __pyx_state[5]; __pyx_result.same_strand = __pyx_state[6]; __pyx_result.softclipped = __pyx_state[7]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 8 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[8])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_CountStrand))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->all);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->all));
  __pyx_v___pyx_result->all = ((struct __pyx_obj_10pysamstats_3opt_CountStrand *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_CountStrand))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->duplicate);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->duplicate));
  __pyx_v___pyx_result->duplicate = ((struct __pyx_obj_10pysamstats_3opt_CountStrand *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_CountStrand))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->faceaway);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->faceaway));
  __pyx_v___pyx_result->faceaway = ((struct __pyx_obj_10pysamstats_3opt_CountStrand *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_CountStrand))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->mate_other_chr);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->mate_other_chr));
  __pyx_v___pyx_result->mate_other_chr = ((struct __pyx_obj_10pysamstats_3opt_CountStrand *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_CountStrand))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->mate_unmapped);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->mate_unmapped));
  __pyx_v___pyx_result->mate_unmapped = ((struct __pyx_obj_10pysamstats_3opt_CountStrand *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 5, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_CountStrand))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->pp);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->pp));
  __pyx_v___pyx_result->pp = ((struct __pyx_obj_10pysamstats_3opt_CountStrand *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 6, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_CountStrand))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->same_strand);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->same_strand));
  __pyx_v___pyx_result->same_strand = ((struct __pyx_obj_10pysamstats_3opt_CountStrand *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 7, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_CountStrand))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->softclipped);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->softclipped));
  __pyx_v___pyx_result->softclipped = ((struct __pyx_obj_10pysamstats_3opt_CountStrand *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_CoverageExtStrand__set_state(CoverageExtStrand __pyx_result, tuple __pyx_state):
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.duplicate = __pyx_state[1]; __pyx_result.faceaway = __pyx_state[2]; __pyx_result.mate_other_chr = __pyx_state[3]; __pyx_result.mate_unmapped = __pyx_state[4]; __pyx_result.pp = __pyx_state[5]; __pyx_result.same_strand = __pyx_state[6]; __pyx_result.softclipped = __pyx_state[7]
 *     if len(__pyx_state) > 8 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[8])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 13, __pyx_L1_error)
  }
  __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_4 = ((__pyx_t_3 > 8) != 0);
  if (__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_5 = (__pyx_t_4 != 0);
  __pyx_t_2 = __pyx_t_5;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "(tree fragment)":14
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.duplicate = __pyx_state[1]; __pyx_result.faceaway = __pyx_state[2]; __pyx_result.mate_other_chr = __pyx_state[3]; __pyx_result.mate_unmapped = __pyx_state[4]; __pyx_result.pp = __pyx_state[5]; __pyx_result.same_strand = __pyx_state[6]; __pyx_result.softclipped = __pyx_state[7]
 *     if len(__pyx_state) > 8 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[8])             # <<<<<<<<<<<<<<
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 14, __pyx_L1_error)
    }
    __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 8, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_CoverageExtStrand__set_state(CoverageExtStrand __pyx_result, tuple __pyx_state):
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.duplicate = __pyx_state[1]; __pyx_result.faceaway = __pyx_state[2]; __pyx_result.mate_other_chr = __pyx_state[3]; __pyx_result.mate_unmapped = __pyx_state[4]; __pyx_result.pp = __pyx_state[5]; __pyx_result.same_strand = __pyx_state[6]; __pyx_result.softclipped = __pyx_state[7]
 *     if len(__pyx_state) > 8 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[8])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_CoverageExtStrand__set_state(<CoverageExtStrand> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_CoverageExtStrand__set_state(CoverageExtStrand __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.duplicate = __pyx_state[1]; __pyx_result.faceaway = __pyx_state[2]; __pyx_result.mate_other_chr = __pyx_state[3]; __pyx_result.mate_unmapped = __pyx_state[4]; __pyx_result.pp = __pyx_state[5]; __pyx_result.same_strand = __pyx_state[6]; __pyx_result.softclipped = __pyx_state[7]
 *     if len(__pyx_state) > 8 and hasattr(__pyx_result, '__dict__'):
 */

  /* 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_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_CoverageExtStrand__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_Variation(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_44__pyx_unpickle_Variation(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_10pysamstats_3opt_43__pyx_unpickle_Variation[] = "__pyx_unpickle_Variation(__pyx_type, long __pyx_checksum, __pyx_state)";
static PyMethodDef __pyx_mdef_10pysamstats_3opt_44__pyx_unpickle_Variation = {"__pyx_unpickle_Variation", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pysamstats_3opt_44__pyx_unpickle_Variation, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pysamstats_3opt_43__pyx_unpickle_Variation};
static PyObject *__pyx_pw_10pysamstats_3opt_44__pyx_unpickle_Variation(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_Variation (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,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_pyx_type)) != 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_pyx_checksum)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Variation", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Variation", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_Variation") < 0)) __PYX_ERR(1, 1, __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___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Variation", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_Variation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_10pysamstats_3opt_43__pyx_unpickle_Variation(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

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

static PyObject *__pyx_pf_10pysamstats_3opt_43__pyx_unpickle_Variation(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("__pyx_unpickle_Variation", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x5c4b584:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x5c4b584 = (A, C, G, N, T, deletions, insertions, matches, mismatches, reads))" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0x5c4b584) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x5c4b584:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x5c4b584 = (A, C, G, N, T, deletions, insertions, matches, mismatches, reads))" % __pyx_checksum)
 *     __pyx_result = Variation.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v___pyx_PickleError = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum != 0x5c4b584:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x5c4b584 = (A, C, G, N, T, deletions, insertions, matches, mismatches, reads))" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = Variation.__new__(__pyx_type)
 *     if __pyx_state is not None:
 */
    __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0x5c, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_v___pyx_PickleError);
    __pyx_t_2 = __pyx_v___pyx_PickleError; __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_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x5c4b584:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x5c4b584 = (A, C, G, N, T, deletions, insertions, matches, mismatches, reads))" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x5c4b584 = (A, C, G, N, T, deletions, insertions, matches, mismatches, reads))" % __pyx_checksum)
 *     __pyx_result = Variation.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_Variation__set_state(<Variation> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_10pysamstats_3opt_Variation), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __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_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v___pyx_result = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x5c4b584 = (A, C, G, N, T, deletions, insertions, matches, mismatches, reads))" % __pyx_checksum)
 *     __pyx_result = Variation.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_Variation__set_state(<Variation> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
  __pyx_t_6 = (__pyx_t_1 != 0);
  if (__pyx_t_6) {

    /* "(tree fragment)":9
 *     __pyx_result = Variation.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_Variation__set_state(<Variation> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_Variation__set_state(Variation __pyx_result, tuple __pyx_state):
 */
    if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_10pysamstats_3opt___pyx_unpickle_Variation__set_state(((struct __pyx_obj_10pysamstats_3opt_Variation *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x5c4b584 = (A, C, G, N, T, deletions, insertions, matches, mismatches, reads))" % __pyx_checksum)
 *     __pyx_result = Variation.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_Variation__set_state(<Variation> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_Variation__set_state(<Variation> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_Variation__set_state(Variation __pyx_result, tuple __pyx_state):
 *     __pyx_result.A = __pyx_state[0]; __pyx_result.C = __pyx_state[1]; __pyx_result.G = __pyx_state[2]; __pyx_result.N = __pyx_state[3]; __pyx_result.T = __pyx_state[4]; __pyx_result.deletions = __pyx_state[5]; __pyx_result.insertions = __pyx_state[6]; __pyx_result.matches = __pyx_state[7]; __pyx_result.mismatches = __pyx_state[8]; __pyx_result.reads = __pyx_state[9]
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_Variation(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_Variation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_Variation__set_state(<Variation> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_Variation__set_state(Variation __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.A = __pyx_state[0]; __pyx_result.C = __pyx_state[1]; __pyx_result.G = __pyx_state[2]; __pyx_result.N = __pyx_state[3]; __pyx_result.T = __pyx_state[4]; __pyx_result.deletions = __pyx_state[5]; __pyx_result.insertions = __pyx_state[6]; __pyx_result.matches = __pyx_state[7]; __pyx_result.mismatches = __pyx_state[8]; __pyx_result.reads = __pyx_state[9]
 *     if len(__pyx_state) > 10 and hasattr(__pyx_result, '__dict__'):
 */

static PyObject *__pyx_f_10pysamstats_3opt___pyx_unpickle_Variation__set_state(struct __pyx_obj_10pysamstats_3opt_Variation *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("__pyx_unpickle_Variation__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_Variation__set_state(Variation __pyx_result, tuple __pyx_state):
 *     __pyx_result.A = __pyx_state[0]; __pyx_result.C = __pyx_state[1]; __pyx_result.G = __pyx_state[2]; __pyx_result.N = __pyx_state[3]; __pyx_result.T = __pyx_state[4]; __pyx_result.deletions = __pyx_state[5]; __pyx_result.insertions = __pyx_state[6]; __pyx_result.matches = __pyx_state[7]; __pyx_result.mismatches = __pyx_state[8]; __pyx_result.reads = __pyx_state[9]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 10 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[10])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_CountPp))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->A);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->A));
  __pyx_v___pyx_result->A = ((struct __pyx_obj_10pysamstats_3opt_CountPp *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_CountPp))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->C);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->C));
  __pyx_v___pyx_result->C = ((struct __pyx_obj_10pysamstats_3opt_CountPp *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_CountPp))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->G);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->G));
  __pyx_v___pyx_result->G = ((struct __pyx_obj_10pysamstats_3opt_CountPp *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_CountPp))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->N);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->N));
  __pyx_v___pyx_result->N = ((struct __pyx_obj_10pysamstats_3opt_CountPp *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_CountPp))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->T);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->T));
  __pyx_v___pyx_result->T = ((struct __pyx_obj_10pysamstats_3opt_CountPp *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 5, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_CountPp))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->deletions);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->deletions));
  __pyx_v___pyx_result->deletions = ((struct __pyx_obj_10pysamstats_3opt_CountPp *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 6, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_CountPp))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->insertions);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->insertions));
  __pyx_v___pyx_result->insertions = ((struct __pyx_obj_10pysamstats_3opt_CountPp *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 7, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_CountPp))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->matches);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->matches));
  __pyx_v___pyx_result->matches = ((struct __pyx_obj_10pysamstats_3opt_CountPp *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 8, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_CountPp))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->mismatches);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->mismatches));
  __pyx_v___pyx_result->mismatches = ((struct __pyx_obj_10pysamstats_3opt_CountPp *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 9, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_CountPp))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->reads);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->reads));
  __pyx_v___pyx_result->reads = ((struct __pyx_obj_10pysamstats_3opt_CountPp *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_Variation__set_state(Variation __pyx_result, tuple __pyx_state):
 *     __pyx_result.A = __pyx_state[0]; __pyx_result.C = __pyx_state[1]; __pyx_result.G = __pyx_state[2]; __pyx_result.N = __pyx_state[3]; __pyx_result.T = __pyx_state[4]; __pyx_result.deletions = __pyx_state[5]; __pyx_result.insertions = __pyx_state[6]; __pyx_result.matches = __pyx_state[7]; __pyx_result.mismatches = __pyx_state[8]; __pyx_result.reads = __pyx_state[9]
 *     if len(__pyx_state) > 10 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[10])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 13, __pyx_L1_error)
  }
  __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_4 = ((__pyx_t_3 > 10) != 0);
  if (__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_5 = (__pyx_t_4 != 0);
  __pyx_t_2 = __pyx_t_5;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "(tree fragment)":14
 *     __pyx_result.A = __pyx_state[0]; __pyx_result.C = __pyx_state[1]; __pyx_result.G = __pyx_state[2]; __pyx_result.N = __pyx_state[3]; __pyx_result.T = __pyx_state[4]; __pyx_result.deletions = __pyx_state[5]; __pyx_result.insertions = __pyx_state[6]; __pyx_result.matches = __pyx_state[7]; __pyx_result.mismatches = __pyx_state[8]; __pyx_result.reads = __pyx_state[9]
 *     if len(__pyx_state) > 10 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[10])             # <<<<<<<<<<<<<<
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 14, __pyx_L1_error)
    }
    __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 10, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_Variation__set_state(Variation __pyx_result, tuple __pyx_state):
 *     __pyx_result.A = __pyx_state[0]; __pyx_result.C = __pyx_state[1]; __pyx_result.G = __pyx_state[2]; __pyx_result.N = __pyx_state[3]; __pyx_result.T = __pyx_state[4]; __pyx_result.deletions = __pyx_state[5]; __pyx_result.insertions = __pyx_state[6]; __pyx_result.matches = __pyx_state[7]; __pyx_result.mismatches = __pyx_state[8]; __pyx_result.reads = __pyx_state[9]
 *     if len(__pyx_state) > 10 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[10])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_Variation__set_state(<Variation> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_Variation__set_state(Variation __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.A = __pyx_state[0]; __pyx_result.C = __pyx_state[1]; __pyx_result.G = __pyx_state[2]; __pyx_result.N = __pyx_state[3]; __pyx_result.T = __pyx_state[4]; __pyx_result.deletions = __pyx_state[5]; __pyx_result.insertions = __pyx_state[6]; __pyx_result.matches = __pyx_state[7]; __pyx_result.mismatches = __pyx_state[8]; __pyx_result.reads = __pyx_state[9]
 *     if len(__pyx_state) > 10 and hasattr(__pyx_result, '__dict__'):
 */

  /* 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_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_Variation__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_VariationStrand(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_46__pyx_unpickle_VariationStrand(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_10pysamstats_3opt_45__pyx_unpickle_VariationStrand[] = "__pyx_unpickle_VariationStrand(__pyx_type, long __pyx_checksum, __pyx_state)";
static PyMethodDef __pyx_mdef_10pysamstats_3opt_46__pyx_unpickle_VariationStrand = {"__pyx_unpickle_VariationStrand", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pysamstats_3opt_46__pyx_unpickle_VariationStrand, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pysamstats_3opt_45__pyx_unpickle_VariationStrand};
static PyObject *__pyx_pw_10pysamstats_3opt_46__pyx_unpickle_VariationStrand(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_VariationStrand (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,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_pyx_type)) != 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_pyx_checksum)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_VariationStrand", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_VariationStrand", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_VariationStrand") < 0)) __PYX_ERR(1, 1, __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___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_VariationStrand", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_VariationStrand", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_10pysamstats_3opt_45__pyx_unpickle_VariationStrand(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

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

static PyObject *__pyx_pf_10pysamstats_3opt_45__pyx_unpickle_VariationStrand(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("__pyx_unpickle_VariationStrand", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x5c4b584:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x5c4b584 = (A, C, G, N, T, deletions, insertions, matches, mismatches, reads))" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0x5c4b584) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x5c4b584:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x5c4b584 = (A, C, G, N, T, deletions, insertions, matches, mismatches, reads))" % __pyx_checksum)
 *     __pyx_result = VariationStrand.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v___pyx_PickleError = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum != 0x5c4b584:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x5c4b584 = (A, C, G, N, T, deletions, insertions, matches, mismatches, reads))" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = VariationStrand.__new__(__pyx_type)
 *     if __pyx_state is not None:
 */
    __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0x5c, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_v___pyx_PickleError);
    __pyx_t_2 = __pyx_v___pyx_PickleError; __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_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x5c4b584:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x5c4b584 = (A, C, G, N, T, deletions, insertions, matches, mismatches, reads))" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x5c4b584 = (A, C, G, N, T, deletions, insertions, matches, mismatches, reads))" % __pyx_checksum)
 *     __pyx_result = VariationStrand.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_VariationStrand__set_state(<VariationStrand> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_10pysamstats_3opt_VariationStrand), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __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_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v___pyx_result = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x5c4b584 = (A, C, G, N, T, deletions, insertions, matches, mismatches, reads))" % __pyx_checksum)
 *     __pyx_result = VariationStrand.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_VariationStrand__set_state(<VariationStrand> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
  __pyx_t_6 = (__pyx_t_1 != 0);
  if (__pyx_t_6) {

    /* "(tree fragment)":9
 *     __pyx_result = VariationStrand.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_VariationStrand__set_state(<VariationStrand> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_VariationStrand__set_state(VariationStrand __pyx_result, tuple __pyx_state):
 */
    if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_10pysamstats_3opt___pyx_unpickle_VariationStrand__set_state(((struct __pyx_obj_10pysamstats_3opt_VariationStrand *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x5c4b584 = (A, C, G, N, T, deletions, insertions, matches, mismatches, reads))" % __pyx_checksum)
 *     __pyx_result = VariationStrand.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_VariationStrand__set_state(<VariationStrand> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_VariationStrand__set_state(<VariationStrand> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_VariationStrand__set_state(VariationStrand __pyx_result, tuple __pyx_state):
 *     __pyx_result.A = __pyx_state[0]; __pyx_result.C = __pyx_state[1]; __pyx_result.G = __pyx_state[2]; __pyx_result.N = __pyx_state[3]; __pyx_result.T = __pyx_state[4]; __pyx_result.deletions = __pyx_state[5]; __pyx_result.insertions = __pyx_state[6]; __pyx_result.matches = __pyx_state[7]; __pyx_result.mismatches = __pyx_state[8]; __pyx_result.reads = __pyx_state[9]
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_VariationStrand(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_VariationStrand", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_VariationStrand__set_state(<VariationStrand> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_VariationStrand__set_state(VariationStrand __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.A = __pyx_state[0]; __pyx_result.C = __pyx_state[1]; __pyx_result.G = __pyx_state[2]; __pyx_result.N = __pyx_state[3]; __pyx_result.T = __pyx_state[4]; __pyx_result.deletions = __pyx_state[5]; __pyx_result.insertions = __pyx_state[6]; __pyx_result.matches = __pyx_state[7]; __pyx_result.mismatches = __pyx_state[8]; __pyx_result.reads = __pyx_state[9]
 *     if len(__pyx_state) > 10 and hasattr(__pyx_result, '__dict__'):
 */

static PyObject *__pyx_f_10pysamstats_3opt___pyx_unpickle_VariationStrand__set_state(struct __pyx_obj_10pysamstats_3opt_VariationStrand *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("__pyx_unpickle_VariationStrand__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_VariationStrand__set_state(VariationStrand __pyx_result, tuple __pyx_state):
 *     __pyx_result.A = __pyx_state[0]; __pyx_result.C = __pyx_state[1]; __pyx_result.G = __pyx_state[2]; __pyx_result.N = __pyx_state[3]; __pyx_result.T = __pyx_state[4]; __pyx_result.deletions = __pyx_state[5]; __pyx_result.insertions = __pyx_state[6]; __pyx_result.matches = __pyx_state[7]; __pyx_result.mismatches = __pyx_state[8]; __pyx_result.reads = __pyx_state[9]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 10 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[10])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_CountPpStrand))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->A);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->A));
  __pyx_v___pyx_result->A = ((struct __pyx_obj_10pysamstats_3opt_CountPpStrand *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_CountPpStrand))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->C);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->C));
  __pyx_v___pyx_result->C = ((struct __pyx_obj_10pysamstats_3opt_CountPpStrand *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_CountPpStrand))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->G);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->G));
  __pyx_v___pyx_result->G = ((struct __pyx_obj_10pysamstats_3opt_CountPpStrand *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_CountPpStrand))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->N);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->N));
  __pyx_v___pyx_result->N = ((struct __pyx_obj_10pysamstats_3opt_CountPpStrand *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_CountPpStrand))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->T);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->T));
  __pyx_v___pyx_result->T = ((struct __pyx_obj_10pysamstats_3opt_CountPpStrand *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 5, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_CountPpStrand))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->deletions);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->deletions));
  __pyx_v___pyx_result->deletions = ((struct __pyx_obj_10pysamstats_3opt_CountPpStrand *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 6, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_CountPpStrand))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->insertions);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->insertions));
  __pyx_v___pyx_result->insertions = ((struct __pyx_obj_10pysamstats_3opt_CountPpStrand *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 7, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_CountPpStrand))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->matches);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->matches));
  __pyx_v___pyx_result->matches = ((struct __pyx_obj_10pysamstats_3opt_CountPpStrand *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 8, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_CountPpStrand))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->mismatches);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->mismatches));
  __pyx_v___pyx_result->mismatches = ((struct __pyx_obj_10pysamstats_3opt_CountPpStrand *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 9, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_CountPpStrand))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->reads);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->reads));
  __pyx_v___pyx_result->reads = ((struct __pyx_obj_10pysamstats_3opt_CountPpStrand *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_VariationStrand__set_state(VariationStrand __pyx_result, tuple __pyx_state):
 *     __pyx_result.A = __pyx_state[0]; __pyx_result.C = __pyx_state[1]; __pyx_result.G = __pyx_state[2]; __pyx_result.N = __pyx_state[3]; __pyx_result.T = __pyx_state[4]; __pyx_result.deletions = __pyx_state[5]; __pyx_result.insertions = __pyx_state[6]; __pyx_result.matches = __pyx_state[7]; __pyx_result.mismatches = __pyx_state[8]; __pyx_result.reads = __pyx_state[9]
 *     if len(__pyx_state) > 10 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[10])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 13, __pyx_L1_error)
  }
  __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_4 = ((__pyx_t_3 > 10) != 0);
  if (__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_5 = (__pyx_t_4 != 0);
  __pyx_t_2 = __pyx_t_5;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "(tree fragment)":14
 *     __pyx_result.A = __pyx_state[0]; __pyx_result.C = __pyx_state[1]; __pyx_result.G = __pyx_state[2]; __pyx_result.N = __pyx_state[3]; __pyx_result.T = __pyx_state[4]; __pyx_result.deletions = __pyx_state[5]; __pyx_result.insertions = __pyx_state[6]; __pyx_result.matches = __pyx_state[7]; __pyx_result.mismatches = __pyx_state[8]; __pyx_result.reads = __pyx_state[9]
 *     if len(__pyx_state) > 10 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[10])             # <<<<<<<<<<<<<<
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 14, __pyx_L1_error)
    }
    __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 10, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_VariationStrand__set_state(VariationStrand __pyx_result, tuple __pyx_state):
 *     __pyx_result.A = __pyx_state[0]; __pyx_result.C = __pyx_state[1]; __pyx_result.G = __pyx_state[2]; __pyx_result.N = __pyx_state[3]; __pyx_result.T = __pyx_state[4]; __pyx_result.deletions = __pyx_state[5]; __pyx_result.insertions = __pyx_state[6]; __pyx_result.matches = __pyx_state[7]; __pyx_result.mismatches = __pyx_state[8]; __pyx_result.reads = __pyx_state[9]
 *     if len(__pyx_state) > 10 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[10])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_VariationStrand__set_state(<VariationStrand> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_VariationStrand__set_state(VariationStrand __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.A = __pyx_state[0]; __pyx_result.C = __pyx_state[1]; __pyx_result.G = __pyx_state[2]; __pyx_result.N = __pyx_state[3]; __pyx_result.T = __pyx_state[4]; __pyx_result.deletions = __pyx_state[5]; __pyx_result.insertions = __pyx_state[6]; __pyx_result.matches = __pyx_state[7]; __pyx_result.mismatches = __pyx_state[8]; __pyx_result.reads = __pyx_state[9]
 *     if len(__pyx_state) > 10 and hasattr(__pyx_result, '__dict__'):
 */

  /* 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_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_VariationStrand__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_TlenHelper(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_48__pyx_unpickle_TlenHelper(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_10pysamstats_3opt_47__pyx_unpickle_TlenHelper[] = "__pyx_unpickle_TlenHelper(__pyx_type, long __pyx_checksum, __pyx_state)";
static PyMethodDef __pyx_mdef_10pysamstats_3opt_48__pyx_unpickle_TlenHelper = {"__pyx_unpickle_TlenHelper", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pysamstats_3opt_48__pyx_unpickle_TlenHelper, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pysamstats_3opt_47__pyx_unpickle_TlenHelper};
static PyObject *__pyx_pw_10pysamstats_3opt_48__pyx_unpickle_TlenHelper(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_TlenHelper (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,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_pyx_type)) != 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_pyx_checksum)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_TlenHelper", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_TlenHelper", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_TlenHelper") < 0)) __PYX_ERR(1, 1, __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___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_TlenHelper", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_TlenHelper", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_10pysamstats_3opt_47__pyx_unpickle_TlenHelper(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

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

static PyObject *__pyx_pf_10pysamstats_3opt_47__pyx_unpickle_TlenHelper(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("__pyx_unpickle_TlenHelper", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x2efd474:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x2efd474 = (d, d2, m, m2, n, s, sq))" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0x2efd474) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x2efd474:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x2efd474 = (d, d2, m, m2, n, s, sq))" % __pyx_checksum)
 *     __pyx_result = TlenHelper.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v___pyx_PickleError = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum != 0x2efd474:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x2efd474 = (d, d2, m, m2, n, s, sq))" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = TlenHelper.__new__(__pyx_type)
 *     if __pyx_state is not None:
 */
    __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0x2e, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_v___pyx_PickleError);
    __pyx_t_2 = __pyx_v___pyx_PickleError; __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_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x2efd474:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x2efd474 = (d, d2, m, m2, n, s, sq))" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x2efd474 = (d, d2, m, m2, n, s, sq))" % __pyx_checksum)
 *     __pyx_result = TlenHelper.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_TlenHelper__set_state(<TlenHelper> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_10pysamstats_3opt_TlenHelper), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __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_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v___pyx_result = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x2efd474 = (d, d2, m, m2, n, s, sq))" % __pyx_checksum)
 *     __pyx_result = TlenHelper.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_TlenHelper__set_state(<TlenHelper> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
  __pyx_t_6 = (__pyx_t_1 != 0);
  if (__pyx_t_6) {

    /* "(tree fragment)":9
 *     __pyx_result = TlenHelper.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_TlenHelper__set_state(<TlenHelper> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_TlenHelper__set_state(TlenHelper __pyx_result, tuple __pyx_state):
 */
    if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_10pysamstats_3opt___pyx_unpickle_TlenHelper__set_state(((struct __pyx_obj_10pysamstats_3opt_TlenHelper *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x2efd474 = (d, d2, m, m2, n, s, sq))" % __pyx_checksum)
 *     __pyx_result = TlenHelper.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_TlenHelper__set_state(<TlenHelper> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_TlenHelper__set_state(<TlenHelper> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_TlenHelper__set_state(TlenHelper __pyx_result, tuple __pyx_state):
 *     __pyx_result.d = __pyx_state[0]; __pyx_result.d2 = __pyx_state[1]; __pyx_result.m = __pyx_state[2]; __pyx_result.m2 = __pyx_state[3]; __pyx_result.n = __pyx_state[4]; __pyx_result.s = __pyx_state[5]; __pyx_result.sq = __pyx_state[6]
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_TlenHelper(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_TlenHelper", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_TlenHelper__set_state(<TlenHelper> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_TlenHelper__set_state(TlenHelper __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.d = __pyx_state[0]; __pyx_result.d2 = __pyx_state[1]; __pyx_result.m = __pyx_state[2]; __pyx_result.m2 = __pyx_state[3]; __pyx_result.n = __pyx_state[4]; __pyx_result.s = __pyx_state[5]; __pyx_result.sq = __pyx_state[6]
 *     if len(__pyx_state) > 7 and hasattr(__pyx_result, '__dict__'):
 */

static PyObject *__pyx_f_10pysamstats_3opt___pyx_unpickle_TlenHelper__set_state(struct __pyx_obj_10pysamstats_3opt_TlenHelper *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  double __pyx_t_2;
  long __pyx_t_3;
  int64_t __pyx_t_4;
  int __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  __Pyx_RefNannySetupContext("__pyx_unpickle_TlenHelper__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_TlenHelper__set_state(TlenHelper __pyx_result, tuple __pyx_state):
 *     __pyx_result.d = __pyx_state[0]; __pyx_result.d2 = __pyx_state[1]; __pyx_result.m = __pyx_state[2]; __pyx_result.m2 = __pyx_state[3]; __pyx_result.n = __pyx_state[4]; __pyx_result.s = __pyx_state[5]; __pyx_result.sq = __pyx_state[6]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 7 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[7])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->d = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->d2 = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->m = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->m2 = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyInt_As_long(__pyx_t_1); if (unlikely((__pyx_t_3 == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->n = __pyx_t_3;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 5, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyInt_As_int64_t(__pyx_t_1); if (unlikely((__pyx_t_4 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->s = __pyx_t_4;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 6, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyInt_As_int64_t(__pyx_t_1); if (unlikely((__pyx_t_4 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->sq = __pyx_t_4;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_TlenHelper__set_state(TlenHelper __pyx_result, tuple __pyx_state):
 *     __pyx_result.d = __pyx_state[0]; __pyx_result.d2 = __pyx_state[1]; __pyx_result.m = __pyx_state[2]; __pyx_result.m2 = __pyx_state[3]; __pyx_result.n = __pyx_state[4]; __pyx_result.s = __pyx_state[5]; __pyx_result.sq = __pyx_state[6]
 *     if len(__pyx_state) > 7 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[7])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 13, __pyx_L1_error)
  }
  __pyx_t_6 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_7 = ((__pyx_t_6 > 7) != 0);
  if (__pyx_t_7) {
  } else {
    __pyx_t_5 = __pyx_t_7;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_7 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_8 = (__pyx_t_7 != 0);
  __pyx_t_5 = __pyx_t_8;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_5) {

    /* "(tree fragment)":14
 *     __pyx_result.d = __pyx_state[0]; __pyx_result.d2 = __pyx_state[1]; __pyx_result.m = __pyx_state[2]; __pyx_result.m2 = __pyx_state[3]; __pyx_result.n = __pyx_state[4]; __pyx_result.s = __pyx_state[5]; __pyx_result.sq = __pyx_state[6]
 *     if len(__pyx_state) > 7 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[7])             # <<<<<<<<<<<<<<
 */
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_update); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 14, __pyx_L1_error)
    }
    __pyx_t_9 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 7, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_11 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
      __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_10);
      if (likely(__pyx_t_11)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
        __Pyx_INCREF(__pyx_t_11);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_10, function);
      }
    }
    __pyx_t_1 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_11, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_9);
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_TlenHelper__set_state(TlenHelper __pyx_result, tuple __pyx_state):
 *     __pyx_result.d = __pyx_state[0]; __pyx_result.d2 = __pyx_state[1]; __pyx_result.m = __pyx_state[2]; __pyx_result.m2 = __pyx_state[3]; __pyx_result.n = __pyx_state[4]; __pyx_result.s = __pyx_state[5]; __pyx_result.sq = __pyx_state[6]
 *     if len(__pyx_state) > 7 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[7])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_TlenHelper__set_state(<TlenHelper> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_TlenHelper__set_state(TlenHelper __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.d = __pyx_state[0]; __pyx_result.d2 = __pyx_state[1]; __pyx_result.m = __pyx_state[2]; __pyx_result.m2 = __pyx_state[3]; __pyx_result.n = __pyx_state[4]; __pyx_result.s = __pyx_state[5]; __pyx_result.sq = __pyx_state[6]
 *     if len(__pyx_state) > 7 and hasattr(__pyx_result, '__dict__'):
 */

  /* 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_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_TlenHelper__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_Tlen(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_50__pyx_unpickle_Tlen(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_10pysamstats_3opt_49__pyx_unpickle_Tlen[] = "__pyx_unpickle_Tlen(__pyx_type, long __pyx_checksum, __pyx_state)";
static PyMethodDef __pyx_mdef_10pysamstats_3opt_50__pyx_unpickle_Tlen = {"__pyx_unpickle_Tlen", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pysamstats_3opt_50__pyx_unpickle_Tlen, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pysamstats_3opt_49__pyx_unpickle_Tlen};
static PyObject *__pyx_pw_10pysamstats_3opt_50__pyx_unpickle_Tlen(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_Tlen (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,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_pyx_type)) != 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_pyx_checksum)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Tlen", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Tlen", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_Tlen") < 0)) __PYX_ERR(1, 1, __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___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Tlen", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_Tlen", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_10pysamstats_3opt_49__pyx_unpickle_Tlen(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

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

static PyObject *__pyx_pf_10pysamstats_3opt_49__pyx_unpickle_Tlen(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("__pyx_unpickle_Tlen", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x2c18efa:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x2c18efa = (reads_all, tlen, tlen_pp))" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0x2c18efa) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x2c18efa:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x2c18efa = (reads_all, tlen, tlen_pp))" % __pyx_checksum)
 *     __pyx_result = Tlen.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v___pyx_PickleError = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum != 0x2c18efa:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x2c18efa = (reads_all, tlen, tlen_pp))" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = Tlen.__new__(__pyx_type)
 *     if __pyx_state is not None:
 */
    __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0x2c, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_v___pyx_PickleError);
    __pyx_t_2 = __pyx_v___pyx_PickleError; __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_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x2c18efa:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x2c18efa = (reads_all, tlen, tlen_pp))" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x2c18efa = (reads_all, tlen, tlen_pp))" % __pyx_checksum)
 *     __pyx_result = Tlen.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_Tlen__set_state(<Tlen> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_10pysamstats_3opt_Tlen), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __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_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v___pyx_result = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x2c18efa = (reads_all, tlen, tlen_pp))" % __pyx_checksum)
 *     __pyx_result = Tlen.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_Tlen__set_state(<Tlen> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
  __pyx_t_6 = (__pyx_t_1 != 0);
  if (__pyx_t_6) {

    /* "(tree fragment)":9
 *     __pyx_result = Tlen.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_Tlen__set_state(<Tlen> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_Tlen__set_state(Tlen __pyx_result, tuple __pyx_state):
 */
    if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_10pysamstats_3opt___pyx_unpickle_Tlen__set_state(((struct __pyx_obj_10pysamstats_3opt_Tlen *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x2c18efa = (reads_all, tlen, tlen_pp))" % __pyx_checksum)
 *     __pyx_result = Tlen.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_Tlen__set_state(<Tlen> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_Tlen__set_state(<Tlen> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_Tlen__set_state(Tlen __pyx_result, tuple __pyx_state):
 *     __pyx_result.reads_all = __pyx_state[0]; __pyx_result.tlen = __pyx_state[1]; __pyx_result.tlen_pp = __pyx_state[2]
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_Tlen(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_Tlen", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_Tlen__set_state(<Tlen> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_Tlen__set_state(Tlen __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.reads_all = __pyx_state[0]; __pyx_result.tlen = __pyx_state[1]; __pyx_result.tlen_pp = __pyx_state[2]
 *     if len(__pyx_state) > 3 and hasattr(__pyx_result, '__dict__'):
 */

static PyObject *__pyx_f_10pysamstats_3opt___pyx_unpickle_Tlen__set_state(struct __pyx_obj_10pysamstats_3opt_Tlen *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  Py_ssize_t __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;
  __Pyx_RefNannySetupContext("__pyx_unpickle_Tlen__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_Tlen__set_state(Tlen __pyx_result, tuple __pyx_state):
 *     __pyx_result.reads_all = __pyx_state[0]; __pyx_result.tlen = __pyx_state[1]; __pyx_result.tlen_pp = __pyx_state[2]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 3 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[3])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->reads_all = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_TlenHelper))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->tlen);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->tlen));
  __pyx_v___pyx_result->tlen = ((struct __pyx_obj_10pysamstats_3opt_TlenHelper *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_TlenHelper))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->tlen_pp);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->tlen_pp));
  __pyx_v___pyx_result->tlen_pp = ((struct __pyx_obj_10pysamstats_3opt_TlenHelper *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_Tlen__set_state(Tlen __pyx_result, tuple __pyx_state):
 *     __pyx_result.reads_all = __pyx_state[0]; __pyx_result.tlen = __pyx_state[1]; __pyx_result.tlen_pp = __pyx_state[2]
 *     if len(__pyx_state) > 3 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[3])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 13, __pyx_L1_error)
  }
  __pyx_t_4 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_5 = ((__pyx_t_4 > 3) != 0);
  if (__pyx_t_5) {
  } else {
    __pyx_t_3 = __pyx_t_5;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_5 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_6 = (__pyx_t_5 != 0);
  __pyx_t_3 = __pyx_t_6;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_3) {

    /* "(tree fragment)":14
 *     __pyx_result.reads_all = __pyx_state[0]; __pyx_result.tlen = __pyx_state[1]; __pyx_result.tlen_pp = __pyx_state[2]
 *     if len(__pyx_state) > 3 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[3])             # <<<<<<<<<<<<<<
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_update); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 14, __pyx_L1_error)
    }
    __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    __pyx_t_1 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_9, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_7);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_Tlen__set_state(Tlen __pyx_result, tuple __pyx_state):
 *     __pyx_result.reads_all = __pyx_state[0]; __pyx_result.tlen = __pyx_state[1]; __pyx_result.tlen_pp = __pyx_state[2]
 *     if len(__pyx_state) > 3 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[3])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_Tlen__set_state(<Tlen> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_Tlen__set_state(Tlen __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.reads_all = __pyx_state[0]; __pyx_result.tlen = __pyx_state[1]; __pyx_result.tlen_pp = __pyx_state[2]
 *     if len(__pyx_state) > 3 and hasattr(__pyx_result, '__dict__'):
 */

  /* 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_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_Tlen__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_TlenStrand(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_52__pyx_unpickle_TlenStrand(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_10pysamstats_3opt_51__pyx_unpickle_TlenStrand[] = "__pyx_unpickle_TlenStrand(__pyx_type, long __pyx_checksum, __pyx_state)";
static PyMethodDef __pyx_mdef_10pysamstats_3opt_52__pyx_unpickle_TlenStrand = {"__pyx_unpickle_TlenStrand", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pysamstats_3opt_52__pyx_unpickle_TlenStrand, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pysamstats_3opt_51__pyx_unpickle_TlenStrand};
static PyObject *__pyx_pw_10pysamstats_3opt_52__pyx_unpickle_TlenStrand(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_TlenStrand (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,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_pyx_type)) != 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_pyx_checksum)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_TlenStrand", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_TlenStrand", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_TlenStrand") < 0)) __PYX_ERR(1, 1, __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___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_TlenStrand", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_TlenStrand", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_10pysamstats_3opt_51__pyx_unpickle_TlenStrand(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

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

static PyObject *__pyx_pf_10pysamstats_3opt_51__pyx_unpickle_TlenStrand(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("__pyx_unpickle_TlenStrand", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x6319d44:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x6319d44 = (reads_all, reads_fwd, reads_rev, tlen, tlen_fwd, tlen_pp, tlen_pp_fwd, tlen_pp_rev, tlen_rev))" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0x6319d44) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x6319d44:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x6319d44 = (reads_all, reads_fwd, reads_rev, tlen, tlen_fwd, tlen_pp, tlen_pp_fwd, tlen_pp_rev, tlen_rev))" % __pyx_checksum)
 *     __pyx_result = TlenStrand.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v___pyx_PickleError = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum != 0x6319d44:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x6319d44 = (reads_all, reads_fwd, reads_rev, tlen, tlen_fwd, tlen_pp, tlen_pp_fwd, tlen_pp_rev, tlen_rev))" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = TlenStrand.__new__(__pyx_type)
 *     if __pyx_state is not None:
 */
    __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0x63, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_v___pyx_PickleError);
    __pyx_t_2 = __pyx_v___pyx_PickleError; __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_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x6319d44:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x6319d44 = (reads_all, reads_fwd, reads_rev, tlen, tlen_fwd, tlen_pp, tlen_pp_fwd, tlen_pp_rev, tlen_rev))" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x6319d44 = (reads_all, reads_fwd, reads_rev, tlen, tlen_fwd, tlen_pp, tlen_pp_fwd, tlen_pp_rev, tlen_rev))" % __pyx_checksum)
 *     __pyx_result = TlenStrand.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_TlenStrand__set_state(<TlenStrand> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_10pysamstats_3opt_TlenStrand), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __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_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v___pyx_result = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x6319d44 = (reads_all, reads_fwd, reads_rev, tlen, tlen_fwd, tlen_pp, tlen_pp_fwd, tlen_pp_rev, tlen_rev))" % __pyx_checksum)
 *     __pyx_result = TlenStrand.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_TlenStrand__set_state(<TlenStrand> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
  __pyx_t_6 = (__pyx_t_1 != 0);
  if (__pyx_t_6) {

    /* "(tree fragment)":9
 *     __pyx_result = TlenStrand.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_TlenStrand__set_state(<TlenStrand> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_TlenStrand__set_state(TlenStrand __pyx_result, tuple __pyx_state):
 */
    if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_10pysamstats_3opt___pyx_unpickle_TlenStrand__set_state(((struct __pyx_obj_10pysamstats_3opt_TlenStrand *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x6319d44 = (reads_all, reads_fwd, reads_rev, tlen, tlen_fwd, tlen_pp, tlen_pp_fwd, tlen_pp_rev, tlen_rev))" % __pyx_checksum)
 *     __pyx_result = TlenStrand.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_TlenStrand__set_state(<TlenStrand> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_TlenStrand__set_state(<TlenStrand> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_TlenStrand__set_state(TlenStrand __pyx_result, tuple __pyx_state):
 *     __pyx_result.reads_all = __pyx_state[0]; __pyx_result.reads_fwd = __pyx_state[1]; __pyx_result.reads_rev = __pyx_state[2]; __pyx_result.tlen = __pyx_state[3]; __pyx_result.tlen_fwd = __pyx_state[4]; __pyx_result.tlen_pp = __pyx_state[5]; __pyx_result.tlen_pp_fwd = __pyx_state[6]; __pyx_result.tlen_pp_rev = __pyx_state[7]; __pyx_result.tlen_rev = __pyx_state[8]
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_TlenStrand(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_TlenStrand", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_TlenStrand__set_state(<TlenStrand> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_TlenStrand__set_state(TlenStrand __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.reads_all = __pyx_state[0]; __pyx_result.reads_fwd = __pyx_state[1]; __pyx_result.reads_rev = __pyx_state[2]; __pyx_result.tlen = __pyx_state[3]; __pyx_result.tlen_fwd = __pyx_state[4]; __pyx_result.tlen_pp = __pyx_state[5]; __pyx_result.tlen_pp_fwd = __pyx_state[6]; __pyx_result.tlen_pp_rev = __pyx_state[7]; __pyx_result.tlen_rev = __pyx_state[8]
 *     if len(__pyx_state) > 9 and hasattr(__pyx_result, '__dict__'):
 */

static PyObject *__pyx_f_10pysamstats_3opt___pyx_unpickle_TlenStrand__set_state(struct __pyx_obj_10pysamstats_3opt_TlenStrand *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  Py_ssize_t __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;
  __Pyx_RefNannySetupContext("__pyx_unpickle_TlenStrand__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_TlenStrand__set_state(TlenStrand __pyx_result, tuple __pyx_state):
 *     __pyx_result.reads_all = __pyx_state[0]; __pyx_result.reads_fwd = __pyx_state[1]; __pyx_result.reads_rev = __pyx_state[2]; __pyx_result.tlen = __pyx_state[3]; __pyx_result.tlen_fwd = __pyx_state[4]; __pyx_result.tlen_pp = __pyx_state[5]; __pyx_result.tlen_pp_fwd = __pyx_state[6]; __pyx_result.tlen_pp_rev = __pyx_state[7]; __pyx_result.tlen_rev = __pyx_state[8]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 9 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[9])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->reads_all = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->reads_fwd = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->reads_rev = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_TlenHelper))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->tlen);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->tlen));
  __pyx_v___pyx_result->tlen = ((struct __pyx_obj_10pysamstats_3opt_TlenHelper *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_TlenHelper))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->tlen_fwd);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->tlen_fwd));
  __pyx_v___pyx_result->tlen_fwd = ((struct __pyx_obj_10pysamstats_3opt_TlenHelper *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 5, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_TlenHelper))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->tlen_pp);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->tlen_pp));
  __pyx_v___pyx_result->tlen_pp = ((struct __pyx_obj_10pysamstats_3opt_TlenHelper *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 6, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_TlenHelper))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->tlen_pp_fwd);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->tlen_pp_fwd));
  __pyx_v___pyx_result->tlen_pp_fwd = ((struct __pyx_obj_10pysamstats_3opt_TlenHelper *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 7, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_TlenHelper))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->tlen_pp_rev);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->tlen_pp_rev));
  __pyx_v___pyx_result->tlen_pp_rev = ((struct __pyx_obj_10pysamstats_3opt_TlenHelper *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 8, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_TlenHelper))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->tlen_rev);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->tlen_rev));
  __pyx_v___pyx_result->tlen_rev = ((struct __pyx_obj_10pysamstats_3opt_TlenHelper *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_TlenStrand__set_state(TlenStrand __pyx_result, tuple __pyx_state):
 *     __pyx_result.reads_all = __pyx_state[0]; __pyx_result.reads_fwd = __pyx_state[1]; __pyx_result.reads_rev = __pyx_state[2]; __pyx_result.tlen = __pyx_state[3]; __pyx_result.tlen_fwd = __pyx_state[4]; __pyx_result.tlen_pp = __pyx_state[5]; __pyx_result.tlen_pp_fwd = __pyx_state[6]; __pyx_result.tlen_pp_rev = __pyx_state[7]; __pyx_result.tlen_rev = __pyx_state[8]
 *     if len(__pyx_state) > 9 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[9])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 13, __pyx_L1_error)
  }
  __pyx_t_4 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_5 = ((__pyx_t_4 > 9) != 0);
  if (__pyx_t_5) {
  } else {
    __pyx_t_3 = __pyx_t_5;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_5 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_6 = (__pyx_t_5 != 0);
  __pyx_t_3 = __pyx_t_6;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_3) {

    /* "(tree fragment)":14
 *     __pyx_result.reads_all = __pyx_state[0]; __pyx_result.reads_fwd = __pyx_state[1]; __pyx_result.reads_rev = __pyx_state[2]; __pyx_result.tlen = __pyx_state[3]; __pyx_result.tlen_fwd = __pyx_state[4]; __pyx_result.tlen_pp = __pyx_state[5]; __pyx_result.tlen_pp_fwd = __pyx_state[6]; __pyx_result.tlen_pp_rev = __pyx_state[7]; __pyx_result.tlen_rev = __pyx_state[8]
 *     if len(__pyx_state) > 9 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[9])             # <<<<<<<<<<<<<<
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_update); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 14, __pyx_L1_error)
    }
    __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 9, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    __pyx_t_1 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_9, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_7);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_TlenStrand__set_state(TlenStrand __pyx_result, tuple __pyx_state):
 *     __pyx_result.reads_all = __pyx_state[0]; __pyx_result.reads_fwd = __pyx_state[1]; __pyx_result.reads_rev = __pyx_state[2]; __pyx_result.tlen = __pyx_state[3]; __pyx_result.tlen_fwd = __pyx_state[4]; __pyx_result.tlen_pp = __pyx_state[5]; __pyx_result.tlen_pp_fwd = __pyx_state[6]; __pyx_result.tlen_pp_rev = __pyx_state[7]; __pyx_result.tlen_rev = __pyx_state[8]
 *     if len(__pyx_state) > 9 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[9])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_TlenStrand__set_state(<TlenStrand> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_TlenStrand__set_state(TlenStrand __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.reads_all = __pyx_state[0]; __pyx_result.reads_fwd = __pyx_state[1]; __pyx_result.reads_rev = __pyx_state[2]; __pyx_result.tlen = __pyx_state[3]; __pyx_result.tlen_fwd = __pyx_state[4]; __pyx_result.tlen_pp = __pyx_state[5]; __pyx_result.tlen_pp_fwd = __pyx_state[6]; __pyx_result.tlen_pp_rev = __pyx_state[7]; __pyx_result.tlen_rev = __pyx_state[8]
 *     if len(__pyx_state) > 9 and hasattr(__pyx_result, '__dict__'):
 */

  /* 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_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_TlenStrand__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_MapqHelper(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_54__pyx_unpickle_MapqHelper(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_10pysamstats_3opt_53__pyx_unpickle_MapqHelper[] = "__pyx_unpickle_MapqHelper(__pyx_type, long __pyx_checksum, __pyx_state)";
static PyMethodDef __pyx_mdef_10pysamstats_3opt_54__pyx_unpickle_MapqHelper = {"__pyx_unpickle_MapqHelper", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pysamstats_3opt_54__pyx_unpickle_MapqHelper, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pysamstats_3opt_53__pyx_unpickle_MapqHelper};
static PyObject *__pyx_pw_10pysamstats_3opt_54__pyx_unpickle_MapqHelper(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_MapqHelper (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,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_pyx_type)) != 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_pyx_checksum)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_MapqHelper", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_MapqHelper", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_MapqHelper") < 0)) __PYX_ERR(1, 1, __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___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_MapqHelper", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_MapqHelper", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_10pysamstats_3opt_53__pyx_unpickle_MapqHelper(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

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

static PyObject *__pyx_pf_10pysamstats_3opt_53__pyx_unpickle_MapqHelper(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("__pyx_unpickle_MapqHelper", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x2b98d68:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x2b98d68 = (max, n, nz, sqsum))" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0x2b98d68) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x2b98d68:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x2b98d68 = (max, n, nz, sqsum))" % __pyx_checksum)
 *     __pyx_result = MapqHelper.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v___pyx_PickleError = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum != 0x2b98d68:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x2b98d68 = (max, n, nz, sqsum))" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = MapqHelper.__new__(__pyx_type)
 *     if __pyx_state is not None:
 */
    __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0x2b, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_v___pyx_PickleError);
    __pyx_t_2 = __pyx_v___pyx_PickleError; __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_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x2b98d68:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x2b98d68 = (max, n, nz, sqsum))" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x2b98d68 = (max, n, nz, sqsum))" % __pyx_checksum)
 *     __pyx_result = MapqHelper.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_MapqHelper__set_state(<MapqHelper> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_10pysamstats_3opt_MapqHelper), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __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_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v___pyx_result = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x2b98d68 = (max, n, nz, sqsum))" % __pyx_checksum)
 *     __pyx_result = MapqHelper.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_MapqHelper__set_state(<MapqHelper> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
  __pyx_t_6 = (__pyx_t_1 != 0);
  if (__pyx_t_6) {

    /* "(tree fragment)":9
 *     __pyx_result = MapqHelper.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_MapqHelper__set_state(<MapqHelper> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_MapqHelper__set_state(MapqHelper __pyx_result, tuple __pyx_state):
 */
    if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_10pysamstats_3opt___pyx_unpickle_MapqHelper__set_state(((struct __pyx_obj_10pysamstats_3opt_MapqHelper *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x2b98d68 = (max, n, nz, sqsum))" % __pyx_checksum)
 *     __pyx_result = MapqHelper.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_MapqHelper__set_state(<MapqHelper> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_MapqHelper__set_state(<MapqHelper> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_MapqHelper__set_state(MapqHelper __pyx_result, tuple __pyx_state):
 *     __pyx_result.max = __pyx_state[0]; __pyx_result.n = __pyx_state[1]; __pyx_result.nz = __pyx_state[2]; __pyx_result.sqsum = __pyx_state[3]
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_MapqHelper(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_MapqHelper", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_MapqHelper__set_state(<MapqHelper> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_MapqHelper__set_state(MapqHelper __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.max = __pyx_state[0]; __pyx_result.n = __pyx_state[1]; __pyx_result.nz = __pyx_state[2]; __pyx_result.sqsum = __pyx_state[3]
 *     if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'):
 */

static PyObject *__pyx_f_10pysamstats_3opt___pyx_unpickle_MapqHelper__set_state(struct __pyx_obj_10pysamstats_3opt_MapqHelper *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  uint64_t __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  __Pyx_RefNannySetupContext("__pyx_unpickle_MapqHelper__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_MapqHelper__set_state(MapqHelper __pyx_result, tuple __pyx_state):
 *     __pyx_result.max = __pyx_state[0]; __pyx_result.n = __pyx_state[1]; __pyx_result.nz = __pyx_state[2]; __pyx_result.sqsum = __pyx_state[3]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[4])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_uint64_t(__pyx_t_1); if (unlikely((__pyx_t_2 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->max = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->n = __pyx_t_3;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->nz = __pyx_t_3;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_uint64_t(__pyx_t_1); if (unlikely((__pyx_t_2 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->sqsum = __pyx_t_2;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_MapqHelper__set_state(MapqHelper __pyx_result, tuple __pyx_state):
 *     __pyx_result.max = __pyx_state[0]; __pyx_result.n = __pyx_state[1]; __pyx_result.nz = __pyx_state[2]; __pyx_result.sqsum = __pyx_state[3]
 *     if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[4])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 13, __pyx_L1_error)
  }
  __pyx_t_5 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_6 = ((__pyx_t_5 > 4) != 0);
  if (__pyx_t_6) {
  } else {
    __pyx_t_4 = __pyx_t_6;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_6 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_7 = (__pyx_t_6 != 0);
  __pyx_t_4 = __pyx_t_7;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_4) {

    /* "(tree fragment)":14
 *     __pyx_result.max = __pyx_state[0]; __pyx_result.n = __pyx_state[1]; __pyx_result.nz = __pyx_state[2]; __pyx_result.sqsum = __pyx_state[3]
 *     if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[4])             # <<<<<<<<<<<<<<
 */
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_update); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 14, __pyx_L1_error)
    }
    __pyx_t_8 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __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_1 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_10, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_8);
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_MapqHelper__set_state(MapqHelper __pyx_result, tuple __pyx_state):
 *     __pyx_result.max = __pyx_state[0]; __pyx_result.n = __pyx_state[1]; __pyx_result.nz = __pyx_state[2]; __pyx_result.sqsum = __pyx_state[3]
 *     if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[4])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_MapqHelper__set_state(<MapqHelper> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_MapqHelper__set_state(MapqHelper __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.max = __pyx_state[0]; __pyx_result.n = __pyx_state[1]; __pyx_result.nz = __pyx_state[2]; __pyx_result.sqsum = __pyx_state[3]
 *     if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'):
 */

  /* 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_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_MapqHelper__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_Mapq(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_56__pyx_unpickle_Mapq(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_10pysamstats_3opt_55__pyx_unpickle_Mapq[] = "__pyx_unpickle_Mapq(__pyx_type, long __pyx_checksum, __pyx_state)";
static PyMethodDef __pyx_mdef_10pysamstats_3opt_56__pyx_unpickle_Mapq = {"__pyx_unpickle_Mapq", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pysamstats_3opt_56__pyx_unpickle_Mapq, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pysamstats_3opt_55__pyx_unpickle_Mapq};
static PyObject *__pyx_pw_10pysamstats_3opt_56__pyx_unpickle_Mapq(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_Mapq (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,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_pyx_type)) != 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_pyx_checksum)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Mapq", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Mapq", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_Mapq") < 0)) __PYX_ERR(1, 1, __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___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Mapq", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_Mapq", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_10pysamstats_3opt_55__pyx_unpickle_Mapq(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

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

static PyObject *__pyx_pf_10pysamstats_3opt_55__pyx_unpickle_Mapq(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("__pyx_unpickle_Mapq", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x145977c:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x145977c = (all, pp))" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0x145977c) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x145977c:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x145977c = (all, pp))" % __pyx_checksum)
 *     __pyx_result = Mapq.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v___pyx_PickleError = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum != 0x145977c:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x145977c = (all, pp))" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = Mapq.__new__(__pyx_type)
 *     if __pyx_state is not None:
 */
    __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0x14, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_v___pyx_PickleError);
    __pyx_t_2 = __pyx_v___pyx_PickleError; __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_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x145977c:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x145977c = (all, pp))" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x145977c = (all, pp))" % __pyx_checksum)
 *     __pyx_result = Mapq.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_Mapq__set_state(<Mapq> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_10pysamstats_3opt_Mapq), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __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_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v___pyx_result = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x145977c = (all, pp))" % __pyx_checksum)
 *     __pyx_result = Mapq.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_Mapq__set_state(<Mapq> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
  __pyx_t_6 = (__pyx_t_1 != 0);
  if (__pyx_t_6) {

    /* "(tree fragment)":9
 *     __pyx_result = Mapq.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_Mapq__set_state(<Mapq> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_Mapq__set_state(Mapq __pyx_result, tuple __pyx_state):
 */
    if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_10pysamstats_3opt___pyx_unpickle_Mapq__set_state(((struct __pyx_obj_10pysamstats_3opt_Mapq *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x145977c = (all, pp))" % __pyx_checksum)
 *     __pyx_result = Mapq.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_Mapq__set_state(<Mapq> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_Mapq__set_state(<Mapq> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_Mapq__set_state(Mapq __pyx_result, tuple __pyx_state):
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.pp = __pyx_state[1]
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_Mapq(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_Mapq", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_Mapq__set_state(<Mapq> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_Mapq__set_state(Mapq __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.pp = __pyx_state[1]
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):
 */

static PyObject *__pyx_f_10pysamstats_3opt___pyx_unpickle_Mapq__set_state(struct __pyx_obj_10pysamstats_3opt_Mapq *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("__pyx_unpickle_Mapq__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_Mapq__set_state(Mapq __pyx_result, tuple __pyx_state):
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.pp = __pyx_state[1]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[2])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_MapqHelper))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->all);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->all));
  __pyx_v___pyx_result->all = ((struct __pyx_obj_10pysamstats_3opt_MapqHelper *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_MapqHelper))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->pp);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->pp));
  __pyx_v___pyx_result->pp = ((struct __pyx_obj_10pysamstats_3opt_MapqHelper *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_Mapq__set_state(Mapq __pyx_result, tuple __pyx_state):
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.pp = __pyx_state[1]
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[2])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 13, __pyx_L1_error)
  }
  __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_4 = ((__pyx_t_3 > 2) != 0);
  if (__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_5 = (__pyx_t_4 != 0);
  __pyx_t_2 = __pyx_t_5;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "(tree fragment)":14
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.pp = __pyx_state[1]
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[2])             # <<<<<<<<<<<<<<
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 14, __pyx_L1_error)
    }
    __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_Mapq__set_state(Mapq __pyx_result, tuple __pyx_state):
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.pp = __pyx_state[1]
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[2])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_Mapq__set_state(<Mapq> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_Mapq__set_state(Mapq __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.pp = __pyx_state[1]
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):
 */

  /* 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_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_Mapq__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_MapqStrand(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_58__pyx_unpickle_MapqStrand(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_10pysamstats_3opt_57__pyx_unpickle_MapqStrand[] = "__pyx_unpickle_MapqStrand(__pyx_type, long __pyx_checksum, __pyx_state)";
static PyMethodDef __pyx_mdef_10pysamstats_3opt_58__pyx_unpickle_MapqStrand = {"__pyx_unpickle_MapqStrand", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pysamstats_3opt_58__pyx_unpickle_MapqStrand, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pysamstats_3opt_57__pyx_unpickle_MapqStrand};
static PyObject *__pyx_pw_10pysamstats_3opt_58__pyx_unpickle_MapqStrand(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_MapqStrand (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,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_pyx_type)) != 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_pyx_checksum)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_MapqStrand", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_MapqStrand", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_MapqStrand") < 0)) __PYX_ERR(1, 1, __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___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_MapqStrand", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_MapqStrand", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_10pysamstats_3opt_57__pyx_unpickle_MapqStrand(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

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

static PyObject *__pyx_pf_10pysamstats_3opt_57__pyx_unpickle_MapqStrand(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("__pyx_unpickle_MapqStrand", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x6e74246:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x6e74246 = (all, fwd, pp, pp_fwd, pp_rev, rev))" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0x6e74246) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x6e74246:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x6e74246 = (all, fwd, pp, pp_fwd, pp_rev, rev))" % __pyx_checksum)
 *     __pyx_result = MapqStrand.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v___pyx_PickleError = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum != 0x6e74246:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x6e74246 = (all, fwd, pp, pp_fwd, pp_rev, rev))" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = MapqStrand.__new__(__pyx_type)
 *     if __pyx_state is not None:
 */
    __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0x6e, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_v___pyx_PickleError);
    __pyx_t_2 = __pyx_v___pyx_PickleError; __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_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x6e74246:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x6e74246 = (all, fwd, pp, pp_fwd, pp_rev, rev))" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x6e74246 = (all, fwd, pp, pp_fwd, pp_rev, rev))" % __pyx_checksum)
 *     __pyx_result = MapqStrand.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_MapqStrand__set_state(<MapqStrand> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_10pysamstats_3opt_MapqStrand), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __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_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v___pyx_result = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x6e74246 = (all, fwd, pp, pp_fwd, pp_rev, rev))" % __pyx_checksum)
 *     __pyx_result = MapqStrand.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_MapqStrand__set_state(<MapqStrand> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
  __pyx_t_6 = (__pyx_t_1 != 0);
  if (__pyx_t_6) {

    /* "(tree fragment)":9
 *     __pyx_result = MapqStrand.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_MapqStrand__set_state(<MapqStrand> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_MapqStrand__set_state(MapqStrand __pyx_result, tuple __pyx_state):
 */
    if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_10pysamstats_3opt___pyx_unpickle_MapqStrand__set_state(((struct __pyx_obj_10pysamstats_3opt_MapqStrand *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x6e74246 = (all, fwd, pp, pp_fwd, pp_rev, rev))" % __pyx_checksum)
 *     __pyx_result = MapqStrand.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_MapqStrand__set_state(<MapqStrand> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_MapqStrand__set_state(<MapqStrand> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_MapqStrand__set_state(MapqStrand __pyx_result, tuple __pyx_state):
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.fwd = __pyx_state[1]; __pyx_result.pp = __pyx_state[2]; __pyx_result.pp_fwd = __pyx_state[3]; __pyx_result.pp_rev = __pyx_state[4]; __pyx_result.rev = __pyx_state[5]
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_MapqStrand(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_MapqStrand", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_MapqStrand__set_state(<MapqStrand> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_MapqStrand__set_state(MapqStrand __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.fwd = __pyx_state[1]; __pyx_result.pp = __pyx_state[2]; __pyx_result.pp_fwd = __pyx_state[3]; __pyx_result.pp_rev = __pyx_state[4]; __pyx_result.rev = __pyx_state[5]
 *     if len(__pyx_state) > 6 and hasattr(__pyx_result, '__dict__'):
 */

static PyObject *__pyx_f_10pysamstats_3opt___pyx_unpickle_MapqStrand__set_state(struct __pyx_obj_10pysamstats_3opt_MapqStrand *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("__pyx_unpickle_MapqStrand__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_MapqStrand__set_state(MapqStrand __pyx_result, tuple __pyx_state):
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.fwd = __pyx_state[1]; __pyx_result.pp = __pyx_state[2]; __pyx_result.pp_fwd = __pyx_state[3]; __pyx_result.pp_rev = __pyx_state[4]; __pyx_result.rev = __pyx_state[5]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 6 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[6])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_MapqHelper))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->all);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->all));
  __pyx_v___pyx_result->all = ((struct __pyx_obj_10pysamstats_3opt_MapqHelper *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_MapqHelper))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->fwd);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->fwd));
  __pyx_v___pyx_result->fwd = ((struct __pyx_obj_10pysamstats_3opt_MapqHelper *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_MapqHelper))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->pp);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->pp));
  __pyx_v___pyx_result->pp = ((struct __pyx_obj_10pysamstats_3opt_MapqHelper *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_MapqHelper))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->pp_fwd);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->pp_fwd));
  __pyx_v___pyx_result->pp_fwd = ((struct __pyx_obj_10pysamstats_3opt_MapqHelper *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_MapqHelper))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->pp_rev);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->pp_rev));
  __pyx_v___pyx_result->pp_rev = ((struct __pyx_obj_10pysamstats_3opt_MapqHelper *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 5, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_MapqHelper))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->rev);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->rev));
  __pyx_v___pyx_result->rev = ((struct __pyx_obj_10pysamstats_3opt_MapqHelper *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_MapqStrand__set_state(MapqStrand __pyx_result, tuple __pyx_state):
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.fwd = __pyx_state[1]; __pyx_result.pp = __pyx_state[2]; __pyx_result.pp_fwd = __pyx_state[3]; __pyx_result.pp_rev = __pyx_state[4]; __pyx_result.rev = __pyx_state[5]
 *     if len(__pyx_state) > 6 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[6])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 13, __pyx_L1_error)
  }
  __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_4 = ((__pyx_t_3 > 6) != 0);
  if (__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_5 = (__pyx_t_4 != 0);
  __pyx_t_2 = __pyx_t_5;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "(tree fragment)":14
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.fwd = __pyx_state[1]; __pyx_result.pp = __pyx_state[2]; __pyx_result.pp_fwd = __pyx_state[3]; __pyx_result.pp_rev = __pyx_state[4]; __pyx_result.rev = __pyx_state[5]
 *     if len(__pyx_state) > 6 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[6])             # <<<<<<<<<<<<<<
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 14, __pyx_L1_error)
    }
    __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 6, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_MapqStrand__set_state(MapqStrand __pyx_result, tuple __pyx_state):
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.fwd = __pyx_state[1]; __pyx_result.pp = __pyx_state[2]; __pyx_result.pp_fwd = __pyx_state[3]; __pyx_result.pp_rev = __pyx_state[4]; __pyx_result.rev = __pyx_state[5]
 *     if len(__pyx_state) > 6 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[6])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_MapqStrand__set_state(<MapqStrand> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_MapqStrand__set_state(MapqStrand __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.fwd = __pyx_state[1]; __pyx_result.pp = __pyx_state[2]; __pyx_result.pp_fwd = __pyx_state[3]; __pyx_result.pp_rev = __pyx_state[4]; __pyx_result.rev = __pyx_state[5]
 *     if len(__pyx_state) > 6 and hasattr(__pyx_result, '__dict__'):
 */

  /* 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_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_MapqStrand__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_BaseqHelper(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_60__pyx_unpickle_BaseqHelper(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_10pysamstats_3opt_59__pyx_unpickle_BaseqHelper[] = "__pyx_unpickle_BaseqHelper(__pyx_type, long __pyx_checksum, __pyx_state)";
static PyMethodDef __pyx_mdef_10pysamstats_3opt_60__pyx_unpickle_BaseqHelper = {"__pyx_unpickle_BaseqHelper", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pysamstats_3opt_60__pyx_unpickle_BaseqHelper, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pysamstats_3opt_59__pyx_unpickle_BaseqHelper};
static PyObject *__pyx_pw_10pysamstats_3opt_60__pyx_unpickle_BaseqHelper(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_BaseqHelper (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,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_pyx_type)) != 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_pyx_checksum)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_BaseqHelper", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_BaseqHelper", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_BaseqHelper") < 0)) __PYX_ERR(1, 1, __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___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_BaseqHelper", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_BaseqHelper", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_10pysamstats_3opt_59__pyx_unpickle_BaseqHelper(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

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

static PyObject *__pyx_pf_10pysamstats_3opt_59__pyx_unpickle_BaseqHelper(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("__pyx_unpickle_BaseqHelper", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x4ce10ab:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x4ce10ab = (n, n_nodel, sqsum))" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0x4ce10ab) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x4ce10ab:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x4ce10ab = (n, n_nodel, sqsum))" % __pyx_checksum)
 *     __pyx_result = BaseqHelper.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v___pyx_PickleError = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum != 0x4ce10ab:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x4ce10ab = (n, n_nodel, sqsum))" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = BaseqHelper.__new__(__pyx_type)
 *     if __pyx_state is not None:
 */
    __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0x4c, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_v___pyx_PickleError);
    __pyx_t_2 = __pyx_v___pyx_PickleError; __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_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x4ce10ab:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x4ce10ab = (n, n_nodel, sqsum))" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x4ce10ab = (n, n_nodel, sqsum))" % __pyx_checksum)
 *     __pyx_result = BaseqHelper.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_BaseqHelper__set_state(<BaseqHelper> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_10pysamstats_3opt_BaseqHelper), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __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_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v___pyx_result = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x4ce10ab = (n, n_nodel, sqsum))" % __pyx_checksum)
 *     __pyx_result = BaseqHelper.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_BaseqHelper__set_state(<BaseqHelper> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
  __pyx_t_6 = (__pyx_t_1 != 0);
  if (__pyx_t_6) {

    /* "(tree fragment)":9
 *     __pyx_result = BaseqHelper.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_BaseqHelper__set_state(<BaseqHelper> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_BaseqHelper__set_state(BaseqHelper __pyx_result, tuple __pyx_state):
 */
    if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_10pysamstats_3opt___pyx_unpickle_BaseqHelper__set_state(((struct __pyx_obj_10pysamstats_3opt_BaseqHelper *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x4ce10ab = (n, n_nodel, sqsum))" % __pyx_checksum)
 *     __pyx_result = BaseqHelper.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_BaseqHelper__set_state(<BaseqHelper> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_BaseqHelper__set_state(<BaseqHelper> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_BaseqHelper__set_state(BaseqHelper __pyx_result, tuple __pyx_state):
 *     __pyx_result.n = __pyx_state[0]; __pyx_result.n_nodel = __pyx_state[1]; __pyx_result.sqsum = __pyx_state[2]
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_BaseqHelper(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_BaseqHelper", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_BaseqHelper__set_state(<BaseqHelper> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_BaseqHelper__set_state(BaseqHelper __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.n = __pyx_state[0]; __pyx_result.n_nodel = __pyx_state[1]; __pyx_result.sqsum = __pyx_state[2]
 *     if len(__pyx_state) > 3 and hasattr(__pyx_result, '__dict__'):
 */

static PyObject *__pyx_f_10pysamstats_3opt___pyx_unpickle_BaseqHelper__set_state(struct __pyx_obj_10pysamstats_3opt_BaseqHelper *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  uint64_t __pyx_t_3;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  __Pyx_RefNannySetupContext("__pyx_unpickle_BaseqHelper__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_BaseqHelper__set_state(BaseqHelper __pyx_result, tuple __pyx_state):
 *     __pyx_result.n = __pyx_state[0]; __pyx_result.n_nodel = __pyx_state[1]; __pyx_result.sqsum = __pyx_state[2]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 3 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[3])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->n = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->n_nodel = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyInt_As_uint64_t(__pyx_t_1); if (unlikely((__pyx_t_3 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->sqsum = __pyx_t_3;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_BaseqHelper__set_state(BaseqHelper __pyx_result, tuple __pyx_state):
 *     __pyx_result.n = __pyx_state[0]; __pyx_result.n_nodel = __pyx_state[1]; __pyx_result.sqsum = __pyx_state[2]
 *     if len(__pyx_state) > 3 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[3])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 13, __pyx_L1_error)
  }
  __pyx_t_5 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_6 = ((__pyx_t_5 > 3) != 0);
  if (__pyx_t_6) {
  } else {
    __pyx_t_4 = __pyx_t_6;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_6 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_7 = (__pyx_t_6 != 0);
  __pyx_t_4 = __pyx_t_7;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_4) {

    /* "(tree fragment)":14
 *     __pyx_result.n = __pyx_state[0]; __pyx_result.n_nodel = __pyx_state[1]; __pyx_result.sqsum = __pyx_state[2]
 *     if len(__pyx_state) > 3 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[3])             # <<<<<<<<<<<<<<
 */
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_update); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 14, __pyx_L1_error)
    }
    __pyx_t_8 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __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_1 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_10, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_8);
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_BaseqHelper__set_state(BaseqHelper __pyx_result, tuple __pyx_state):
 *     __pyx_result.n = __pyx_state[0]; __pyx_result.n_nodel = __pyx_state[1]; __pyx_result.sqsum = __pyx_state[2]
 *     if len(__pyx_state) > 3 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[3])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_BaseqHelper__set_state(<BaseqHelper> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_BaseqHelper__set_state(BaseqHelper __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.n = __pyx_state[0]; __pyx_result.n_nodel = __pyx_state[1]; __pyx_result.sqsum = __pyx_state[2]
 *     if len(__pyx_state) > 3 and hasattr(__pyx_result, '__dict__'):
 */

  /* 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_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_BaseqHelper__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_BaseqPpHelper(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_62__pyx_unpickle_BaseqPpHelper(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_10pysamstats_3opt_61__pyx_unpickle_BaseqPpHelper[] = "__pyx_unpickle_BaseqPpHelper(__pyx_type, long __pyx_checksum, __pyx_state)";
static PyMethodDef __pyx_mdef_10pysamstats_3opt_62__pyx_unpickle_BaseqPpHelper = {"__pyx_unpickle_BaseqPpHelper", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pysamstats_3opt_62__pyx_unpickle_BaseqPpHelper, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pysamstats_3opt_61__pyx_unpickle_BaseqPpHelper};
static PyObject *__pyx_pw_10pysamstats_3opt_62__pyx_unpickle_BaseqPpHelper(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_BaseqPpHelper (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,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_pyx_type)) != 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_pyx_checksum)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_BaseqPpHelper", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_BaseqPpHelper", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_BaseqPpHelper") < 0)) __PYX_ERR(1, 1, __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___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_BaseqPpHelper", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_BaseqPpHelper", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_10pysamstats_3opt_61__pyx_unpickle_BaseqPpHelper(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

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

static PyObject *__pyx_pf_10pysamstats_3opt_61__pyx_unpickle_BaseqPpHelper(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("__pyx_unpickle_BaseqPpHelper", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x145977c:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x145977c = (all, pp))" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0x145977c) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x145977c:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x145977c = (all, pp))" % __pyx_checksum)
 *     __pyx_result = BaseqPpHelper.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v___pyx_PickleError = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum != 0x145977c:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x145977c = (all, pp))" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = BaseqPpHelper.__new__(__pyx_type)
 *     if __pyx_state is not None:
 */
    __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0x14, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_v___pyx_PickleError);
    __pyx_t_2 = __pyx_v___pyx_PickleError; __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_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x145977c:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x145977c = (all, pp))" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x145977c = (all, pp))" % __pyx_checksum)
 *     __pyx_result = BaseqPpHelper.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_BaseqPpHelper__set_state(<BaseqPpHelper> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_10pysamstats_3opt_BaseqPpHelper), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __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_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v___pyx_result = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x145977c = (all, pp))" % __pyx_checksum)
 *     __pyx_result = BaseqPpHelper.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_BaseqPpHelper__set_state(<BaseqPpHelper> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
  __pyx_t_6 = (__pyx_t_1 != 0);
  if (__pyx_t_6) {

    /* "(tree fragment)":9
 *     __pyx_result = BaseqPpHelper.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_BaseqPpHelper__set_state(<BaseqPpHelper> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_BaseqPpHelper__set_state(BaseqPpHelper __pyx_result, tuple __pyx_state):
 */
    if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_10pysamstats_3opt___pyx_unpickle_BaseqPpHelper__set_state(((struct __pyx_obj_10pysamstats_3opt_BaseqPpHelper *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x145977c = (all, pp))" % __pyx_checksum)
 *     __pyx_result = BaseqPpHelper.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_BaseqPpHelper__set_state(<BaseqPpHelper> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_BaseqPpHelper__set_state(<BaseqPpHelper> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_BaseqPpHelper__set_state(BaseqPpHelper __pyx_result, tuple __pyx_state):
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.pp = __pyx_state[1]
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_BaseqPpHelper(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_BaseqPpHelper", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_BaseqPpHelper__set_state(<BaseqPpHelper> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_BaseqPpHelper__set_state(BaseqPpHelper __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.pp = __pyx_state[1]
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):
 */

static PyObject *__pyx_f_10pysamstats_3opt___pyx_unpickle_BaseqPpHelper__set_state(struct __pyx_obj_10pysamstats_3opt_BaseqPpHelper *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("__pyx_unpickle_BaseqPpHelper__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_BaseqPpHelper__set_state(BaseqPpHelper __pyx_result, tuple __pyx_state):
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.pp = __pyx_state[1]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[2])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_BaseqHelper))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->all);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->all));
  __pyx_v___pyx_result->all = ((struct __pyx_obj_10pysamstats_3opt_BaseqHelper *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_BaseqHelper))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->pp);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->pp));
  __pyx_v___pyx_result->pp = ((struct __pyx_obj_10pysamstats_3opt_BaseqHelper *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_BaseqPpHelper__set_state(BaseqPpHelper __pyx_result, tuple __pyx_state):
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.pp = __pyx_state[1]
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[2])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 13, __pyx_L1_error)
  }
  __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_4 = ((__pyx_t_3 > 2) != 0);
  if (__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_5 = (__pyx_t_4 != 0);
  __pyx_t_2 = __pyx_t_5;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "(tree fragment)":14
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.pp = __pyx_state[1]
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[2])             # <<<<<<<<<<<<<<
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 14, __pyx_L1_error)
    }
    __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_BaseqPpHelper__set_state(BaseqPpHelper __pyx_result, tuple __pyx_state):
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.pp = __pyx_state[1]
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[2])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_BaseqPpHelper__set_state(<BaseqPpHelper> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_BaseqPpHelper__set_state(BaseqPpHelper __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.pp = __pyx_state[1]
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):
 */

  /* 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_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_BaseqPpHelper__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_Baseq(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_64__pyx_unpickle_Baseq(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_10pysamstats_3opt_63__pyx_unpickle_Baseq[] = "__pyx_unpickle_Baseq(__pyx_type, long __pyx_checksum, __pyx_state)";
static PyMethodDef __pyx_mdef_10pysamstats_3opt_64__pyx_unpickle_Baseq = {"__pyx_unpickle_Baseq", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pysamstats_3opt_64__pyx_unpickle_Baseq, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pysamstats_3opt_63__pyx_unpickle_Baseq};
static PyObject *__pyx_pw_10pysamstats_3opt_64__pyx_unpickle_Baseq(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_Baseq (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,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_pyx_type)) != 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_pyx_checksum)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Baseq", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Baseq", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_Baseq") < 0)) __PYX_ERR(1, 1, __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___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Baseq", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_Baseq", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_10pysamstats_3opt_63__pyx_unpickle_Baseq(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

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

static PyObject *__pyx_pf_10pysamstats_3opt_63__pyx_unpickle_Baseq(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("__pyx_unpickle_Baseq", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xfde5d67:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xfde5d67 = (helper))" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xfde5d67) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xfde5d67:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xfde5d67 = (helper))" % __pyx_checksum)
 *     __pyx_result = Baseq.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v___pyx_PickleError = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum != 0xfde5d67:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xfde5d67 = (helper))" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = Baseq.__new__(__pyx_type)
 *     if __pyx_state is not None:
 */
    __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xfd, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_v___pyx_PickleError);
    __pyx_t_2 = __pyx_v___pyx_PickleError; __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_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xfde5d67:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xfde5d67 = (helper))" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xfde5d67 = (helper))" % __pyx_checksum)
 *     __pyx_result = Baseq.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_Baseq__set_state(<Baseq> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_10pysamstats_3opt_Baseq), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __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_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v___pyx_result = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xfde5d67 = (helper))" % __pyx_checksum)
 *     __pyx_result = Baseq.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_Baseq__set_state(<Baseq> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
  __pyx_t_6 = (__pyx_t_1 != 0);
  if (__pyx_t_6) {

    /* "(tree fragment)":9
 *     __pyx_result = Baseq.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_Baseq__set_state(<Baseq> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_Baseq__set_state(Baseq __pyx_result, tuple __pyx_state):
 */
    if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_10pysamstats_3opt___pyx_unpickle_Baseq__set_state(((struct __pyx_obj_10pysamstats_3opt_Baseq *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xfde5d67 = (helper))" % __pyx_checksum)
 *     __pyx_result = Baseq.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_Baseq__set_state(<Baseq> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_Baseq__set_state(<Baseq> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_Baseq__set_state(Baseq __pyx_result, tuple __pyx_state):
 *     __pyx_result.helper = __pyx_state[0]
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_Baseq(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_Baseq", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_Baseq__set_state(<Baseq> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_Baseq__set_state(Baseq __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.helper = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 */

static PyObject *__pyx_f_10pysamstats_3opt___pyx_unpickle_Baseq__set_state(struct __pyx_obj_10pysamstats_3opt_Baseq *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("__pyx_unpickle_Baseq__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_Baseq__set_state(Baseq __pyx_result, tuple __pyx_state):
 *     __pyx_result.helper = __pyx_state[0]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[1])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_BaseqPpHelper))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->helper);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->helper));
  __pyx_v___pyx_result->helper = ((struct __pyx_obj_10pysamstats_3opt_BaseqPpHelper *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_Baseq__set_state(Baseq __pyx_result, tuple __pyx_state):
 *     __pyx_result.helper = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[1])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 13, __pyx_L1_error)
  }
  __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_4 = ((__pyx_t_3 > 1) != 0);
  if (__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_5 = (__pyx_t_4 != 0);
  __pyx_t_2 = __pyx_t_5;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "(tree fragment)":14
 *     __pyx_result.helper = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[1])             # <<<<<<<<<<<<<<
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 14, __pyx_L1_error)
    }
    __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_Baseq__set_state(Baseq __pyx_result, tuple __pyx_state):
 *     __pyx_result.helper = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[1])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_Baseq__set_state(<Baseq> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_Baseq__set_state(Baseq __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.helper = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 */

  /* 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_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_Baseq__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_BaseqStrandPpHelper(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_66__pyx_unpickle_BaseqStrandPpHelper(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_10pysamstats_3opt_65__pyx_unpickle_BaseqStrandPpHelper[] = "__pyx_unpickle_BaseqStrandPpHelper(__pyx_type, long __pyx_checksum, __pyx_state)";
static PyMethodDef __pyx_mdef_10pysamstats_3opt_66__pyx_unpickle_BaseqStrandPpHelper = {"__pyx_unpickle_BaseqStrandPpHelper", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pysamstats_3opt_66__pyx_unpickle_BaseqStrandPpHelper, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pysamstats_3opt_65__pyx_unpickle_BaseqStrandPpHelper};
static PyObject *__pyx_pw_10pysamstats_3opt_66__pyx_unpickle_BaseqStrandPpHelper(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_BaseqStrandPpHelper (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,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_pyx_type)) != 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_pyx_checksum)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_BaseqStrandPpHelper", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_BaseqStrandPpHelper", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_BaseqStrandPpHelper") < 0)) __PYX_ERR(1, 1, __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___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_BaseqStrandPpHelper", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_BaseqStrandPpHelper", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_10pysamstats_3opt_65__pyx_unpickle_BaseqStrandPpHelper(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

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

static PyObject *__pyx_pf_10pysamstats_3opt_65__pyx_unpickle_BaseqStrandPpHelper(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("__pyx_unpickle_BaseqStrandPpHelper", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x6e74246:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x6e74246 = (all, fwd, pp, pp_fwd, pp_rev, rev))" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0x6e74246) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x6e74246:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x6e74246 = (all, fwd, pp, pp_fwd, pp_rev, rev))" % __pyx_checksum)
 *     __pyx_result = BaseqStrandPpHelper.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v___pyx_PickleError = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum != 0x6e74246:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x6e74246 = (all, fwd, pp, pp_fwd, pp_rev, rev))" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = BaseqStrandPpHelper.__new__(__pyx_type)
 *     if __pyx_state is not None:
 */
    __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0x6e, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_v___pyx_PickleError);
    __pyx_t_2 = __pyx_v___pyx_PickleError; __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_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x6e74246:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x6e74246 = (all, fwd, pp, pp_fwd, pp_rev, rev))" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x6e74246 = (all, fwd, pp, pp_fwd, pp_rev, rev))" % __pyx_checksum)
 *     __pyx_result = BaseqStrandPpHelper.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_BaseqStrandPpHelper__set_state(<BaseqStrandPpHelper> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_10pysamstats_3opt_BaseqStrandPpHelper), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __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_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v___pyx_result = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x6e74246 = (all, fwd, pp, pp_fwd, pp_rev, rev))" % __pyx_checksum)
 *     __pyx_result = BaseqStrandPpHelper.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_BaseqStrandPpHelper__set_state(<BaseqStrandPpHelper> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
  __pyx_t_6 = (__pyx_t_1 != 0);
  if (__pyx_t_6) {

    /* "(tree fragment)":9
 *     __pyx_result = BaseqStrandPpHelper.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_BaseqStrandPpHelper__set_state(<BaseqStrandPpHelper> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_BaseqStrandPpHelper__set_state(BaseqStrandPpHelper __pyx_result, tuple __pyx_state):
 */
    if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_10pysamstats_3opt___pyx_unpickle_BaseqStrandPpHelper__set_state(((struct __pyx_obj_10pysamstats_3opt_BaseqStrandPpHelper *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x6e74246 = (all, fwd, pp, pp_fwd, pp_rev, rev))" % __pyx_checksum)
 *     __pyx_result = BaseqStrandPpHelper.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_BaseqStrandPpHelper__set_state(<BaseqStrandPpHelper> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_BaseqStrandPpHelper__set_state(<BaseqStrandPpHelper> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_BaseqStrandPpHelper__set_state(BaseqStrandPpHelper __pyx_result, tuple __pyx_state):
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.fwd = __pyx_state[1]; __pyx_result.pp = __pyx_state[2]; __pyx_result.pp_fwd = __pyx_state[3]; __pyx_result.pp_rev = __pyx_state[4]; __pyx_result.rev = __pyx_state[5]
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_BaseqStrandPpHelper(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_BaseqStrandPpHelper", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_BaseqStrandPpHelper__set_state(<BaseqStrandPpHelper> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_BaseqStrandPpHelper__set_state(BaseqStrandPpHelper __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.fwd = __pyx_state[1]; __pyx_result.pp = __pyx_state[2]; __pyx_result.pp_fwd = __pyx_state[3]; __pyx_result.pp_rev = __pyx_state[4]; __pyx_result.rev = __pyx_state[5]
 *     if len(__pyx_state) > 6 and hasattr(__pyx_result, '__dict__'):
 */

static PyObject *__pyx_f_10pysamstats_3opt___pyx_unpickle_BaseqStrandPpHelper__set_state(struct __pyx_obj_10pysamstats_3opt_BaseqStrandPpHelper *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("__pyx_unpickle_BaseqStrandPpHelper__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_BaseqStrandPpHelper__set_state(BaseqStrandPpHelper __pyx_result, tuple __pyx_state):
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.fwd = __pyx_state[1]; __pyx_result.pp = __pyx_state[2]; __pyx_result.pp_fwd = __pyx_state[3]; __pyx_result.pp_rev = __pyx_state[4]; __pyx_result.rev = __pyx_state[5]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 6 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[6])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_BaseqHelper))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->all);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->all));
  __pyx_v___pyx_result->all = ((struct __pyx_obj_10pysamstats_3opt_BaseqHelper *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_BaseqHelper))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->fwd);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->fwd));
  __pyx_v___pyx_result->fwd = ((struct __pyx_obj_10pysamstats_3opt_BaseqHelper *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_BaseqHelper))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->pp);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->pp));
  __pyx_v___pyx_result->pp = ((struct __pyx_obj_10pysamstats_3opt_BaseqHelper *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_BaseqHelper))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->pp_fwd);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->pp_fwd));
  __pyx_v___pyx_result->pp_fwd = ((struct __pyx_obj_10pysamstats_3opt_BaseqHelper *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_BaseqHelper))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->pp_rev);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->pp_rev));
  __pyx_v___pyx_result->pp_rev = ((struct __pyx_obj_10pysamstats_3opt_BaseqHelper *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 5, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_BaseqHelper))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->rev);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->rev));
  __pyx_v___pyx_result->rev = ((struct __pyx_obj_10pysamstats_3opt_BaseqHelper *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_BaseqStrandPpHelper__set_state(BaseqStrandPpHelper __pyx_result, tuple __pyx_state):
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.fwd = __pyx_state[1]; __pyx_result.pp = __pyx_state[2]; __pyx_result.pp_fwd = __pyx_state[3]; __pyx_result.pp_rev = __pyx_state[4]; __pyx_result.rev = __pyx_state[5]
 *     if len(__pyx_state) > 6 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[6])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 13, __pyx_L1_error)
  }
  __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_4 = ((__pyx_t_3 > 6) != 0);
  if (__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_5 = (__pyx_t_4 != 0);
  __pyx_t_2 = __pyx_t_5;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "(tree fragment)":14
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.fwd = __pyx_state[1]; __pyx_result.pp = __pyx_state[2]; __pyx_result.pp_fwd = __pyx_state[3]; __pyx_result.pp_rev = __pyx_state[4]; __pyx_result.rev = __pyx_state[5]
 *     if len(__pyx_state) > 6 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[6])             # <<<<<<<<<<<<<<
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 14, __pyx_L1_error)
    }
    __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 6, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_BaseqStrandPpHelper__set_state(BaseqStrandPpHelper __pyx_result, tuple __pyx_state):
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.fwd = __pyx_state[1]; __pyx_result.pp = __pyx_state[2]; __pyx_result.pp_fwd = __pyx_state[3]; __pyx_result.pp_rev = __pyx_state[4]; __pyx_result.rev = __pyx_state[5]
 *     if len(__pyx_state) > 6 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[6])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_BaseqStrandPpHelper__set_state(<BaseqStrandPpHelper> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_BaseqStrandPpHelper__set_state(BaseqStrandPpHelper __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.fwd = __pyx_state[1]; __pyx_result.pp = __pyx_state[2]; __pyx_result.pp_fwd = __pyx_state[3]; __pyx_result.pp_rev = __pyx_state[4]; __pyx_result.rev = __pyx_state[5]
 *     if len(__pyx_state) > 6 and hasattr(__pyx_result, '__dict__'):
 */

  /* 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_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_BaseqStrandPpHelper__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_BaseqStrand(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_68__pyx_unpickle_BaseqStrand(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_10pysamstats_3opt_67__pyx_unpickle_BaseqStrand[] = "__pyx_unpickle_BaseqStrand(__pyx_type, long __pyx_checksum, __pyx_state)";
static PyMethodDef __pyx_mdef_10pysamstats_3opt_68__pyx_unpickle_BaseqStrand = {"__pyx_unpickle_BaseqStrand", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pysamstats_3opt_68__pyx_unpickle_BaseqStrand, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pysamstats_3opt_67__pyx_unpickle_BaseqStrand};
static PyObject *__pyx_pw_10pysamstats_3opt_68__pyx_unpickle_BaseqStrand(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_BaseqStrand (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,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_pyx_type)) != 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_pyx_checksum)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_BaseqStrand", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_BaseqStrand", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_BaseqStrand") < 0)) __PYX_ERR(1, 1, __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___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_BaseqStrand", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_BaseqStrand", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_10pysamstats_3opt_67__pyx_unpickle_BaseqStrand(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

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

static PyObject *__pyx_pf_10pysamstats_3opt_67__pyx_unpickle_BaseqStrand(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("__pyx_unpickle_BaseqStrand", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xfde5d67:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xfde5d67 = (helper))" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xfde5d67) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xfde5d67:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xfde5d67 = (helper))" % __pyx_checksum)
 *     __pyx_result = BaseqStrand.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v___pyx_PickleError = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum != 0xfde5d67:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xfde5d67 = (helper))" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = BaseqStrand.__new__(__pyx_type)
 *     if __pyx_state is not None:
 */
    __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xfd, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_v___pyx_PickleError);
    __pyx_t_2 = __pyx_v___pyx_PickleError; __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_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xfde5d67:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xfde5d67 = (helper))" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xfde5d67 = (helper))" % __pyx_checksum)
 *     __pyx_result = BaseqStrand.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_BaseqStrand__set_state(<BaseqStrand> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_10pysamstats_3opt_BaseqStrand), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __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_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v___pyx_result = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xfde5d67 = (helper))" % __pyx_checksum)
 *     __pyx_result = BaseqStrand.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_BaseqStrand__set_state(<BaseqStrand> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
  __pyx_t_6 = (__pyx_t_1 != 0);
  if (__pyx_t_6) {

    /* "(tree fragment)":9
 *     __pyx_result = BaseqStrand.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_BaseqStrand__set_state(<BaseqStrand> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_BaseqStrand__set_state(BaseqStrand __pyx_result, tuple __pyx_state):
 */
    if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_10pysamstats_3opt___pyx_unpickle_BaseqStrand__set_state(((struct __pyx_obj_10pysamstats_3opt_BaseqStrand *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xfde5d67 = (helper))" % __pyx_checksum)
 *     __pyx_result = BaseqStrand.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_BaseqStrand__set_state(<BaseqStrand> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_BaseqStrand__set_state(<BaseqStrand> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_BaseqStrand__set_state(BaseqStrand __pyx_result, tuple __pyx_state):
 *     __pyx_result.helper = __pyx_state[0]
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_BaseqStrand(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_BaseqStrand", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_BaseqStrand__set_state(<BaseqStrand> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_BaseqStrand__set_state(BaseqStrand __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.helper = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 */

static PyObject *__pyx_f_10pysamstats_3opt___pyx_unpickle_BaseqStrand__set_state(struct __pyx_obj_10pysamstats_3opt_BaseqStrand *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("__pyx_unpickle_BaseqStrand__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_BaseqStrand__set_state(BaseqStrand __pyx_result, tuple __pyx_state):
 *     __pyx_result.helper = __pyx_state[0]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[1])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_BaseqStrandPpHelper))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->helper);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->helper));
  __pyx_v___pyx_result->helper = ((struct __pyx_obj_10pysamstats_3opt_BaseqStrandPpHelper *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_BaseqStrand__set_state(BaseqStrand __pyx_result, tuple __pyx_state):
 *     __pyx_result.helper = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[1])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 13, __pyx_L1_error)
  }
  __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_4 = ((__pyx_t_3 > 1) != 0);
  if (__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_5 = (__pyx_t_4 != 0);
  __pyx_t_2 = __pyx_t_5;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "(tree fragment)":14
 *     __pyx_result.helper = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[1])             # <<<<<<<<<<<<<<
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 14, __pyx_L1_error)
    }
    __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_BaseqStrand__set_state(BaseqStrand __pyx_result, tuple __pyx_state):
 *     __pyx_result.helper = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[1])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_BaseqStrand__set_state(<BaseqStrand> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_BaseqStrand__set_state(BaseqStrand __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.helper = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 */

  /* 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_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_BaseqStrand__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_BaseqExt(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_70__pyx_unpickle_BaseqExt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_10pysamstats_3opt_69__pyx_unpickle_BaseqExt[] = "__pyx_unpickle_BaseqExt(__pyx_type, long __pyx_checksum, __pyx_state)";
static PyMethodDef __pyx_mdef_10pysamstats_3opt_70__pyx_unpickle_BaseqExt = {"__pyx_unpickle_BaseqExt", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pysamstats_3opt_70__pyx_unpickle_BaseqExt, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pysamstats_3opt_69__pyx_unpickle_BaseqExt};
static PyObject *__pyx_pw_10pysamstats_3opt_70__pyx_unpickle_BaseqExt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_BaseqExt (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,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_pyx_type)) != 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_pyx_checksum)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_BaseqExt", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_BaseqExt", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_BaseqExt") < 0)) __PYX_ERR(1, 1, __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___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_BaseqExt", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_BaseqExt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_10pysamstats_3opt_69__pyx_unpickle_BaseqExt(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

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

static PyObject *__pyx_pf_10pysamstats_3opt_69__pyx_unpickle_BaseqExt(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("__pyx_unpickle_BaseqExt", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xbc518eb:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xbc518eb = (all, matches, mismatches))" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xbc518eb) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xbc518eb:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xbc518eb = (all, matches, mismatches))" % __pyx_checksum)
 *     __pyx_result = BaseqExt.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v___pyx_PickleError = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum != 0xbc518eb:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xbc518eb = (all, matches, mismatches))" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = BaseqExt.__new__(__pyx_type)
 *     if __pyx_state is not None:
 */
    __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xbc, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_v___pyx_PickleError);
    __pyx_t_2 = __pyx_v___pyx_PickleError; __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_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xbc518eb:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xbc518eb = (all, matches, mismatches))" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xbc518eb = (all, matches, mismatches))" % __pyx_checksum)
 *     __pyx_result = BaseqExt.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_BaseqExt__set_state(<BaseqExt> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_10pysamstats_3opt_BaseqExt), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __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_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v___pyx_result = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xbc518eb = (all, matches, mismatches))" % __pyx_checksum)
 *     __pyx_result = BaseqExt.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_BaseqExt__set_state(<BaseqExt> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
  __pyx_t_6 = (__pyx_t_1 != 0);
  if (__pyx_t_6) {

    /* "(tree fragment)":9
 *     __pyx_result = BaseqExt.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_BaseqExt__set_state(<BaseqExt> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_BaseqExt__set_state(BaseqExt __pyx_result, tuple __pyx_state):
 */
    if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_10pysamstats_3opt___pyx_unpickle_BaseqExt__set_state(((struct __pyx_obj_10pysamstats_3opt_BaseqExt *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xbc518eb = (all, matches, mismatches))" % __pyx_checksum)
 *     __pyx_result = BaseqExt.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_BaseqExt__set_state(<BaseqExt> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_BaseqExt__set_state(<BaseqExt> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_BaseqExt__set_state(BaseqExt __pyx_result, tuple __pyx_state):
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.matches = __pyx_state[1]; __pyx_result.mismatches = __pyx_state[2]
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_BaseqExt(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_BaseqExt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_BaseqExt__set_state(<BaseqExt> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_BaseqExt__set_state(BaseqExt __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.matches = __pyx_state[1]; __pyx_result.mismatches = __pyx_state[2]
 *     if len(__pyx_state) > 3 and hasattr(__pyx_result, '__dict__'):
 */

static PyObject *__pyx_f_10pysamstats_3opt___pyx_unpickle_BaseqExt__set_state(struct __pyx_obj_10pysamstats_3opt_BaseqExt *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("__pyx_unpickle_BaseqExt__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_BaseqExt__set_state(BaseqExt __pyx_result, tuple __pyx_state):
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.matches = __pyx_state[1]; __pyx_result.mismatches = __pyx_state[2]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 3 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[3])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_BaseqPpHelper))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->all);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->all));
  __pyx_v___pyx_result->all = ((struct __pyx_obj_10pysamstats_3opt_BaseqPpHelper *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_BaseqPpHelper))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->matches);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->matches));
  __pyx_v___pyx_result->matches = ((struct __pyx_obj_10pysamstats_3opt_BaseqPpHelper *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_BaseqPpHelper))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->mismatches);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->mismatches));
  __pyx_v___pyx_result->mismatches = ((struct __pyx_obj_10pysamstats_3opt_BaseqPpHelper *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_BaseqExt__set_state(BaseqExt __pyx_result, tuple __pyx_state):
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.matches = __pyx_state[1]; __pyx_result.mismatches = __pyx_state[2]
 *     if len(__pyx_state) > 3 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[3])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 13, __pyx_L1_error)
  }
  __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_4 = ((__pyx_t_3 > 3) != 0);
  if (__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_5 = (__pyx_t_4 != 0);
  __pyx_t_2 = __pyx_t_5;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "(tree fragment)":14
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.matches = __pyx_state[1]; __pyx_result.mismatches = __pyx_state[2]
 *     if len(__pyx_state) > 3 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[3])             # <<<<<<<<<<<<<<
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 14, __pyx_L1_error)
    }
    __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_BaseqExt__set_state(BaseqExt __pyx_result, tuple __pyx_state):
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.matches = __pyx_state[1]; __pyx_result.mismatches = __pyx_state[2]
 *     if len(__pyx_state) > 3 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[3])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_BaseqExt__set_state(<BaseqExt> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_BaseqExt__set_state(BaseqExt __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.matches = __pyx_state[1]; __pyx_result.mismatches = __pyx_state[2]
 *     if len(__pyx_state) > 3 and hasattr(__pyx_result, '__dict__'):
 */

  /* 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_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_BaseqExt__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_BaseqExtStrand(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_72__pyx_unpickle_BaseqExtStrand(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_10pysamstats_3opt_71__pyx_unpickle_BaseqExtStrand[] = "__pyx_unpickle_BaseqExtStrand(__pyx_type, long __pyx_checksum, __pyx_state)";
static PyMethodDef __pyx_mdef_10pysamstats_3opt_72__pyx_unpickle_BaseqExtStrand = {"__pyx_unpickle_BaseqExtStrand", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pysamstats_3opt_72__pyx_unpickle_BaseqExtStrand, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pysamstats_3opt_71__pyx_unpickle_BaseqExtStrand};
static PyObject *__pyx_pw_10pysamstats_3opt_72__pyx_unpickle_BaseqExtStrand(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_BaseqExtStrand (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,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_pyx_type)) != 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_pyx_checksum)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_BaseqExtStrand", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_BaseqExtStrand", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_BaseqExtStrand") < 0)) __PYX_ERR(1, 1, __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___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_BaseqExtStrand", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_BaseqExtStrand", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_10pysamstats_3opt_71__pyx_unpickle_BaseqExtStrand(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

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

static PyObject *__pyx_pf_10pysamstats_3opt_71__pyx_unpickle_BaseqExtStrand(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("__pyx_unpickle_BaseqExtStrand", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xbc518eb:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xbc518eb = (all, matches, mismatches))" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xbc518eb) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xbc518eb:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xbc518eb = (all, matches, mismatches))" % __pyx_checksum)
 *     __pyx_result = BaseqExtStrand.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v___pyx_PickleError = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum != 0xbc518eb:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xbc518eb = (all, matches, mismatches))" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = BaseqExtStrand.__new__(__pyx_type)
 *     if __pyx_state is not None:
 */
    __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xbc, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_v___pyx_PickleError);
    __pyx_t_2 = __pyx_v___pyx_PickleError; __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_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xbc518eb:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xbc518eb = (all, matches, mismatches))" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xbc518eb = (all, matches, mismatches))" % __pyx_checksum)
 *     __pyx_result = BaseqExtStrand.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_BaseqExtStrand__set_state(<BaseqExtStrand> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_10pysamstats_3opt_BaseqExtStrand), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __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_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v___pyx_result = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xbc518eb = (all, matches, mismatches))" % __pyx_checksum)
 *     __pyx_result = BaseqExtStrand.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_BaseqExtStrand__set_state(<BaseqExtStrand> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
  __pyx_t_6 = (__pyx_t_1 != 0);
  if (__pyx_t_6) {

    /* "(tree fragment)":9
 *     __pyx_result = BaseqExtStrand.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_BaseqExtStrand__set_state(<BaseqExtStrand> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_BaseqExtStrand__set_state(BaseqExtStrand __pyx_result, tuple __pyx_state):
 */
    if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_10pysamstats_3opt___pyx_unpickle_BaseqExtStrand__set_state(((struct __pyx_obj_10pysamstats_3opt_BaseqExtStrand *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xbc518eb = (all, matches, mismatches))" % __pyx_checksum)
 *     __pyx_result = BaseqExtStrand.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_BaseqExtStrand__set_state(<BaseqExtStrand> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_BaseqExtStrand__set_state(<BaseqExtStrand> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_BaseqExtStrand__set_state(BaseqExtStrand __pyx_result, tuple __pyx_state):
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.matches = __pyx_state[1]; __pyx_result.mismatches = __pyx_state[2]
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_BaseqExtStrand(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_BaseqExtStrand", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_BaseqExtStrand__set_state(<BaseqExtStrand> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_BaseqExtStrand__set_state(BaseqExtStrand __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.matches = __pyx_state[1]; __pyx_result.mismatches = __pyx_state[2]
 *     if len(__pyx_state) > 3 and hasattr(__pyx_result, '__dict__'):
 */

static PyObject *__pyx_f_10pysamstats_3opt___pyx_unpickle_BaseqExtStrand__set_state(struct __pyx_obj_10pysamstats_3opt_BaseqExtStrand *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("__pyx_unpickle_BaseqExtStrand__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_BaseqExtStrand__set_state(BaseqExtStrand __pyx_result, tuple __pyx_state):
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.matches = __pyx_state[1]; __pyx_result.mismatches = __pyx_state[2]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 3 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[3])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_BaseqStrandPpHelper))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->all);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->all));
  __pyx_v___pyx_result->all = ((struct __pyx_obj_10pysamstats_3opt_BaseqStrandPpHelper *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_BaseqStrandPpHelper))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->matches);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->matches));
  __pyx_v___pyx_result->matches = ((struct __pyx_obj_10pysamstats_3opt_BaseqStrandPpHelper *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_BaseqStrandPpHelper))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->mismatches);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->mismatches));
  __pyx_v___pyx_result->mismatches = ((struct __pyx_obj_10pysamstats_3opt_BaseqStrandPpHelper *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_BaseqExtStrand__set_state(BaseqExtStrand __pyx_result, tuple __pyx_state):
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.matches = __pyx_state[1]; __pyx_result.mismatches = __pyx_state[2]
 *     if len(__pyx_state) > 3 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[3])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 13, __pyx_L1_error)
  }
  __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_4 = ((__pyx_t_3 > 3) != 0);
  if (__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_5 = (__pyx_t_4 != 0);
  __pyx_t_2 = __pyx_t_5;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "(tree fragment)":14
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.matches = __pyx_state[1]; __pyx_result.mismatches = __pyx_state[2]
 *     if len(__pyx_state) > 3 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[3])             # <<<<<<<<<<<<<<
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 14, __pyx_L1_error)
    }
    __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_BaseqExtStrand__set_state(BaseqExtStrand __pyx_result, tuple __pyx_state):
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.matches = __pyx_state[1]; __pyx_result.mismatches = __pyx_state[2]
 *     if len(__pyx_state) > 3 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[3])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_BaseqExtStrand__set_state(<BaseqExtStrand> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_BaseqExtStrand__set_state(BaseqExtStrand __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.matches = __pyx_state[1]; __pyx_result.mismatches = __pyx_state[2]
 *     if len(__pyx_state) > 3 and hasattr(__pyx_result, '__dict__'):
 */

  /* 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_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_BaseqExtStrand__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_CoverageGC(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_74__pyx_unpickle_CoverageGC(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_10pysamstats_3opt_73__pyx_unpickle_CoverageGC[] = "__pyx_unpickle_CoverageGC(__pyx_type, long __pyx_checksum, __pyx_state)";
static PyMethodDef __pyx_mdef_10pysamstats_3opt_74__pyx_unpickle_CoverageGC = {"__pyx_unpickle_CoverageGC", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pysamstats_3opt_74__pyx_unpickle_CoverageGC, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pysamstats_3opt_73__pyx_unpickle_CoverageGC};
static PyObject *__pyx_pw_10pysamstats_3opt_74__pyx_unpickle_CoverageGC(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_CoverageGC (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,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_pyx_type)) != 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_pyx_checksum)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_CoverageGC", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_CoverageGC", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_CoverageGC") < 0)) __PYX_ERR(1, 1, __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___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_CoverageGC", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_CoverageGC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_10pysamstats_3opt_73__pyx_unpickle_CoverageGC(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

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

static PyObject *__pyx_pf_10pysamstats_3opt_73__pyx_unpickle_CoverageGC(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("__pyx_unpickle_CoverageGC", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xad19be7:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xad19be7 = (reads, window_offset, window_size))" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xad19be7) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xad19be7:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xad19be7 = (reads, window_offset, window_size))" % __pyx_checksum)
 *     __pyx_result = CoverageGC.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v___pyx_PickleError = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum != 0xad19be7:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xad19be7 = (reads, window_offset, window_size))" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = CoverageGC.__new__(__pyx_type)
 *     if __pyx_state is not None:
 */
    __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xad, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_v___pyx_PickleError);
    __pyx_t_2 = __pyx_v___pyx_PickleError; __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_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xad19be7:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xad19be7 = (reads, window_offset, window_size))" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xad19be7 = (reads, window_offset, window_size))" % __pyx_checksum)
 *     __pyx_result = CoverageGC.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_CoverageGC__set_state(<CoverageGC> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_10pysamstats_3opt_CoverageGC), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __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_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v___pyx_result = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xad19be7 = (reads, window_offset, window_size))" % __pyx_checksum)
 *     __pyx_result = CoverageGC.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_CoverageGC__set_state(<CoverageGC> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
  __pyx_t_6 = (__pyx_t_1 != 0);
  if (__pyx_t_6) {

    /* "(tree fragment)":9
 *     __pyx_result = CoverageGC.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_CoverageGC__set_state(<CoverageGC> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_CoverageGC__set_state(CoverageGC __pyx_result, tuple __pyx_state):
 */
    if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_10pysamstats_3opt___pyx_unpickle_CoverageGC__set_state(((struct __pyx_obj_10pysamstats_3opt_CoverageGC *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xad19be7 = (reads, window_offset, window_size))" % __pyx_checksum)
 *     __pyx_result = CoverageGC.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_CoverageGC__set_state(<CoverageGC> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_CoverageGC__set_state(<CoverageGC> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_CoverageGC__set_state(CoverageGC __pyx_result, tuple __pyx_state):
 *     __pyx_result.reads = __pyx_state[0]; __pyx_result.window_offset = __pyx_state[1]; __pyx_result.window_size = __pyx_state[2]
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_CoverageGC(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_CoverageGC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_CoverageGC__set_state(<CoverageGC> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_CoverageGC__set_state(CoverageGC __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.reads = __pyx_state[0]; __pyx_result.window_offset = __pyx_state[1]; __pyx_result.window_size = __pyx_state[2]
 *     if len(__pyx_state) > 3 and hasattr(__pyx_result, '__dict__'):
 */

static PyObject *__pyx_f_10pysamstats_3opt___pyx_unpickle_CoverageGC__set_state(struct __pyx_obj_10pysamstats_3opt_CoverageGC *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  Py_ssize_t __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;
  __Pyx_RefNannySetupContext("__pyx_unpickle_CoverageGC__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_CoverageGC__set_state(CoverageGC __pyx_result, tuple __pyx_state):
 *     __pyx_result.reads = __pyx_state[0]; __pyx_result.window_offset = __pyx_state[1]; __pyx_result.window_size = __pyx_state[2]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 3 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[3])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10pysamstats_3opt_CountPp))))) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->reads);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->reads));
  __pyx_v___pyx_result->reads = ((struct __pyx_obj_10pysamstats_3opt_CountPp *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->window_offset = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->window_size = __pyx_t_2;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_CoverageGC__set_state(CoverageGC __pyx_result, tuple __pyx_state):
 *     __pyx_result.reads = __pyx_state[0]; __pyx_result.window_offset = __pyx_state[1]; __pyx_result.window_size = __pyx_state[2]
 *     if len(__pyx_state) > 3 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[3])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 13, __pyx_L1_error)
  }
  __pyx_t_4 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_5 = ((__pyx_t_4 > 3) != 0);
  if (__pyx_t_5) {
  } else {
    __pyx_t_3 = __pyx_t_5;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_5 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_6 = (__pyx_t_5 != 0);
  __pyx_t_3 = __pyx_t_6;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_3) {

    /* "(tree fragment)":14
 *     __pyx_result.reads = __pyx_state[0]; __pyx_result.window_offset = __pyx_state[1]; __pyx_result.window_size = __pyx_state[2]
 *     if len(__pyx_state) > 3 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[3])             # <<<<<<<<<<<<<<
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_update); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 14, __pyx_L1_error)
    }
    __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    __pyx_t_1 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_9, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_7);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_CoverageGC__set_state(CoverageGC __pyx_result, tuple __pyx_state):
 *     __pyx_result.reads = __pyx_state[0]; __pyx_result.window_offset = __pyx_state[1]; __pyx_result.window_size = __pyx_state[2]
 *     if len(__pyx_state) > 3 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[3])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_CoverageGC__set_state(<CoverageGC> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_CoverageGC__set_state(CoverageGC __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.reads = __pyx_state[0]; __pyx_result.window_offset = __pyx_state[1]; __pyx_result.window_size = __pyx_state[2]
 *     if len(__pyx_state) > 3 and hasattr(__pyx_result, '__dict__'):
 */

  /* 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_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_CoverageGC__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_BinnedStat(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_76__pyx_unpickle_BinnedStat(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_10pysamstats_3opt_75__pyx_unpickle_BinnedStat[] = "__pyx_unpickle_BinnedStat(__pyx_type, long __pyx_checksum, __pyx_state)";
static PyMethodDef __pyx_mdef_10pysamstats_3opt_76__pyx_unpickle_BinnedStat = {"__pyx_unpickle_BinnedStat", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pysamstats_3opt_76__pyx_unpickle_BinnedStat, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pysamstats_3opt_75__pyx_unpickle_BinnedStat};
static PyObject *__pyx_pw_10pysamstats_3opt_76__pyx_unpickle_BinnedStat(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_BinnedStat (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,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_pyx_type)) != 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_pyx_checksum)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_BinnedStat", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_BinnedStat", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_BinnedStat") < 0)) __PYX_ERR(1, 1, __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___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_BinnedStat", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_BinnedStat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_10pysamstats_3opt_75__pyx_unpickle_BinnedStat(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

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

static PyObject *__pyx_pf_10pysamstats_3opt_75__pyx_unpickle_BinnedStat(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("__pyx_unpickle_BinnedStat", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xd41d8cd:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xd41d8cd) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xd41d8cd:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = BinnedStat.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v___pyx_PickleError = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum != 0xd41d8cd:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = BinnedStat.__new__(__pyx_type)
 *     if __pyx_state is not None:
 */
    __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xd4, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_v___pyx_PickleError);
    __pyx_t_2 = __pyx_v___pyx_PickleError; __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_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xd41d8cd:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = BinnedStat.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_BinnedStat__set_state(<BinnedStat> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_10pysamstats_3opt_BinnedStat), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __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_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v___pyx_result = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = BinnedStat.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_BinnedStat__set_state(<BinnedStat> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
  __pyx_t_6 = (__pyx_t_1 != 0);
  if (__pyx_t_6) {

    /* "(tree fragment)":9
 *     __pyx_result = BinnedStat.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_BinnedStat__set_state(<BinnedStat> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_BinnedStat__set_state(BinnedStat __pyx_result, tuple __pyx_state):
 */
    if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_10pysamstats_3opt___pyx_unpickle_BinnedStat__set_state(((struct __pyx_obj_10pysamstats_3opt_BinnedStat *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = BinnedStat.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_BinnedStat__set_state(<BinnedStat> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_BinnedStat__set_state(<BinnedStat> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_BinnedStat__set_state(BinnedStat __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_BinnedStat(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_BinnedStat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_BinnedStat__set_state(<BinnedStat> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_BinnedStat__set_state(BinnedStat __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */

static PyObject *__pyx_f_10pysamstats_3opt___pyx_unpickle_BinnedStat__set_state(struct __pyx_obj_10pysamstats_3opt_BinnedStat *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("__pyx_unpickle_BinnedStat__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_BinnedStat__set_state(BinnedStat __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_2 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(1, 12, __pyx_L1_error)
  __pyx_t_3 = ((__pyx_t_2 > 0) != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 12, __pyx_L1_error)
  __pyx_t_4 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_BinnedStat__set_state(BinnedStat __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])             # <<<<<<<<<<<<<<
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 13, __pyx_L1_error)
    }
    __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_BinnedStat__set_state(BinnedStat __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_BinnedStat__set_state(<BinnedStat> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_BinnedStat__set_state(BinnedStat __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_BinnedStat__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_CoverageBinned(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_78__pyx_unpickle_CoverageBinned(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_10pysamstats_3opt_77__pyx_unpickle_CoverageBinned[] = "__pyx_unpickle_CoverageBinned(__pyx_type, long __pyx_checksum, __pyx_state)";
static PyMethodDef __pyx_mdef_10pysamstats_3opt_78__pyx_unpickle_CoverageBinned = {"__pyx_unpickle_CoverageBinned", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pysamstats_3opt_78__pyx_unpickle_CoverageBinned, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pysamstats_3opt_77__pyx_unpickle_CoverageBinned};
static PyObject *__pyx_pw_10pysamstats_3opt_78__pyx_unpickle_CoverageBinned(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_CoverageBinned (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,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_pyx_type)) != 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_pyx_checksum)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_CoverageBinned", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_CoverageBinned", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_CoverageBinned") < 0)) __PYX_ERR(1, 1, __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___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_CoverageBinned", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_CoverageBinned", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_10pysamstats_3opt_77__pyx_unpickle_CoverageBinned(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

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

static PyObject *__pyx_pf_10pysamstats_3opt_77__pyx_unpickle_CoverageBinned(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("__pyx_unpickle_CoverageBinned", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xce7bb01:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xce7bb01 = (reads_all, reads_pp))" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xce7bb01) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xce7bb01:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xce7bb01 = (reads_all, reads_pp))" % __pyx_checksum)
 *     __pyx_result = CoverageBinned.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v___pyx_PickleError = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum != 0xce7bb01:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xce7bb01 = (reads_all, reads_pp))" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = CoverageBinned.__new__(__pyx_type)
 *     if __pyx_state is not None:
 */
    __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xce, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_v___pyx_PickleError);
    __pyx_t_2 = __pyx_v___pyx_PickleError; __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_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xce7bb01:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xce7bb01 = (reads_all, reads_pp))" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xce7bb01 = (reads_all, reads_pp))" % __pyx_checksum)
 *     __pyx_result = CoverageBinned.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_CoverageBinned__set_state(<CoverageBinned> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_10pysamstats_3opt_CoverageBinned), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __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_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v___pyx_result = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xce7bb01 = (reads_all, reads_pp))" % __pyx_checksum)
 *     __pyx_result = CoverageBinned.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_CoverageBinned__set_state(<CoverageBinned> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
  __pyx_t_6 = (__pyx_t_1 != 0);
  if (__pyx_t_6) {

    /* "(tree fragment)":9
 *     __pyx_result = CoverageBinned.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_CoverageBinned__set_state(<CoverageBinned> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_CoverageBinned__set_state(CoverageBinned __pyx_result, tuple __pyx_state):
 */
    if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_10pysamstats_3opt___pyx_unpickle_CoverageBinned__set_state(((struct __pyx_obj_10pysamstats_3opt_CoverageBinned *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xce7bb01 = (reads_all, reads_pp))" % __pyx_checksum)
 *     __pyx_result = CoverageBinned.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_CoverageBinned__set_state(<CoverageBinned> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_CoverageBinned__set_state(<CoverageBinned> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_CoverageBinned__set_state(CoverageBinned __pyx_result, tuple __pyx_state):
 *     __pyx_result.reads_all = __pyx_state[0]; __pyx_result.reads_pp = __pyx_state[1]
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_CoverageBinned(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_CoverageBinned", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_CoverageBinned__set_state(<CoverageBinned> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_CoverageBinned__set_state(CoverageBinned __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.reads_all = __pyx_state[0]; __pyx_result.reads_pp = __pyx_state[1]
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):
 */

static PyObject *__pyx_f_10pysamstats_3opt___pyx_unpickle_CoverageBinned__set_state(struct __pyx_obj_10pysamstats_3opt_CoverageBinned *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  Py_ssize_t __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;
  __Pyx_RefNannySetupContext("__pyx_unpickle_CoverageBinned__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_CoverageBinned__set_state(CoverageBinned __pyx_result, tuple __pyx_state):
 *     __pyx_result.reads_all = __pyx_state[0]; __pyx_result.reads_pp = __pyx_state[1]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[2])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->reads_all = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->reads_pp = __pyx_t_2;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_CoverageBinned__set_state(CoverageBinned __pyx_result, tuple __pyx_state):
 *     __pyx_result.reads_all = __pyx_state[0]; __pyx_result.reads_pp = __pyx_state[1]
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[2])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 13, __pyx_L1_error)
  }
  __pyx_t_4 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_5 = ((__pyx_t_4 > 2) != 0);
  if (__pyx_t_5) {
  } else {
    __pyx_t_3 = __pyx_t_5;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_5 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_6 = (__pyx_t_5 != 0);
  __pyx_t_3 = __pyx_t_6;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_3) {

    /* "(tree fragment)":14
 *     __pyx_result.reads_all = __pyx_state[0]; __pyx_result.reads_pp = __pyx_state[1]
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[2])             # <<<<<<<<<<<<<<
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_update); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 14, __pyx_L1_error)
    }
    __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    __pyx_t_1 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_9, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_7);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_CoverageBinned__set_state(CoverageBinned __pyx_result, tuple __pyx_state):
 *     __pyx_result.reads_all = __pyx_state[0]; __pyx_result.reads_pp = __pyx_state[1]
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[2])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_CoverageBinned__set_state(<CoverageBinned> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_CoverageBinned__set_state(CoverageBinned __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.reads_all = __pyx_state[0]; __pyx_result.reads_pp = __pyx_state[1]
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):
 */

  /* 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_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_CoverageBinned__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_CoverageExtBinned(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_80__pyx_unpickle_CoverageExtBinned(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_10pysamstats_3opt_79__pyx_unpickle_CoverageExtBinned[] = "__pyx_unpickle_CoverageExtBinned(__pyx_type, long __pyx_checksum, __pyx_state)";
static PyMethodDef __pyx_mdef_10pysamstats_3opt_80__pyx_unpickle_CoverageExtBinned = {"__pyx_unpickle_CoverageExtBinned", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pysamstats_3opt_80__pyx_unpickle_CoverageExtBinned, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pysamstats_3opt_79__pyx_unpickle_CoverageExtBinned};
static PyObject *__pyx_pw_10pysamstats_3opt_80__pyx_unpickle_CoverageExtBinned(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_CoverageExtBinned (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,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_pyx_type)) != 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_pyx_checksum)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_CoverageExtBinned", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_CoverageExtBinned", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_CoverageExtBinned") < 0)) __PYX_ERR(1, 1, __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___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_CoverageExtBinned", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_CoverageExtBinned", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_10pysamstats_3opt_79__pyx_unpickle_CoverageExtBinned(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

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

static PyObject *__pyx_pf_10pysamstats_3opt_79__pyx_unpickle_CoverageExtBinned(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("__pyx_unpickle_CoverageExtBinned", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xdc660eb:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xdc660eb = (reads_all, reads_duplicate, reads_faceaway, reads_mate_other_chr, reads_mate_same_strand, reads_mate_unmapped, reads_pp, reads_softclipped))" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xdc660eb) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xdc660eb:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xdc660eb = (reads_all, reads_duplicate, reads_faceaway, reads_mate_other_chr, reads_mate_same_strand, reads_mate_unmapped, reads_pp, reads_softclipped))" % __pyx_checksum)
 *     __pyx_result = CoverageExtBinned.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v___pyx_PickleError = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum != 0xdc660eb:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xdc660eb = (reads_all, reads_duplicate, reads_faceaway, reads_mate_other_chr, reads_mate_same_strand, reads_mate_unmapped, reads_pp, reads_softclipped))" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = CoverageExtBinned.__new__(__pyx_type)
 *     if __pyx_state is not None:
 */
    __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xdc, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_v___pyx_PickleError);
    __pyx_t_2 = __pyx_v___pyx_PickleError; __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_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xdc660eb:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xdc660eb = (reads_all, reads_duplicate, reads_faceaway, reads_mate_other_chr, reads_mate_same_strand, reads_mate_unmapped, reads_pp, reads_softclipped))" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xdc660eb = (reads_all, reads_duplicate, reads_faceaway, reads_mate_other_chr, reads_mate_same_strand, reads_mate_unmapped, reads_pp, reads_softclipped))" % __pyx_checksum)
 *     __pyx_result = CoverageExtBinned.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_CoverageExtBinned__set_state(<CoverageExtBinned> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_10pysamstats_3opt_CoverageExtBinned), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __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_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v___pyx_result = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xdc660eb = (reads_all, reads_duplicate, reads_faceaway, reads_mate_other_chr, reads_mate_same_strand, reads_mate_unmapped, reads_pp, reads_softclipped))" % __pyx_checksum)
 *     __pyx_result = CoverageExtBinned.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_CoverageExtBinned__set_state(<CoverageExtBinned> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
  __pyx_t_6 = (__pyx_t_1 != 0);
  if (__pyx_t_6) {

    /* "(tree fragment)":9
 *     __pyx_result = CoverageExtBinned.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_CoverageExtBinned__set_state(<CoverageExtBinned> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_CoverageExtBinned__set_state(CoverageExtBinned __pyx_result, tuple __pyx_state):
 */
    if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_10pysamstats_3opt___pyx_unpickle_CoverageExtBinned__set_state(((struct __pyx_obj_10pysamstats_3opt_CoverageExtBinned *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xdc660eb = (reads_all, reads_duplicate, reads_faceaway, reads_mate_other_chr, reads_mate_same_strand, reads_mate_unmapped, reads_pp, reads_softclipped))" % __pyx_checksum)
 *     __pyx_result = CoverageExtBinned.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_CoverageExtBinned__set_state(<CoverageExtBinned> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_CoverageExtBinned__set_state(<CoverageExtBinned> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_CoverageExtBinned__set_state(CoverageExtBinned __pyx_result, tuple __pyx_state):
 *     __pyx_result.reads_all = __pyx_state[0]; __pyx_result.reads_duplicate = __pyx_state[1]; __pyx_result.reads_faceaway = __pyx_state[2]; __pyx_result.reads_mate_other_chr = __pyx_state[3]; __pyx_result.reads_mate_same_strand = __pyx_state[4]; __pyx_result.reads_mate_unmapped = __pyx_state[5]; __pyx_result.reads_pp = __pyx_state[6]; __pyx_result.reads_softclipped = __pyx_state[7]
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_CoverageExtBinned(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_CoverageExtBinned", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_CoverageExtBinned__set_state(<CoverageExtBinned> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_CoverageExtBinned__set_state(CoverageExtBinned __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.reads_all = __pyx_state[0]; __pyx_result.reads_duplicate = __pyx_state[1]; __pyx_result.reads_faceaway = __pyx_state[2]; __pyx_result.reads_mate_other_chr = __pyx_state[3]; __pyx_result.reads_mate_same_strand = __pyx_state[4]; __pyx_result.reads_mate_unmapped = __pyx_state[5]; __pyx_result.reads_pp = __pyx_state[6]; __pyx_result.reads_softclipped = __pyx_state[7]
 *     if len(__pyx_state) > 8 and hasattr(__pyx_result, '__dict__'):
 */

static PyObject *__pyx_f_10pysamstats_3opt___pyx_unpickle_CoverageExtBinned__set_state(struct __pyx_obj_10pysamstats_3opt_CoverageExtBinned *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  Py_ssize_t __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;
  __Pyx_RefNannySetupContext("__pyx_unpickle_CoverageExtBinned__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_CoverageExtBinned__set_state(CoverageExtBinned __pyx_result, tuple __pyx_state):
 *     __pyx_result.reads_all = __pyx_state[0]; __pyx_result.reads_duplicate = __pyx_state[1]; __pyx_result.reads_faceaway = __pyx_state[2]; __pyx_result.reads_mate_other_chr = __pyx_state[3]; __pyx_result.reads_mate_same_strand = __pyx_state[4]; __pyx_result.reads_mate_unmapped = __pyx_state[5]; __pyx_result.reads_pp = __pyx_state[6]; __pyx_result.reads_softclipped = __pyx_state[7]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 8 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[8])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->reads_all = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->reads_duplicate = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->reads_faceaway = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->reads_mate_other_chr = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->reads_mate_same_strand = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 5, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->reads_mate_unmapped = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 6, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->reads_pp = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 7, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->reads_softclipped = __pyx_t_2;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_CoverageExtBinned__set_state(CoverageExtBinned __pyx_result, tuple __pyx_state):
 *     __pyx_result.reads_all = __pyx_state[0]; __pyx_result.reads_duplicate = __pyx_state[1]; __pyx_result.reads_faceaway = __pyx_state[2]; __pyx_result.reads_mate_other_chr = __pyx_state[3]; __pyx_result.reads_mate_same_strand = __pyx_state[4]; __pyx_result.reads_mate_unmapped = __pyx_state[5]; __pyx_result.reads_pp = __pyx_state[6]; __pyx_result.reads_softclipped = __pyx_state[7]
 *     if len(__pyx_state) > 8 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[8])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 13, __pyx_L1_error)
  }
  __pyx_t_4 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_5 = ((__pyx_t_4 > 8) != 0);
  if (__pyx_t_5) {
  } else {
    __pyx_t_3 = __pyx_t_5;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_5 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_6 = (__pyx_t_5 != 0);
  __pyx_t_3 = __pyx_t_6;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_3) {

    /* "(tree fragment)":14
 *     __pyx_result.reads_all = __pyx_state[0]; __pyx_result.reads_duplicate = __pyx_state[1]; __pyx_result.reads_faceaway = __pyx_state[2]; __pyx_result.reads_mate_other_chr = __pyx_state[3]; __pyx_result.reads_mate_same_strand = __pyx_state[4]; __pyx_result.reads_mate_unmapped = __pyx_state[5]; __pyx_result.reads_pp = __pyx_state[6]; __pyx_result.reads_softclipped = __pyx_state[7]
 *     if len(__pyx_state) > 8 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[8])             # <<<<<<<<<<<<<<
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_update); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 14, __pyx_L1_error)
    }
    __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 8, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    __pyx_t_1 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_9, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_7);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_CoverageExtBinned__set_state(CoverageExtBinned __pyx_result, tuple __pyx_state):
 *     __pyx_result.reads_all = __pyx_state[0]; __pyx_result.reads_duplicate = __pyx_state[1]; __pyx_result.reads_faceaway = __pyx_state[2]; __pyx_result.reads_mate_other_chr = __pyx_state[3]; __pyx_result.reads_mate_same_strand = __pyx_state[4]; __pyx_result.reads_mate_unmapped = __pyx_state[5]; __pyx_result.reads_pp = __pyx_state[6]; __pyx_result.reads_softclipped = __pyx_state[7]
 *     if len(__pyx_state) > 8 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[8])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_CoverageExtBinned__set_state(<CoverageExtBinned> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_CoverageExtBinned__set_state(CoverageExtBinned __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.reads_all = __pyx_state[0]; __pyx_result.reads_duplicate = __pyx_state[1]; __pyx_result.reads_faceaway = __pyx_state[2]; __pyx_result.reads_mate_other_chr = __pyx_state[3]; __pyx_result.reads_mate_same_strand = __pyx_state[4]; __pyx_result.reads_mate_unmapped = __pyx_state[5]; __pyx_result.reads_pp = __pyx_state[6]; __pyx_result.reads_softclipped = __pyx_state[7]
 *     if len(__pyx_state) > 8 and hasattr(__pyx_result, '__dict__'):
 */

  /* 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_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_CoverageExtBinned__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_MapqBinned(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_82__pyx_unpickle_MapqBinned(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_10pysamstats_3opt_81__pyx_unpickle_MapqBinned[] = "__pyx_unpickle_MapqBinned(__pyx_type, long __pyx_checksum, __pyx_state)";
static PyMethodDef __pyx_mdef_10pysamstats_3opt_82__pyx_unpickle_MapqBinned = {"__pyx_unpickle_MapqBinned", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pysamstats_3opt_82__pyx_unpickle_MapqBinned, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pysamstats_3opt_81__pyx_unpickle_MapqBinned};
static PyObject *__pyx_pw_10pysamstats_3opt_82__pyx_unpickle_MapqBinned(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_MapqBinned (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,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_pyx_type)) != 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_pyx_checksum)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_MapqBinned", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_MapqBinned", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_MapqBinned") < 0)) __PYX_ERR(1, 1, __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___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_MapqBinned", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_MapqBinned", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_10pysamstats_3opt_81__pyx_unpickle_MapqBinned(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

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

static PyObject *__pyx_pf_10pysamstats_3opt_81__pyx_unpickle_MapqBinned(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("__pyx_unpickle_MapqBinned", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x3af741f:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x3af741f = (mapq, mapq_squared_sum, reads_all, reads_mapq0))" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0x3af741f) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x3af741f:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x3af741f = (mapq, mapq_squared_sum, reads_all, reads_mapq0))" % __pyx_checksum)
 *     __pyx_result = MapqBinned.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v___pyx_PickleError = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum != 0x3af741f:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x3af741f = (mapq, mapq_squared_sum, reads_all, reads_mapq0))" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = MapqBinned.__new__(__pyx_type)
 *     if __pyx_state is not None:
 */
    __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0x3a, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_v___pyx_PickleError);
    __pyx_t_2 = __pyx_v___pyx_PickleError; __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_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x3af741f:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x3af741f = (mapq, mapq_squared_sum, reads_all, reads_mapq0))" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x3af741f = (mapq, mapq_squared_sum, reads_all, reads_mapq0))" % __pyx_checksum)
 *     __pyx_result = MapqBinned.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_MapqBinned__set_state(<MapqBinned> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_10pysamstats_3opt_MapqBinned), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __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_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v___pyx_result = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x3af741f = (mapq, mapq_squared_sum, reads_all, reads_mapq0))" % __pyx_checksum)
 *     __pyx_result = MapqBinned.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_MapqBinned__set_state(<MapqBinned> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
  __pyx_t_6 = (__pyx_t_1 != 0);
  if (__pyx_t_6) {

    /* "(tree fragment)":9
 *     __pyx_result = MapqBinned.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_MapqBinned__set_state(<MapqBinned> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_MapqBinned__set_state(MapqBinned __pyx_result, tuple __pyx_state):
 */
    if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_10pysamstats_3opt___pyx_unpickle_MapqBinned__set_state(((struct __pyx_obj_10pysamstats_3opt_MapqBinned *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x3af741f = (mapq, mapq_squared_sum, reads_all, reads_mapq0))" % __pyx_checksum)
 *     __pyx_result = MapqBinned.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_MapqBinned__set_state(<MapqBinned> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_MapqBinned__set_state(<MapqBinned> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_MapqBinned__set_state(MapqBinned __pyx_result, tuple __pyx_state):
 *     __pyx_result.mapq = __pyx_state[0]; __pyx_result.mapq_squared_sum = __pyx_state[1]; __pyx_result.reads_all = __pyx_state[2]; __pyx_result.reads_mapq0 = __pyx_state[3]
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_MapqBinned(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_MapqBinned", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_MapqBinned__set_state(<MapqBinned> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_MapqBinned__set_state(MapqBinned __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.mapq = __pyx_state[0]; __pyx_result.mapq_squared_sum = __pyx_state[1]; __pyx_result.reads_all = __pyx_state[2]; __pyx_result.reads_mapq0 = __pyx_state[3]
 *     if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'):
 */

static PyObject *__pyx_f_10pysamstats_3opt___pyx_unpickle_MapqBinned__set_state(struct __pyx_obj_10pysamstats_3opt_MapqBinned *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  uint64_t __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  __Pyx_RefNannySetupContext("__pyx_unpickle_MapqBinned__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_MapqBinned__set_state(MapqBinned __pyx_result, tuple __pyx_state):
 *     __pyx_result.mapq = __pyx_state[0]; __pyx_result.mapq_squared_sum = __pyx_state[1]; __pyx_result.reads_all = __pyx_state[2]; __pyx_result.reads_mapq0 = __pyx_state[3]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[4])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_uint64_t(__pyx_t_1); if (unlikely((__pyx_t_2 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->mapq = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_uint64_t(__pyx_t_1); if (unlikely((__pyx_t_2 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->mapq_squared_sum = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->reads_all = __pyx_t_3;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->reads_mapq0 = __pyx_t_3;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_MapqBinned__set_state(MapqBinned __pyx_result, tuple __pyx_state):
 *     __pyx_result.mapq = __pyx_state[0]; __pyx_result.mapq_squared_sum = __pyx_state[1]; __pyx_result.reads_all = __pyx_state[2]; __pyx_result.reads_mapq0 = __pyx_state[3]
 *     if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[4])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 13, __pyx_L1_error)
  }
  __pyx_t_5 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_6 = ((__pyx_t_5 > 4) != 0);
  if (__pyx_t_6) {
  } else {
    __pyx_t_4 = __pyx_t_6;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_6 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_7 = (__pyx_t_6 != 0);
  __pyx_t_4 = __pyx_t_7;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_4) {

    /* "(tree fragment)":14
 *     __pyx_result.mapq = __pyx_state[0]; __pyx_result.mapq_squared_sum = __pyx_state[1]; __pyx_result.reads_all = __pyx_state[2]; __pyx_result.reads_mapq0 = __pyx_state[3]
 *     if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[4])             # <<<<<<<<<<<<<<
 */
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_update); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 14, __pyx_L1_error)
    }
    __pyx_t_8 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __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_1 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_10, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_8);
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_MapqBinned__set_state(MapqBinned __pyx_result, tuple __pyx_state):
 *     __pyx_result.mapq = __pyx_state[0]; __pyx_result.mapq_squared_sum = __pyx_state[1]; __pyx_result.reads_all = __pyx_state[2]; __pyx_result.reads_mapq0 = __pyx_state[3]
 *     if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[4])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_MapqBinned__set_state(<MapqBinned> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_MapqBinned__set_state(MapqBinned __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.mapq = __pyx_state[0]; __pyx_result.mapq_squared_sum = __pyx_state[1]; __pyx_result.reads_all = __pyx_state[2]; __pyx_result.reads_mapq0 = __pyx_state[3]
 *     if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'):
 */

  /* 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_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_MapqBinned__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_AlignmentBinned(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_84__pyx_unpickle_AlignmentBinned(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_10pysamstats_3opt_83__pyx_unpickle_AlignmentBinned[] = "__pyx_unpickle_AlignmentBinned(__pyx_type, long __pyx_checksum, __pyx_state)";
static PyMethodDef __pyx_mdef_10pysamstats_3opt_84__pyx_unpickle_AlignmentBinned = {"__pyx_unpickle_AlignmentBinned", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pysamstats_3opt_84__pyx_unpickle_AlignmentBinned, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pysamstats_3opt_83__pyx_unpickle_AlignmentBinned};
static PyObject *__pyx_pw_10pysamstats_3opt_84__pyx_unpickle_AlignmentBinned(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_AlignmentBinned (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,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_pyx_type)) != 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_pyx_checksum)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_AlignmentBinned", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_AlignmentBinned", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_AlignmentBinned") < 0)) __PYX_ERR(1, 1, __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___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_AlignmentBinned", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_AlignmentBinned", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_10pysamstats_3opt_83__pyx_unpickle_AlignmentBinned(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

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

static PyObject *__pyx_pf_10pysamstats_3opt_83__pyx_unpickle_AlignmentBinned(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("__pyx_unpickle_AlignmentBinned", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x6770c51:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x6770c51 = (D, EQ, H, I, M, N, P, S, X, reads_all))" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0x6770c51) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x6770c51:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x6770c51 = (D, EQ, H, I, M, N, P, S, X, reads_all))" % __pyx_checksum)
 *     __pyx_result = AlignmentBinned.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v___pyx_PickleError = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum != 0x6770c51:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x6770c51 = (D, EQ, H, I, M, N, P, S, X, reads_all))" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = AlignmentBinned.__new__(__pyx_type)
 *     if __pyx_state is not None:
 */
    __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0x67, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_v___pyx_PickleError);
    __pyx_t_2 = __pyx_v___pyx_PickleError; __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_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x6770c51:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x6770c51 = (D, EQ, H, I, M, N, P, S, X, reads_all))" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x6770c51 = (D, EQ, H, I, M, N, P, S, X, reads_all))" % __pyx_checksum)
 *     __pyx_result = AlignmentBinned.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_AlignmentBinned__set_state(<AlignmentBinned> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_10pysamstats_3opt_AlignmentBinned), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __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_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v___pyx_result = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x6770c51 = (D, EQ, H, I, M, N, P, S, X, reads_all))" % __pyx_checksum)
 *     __pyx_result = AlignmentBinned.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_AlignmentBinned__set_state(<AlignmentBinned> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
  __pyx_t_6 = (__pyx_t_1 != 0);
  if (__pyx_t_6) {

    /* "(tree fragment)":9
 *     __pyx_result = AlignmentBinned.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_AlignmentBinned__set_state(<AlignmentBinned> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_AlignmentBinned__set_state(AlignmentBinned __pyx_result, tuple __pyx_state):
 */
    if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_10pysamstats_3opt___pyx_unpickle_AlignmentBinned__set_state(((struct __pyx_obj_10pysamstats_3opt_AlignmentBinned *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x6770c51 = (D, EQ, H, I, M, N, P, S, X, reads_all))" % __pyx_checksum)
 *     __pyx_result = AlignmentBinned.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_AlignmentBinned__set_state(<AlignmentBinned> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_AlignmentBinned__set_state(<AlignmentBinned> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_AlignmentBinned__set_state(AlignmentBinned __pyx_result, tuple __pyx_state):
 *     __pyx_result.D = __pyx_state[0]; __pyx_result.EQ = __pyx_state[1]; __pyx_result.H = __pyx_state[2]; __pyx_result.I = __pyx_state[3]; __pyx_result.M = __pyx_state[4]; __pyx_result.N = __pyx_state[5]; __pyx_result.P = __pyx_state[6]; __pyx_result.S = __pyx_state[7]; __pyx_result.X = __pyx_state[8]; __pyx_result.reads_all = __pyx_state[9]
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_AlignmentBinned(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_AlignmentBinned", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_AlignmentBinned__set_state(<AlignmentBinned> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_AlignmentBinned__set_state(AlignmentBinned __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.D = __pyx_state[0]; __pyx_result.EQ = __pyx_state[1]; __pyx_result.H = __pyx_state[2]; __pyx_result.I = __pyx_state[3]; __pyx_result.M = __pyx_state[4]; __pyx_result.N = __pyx_state[5]; __pyx_result.P = __pyx_state[6]; __pyx_result.S = __pyx_state[7]; __pyx_result.X = __pyx_state[8]; __pyx_result.reads_all = __pyx_state[9]
 *     if len(__pyx_state) > 10 and hasattr(__pyx_result, '__dict__'):
 */

static PyObject *__pyx_f_10pysamstats_3opt___pyx_unpickle_AlignmentBinned__set_state(struct __pyx_obj_10pysamstats_3opt_AlignmentBinned *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  Py_ssize_t __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;
  __Pyx_RefNannySetupContext("__pyx_unpickle_AlignmentBinned__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_AlignmentBinned__set_state(AlignmentBinned __pyx_result, tuple __pyx_state):
 *     __pyx_result.D = __pyx_state[0]; __pyx_result.EQ = __pyx_state[1]; __pyx_result.H = __pyx_state[2]; __pyx_result.I = __pyx_state[3]; __pyx_result.M = __pyx_state[4]; __pyx_result.N = __pyx_state[5]; __pyx_result.P = __pyx_state[6]; __pyx_result.S = __pyx_state[7]; __pyx_result.X = __pyx_state[8]; __pyx_result.reads_all = __pyx_state[9]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 10 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[10])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->D = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->EQ = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->H = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->I = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->M = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 5, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->N = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 6, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->P = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 7, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->S = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 8, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->X = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 9, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->reads_all = __pyx_t_2;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_AlignmentBinned__set_state(AlignmentBinned __pyx_result, tuple __pyx_state):
 *     __pyx_result.D = __pyx_state[0]; __pyx_result.EQ = __pyx_state[1]; __pyx_result.H = __pyx_state[2]; __pyx_result.I = __pyx_state[3]; __pyx_result.M = __pyx_state[4]; __pyx_result.N = __pyx_state[5]; __pyx_result.P = __pyx_state[6]; __pyx_result.S = __pyx_state[7]; __pyx_result.X = __pyx_state[8]; __pyx_result.reads_all = __pyx_state[9]
 *     if len(__pyx_state) > 10 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[10])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 13, __pyx_L1_error)
  }
  __pyx_t_4 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_5 = ((__pyx_t_4 > 10) != 0);
  if (__pyx_t_5) {
  } else {
    __pyx_t_3 = __pyx_t_5;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_5 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_6 = (__pyx_t_5 != 0);
  __pyx_t_3 = __pyx_t_6;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_3) {

    /* "(tree fragment)":14
 *     __pyx_result.D = __pyx_state[0]; __pyx_result.EQ = __pyx_state[1]; __pyx_result.H = __pyx_state[2]; __pyx_result.I = __pyx_state[3]; __pyx_result.M = __pyx_state[4]; __pyx_result.N = __pyx_state[5]; __pyx_result.P = __pyx_state[6]; __pyx_result.S = __pyx_state[7]; __pyx_result.X = __pyx_state[8]; __pyx_result.reads_all = __pyx_state[9]
 *     if len(__pyx_state) > 10 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[10])             # <<<<<<<<<<<<<<
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_update); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 14, __pyx_L1_error)
    }
    __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 10, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    __pyx_t_1 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_9, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_7);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_AlignmentBinned__set_state(AlignmentBinned __pyx_result, tuple __pyx_state):
 *     __pyx_result.D = __pyx_state[0]; __pyx_result.EQ = __pyx_state[1]; __pyx_result.H = __pyx_state[2]; __pyx_result.I = __pyx_state[3]; __pyx_result.M = __pyx_state[4]; __pyx_result.N = __pyx_state[5]; __pyx_result.P = __pyx_state[6]; __pyx_result.S = __pyx_state[7]; __pyx_result.X = __pyx_state[8]; __pyx_result.reads_all = __pyx_state[9]
 *     if len(__pyx_state) > 10 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[10])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_AlignmentBinned__set_state(<AlignmentBinned> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_AlignmentBinned__set_state(AlignmentBinned __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.D = __pyx_state[0]; __pyx_result.EQ = __pyx_state[1]; __pyx_result.H = __pyx_state[2]; __pyx_result.I = __pyx_state[3]; __pyx_result.M = __pyx_state[4]; __pyx_result.N = __pyx_state[5]; __pyx_result.P = __pyx_state[6]; __pyx_result.S = __pyx_state[7]; __pyx_result.X = __pyx_state[8]; __pyx_result.reads_all = __pyx_state[9]
 *     if len(__pyx_state) > 10 and hasattr(__pyx_result, '__dict__'):
 */

  /* 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_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_AlignmentBinned__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_TlenBinned(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pysamstats_3opt_86__pyx_unpickle_TlenBinned(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_10pysamstats_3opt_85__pyx_unpickle_TlenBinned[] = "__pyx_unpickle_TlenBinned(__pyx_type, long __pyx_checksum, __pyx_state)";
static PyMethodDef __pyx_mdef_10pysamstats_3opt_86__pyx_unpickle_TlenBinned = {"__pyx_unpickle_TlenBinned", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pysamstats_3opt_86__pyx_unpickle_TlenBinned, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pysamstats_3opt_85__pyx_unpickle_TlenBinned};
static PyObject *__pyx_pw_10pysamstats_3opt_86__pyx_unpickle_TlenBinned(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_TlenBinned (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,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_pyx_type)) != 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_pyx_checksum)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_TlenBinned", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_TlenBinned", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_TlenBinned") < 0)) __PYX_ERR(1, 1, __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___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_TlenBinned", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_TlenBinned", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_10pysamstats_3opt_85__pyx_unpickle_TlenBinned(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

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

static PyObject *__pyx_pf_10pysamstats_3opt_85__pyx_unpickle_TlenBinned(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("__pyx_unpickle_TlenBinned", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x87ba974:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x87ba974 = (reads_all, reads_pp, tlen_pp_squared_sum, tlen_pp_sum, tlen_squared_sum, tlen_sum))" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0x87ba974) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x87ba974:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x87ba974 = (reads_all, reads_pp, tlen_pp_squared_sum, tlen_pp_sum, tlen_squared_sum, tlen_sum))" % __pyx_checksum)
 *     __pyx_result = TlenBinned.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v___pyx_PickleError = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum != 0x87ba974:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x87ba974 = (reads_all, reads_pp, tlen_pp_squared_sum, tlen_pp_sum, tlen_squared_sum, tlen_sum))" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = TlenBinned.__new__(__pyx_type)
 *     if __pyx_state is not None:
 */
    __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0x87, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_v___pyx_PickleError);
    __pyx_t_2 = __pyx_v___pyx_PickleError; __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_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x87ba974:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x87ba974 = (reads_all, reads_pp, tlen_pp_squared_sum, tlen_pp_sum, tlen_squared_sum, tlen_sum))" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x87ba974 = (reads_all, reads_pp, tlen_pp_squared_sum, tlen_pp_sum, tlen_squared_sum, tlen_sum))" % __pyx_checksum)
 *     __pyx_result = TlenBinned.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_TlenBinned__set_state(<TlenBinned> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_10pysamstats_3opt_TlenBinned), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __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_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v___pyx_result = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x87ba974 = (reads_all, reads_pp, tlen_pp_squared_sum, tlen_pp_sum, tlen_squared_sum, tlen_sum))" % __pyx_checksum)
 *     __pyx_result = TlenBinned.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_TlenBinned__set_state(<TlenBinned> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
  __pyx_t_6 = (__pyx_t_1 != 0);
  if (__pyx_t_6) {

    /* "(tree fragment)":9
 *     __pyx_result = TlenBinned.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_TlenBinned__set_state(<TlenBinned> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_TlenBinned__set_state(TlenBinned __pyx_result, tuple __pyx_state):
 */
    if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_10pysamstats_3opt___pyx_unpickle_TlenBinned__set_state(((struct __pyx_obj_10pysamstats_3opt_TlenBinned *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x87ba974 = (reads_all, reads_pp, tlen_pp_squared_sum, tlen_pp_sum, tlen_squared_sum, tlen_sum))" % __pyx_checksum)
 *     __pyx_result = TlenBinned.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_TlenBinned__set_state(<TlenBinned> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_TlenBinned__set_state(<TlenBinned> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_TlenBinned__set_state(TlenBinned __pyx_result, tuple __pyx_state):
 *     __pyx_result.reads_all = __pyx_state[0]; __pyx_result.reads_pp = __pyx_state[1]; __pyx_result.tlen_pp_squared_sum = __pyx_state[2]; __pyx_result.tlen_pp_sum = __pyx_state[3]; __pyx_result.tlen_squared_sum = __pyx_state[4]; __pyx_result.tlen_sum = __pyx_state[5]
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_TlenBinned(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_TlenBinned", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_TlenBinned__set_state(<TlenBinned> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_TlenBinned__set_state(TlenBinned __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.reads_all = __pyx_state[0]; __pyx_result.reads_pp = __pyx_state[1]; __pyx_result.tlen_pp_squared_sum = __pyx_state[2]; __pyx_result.tlen_pp_sum = __pyx_state[3]; __pyx_result.tlen_squared_sum = __pyx_state[4]; __pyx_result.tlen_sum = __pyx_state[5]
 *     if len(__pyx_state) > 6 and hasattr(__pyx_result, '__dict__'):
 */

static PyObject *__pyx_f_10pysamstats_3opt___pyx_unpickle_TlenBinned__set_state(struct __pyx_obj_10pysamstats_3opt_TlenBinned *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int64_t __pyx_t_3;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  __Pyx_RefNannySetupContext("__pyx_unpickle_TlenBinned__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_TlenBinned__set_state(TlenBinned __pyx_result, tuple __pyx_state):
 *     __pyx_result.reads_all = __pyx_state[0]; __pyx_result.reads_pp = __pyx_state[1]; __pyx_result.tlen_pp_squared_sum = __pyx_state[2]; __pyx_result.tlen_pp_sum = __pyx_state[3]; __pyx_result.tlen_squared_sum = __pyx_state[4]; __pyx_result.tlen_sum = __pyx_state[5]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 6 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[6])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->reads_all = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->reads_pp = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyInt_As_int64_t(__pyx_t_1); if (unlikely((__pyx_t_3 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->tlen_pp_squared_sum = __pyx_t_3;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyInt_As_int64_t(__pyx_t_1); if (unlikely((__pyx_t_3 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->tlen_pp_sum = __pyx_t_3;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyInt_As_int64_t(__pyx_t_1); if (unlikely((__pyx_t_3 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->tlen_squared_sum = __pyx_t_3;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 5, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyInt_As_int64_t(__pyx_t_1); if (unlikely((__pyx_t_3 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->tlen_sum = __pyx_t_3;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_TlenBinned__set_state(TlenBinned __pyx_result, tuple __pyx_state):
 *     __pyx_result.reads_all = __pyx_state[0]; __pyx_result.reads_pp = __pyx_state[1]; __pyx_result.tlen_pp_squared_sum = __pyx_state[2]; __pyx_result.tlen_pp_sum = __pyx_state[3]; __pyx_result.tlen_squared_sum = __pyx_state[4]; __pyx_result.tlen_sum = __pyx_state[5]
 *     if len(__pyx_state) > 6 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[6])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 13, __pyx_L1_error)
  }
  __pyx_t_5 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_6 = ((__pyx_t_5 > 6) != 0);
  if (__pyx_t_6) {
  } else {
    __pyx_t_4 = __pyx_t_6;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_6 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_t_7 = (__pyx_t_6 != 0);
  __pyx_t_4 = __pyx_t_7;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_4) {

    /* "(tree fragment)":14
 *     __pyx_result.reads_all = __pyx_state[0]; __pyx_result.reads_pp = __pyx_state[1]; __pyx_result.tlen_pp_squared_sum = __pyx_state[2]; __pyx_result.tlen_pp_sum = __pyx_state[3]; __pyx_result.tlen_squared_sum = __pyx_state[4]; __pyx_result.tlen_sum = __pyx_state[5]
 *     if len(__pyx_state) > 6 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[6])             # <<<<<<<<<<<<<<
 */
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_update); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 14, __pyx_L1_error)
    }
    __pyx_t_8 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 6, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __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_1 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_10, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_8);
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_TlenBinned__set_state(TlenBinned __pyx_result, tuple __pyx_state):
 *     __pyx_result.reads_all = __pyx_state[0]; __pyx_result.reads_pp = __pyx_state[1]; __pyx_result.tlen_pp_squared_sum = __pyx_state[2]; __pyx_result.tlen_pp_sum = __pyx_state[3]; __pyx_result.tlen_squared_sum = __pyx_state[4]; __pyx_result.tlen_sum = __pyx_state[5]
 *     if len(__pyx_state) > 6 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[6])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_TlenBinned__set_state(<TlenBinned> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_TlenBinned__set_state(TlenBinned __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.reads_all = __pyx_state[0]; __pyx_result.reads_pp = __pyx_state[1]; __pyx_result.tlen_pp_squared_sum = __pyx_state[2]; __pyx_result.tlen_pp_sum = __pyx_state[3]; __pyx_result.tlen_squared_sum = __pyx_state[4]; __pyx_result.tlen_sum = __pyx_state[5]
 *     if len(__pyx_state) > 6 and hasattr(__pyx_result, '__dict__'):
 */

  /* 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_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("pysamstats.opt.__pyx_unpickle_TlenBinned__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __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;
  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(2, 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(2, 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(2, 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(2, 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(2, 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(2, 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 = NULL;
  arrayobject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("clone", 0);

  /* "array.pxd":134
 *     type will be same as template.
 *     if zero is true, new array will be initialized with zeroes."""
 *     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(2, 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."""
 *     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
 *     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."""
 *     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. """
 *     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 = NULL;
  arrayobject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("copy", 0);

  /* "array.pxd":141
 * cdef inline array copy(array self):
 *     """ make a copy of an 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(2, 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. """
 *     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
 *     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. """
 *     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;
  __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(2, 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;
  __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(2, 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(2, 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_vtabstruct_10pysamstats_3opt_PileupStat __pyx_vtable_10pysamstats_3opt_PileupStat;

static PyObject *__pyx_tp_new_10pysamstats_3opt_PileupStat(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_10pysamstats_3opt_PileupStat *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_10pysamstats_3opt_PileupStat *)o);
  p->__pyx_vtab = __pyx_vtabptr_10pysamstats_3opt_PileupStat;
  return o;
}

static void __pyx_tp_dealloc_10pysamstats_3opt_PileupStat(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_10pysamstats_3opt_PileupStat[] = {
  {"__reduce_cython__", (PyCFunction)__pyx_pw_10pysamstats_3opt_10PileupStat_1__reduce_cython__, METH_NOARGS, __pyx_doc_10pysamstats_3opt_10PileupStat___reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_10pysamstats_3opt_10PileupStat_3__setstate_cython__, METH_O, __pyx_doc_10pysamstats_3opt_10PileupStat_2__setstate_cython__},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_10pysamstats_3opt_PileupStat = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysamstats.opt.PileupStat", /*tp_name*/
  sizeof(struct __pyx_obj_10pysamstats_3opt_PileupStat), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_10pysamstats_3opt_PileupStat, /*tp_dealloc*/
  0, /*tp_print*/
  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_BASETYPE, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_10pysamstats_3opt_PileupStat, /*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_10pysamstats_3opt_PileupStat, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_10pysamstats_3opt_CountPp __pyx_vtable_10pysamstats_3opt_CountPp;

static PyObject *__pyx_tp_new_10pysamstats_3opt_CountPp(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_10pysamstats_3opt_CountPp *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_10pysamstats_3opt_CountPp *)o);
  p->__pyx_vtab = __pyx_vtabptr_10pysamstats_3opt_CountPp;
  return o;
}

static void __pyx_tp_dealloc_10pysamstats_3opt_CountPp(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_10pysamstats_3opt_CountPp[] = {
  {"reset", (PyCFunction)__pyx_pw_10pysamstats_3opt_7CountPp_3reset, METH_NOARGS, __pyx_doc_10pysamstats_3opt_7CountPp_2reset},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_10pysamstats_3opt_7CountPp_5__reduce_cython__, METH_NOARGS, __pyx_doc_10pysamstats_3opt_7CountPp_4__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_10pysamstats_3opt_7CountPp_7__setstate_cython__, METH_O, __pyx_doc_10pysamstats_3opt_7CountPp_6__setstate_cython__},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_10pysamstats_3opt_CountPp = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysamstats.opt.CountPp", /*tp_name*/
  sizeof(struct __pyx_obj_10pysamstats_3opt_CountPp), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_10pysamstats_3opt_CountPp, /*tp_dealloc*/
  0, /*tp_print*/
  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_BASETYPE, /*tp_flags*/
  "CountPp()", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_10pysamstats_3opt_CountPp, /*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*/
  __pyx_pw_10pysamstats_3opt_7CountPp_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_10pysamstats_3opt_CountPp, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_10pysamstats_3opt_Coverage __pyx_vtable_10pysamstats_3opt_Coverage;

static PyObject *__pyx_tp_new_10pysamstats_3opt_Coverage(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_10pysamstats_3opt_Coverage *p;
  PyObject *o = __pyx_tp_new_10pysamstats_3opt_PileupStat(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_10pysamstats_3opt_Coverage *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_10pysamstats_3opt_PileupStat*)__pyx_vtabptr_10pysamstats_3opt_Coverage;
  p->reads = ((struct __pyx_obj_10pysamstats_3opt_CountPp *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_10pysamstats_3opt_Coverage(PyObject *o) {
  struct __pyx_obj_10pysamstats_3opt_Coverage *p = (struct __pyx_obj_10pysamstats_3opt_Coverage *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->reads);
  #if CYTHON_USE_TYPE_SLOTS
  if (PyType_IS_GC(Py_TYPE(o)->tp_base))
  #endif
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_10pysamstats_3opt_PileupStat(o);
}

static int __pyx_tp_traverse_10pysamstats_3opt_Coverage(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_10pysamstats_3opt_Coverage *p = (struct __pyx_obj_10pysamstats_3opt_Coverage *)o;
  e = ((likely(__pyx_ptype_10pysamstats_3opt_PileupStat)) ? ((__pyx_ptype_10pysamstats_3opt_PileupStat->tp_traverse) ? __pyx_ptype_10pysamstats_3opt_PileupStat->tp_traverse(o, v, a) : 0) : __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_10pysamstats_3opt_Coverage)); if (e) return e;
  if (p->reads) {
    e = (*v)(((PyObject *)p->reads), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_10pysamstats_3opt_Coverage(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_10pysamstats_3opt_Coverage *p = (struct __pyx_obj_10pysamstats_3opt_Coverage *)o;
  if (likely(__pyx_ptype_10pysamstats_3opt_PileupStat)) { if (__pyx_ptype_10pysamstats_3opt_PileupStat->tp_clear) __pyx_ptype_10pysamstats_3opt_PileupStat->tp_clear(o); } else __Pyx_call_next_tp_clear(o, __pyx_tp_clear_10pysamstats_3opt_Coverage);
  tmp = ((PyObject*)p->reads);
  p->reads = ((struct __pyx_obj_10pysamstats_3opt_CountPp *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_10pysamstats_3opt_Coverage[] = {
  {"reset", (PyCFunction)__pyx_pw_10pysamstats_3opt_8Coverage_3reset, METH_NOARGS, __pyx_doc_10pysamstats_3opt_8Coverage_2reset},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_10pysamstats_3opt_8Coverage_5__reduce_cython__, METH_NOARGS, __pyx_doc_10pysamstats_3opt_8Coverage_4__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_10pysamstats_3opt_8Coverage_7__setstate_cython__, METH_O, __pyx_doc_10pysamstats_3opt_8Coverage_6__setstate_cython__},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_10pysamstats_3opt_Coverage = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysamstats.opt.Coverage", /*tp_name*/
  sizeof(struct __pyx_obj_10pysamstats_3opt_Coverage), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_10pysamstats_3opt_Coverage, /*tp_dealloc*/
  0, /*tp_print*/
  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_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "Coverage()", /*tp_doc*/
  __pyx_tp_traverse_10pysamstats_3opt_Coverage, /*tp_traverse*/
  __pyx_tp_clear_10pysamstats_3opt_Coverage, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_10pysamstats_3opt_Coverage, /*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*/
  __pyx_pw_10pysamstats_3opt_8Coverage_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_10pysamstats_3opt_Coverage, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_10pysamstats_3opt_CountPpStrand __pyx_vtable_10pysamstats_3opt_CountPpStrand;

static PyObject *__pyx_tp_new_10pysamstats_3opt_CountPpStrand(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_10pysamstats_3opt_CountPpStrand *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_10pysamstats_3opt_CountPpStrand *)o);
  p->__pyx_vtab = __pyx_vtabptr_10pysamstats_3opt_CountPpStrand;
  return o;
}

static void __pyx_tp_dealloc_10pysamstats_3opt_CountPpStrand(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_10pysamstats_3opt_CountPpStrand[] = {
  {"reset", (PyCFunction)__pyx_pw_10pysamstats_3opt_13CountPpStrand_3reset, METH_NOARGS, __pyx_doc_10pysamstats_3opt_13CountPpStrand_2reset},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_10pysamstats_3opt_13CountPpStrand_5__reduce_cython__, METH_NOARGS, __pyx_doc_10pysamstats_3opt_13CountPpStrand_4__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_10pysamstats_3opt_13CountPpStrand_7__setstate_cython__, METH_O, __pyx_doc_10pysamstats_3opt_13CountPpStrand_6__setstate_cython__},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_10pysamstats_3opt_CountPpStrand = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysamstats.opt.CountPpStrand", /*tp_name*/
  sizeof(struct __pyx_obj_10pysamstats_3opt_CountPpStrand), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_10pysamstats_3opt_CountPpStrand, /*tp_dealloc*/
  0, /*tp_print*/
  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_BASETYPE, /*tp_flags*/
  "CountPpStrand()", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_10pysamstats_3opt_CountPpStrand, /*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*/
  __pyx_pw_10pysamstats_3opt_13CountPpStrand_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_10pysamstats_3opt_CountPpStrand, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_10pysamstats_3opt_CoverageStrand __pyx_vtable_10pysamstats_3opt_CoverageStrand;

static PyObject *__pyx_tp_new_10pysamstats_3opt_CoverageStrand(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_10pysamstats_3opt_CoverageStrand *p;
  PyObject *o = __pyx_tp_new_10pysamstats_3opt_PileupStat(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_10pysamstats_3opt_CoverageStrand *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_10pysamstats_3opt_PileupStat*)__pyx_vtabptr_10pysamstats_3opt_CoverageStrand;
  p->reads = ((struct __pyx_obj_10pysamstats_3opt_CountPpStrand *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_10pysamstats_3opt_CoverageStrand(PyObject *o) {
  struct __pyx_obj_10pysamstats_3opt_CoverageStrand *p = (struct __pyx_obj_10pysamstats_3opt_CoverageStrand *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->reads);
  #if CYTHON_USE_TYPE_SLOTS
  if (PyType_IS_GC(Py_TYPE(o)->tp_base))
  #endif
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_10pysamstats_3opt_PileupStat(o);
}

static int __pyx_tp_traverse_10pysamstats_3opt_CoverageStrand(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_10pysamstats_3opt_CoverageStrand *p = (struct __pyx_obj_10pysamstats_3opt_CoverageStrand *)o;
  e = ((likely(__pyx_ptype_10pysamstats_3opt_PileupStat)) ? ((__pyx_ptype_10pysamstats_3opt_PileupStat->tp_traverse) ? __pyx_ptype_10pysamstats_3opt_PileupStat->tp_traverse(o, v, a) : 0) : __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_10pysamstats_3opt_CoverageStrand)); if (e) return e;
  if (p->reads) {
    e = (*v)(((PyObject *)p->reads), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_10pysamstats_3opt_CoverageStrand(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_10pysamstats_3opt_CoverageStrand *p = (struct __pyx_obj_10pysamstats_3opt_CoverageStrand *)o;
  if (likely(__pyx_ptype_10pysamstats_3opt_PileupStat)) { if (__pyx_ptype_10pysamstats_3opt_PileupStat->tp_clear) __pyx_ptype_10pysamstats_3opt_PileupStat->tp_clear(o); } else __Pyx_call_next_tp_clear(o, __pyx_tp_clear_10pysamstats_3opt_CoverageStrand);
  tmp = ((PyObject*)p->reads);
  p->reads = ((struct __pyx_obj_10pysamstats_3opt_CountPpStrand *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_10pysamstats_3opt_CoverageStrand[] = {
  {"reset", (PyCFunction)__pyx_pw_10pysamstats_3opt_14CoverageStrand_3reset, METH_NOARGS, __pyx_doc_10pysamstats_3opt_14CoverageStrand_2reset},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_10pysamstats_3opt_14CoverageStrand_5__reduce_cython__, METH_NOARGS, __pyx_doc_10pysamstats_3opt_14CoverageStrand_4__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_10pysamstats_3opt_14CoverageStrand_7__setstate_cython__, METH_O, __pyx_doc_10pysamstats_3opt_14CoverageStrand_6__setstate_cython__},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_10pysamstats_3opt_CoverageStrand = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysamstats.opt.CoverageStrand", /*tp_name*/
  sizeof(struct __pyx_obj_10pysamstats_3opt_CoverageStrand), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_10pysamstats_3opt_CoverageStrand, /*tp_dealloc*/
  0, /*tp_print*/
  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_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "CoverageStrand()", /*tp_doc*/
  __pyx_tp_traverse_10pysamstats_3opt_CoverageStrand, /*tp_traverse*/
  __pyx_tp_clear_10pysamstats_3opt_CoverageStrand, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_10pysamstats_3opt_CoverageStrand, /*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*/
  __pyx_pw_10pysamstats_3opt_14CoverageStrand_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_10pysamstats_3opt_CoverageStrand, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_10pysamstats_3opt_CoverageExt __pyx_vtable_10pysamstats_3opt_CoverageExt;

static PyObject *__pyx_tp_new_10pysamstats_3opt_CoverageExt(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_10pysamstats_3opt_CoverageExt *p;
  PyObject *o = __pyx_tp_new_10pysamstats_3opt_PileupStat(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_10pysamstats_3opt_CoverageExt *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_10pysamstats_3opt_PileupStat*)__pyx_vtabptr_10pysamstats_3opt_CoverageExt;
  return o;
}

static PyMethodDef __pyx_methods_10pysamstats_3opt_CoverageExt[] = {
  {"reset", (PyCFunction)__pyx_pw_10pysamstats_3opt_11CoverageExt_3reset, METH_NOARGS, __pyx_doc_10pysamstats_3opt_11CoverageExt_2reset},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_10pysamstats_3opt_11CoverageExt_5__reduce_cython__, METH_NOARGS, __pyx_doc_10pysamstats_3opt_11CoverageExt_4__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_10pysamstats_3opt_11CoverageExt_7__setstate_cython__, METH_O, __pyx_doc_10pysamstats_3opt_11CoverageExt_6__setstate_cython__},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_10pysamstats_3opt_CoverageExt = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysamstats.opt.CoverageExt", /*tp_name*/
  sizeof(struct __pyx_obj_10pysamstats_3opt_CoverageExt), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_10pysamstats_3opt_PileupStat, /*tp_dealloc*/
  0, /*tp_print*/
  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_BASETYPE, /*tp_flags*/
  "CoverageExt()", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_10pysamstats_3opt_CoverageExt, /*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*/
  __pyx_pw_10pysamstats_3opt_11CoverageExt_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_10pysamstats_3opt_CoverageExt, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_10pysamstats_3opt_CountStrand __pyx_vtable_10pysamstats_3opt_CountStrand;

static PyObject *__pyx_tp_new_10pysamstats_3opt_CountStrand(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_10pysamstats_3opt_CountStrand *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_10pysamstats_3opt_CountStrand *)o);
  p->__pyx_vtab = __pyx_vtabptr_10pysamstats_3opt_CountStrand;
  return o;
}

static void __pyx_tp_dealloc_10pysamstats_3opt_CountStrand(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_10pysamstats_3opt_CountStrand[] = {
  {"reset", (PyCFunction)__pyx_pw_10pysamstats_3opt_11CountStrand_3reset, METH_NOARGS, __pyx_doc_10pysamstats_3opt_11CountStrand_2reset},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_10pysamstats_3opt_11CountStrand_5__reduce_cython__, METH_NOARGS, __pyx_doc_10pysamstats_3opt_11CountStrand_4__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_10pysamstats_3opt_11CountStrand_7__setstate_cython__, METH_O, __pyx_doc_10pysamstats_3opt_11CountStrand_6__setstate_cython__},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_10pysamstats_3opt_CountStrand = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysamstats.opt.CountStrand", /*tp_name*/
  sizeof(struct __pyx_obj_10pysamstats_3opt_CountStrand), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_10pysamstats_3opt_CountStrand, /*tp_dealloc*/
  0, /*tp_print*/
  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_BASETYPE, /*tp_flags*/
  "CountStrand()", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_10pysamstats_3opt_CountStrand, /*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*/
  __pyx_pw_10pysamstats_3opt_11CountStrand_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_10pysamstats_3opt_CountStrand, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_10pysamstats_3opt_CoverageExtStrand __pyx_vtable_10pysamstats_3opt_CoverageExtStrand;

static PyObject *__pyx_tp_new_10pysamstats_3opt_CoverageExtStrand(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_10pysamstats_3opt_CoverageExtStrand *p;
  PyObject *o = __pyx_tp_new_10pysamstats_3opt_PileupStat(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_10pysamstats_3opt_CoverageExtStrand *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_10pysamstats_3opt_PileupStat*)__pyx_vtabptr_10pysamstats_3opt_CoverageExtStrand;
  p->all = ((struct __pyx_obj_10pysamstats_3opt_CountStrand *)Py_None); Py_INCREF(Py_None);
  p->pp = ((struct __pyx_obj_10pysamstats_3opt_CountStrand *)Py_None); Py_INCREF(Py_None);
  p->mate_unmapped = ((struct __pyx_obj_10pysamstats_3opt_CountStrand *)Py_None); Py_INCREF(Py_None);
  p->mate_other_chr = ((struct __pyx_obj_10pysamstats_3opt_CountStrand *)Py_None); Py_INCREF(Py_None);
  p->same_strand = ((struct __pyx_obj_10pysamstats_3opt_CountStrand *)Py_None); Py_INCREF(Py_None);
  p->faceaway = ((struct __pyx_obj_10pysamstats_3opt_CountStrand *)Py_None); Py_INCREF(Py_None);
  p->softclipped = ((struct __pyx_obj_10pysamstats_3opt_CountStrand *)Py_None); Py_INCREF(Py_None);
  p->duplicate = ((struct __pyx_obj_10pysamstats_3opt_CountStrand *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_10pysamstats_3opt_CoverageExtStrand(PyObject *o) {
  struct __pyx_obj_10pysamstats_3opt_CoverageExtStrand *p = (struct __pyx_obj_10pysamstats_3opt_CoverageExtStrand *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->all);
  Py_CLEAR(p->pp);
  Py_CLEAR(p->mate_unmapped);
  Py_CLEAR(p->mate_other_chr);
  Py_CLEAR(p->same_strand);
  Py_CLEAR(p->faceaway);
  Py_CLEAR(p->softclipped);
  Py_CLEAR(p->duplicate);
  #if CYTHON_USE_TYPE_SLOTS
  if (PyType_IS_GC(Py_TYPE(o)->tp_base))
  #endif
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_10pysamstats_3opt_PileupStat(o);
}

static int __pyx_tp_traverse_10pysamstats_3opt_CoverageExtStrand(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_10pysamstats_3opt_CoverageExtStrand *p = (struct __pyx_obj_10pysamstats_3opt_CoverageExtStrand *)o;
  e = ((likely(__pyx_ptype_10pysamstats_3opt_PileupStat)) ? ((__pyx_ptype_10pysamstats_3opt_PileupStat->tp_traverse) ? __pyx_ptype_10pysamstats_3opt_PileupStat->tp_traverse(o, v, a) : 0) : __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_10pysamstats_3opt_CoverageExtStrand)); if (e) return e;
  if (p->all) {
    e = (*v)(((PyObject *)p->all), a); if (e) return e;
  }
  if (p->pp) {
    e = (*v)(((PyObject *)p->pp), a); if (e) return e;
  }
  if (p->mate_unmapped) {
    e = (*v)(((PyObject *)p->mate_unmapped), a); if (e) return e;
  }
  if (p->mate_other_chr) {
    e = (*v)(((PyObject *)p->mate_other_chr), a); if (e) return e;
  }
  if (p->same_strand) {
    e = (*v)(((PyObject *)p->same_strand), a); if (e) return e;
  }
  if (p->faceaway) {
    e = (*v)(((PyObject *)p->faceaway), a); if (e) return e;
  }
  if (p->softclipped) {
    e = (*v)(((PyObject *)p->softclipped), a); if (e) return e;
  }
  if (p->duplicate) {
    e = (*v)(((PyObject *)p->duplicate), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_10pysamstats_3opt_CoverageExtStrand(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_10pysamstats_3opt_CoverageExtStrand *p = (struct __pyx_obj_10pysamstats_3opt_CoverageExtStrand *)o;
  if (likely(__pyx_ptype_10pysamstats_3opt_PileupStat)) { if (__pyx_ptype_10pysamstats_3opt_PileupStat->tp_clear) __pyx_ptype_10pysamstats_3opt_PileupStat->tp_clear(o); } else __Pyx_call_next_tp_clear(o, __pyx_tp_clear_10pysamstats_3opt_CoverageExtStrand);
  tmp = ((PyObject*)p->all);
  p->all = ((struct __pyx_obj_10pysamstats_3opt_CountStrand *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->pp);
  p->pp = ((struct __pyx_obj_10pysamstats_3opt_CountStrand *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->mate_unmapped);
  p->mate_unmapped = ((struct __pyx_obj_10pysamstats_3opt_CountStrand *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->mate_other_chr);
  p->mate_other_chr = ((struct __pyx_obj_10pysamstats_3opt_CountStrand *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->same_strand);
  p->same_strand = ((struct __pyx_obj_10pysamstats_3opt_CountStrand *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->faceaway);
  p->faceaway = ((struct __pyx_obj_10pysamstats_3opt_CountStrand *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->softclipped);
  p->softclipped = ((struct __pyx_obj_10pysamstats_3opt_CountStrand *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->duplicate);
  p->duplicate = ((struct __pyx_obj_10pysamstats_3opt_CountStrand *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_10pysamstats_3opt_CoverageExtStrand[] = {
  {"reset", (PyCFunction)__pyx_pw_10pysamstats_3opt_17CoverageExtStrand_3reset, METH_NOARGS, __pyx_doc_10pysamstats_3opt_17CoverageExtStrand_2reset},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_10pysamstats_3opt_17CoverageExtStrand_5__reduce_cython__, METH_NOARGS, __pyx_doc_10pysamstats_3opt_17CoverageExtStrand_4__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_10pysamstats_3opt_17CoverageExtStrand_7__setstate_cython__, METH_O, __pyx_doc_10pysamstats_3opt_17CoverageExtStrand_6__setstate_cython__},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_10pysamstats_3opt_CoverageExtStrand = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysamstats.opt.CoverageExtStrand", /*tp_name*/
  sizeof(struct __pyx_obj_10pysamstats_3opt_CoverageExtStrand), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_10pysamstats_3opt_CoverageExtStrand, /*tp_dealloc*/
  0, /*tp_print*/
  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_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "CoverageExtStrand()", /*tp_doc*/
  __pyx_tp_traverse_10pysamstats_3opt_CoverageExtStrand, /*tp_traverse*/
  __pyx_tp_clear_10pysamstats_3opt_CoverageExtStrand, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_10pysamstats_3opt_CoverageExtStrand, /*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*/
  __pyx_pw_10pysamstats_3opt_17CoverageExtStrand_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_10pysamstats_3opt_CoverageExtStrand, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_10pysamstats_3opt_Variation __pyx_vtable_10pysamstats_3opt_Variation;

static PyObject *__pyx_tp_new_10pysamstats_3opt_Variation(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_10pysamstats_3opt_Variation *p;
  PyObject *o = __pyx_tp_new_10pysamstats_3opt_PileupStat(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_10pysamstats_3opt_Variation *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_10pysamstats_3opt_PileupStat*)__pyx_vtabptr_10pysamstats_3opt_Variation;
  p->reads = ((struct __pyx_obj_10pysamstats_3opt_CountPp *)Py_None); Py_INCREF(Py_None);
  p->matches = ((struct __pyx_obj_10pysamstats_3opt_CountPp *)Py_None); Py_INCREF(Py_None);
  p->mismatches = ((struct __pyx_obj_10pysamstats_3opt_CountPp *)Py_None); Py_INCREF(Py_None);
  p->deletions = ((struct __pyx_obj_10pysamstats_3opt_CountPp *)Py_None); Py_INCREF(Py_None);
  p->insertions = ((struct __pyx_obj_10pysamstats_3opt_CountPp *)Py_None); Py_INCREF(Py_None);
  p->A = ((struct __pyx_obj_10pysamstats_3opt_CountPp *)Py_None); Py_INCREF(Py_None);
  p->C = ((struct __pyx_obj_10pysamstats_3opt_CountPp *)Py_None); Py_INCREF(Py_None);
  p->T = ((struct __pyx_obj_10pysamstats_3opt_CountPp *)Py_None); Py_INCREF(Py_None);
  p->G = ((struct __pyx_obj_10pysamstats_3opt_CountPp *)Py_None); Py_INCREF(Py_None);
  p->N = ((struct __pyx_obj_10pysamstats_3opt_CountPp *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_10pysamstats_3opt_Variation(PyObject *o) {
  struct __pyx_obj_10pysamstats_3opt_Variation *p = (struct __pyx_obj_10pysamstats_3opt_Variation *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->reads);
  Py_CLEAR(p->matches);
  Py_CLEAR(p->mismatches);
  Py_CLEAR(p->deletions);
  Py_CLEAR(p->insertions);
  Py_CLEAR(p->A);
  Py_CLEAR(p->C);
  Py_CLEAR(p->T);
  Py_CLEAR(p->G);
  Py_CLEAR(p->N);
  #if CYTHON_USE_TYPE_SLOTS
  if (PyType_IS_GC(Py_TYPE(o)->tp_base))
  #endif
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_10pysamstats_3opt_PileupStat(o);
}

static int __pyx_tp_traverse_10pysamstats_3opt_Variation(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_10pysamstats_3opt_Variation *p = (struct __pyx_obj_10pysamstats_3opt_Variation *)o;
  e = ((likely(__pyx_ptype_10pysamstats_3opt_PileupStat)) ? ((__pyx_ptype_10pysamstats_3opt_PileupStat->tp_traverse) ? __pyx_ptype_10pysamstats_3opt_PileupStat->tp_traverse(o, v, a) : 0) : __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_10pysamstats_3opt_Variation)); if (e) return e;
  if (p->reads) {
    e = (*v)(((PyObject *)p->reads), a); if (e) return e;
  }
  if (p->matches) {
    e = (*v)(((PyObject *)p->matches), a); if (e) return e;
  }
  if (p->mismatches) {
    e = (*v)(((PyObject *)p->mismatches), a); if (e) return e;
  }
  if (p->deletions) {
    e = (*v)(((PyObject *)p->deletions), a); if (e) return e;
  }
  if (p->insertions) {
    e = (*v)(((PyObject *)p->insertions), a); if (e) return e;
  }
  if (p->A) {
    e = (*v)(((PyObject *)p->A), a); if (e) return e;
  }
  if (p->C) {
    e = (*v)(((PyObject *)p->C), a); if (e) return e;
  }
  if (p->T) {
    e = (*v)(((PyObject *)p->T), a); if (e) return e;
  }
  if (p->G) {
    e = (*v)(((PyObject *)p->G), a); if (e) return e;
  }
  if (p->N) {
    e = (*v)(((PyObject *)p->N), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_10pysamstats_3opt_Variation(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_10pysamstats_3opt_Variation *p = (struct __pyx_obj_10pysamstats_3opt_Variation *)o;
  if (likely(__pyx_ptype_10pysamstats_3opt_PileupStat)) { if (__pyx_ptype_10pysamstats_3opt_PileupStat->tp_clear) __pyx_ptype_10pysamstats_3opt_PileupStat->tp_clear(o); } else __Pyx_call_next_tp_clear(o, __pyx_tp_clear_10pysamstats_3opt_Variation);
  tmp = ((PyObject*)p->reads);
  p->reads = ((struct __pyx_obj_10pysamstats_3opt_CountPp *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->matches);
  p->matches = ((struct __pyx_obj_10pysamstats_3opt_CountPp *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->mismatches);
  p->mismatches = ((struct __pyx_obj_10pysamstats_3opt_CountPp *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->deletions);
  p->deletions = ((struct __pyx_obj_10pysamstats_3opt_CountPp *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->insertions);
  p->insertions = ((struct __pyx_obj_10pysamstats_3opt_CountPp *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->A);
  p->A = ((struct __pyx_obj_10pysamstats_3opt_CountPp *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->C);
  p->C = ((struct __pyx_obj_10pysamstats_3opt_CountPp *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->T);
  p->T = ((struct __pyx_obj_10pysamstats_3opt_CountPp *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->G);
  p->G = ((struct __pyx_obj_10pysamstats_3opt_CountPp *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->N);
  p->N = ((struct __pyx_obj_10pysamstats_3opt_CountPp *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_10pysamstats_3opt_Variation[] = {
  {"reset", (PyCFunction)__pyx_pw_10pysamstats_3opt_9Variation_3reset, METH_NOARGS, __pyx_doc_10pysamstats_3opt_9Variation_2reset},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_10pysamstats_3opt_9Variation_5__reduce_cython__, METH_NOARGS, __pyx_doc_10pysamstats_3opt_9Variation_4__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_10pysamstats_3opt_9Variation_7__setstate_cython__, METH_O, __pyx_doc_10pysamstats_3opt_9Variation_6__setstate_cython__},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_10pysamstats_3opt_Variation = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysamstats.opt.Variation", /*tp_name*/
  sizeof(struct __pyx_obj_10pysamstats_3opt_Variation), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_10pysamstats_3opt_Variation, /*tp_dealloc*/
  0, /*tp_print*/
  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_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "Variation()", /*tp_doc*/
  __pyx_tp_traverse_10pysamstats_3opt_Variation, /*tp_traverse*/
  __pyx_tp_clear_10pysamstats_3opt_Variation, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_10pysamstats_3opt_Variation, /*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*/
  __pyx_pw_10pysamstats_3opt_9Variation_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_10pysamstats_3opt_Variation, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_10pysamstats_3opt_VariationStrand __pyx_vtable_10pysamstats_3opt_VariationStrand;

static PyObject *__pyx_tp_new_10pysamstats_3opt_VariationStrand(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_10pysamstats_3opt_VariationStrand *p;
  PyObject *o = __pyx_tp_new_10pysamstats_3opt_PileupStat(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_10pysamstats_3opt_VariationStrand *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_10pysamstats_3opt_PileupStat*)__pyx_vtabptr_10pysamstats_3opt_VariationStrand;
  p->reads = ((struct __pyx_obj_10pysamstats_3opt_CountPpStrand *)Py_None); Py_INCREF(Py_None);
  p->matches = ((struct __pyx_obj_10pysamstats_3opt_CountPpStrand *)Py_None); Py_INCREF(Py_None);
  p->mismatches = ((struct __pyx_obj_10pysamstats_3opt_CountPpStrand *)Py_None); Py_INCREF(Py_None);
  p->deletions = ((struct __pyx_obj_10pysamstats_3opt_CountPpStrand *)Py_None); Py_INCREF(Py_None);
  p->insertions = ((struct __pyx_obj_10pysamstats_3opt_CountPpStrand *)Py_None); Py_INCREF(Py_None);
  p->A = ((struct __pyx_obj_10pysamstats_3opt_CountPpStrand *)Py_None); Py_INCREF(Py_None);
  p->C = ((struct __pyx_obj_10pysamstats_3opt_CountPpStrand *)Py_None); Py_INCREF(Py_None);
  p->T = ((struct __pyx_obj_10pysamstats_3opt_CountPpStrand *)Py_None); Py_INCREF(Py_None);
  p->G = ((struct __pyx_obj_10pysamstats_3opt_CountPpStrand *)Py_None); Py_INCREF(Py_None);
  p->N = ((struct __pyx_obj_10pysamstats_3opt_CountPpStrand *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_10pysamstats_3opt_VariationStrand(PyObject *o) {
  struct __pyx_obj_10pysamstats_3opt_VariationStrand *p = (struct __pyx_obj_10pysamstats_3opt_VariationStrand *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->reads);
  Py_CLEAR(p->matches);
  Py_CLEAR(p->mismatches);
  Py_CLEAR(p->deletions);
  Py_CLEAR(p->insertions);
  Py_CLEAR(p->A);
  Py_CLEAR(p->C);
  Py_CLEAR(p->T);
  Py_CLEAR(p->G);
  Py_CLEAR(p->N);
  #if CYTHON_USE_TYPE_SLOTS
  if (PyType_IS_GC(Py_TYPE(o)->tp_base))
  #endif
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_10pysamstats_3opt_PileupStat(o);
}

static int __pyx_tp_traverse_10pysamstats_3opt_VariationStrand(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_10pysamstats_3opt_VariationStrand *p = (struct __pyx_obj_10pysamstats_3opt_VariationStrand *)o;
  e = ((likely(__pyx_ptype_10pysamstats_3opt_PileupStat)) ? ((__pyx_ptype_10pysamstats_3opt_PileupStat->tp_traverse) ? __pyx_ptype_10pysamstats_3opt_PileupStat->tp_traverse(o, v, a) : 0) : __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_10pysamstats_3opt_VariationStrand)); if (e) return e;
  if (p->reads) {
    e = (*v)(((PyObject *)p->reads), a); if (e) return e;
  }
  if (p->matches) {
    e = (*v)(((PyObject *)p->matches), a); if (e) return e;
  }
  if (p->mismatches) {
    e = (*v)(((PyObject *)p->mismatches), a); if (e) return e;
  }
  if (p->deletions) {
    e = (*v)(((PyObject *)p->deletions), a); if (e) return e;
  }
  if (p->insertions) {
    e = (*v)(((PyObject *)p->insertions), a); if (e) return e;
  }
  if (p->A) {
    e = (*v)(((PyObject *)p->A), a); if (e) return e;
  }
  if (p->C) {
    e = (*v)(((PyObject *)p->C), a); if (e) return e;
  }
  if (p->T) {
    e = (*v)(((PyObject *)p->T), a); if (e) return e;
  }
  if (p->G) {
    e = (*v)(((PyObject *)p->G), a); if (e) return e;
  }
  if (p->N) {
    e = (*v)(((PyObject *)p->N), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_10pysamstats_3opt_VariationStrand(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_10pysamstats_3opt_VariationStrand *p = (struct __pyx_obj_10pysamstats_3opt_VariationStrand *)o;
  if (likely(__pyx_ptype_10pysamstats_3opt_PileupStat)) { if (__pyx_ptype_10pysamstats_3opt_PileupStat->tp_clear) __pyx_ptype_10pysamstats_3opt_PileupStat->tp_clear(o); } else __Pyx_call_next_tp_clear(o, __pyx_tp_clear_10pysamstats_3opt_VariationStrand);
  tmp = ((PyObject*)p->reads);
  p->reads = ((struct __pyx_obj_10pysamstats_3opt_CountPpStrand *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->matches);
  p->matches = ((struct __pyx_obj_10pysamstats_3opt_CountPpStrand *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->mismatches);
  p->mismatches = ((struct __pyx_obj_10pysamstats_3opt_CountPpStrand *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->deletions);
  p->deletions = ((struct __pyx_obj_10pysamstats_3opt_CountPpStrand *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->insertions);
  p->insertions = ((struct __pyx_obj_10pysamstats_3opt_CountPpStrand *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->A);
  p->A = ((struct __pyx_obj_10pysamstats_3opt_CountPpStrand *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->C);
  p->C = ((struct __pyx_obj_10pysamstats_3opt_CountPpStrand *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->T);
  p->T = ((struct __pyx_obj_10pysamstats_3opt_CountPpStrand *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->G);
  p->G = ((struct __pyx_obj_10pysamstats_3opt_CountPpStrand *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->N);
  p->N = ((struct __pyx_obj_10pysamstats_3opt_CountPpStrand *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_10pysamstats_3opt_VariationStrand[] = {
  {"reset", (PyCFunction)__pyx_pw_10pysamstats_3opt_15VariationStrand_3reset, METH_NOARGS, __pyx_doc_10pysamstats_3opt_15VariationStrand_2reset},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_10pysamstats_3opt_15VariationStrand_5__reduce_cython__, METH_NOARGS, __pyx_doc_10pysamstats_3opt_15VariationStrand_4__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_10pysamstats_3opt_15VariationStrand_7__setstate_cython__, METH_O, __pyx_doc_10pysamstats_3opt_15VariationStrand_6__setstate_cython__},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_10pysamstats_3opt_VariationStrand = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysamstats.opt.VariationStrand", /*tp_name*/
  sizeof(struct __pyx_obj_10pysamstats_3opt_VariationStrand), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_10pysamstats_3opt_VariationStrand, /*tp_dealloc*/
  0, /*tp_print*/
  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_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "VariationStrand()", /*tp_doc*/
  __pyx_tp_traverse_10pysamstats_3opt_VariationStrand, /*tp_traverse*/
  __pyx_tp_clear_10pysamstats_3opt_VariationStrand, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_10pysamstats_3opt_VariationStrand, /*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*/
  __pyx_pw_10pysamstats_3opt_15VariationStrand_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_10pysamstats_3opt_VariationStrand, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_10pysamstats_3opt_TlenHelper __pyx_vtable_10pysamstats_3opt_TlenHelper;

static PyObject *__pyx_tp_new_10pysamstats_3opt_TlenHelper(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_10pysamstats_3opt_TlenHelper *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_10pysamstats_3opt_TlenHelper *)o);
  p->__pyx_vtab = __pyx_vtabptr_10pysamstats_3opt_TlenHelper;
  return o;
}

static void __pyx_tp_dealloc_10pysamstats_3opt_TlenHelper(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_10pysamstats_3opt_TlenHelper[] = {
  {"reset", (PyCFunction)__pyx_pw_10pysamstats_3opt_10TlenHelper_3reset, METH_NOARGS, __pyx_doc_10pysamstats_3opt_10TlenHelper_2reset},
  {"variance", (PyCFunction)__pyx_pw_10pysamstats_3opt_10TlenHelper_5variance, METH_NOARGS, __pyx_doc_10pysamstats_3opt_10TlenHelper_4variance},
  {"std", (PyCFunction)__pyx_pw_10pysamstats_3opt_10TlenHelper_7std, METH_NOARGS, __pyx_doc_10pysamstats_3opt_10TlenHelper_6std},
  {"mean", (PyCFunction)__pyx_pw_10pysamstats_3opt_10TlenHelper_9mean, METH_NOARGS, __pyx_doc_10pysamstats_3opt_10TlenHelper_8mean},
  {"rms", (PyCFunction)__pyx_pw_10pysamstats_3opt_10TlenHelper_11rms, METH_NOARGS, __pyx_doc_10pysamstats_3opt_10TlenHelper_10rms},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_10pysamstats_3opt_10TlenHelper_13__reduce_cython__, METH_NOARGS, __pyx_doc_10pysamstats_3opt_10TlenHelper_12__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_10pysamstats_3opt_10TlenHelper_15__setstate_cython__, METH_O, __pyx_doc_10pysamstats_3opt_10TlenHelper_14__setstate_cython__},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_10pysamstats_3opt_TlenHelper = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysamstats.opt.TlenHelper", /*tp_name*/
  sizeof(struct __pyx_obj_10pysamstats_3opt_TlenHelper), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_10pysamstats_3opt_TlenHelper, /*tp_dealloc*/
  0, /*tp_print*/
  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_BASETYPE, /*tp_flags*/
  "TlenHelper()", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_10pysamstats_3opt_TlenHelper, /*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*/
  __pyx_pw_10pysamstats_3opt_10TlenHelper_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_10pysamstats_3opt_TlenHelper, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_10pysamstats_3opt_Tlen __pyx_vtable_10pysamstats_3opt_Tlen;

static PyObject *__pyx_tp_new_10pysamstats_3opt_Tlen(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_10pysamstats_3opt_Tlen *p;
  PyObject *o = __pyx_tp_new_10pysamstats_3opt_PileupStat(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_10pysamstats_3opt_Tlen *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_10pysamstats_3opt_PileupStat*)__pyx_vtabptr_10pysamstats_3opt_Tlen;
  p->tlen = ((struct __pyx_obj_10pysamstats_3opt_TlenHelper *)Py_None); Py_INCREF(Py_None);
  p->tlen_pp = ((struct __pyx_obj_10pysamstats_3opt_TlenHelper *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_10pysamstats_3opt_Tlen(PyObject *o) {
  struct __pyx_obj_10pysamstats_3opt_Tlen *p = (struct __pyx_obj_10pysamstats_3opt_Tlen *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->tlen);
  Py_CLEAR(p->tlen_pp);
  #if CYTHON_USE_TYPE_SLOTS
  if (PyType_IS_GC(Py_TYPE(o)->tp_base))
  #endif
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_10pysamstats_3opt_PileupStat(o);
}

static int __pyx_tp_traverse_10pysamstats_3opt_Tlen(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_10pysamstats_3opt_Tlen *p = (struct __pyx_obj_10pysamstats_3opt_Tlen *)o;
  e = ((likely(__pyx_ptype_10pysamstats_3opt_PileupStat)) ? ((__pyx_ptype_10pysamstats_3opt_PileupStat->tp_traverse) ? __pyx_ptype_10pysamstats_3opt_PileupStat->tp_traverse(o, v, a) : 0) : __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_10pysamstats_3opt_Tlen)); if (e) return e;
  if (p->tlen) {
    e = (*v)(((PyObject *)p->tlen), a); if (e) return e;
  }
  if (p->tlen_pp) {
    e = (*v)(((PyObject *)p->tlen_pp), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_10pysamstats_3opt_Tlen(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_10pysamstats_3opt_Tlen *p = (struct __pyx_obj_10pysamstats_3opt_Tlen *)o;
  if (likely(__pyx_ptype_10pysamstats_3opt_PileupStat)) { if (__pyx_ptype_10pysamstats_3opt_PileupStat->tp_clear) __pyx_ptype_10pysamstats_3opt_PileupStat->tp_clear(o); } else __Pyx_call_next_tp_clear(o, __pyx_tp_clear_10pysamstats_3opt_Tlen);
  tmp = ((PyObject*)p->tlen);
  p->tlen = ((struct __pyx_obj_10pysamstats_3opt_TlenHelper *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->tlen_pp);
  p->tlen_pp = ((struct __pyx_obj_10pysamstats_3opt_TlenHelper *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_10pysamstats_3opt_Tlen[] = {
  {"reset", (PyCFunction)__pyx_pw_10pysamstats_3opt_4Tlen_3reset, METH_NOARGS, __pyx_doc_10pysamstats_3opt_4Tlen_2reset},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_10pysamstats_3opt_4Tlen_5__reduce_cython__, METH_NOARGS, __pyx_doc_10pysamstats_3opt_4Tlen_4__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_10pysamstats_3opt_4Tlen_7__setstate_cython__, METH_O, __pyx_doc_10pysamstats_3opt_4Tlen_6__setstate_cython__},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_10pysamstats_3opt_Tlen = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysamstats.opt.Tlen", /*tp_name*/
  sizeof(struct __pyx_obj_10pysamstats_3opt_Tlen), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_10pysamstats_3opt_Tlen, /*tp_dealloc*/
  0, /*tp_print*/
  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_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "Tlen()", /*tp_doc*/
  __pyx_tp_traverse_10pysamstats_3opt_Tlen, /*tp_traverse*/
  __pyx_tp_clear_10pysamstats_3opt_Tlen, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_10pysamstats_3opt_Tlen, /*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*/
  __pyx_pw_10pysamstats_3opt_4Tlen_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_10pysamstats_3opt_Tlen, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_10pysamstats_3opt_TlenStrand __pyx_vtable_10pysamstats_3opt_TlenStrand;

static PyObject *__pyx_tp_new_10pysamstats_3opt_TlenStrand(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_10pysamstats_3opt_TlenStrand *p;
  PyObject *o = __pyx_tp_new_10pysamstats_3opt_PileupStat(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_10pysamstats_3opt_TlenStrand *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_10pysamstats_3opt_PileupStat*)__pyx_vtabptr_10pysamstats_3opt_TlenStrand;
  p->tlen = ((struct __pyx_obj_10pysamstats_3opt_TlenHelper *)Py_None); Py_INCREF(Py_None);
  p->tlen_fwd = ((struct __pyx_obj_10pysamstats_3opt_TlenHelper *)Py_None); Py_INCREF(Py_None);
  p->tlen_rev = ((struct __pyx_obj_10pysamstats_3opt_TlenHelper *)Py_None); Py_INCREF(Py_None);
  p->tlen_pp = ((struct __pyx_obj_10pysamstats_3opt_TlenHelper *)Py_None); Py_INCREF(Py_None);
  p->tlen_pp_fwd = ((struct __pyx_obj_10pysamstats_3opt_TlenHelper *)Py_None); Py_INCREF(Py_None);
  p->tlen_pp_rev = ((struct __pyx_obj_10pysamstats_3opt_TlenHelper *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_10pysamstats_3opt_TlenStrand(PyObject *o) {
  struct __pyx_obj_10pysamstats_3opt_TlenStrand *p = (struct __pyx_obj_10pysamstats_3opt_TlenStrand *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->tlen);
  Py_CLEAR(p->tlen_fwd);
  Py_CLEAR(p->tlen_rev);
  Py_CLEAR(p->tlen_pp);
  Py_CLEAR(p->tlen_pp_fwd);
  Py_CLEAR(p->tlen_pp_rev);
  #if CYTHON_USE_TYPE_SLOTS
  if (PyType_IS_GC(Py_TYPE(o)->tp_base))
  #endif
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_10pysamstats_3opt_PileupStat(o);
}

static int __pyx_tp_traverse_10pysamstats_3opt_TlenStrand(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_10pysamstats_3opt_TlenStrand *p = (struct __pyx_obj_10pysamstats_3opt_TlenStrand *)o;
  e = ((likely(__pyx_ptype_10pysamstats_3opt_PileupStat)) ? ((__pyx_ptype_10pysamstats_3opt_PileupStat->tp_traverse) ? __pyx_ptype_10pysamstats_3opt_PileupStat->tp_traverse(o, v, a) : 0) : __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_10pysamstats_3opt_TlenStrand)); if (e) return e;
  if (p->tlen) {
    e = (*v)(((PyObject *)p->tlen), a); if (e) return e;
  }
  if (p->tlen_fwd) {
    e = (*v)(((PyObject *)p->tlen_fwd), a); if (e) return e;
  }
  if (p->tlen_rev) {
    e = (*v)(((PyObject *)p->tlen_rev), a); if (e) return e;
  }
  if (p->tlen_pp) {
    e = (*v)(((PyObject *)p->tlen_pp), a); if (e) return e;
  }
  if (p->tlen_pp_fwd) {
    e = (*v)(((PyObject *)p->tlen_pp_fwd), a); if (e) return e;
  }
  if (p->tlen_pp_rev) {
    e = (*v)(((PyObject *)p->tlen_pp_rev), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_10pysamstats_3opt_TlenStrand(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_10pysamstats_3opt_TlenStrand *p = (struct __pyx_obj_10pysamstats_3opt_TlenStrand *)o;
  if (likely(__pyx_ptype_10pysamstats_3opt_PileupStat)) { if (__pyx_ptype_10pysamstats_3opt_PileupStat->tp_clear) __pyx_ptype_10pysamstats_3opt_PileupStat->tp_clear(o); } else __Pyx_call_next_tp_clear(o, __pyx_tp_clear_10pysamstats_3opt_TlenStrand);
  tmp = ((PyObject*)p->tlen);
  p->tlen = ((struct __pyx_obj_10pysamstats_3opt_TlenHelper *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->tlen_fwd);
  p->tlen_fwd = ((struct __pyx_obj_10pysamstats_3opt_TlenHelper *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->tlen_rev);
  p->tlen_rev = ((struct __pyx_obj_10pysamstats_3opt_TlenHelper *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->tlen_pp);
  p->tlen_pp = ((struct __pyx_obj_10pysamstats_3opt_TlenHelper *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->tlen_pp_fwd);
  p->tlen_pp_fwd = ((struct __pyx_obj_10pysamstats_3opt_TlenHelper *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->tlen_pp_rev);
  p->tlen_pp_rev = ((struct __pyx_obj_10pysamstats_3opt_TlenHelper *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_10pysamstats_3opt_TlenStrand[] = {
  {"reset", (PyCFunction)__pyx_pw_10pysamstats_3opt_10TlenStrand_3reset, METH_NOARGS, __pyx_doc_10pysamstats_3opt_10TlenStrand_2reset},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_10pysamstats_3opt_10TlenStrand_5__reduce_cython__, METH_NOARGS, __pyx_doc_10pysamstats_3opt_10TlenStrand_4__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_10pysamstats_3opt_10TlenStrand_7__setstate_cython__, METH_O, __pyx_doc_10pysamstats_3opt_10TlenStrand_6__setstate_cython__},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_10pysamstats_3opt_TlenStrand = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysamstats.opt.TlenStrand", /*tp_name*/
  sizeof(struct __pyx_obj_10pysamstats_3opt_TlenStrand), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_10pysamstats_3opt_TlenStrand, /*tp_dealloc*/
  0, /*tp_print*/
  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_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "TlenStrand()", /*tp_doc*/
  __pyx_tp_traverse_10pysamstats_3opt_TlenStrand, /*tp_traverse*/
  __pyx_tp_clear_10pysamstats_3opt_TlenStrand, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_10pysamstats_3opt_TlenStrand, /*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*/
  __pyx_pw_10pysamstats_3opt_10TlenStrand_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_10pysamstats_3opt_TlenStrand, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_10pysamstats_3opt_MapqHelper __pyx_vtable_10pysamstats_3opt_MapqHelper;

static PyObject *__pyx_tp_new_10pysamstats_3opt_MapqHelper(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_10pysamstats_3opt_MapqHelper *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_10pysamstats_3opt_MapqHelper *)o);
  p->__pyx_vtab = __pyx_vtabptr_10pysamstats_3opt_MapqHelper;
  return o;
}

static void __pyx_tp_dealloc_10pysamstats_3opt_MapqHelper(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_10pysamstats_3opt_MapqHelper[] = {
  {"reset", (PyCFunction)__pyx_pw_10pysamstats_3opt_10MapqHelper_3reset, METH_NOARGS, __pyx_doc_10pysamstats_3opt_10MapqHelper_2reset},
  {"rms", (PyCFunction)__pyx_pw_10pysamstats_3opt_10MapqHelper_5rms, METH_NOARGS, __pyx_doc_10pysamstats_3opt_10MapqHelper_4rms},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_10pysamstats_3opt_10MapqHelper_7__reduce_cython__, METH_NOARGS, __pyx_doc_10pysamstats_3opt_10MapqHelper_6__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_10pysamstats_3opt_10MapqHelper_9__setstate_cython__, METH_O, __pyx_doc_10pysamstats_3opt_10MapqHelper_8__setstate_cython__},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_10pysamstats_3opt_MapqHelper = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysamstats.opt.MapqHelper", /*tp_name*/
  sizeof(struct __pyx_obj_10pysamstats_3opt_MapqHelper), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_10pysamstats_3opt_MapqHelper, /*tp_dealloc*/
  0, /*tp_print*/
  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_BASETYPE, /*tp_flags*/
  "MapqHelper()", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_10pysamstats_3opt_MapqHelper, /*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*/
  __pyx_pw_10pysamstats_3opt_10MapqHelper_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_10pysamstats_3opt_MapqHelper, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_10pysamstats_3opt_Mapq __pyx_vtable_10pysamstats_3opt_Mapq;

static PyObject *__pyx_tp_new_10pysamstats_3opt_Mapq(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_10pysamstats_3opt_Mapq *p;
  PyObject *o = __pyx_tp_new_10pysamstats_3opt_PileupStat(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_10pysamstats_3opt_Mapq *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_10pysamstats_3opt_PileupStat*)__pyx_vtabptr_10pysamstats_3opt_Mapq;
  p->all = ((struct __pyx_obj_10pysamstats_3opt_MapqHelper *)Py_None); Py_INCREF(Py_None);
  p->pp = ((struct __pyx_obj_10pysamstats_3opt_MapqHelper *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_10pysamstats_3opt_Mapq(PyObject *o) {
  struct __pyx_obj_10pysamstats_3opt_Mapq *p = (struct __pyx_obj_10pysamstats_3opt_Mapq *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->all);
  Py_CLEAR(p->pp);
  #if CYTHON_USE_TYPE_SLOTS
  if (PyType_IS_GC(Py_TYPE(o)->tp_base))
  #endif
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_10pysamstats_3opt_PileupStat(o);
}

static int __pyx_tp_traverse_10pysamstats_3opt_Mapq(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_10pysamstats_3opt_Mapq *p = (struct __pyx_obj_10pysamstats_3opt_Mapq *)o;
  e = ((likely(__pyx_ptype_10pysamstats_3opt_PileupStat)) ? ((__pyx_ptype_10pysamstats_3opt_PileupStat->tp_traverse) ? __pyx_ptype_10pysamstats_3opt_PileupStat->tp_traverse(o, v, a) : 0) : __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_10pysamstats_3opt_Mapq)); if (e) return e;
  if (p->all) {
    e = (*v)(((PyObject *)p->all), a); if (e) return e;
  }
  if (p->pp) {
    e = (*v)(((PyObject *)p->pp), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_10pysamstats_3opt_Mapq(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_10pysamstats_3opt_Mapq *p = (struct __pyx_obj_10pysamstats_3opt_Mapq *)o;
  if (likely(__pyx_ptype_10pysamstats_3opt_PileupStat)) { if (__pyx_ptype_10pysamstats_3opt_PileupStat->tp_clear) __pyx_ptype_10pysamstats_3opt_PileupStat->tp_clear(o); } else __Pyx_call_next_tp_clear(o, __pyx_tp_clear_10pysamstats_3opt_Mapq);
  tmp = ((PyObject*)p->all);
  p->all = ((struct __pyx_obj_10pysamstats_3opt_MapqHelper *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->pp);
  p->pp = ((struct __pyx_obj_10pysamstats_3opt_MapqHelper *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_10pysamstats_3opt_Mapq[] = {
  {"reset", (PyCFunction)__pyx_pw_10pysamstats_3opt_4Mapq_3reset, METH_NOARGS, __pyx_doc_10pysamstats_3opt_4Mapq_2reset},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_10pysamstats_3opt_4Mapq_5__reduce_cython__, METH_NOARGS, __pyx_doc_10pysamstats_3opt_4Mapq_4__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_10pysamstats_3opt_4Mapq_7__setstate_cython__, METH_O, __pyx_doc_10pysamstats_3opt_4Mapq_6__setstate_cython__},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_10pysamstats_3opt_Mapq = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysamstats.opt.Mapq", /*tp_name*/
  sizeof(struct __pyx_obj_10pysamstats_3opt_Mapq), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_10pysamstats_3opt_Mapq, /*tp_dealloc*/
  0, /*tp_print*/
  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_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "Mapq()", /*tp_doc*/
  __pyx_tp_traverse_10pysamstats_3opt_Mapq, /*tp_traverse*/
  __pyx_tp_clear_10pysamstats_3opt_Mapq, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_10pysamstats_3opt_Mapq, /*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*/
  __pyx_pw_10pysamstats_3opt_4Mapq_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_10pysamstats_3opt_Mapq, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_10pysamstats_3opt_MapqStrand __pyx_vtable_10pysamstats_3opt_MapqStrand;

static PyObject *__pyx_tp_new_10pysamstats_3opt_MapqStrand(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_10pysamstats_3opt_MapqStrand *p;
  PyObject *o = __pyx_tp_new_10pysamstats_3opt_PileupStat(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_10pysamstats_3opt_MapqStrand *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_10pysamstats_3opt_PileupStat*)__pyx_vtabptr_10pysamstats_3opt_MapqStrand;
  p->all = ((struct __pyx_obj_10pysamstats_3opt_MapqHelper *)Py_None); Py_INCREF(Py_None);
  p->fwd = ((struct __pyx_obj_10pysamstats_3opt_MapqHelper *)Py_None); Py_INCREF(Py_None);
  p->rev = ((struct __pyx_obj_10pysamstats_3opt_MapqHelper *)Py_None); Py_INCREF(Py_None);
  p->pp = ((struct __pyx_obj_10pysamstats_3opt_MapqHelper *)Py_None); Py_INCREF(Py_None);
  p->pp_fwd = ((struct __pyx_obj_10pysamstats_3opt_MapqHelper *)Py_None); Py_INCREF(Py_None);
  p->pp_rev = ((struct __pyx_obj_10pysamstats_3opt_MapqHelper *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_10pysamstats_3opt_MapqStrand(PyObject *o) {
  struct __pyx_obj_10pysamstats_3opt_MapqStrand *p = (struct __pyx_obj_10pysamstats_3opt_MapqStrand *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->all);
  Py_CLEAR(p->fwd);
  Py_CLEAR(p->rev);
  Py_CLEAR(p->pp);
  Py_CLEAR(p->pp_fwd);
  Py_CLEAR(p->pp_rev);
  #if CYTHON_USE_TYPE_SLOTS
  if (PyType_IS_GC(Py_TYPE(o)->tp_base))
  #endif
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_10pysamstats_3opt_PileupStat(o);
}

static int __pyx_tp_traverse_10pysamstats_3opt_MapqStrand(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_10pysamstats_3opt_MapqStrand *p = (struct __pyx_obj_10pysamstats_3opt_MapqStrand *)o;
  e = ((likely(__pyx_ptype_10pysamstats_3opt_PileupStat)) ? ((__pyx_ptype_10pysamstats_3opt_PileupStat->tp_traverse) ? __pyx_ptype_10pysamstats_3opt_PileupStat->tp_traverse(o, v, a) : 0) : __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_10pysamstats_3opt_MapqStrand)); if (e) return e;
  if (p->all) {
    e = (*v)(((PyObject *)p->all), a); if (e) return e;
  }
  if (p->fwd) {
    e = (*v)(((PyObject *)p->fwd), a); if (e) return e;
  }
  if (p->rev) {
    e = (*v)(((PyObject *)p->rev), a); if (e) return e;
  }
  if (p->pp) {
    e = (*v)(((PyObject *)p->pp), a); if (e) return e;
  }
  if (p->pp_fwd) {
    e = (*v)(((PyObject *)p->pp_fwd), a); if (e) return e;
  }
  if (p->pp_rev) {
    e = (*v)(((PyObject *)p->pp_rev), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_10pysamstats_3opt_MapqStrand(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_10pysamstats_3opt_MapqStrand *p = (struct __pyx_obj_10pysamstats_3opt_MapqStrand *)o;
  if (likely(__pyx_ptype_10pysamstats_3opt_PileupStat)) { if (__pyx_ptype_10pysamstats_3opt_PileupStat->tp_clear) __pyx_ptype_10pysamstats_3opt_PileupStat->tp_clear(o); } else __Pyx_call_next_tp_clear(o, __pyx_tp_clear_10pysamstats_3opt_MapqStrand);
  tmp = ((PyObject*)p->all);
  p->all = ((struct __pyx_obj_10pysamstats_3opt_MapqHelper *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->fwd);
  p->fwd = ((struct __pyx_obj_10pysamstats_3opt_MapqHelper *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->rev);
  p->rev = ((struct __pyx_obj_10pysamstats_3opt_MapqHelper *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->pp);
  p->pp = ((struct __pyx_obj_10pysamstats_3opt_MapqHelper *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->pp_fwd);
  p->pp_fwd = ((struct __pyx_obj_10pysamstats_3opt_MapqHelper *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->pp_rev);
  p->pp_rev = ((struct __pyx_obj_10pysamstats_3opt_MapqHelper *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_10pysamstats_3opt_MapqStrand[] = {
  {"reset", (PyCFunction)__pyx_pw_10pysamstats_3opt_10MapqStrand_3reset, METH_NOARGS, __pyx_doc_10pysamstats_3opt_10MapqStrand_2reset},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_10pysamstats_3opt_10MapqStrand_5__reduce_cython__, METH_NOARGS, __pyx_doc_10pysamstats_3opt_10MapqStrand_4__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_10pysamstats_3opt_10MapqStrand_7__setstate_cython__, METH_O, __pyx_doc_10pysamstats_3opt_10MapqStrand_6__setstate_cython__},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_10pysamstats_3opt_MapqStrand = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysamstats.opt.MapqStrand", /*tp_name*/
  sizeof(struct __pyx_obj_10pysamstats_3opt_MapqStrand), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_10pysamstats_3opt_MapqStrand, /*tp_dealloc*/
  0, /*tp_print*/
  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_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "MapqStrand()", /*tp_doc*/
  __pyx_tp_traverse_10pysamstats_3opt_MapqStrand, /*tp_traverse*/
  __pyx_tp_clear_10pysamstats_3opt_MapqStrand, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_10pysamstats_3opt_MapqStrand, /*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*/
  __pyx_pw_10pysamstats_3opt_10MapqStrand_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_10pysamstats_3opt_MapqStrand, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_10pysamstats_3opt_BaseqHelper __pyx_vtable_10pysamstats_3opt_BaseqHelper;

static PyObject *__pyx_tp_new_10pysamstats_3opt_BaseqHelper(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_10pysamstats_3opt_BaseqHelper *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_10pysamstats_3opt_BaseqHelper *)o);
  p->__pyx_vtab = __pyx_vtabptr_10pysamstats_3opt_BaseqHelper;
  return o;
}

static void __pyx_tp_dealloc_10pysamstats_3opt_BaseqHelper(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_10pysamstats_3opt_BaseqHelper[] = {
  {"reset", (PyCFunction)__pyx_pw_10pysamstats_3opt_11BaseqHelper_3reset, METH_NOARGS, __pyx_doc_10pysamstats_3opt_11BaseqHelper_2reset},
  {"rms", (PyCFunction)__pyx_pw_10pysamstats_3opt_11BaseqHelper_5rms, METH_NOARGS, __pyx_doc_10pysamstats_3opt_11BaseqHelper_4rms},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_10pysamstats_3opt_11BaseqHelper_7__reduce_cython__, METH_NOARGS, __pyx_doc_10pysamstats_3opt_11BaseqHelper_6__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_10pysamstats_3opt_11BaseqHelper_9__setstate_cython__, METH_O, __pyx_doc_10pysamstats_3opt_11BaseqHelper_8__setstate_cython__},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_10pysamstats_3opt_BaseqHelper = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysamstats.opt.BaseqHelper", /*tp_name*/
  sizeof(struct __pyx_obj_10pysamstats_3opt_BaseqHelper), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_10pysamstats_3opt_BaseqHelper, /*tp_dealloc*/
  0, /*tp_print*/
  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_BASETYPE, /*tp_flags*/
  "BaseqHelper()", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_10pysamstats_3opt_BaseqHelper, /*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*/
  __pyx_pw_10pysamstats_3opt_11BaseqHelper_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_10pysamstats_3opt_BaseqHelper, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_10pysamstats_3opt_BaseqPpHelper __pyx_vtable_10pysamstats_3opt_BaseqPpHelper;

static PyObject *__pyx_tp_new_10pysamstats_3opt_BaseqPpHelper(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_10pysamstats_3opt_BaseqPpHelper *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_10pysamstats_3opt_BaseqPpHelper *)o);
  p->__pyx_vtab = __pyx_vtabptr_10pysamstats_3opt_BaseqPpHelper;
  p->all = ((struct __pyx_obj_10pysamstats_3opt_BaseqHelper *)Py_None); Py_INCREF(Py_None);
  p->pp = ((struct __pyx_obj_10pysamstats_3opt_BaseqHelper *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_10pysamstats_3opt_BaseqPpHelper(PyObject *o) {
  struct __pyx_obj_10pysamstats_3opt_BaseqPpHelper *p = (struct __pyx_obj_10pysamstats_3opt_BaseqPpHelper *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->all);
  Py_CLEAR(p->pp);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_10pysamstats_3opt_BaseqPpHelper(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_10pysamstats_3opt_BaseqPpHelper *p = (struct __pyx_obj_10pysamstats_3opt_BaseqPpHelper *)o;
  if (p->all) {
    e = (*v)(((PyObject *)p->all), a); if (e) return e;
  }
  if (p->pp) {
    e = (*v)(((PyObject *)p->pp), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_10pysamstats_3opt_BaseqPpHelper(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_10pysamstats_3opt_BaseqPpHelper *p = (struct __pyx_obj_10pysamstats_3opt_BaseqPpHelper *)o;
  tmp = ((PyObject*)p->all);
  p->all = ((struct __pyx_obj_10pysamstats_3opt_BaseqHelper *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->pp);
  p->pp = ((struct __pyx_obj_10pysamstats_3opt_BaseqHelper *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_10pysamstats_3opt_BaseqPpHelper[] = {
  {"reset", (PyCFunction)__pyx_pw_10pysamstats_3opt_13BaseqPpHelper_3reset, METH_NOARGS, __pyx_doc_10pysamstats_3opt_13BaseqPpHelper_2reset},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_10pysamstats_3opt_13BaseqPpHelper_5__reduce_cython__, METH_NOARGS, __pyx_doc_10pysamstats_3opt_13BaseqPpHelper_4__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_10pysamstats_3opt_13BaseqPpHelper_7__setstate_cython__, METH_O, __pyx_doc_10pysamstats_3opt_13BaseqPpHelper_6__setstate_cython__},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_10pysamstats_3opt_BaseqPpHelper = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysamstats.opt.BaseqPpHelper", /*tp_name*/
  sizeof(struct __pyx_obj_10pysamstats_3opt_BaseqPpHelper), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_10pysamstats_3opt_BaseqPpHelper, /*tp_dealloc*/
  0, /*tp_print*/
  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_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "BaseqPpHelper()", /*tp_doc*/
  __pyx_tp_traverse_10pysamstats_3opt_BaseqPpHelper, /*tp_traverse*/
  __pyx_tp_clear_10pysamstats_3opt_BaseqPpHelper, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_10pysamstats_3opt_BaseqPpHelper, /*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*/
  __pyx_pw_10pysamstats_3opt_13BaseqPpHelper_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_10pysamstats_3opt_BaseqPpHelper, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_10pysamstats_3opt_Baseq __pyx_vtable_10pysamstats_3opt_Baseq;

static PyObject *__pyx_tp_new_10pysamstats_3opt_Baseq(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_10pysamstats_3opt_Baseq *p;
  PyObject *o = __pyx_tp_new_10pysamstats_3opt_PileupStat(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_10pysamstats_3opt_Baseq *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_10pysamstats_3opt_PileupStat*)__pyx_vtabptr_10pysamstats_3opt_Baseq;
  p->helper = ((struct __pyx_obj_10pysamstats_3opt_BaseqPpHelper *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_10pysamstats_3opt_Baseq(PyObject *o) {
  struct __pyx_obj_10pysamstats_3opt_Baseq *p = (struct __pyx_obj_10pysamstats_3opt_Baseq *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->helper);
  #if CYTHON_USE_TYPE_SLOTS
  if (PyType_IS_GC(Py_TYPE(o)->tp_base))
  #endif
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_10pysamstats_3opt_PileupStat(o);
}

static int __pyx_tp_traverse_10pysamstats_3opt_Baseq(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_10pysamstats_3opt_Baseq *p = (struct __pyx_obj_10pysamstats_3opt_Baseq *)o;
  e = ((likely(__pyx_ptype_10pysamstats_3opt_PileupStat)) ? ((__pyx_ptype_10pysamstats_3opt_PileupStat->tp_traverse) ? __pyx_ptype_10pysamstats_3opt_PileupStat->tp_traverse(o, v, a) : 0) : __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_10pysamstats_3opt_Baseq)); if (e) return e;
  if (p->helper) {
    e = (*v)(((PyObject *)p->helper), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_10pysamstats_3opt_Baseq(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_10pysamstats_3opt_Baseq *p = (struct __pyx_obj_10pysamstats_3opt_Baseq *)o;
  if (likely(__pyx_ptype_10pysamstats_3opt_PileupStat)) { if (__pyx_ptype_10pysamstats_3opt_PileupStat->tp_clear) __pyx_ptype_10pysamstats_3opt_PileupStat->tp_clear(o); } else __Pyx_call_next_tp_clear(o, __pyx_tp_clear_10pysamstats_3opt_Baseq);
  tmp = ((PyObject*)p->helper);
  p->helper = ((struct __pyx_obj_10pysamstats_3opt_BaseqPpHelper *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_10pysamstats_3opt_Baseq[] = {
  {"reset", (PyCFunction)__pyx_pw_10pysamstats_3opt_5Baseq_3reset, METH_NOARGS, __pyx_doc_10pysamstats_3opt_5Baseq_2reset},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_10pysamstats_3opt_5Baseq_5__reduce_cython__, METH_NOARGS, __pyx_doc_10pysamstats_3opt_5Baseq_4__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_10pysamstats_3opt_5Baseq_7__setstate_cython__, METH_O, __pyx_doc_10pysamstats_3opt_5Baseq_6__setstate_cython__},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_10pysamstats_3opt_Baseq = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysamstats.opt.Baseq", /*tp_name*/
  sizeof(struct __pyx_obj_10pysamstats_3opt_Baseq), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_10pysamstats_3opt_Baseq, /*tp_dealloc*/
  0, /*tp_print*/
  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_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "Baseq()", /*tp_doc*/
  __pyx_tp_traverse_10pysamstats_3opt_Baseq, /*tp_traverse*/
  __pyx_tp_clear_10pysamstats_3opt_Baseq, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_10pysamstats_3opt_Baseq, /*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*/
  __pyx_pw_10pysamstats_3opt_5Baseq_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_10pysamstats_3opt_Baseq, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_10pysamstats_3opt_BaseqStrandPpHelper __pyx_vtable_10pysamstats_3opt_BaseqStrandPpHelper;

static PyObject *__pyx_tp_new_10pysamstats_3opt_BaseqStrandPpHelper(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_10pysamstats_3opt_BaseqStrandPpHelper *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_10pysamstats_3opt_BaseqStrandPpHelper *)o);
  p->__pyx_vtab = __pyx_vtabptr_10pysamstats_3opt_BaseqStrandPpHelper;
  p->all = ((struct __pyx_obj_10pysamstats_3opt_BaseqHelper *)Py_None); Py_INCREF(Py_None);
  p->fwd = ((struct __pyx_obj_10pysamstats_3opt_BaseqHelper *)Py_None); Py_INCREF(Py_None);
  p->rev = ((struct __pyx_obj_10pysamstats_3opt_BaseqHelper *)Py_None); Py_INCREF(Py_None);
  p->pp = ((struct __pyx_obj_10pysamstats_3opt_BaseqHelper *)Py_None); Py_INCREF(Py_None);
  p->pp_fwd = ((struct __pyx_obj_10pysamstats_3opt_BaseqHelper *)Py_None); Py_INCREF(Py_None);
  p->pp_rev = ((struct __pyx_obj_10pysamstats_3opt_BaseqHelper *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_10pysamstats_3opt_BaseqStrandPpHelper(PyObject *o) {
  struct __pyx_obj_10pysamstats_3opt_BaseqStrandPpHelper *p = (struct __pyx_obj_10pysamstats_3opt_BaseqStrandPpHelper *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->all);
  Py_CLEAR(p->fwd);
  Py_CLEAR(p->rev);
  Py_CLEAR(p->pp);
  Py_CLEAR(p->pp_fwd);
  Py_CLEAR(p->pp_rev);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_10pysamstats_3opt_BaseqStrandPpHelper(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_10pysamstats_3opt_BaseqStrandPpHelper *p = (struct __pyx_obj_10pysamstats_3opt_BaseqStrandPpHelper *)o;
  if (p->all) {
    e = (*v)(((PyObject *)p->all), a); if (e) return e;
  }
  if (p->fwd) {
    e = (*v)(((PyObject *)p->fwd), a); if (e) return e;
  }
  if (p->rev) {
    e = (*v)(((PyObject *)p->rev), a); if (e) return e;
  }
  if (p->pp) {
    e = (*v)(((PyObject *)p->pp), a); if (e) return e;
  }
  if (p->pp_fwd) {
    e = (*v)(((PyObject *)p->pp_fwd), a); if (e) return e;
  }
  if (p->pp_rev) {
    e = (*v)(((PyObject *)p->pp_rev), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_10pysamstats_3opt_BaseqStrandPpHelper(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_10pysamstats_3opt_BaseqStrandPpHelper *p = (struct __pyx_obj_10pysamstats_3opt_BaseqStrandPpHelper *)o;
  tmp = ((PyObject*)p->all);
  p->all = ((struct __pyx_obj_10pysamstats_3opt_BaseqHelper *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->fwd);
  p->fwd = ((struct __pyx_obj_10pysamstats_3opt_BaseqHelper *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->rev);
  p->rev = ((struct __pyx_obj_10pysamstats_3opt_BaseqHelper *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->pp);
  p->pp = ((struct __pyx_obj_10pysamstats_3opt_BaseqHelper *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->pp_fwd);
  p->pp_fwd = ((struct __pyx_obj_10pysamstats_3opt_BaseqHelper *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->pp_rev);
  p->pp_rev = ((struct __pyx_obj_10pysamstats_3opt_BaseqHelper *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_10pysamstats_3opt_BaseqStrandPpHelper[] = {
  {"reset", (PyCFunction)__pyx_pw_10pysamstats_3opt_19BaseqStrandPpHelper_3reset, METH_NOARGS, __pyx_doc_10pysamstats_3opt_19BaseqStrandPpHelper_2reset},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_10pysamstats_3opt_19BaseqStrandPpHelper_5__reduce_cython__, METH_NOARGS, __pyx_doc_10pysamstats_3opt_19BaseqStrandPpHelper_4__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_10pysamstats_3opt_19BaseqStrandPpHelper_7__setstate_cython__, METH_O, __pyx_doc_10pysamstats_3opt_19BaseqStrandPpHelper_6__setstate_cython__},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_10pysamstats_3opt_BaseqStrandPpHelper = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysamstats.opt.BaseqStrandPpHelper", /*tp_name*/
  sizeof(struct __pyx_obj_10pysamstats_3opt_BaseqStrandPpHelper), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_10pysamstats_3opt_BaseqStrandPpHelper, /*tp_dealloc*/
  0, /*tp_print*/
  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_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "BaseqStrandPpHelper()", /*tp_doc*/
  __pyx_tp_traverse_10pysamstats_3opt_BaseqStrandPpHelper, /*tp_traverse*/
  __pyx_tp_clear_10pysamstats_3opt_BaseqStrandPpHelper, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_10pysamstats_3opt_BaseqStrandPpHelper, /*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*/
  __pyx_pw_10pysamstats_3opt_19BaseqStrandPpHelper_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_10pysamstats_3opt_BaseqStrandPpHelper, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_10pysamstats_3opt_BaseqStrand __pyx_vtable_10pysamstats_3opt_BaseqStrand;

static PyObject *__pyx_tp_new_10pysamstats_3opt_BaseqStrand(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_10pysamstats_3opt_BaseqStrand *p;
  PyObject *o = __pyx_tp_new_10pysamstats_3opt_PileupStat(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_10pysamstats_3opt_BaseqStrand *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_10pysamstats_3opt_PileupStat*)__pyx_vtabptr_10pysamstats_3opt_BaseqStrand;
  p->helper = ((struct __pyx_obj_10pysamstats_3opt_BaseqStrandPpHelper *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_10pysamstats_3opt_BaseqStrand(PyObject *o) {
  struct __pyx_obj_10pysamstats_3opt_BaseqStrand *p = (struct __pyx_obj_10pysamstats_3opt_BaseqStrand *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->helper);
  #if CYTHON_USE_TYPE_SLOTS
  if (PyType_IS_GC(Py_TYPE(o)->tp_base))
  #endif
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_10pysamstats_3opt_PileupStat(o);
}

static int __pyx_tp_traverse_10pysamstats_3opt_BaseqStrand(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_10pysamstats_3opt_BaseqStrand *p = (struct __pyx_obj_10pysamstats_3opt_BaseqStrand *)o;
  e = ((likely(__pyx_ptype_10pysamstats_3opt_PileupStat)) ? ((__pyx_ptype_10pysamstats_3opt_PileupStat->tp_traverse) ? __pyx_ptype_10pysamstats_3opt_PileupStat->tp_traverse(o, v, a) : 0) : __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_10pysamstats_3opt_BaseqStrand)); if (e) return e;
  if (p->helper) {
    e = (*v)(((PyObject *)p->helper), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_10pysamstats_3opt_BaseqStrand(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_10pysamstats_3opt_BaseqStrand *p = (struct __pyx_obj_10pysamstats_3opt_BaseqStrand *)o;
  if (likely(__pyx_ptype_10pysamstats_3opt_PileupStat)) { if (__pyx_ptype_10pysamstats_3opt_PileupStat->tp_clear) __pyx_ptype_10pysamstats_3opt_PileupStat->tp_clear(o); } else __Pyx_call_next_tp_clear(o, __pyx_tp_clear_10pysamstats_3opt_BaseqStrand);
  tmp = ((PyObject*)p->helper);
  p->helper = ((struct __pyx_obj_10pysamstats_3opt_BaseqStrandPpHelper *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_10pysamstats_3opt_BaseqStrand[] = {
  {"reset", (PyCFunction)__pyx_pw_10pysamstats_3opt_11BaseqStrand_3reset, METH_NOARGS, __pyx_doc_10pysamstats_3opt_11BaseqStrand_2reset},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_10pysamstats_3opt_11BaseqStrand_5__reduce_cython__, METH_NOARGS, __pyx_doc_10pysamstats_3opt_11BaseqStrand_4__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_10pysamstats_3opt_11BaseqStrand_7__setstate_cython__, METH_O, __pyx_doc_10pysamstats_3opt_11BaseqStrand_6__setstate_cython__},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_10pysamstats_3opt_BaseqStrand = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysamstats.opt.BaseqStrand", /*tp_name*/
  sizeof(struct __pyx_obj_10pysamstats_3opt_BaseqStrand), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_10pysamstats_3opt_BaseqStrand, /*tp_dealloc*/
  0, /*tp_print*/
  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_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "BaseqStrand()", /*tp_doc*/
  __pyx_tp_traverse_10pysamstats_3opt_BaseqStrand, /*tp_traverse*/
  __pyx_tp_clear_10pysamstats_3opt_BaseqStrand, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_10pysamstats_3opt_BaseqStrand, /*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*/
  __pyx_pw_10pysamstats_3opt_11BaseqStrand_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_10pysamstats_3opt_BaseqStrand, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_10pysamstats_3opt_BaseqExt __pyx_vtable_10pysamstats_3opt_BaseqExt;

static PyObject *__pyx_tp_new_10pysamstats_3opt_BaseqExt(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_10pysamstats_3opt_BaseqExt *p;
  PyObject *o = __pyx_tp_new_10pysamstats_3opt_PileupStat(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_10pysamstats_3opt_BaseqExt *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_10pysamstats_3opt_PileupStat*)__pyx_vtabptr_10pysamstats_3opt_BaseqExt;
  p->all = ((struct __pyx_obj_10pysamstats_3opt_BaseqPpHelper *)Py_None); Py_INCREF(Py_None);
  p->matches = ((struct __pyx_obj_10pysamstats_3opt_BaseqPpHelper *)Py_None); Py_INCREF(Py_None);
  p->mismatches = ((struct __pyx_obj_10pysamstats_3opt_BaseqPpHelper *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_10pysamstats_3opt_BaseqExt(PyObject *o) {
  struct __pyx_obj_10pysamstats_3opt_BaseqExt *p = (struct __pyx_obj_10pysamstats_3opt_BaseqExt *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->all);
  Py_CLEAR(p->matches);
  Py_CLEAR(p->mismatches);
  #if CYTHON_USE_TYPE_SLOTS
  if (PyType_IS_GC(Py_TYPE(o)->tp_base))
  #endif
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_10pysamstats_3opt_PileupStat(o);
}

static int __pyx_tp_traverse_10pysamstats_3opt_BaseqExt(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_10pysamstats_3opt_BaseqExt *p = (struct __pyx_obj_10pysamstats_3opt_BaseqExt *)o;
  e = ((likely(__pyx_ptype_10pysamstats_3opt_PileupStat)) ? ((__pyx_ptype_10pysamstats_3opt_PileupStat->tp_traverse) ? __pyx_ptype_10pysamstats_3opt_PileupStat->tp_traverse(o, v, a) : 0) : __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_10pysamstats_3opt_BaseqExt)); if (e) return e;
  if (p->all) {
    e = (*v)(((PyObject *)p->all), a); if (e) return e;
  }
  if (p->matches) {
    e = (*v)(((PyObject *)p->matches), a); if (e) return e;
  }
  if (p->mismatches) {
    e = (*v)(((PyObject *)p->mismatches), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_10pysamstats_3opt_BaseqExt(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_10pysamstats_3opt_BaseqExt *p = (struct __pyx_obj_10pysamstats_3opt_BaseqExt *)o;
  if (likely(__pyx_ptype_10pysamstats_3opt_PileupStat)) { if (__pyx_ptype_10pysamstats_3opt_PileupStat->tp_clear) __pyx_ptype_10pysamstats_3opt_PileupStat->tp_clear(o); } else __Pyx_call_next_tp_clear(o, __pyx_tp_clear_10pysamstats_3opt_BaseqExt);
  tmp = ((PyObject*)p->all);
  p->all = ((struct __pyx_obj_10pysamstats_3opt_BaseqPpHelper *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->matches);
  p->matches = ((struct __pyx_obj_10pysamstats_3opt_BaseqPpHelper *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->mismatches);
  p->mismatches = ((struct __pyx_obj_10pysamstats_3opt_BaseqPpHelper *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_10pysamstats_3opt_BaseqExt[] = {
  {"reset", (PyCFunction)__pyx_pw_10pysamstats_3opt_8BaseqExt_3reset, METH_NOARGS, __pyx_doc_10pysamstats_3opt_8BaseqExt_2reset},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_10pysamstats_3opt_8BaseqExt_5__reduce_cython__, METH_NOARGS, __pyx_doc_10pysamstats_3opt_8BaseqExt_4__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_10pysamstats_3opt_8BaseqExt_7__setstate_cython__, METH_O, __pyx_doc_10pysamstats_3opt_8BaseqExt_6__setstate_cython__},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_10pysamstats_3opt_BaseqExt = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysamstats.opt.BaseqExt", /*tp_name*/
  sizeof(struct __pyx_obj_10pysamstats_3opt_BaseqExt), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_10pysamstats_3opt_BaseqExt, /*tp_dealloc*/
  0, /*tp_print*/
  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_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "BaseqExt()", /*tp_doc*/
  __pyx_tp_traverse_10pysamstats_3opt_BaseqExt, /*tp_traverse*/
  __pyx_tp_clear_10pysamstats_3opt_BaseqExt, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_10pysamstats_3opt_BaseqExt, /*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*/
  __pyx_pw_10pysamstats_3opt_8BaseqExt_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_10pysamstats_3opt_BaseqExt, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_10pysamstats_3opt_BaseqExtStrand __pyx_vtable_10pysamstats_3opt_BaseqExtStrand;

static PyObject *__pyx_tp_new_10pysamstats_3opt_BaseqExtStrand(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_10pysamstats_3opt_BaseqExtStrand *p;
  PyObject *o = __pyx_tp_new_10pysamstats_3opt_PileupStat(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_10pysamstats_3opt_BaseqExtStrand *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_10pysamstats_3opt_PileupStat*)__pyx_vtabptr_10pysamstats_3opt_BaseqExtStrand;
  p->all = ((struct __pyx_obj_10pysamstats_3opt_BaseqStrandPpHelper *)Py_None); Py_INCREF(Py_None);
  p->matches = ((struct __pyx_obj_10pysamstats_3opt_BaseqStrandPpHelper *)Py_None); Py_INCREF(Py_None);
  p->mismatches = ((struct __pyx_obj_10pysamstats_3opt_BaseqStrandPpHelper *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_10pysamstats_3opt_BaseqExtStrand(PyObject *o) {
  struct __pyx_obj_10pysamstats_3opt_BaseqExtStrand *p = (struct __pyx_obj_10pysamstats_3opt_BaseqExtStrand *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->all);
  Py_CLEAR(p->matches);
  Py_CLEAR(p->mismatches);
  #if CYTHON_USE_TYPE_SLOTS
  if (PyType_IS_GC(Py_TYPE(o)->tp_base))
  #endif
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_10pysamstats_3opt_PileupStat(o);
}

static int __pyx_tp_traverse_10pysamstats_3opt_BaseqExtStrand(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_10pysamstats_3opt_BaseqExtStrand *p = (struct __pyx_obj_10pysamstats_3opt_BaseqExtStrand *)o;
  e = ((likely(__pyx_ptype_10pysamstats_3opt_PileupStat)) ? ((__pyx_ptype_10pysamstats_3opt_PileupStat->tp_traverse) ? __pyx_ptype_10pysamstats_3opt_PileupStat->tp_traverse(o, v, a) : 0) : __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_10pysamstats_3opt_BaseqExtStrand)); if (e) return e;
  if (p->all) {
    e = (*v)(((PyObject *)p->all), a); if (e) return e;
  }
  if (p->matches) {
    e = (*v)(((PyObject *)p->matches), a); if (e) return e;
  }
  if (p->mismatches) {
    e = (*v)(((PyObject *)p->mismatches), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_10pysamstats_3opt_BaseqExtStrand(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_10pysamstats_3opt_BaseqExtStrand *p = (struct __pyx_obj_10pysamstats_3opt_BaseqExtStrand *)o;
  if (likely(__pyx_ptype_10pysamstats_3opt_PileupStat)) { if (__pyx_ptype_10pysamstats_3opt_PileupStat->tp_clear) __pyx_ptype_10pysamstats_3opt_PileupStat->tp_clear(o); } else __Pyx_call_next_tp_clear(o, __pyx_tp_clear_10pysamstats_3opt_BaseqExtStrand);
  tmp = ((PyObject*)p->all);
  p->all = ((struct __pyx_obj_10pysamstats_3opt_BaseqStrandPpHelper *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->matches);
  p->matches = ((struct __pyx_obj_10pysamstats_3opt_BaseqStrandPpHelper *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->mismatches);
  p->mismatches = ((struct __pyx_obj_10pysamstats_3opt_BaseqStrandPpHelper *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_10pysamstats_3opt_BaseqExtStrand[] = {
  {"reset", (PyCFunction)__pyx_pw_10pysamstats_3opt_14BaseqExtStrand_3reset, METH_NOARGS, __pyx_doc_10pysamstats_3opt_14BaseqExtStrand_2reset},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_10pysamstats_3opt_14BaseqExtStrand_5__reduce_cython__, METH_NOARGS, __pyx_doc_10pysamstats_3opt_14BaseqExtStrand_4__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_10pysamstats_3opt_14BaseqExtStrand_7__setstate_cython__, METH_O, __pyx_doc_10pysamstats_3opt_14BaseqExtStrand_6__setstate_cython__},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_10pysamstats_3opt_BaseqExtStrand = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysamstats.opt.BaseqExtStrand", /*tp_name*/
  sizeof(struct __pyx_obj_10pysamstats_3opt_BaseqExtStrand), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_10pysamstats_3opt_BaseqExtStrand, /*tp_dealloc*/
  0, /*tp_print*/
  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_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "BaseqExtStrand()", /*tp_doc*/
  __pyx_tp_traverse_10pysamstats_3opt_BaseqExtStrand, /*tp_traverse*/
  __pyx_tp_clear_10pysamstats_3opt_BaseqExtStrand, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_10pysamstats_3opt_BaseqExtStrand, /*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*/
  __pyx_pw_10pysamstats_3opt_14BaseqExtStrand_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_10pysamstats_3opt_BaseqExtStrand, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_10pysamstats_3opt_CoverageGC __pyx_vtable_10pysamstats_3opt_CoverageGC;

static PyObject *__pyx_tp_new_10pysamstats_3opt_CoverageGC(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_10pysamstats_3opt_CoverageGC *p;
  PyObject *o = __pyx_tp_new_10pysamstats_3opt_PileupStat(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_10pysamstats_3opt_CoverageGC *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_10pysamstats_3opt_PileupStat*)__pyx_vtabptr_10pysamstats_3opt_CoverageGC;
  p->reads = ((struct __pyx_obj_10pysamstats_3opt_CountPp *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_10pysamstats_3opt_CoverageGC(PyObject *o) {
  struct __pyx_obj_10pysamstats_3opt_CoverageGC *p = (struct __pyx_obj_10pysamstats_3opt_CoverageGC *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->reads);
  #if CYTHON_USE_TYPE_SLOTS
  if (PyType_IS_GC(Py_TYPE(o)->tp_base))
  #endif
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_10pysamstats_3opt_PileupStat(o);
}

static int __pyx_tp_traverse_10pysamstats_3opt_CoverageGC(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_10pysamstats_3opt_CoverageGC *p = (struct __pyx_obj_10pysamstats_3opt_CoverageGC *)o;
  e = ((likely(__pyx_ptype_10pysamstats_3opt_PileupStat)) ? ((__pyx_ptype_10pysamstats_3opt_PileupStat->tp_traverse) ? __pyx_ptype_10pysamstats_3opt_PileupStat->tp_traverse(o, v, a) : 0) : __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_10pysamstats_3opt_CoverageGC)); if (e) return e;
  if (p->reads) {
    e = (*v)(((PyObject *)p->reads), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_10pysamstats_3opt_CoverageGC(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_10pysamstats_3opt_CoverageGC *p = (struct __pyx_obj_10pysamstats_3opt_CoverageGC *)o;
  if (likely(__pyx_ptype_10pysamstats_3opt_PileupStat)) { if (__pyx_ptype_10pysamstats_3opt_PileupStat->tp_clear) __pyx_ptype_10pysamstats_3opt_PileupStat->tp_clear(o); } else __Pyx_call_next_tp_clear(o, __pyx_tp_clear_10pysamstats_3opt_CoverageGC);
  tmp = ((PyObject*)p->reads);
  p->reads = ((struct __pyx_obj_10pysamstats_3opt_CountPp *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_10pysamstats_3opt_CoverageGC[] = {
  {"reset", (PyCFunction)__pyx_pw_10pysamstats_3opt_10CoverageGC_3reset, METH_NOARGS, __pyx_doc_10pysamstats_3opt_10CoverageGC_2reset},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_10pysamstats_3opt_10CoverageGC_5__reduce_cython__, METH_NOARGS, __pyx_doc_10pysamstats_3opt_10CoverageGC_4__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_10pysamstats_3opt_10CoverageGC_7__setstate_cython__, METH_O, __pyx_doc_10pysamstats_3opt_10CoverageGC_6__setstate_cython__},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_10pysamstats_3opt_CoverageGC = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysamstats.opt.CoverageGC", /*tp_name*/
  sizeof(struct __pyx_obj_10pysamstats_3opt_CoverageGC), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_10pysamstats_3opt_CoverageGC, /*tp_dealloc*/
  0, /*tp_print*/
  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_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "CoverageGC(window_size, window_offset)", /*tp_doc*/
  __pyx_tp_traverse_10pysamstats_3opt_CoverageGC, /*tp_traverse*/
  __pyx_tp_clear_10pysamstats_3opt_CoverageGC, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_10pysamstats_3opt_CoverageGC, /*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*/
  __pyx_pw_10pysamstats_3opt_10CoverageGC_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_10pysamstats_3opt_CoverageGC, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_10pysamstats_3opt_BinnedStat __pyx_vtable_10pysamstats_3opt_BinnedStat;

static PyObject *__pyx_tp_new_10pysamstats_3opt_BinnedStat(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_10pysamstats_3opt_BinnedStat *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_10pysamstats_3opt_BinnedStat *)o);
  p->__pyx_vtab = __pyx_vtabptr_10pysamstats_3opt_BinnedStat;
  return o;
}

static void __pyx_tp_dealloc_10pysamstats_3opt_BinnedStat(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_10pysamstats_3opt_BinnedStat[] = {
  {"__reduce_cython__", (PyCFunction)__pyx_pw_10pysamstats_3opt_10BinnedStat_1__reduce_cython__, METH_NOARGS, __pyx_doc_10pysamstats_3opt_10BinnedStat___reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_10pysamstats_3opt_10BinnedStat_3__setstate_cython__, METH_O, __pyx_doc_10pysamstats_3opt_10BinnedStat_2__setstate_cython__},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_10pysamstats_3opt_BinnedStat = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysamstats.opt.BinnedStat", /*tp_name*/
  sizeof(struct __pyx_obj_10pysamstats_3opt_BinnedStat), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_10pysamstats_3opt_BinnedStat, /*tp_dealloc*/
  0, /*tp_print*/
  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_BASETYPE, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_10pysamstats_3opt_BinnedStat, /*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_10pysamstats_3opt_BinnedStat, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_10pysamstats_3opt_CoverageBinned __pyx_vtable_10pysamstats_3opt_CoverageBinned;

static PyObject *__pyx_tp_new_10pysamstats_3opt_CoverageBinned(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_10pysamstats_3opt_CoverageBinned *p;
  PyObject *o = __pyx_tp_new_10pysamstats_3opt_BinnedStat(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_10pysamstats_3opt_CoverageBinned *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_10pysamstats_3opt_BinnedStat*)__pyx_vtabptr_10pysamstats_3opt_CoverageBinned;
  return o;
}

static PyMethodDef __pyx_methods_10pysamstats_3opt_CoverageBinned[] = {
  {"__reduce_cython__", (PyCFunction)__pyx_pw_10pysamstats_3opt_14CoverageBinned_3__reduce_cython__, METH_NOARGS, __pyx_doc_10pysamstats_3opt_14CoverageBinned_2__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_10pysamstats_3opt_14CoverageBinned_5__setstate_cython__, METH_O, __pyx_doc_10pysamstats_3opt_14CoverageBinned_4__setstate_cython__},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_10pysamstats_3opt_CoverageBinned = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysamstats.opt.CoverageBinned", /*tp_name*/
  sizeof(struct __pyx_obj_10pysamstats_3opt_CoverageBinned), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_10pysamstats_3opt_BinnedStat, /*tp_dealloc*/
  0, /*tp_print*/
  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_BASETYPE, /*tp_flags*/
  "CoverageBinned()", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_10pysamstats_3opt_CoverageBinned, /*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*/
  __pyx_pw_10pysamstats_3opt_14CoverageBinned_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_10pysamstats_3opt_CoverageBinned, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_10pysamstats_3opt_CoverageExtBinned __pyx_vtable_10pysamstats_3opt_CoverageExtBinned;

static PyObject *__pyx_tp_new_10pysamstats_3opt_CoverageExtBinned(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_10pysamstats_3opt_CoverageExtBinned *p;
  PyObject *o = __pyx_tp_new_10pysamstats_3opt_BinnedStat(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_10pysamstats_3opt_CoverageExtBinned *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_10pysamstats_3opt_BinnedStat*)__pyx_vtabptr_10pysamstats_3opt_CoverageExtBinned;
  return o;
}

static PyMethodDef __pyx_methods_10pysamstats_3opt_CoverageExtBinned[] = {
  {"__reduce_cython__", (PyCFunction)__pyx_pw_10pysamstats_3opt_17CoverageExtBinned_3__reduce_cython__, METH_NOARGS, __pyx_doc_10pysamstats_3opt_17CoverageExtBinned_2__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_10pysamstats_3opt_17CoverageExtBinned_5__setstate_cython__, METH_O, __pyx_doc_10pysamstats_3opt_17CoverageExtBinned_4__setstate_cython__},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_10pysamstats_3opt_CoverageExtBinned = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysamstats.opt.CoverageExtBinned", /*tp_name*/
  sizeof(struct __pyx_obj_10pysamstats_3opt_CoverageExtBinned), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_10pysamstats_3opt_BinnedStat, /*tp_dealloc*/
  0, /*tp_print*/
  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_BASETYPE, /*tp_flags*/
  "CoverageExtBinned()", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_10pysamstats_3opt_CoverageExtBinned, /*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*/
  __pyx_pw_10pysamstats_3opt_17CoverageExtBinned_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_10pysamstats_3opt_CoverageExtBinned, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_10pysamstats_3opt_MapqBinned __pyx_vtable_10pysamstats_3opt_MapqBinned;

static PyObject *__pyx_tp_new_10pysamstats_3opt_MapqBinned(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_10pysamstats_3opt_MapqBinned *p;
  PyObject *o = __pyx_tp_new_10pysamstats_3opt_BinnedStat(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_10pysamstats_3opt_MapqBinned *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_10pysamstats_3opt_BinnedStat*)__pyx_vtabptr_10pysamstats_3opt_MapqBinned;
  return o;
}

static PyMethodDef __pyx_methods_10pysamstats_3opt_MapqBinned[] = {
  {"__reduce_cython__", (PyCFunction)__pyx_pw_10pysamstats_3opt_10MapqBinned_3__reduce_cython__, METH_NOARGS, __pyx_doc_10pysamstats_3opt_10MapqBinned_2__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_10pysamstats_3opt_10MapqBinned_5__setstate_cython__, METH_O, __pyx_doc_10pysamstats_3opt_10MapqBinned_4__setstate_cython__},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_10pysamstats_3opt_MapqBinned = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysamstats.opt.MapqBinned", /*tp_name*/
  sizeof(struct __pyx_obj_10pysamstats_3opt_MapqBinned), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_10pysamstats_3opt_BinnedStat, /*tp_dealloc*/
  0, /*tp_print*/
  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_BASETYPE, /*tp_flags*/
  "MapqBinned()", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_10pysamstats_3opt_MapqBinned, /*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*/
  __pyx_pw_10pysamstats_3opt_10MapqBinned_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_10pysamstats_3opt_MapqBinned, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_10pysamstats_3opt_AlignmentBinned __pyx_vtable_10pysamstats_3opt_AlignmentBinned;

static PyObject *__pyx_tp_new_10pysamstats_3opt_AlignmentBinned(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_10pysamstats_3opt_AlignmentBinned *p;
  PyObject *o = __pyx_tp_new_10pysamstats_3opt_BinnedStat(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_10pysamstats_3opt_AlignmentBinned *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_10pysamstats_3opt_BinnedStat*)__pyx_vtabptr_10pysamstats_3opt_AlignmentBinned;
  return o;
}

static PyMethodDef __pyx_methods_10pysamstats_3opt_AlignmentBinned[] = {
  {"__reduce_cython__", (PyCFunction)__pyx_pw_10pysamstats_3opt_15AlignmentBinned_3__reduce_cython__, METH_NOARGS, __pyx_doc_10pysamstats_3opt_15AlignmentBinned_2__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_10pysamstats_3opt_15AlignmentBinned_5__setstate_cython__, METH_O, __pyx_doc_10pysamstats_3opt_15AlignmentBinned_4__setstate_cython__},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_10pysamstats_3opt_AlignmentBinned = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysamstats.opt.AlignmentBinned", /*tp_name*/
  sizeof(struct __pyx_obj_10pysamstats_3opt_AlignmentBinned), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_10pysamstats_3opt_BinnedStat, /*tp_dealloc*/
  0, /*tp_print*/
  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_BASETYPE, /*tp_flags*/
  "AlignmentBinned()", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_10pysamstats_3opt_AlignmentBinned, /*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*/
  __pyx_pw_10pysamstats_3opt_15AlignmentBinned_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_10pysamstats_3opt_AlignmentBinned, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_10pysamstats_3opt_TlenBinned __pyx_vtable_10pysamstats_3opt_TlenBinned;

static PyObject *__pyx_tp_new_10pysamstats_3opt_TlenBinned(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_10pysamstats_3opt_TlenBinned *p;
  PyObject *o = __pyx_tp_new_10pysamstats_3opt_BinnedStat(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_10pysamstats_3opt_TlenBinned *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_10pysamstats_3opt_BinnedStat*)__pyx_vtabptr_10pysamstats_3opt_TlenBinned;
  return o;
}

static PyMethodDef __pyx_methods_10pysamstats_3opt_TlenBinned[] = {
  {"__reduce_cython__", (PyCFunction)__pyx_pw_10pysamstats_3opt_10TlenBinned_3__reduce_cython__, METH_NOARGS, __pyx_doc_10pysamstats_3opt_10TlenBinned_2__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_10pysamstats_3opt_10TlenBinned_5__setstate_cython__, METH_O, __pyx_doc_10pysamstats_3opt_10TlenBinned_4__setstate_cython__},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_10pysamstats_3opt_TlenBinned = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysamstats.opt.TlenBinned", /*tp_name*/
  sizeof(struct __pyx_obj_10pysamstats_3opt_TlenBinned), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_10pysamstats_3opt_BinnedStat, /*tp_dealloc*/
  0, /*tp_print*/
  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_BASETYPE, /*tp_flags*/
  "TlenBinned()", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_10pysamstats_3opt_TlenBinned, /*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*/
  __pyx_pw_10pysamstats_3opt_10TlenBinned_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_10pysamstats_3opt_TlenBinned, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_10pysamstats_3opt___pyx_scope_struct__iter_pileup_default *__pyx_freelist_10pysamstats_3opt___pyx_scope_struct__iter_pileup_default[8];
static int __pyx_freecount_10pysamstats_3opt___pyx_scope_struct__iter_pileup_default = 0;

static PyObject *__pyx_tp_new_10pysamstats_3opt___pyx_scope_struct__iter_pileup_default(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_10pysamstats_3opt___pyx_scope_struct__iter_pileup_default > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_10pysamstats_3opt___pyx_scope_struct__iter_pileup_default)))) {
    o = (PyObject*)__pyx_freelist_10pysamstats_3opt___pyx_scope_struct__iter_pileup_default[--__pyx_freecount_10pysamstats_3opt___pyx_scope_struct__iter_pileup_default];
    memset(o, 0, sizeof(struct __pyx_obj_10pysamstats_3opt___pyx_scope_struct__iter_pileup_default));
    (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_10pysamstats_3opt___pyx_scope_struct__iter_pileup_default(PyObject *o) {
  struct __pyx_obj_10pysamstats_3opt___pyx_scope_struct__iter_pileup_default *p = (struct __pyx_obj_10pysamstats_3opt___pyx_scope_struct__iter_pileup_default *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_alignmentfile);
  Py_CLEAR(p->__pyx_v_chrom);
  Py_CLEAR(p->__pyx_v_col);
  Py_CLEAR(p->__pyx_v_end);
  Py_CLEAR(p->__pyx_v_fafile);
  Py_CLEAR(p->__pyx_v_it);
  Py_CLEAR(p->__pyx_v_max_depth);
  Py_CLEAR(p->__pyx_v_one_based);
  Py_CLEAR(p->__pyx_v_rec);
  Py_CLEAR(p->__pyx_v_start);
  Py_CLEAR(p->__pyx_v_stat);
  Py_CLEAR(p->__pyx_v_stepper);
  Py_CLEAR(p->__pyx_v_truncate);
  Py_CLEAR(p->__pyx_t_0);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_10pysamstats_3opt___pyx_scope_struct__iter_pileup_default < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_10pysamstats_3opt___pyx_scope_struct__iter_pileup_default)))) {
    __pyx_freelist_10pysamstats_3opt___pyx_scope_struct__iter_pileup_default[__pyx_freecount_10pysamstats_3opt___pyx_scope_struct__iter_pileup_default++] = ((struct __pyx_obj_10pysamstats_3opt___pyx_scope_struct__iter_pileup_default *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_10pysamstats_3opt___pyx_scope_struct__iter_pileup_default(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_10pysamstats_3opt___pyx_scope_struct__iter_pileup_default *p = (struct __pyx_obj_10pysamstats_3opt___pyx_scope_struct__iter_pileup_default *)o;
  if (p->__pyx_v_alignmentfile) {
    e = (*v)(p->__pyx_v_alignmentfile, a); if (e) return e;
  }
  if (p->__pyx_v_chrom) {
    e = (*v)(p->__pyx_v_chrom, a); if (e) return e;
  }
  if (p->__pyx_v_col) {
    e = (*v)(((PyObject *)p->__pyx_v_col), a); if (e) return e;
  }
  if (p->__pyx_v_end) {
    e = (*v)(p->__pyx_v_end, a); if (e) return e;
  }
  if (p->__pyx_v_fafile) {
    e = (*v)(p->__pyx_v_fafile, a); if (e) return e;
  }
  if (p->__pyx_v_it) {
    e = (*v)(p->__pyx_v_it, a); if (e) return e;
  }
  if (p->__pyx_v_max_depth) {
    e = (*v)(p->__pyx_v_max_depth, a); if (e) return e;
  }
  if (p->__pyx_v_one_based) {
    e = (*v)(p->__pyx_v_one_based, a); if (e) return e;
  }
  if (p->__pyx_v_rec) {
    e = (*v)(p->__pyx_v_rec, a); if (e) return e;
  }
  if (p->__pyx_v_start) {
    e = (*v)(p->__pyx_v_start, a); if (e) return e;
  }
  if (p->__pyx_v_stat) {
    e = (*v)(p->__pyx_v_stat, a); if (e) return e;
  }
  if (p->__pyx_v_stepper) {
    e = (*v)(p->__pyx_v_stepper, a); if (e) return e;
  }
  if (p->__pyx_v_truncate) {
    e = (*v)(p->__pyx_v_truncate, 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_10pysamstats_3opt___pyx_scope_struct__iter_pileup_default = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysamstats.opt.__pyx_scope_struct__iter_pileup_default", /*tp_name*/
  sizeof(struct __pyx_obj_10pysamstats_3opt___pyx_scope_struct__iter_pileup_default), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_10pysamstats_3opt___pyx_scope_struct__iter_pileup_default, /*tp_dealloc*/
  0, /*tp_print*/
  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_10pysamstats_3opt___pyx_scope_struct__iter_pileup_default, /*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_10pysamstats_3opt___pyx_scope_struct__iter_pileup_default, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_10pysamstats_3opt___pyx_scope_struct_1_iter_pileup_padded_chrom *__pyx_freelist_10pysamstats_3opt___pyx_scope_struct_1_iter_pileup_padded_chrom[8];
static int __pyx_freecount_10pysamstats_3opt___pyx_scope_struct_1_iter_pileup_padded_chrom = 0;

static PyObject *__pyx_tp_new_10pysamstats_3opt___pyx_scope_struct_1_iter_pileup_padded_chrom(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_10pysamstats_3opt___pyx_scope_struct_1_iter_pileup_padded_chrom > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_10pysamstats_3opt___pyx_scope_struct_1_iter_pileup_padded_chrom)))) {
    o = (PyObject*)__pyx_freelist_10pysamstats_3opt___pyx_scope_struct_1_iter_pileup_padded_chrom[--__pyx_freecount_10pysamstats_3opt___pyx_scope_struct_1_iter_pileup_padded_chrom];
    memset(o, 0, sizeof(struct __pyx_obj_10pysamstats_3opt___pyx_scope_struct_1_iter_pileup_padded_chrom));
    (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_10pysamstats_3opt___pyx_scope_struct_1_iter_pileup_padded_chrom(PyObject *o) {
  struct __pyx_obj_10pysamstats_3opt___pyx_scope_struct_1_iter_pileup_padded_chrom *p = (struct __pyx_obj_10pysamstats_3opt___pyx_scope_struct_1_iter_pileup_padded_chrom *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_alignmentfile);
  Py_CLEAR(p->__pyx_v_chrom);
  Py_CLEAR(p->__pyx_v_col);
  Py_CLEAR(p->__pyx_v_end);
  Py_CLEAR(p->__pyx_v_fafile);
  Py_CLEAR(p->__pyx_v_it);
  Py_CLEAR(p->__pyx_v_max_depth);
  Py_CLEAR(p->__pyx_v_min_baseq);
  Py_CLEAR(p->__pyx_v_min_mapq);
  Py_CLEAR(p->__pyx_v_no_del);
  Py_CLEAR(p->__pyx_v_no_dup);
  Py_CLEAR(p->__pyx_v_one_based);
  Py_CLEAR(p->__pyx_v_rec);
  Py_CLEAR(p->__pyx_v_refbase);
  Py_CLEAR(p->__pyx_v_start);
  Py_CLEAR(p->__pyx_v_stat);
  Py_CLEAR(p->__pyx_v_stepper);
  Py_CLEAR(p->__pyx_v_truncate);
  Py_CLEAR(p->__pyx_t_0);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_10pysamstats_3opt___pyx_scope_struct_1_iter_pileup_padded_chrom < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_10pysamstats_3opt___pyx_scope_struct_1_iter_pileup_padded_chrom)))) {
    __pyx_freelist_10pysamstats_3opt___pyx_scope_struct_1_iter_pileup_padded_chrom[__pyx_freecount_10pysamstats_3opt___pyx_scope_struct_1_iter_pileup_padded_chrom++] = ((struct __pyx_obj_10pysamstats_3opt___pyx_scope_struct_1_iter_pileup_padded_chrom *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_10pysamstats_3opt___pyx_scope_struct_1_iter_pileup_padded_chrom(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_10pysamstats_3opt___pyx_scope_struct_1_iter_pileup_padded_chrom *p = (struct __pyx_obj_10pysamstats_3opt___pyx_scope_struct_1_iter_pileup_padded_chrom *)o;
  if (p->__pyx_v_alignmentfile) {
    e = (*v)(p->__pyx_v_alignmentfile, a); if (e) return e;
  }
  if (p->__pyx_v_chrom) {
    e = (*v)(p->__pyx_v_chrom, a); if (e) return e;
  }
  if (p->__pyx_v_col) {
    e = (*v)(((PyObject *)p->__pyx_v_col), a); if (e) return e;
  }
  if (p->__pyx_v_end) {
    e = (*v)(p->__pyx_v_end, a); if (e) return e;
  }
  if (p->__pyx_v_fafile) {
    e = (*v)(p->__pyx_v_fafile, a); if (e) return e;
  }
  if (p->__pyx_v_it) {
    e = (*v)(p->__pyx_v_it, a); if (e) return e;
  }
  if (p->__pyx_v_max_depth) {
    e = (*v)(p->__pyx_v_max_depth, a); if (e) return e;
  }
  if (p->__pyx_v_min_baseq) {
    e = (*v)(p->__pyx_v_min_baseq, a); if (e) return e;
  }
  if (p->__pyx_v_min_mapq) {
    e = (*v)(p->__pyx_v_min_mapq, a); if (e) return e;
  }
  if (p->__pyx_v_no_del) {
    e = (*v)(p->__pyx_v_no_del, a); if (e) return e;
  }
  if (p->__pyx_v_no_dup) {
    e = (*v)(p->__pyx_v_no_dup, a); if (e) return e;
  }
  if (p->__pyx_v_one_based) {
    e = (*v)(p->__pyx_v_one_based, a); if (e) return e;
  }
  if (p->__pyx_v_rec) {
    e = (*v)(p->__pyx_v_rec, a); if (e) return e;
  }
  if (p->__pyx_v_refbase) {
    e = (*v)(p->__pyx_v_refbase, a); if (e) return e;
  }
  if (p->__pyx_v_start) {
    e = (*v)(p->__pyx_v_start, a); if (e) return e;
  }
  if (p->__pyx_v_stat) {
    e = (*v)(((PyObject *)p->__pyx_v_stat), a); if (e) return e;
  }
  if (p->__pyx_v_stepper) {
    e = (*v)(p->__pyx_v_stepper, a); if (e) return e;
  }
  if (p->__pyx_v_truncate) {
    e = (*v)(p->__pyx_v_truncate, 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_10pysamstats_3opt___pyx_scope_struct_1_iter_pileup_padded_chrom = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysamstats.opt.__pyx_scope_struct_1_iter_pileup_padded_chrom", /*tp_name*/
  sizeof(struct __pyx_obj_10pysamstats_3opt___pyx_scope_struct_1_iter_pileup_padded_chrom), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_10pysamstats_3opt___pyx_scope_struct_1_iter_pileup_padded_chrom, /*tp_dealloc*/
  0, /*tp_print*/
  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_10pysamstats_3opt___pyx_scope_struct_1_iter_pileup_padded_chrom, /*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_10pysamstats_3opt___pyx_scope_struct_1_iter_pileup_padded_chrom, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_10pysamstats_3opt___pyx_scope_struct_2_iter_binned_chrom *__pyx_freelist_10pysamstats_3opt___pyx_scope_struct_2_iter_binned_chrom[8];
static int __pyx_freecount_10pysamstats_3opt___pyx_scope_struct_2_iter_binned_chrom = 0;

static PyObject *__pyx_tp_new_10pysamstats_3opt___pyx_scope_struct_2_iter_binned_chrom(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_10pysamstats_3opt___pyx_scope_struct_2_iter_binned_chrom > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_10pysamstats_3opt___pyx_scope_struct_2_iter_binned_chrom)))) {
    o = (PyObject*)__pyx_freelist_10pysamstats_3opt___pyx_scope_struct_2_iter_binned_chrom[--__pyx_freecount_10pysamstats_3opt___pyx_scope_struct_2_iter_binned_chrom];
    memset(o, 0, sizeof(struct __pyx_obj_10pysamstats_3opt___pyx_scope_struct_2_iter_binned_chrom));
    (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_10pysamstats_3opt___pyx_scope_struct_2_iter_binned_chrom(PyObject *o) {
  struct __pyx_obj_10pysamstats_3opt___pyx_scope_struct_2_iter_binned_chrom *p = (struct __pyx_obj_10pysamstats_3opt___pyx_scope_struct_2_iter_binned_chrom *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_alignmentfile);
  Py_CLEAR(p->__pyx_v_chrom);
  Py_CLEAR(p->__pyx_v_end);
  Py_CLEAR(p->__pyx_v_fafile);
  Py_CLEAR(p->__pyx_v_it);
  Py_CLEAR(p->__pyx_v_one_based);
  Py_CLEAR(p->__pyx_v_pos);
  Py_CLEAR(p->__pyx_v_rec);
  Py_CLEAR(p->__pyx_v_start);
  Py_CLEAR(p->__pyx_v_stat);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_10pysamstats_3opt___pyx_scope_struct_2_iter_binned_chrom < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_10pysamstats_3opt___pyx_scope_struct_2_iter_binned_chrom)))) {
    __pyx_freelist_10pysamstats_3opt___pyx_scope_struct_2_iter_binned_chrom[__pyx_freecount_10pysamstats_3opt___pyx_scope_struct_2_iter_binned_chrom++] = ((struct __pyx_obj_10pysamstats_3opt___pyx_scope_struct_2_iter_binned_chrom *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_10pysamstats_3opt___pyx_scope_struct_2_iter_binned_chrom(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_10pysamstats_3opt___pyx_scope_struct_2_iter_binned_chrom *p = (struct __pyx_obj_10pysamstats_3opt___pyx_scope_struct_2_iter_binned_chrom *)o;
  if (p->__pyx_v_alignmentfile) {
    e = (*v)(((PyObject *)p->__pyx_v_alignmentfile), a); if (e) return e;
  }
  if (p->__pyx_v_chrom) {
    e = (*v)(p->__pyx_v_chrom, a); if (e) return e;
  }
  if (p->__pyx_v_end) {
    e = (*v)(p->__pyx_v_end, a); if (e) return e;
  }
  if (p->__pyx_v_fafile) {
    e = (*v)(((PyObject *)p->__pyx_v_fafile), a); if (e) return e;
  }
  if (p->__pyx_v_it) {
    e = (*v)(((PyObject *)p->__pyx_v_it), a); if (e) return e;
  }
  if (p->__pyx_v_one_based) {
    e = (*v)(p->__pyx_v_one_based, a); if (e) return e;
  }
  if (p->__pyx_v_pos) {
    e = (*v)(p->__pyx_v_pos, a); if (e) return e;
  }
  if (p->__pyx_v_rec) {
    e = (*v)(p->__pyx_v_rec, a); if (e) return e;
  }
  if (p->__pyx_v_start) {
    e = (*v)(p->__pyx_v_start, a); if (e) return e;
  }
  if (p->__pyx_v_stat) {
    e = (*v)(((PyObject *)p->__pyx_v_stat), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_10pysamstats_3opt___pyx_scope_struct_2_iter_binned_chrom = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysamstats.opt.__pyx_scope_struct_2_iter_binned_chrom", /*tp_name*/
  sizeof(struct __pyx_obj_10pysamstats_3opt___pyx_scope_struct_2_iter_binned_chrom), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_10pysamstats_3opt___pyx_scope_struct_2_iter_binned_chrom, /*tp_dealloc*/
  0, /*tp_print*/
  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_10pysamstats_3opt___pyx_scope_struct_2_iter_binned_chrom, /*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_10pysamstats_3opt___pyx_scope_struct_2_iter_binned_chrom, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyMethodDef __pyx_methods[] = {
  {0, 0, 0, 0}
};

#if PY_MAJOR_VERSION >= 3
#if CYTHON_PEP489_MULTI_PHASE_INIT
static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
static int __pyx_pymod_exec_opt(PyObject* module); /*proto*/
static PyModuleDef_Slot __pyx_moduledef_slots[] = {
  {Py_mod_create, (void*)__pyx_pymod_create},
  {Py_mod_exec, (void*)__pyx_pymod_exec_opt},
  {0, NULL}
};
#endif

static struct PyModuleDef __pyx_moduledef = {
    PyModuleDef_HEAD_INIT,
    "opt",
    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_s_, __pyx_k_, sizeof(__pyx_k_), 0, 0, 1, 0},
  {&__pyx_n_b_A, __pyx_k_A, sizeof(__pyx_k_A), 0, 0, 0, 1},
  {&__pyx_n_s_A, __pyx_k_A, sizeof(__pyx_k_A), 0, 0, 1, 1},
  {&__pyx_n_s_A_fwd, __pyx_k_A_fwd, sizeof(__pyx_k_A_fwd), 0, 0, 1, 1},
  {&__pyx_n_s_A_pp, __pyx_k_A_pp, sizeof(__pyx_k_A_pp), 0, 0, 1, 1},
  {&__pyx_n_s_A_pp_fwd, __pyx_k_A_pp_fwd, sizeof(__pyx_k_A_pp_fwd), 0, 0, 1, 1},
  {&__pyx_n_s_A_pp_rev, __pyx_k_A_pp_rev, sizeof(__pyx_k_A_pp_rev), 0, 0, 1, 1},
  {&__pyx_n_s_A_rev, __pyx_k_A_rev, sizeof(__pyx_k_A_rev), 0, 0, 1, 1},
  {&__pyx_n_s_AlignmentBinned, __pyx_k_AlignmentBinned, sizeof(__pyx_k_AlignmentBinned), 0, 0, 1, 1},
  {&__pyx_n_s_Baseq, __pyx_k_Baseq, sizeof(__pyx_k_Baseq), 0, 0, 1, 1},
  {&__pyx_n_s_BaseqExt, __pyx_k_BaseqExt, sizeof(__pyx_k_BaseqExt), 0, 0, 1, 1},
  {&__pyx_n_s_BaseqExtStrand, __pyx_k_BaseqExtStrand, sizeof(__pyx_k_BaseqExtStrand), 0, 0, 1, 1},
  {&__pyx_n_s_BaseqHelper, __pyx_k_BaseqHelper, sizeof(__pyx_k_BaseqHelper), 0, 0, 1, 1},
  {&__pyx_n_s_BaseqPpHelper, __pyx_k_BaseqPpHelper, sizeof(__pyx_k_BaseqPpHelper), 0, 0, 1, 1},
  {&__pyx_n_s_BaseqStrand, __pyx_k_BaseqStrand, sizeof(__pyx_k_BaseqStrand), 0, 0, 1, 1},
  {&__pyx_n_s_BaseqStrandPpHelper, __pyx_k_BaseqStrandPpHelper, sizeof(__pyx_k_BaseqStrandPpHelper), 0, 0, 1, 1},
  {&__pyx_n_s_BinnedStat, __pyx_k_BinnedStat, sizeof(__pyx_k_BinnedStat), 0, 0, 1, 1},
  {&__pyx_n_b_C, __pyx_k_C, sizeof(__pyx_k_C), 0, 0, 0, 1},
  {&__pyx_n_s_C, __pyx_k_C, sizeof(__pyx_k_C), 0, 0, 1, 1},
  {&__pyx_n_s_C_fwd, __pyx_k_C_fwd, sizeof(__pyx_k_C_fwd), 0, 0, 1, 1},
  {&__pyx_n_s_C_pp, __pyx_k_C_pp, sizeof(__pyx_k_C_pp), 0, 0, 1, 1},
  {&__pyx_n_s_C_pp_fwd, __pyx_k_C_pp_fwd, sizeof(__pyx_k_C_pp_fwd), 0, 0, 1, 1},
  {&__pyx_n_s_C_pp_rev, __pyx_k_C_pp_rev, sizeof(__pyx_k_C_pp_rev), 0, 0, 1, 1},
  {&__pyx_n_s_C_rev, __pyx_k_C_rev, sizeof(__pyx_k_C_rev), 0, 0, 1, 1},
  {&__pyx_n_s_CountPp, __pyx_k_CountPp, sizeof(__pyx_k_CountPp), 0, 0, 1, 1},
  {&__pyx_n_s_CountPpStrand, __pyx_k_CountPpStrand, sizeof(__pyx_k_CountPpStrand), 0, 0, 1, 1},
  {&__pyx_n_s_CountStrand, __pyx_k_CountStrand, sizeof(__pyx_k_CountStrand), 0, 0, 1, 1},
  {&__pyx_n_s_Coverage, __pyx_k_Coverage, sizeof(__pyx_k_Coverage), 0, 0, 1, 1},
  {&__pyx_n_s_CoverageBinned, __pyx_k_CoverageBinned, sizeof(__pyx_k_CoverageBinned), 0, 0, 1, 1},
  {&__pyx_n_s_CoverageExt, __pyx_k_CoverageExt, sizeof(__pyx_k_CoverageExt), 0, 0, 1, 1},
  {&__pyx_n_s_CoverageExtBinned, __pyx_k_CoverageExtBinned, sizeof(__pyx_k_CoverageExtBinned), 0, 0, 1, 1},
  {&__pyx_n_s_CoverageExtStrand, __pyx_k_CoverageExtStrand, sizeof(__pyx_k_CoverageExtStrand), 0, 0, 1, 1},
  {&__pyx_n_s_CoverageGC, __pyx_k_CoverageGC, sizeof(__pyx_k_CoverageGC), 0, 0, 1, 1},
  {&__pyx_n_s_CoverageStrand, __pyx_k_CoverageStrand, sizeof(__pyx_k_CoverageStrand), 0, 0, 1, 1},
  {&__pyx_n_s_D, __pyx_k_D, sizeof(__pyx_k_D), 0, 0, 1, 1},
  {&__pyx_n_b_G, __pyx_k_G, sizeof(__pyx_k_G), 0, 0, 0, 1},
  {&__pyx_n_s_G, __pyx_k_G, sizeof(__pyx_k_G), 0, 0, 1, 1},
  {&__pyx_n_s_G_fwd, __pyx_k_G_fwd, sizeof(__pyx_k_G_fwd), 0, 0, 1, 1},
  {&__pyx_n_s_G_pp, __pyx_k_G_pp, sizeof(__pyx_k_G_pp), 0, 0, 1, 1},
  {&__pyx_n_s_G_pp_fwd, __pyx_k_G_pp_fwd, sizeof(__pyx_k_G_pp_fwd), 0, 0, 1, 1},
  {&__pyx_n_s_G_pp_rev, __pyx_k_G_pp_rev, sizeof(__pyx_k_G_pp_rev), 0, 0, 1, 1},
  {&__pyx_n_s_G_rev, __pyx_k_G_rev, sizeof(__pyx_k_G_rev), 0, 0, 1, 1},
  {&__pyx_n_s_H, __pyx_k_H, sizeof(__pyx_k_H), 0, 0, 1, 1},
  {&__pyx_n_s_I, __pyx_k_I, sizeof(__pyx_k_I), 0, 0, 1, 1},
  {&__pyx_kp_s_Incompatible_checksums_s_vs_0x09, __pyx_k_Incompatible_checksums_s_vs_0x09, sizeof(__pyx_k_Incompatible_checksums_s_vs_0x09), 0, 0, 1, 0},
  {&__pyx_kp_s_Incompatible_checksums_s_vs_0x0f, __pyx_k_Incompatible_checksums_s_vs_0x0f, sizeof(__pyx_k_Incompatible_checksums_s_vs_0x0f), 0, 0, 1, 0},
  {&__pyx_kp_s_Incompatible_checksums_s_vs_0x14, __pyx_k_Incompatible_checksums_s_vs_0x14, sizeof(__pyx_k_Incompatible_checksums_s_vs_0x14), 0, 0, 1, 0},
  {&__pyx_kp_s_Incompatible_checksums_s_vs_0x2b, __pyx_k_Incompatible_checksums_s_vs_0x2b, sizeof(__pyx_k_Incompatible_checksums_s_vs_0x2b), 0, 0, 1, 0},
  {&__pyx_kp_s_Incompatible_checksums_s_vs_0x2c, __pyx_k_Incompatible_checksums_s_vs_0x2c, sizeof(__pyx_k_Incompatible_checksums_s_vs_0x2c), 0, 0, 1, 0},
  {&__pyx_kp_s_Incompatible_checksums_s_vs_0x2e, __pyx_k_Incompatible_checksums_s_vs_0x2e, sizeof(__pyx_k_Incompatible_checksums_s_vs_0x2e), 0, 0, 1, 0},
  {&__pyx_kp_s_Incompatible_checksums_s_vs_0x3a, __pyx_k_Incompatible_checksums_s_vs_0x3a, sizeof(__pyx_k_Incompatible_checksums_s_vs_0x3a), 0, 0, 1, 0},
  {&__pyx_kp_s_Incompatible_checksums_s_vs_0x4c, __pyx_k_Incompatible_checksums_s_vs_0x4c, sizeof(__pyx_k_Incompatible_checksums_s_vs_0x4c), 0, 0, 1, 0},
  {&__pyx_kp_s_Incompatible_checksums_s_vs_0x5c, __pyx_k_Incompatible_checksums_s_vs_0x5c, sizeof(__pyx_k_Incompatible_checksums_s_vs_0x5c), 0, 0, 1, 0},
  {&__pyx_kp_s_Incompatible_checksums_s_vs_0x63, __pyx_k_Incompatible_checksums_s_vs_0x63, sizeof(__pyx_k_Incompatible_checksums_s_vs_0x63), 0, 0, 1, 0},
  {&__pyx_kp_s_Incompatible_checksums_s_vs_0x67, __pyx_k_Incompatible_checksums_s_vs_0x67, sizeof(__pyx_k_Incompatible_checksums_s_vs_0x67), 0, 0, 1, 0},
  {&__pyx_kp_s_Incompatible_checksums_s_vs_0x6e, __pyx_k_Incompatible_checksums_s_vs_0x6e, sizeof(__pyx_k_Incompatible_checksums_s_vs_0x6e), 0, 0, 1, 0},
  {&__pyx_kp_s_Incompatible_checksums_s_vs_0x87, __pyx_k_Incompatible_checksums_s_vs_0x87, sizeof(__pyx_k_Incompatible_checksums_s_vs_0x87), 0, 0, 1, 0},
  {&__pyx_kp_s_Incompatible_checksums_s_vs_0xad, __pyx_k_Incompatible_checksums_s_vs_0xad, sizeof(__pyx_k_Incompatible_checksums_s_vs_0xad), 0, 0, 1, 0},
  {&__pyx_kp_s_Incompatible_checksums_s_vs_0xbc, __pyx_k_Incompatible_checksums_s_vs_0xbc, sizeof(__pyx_k_Incompatible_checksums_s_vs_0xbc), 0, 0, 1, 0},
  {&__pyx_kp_s_Incompatible_checksums_s_vs_0xc0, __pyx_k_Incompatible_checksums_s_vs_0xc0, sizeof(__pyx_k_Incompatible_checksums_s_vs_0xc0), 0, 0, 1, 0},
  {&__pyx_kp_s_Incompatible_checksums_s_vs_0xce, __pyx_k_Incompatible_checksums_s_vs_0xce, sizeof(__pyx_k_Incompatible_checksums_s_vs_0xce), 0, 0, 1, 0},
  {&__pyx_kp_s_Incompatible_checksums_s_vs_0xd4, __pyx_k_Incompatible_checksums_s_vs_0xd4, sizeof(__pyx_k_Incompatible_checksums_s_vs_0xd4), 0, 0, 1, 0},
  {&__pyx_kp_s_Incompatible_checksums_s_vs_0xdc, __pyx_k_Incompatible_checksums_s_vs_0xdc, sizeof(__pyx_k_Incompatible_checksums_s_vs_0xdc), 0, 0, 1, 0},
  {&__pyx_kp_s_Incompatible_checksums_s_vs_0xfd, __pyx_k_Incompatible_checksums_s_vs_0xfd, sizeof(__pyx_k_Incompatible_checksums_s_vs_0xfd), 0, 0, 1, 0},
  {&__pyx_n_s_M, __pyx_k_M, sizeof(__pyx_k_M), 0, 0, 1, 1},
  {&__pyx_n_s_Mapq, __pyx_k_Mapq, sizeof(__pyx_k_Mapq), 0, 0, 1, 1},
  {&__pyx_n_s_MapqBinned, __pyx_k_MapqBinned, sizeof(__pyx_k_MapqBinned), 0, 0, 1, 1},
  {&__pyx_n_s_MapqHelper, __pyx_k_MapqHelper, sizeof(__pyx_k_MapqHelper), 0, 0, 1, 1},
  {&__pyx_n_s_MapqStrand, __pyx_k_MapqStrand, sizeof(__pyx_k_MapqStrand), 0, 0, 1, 1},
  {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
  {&__pyx_n_b_N, __pyx_k_N, sizeof(__pyx_k_N), 0, 0, 0, 1},
  {&__pyx_n_s_N, __pyx_k_N, sizeof(__pyx_k_N), 0, 0, 1, 1},
  {&__pyx_n_s_N_fwd, __pyx_k_N_fwd, sizeof(__pyx_k_N_fwd), 0, 0, 1, 1},
  {&__pyx_n_s_N_pp, __pyx_k_N_pp, sizeof(__pyx_k_N_pp), 0, 0, 1, 1},
  {&__pyx_n_s_N_pp_fwd, __pyx_k_N_pp_fwd, sizeof(__pyx_k_N_pp_fwd), 0, 0, 1, 1},
  {&__pyx_n_s_N_pp_rev, __pyx_k_N_pp_rev, sizeof(__pyx_k_N_pp_rev), 0, 0, 1, 1},
  {&__pyx_n_s_N_rev, __pyx_k_N_rev, sizeof(__pyx_k_N_rev), 0, 0, 1, 1},
  {&__pyx_n_s_P, __pyx_k_P, sizeof(__pyx_k_P), 0, 0, 1, 1},
  {&__pyx_n_s_PY2, __pyx_k_PY2, sizeof(__pyx_k_PY2), 0, 0, 1, 1},
  {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1},
  {&__pyx_n_s_PileupStat, __pyx_k_PileupStat, sizeof(__pyx_k_PileupStat), 0, 0, 1, 1},
  {&__pyx_n_s_S, __pyx_k_S, sizeof(__pyx_k_S), 0, 0, 1, 1},
  {&__pyx_n_b_T, __pyx_k_T, sizeof(__pyx_k_T), 0, 0, 0, 1},
  {&__pyx_n_s_T, __pyx_k_T, sizeof(__pyx_k_T), 0, 0, 1, 1},
  {&__pyx_n_s_T_fwd, __pyx_k_T_fwd, sizeof(__pyx_k_T_fwd), 0, 0, 1, 1},
  {&__pyx_n_s_T_pp, __pyx_k_T_pp, sizeof(__pyx_k_T_pp), 0, 0, 1, 1},
  {&__pyx_n_s_T_pp_fwd, __pyx_k_T_pp_fwd, sizeof(__pyx_k_T_pp_fwd), 0, 0, 1, 1},
  {&__pyx_n_s_T_pp_rev, __pyx_k_T_pp_rev, sizeof(__pyx_k_T_pp_rev), 0, 0, 1, 1},
  {&__pyx_n_s_T_rev, __pyx_k_T_rev, sizeof(__pyx_k_T_rev), 0, 0, 1, 1},
  {&__pyx_n_s_Tlen, __pyx_k_Tlen, sizeof(__pyx_k_Tlen), 0, 0, 1, 1},
  {&__pyx_n_s_TlenBinned, __pyx_k_TlenBinned, sizeof(__pyx_k_TlenBinned), 0, 0, 1, 1},
  {&__pyx_n_s_TlenHelper, __pyx_k_TlenHelper, sizeof(__pyx_k_TlenHelper), 0, 0, 1, 1},
  {&__pyx_n_s_TlenStrand, __pyx_k_TlenStrand, sizeof(__pyx_k_TlenStrand), 0, 0, 1, 1},
  {&__pyx_n_s_Variation, __pyx_k_Variation, sizeof(__pyx_k_Variation), 0, 0, 1, 1},
  {&__pyx_n_s_VariationStrand, __pyx_k_VariationStrand, sizeof(__pyx_k_VariationStrand), 0, 0, 1, 1},
  {&__pyx_n_s_X, __pyx_k_X, sizeof(__pyx_k_X), 0, 0, 1, 1},
  {&__pyx_n_s_alignmentfile, __pyx_k_alignmentfile, sizeof(__pyx_k_alignmentfile), 0, 0, 1, 1},
  {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1},
  {&__pyx_n_s_around, __pyx_k_around, sizeof(__pyx_k_around), 0, 0, 1, 1},
  {&__pyx_n_s_ascii, __pyx_k_ascii, sizeof(__pyx_k_ascii), 0, 0, 1, 1},
  {&__pyx_n_s_b, __pyx_k_b, sizeof(__pyx_k_b), 0, 0, 1, 1},
  {&__pyx_n_s_bases_all, __pyx_k_bases_all, sizeof(__pyx_k_bases_all), 0, 0, 1, 1},
  {&__pyx_n_s_bin_end, __pyx_k_bin_end, sizeof(__pyx_k_bin_end), 0, 0, 1, 1},
  {&__pyx_n_s_bin_start, __pyx_k_bin_start, sizeof(__pyx_k_bin_start), 0, 0, 1, 1},
  {&__pyx_n_s_chain, __pyx_k_chain, sizeof(__pyx_k_chain), 0, 0, 1, 1},
  {&__pyx_n_s_chrlen, __pyx_k_chrlen, sizeof(__pyx_k_chrlen), 0, 0, 1, 1},
  {&__pyx_n_s_chrom, __pyx_k_chrom, sizeof(__pyx_k_chrom), 0, 0, 1, 1},
  {&__pyx_kp_s_chromosome_is_None, __pyx_k_chromosome_is_None, sizeof(__pyx_k_chromosome_is_None), 0, 0, 1, 0},
  {&__pyx_kp_s_chromosome_not_in_SAM_references, __pyx_k_chromosome_not_in_SAM_references, sizeof(__pyx_k_chromosome_not_in_SAM_references), 0, 0, 1, 0},
  {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
  {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1},
  {&__pyx_n_s_col, __pyx_k_col, sizeof(__pyx_k_col), 0, 0, 1, 1},
  {&__pyx_n_s_count, __pyx_k_count, sizeof(__pyx_k_count), 0, 0, 1, 1},
  {&__pyx_n_s_count_reads, __pyx_k_count_reads, sizeof(__pyx_k_count_reads), 0, 0, 1, 1},
  {&__pyx_n_s_curpos, __pyx_k_curpos, sizeof(__pyx_k_curpos), 0, 0, 1, 1},
  {&__pyx_n_s_deletions, __pyx_k_deletions, sizeof(__pyx_k_deletions), 0, 0, 1, 1},
  {&__pyx_n_s_deletions_fwd, __pyx_k_deletions_fwd, sizeof(__pyx_k_deletions_fwd), 0, 0, 1, 1},
  {&__pyx_n_s_deletions_pp, __pyx_k_deletions_pp, sizeof(__pyx_k_deletions_pp), 0, 0, 1, 1},
  {&__pyx_n_s_deletions_pp_fwd, __pyx_k_deletions_pp_fwd, sizeof(__pyx_k_deletions_pp_fwd), 0, 0, 1, 1},
  {&__pyx_n_s_deletions_pp_rev, __pyx_k_deletions_pp_rev, sizeof(__pyx_k_deletions_pp_rev), 0, 0, 1, 1},
  {&__pyx_n_s_deletions_rev, __pyx_k_deletions_rev, sizeof(__pyx_k_deletions_rev), 0, 0, 1, 1},
  {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1},
  {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
  {&__pyx_n_s_end, __pyx_k_end, sizeof(__pyx_k_end), 0, 0, 1, 1},
  {&__pyx_n_s_fafile, __pyx_k_fafile, sizeof(__pyx_k_fafile), 0, 0, 1, 1},
  {&__pyx_n_s_fetch, __pyx_k_fetch, sizeof(__pyx_k_fetch), 0, 0, 1, 1},
  {&__pyx_n_s_gc, __pyx_k_gc, sizeof(__pyx_k_gc), 0, 0, 1, 1},
  {&__pyx_n_s_get_refbase, __pyx_k_get_refbase, sizeof(__pyx_k_get_refbase), 0, 0, 1, 1},
  {&__pyx_n_s_getrname, __pyx_k_getrname, sizeof(__pyx_k_getrname), 0, 0, 1, 1},
  {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
  {&__pyx_n_s_has_coord, __pyx_k_has_coord, sizeof(__pyx_k_has_coord), 0, 0, 1, 1},
  {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
  {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
  {&__pyx_n_s_index, __pyx_k_index, sizeof(__pyx_k_index), 0, 0, 1, 1},
  {&__pyx_n_s_insertions, __pyx_k_insertions, sizeof(__pyx_k_insertions), 0, 0, 1, 1},
  {&__pyx_n_s_insertions_fwd, __pyx_k_insertions_fwd, sizeof(__pyx_k_insertions_fwd), 0, 0, 1, 1},
  {&__pyx_n_s_insertions_pp, __pyx_k_insertions_pp, sizeof(__pyx_k_insertions_pp), 0, 0, 1, 1},
  {&__pyx_n_s_insertions_pp_fwd, __pyx_k_insertions_pp_fwd, sizeof(__pyx_k_insertions_pp_fwd), 0, 0, 1, 1},
  {&__pyx_n_s_insertions_pp_rev, __pyx_k_insertions_pp_rev, sizeof(__pyx_k_insertions_pp_rev), 0, 0, 1, 1},
  {&__pyx_n_s_insertions_rev, __pyx_k_insertions_rev, sizeof(__pyx_k_insertions_rev), 0, 0, 1, 1},
  {&__pyx_n_s_it, __pyx_k_it, sizeof(__pyx_k_it), 0, 0, 1, 1},
  {&__pyx_n_s_itc, __pyx_k_itc, sizeof(__pyx_k_itc), 0, 0, 1, 1},
  {&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1},
  {&__pyx_n_s_iter_binned, __pyx_k_iter_binned, sizeof(__pyx_k_iter_binned), 0, 0, 1, 1},
  {&__pyx_n_s_iter_binned_chrom, __pyx_k_iter_binned_chrom, sizeof(__pyx_k_iter_binned_chrom), 0, 0, 1, 1},
  {&__pyx_n_s_iter_pileup, __pyx_k_iter_pileup, sizeof(__pyx_k_iter_pileup), 0, 0, 1, 1},
  {&__pyx_n_s_iter_pileup_default, __pyx_k_iter_pileup_default, sizeof(__pyx_k_iter_pileup_default), 0, 0, 1, 1},
  {&__pyx_n_s_iter_pileup_padded, __pyx_k_iter_pileup_padded, sizeof(__pyx_k_iter_pileup_padded), 0, 0, 1, 1},
  {&__pyx_n_s_iter_pileup_padded_chrom, __pyx_k_iter_pileup_padded_chrom, sizeof(__pyx_k_iter_pileup_padded_chrom), 0, 0, 1, 1},
  {&__pyx_n_s_itertools, __pyx_k_itertools, sizeof(__pyx_k_itertools), 0, 0, 1, 1},
  {&__pyx_n_s_its, __pyx_k_its, sizeof(__pyx_k_its), 0, 0, 1, 1},
  {&__pyx_n_s_kwargs, __pyx_k_kwargs, sizeof(__pyx_k_kwargs), 0, 0, 1, 1},
  {&__pyx_n_s_lengths, __pyx_k_lengths, sizeof(__pyx_k_lengths), 0, 0, 1, 1},
  {&__pyx_n_s_lower, __pyx_k_lower, sizeof(__pyx_k_lower), 0, 0, 1, 1},
  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
  {&__pyx_n_s_matches, __pyx_k_matches, sizeof(__pyx_k_matches), 0, 0, 1, 1},
  {&__pyx_n_s_matches_fwd, __pyx_k_matches_fwd, sizeof(__pyx_k_matches_fwd), 0, 0, 1, 1},
  {&__pyx_n_s_matches_pp, __pyx_k_matches_pp, sizeof(__pyx_k_matches_pp), 0, 0, 1, 1},
  {&__pyx_n_s_matches_pp_fwd, __pyx_k_matches_pp_fwd, sizeof(__pyx_k_matches_pp_fwd), 0, 0, 1, 1},
  {&__pyx_n_s_matches_pp_rev, __pyx_k_matches_pp_rev, sizeof(__pyx_k_matches_pp_rev), 0, 0, 1, 1},
  {&__pyx_n_s_matches_rev, __pyx_k_matches_rev, sizeof(__pyx_k_matches_rev), 0, 0, 1, 1},
  {&__pyx_n_s_max_depth, __pyx_k_max_depth, sizeof(__pyx_k_max_depth), 0, 0, 1, 1},
  {&__pyx_n_s_max_mapq, __pyx_k_max_mapq, sizeof(__pyx_k_max_mapq), 0, 0, 1, 1},
  {&__pyx_n_s_max_mapq_fwd, __pyx_k_max_mapq_fwd, sizeof(__pyx_k_max_mapq_fwd), 0, 0, 1, 1},
  {&__pyx_n_s_max_mapq_pp, __pyx_k_max_mapq_pp, sizeof(__pyx_k_max_mapq_pp), 0, 0, 1, 1},
  {&__pyx_n_s_max_mapq_pp_fwd, __pyx_k_max_mapq_pp_fwd, sizeof(__pyx_k_max_mapq_pp_fwd), 0, 0, 1, 1},
  {&__pyx_n_s_max_mapq_pp_rev, __pyx_k_max_mapq_pp_rev, sizeof(__pyx_k_max_mapq_pp_rev), 0, 0, 1, 1},
  {&__pyx_n_s_max_mapq_rev, __pyx_k_max_mapq_rev, sizeof(__pyx_k_max_mapq_rev), 0, 0, 1, 1},
  {&__pyx_n_s_mean, __pyx_k_mean, sizeof(__pyx_k_mean), 0, 0, 1, 1},
  {&__pyx_n_s_mean_tlen, __pyx_k_mean_tlen, sizeof(__pyx_k_mean_tlen), 0, 0, 1, 1},
  {&__pyx_n_s_mean_tlen_fwd, __pyx_k_mean_tlen_fwd, sizeof(__pyx_k_mean_tlen_fwd), 0, 0, 1, 1},
  {&__pyx_n_s_mean_tlen_pp, __pyx_k_mean_tlen_pp, sizeof(__pyx_k_mean_tlen_pp), 0, 0, 1, 1},
  {&__pyx_n_s_mean_tlen_pp_fwd, __pyx_k_mean_tlen_pp_fwd, sizeof(__pyx_k_mean_tlen_pp_fwd), 0, 0, 1, 1},
  {&__pyx_n_s_mean_tlen_pp_rev, __pyx_k_mean_tlen_pp_rev, sizeof(__pyx_k_mean_tlen_pp_rev), 0, 0, 1, 1},
  {&__pyx_n_s_mean_tlen_rev, __pyx_k_mean_tlen_rev, sizeof(__pyx_k_mean_tlen_rev), 0, 0, 1, 1},
  {&__pyx_n_s_min_baseq, __pyx_k_min_baseq, sizeof(__pyx_k_min_baseq), 0, 0, 1, 1},
  {&__pyx_n_s_min_mapq, __pyx_k_min_mapq, sizeof(__pyx_k_min_mapq), 0, 0, 1, 1},
  {&__pyx_n_s_mismatches, __pyx_k_mismatches, sizeof(__pyx_k_mismatches), 0, 0, 1, 1},
  {&__pyx_n_s_mismatches_fwd, __pyx_k_mismatches_fwd, sizeof(__pyx_k_mismatches_fwd), 0, 0, 1, 1},
  {&__pyx_n_s_mismatches_pp, __pyx_k_mismatches_pp, sizeof(__pyx_k_mismatches_pp), 0, 0, 1, 1},
  {&__pyx_n_s_mismatches_pp_fwd, __pyx_k_mismatches_pp_fwd, sizeof(__pyx_k_mismatches_pp_fwd), 0, 0, 1, 1},
  {&__pyx_n_s_mismatches_pp_rev, __pyx_k_mismatches_pp_rev, sizeof(__pyx_k_mismatches_pp_rev), 0, 0, 1, 1},
  {&__pyx_n_s_mismatches_rev, __pyx_k_mismatches_rev, sizeof(__pyx_k_mismatches_rev), 0, 0, 1, 1},
  {&__pyx_n_s_multiple_iterators, __pyx_k_multiple_iterators, sizeof(__pyx_k_multiple_iterators), 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, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1},
  {&__pyx_n_s_no_del, __pyx_k_no_del, sizeof(__pyx_k_no_del), 0, 0, 1, 1},
  {&__pyx_n_s_no_dup, __pyx_k_no_dup, sizeof(__pyx_k_no_dup), 0, 0, 1, 1},
  {&__pyx_n_s_normalise_coords, __pyx_k_normalise_coords, sizeof(__pyx_k_normalise_coords), 0, 0, 1, 1},
  {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
  {&__pyx_n_s_one_based, __pyx_k_one_based, sizeof(__pyx_k_one_based), 0, 0, 1, 1},
  {&__pyx_n_s_pad, __pyx_k_pad, sizeof(__pyx_k_pad), 0, 0, 1, 1},
  {&__pyx_n_s_parse_region, __pyx_k_parse_region, sizeof(__pyx_k_parse_region), 0, 0, 1, 1},
  {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1},
  {&__pyx_n_s_pileup, __pyx_k_pileup, sizeof(__pyx_k_pileup), 0, 0, 1, 1},
  {&__pyx_n_s_plp, __pyx_k_plp, sizeof(__pyx_k_plp), 0, 0, 1, 1},
  {&__pyx_n_s_pos, __pyx_k_pos, sizeof(__pyx_k_pos), 0, 0, 1, 1},
  {&__pyx_n_s_pysamstats_opt, __pyx_k_pysamstats_opt, sizeof(__pyx_k_pysamstats_opt), 0, 0, 1, 1},
  {&__pyx_kp_s_pysamstats_opt_pyx, __pyx_k_pysamstats_opt_pyx, sizeof(__pyx_k_pysamstats_opt_pyx), 0, 0, 1, 0},
  {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_AlignmentBinned, __pyx_k_pyx_unpickle_AlignmentBinned, sizeof(__pyx_k_pyx_unpickle_AlignmentBinned), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_Baseq, __pyx_k_pyx_unpickle_Baseq, sizeof(__pyx_k_pyx_unpickle_Baseq), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_BaseqExt, __pyx_k_pyx_unpickle_BaseqExt, sizeof(__pyx_k_pyx_unpickle_BaseqExt), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_BaseqExtStrand, __pyx_k_pyx_unpickle_BaseqExtStrand, sizeof(__pyx_k_pyx_unpickle_BaseqExtStrand), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_BaseqHelper, __pyx_k_pyx_unpickle_BaseqHelper, sizeof(__pyx_k_pyx_unpickle_BaseqHelper), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_BaseqPpHelper, __pyx_k_pyx_unpickle_BaseqPpHelper, sizeof(__pyx_k_pyx_unpickle_BaseqPpHelper), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_BaseqStrand, __pyx_k_pyx_unpickle_BaseqStrand, sizeof(__pyx_k_pyx_unpickle_BaseqStrand), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_BaseqStrandPpHelp, __pyx_k_pyx_unpickle_BaseqStrandPpHelp, sizeof(__pyx_k_pyx_unpickle_BaseqStrandPpHelp), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_BinnedStat, __pyx_k_pyx_unpickle_BinnedStat, sizeof(__pyx_k_pyx_unpickle_BinnedStat), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_CountPp, __pyx_k_pyx_unpickle_CountPp, sizeof(__pyx_k_pyx_unpickle_CountPp), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_CountPpStrand, __pyx_k_pyx_unpickle_CountPpStrand, sizeof(__pyx_k_pyx_unpickle_CountPpStrand), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_CountStrand, __pyx_k_pyx_unpickle_CountStrand, sizeof(__pyx_k_pyx_unpickle_CountStrand), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_Coverage, __pyx_k_pyx_unpickle_Coverage, sizeof(__pyx_k_pyx_unpickle_Coverage), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_CoverageBinned, __pyx_k_pyx_unpickle_CoverageBinned, sizeof(__pyx_k_pyx_unpickle_CoverageBinned), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_CoverageExt, __pyx_k_pyx_unpickle_CoverageExt, sizeof(__pyx_k_pyx_unpickle_CoverageExt), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_CoverageExtBinned, __pyx_k_pyx_unpickle_CoverageExtBinned, sizeof(__pyx_k_pyx_unpickle_CoverageExtBinned), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_CoverageExtStrand, __pyx_k_pyx_unpickle_CoverageExtStrand, sizeof(__pyx_k_pyx_unpickle_CoverageExtStrand), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_CoverageGC, __pyx_k_pyx_unpickle_CoverageGC, sizeof(__pyx_k_pyx_unpickle_CoverageGC), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_CoverageStrand, __pyx_k_pyx_unpickle_CoverageStrand, sizeof(__pyx_k_pyx_unpickle_CoverageStrand), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_Mapq, __pyx_k_pyx_unpickle_Mapq, sizeof(__pyx_k_pyx_unpickle_Mapq), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_MapqBinned, __pyx_k_pyx_unpickle_MapqBinned, sizeof(__pyx_k_pyx_unpickle_MapqBinned), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_MapqHelper, __pyx_k_pyx_unpickle_MapqHelper, sizeof(__pyx_k_pyx_unpickle_MapqHelper), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_MapqStrand, __pyx_k_pyx_unpickle_MapqStrand, sizeof(__pyx_k_pyx_unpickle_MapqStrand), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_PileupStat, __pyx_k_pyx_unpickle_PileupStat, sizeof(__pyx_k_pyx_unpickle_PileupStat), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_Tlen, __pyx_k_pyx_unpickle_Tlen, sizeof(__pyx_k_pyx_unpickle_Tlen), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_TlenBinned, __pyx_k_pyx_unpickle_TlenBinned, sizeof(__pyx_k_pyx_unpickle_TlenBinned), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_TlenHelper, __pyx_k_pyx_unpickle_TlenHelper, sizeof(__pyx_k_pyx_unpickle_TlenHelper), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_TlenStrand, __pyx_k_pyx_unpickle_TlenStrand, sizeof(__pyx_k_pyx_unpickle_TlenStrand), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_Variation, __pyx_k_pyx_unpickle_Variation, sizeof(__pyx_k_pyx_unpickle_Variation), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_VariationStrand, __pyx_k_pyx_unpickle_VariationStrand, sizeof(__pyx_k_pyx_unpickle_VariationStrand), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
  {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
  {&__pyx_n_s_read, __pyx_k_read, sizeof(__pyx_k_read), 0, 0, 1, 1},
  {&__pyx_n_s_reads_all, __pyx_k_reads_all, sizeof(__pyx_k_reads_all), 0, 0, 1, 1},
  {&__pyx_n_s_reads_duplicate, __pyx_k_reads_duplicate, sizeof(__pyx_k_reads_duplicate), 0, 0, 1, 1},
  {&__pyx_n_s_reads_duplicate_fwd, __pyx_k_reads_duplicate_fwd, sizeof(__pyx_k_reads_duplicate_fwd), 0, 0, 1, 1},
  {&__pyx_n_s_reads_duplicate_rev, __pyx_k_reads_duplicate_rev, sizeof(__pyx_k_reads_duplicate_rev), 0, 0, 1, 1},
  {&__pyx_n_s_reads_faceaway, __pyx_k_reads_faceaway, sizeof(__pyx_k_reads_faceaway), 0, 0, 1, 1},
  {&__pyx_n_s_reads_faceaway_fwd, __pyx_k_reads_faceaway_fwd, sizeof(__pyx_k_reads_faceaway_fwd), 0, 0, 1, 1},
  {&__pyx_n_s_reads_faceaway_rev, __pyx_k_reads_faceaway_rev, sizeof(__pyx_k_reads_faceaway_rev), 0, 0, 1, 1},
  {&__pyx_n_s_reads_fwd, __pyx_k_reads_fwd, sizeof(__pyx_k_reads_fwd), 0, 0, 1, 1},
  {&__pyx_n_s_reads_mapq0, __pyx_k_reads_mapq0, sizeof(__pyx_k_reads_mapq0), 0, 0, 1, 1},
  {&__pyx_n_s_reads_mapq0_fwd, __pyx_k_reads_mapq0_fwd, sizeof(__pyx_k_reads_mapq0_fwd), 0, 0, 1, 1},
  {&__pyx_n_s_reads_mapq0_pp, __pyx_k_reads_mapq0_pp, sizeof(__pyx_k_reads_mapq0_pp), 0, 0, 1, 1},
  {&__pyx_n_s_reads_mapq0_pp_fwd, __pyx_k_reads_mapq0_pp_fwd, sizeof(__pyx_k_reads_mapq0_pp_fwd), 0, 0, 1, 1},
  {&__pyx_n_s_reads_mapq0_pp_rev, __pyx_k_reads_mapq0_pp_rev, sizeof(__pyx_k_reads_mapq0_pp_rev), 0, 0, 1, 1},
  {&__pyx_n_s_reads_mapq0_rev, __pyx_k_reads_mapq0_rev, sizeof(__pyx_k_reads_mapq0_rev), 0, 0, 1, 1},
  {&__pyx_n_s_reads_mate_other_chr, __pyx_k_reads_mate_other_chr, sizeof(__pyx_k_reads_mate_other_chr), 0, 0, 1, 1},
  {&__pyx_n_s_reads_mate_other_chr_fwd, __pyx_k_reads_mate_other_chr_fwd, sizeof(__pyx_k_reads_mate_other_chr_fwd), 0, 0, 1, 1},
  {&__pyx_n_s_reads_mate_other_chr_rev, __pyx_k_reads_mate_other_chr_rev, sizeof(__pyx_k_reads_mate_other_chr_rev), 0, 0, 1, 1},
  {&__pyx_n_s_reads_mate_same_strand, __pyx_k_reads_mate_same_strand, sizeof(__pyx_k_reads_mate_same_strand), 0, 0, 1, 1},
  {&__pyx_n_s_reads_mate_same_strand_fwd, __pyx_k_reads_mate_same_strand_fwd, sizeof(__pyx_k_reads_mate_same_strand_fwd), 0, 0, 1, 1},
  {&__pyx_n_s_reads_mate_same_strand_rev, __pyx_k_reads_mate_same_strand_rev, sizeof(__pyx_k_reads_mate_same_strand_rev), 0, 0, 1, 1},
  {&__pyx_n_s_reads_mate_unmapped, __pyx_k_reads_mate_unmapped, sizeof(__pyx_k_reads_mate_unmapped), 0, 0, 1, 1},
  {&__pyx_n_s_reads_mate_unmapped_fwd, __pyx_k_reads_mate_unmapped_fwd, sizeof(__pyx_k_reads_mate_unmapped_fwd), 0, 0, 1, 1},
  {&__pyx_n_s_reads_mate_unmapped_rev, __pyx_k_reads_mate_unmapped_rev, sizeof(__pyx_k_reads_mate_unmapped_rev), 0, 0, 1, 1},
  {&__pyx_n_s_reads_paired, __pyx_k_reads_paired, sizeof(__pyx_k_reads_paired), 0, 0, 1, 1},
  {&__pyx_n_s_reads_paired_fwd, __pyx_k_reads_paired_fwd, sizeof(__pyx_k_reads_paired_fwd), 0, 0, 1, 1},
  {&__pyx_n_s_reads_paired_rev, __pyx_k_reads_paired_rev, sizeof(__pyx_k_reads_paired_rev), 0, 0, 1, 1},
  {&__pyx_n_s_reads_pp, __pyx_k_reads_pp, sizeof(__pyx_k_reads_pp), 0, 0, 1, 1},
  {&__pyx_n_s_reads_pp_fwd, __pyx_k_reads_pp_fwd, sizeof(__pyx_k_reads_pp_fwd), 0, 0, 1, 1},
  {&__pyx_n_s_reads_pp_rev, __pyx_k_reads_pp_rev, sizeof(__pyx_k_reads_pp_rev), 0, 0, 1, 1},
  {&__pyx_n_s_reads_rev, __pyx_k_reads_rev, sizeof(__pyx_k_reads_rev), 0, 0, 1, 1},
  {&__pyx_n_s_reads_softclipped, __pyx_k_reads_softclipped, sizeof(__pyx_k_reads_softclipped), 0, 0, 1, 1},
  {&__pyx_n_s_reads_softclipped_fwd, __pyx_k_reads_softclipped_fwd, sizeof(__pyx_k_reads_softclipped_fwd), 0, 0, 1, 1},
  {&__pyx_n_s_reads_softclipped_rev, __pyx_k_reads_softclipped_rev, sizeof(__pyx_k_reads_softclipped_rev), 0, 0, 1, 1},
  {&__pyx_n_s_rec, __pyx_k_rec, sizeof(__pyx_k_rec), 0, 0, 1, 1},
  {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
  {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
  {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
  {&__pyx_n_s_ref, __pyx_k_ref, sizeof(__pyx_k_ref), 0, 0, 1, 1},
  {&__pyx_n_s_refbase, __pyx_k_refbase, sizeof(__pyx_k_refbase), 0, 0, 1, 1},
  {&__pyx_n_s_reference, __pyx_k_reference, sizeof(__pyx_k_reference), 0, 0, 1, 1},
  {&__pyx_n_s_references, __pyx_k_references, sizeof(__pyx_k_references), 0, 0, 1, 1},
  {&__pyx_n_s_rend, __pyx_k_rend, sizeof(__pyx_k_rend), 0, 0, 1, 1},
  {&__pyx_n_s_reset, __pyx_k_reset, sizeof(__pyx_k_reset), 0, 0, 1, 1},
  {&__pyx_n_s_rms, __pyx_k_rms, sizeof(__pyx_k_rms), 0, 0, 1, 1},
  {&__pyx_n_s_rms_baseq, __pyx_k_rms_baseq, sizeof(__pyx_k_rms_baseq), 0, 0, 1, 1},
  {&__pyx_n_s_rms_baseq_fwd, __pyx_k_rms_baseq_fwd, sizeof(__pyx_k_rms_baseq_fwd), 0, 0, 1, 1},
  {&__pyx_n_s_rms_baseq_matches, __pyx_k_rms_baseq_matches, sizeof(__pyx_k_rms_baseq_matches), 0, 0, 1, 1},
  {&__pyx_n_s_rms_baseq_matches_fwd, __pyx_k_rms_baseq_matches_fwd, sizeof(__pyx_k_rms_baseq_matches_fwd), 0, 0, 1, 1},
  {&__pyx_n_s_rms_baseq_matches_pp, __pyx_k_rms_baseq_matches_pp, sizeof(__pyx_k_rms_baseq_matches_pp), 0, 0, 1, 1},
  {&__pyx_n_s_rms_baseq_matches_pp_fwd, __pyx_k_rms_baseq_matches_pp_fwd, sizeof(__pyx_k_rms_baseq_matches_pp_fwd), 0, 0, 1, 1},
  {&__pyx_n_s_rms_baseq_matches_pp_rev, __pyx_k_rms_baseq_matches_pp_rev, sizeof(__pyx_k_rms_baseq_matches_pp_rev), 0, 0, 1, 1},
  {&__pyx_n_s_rms_baseq_matches_rev, __pyx_k_rms_baseq_matches_rev, sizeof(__pyx_k_rms_baseq_matches_rev), 0, 0, 1, 1},
  {&__pyx_n_s_rms_baseq_mismatches, __pyx_k_rms_baseq_mismatches, sizeof(__pyx_k_rms_baseq_mismatches), 0, 0, 1, 1},
  {&__pyx_n_s_rms_baseq_mismatches_fwd, __pyx_k_rms_baseq_mismatches_fwd, sizeof(__pyx_k_rms_baseq_mismatches_fwd), 0, 0, 1, 1},
  {&__pyx_n_s_rms_baseq_mismatches_pp, __pyx_k_rms_baseq_mismatches_pp, sizeof(__pyx_k_rms_baseq_mismatches_pp), 0, 0, 1, 1},
  {&__pyx_n_s_rms_baseq_mismatches_pp_fwd, __pyx_k_rms_baseq_mismatches_pp_fwd, sizeof(__pyx_k_rms_baseq_mismatches_pp_fwd), 0, 0, 1, 1},
  {&__pyx_n_s_rms_baseq_mismatches_pp_rev, __pyx_k_rms_baseq_mismatches_pp_rev, sizeof(__pyx_k_rms_baseq_mismatches_pp_rev), 0, 0, 1, 1},
  {&__pyx_n_s_rms_baseq_mismatches_rev, __pyx_k_rms_baseq_mismatches_rev, sizeof(__pyx_k_rms_baseq_mismatches_rev), 0, 0, 1, 1},
  {&__pyx_n_s_rms_baseq_pp, __pyx_k_rms_baseq_pp, sizeof(__pyx_k_rms_baseq_pp), 0, 0, 1, 1},
  {&__pyx_n_s_rms_baseq_pp_fwd, __pyx_k_rms_baseq_pp_fwd, sizeof(__pyx_k_rms_baseq_pp_fwd), 0, 0, 1, 1},
  {&__pyx_n_s_rms_baseq_pp_rev, __pyx_k_rms_baseq_pp_rev, sizeof(__pyx_k_rms_baseq_pp_rev), 0, 0, 1, 1},
  {&__pyx_n_s_rms_baseq_rev, __pyx_k_rms_baseq_rev, sizeof(__pyx_k_rms_baseq_rev), 0, 0, 1, 1},
  {&__pyx_n_s_rms_mapq, __pyx_k_rms_mapq, sizeof(__pyx_k_rms_mapq), 0, 0, 1, 1},
  {&__pyx_n_s_rms_mapq_fwd, __pyx_k_rms_mapq_fwd, sizeof(__pyx_k_rms_mapq_fwd), 0, 0, 1, 1},
  {&__pyx_n_s_rms_mapq_pp, __pyx_k_rms_mapq_pp, sizeof(__pyx_k_rms_mapq_pp), 0, 0, 1, 1},
  {&__pyx_n_s_rms_mapq_pp_fwd, __pyx_k_rms_mapq_pp_fwd, sizeof(__pyx_k_rms_mapq_pp_fwd), 0, 0, 1, 1},
  {&__pyx_n_s_rms_mapq_pp_rev, __pyx_k_rms_mapq_pp_rev, sizeof(__pyx_k_rms_mapq_pp_rev), 0, 0, 1, 1},
  {&__pyx_n_s_rms_mapq_rev, __pyx_k_rms_mapq_rev, sizeof(__pyx_k_rms_mapq_rev), 0, 0, 1, 1},
  {&__pyx_n_s_rms_tlen, __pyx_k_rms_tlen, sizeof(__pyx_k_rms_tlen), 0, 0, 1, 1},
  {&__pyx_n_s_rms_tlen_fwd, __pyx_k_rms_tlen_fwd, sizeof(__pyx_k_rms_tlen_fwd), 0, 0, 1, 1},
  {&__pyx_n_s_rms_tlen_pp, __pyx_k_rms_tlen_pp, sizeof(__pyx_k_rms_tlen_pp), 0, 0, 1, 1},
  {&__pyx_n_s_rms_tlen_pp_fwd, __pyx_k_rms_tlen_pp_fwd, sizeof(__pyx_k_rms_tlen_pp_fwd), 0, 0, 1, 1},
  {&__pyx_n_s_rms_tlen_pp_rev, __pyx_k_rms_tlen_pp_rev, sizeof(__pyx_k_rms_tlen_pp_rev), 0, 0, 1, 1},
  {&__pyx_n_s_rms_tlen_rev, __pyx_k_rms_tlen_rev, sizeof(__pyx_k_rms_tlen_rev), 0, 0, 1, 1},
  {&__pyx_n_s_rootmean, __pyx_k_rootmean, sizeof(__pyx_k_rootmean), 0, 0, 1, 1},
  {&__pyx_n_s_round, __pyx_k_round, sizeof(__pyx_k_round), 0, 0, 1, 1},
  {&__pyx_n_s_rstart, __pyx_k_rstart, sizeof(__pyx_k_rstart), 0, 0, 1, 1},
  {&__pyx_n_s_rtid, __pyx_k_rtid, sizeof(__pyx_k_rtid), 0, 0, 1, 1},
  {&__pyx_n_s_send, __pyx_k_send, sizeof(__pyx_k_send), 0, 0, 1, 1},
  {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
  {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
  {&__pyx_n_s_sqsum, __pyx_k_sqsum, sizeof(__pyx_k_sqsum), 0, 0, 1, 1},
  {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1},
  {&__pyx_n_s_stat, __pyx_k_stat, sizeof(__pyx_k_stat), 0, 0, 1, 1},
  {&__pyx_n_s_stat_pileup, __pyx_k_stat_pileup, sizeof(__pyx_k_stat_pileup), 0, 0, 1, 1},
  {&__pyx_n_s_std, __pyx_k_std, sizeof(__pyx_k_std), 0, 0, 1, 1},
  {&__pyx_n_s_std_tlen, __pyx_k_std_tlen, sizeof(__pyx_k_std_tlen), 0, 0, 1, 1},
  {&__pyx_n_s_std_tlen_fwd, __pyx_k_std_tlen_fwd, sizeof(__pyx_k_std_tlen_fwd), 0, 0, 1, 1},
  {&__pyx_n_s_std_tlen_pp, __pyx_k_std_tlen_pp, sizeof(__pyx_k_std_tlen_pp), 0, 0, 1, 1},
  {&__pyx_n_s_std_tlen_pp_fwd, __pyx_k_std_tlen_pp_fwd, sizeof(__pyx_k_std_tlen_pp_fwd), 0, 0, 1, 1},
  {&__pyx_n_s_std_tlen_pp_rev, __pyx_k_std_tlen_pp_rev, sizeof(__pyx_k_std_tlen_pp_rev), 0, 0, 1, 1},
  {&__pyx_n_s_std_tlen_rev, __pyx_k_std_tlen_rev, sizeof(__pyx_k_std_tlen_rev), 0, 0, 1, 1},
  {&__pyx_n_s_stepper, __pyx_k_stepper, sizeof(__pyx_k_stepper), 0, 0, 1, 1},
  {&__pyx_n_s_string_types, __pyx_k_string_types, sizeof(__pyx_k_string_types), 0, 0, 1, 1},
  {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
  {&__pyx_n_s_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 0, 0, 1, 1},
  {&__pyx_n_s_sys_2, __pyx_k_sys_2, sizeof(__pyx_k_sys_2), 0, 0, 1, 1},
  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
  {&__pyx_n_s_throw, __pyx_k_throw, sizeof(__pyx_k_throw), 0, 0, 1, 1},
  {&__pyx_n_s_total, __pyx_k_total, sizeof(__pyx_k_total), 0, 0, 1, 1},
  {&__pyx_n_s_truncate, __pyx_k_truncate, sizeof(__pyx_k_truncate), 0, 0, 1, 1},
  {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1},
  {&__pyx_n_s_upper, __pyx_k_upper, sizeof(__pyx_k_upper), 0, 0, 1, 1},
  {&__pyx_n_s_version_info, __pyx_k_version_info, sizeof(__pyx_k_version_info), 0, 0, 1, 1},
  {&__pyx_n_s_window_offset, __pyx_k_window_offset, sizeof(__pyx_k_window_offset), 0, 0, 1, 1},
  {&__pyx_n_s_window_size, __pyx_k_window_size, sizeof(__pyx_k_window_size), 0, 0, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 1535, __pyx_L1_error)
  __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(2, 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);

  /* "pysamstats/opt.pyx":2112
 * 
 *     if chrom is None:
 *         return None, None             # <<<<<<<<<<<<<<
 * 
 *     else:
 */
  __pyx_tuple__5 = PyTuple_Pack(2, Py_None, Py_None); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 2112, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__5);
  __Pyx_GIVEREF(__pyx_tuple__5);

  /* "pysamstats/opt.pyx":1827
 * 
 * 
 * def iter_pileup(stat, alignmentfile, fafile, pad, **kwargs):             # <<<<<<<<<<<<<<
 *     """General purpose function to generate statistics, where one record is
 *     generated for each genome position in the selected range, based on a
 */
  __pyx_tuple__6 = PyTuple_Pack(5, __pyx_n_s_stat, __pyx_n_s_alignmentfile, __pyx_n_s_fafile, __pyx_n_s_pad, __pyx_n_s_kwargs); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 1827, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__6);
  __Pyx_GIVEREF(__pyx_tuple__6);
  __pyx_codeobj__7 = (PyObject*)__Pyx_PyCode_New(4, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__6, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysamstats_opt_pyx, __pyx_n_s_iter_pileup, 1827, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__7)) __PYX_ERR(0, 1827, __pyx_L1_error)

  /* "pysamstats/opt.pyx":1846
 * 
 * 
 * def iter_pileup_default(stat, alignmentfile, fafile, chrom, start, end, one_based, truncate, stepper,             # <<<<<<<<<<<<<<
 *                         max_depth, int min_mapq, int min_baseq, bint no_del, bint no_dup):
 *     cdef:
 */
  __pyx_tuple__8 = PyTuple_Pack(17, __pyx_n_s_stat, __pyx_n_s_alignmentfile, __pyx_n_s_fafile, __pyx_n_s_chrom, __pyx_n_s_start, __pyx_n_s_end, __pyx_n_s_one_based, __pyx_n_s_truncate, __pyx_n_s_stepper, __pyx_n_s_max_depth, __pyx_n_s_min_mapq, __pyx_n_s_min_baseq, __pyx_n_s_no_del, __pyx_n_s_no_dup, __pyx_n_s_col, __pyx_n_s_it, __pyx_n_s_rec); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 1846, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__8);
  __Pyx_GIVEREF(__pyx_tuple__8);
  __pyx_codeobj__2 = (PyObject*)__Pyx_PyCode_New(14, 0, 17, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__8, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysamstats_opt_pyx, __pyx_n_s_iter_pileup_default, 1846, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__2)) __PYX_ERR(0, 1846, __pyx_L1_error)

  /* "pysamstats/opt.pyx":1866
 * 
 * 
 * def stat_pileup(PileupStat stat,             # <<<<<<<<<<<<<<
 *                 PileupColumn col,
 *                 AlignmentFile alignmentfile,
 */
  __pyx_tuple__9 = PyTuple_Pack(18, __pyx_n_s_stat, __pyx_n_s_col, __pyx_n_s_alignmentfile, __pyx_n_s_fafile, __pyx_n_s_one_based, __pyx_n_s_min_mapq, __pyx_n_s_min_baseq, __pyx_n_s_no_del, __pyx_n_s_no_dup, __pyx_n_s_plp, __pyx_n_s_read, __pyx_n_s_b, __pyx_n_s_i, __pyx_n_s_n, __pyx_n_s_chrom, __pyx_n_s_refbase, __pyx_n_s_rec, __pyx_n_s_pos); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 1866, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__9);
  __Pyx_GIVEREF(__pyx_tuple__9);
  __pyx_codeobj__10 = (PyObject*)__Pyx_PyCode_New(9, 0, 18, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__9, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysamstats_opt_pyx, __pyx_n_s_stat_pileup, 1866, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__10)) __PYX_ERR(0, 1866, __pyx_L1_error)

  /* "pysamstats/opt.pyx":1922
 * 
 * 
 * def iter_pileup_padded(stat, alignmentfile, fafile, chrom, **kwargs):             # <<<<<<<<<<<<<<
 *     if chrom is not None:
 *         it = iter_pileup_padded_chrom(stat, alignmentfile=alignmentfile, fafile=fafile,
 */
  __pyx_tuple__11 = PyTuple_Pack(8, __pyx_n_s_stat, __pyx_n_s_alignmentfile, __pyx_n_s_fafile, __pyx_n_s_chrom, __pyx_n_s_kwargs, __pyx_n_s_it, __pyx_n_s_its, __pyx_n_s_itc); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 1922, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__11);
  __Pyx_GIVEREF(__pyx_tuple__11);
  __pyx_codeobj__12 = (PyObject*)__Pyx_PyCode_New(4, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__11, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysamstats_opt_pyx, __pyx_n_s_iter_pileup_padded, 1922, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__12)) __PYX_ERR(0, 1922, __pyx_L1_error)

  /* "pysamstats/opt.pyx":1936
 * 
 * 
 * def iter_pileup_padded_chrom(PileupStat stat, alignmentfile, fafile, chrom, start, end,             # <<<<<<<<<<<<<<
 *                              one_based, truncate, stepper, max_depth, min_mapq, min_baseq, no_del, no_dup):
 *     cdef:
 */
  __pyx_tuple__13 = PyTuple_Pack(20, __pyx_n_s_stat, __pyx_n_s_alignmentfile, __pyx_n_s_fafile, __pyx_n_s_chrom, __pyx_n_s_start, __pyx_n_s_end, __pyx_n_s_one_based, __pyx_n_s_truncate, __pyx_n_s_stepper, __pyx_n_s_max_depth, __pyx_n_s_min_mapq, __pyx_n_s_min_baseq, __pyx_n_s_no_del, __pyx_n_s_no_dup, __pyx_n_s_col, __pyx_n_s_curpos, __pyx_n_s_it, __pyx_n_s_refbase, __pyx_n_s_rec, __pyx_n_s_pos); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 1936, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__13);
  __Pyx_GIVEREF(__pyx_tuple__13);
  __pyx_codeobj__3 = (PyObject*)__Pyx_PyCode_New(14, 0, 20, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__13, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysamstats_opt_pyx, __pyx_n_s_iter_pileup_padded_chrom, 1936, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__3)) __PYX_ERR(0, 1936, __pyx_L1_error)

  /* "pysamstats/opt.pyx":1987
 * 
 * 
 * def get_refbase(fafile, chrom, pos):             # <<<<<<<<<<<<<<
 *     if fafile is not None:
 *         refbase = fafile.fetch(reference=chrom, start=pos, end=pos+1).upper()
 */
  __pyx_tuple__14 = PyTuple_Pack(4, __pyx_n_s_fafile, __pyx_n_s_chrom, __pyx_n_s_pos, __pyx_n_s_refbase); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 1987, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__14);
  __Pyx_GIVEREF(__pyx_tuple__14);
  __pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__14, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysamstats_opt_pyx, __pyx_n_s_get_refbase, 1987, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) __PYX_ERR(0, 1987, __pyx_L1_error)

  /* "pysamstats/opt.pyx":1997
 * 
 * 
 * def iter_binned(stat, alignmentfile, fafile, chrom, window_size=300, window_offset=None,             # <<<<<<<<<<<<<<
 *                 **kwargs):
 * 
 */
  __pyx_tuple__16 = PyTuple_Pack(10, __pyx_n_s_stat, __pyx_n_s_alignmentfile, __pyx_n_s_fafile, __pyx_n_s_chrom, __pyx_n_s_window_size, __pyx_n_s_window_offset, __pyx_n_s_kwargs, __pyx_n_s_its, __pyx_n_s_itc, __pyx_n_s_it); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 1997, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__16);
  __Pyx_GIVEREF(__pyx_tuple__16);
  __pyx_codeobj__17 = (PyObject*)__Pyx_PyCode_New(6, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__16, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysamstats_opt_pyx, __pyx_n_s_iter_binned, 1997, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) __PYX_ERR(0, 1997, __pyx_L1_error)

  /* "pysamstats/opt.pyx":2026
 * 
 * 
 * def iter_binned_chrom(BinnedStat stat, AlignmentFile alignmentfile, FastaFile fafile,             # <<<<<<<<<<<<<<
 *                       chrom, start, end, one_based, int window_size, int window_offset,
 *                       int min_mapq, int no_dup):
 */
  __pyx_tuple__18 = PyTuple_Pack(21, __pyx_n_s_stat, __pyx_n_s_alignmentfile, __pyx_n_s_fafile, __pyx_n_s_chrom, __pyx_n_s_start, __pyx_n_s_end, __pyx_n_s_one_based, __pyx_n_s_window_size, __pyx_n_s_window_offset, __pyx_n_s_min_mapq, __pyx_n_s_no_dup, __pyx_n_s_rtid, __pyx_n_s_rstart, __pyx_n_s_rend, __pyx_n_s_has_coord, __pyx_n_s_bin_start, __pyx_n_s_bin_end, __pyx_n_s_it, __pyx_n_s_b, __pyx_n_s_rec, __pyx_n_s_pos); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 2026, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__18);
  __Pyx_GIVEREF(__pyx_tuple__18);
  __pyx_codeobj__4 = (PyObject*)__Pyx_PyCode_New(11, 0, 21, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__18, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysamstats_opt_pyx, __pyx_n_s_iter_binned_chrom, 2026, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__4)) __PYX_ERR(0, 2026, __pyx_L1_error)

  /* "pysamstats/opt.pyx":2105
 * 
 * 
 * def normalise_coords(AlignmentFile alignmentfile, chrom, start, end, one_based):             # <<<<<<<<<<<<<<
 *     """Convert to zero-based coordinates and deal with unspecified start
 *     and/or end.
 */
  __pyx_tuple__19 = PyTuple_Pack(6, __pyx_n_s_alignmentfile, __pyx_n_s_chrom, __pyx_n_s_start, __pyx_n_s_end, __pyx_n_s_one_based, __pyx_n_s_chrlen); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 2105, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__19);
  __Pyx_GIVEREF(__pyx_tuple__19);
  __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(5, 0, 6, 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_pysamstats_opt_pyx, __pyx_n_s_normalise_coords, 2105, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) __PYX_ERR(0, 2105, __pyx_L1_error)

  /* "pysamstats/opt.pyx":2159
 * 
 * 
 * def rootmean(uint64_t sqsum, int count):             # <<<<<<<<<<<<<<
 *     if count > 0:
 *         return int(round(sqrt(sqsum / count)))
 */
  __pyx_tuple__21 = PyTuple_Pack(2, __pyx_n_s_sqsum, __pyx_n_s_count); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 2159, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__21);
  __Pyx_GIVEREF(__pyx_tuple__21);
  __pyx_codeobj__22 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 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_pysamstats_opt_pyx, __pyx_n_s_rootmean, 2159, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) __PYX_ERR(0, 2159, __pyx_L1_error)

  /* "pysamstats/opt.pyx":2166
 * 
 * 
 * def mean(int64_t total, int count):             # <<<<<<<<<<<<<<
 *     if count > 0:
 *         return int(round(total / count))
 */
  __pyx_tuple__23 = PyTuple_Pack(2, __pyx_n_s_total, __pyx_n_s_count); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 2166, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__23);
  __Pyx_GIVEREF(__pyx_tuple__23);
  __pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 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_pysamstats_opt_pyx, __pyx_n_s_mean, 2166, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(0, 2166, __pyx_L1_error)

  /* "pysamstats/opt.pyx":2176
 * 
 * 
 * def count_reads(AlignmentFile alignmentfile, chrom=None, start=None, end=None):             # <<<<<<<<<<<<<<
 *     cdef IteratorRowRegion it
 *     cdef int n = 0
 */
  __pyx_tuple__25 = PyTuple_Pack(10, __pyx_n_s_alignmentfile, __pyx_n_s_chrom, __pyx_n_s_start, __pyx_n_s_end, __pyx_n_s_it, __pyx_n_s_n, __pyx_n_s_has_coord, __pyx_n_s_rtid, __pyx_n_s_rstart, __pyx_n_s_rend); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 2176, __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_pysamstats_opt_pyx, __pyx_n_s_count_reads, 2176, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(0, 2176, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __pyx_unpickle_PileupStat(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */
  __pyx_tuple__27 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__27);
  __Pyx_GIVEREF(__pyx_tuple__27);
  __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 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_stringsource, __pyx_n_s_pyx_unpickle_PileupStat, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_tuple__29 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__29);
  __Pyx_GIVEREF(__pyx_tuple__29);
  __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 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_stringsource, __pyx_n_s_pyx_unpickle_CountPp, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_tuple__31 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__31);
  __Pyx_GIVEREF(__pyx_tuple__31);
  __pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 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_stringsource, __pyx_n_s_pyx_unpickle_Coverage, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_tuple__33 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__33);
  __Pyx_GIVEREF(__pyx_tuple__33);
  __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 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_stringsource, __pyx_n_s_pyx_unpickle_CountPpStrand, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_tuple__35 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(1, 1, __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_stringsource, __pyx_n_s_pyx_unpickle_CoverageStrand, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_tuple__37 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__37);
  __Pyx_GIVEREF(__pyx_tuple__37);
  __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 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_stringsource, __pyx_n_s_pyx_unpickle_CoverageExt, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_tuple__39 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__39);
  __Pyx_GIVEREF(__pyx_tuple__39);
  __pyx_codeobj__40 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 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_stringsource, __pyx_n_s_pyx_unpickle_CountStrand, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__40)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_tuple__41 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__41);
  __Pyx_GIVEREF(__pyx_tuple__41);
  __pyx_codeobj__42 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 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_stringsource, __pyx_n_s_pyx_unpickle_CoverageExtStrand, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__42)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_tuple__43 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__43);
  __Pyx_GIVEREF(__pyx_tuple__43);
  __pyx_codeobj__44 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 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_stringsource, __pyx_n_s_pyx_unpickle_Variation, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__44)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_tuple__45 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__45);
  __Pyx_GIVEREF(__pyx_tuple__45);
  __pyx_codeobj__46 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__45, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_VariationStrand, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__46)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_tuple__47 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__47)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__47);
  __Pyx_GIVEREF(__pyx_tuple__47);
  __pyx_codeobj__48 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__47, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_TlenHelper, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__48)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_tuple__49 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__49)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__49);
  __Pyx_GIVEREF(__pyx_tuple__49);
  __pyx_codeobj__50 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__49, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Tlen, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__50)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_tuple__51 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__51)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__51);
  __Pyx_GIVEREF(__pyx_tuple__51);
  __pyx_codeobj__52 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__51, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_TlenStrand, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__52)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_tuple__53 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__53)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__53);
  __Pyx_GIVEREF(__pyx_tuple__53);
  __pyx_codeobj__54 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__53, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_MapqHelper, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__54)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_tuple__55 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__55)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__55);
  __Pyx_GIVEREF(__pyx_tuple__55);
  __pyx_codeobj__56 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__55, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Mapq, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__56)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_tuple__57 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__57)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__57);
  __Pyx_GIVEREF(__pyx_tuple__57);
  __pyx_codeobj__58 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__57, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_MapqStrand, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__58)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_tuple__59 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__59)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__59);
  __Pyx_GIVEREF(__pyx_tuple__59);
  __pyx_codeobj__60 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__59, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_BaseqHelper, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__60)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_tuple__61 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__61)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__61);
  __Pyx_GIVEREF(__pyx_tuple__61);
  __pyx_codeobj__62 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__61, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_BaseqPpHelper, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__62)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_tuple__63 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__63)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__63);
  __Pyx_GIVEREF(__pyx_tuple__63);
  __pyx_codeobj__64 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__63, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Baseq, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__64)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_tuple__65 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__65)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__65);
  __Pyx_GIVEREF(__pyx_tuple__65);
  __pyx_codeobj__66 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__65, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_BaseqStrandPpHelp, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__66)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_tuple__67 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__67)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__67);
  __Pyx_GIVEREF(__pyx_tuple__67);
  __pyx_codeobj__68 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__67, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_BaseqStrand, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__68)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_tuple__69 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__69)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__69);
  __Pyx_GIVEREF(__pyx_tuple__69);
  __pyx_codeobj__70 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__69, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_BaseqExt, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__70)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_tuple__71 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__71)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__71);
  __Pyx_GIVEREF(__pyx_tuple__71);
  __pyx_codeobj__72 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__71, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_BaseqExtStrand, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__72)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_tuple__73 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__73)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__73);
  __Pyx_GIVEREF(__pyx_tuple__73);
  __pyx_codeobj__74 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__73, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_CoverageGC, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__74)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_tuple__75 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__75)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__75);
  __Pyx_GIVEREF(__pyx_tuple__75);
  __pyx_codeobj__76 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__75, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_BinnedStat, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__76)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_tuple__77 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__77)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__77);
  __Pyx_GIVEREF(__pyx_tuple__77);
  __pyx_codeobj__78 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__77, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_CoverageBinned, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__78)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_tuple__79 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__79)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__79);
  __Pyx_GIVEREF(__pyx_tuple__79);
  __pyx_codeobj__80 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__79, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_CoverageExtBinned, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__80)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_tuple__81 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__81)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__81);
  __Pyx_GIVEREF(__pyx_tuple__81);
  __pyx_codeobj__82 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__81, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_MapqBinned, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__82)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_tuple__83 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__83)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__83);
  __Pyx_GIVEREF(__pyx_tuple__83);
  __pyx_codeobj__84 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__83, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_AlignmentBinned, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__84)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_tuple__85 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__85)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__85);
  __Pyx_GIVEREF(__pyx_tuple__85);
  __pyx_codeobj__86 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__85, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_TlenBinned, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__86)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) __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_300 = PyInt_FromLong(300); if (unlikely(!__pyx_int_300)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_9640749 = PyInt_FromLong(9640749L); if (unlikely(!__pyx_int_9640749)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_16489717 = PyInt_FromLong(16489717L); if (unlikely(!__pyx_int_16489717)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_21337980 = PyInt_FromLong(21337980L); if (unlikely(!__pyx_int_21337980)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_45714792 = PyInt_FromLong(45714792L); if (unlikely(!__pyx_int_45714792)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_46239482 = PyInt_FromLong(46239482L); if (unlikely(!__pyx_int_46239482)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_49271924 = PyInt_FromLong(49271924L); if (unlikely(!__pyx_int_49271924)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_61830175 = PyInt_FromLong(61830175L); if (unlikely(!__pyx_int_61830175)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_80613547 = PyInt_FromLong(80613547L); if (unlikely(!__pyx_int_80613547)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_96777604 = PyInt_FromLong(96777604L); if (unlikely(!__pyx_int_96777604)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_103914820 = PyInt_FromLong(103914820L); if (unlikely(!__pyx_int_103914820)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_108465233 = PyInt_FromLong(108465233L); if (unlikely(!__pyx_int_108465233)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_115819078 = PyInt_FromLong(115819078L); if (unlikely(!__pyx_int_115819078)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_142322036 = PyInt_FromLong(142322036L); if (unlikely(!__pyx_int_142322036)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_181509095 = PyInt_FromLong(181509095L); if (unlikely(!__pyx_int_181509095)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_197466347 = PyInt_FromLong(197466347L); if (unlikely(!__pyx_int_197466347)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_202141403 = PyInt_FromLong(202141403L); if (unlikely(!__pyx_int_202141403)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_216513281 = PyInt_FromLong(216513281L); if (unlikely(!__pyx_int_216513281)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_222419149 = PyInt_FromLong(222419149L); if (unlikely(!__pyx_int_222419149)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_231104747 = PyInt_FromLong(231104747L); if (unlikely(!__pyx_int_231104747)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_266231143 = PyInt_FromLong(266231143L); if (unlikely(!__pyx_int_266231143)) __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
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
  /*--- Function export code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_type_init_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
  /*--- Type init code ---*/
  __pyx_vtabptr_10pysamstats_3opt_PileupStat = &__pyx_vtable_10pysamstats_3opt_PileupStat;
  __pyx_vtable_10pysamstats_3opt_PileupStat.rec = (PyObject *(*)(struct __pyx_obj_10pysamstats_3opt_PileupStat *, PyObject *, PyObject *, struct __pyx_obj_5pysam_9libcfaidx_FastaFile *, PyObject *))__pyx_f_10pysamstats_3opt_10PileupStat_rec;
  __pyx_vtable_10pysamstats_3opt_PileupStat.recv = (void (*)(struct __pyx_obj_10pysamstats_3opt_PileupStat *, bam_pileup1_t *, struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn *, PyObject *))__pyx_f_10pysamstats_3opt_10PileupStat_recv;
  if (PyType_Ready(&__pyx_type_10pysamstats_3opt_PileupStat) < 0) __PYX_ERR(0, 75, __pyx_L1_error)
  __pyx_type_10pysamstats_3opt_PileupStat.tp_print = 0;
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_10pysamstats_3opt_PileupStat.tp_dictoffset && __pyx_type_10pysamstats_3opt_PileupStat.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_10pysamstats_3opt_PileupStat.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_10pysamstats_3opt_PileupStat.tp_dict, __pyx_vtabptr_10pysamstats_3opt_PileupStat) < 0) __PYX_ERR(0, 75, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_PileupStat, (PyObject *)&__pyx_type_10pysamstats_3opt_PileupStat) < 0) __PYX_ERR(0, 75, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_10pysamstats_3opt_PileupStat) < 0) __PYX_ERR(0, 75, __pyx_L1_error)
  __pyx_ptype_10pysamstats_3opt_PileupStat = &__pyx_type_10pysamstats_3opt_PileupStat;
  __pyx_vtabptr_10pysamstats_3opt_CountPp = &__pyx_vtable_10pysamstats_3opt_CountPp;
  __pyx_vtable_10pysamstats_3opt_CountPp.incr = (void (*)(struct __pyx_obj_10pysamstats_3opt_CountPp *, int))__pyx_f_10pysamstats_3opt_7CountPp_incr;
  if (PyType_Ready(&__pyx_type_10pysamstats_3opt_CountPp) < 0) __PYX_ERR(0, 90, __pyx_L1_error)
  __pyx_type_10pysamstats_3opt_CountPp.tp_print = 0;
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_10pysamstats_3opt_CountPp.tp_dictoffset && __pyx_type_10pysamstats_3opt_CountPp.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_10pysamstats_3opt_CountPp.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_10pysamstats_3opt_CountPp.tp_dict, __pyx_vtabptr_10pysamstats_3opt_CountPp) < 0) __PYX_ERR(0, 90, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_CountPp, (PyObject *)&__pyx_type_10pysamstats_3opt_CountPp) < 0) __PYX_ERR(0, 90, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_10pysamstats_3opt_CountPp) < 0) __PYX_ERR(0, 90, __pyx_L1_error)
  __pyx_ptype_10pysamstats_3opt_CountPp = &__pyx_type_10pysamstats_3opt_CountPp;
  __pyx_vtabptr_10pysamstats_3opt_Coverage = &__pyx_vtable_10pysamstats_3opt_Coverage;
  __pyx_vtable_10pysamstats_3opt_Coverage.__pyx_base = *__pyx_vtabptr_10pysamstats_3opt_PileupStat;
  __pyx_vtable_10pysamstats_3opt_Coverage.__pyx_base.rec = (PyObject *(*)(struct __pyx_obj_10pysamstats_3opt_PileupStat *, PyObject *, PyObject *, struct __pyx_obj_5pysam_9libcfaidx_FastaFile *, PyObject *))__pyx_f_10pysamstats_3opt_8Coverage_rec;
  __pyx_vtable_10pysamstats_3opt_Coverage.__pyx_base.recv = (void (*)(struct __pyx_obj_10pysamstats_3opt_PileupStat *, bam_pileup1_t *, struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn *, PyObject *))__pyx_f_10pysamstats_3opt_8Coverage_recv;
  __pyx_type_10pysamstats_3opt_Coverage.tp_base = __pyx_ptype_10pysamstats_3opt_PileupStat;
  if (PyType_Ready(&__pyx_type_10pysamstats_3opt_Coverage) < 0) __PYX_ERR(0, 107, __pyx_L1_error)
  __pyx_type_10pysamstats_3opt_Coverage.tp_print = 0;
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_10pysamstats_3opt_Coverage.tp_dictoffset && __pyx_type_10pysamstats_3opt_Coverage.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_10pysamstats_3opt_Coverage.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_10pysamstats_3opt_Coverage.tp_dict, __pyx_vtabptr_10pysamstats_3opt_Coverage) < 0) __PYX_ERR(0, 107, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Coverage, (PyObject *)&__pyx_type_10pysamstats_3opt_Coverage) < 0) __PYX_ERR(0, 107, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_10pysamstats_3opt_Coverage) < 0) __PYX_ERR(0, 107, __pyx_L1_error)
  __pyx_ptype_10pysamstats_3opt_Coverage = &__pyx_type_10pysamstats_3opt_Coverage;
  __pyx_vtabptr_10pysamstats_3opt_CountPpStrand = &__pyx_vtable_10pysamstats_3opt_CountPpStrand;
  __pyx_vtable_10pysamstats_3opt_CountPpStrand.incr = (void (*)(struct __pyx_obj_10pysamstats_3opt_CountPpStrand *, int, int))__pyx_f_10pysamstats_3opt_13CountPpStrand_incr;
  if (PyType_Ready(&__pyx_type_10pysamstats_3opt_CountPpStrand) < 0) __PYX_ERR(0, 147, __pyx_L1_error)
  __pyx_type_10pysamstats_3opt_CountPpStrand.tp_print = 0;
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_10pysamstats_3opt_CountPpStrand.tp_dictoffset && __pyx_type_10pysamstats_3opt_CountPpStrand.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_10pysamstats_3opt_CountPpStrand.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_10pysamstats_3opt_CountPpStrand.tp_dict, __pyx_vtabptr_10pysamstats_3opt_CountPpStrand) < 0) __PYX_ERR(0, 147, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_CountPpStrand, (PyObject *)&__pyx_type_10pysamstats_3opt_CountPpStrand) < 0) __PYX_ERR(0, 147, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_10pysamstats_3opt_CountPpStrand) < 0) __PYX_ERR(0, 147, __pyx_L1_error)
  __pyx_ptype_10pysamstats_3opt_CountPpStrand = &__pyx_type_10pysamstats_3opt_CountPpStrand;
  __pyx_vtabptr_10pysamstats_3opt_CoverageStrand = &__pyx_vtable_10pysamstats_3opt_CoverageStrand;
  __pyx_vtable_10pysamstats_3opt_CoverageStrand.__pyx_base = *__pyx_vtabptr_10pysamstats_3opt_PileupStat;
  __pyx_vtable_10pysamstats_3opt_CoverageStrand.__pyx_base.rec = (PyObject *(*)(struct __pyx_obj_10pysamstats_3opt_PileupStat *, PyObject *, PyObject *, struct __pyx_obj_5pysam_9libcfaidx_FastaFile *, PyObject *))__pyx_f_10pysamstats_3opt_14CoverageStrand_rec;
  __pyx_vtable_10pysamstats_3opt_CoverageStrand.__pyx_base.recv = (void (*)(struct __pyx_obj_10pysamstats_3opt_PileupStat *, bam_pileup1_t *, struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn *, PyObject *))__pyx_f_10pysamstats_3opt_14CoverageStrand_recv;
  __pyx_type_10pysamstats_3opt_CoverageStrand.tp_base = __pyx_ptype_10pysamstats_3opt_PileupStat;
  if (PyType_Ready(&__pyx_type_10pysamstats_3opt_CoverageStrand) < 0) __PYX_ERR(0, 172, __pyx_L1_error)
  __pyx_type_10pysamstats_3opt_CoverageStrand.tp_print = 0;
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_10pysamstats_3opt_CoverageStrand.tp_dictoffset && __pyx_type_10pysamstats_3opt_CoverageStrand.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_10pysamstats_3opt_CoverageStrand.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_10pysamstats_3opt_CoverageStrand.tp_dict, __pyx_vtabptr_10pysamstats_3opt_CoverageStrand) < 0) __PYX_ERR(0, 172, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_CoverageStrand, (PyObject *)&__pyx_type_10pysamstats_3opt_CoverageStrand) < 0) __PYX_ERR(0, 172, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_10pysamstats_3opt_CoverageStrand) < 0) __PYX_ERR(0, 172, __pyx_L1_error)
  __pyx_ptype_10pysamstats_3opt_CoverageStrand = &__pyx_type_10pysamstats_3opt_CoverageStrand;
  __pyx_vtabptr_10pysamstats_3opt_CoverageExt = &__pyx_vtable_10pysamstats_3opt_CoverageExt;
  __pyx_vtable_10pysamstats_3opt_CoverageExt.__pyx_base = *__pyx_vtabptr_10pysamstats_3opt_PileupStat;
  __pyx_vtable_10pysamstats_3opt_CoverageExt.__pyx_base.rec = (PyObject *(*)(struct __pyx_obj_10pysamstats_3opt_PileupStat *, PyObject *, PyObject *, struct __pyx_obj_5pysam_9libcfaidx_FastaFile *, PyObject *))__pyx_f_10pysamstats_3opt_11CoverageExt_rec;
  __pyx_vtable_10pysamstats_3opt_CoverageExt.__pyx_base.recv = (void (*)(struct __pyx_obj_10pysamstats_3opt_PileupStat *, bam_pileup1_t *, struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn *, PyObject *))__pyx_f_10pysamstats_3opt_11CoverageExt_recv;
  __pyx_type_10pysamstats_3opt_CoverageExt.tp_base = __pyx_ptype_10pysamstats_3opt_PileupStat;
  if (PyType_Ready(&__pyx_type_10pysamstats_3opt_CoverageExt) < 0) __PYX_ERR(0, 220, __pyx_L1_error)
  __pyx_type_10pysamstats_3opt_CoverageExt.tp_print = 0;
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_10pysamstats_3opt_CoverageExt.tp_dictoffset && __pyx_type_10pysamstats_3opt_CoverageExt.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_10pysamstats_3opt_CoverageExt.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_10pysamstats_3opt_CoverageExt.tp_dict, __pyx_vtabptr_10pysamstats_3opt_CoverageExt) < 0) __PYX_ERR(0, 220, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_CoverageExt, (PyObject *)&__pyx_type_10pysamstats_3opt_CoverageExt) < 0) __PYX_ERR(0, 220, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_10pysamstats_3opt_CoverageExt) < 0) __PYX_ERR(0, 220, __pyx_L1_error)
  __pyx_ptype_10pysamstats_3opt_CoverageExt = &__pyx_type_10pysamstats_3opt_CoverageExt;
  __pyx_vtabptr_10pysamstats_3opt_CountStrand = &__pyx_vtable_10pysamstats_3opt_CountStrand;
  __pyx_vtable_10pysamstats_3opt_CountStrand.incr = (void (*)(struct __pyx_obj_10pysamstats_3opt_CountStrand *, int))__pyx_f_10pysamstats_3opt_11CountStrand_incr;
  if (PyType_Ready(&__pyx_type_10pysamstats_3opt_CountStrand) < 0) __PYX_ERR(0, 305, __pyx_L1_error)
  __pyx_type_10pysamstats_3opt_CountStrand.tp_print = 0;
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_10pysamstats_3opt_CountStrand.tp_dictoffset && __pyx_type_10pysamstats_3opt_CountStrand.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_10pysamstats_3opt_CountStrand.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_10pysamstats_3opt_CountStrand.tp_dict, __pyx_vtabptr_10pysamstats_3opt_CountStrand) < 0) __PYX_ERR(0, 305, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_CountStrand, (PyObject *)&__pyx_type_10pysamstats_3opt_CountStrand) < 0) __PYX_ERR(0, 305, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_10pysamstats_3opt_CountStrand) < 0) __PYX_ERR(0, 305, __pyx_L1_error)
  __pyx_ptype_10pysamstats_3opt_CountStrand = &__pyx_type_10pysamstats_3opt_CountStrand;
  __pyx_vtabptr_10pysamstats_3opt_CoverageExtStrand = &__pyx_vtable_10pysamstats_3opt_CoverageExtStrand;
  __pyx_vtable_10pysamstats_3opt_CoverageExtStrand.__pyx_base = *__pyx_vtabptr_10pysamstats_3opt_PileupStat;
  __pyx_vtable_10pysamstats_3opt_CoverageExtStrand.__pyx_base.rec = (PyObject *(*)(struct __pyx_obj_10pysamstats_3opt_PileupStat *, PyObject *, PyObject *, struct __pyx_obj_5pysam_9libcfaidx_FastaFile *, PyObject *))__pyx_f_10pysamstats_3opt_17CoverageExtStrand_rec;
  __pyx_vtable_10pysamstats_3opt_CoverageExtStrand.__pyx_base.recv = (void (*)(struct __pyx_obj_10pysamstats_3opt_PileupStat *, bam_pileup1_t *, struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn *, PyObject *))__pyx_f_10pysamstats_3opt_17CoverageExtStrand_recv;
  __pyx_type_10pysamstats_3opt_CoverageExtStrand.tp_base = __pyx_ptype_10pysamstats_3opt_PileupStat;
  if (PyType_Ready(&__pyx_type_10pysamstats_3opt_CoverageExtStrand) < 0) __PYX_ERR(0, 324, __pyx_L1_error)
  __pyx_type_10pysamstats_3opt_CoverageExtStrand.tp_print = 0;
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_10pysamstats_3opt_CoverageExtStrand.tp_dictoffset && __pyx_type_10pysamstats_3opt_CoverageExtStrand.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_10pysamstats_3opt_CoverageExtStrand.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_10pysamstats_3opt_CoverageExtStrand.tp_dict, __pyx_vtabptr_10pysamstats_3opt_CoverageExtStrand) < 0) __PYX_ERR(0, 324, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_CoverageExtStrand, (PyObject *)&__pyx_type_10pysamstats_3opt_CoverageExtStrand) < 0) __PYX_ERR(0, 324, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_10pysamstats_3opt_CoverageExtStrand) < 0) __PYX_ERR(0, 324, __pyx_L1_error)
  __pyx_ptype_10pysamstats_3opt_CoverageExtStrand = &__pyx_type_10pysamstats_3opt_CoverageExtStrand;
  __pyx_vtabptr_10pysamstats_3opt_Variation = &__pyx_vtable_10pysamstats_3opt_Variation;
  __pyx_vtable_10pysamstats_3opt_Variation.__pyx_base = *__pyx_vtabptr_10pysamstats_3opt_PileupStat;
  __pyx_vtable_10pysamstats_3opt_Variation.__pyx_base.rec = (PyObject *(*)(struct __pyx_obj_10pysamstats_3opt_PileupStat *, PyObject *, PyObject *, struct __pyx_obj_5pysam_9libcfaidx_FastaFile *, PyObject *))__pyx_f_10pysamstats_3opt_9Variation_rec;
  __pyx_vtable_10pysamstats_3opt_Variation.__pyx_base.recv = (void (*)(struct __pyx_obj_10pysamstats_3opt_PileupStat *, bam_pileup1_t *, struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn *, PyObject *))__pyx_f_10pysamstats_3opt_9Variation_recv;
  __pyx_type_10pysamstats_3opt_Variation.tp_base = __pyx_ptype_10pysamstats_3opt_PileupStat;
  if (PyType_Ready(&__pyx_type_10pysamstats_3opt_Variation) < 0) __PYX_ERR(0, 435, __pyx_L1_error)
  __pyx_type_10pysamstats_3opt_Variation.tp_print = 0;
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_10pysamstats_3opt_Variation.tp_dictoffset && __pyx_type_10pysamstats_3opt_Variation.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_10pysamstats_3opt_Variation.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_10pysamstats_3opt_Variation.tp_dict, __pyx_vtabptr_10pysamstats_3opt_Variation) < 0) __PYX_ERR(0, 435, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Variation, (PyObject *)&__pyx_type_10pysamstats_3opt_Variation) < 0) __PYX_ERR(0, 435, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_10pysamstats_3opt_Variation) < 0) __PYX_ERR(0, 435, __pyx_L1_error)
  __pyx_ptype_10pysamstats_3opt_Variation = &__pyx_type_10pysamstats_3opt_Variation;
  __pyx_vtabptr_10pysamstats_3opt_VariationStrand = &__pyx_vtable_10pysamstats_3opt_VariationStrand;
  __pyx_vtable_10pysamstats_3opt_VariationStrand.__pyx_base = *__pyx_vtabptr_10pysamstats_3opt_PileupStat;
  __pyx_vtable_10pysamstats_3opt_VariationStrand.__pyx_base.rec = (PyObject *(*)(struct __pyx_obj_10pysamstats_3opt_PileupStat *, PyObject *, PyObject *, struct __pyx_obj_5pysam_9libcfaidx_FastaFile *, PyObject *))__pyx_f_10pysamstats_3opt_15VariationStrand_rec;
  __pyx_vtable_10pysamstats_3opt_VariationStrand.__pyx_base.recv = (void (*)(struct __pyx_obj_10pysamstats_3opt_PileupStat *, bam_pileup1_t *, struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn *, PyObject *))__pyx_f_10pysamstats_3opt_15VariationStrand_recv;
  __pyx_type_10pysamstats_3opt_VariationStrand.tp_base = __pyx_ptype_10pysamstats_3opt_PileupStat;
  if (PyType_Ready(&__pyx_type_10pysamstats_3opt_VariationStrand) < 0) __PYX_ERR(0, 544, __pyx_L1_error)
  __pyx_type_10pysamstats_3opt_VariationStrand.tp_print = 0;
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_10pysamstats_3opt_VariationStrand.tp_dictoffset && __pyx_type_10pysamstats_3opt_VariationStrand.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_10pysamstats_3opt_VariationStrand.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_10pysamstats_3opt_VariationStrand.tp_dict, __pyx_vtabptr_10pysamstats_3opt_VariationStrand) < 0) __PYX_ERR(0, 544, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_VariationStrand, (PyObject *)&__pyx_type_10pysamstats_3opt_VariationStrand) < 0) __PYX_ERR(0, 544, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_10pysamstats_3opt_VariationStrand) < 0) __PYX_ERR(0, 544, __pyx_L1_error)
  __pyx_ptype_10pysamstats_3opt_VariationStrand = &__pyx_type_10pysamstats_3opt_VariationStrand;
  __pyx_vtabptr_10pysamstats_3opt_TlenHelper = &__pyx_vtable_10pysamstats_3opt_TlenHelper;
  __pyx_vtable_10pysamstats_3opt_TlenHelper.update = (void (*)(struct __pyx_obj_10pysamstats_3opt_TlenHelper *, int64_t))__pyx_f_10pysamstats_3opt_10TlenHelper_update;
  if (PyType_Ready(&__pyx_type_10pysamstats_3opt_TlenHelper) < 0) __PYX_ERR(0, 679, __pyx_L1_error)
  __pyx_type_10pysamstats_3opt_TlenHelper.tp_print = 0;
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_10pysamstats_3opt_TlenHelper.tp_dictoffset && __pyx_type_10pysamstats_3opt_TlenHelper.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_10pysamstats_3opt_TlenHelper.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_10pysamstats_3opt_TlenHelper.tp_dict, __pyx_vtabptr_10pysamstats_3opt_TlenHelper) < 0) __PYX_ERR(0, 679, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_TlenHelper, (PyObject *)&__pyx_type_10pysamstats_3opt_TlenHelper) < 0) __PYX_ERR(0, 679, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_10pysamstats_3opt_TlenHelper) < 0) __PYX_ERR(0, 679, __pyx_L1_error)
  __pyx_ptype_10pysamstats_3opt_TlenHelper = &__pyx_type_10pysamstats_3opt_TlenHelper;
  __pyx_vtabptr_10pysamstats_3opt_Tlen = &__pyx_vtable_10pysamstats_3opt_Tlen;
  __pyx_vtable_10pysamstats_3opt_Tlen.__pyx_base = *__pyx_vtabptr_10pysamstats_3opt_PileupStat;
  __pyx_vtable_10pysamstats_3opt_Tlen.__pyx_base.rec = (PyObject *(*)(struct __pyx_obj_10pysamstats_3opt_PileupStat *, PyObject *, PyObject *, struct __pyx_obj_5pysam_9libcfaidx_FastaFile *, PyObject *))__pyx_f_10pysamstats_3opt_4Tlen_rec;
  __pyx_vtable_10pysamstats_3opt_Tlen.__pyx_base.recv = (void (*)(struct __pyx_obj_10pysamstats_3opt_PileupStat *, bam_pileup1_t *, struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn *, PyObject *))__pyx_f_10pysamstats_3opt_4Tlen_recv;
  __pyx_type_10pysamstats_3opt_Tlen.tp_base = __pyx_ptype_10pysamstats_3opt_PileupStat;
  if (PyType_Ready(&__pyx_type_10pysamstats_3opt_Tlen) < 0) __PYX_ERR(0, 731, __pyx_L1_error)
  __pyx_type_10pysamstats_3opt_Tlen.tp_print = 0;
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_10pysamstats_3opt_Tlen.tp_dictoffset && __pyx_type_10pysamstats_3opt_Tlen.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_10pysamstats_3opt_Tlen.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_10pysamstats_3opt_Tlen.tp_dict, __pyx_vtabptr_10pysamstats_3opt_Tlen) < 0) __PYX_ERR(0, 731, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Tlen, (PyObject *)&__pyx_type_10pysamstats_3opt_Tlen) < 0) __PYX_ERR(0, 731, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_10pysamstats_3opt_Tlen) < 0) __PYX_ERR(0, 731, __pyx_L1_error)
  __pyx_ptype_10pysamstats_3opt_Tlen = &__pyx_type_10pysamstats_3opt_Tlen;
  __pyx_vtabptr_10pysamstats_3opt_TlenStrand = &__pyx_vtable_10pysamstats_3opt_TlenStrand;
  __pyx_vtable_10pysamstats_3opt_TlenStrand.__pyx_base = *__pyx_vtabptr_10pysamstats_3opt_PileupStat;
  __pyx_vtable_10pysamstats_3opt_TlenStrand.__pyx_base.rec = (PyObject *(*)(struct __pyx_obj_10pysamstats_3opt_PileupStat *, PyObject *, PyObject *, struct __pyx_obj_5pysam_9libcfaidx_FastaFile *, PyObject *))__pyx_f_10pysamstats_3opt_10TlenStrand_rec;
  __pyx_vtable_10pysamstats_3opt_TlenStrand.__pyx_base.recv = (void (*)(struct __pyx_obj_10pysamstats_3opt_PileupStat *, bam_pileup1_t *, struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn *, PyObject *))__pyx_f_10pysamstats_3opt_10TlenStrand_recv;
  __pyx_type_10pysamstats_3opt_TlenStrand.tp_base = __pyx_ptype_10pysamstats_3opt_PileupStat;
  if (PyType_Ready(&__pyx_type_10pysamstats_3opt_TlenStrand) < 0) __PYX_ERR(0, 796, __pyx_L1_error)
  __pyx_type_10pysamstats_3opt_TlenStrand.tp_print = 0;
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_10pysamstats_3opt_TlenStrand.tp_dictoffset && __pyx_type_10pysamstats_3opt_TlenStrand.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_10pysamstats_3opt_TlenStrand.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_10pysamstats_3opt_TlenStrand.tp_dict, __pyx_vtabptr_10pysamstats_3opt_TlenStrand) < 0) __PYX_ERR(0, 796, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_TlenStrand, (PyObject *)&__pyx_type_10pysamstats_3opt_TlenStrand) < 0) __PYX_ERR(0, 796, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_10pysamstats_3opt_TlenStrand) < 0) __PYX_ERR(0, 796, __pyx_L1_error)
  __pyx_ptype_10pysamstats_3opt_TlenStrand = &__pyx_type_10pysamstats_3opt_TlenStrand;
  __pyx_vtabptr_10pysamstats_3opt_MapqHelper = &__pyx_vtable_10pysamstats_3opt_MapqHelper;
  __pyx_vtable_10pysamstats_3opt_MapqHelper.update = (void (*)(struct __pyx_obj_10pysamstats_3opt_MapqHelper *, uint64_t))__pyx_f_10pysamstats_3opt_10MapqHelper_update;
  if (PyType_Ready(&__pyx_type_10pysamstats_3opt_MapqHelper) < 0) __PYX_ERR(0, 912, __pyx_L1_error)
  __pyx_type_10pysamstats_3opt_MapqHelper.tp_print = 0;
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_10pysamstats_3opt_MapqHelper.tp_dictoffset && __pyx_type_10pysamstats_3opt_MapqHelper.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_10pysamstats_3opt_MapqHelper.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_10pysamstats_3opt_MapqHelper.tp_dict, __pyx_vtabptr_10pysamstats_3opt_MapqHelper) < 0) __PYX_ERR(0, 912, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_MapqHelper, (PyObject *)&__pyx_type_10pysamstats_3opt_MapqHelper) < 0) __PYX_ERR(0, 912, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_10pysamstats_3opt_MapqHelper) < 0) __PYX_ERR(0, 912, __pyx_L1_error)
  __pyx_ptype_10pysamstats_3opt_MapqHelper = &__pyx_type_10pysamstats_3opt_MapqHelper;
  __pyx_vtabptr_10pysamstats_3opt_Mapq = &__pyx_vtable_10pysamstats_3opt_Mapq;
  __pyx_vtable_10pysamstats_3opt_Mapq.__pyx_base = *__pyx_vtabptr_10pysamstats_3opt_PileupStat;
  __pyx_vtable_10pysamstats_3opt_Mapq.__pyx_base.rec = (PyObject *(*)(struct __pyx_obj_10pysamstats_3opt_PileupStat *, PyObject *, PyObject *, struct __pyx_obj_5pysam_9libcfaidx_FastaFile *, PyObject *))__pyx_f_10pysamstats_3opt_4Mapq_rec;
  __pyx_vtable_10pysamstats_3opt_Mapq.__pyx_base.recv = (void (*)(struct __pyx_obj_10pysamstats_3opt_PileupStat *, bam_pileup1_t *, struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn *, PyObject *))__pyx_f_10pysamstats_3opt_4Mapq_recv;
  __pyx_type_10pysamstats_3opt_Mapq.tp_base = __pyx_ptype_10pysamstats_3opt_PileupStat;
  if (PyType_Ready(&__pyx_type_10pysamstats_3opt_Mapq) < 0) __PYX_ERR(0, 941, __pyx_L1_error)
  __pyx_type_10pysamstats_3opt_Mapq.tp_print = 0;
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_10pysamstats_3opt_Mapq.tp_dictoffset && __pyx_type_10pysamstats_3opt_Mapq.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_10pysamstats_3opt_Mapq.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_10pysamstats_3opt_Mapq.tp_dict, __pyx_vtabptr_10pysamstats_3opt_Mapq) < 0) __PYX_ERR(0, 941, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Mapq, (PyObject *)&__pyx_type_10pysamstats_3opt_Mapq) < 0) __PYX_ERR(0, 941, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_10pysamstats_3opt_Mapq) < 0) __PYX_ERR(0, 941, __pyx_L1_error)
  __pyx_ptype_10pysamstats_3opt_Mapq = &__pyx_type_10pysamstats_3opt_Mapq;
  __pyx_vtabptr_10pysamstats_3opt_MapqStrand = &__pyx_vtable_10pysamstats_3opt_MapqStrand;
  __pyx_vtable_10pysamstats_3opt_MapqStrand.__pyx_base = *__pyx_vtabptr_10pysamstats_3opt_PileupStat;
  __pyx_vtable_10pysamstats_3opt_MapqStrand.__pyx_base.rec = (PyObject *(*)(struct __pyx_obj_10pysamstats_3opt_PileupStat *, PyObject *, PyObject *, struct __pyx_obj_5pysam_9libcfaidx_FastaFile *, PyObject *))__pyx_f_10pysamstats_3opt_10MapqStrand_rec;
  __pyx_vtable_10pysamstats_3opt_MapqStrand.__pyx_base.recv = (void (*)(struct __pyx_obj_10pysamstats_3opt_PileupStat *, bam_pileup1_t *, struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn *, PyObject *))__pyx_f_10pysamstats_3opt_10MapqStrand_recv;
  __pyx_type_10pysamstats_3opt_MapqStrand.tp_base = __pyx_ptype_10pysamstats_3opt_PileupStat;
  if (PyType_Ready(&__pyx_type_10pysamstats_3opt_MapqStrand) < 0) __PYX_ERR(0, 997, __pyx_L1_error)
  __pyx_type_10pysamstats_3opt_MapqStrand.tp_print = 0;
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_10pysamstats_3opt_MapqStrand.tp_dictoffset && __pyx_type_10pysamstats_3opt_MapqStrand.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_10pysamstats_3opt_MapqStrand.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_10pysamstats_3opt_MapqStrand.tp_dict, __pyx_vtabptr_10pysamstats_3opt_MapqStrand) < 0) __PYX_ERR(0, 997, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_MapqStrand, (PyObject *)&__pyx_type_10pysamstats_3opt_MapqStrand) < 0) __PYX_ERR(0, 997, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_10pysamstats_3opt_MapqStrand) < 0) __PYX_ERR(0, 997, __pyx_L1_error)
  __pyx_ptype_10pysamstats_3opt_MapqStrand = &__pyx_type_10pysamstats_3opt_MapqStrand;
  __pyx_vtabptr_10pysamstats_3opt_BaseqHelper = &__pyx_vtable_10pysamstats_3opt_BaseqHelper;
  __pyx_vtable_10pysamstats_3opt_BaseqHelper.update = (void (*)(struct __pyx_obj_10pysamstats_3opt_BaseqHelper *, int64_t))__pyx_f_10pysamstats_3opt_11BaseqHelper_update;
  if (PyType_Ready(&__pyx_type_10pysamstats_3opt_BaseqHelper) < 0) __PYX_ERR(0, 1093, __pyx_L1_error)
  __pyx_type_10pysamstats_3opt_BaseqHelper.tp_print = 0;
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_10pysamstats_3opt_BaseqHelper.tp_dictoffset && __pyx_type_10pysamstats_3opt_BaseqHelper.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_10pysamstats_3opt_BaseqHelper.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_10pysamstats_3opt_BaseqHelper.tp_dict, __pyx_vtabptr_10pysamstats_3opt_BaseqHelper) < 0) __PYX_ERR(0, 1093, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_BaseqHelper, (PyObject *)&__pyx_type_10pysamstats_3opt_BaseqHelper) < 0) __PYX_ERR(0, 1093, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_10pysamstats_3opt_BaseqHelper) < 0) __PYX_ERR(0, 1093, __pyx_L1_error)
  __pyx_ptype_10pysamstats_3opt_BaseqHelper = &__pyx_type_10pysamstats_3opt_BaseqHelper;
  __pyx_vtabptr_10pysamstats_3opt_BaseqPpHelper = &__pyx_vtable_10pysamstats_3opt_BaseqPpHelper;
  __pyx_vtable_10pysamstats_3opt_BaseqPpHelper.update = (void (*)(struct __pyx_obj_10pysamstats_3opt_BaseqPpHelper *, int64_t, int))__pyx_f_10pysamstats_3opt_13BaseqPpHelper_update;
  if (PyType_Ready(&__pyx_type_10pysamstats_3opt_BaseqPpHelper) < 0) __PYX_ERR(0, 1119, __pyx_L1_error)
  __pyx_type_10pysamstats_3opt_BaseqPpHelper.tp_print = 0;
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_10pysamstats_3opt_BaseqPpHelper.tp_dictoffset && __pyx_type_10pysamstats_3opt_BaseqPpHelper.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_10pysamstats_3opt_BaseqPpHelper.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_10pysamstats_3opt_BaseqPpHelper.tp_dict, __pyx_vtabptr_10pysamstats_3opt_BaseqPpHelper) < 0) __PYX_ERR(0, 1119, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_BaseqPpHelper, (PyObject *)&__pyx_type_10pysamstats_3opt_BaseqPpHelper) < 0) __PYX_ERR(0, 1119, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_10pysamstats_3opt_BaseqPpHelper) < 0) __PYX_ERR(0, 1119, __pyx_L1_error)
  __pyx_ptype_10pysamstats_3opt_BaseqPpHelper = &__pyx_type_10pysamstats_3opt_BaseqPpHelper;
  __pyx_vtabptr_10pysamstats_3opt_Baseq = &__pyx_vtable_10pysamstats_3opt_Baseq;
  __pyx_vtable_10pysamstats_3opt_Baseq.__pyx_base = *__pyx_vtabptr_10pysamstats_3opt_PileupStat;
  __pyx_vtable_10pysamstats_3opt_Baseq.__pyx_base.rec = (PyObject *(*)(struct __pyx_obj_10pysamstats_3opt_PileupStat *, PyObject *, PyObject *, struct __pyx_obj_5pysam_9libcfaidx_FastaFile *, PyObject *))__pyx_f_10pysamstats_3opt_5Baseq_rec;
  __pyx_vtable_10pysamstats_3opt_Baseq.__pyx_base.recv = (void (*)(struct __pyx_obj_10pysamstats_3opt_PileupStat *, bam_pileup1_t *, struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn *, PyObject *))__pyx_f_10pysamstats_3opt_5Baseq_recv;
  __pyx_type_10pysamstats_3opt_Baseq.tp_base = __pyx_ptype_10pysamstats_3opt_PileupStat;
  if (PyType_Ready(&__pyx_type_10pysamstats_3opt_Baseq) < 0) __PYX_ERR(0, 1141, __pyx_L1_error)
  __pyx_type_10pysamstats_3opt_Baseq.tp_print = 0;
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_10pysamstats_3opt_Baseq.tp_dictoffset && __pyx_type_10pysamstats_3opt_Baseq.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_10pysamstats_3opt_Baseq.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_10pysamstats_3opt_Baseq.tp_dict, __pyx_vtabptr_10pysamstats_3opt_Baseq) < 0) __PYX_ERR(0, 1141, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Baseq, (PyObject *)&__pyx_type_10pysamstats_3opt_Baseq) < 0) __PYX_ERR(0, 1141, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_10pysamstats_3opt_Baseq) < 0) __PYX_ERR(0, 1141, __pyx_L1_error)
  __pyx_ptype_10pysamstats_3opt_Baseq = &__pyx_type_10pysamstats_3opt_Baseq;
  __pyx_vtabptr_10pysamstats_3opt_BaseqStrandPpHelper = &__pyx_vtable_10pysamstats_3opt_BaseqStrandPpHelper;
  __pyx_vtable_10pysamstats_3opt_BaseqStrandPpHelper.update = (void (*)(struct __pyx_obj_10pysamstats_3opt_BaseqStrandPpHelper *, int64_t, int, int))__pyx_f_10pysamstats_3opt_19BaseqStrandPpHelper_update;
  if (PyType_Ready(&__pyx_type_10pysamstats_3opt_BaseqStrandPpHelper) < 0) __PYX_ERR(0, 1188, __pyx_L1_error)
  __pyx_type_10pysamstats_3opt_BaseqStrandPpHelper.tp_print = 0;
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_10pysamstats_3opt_BaseqStrandPpHelper.tp_dictoffset && __pyx_type_10pysamstats_3opt_BaseqStrandPpHelper.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_10pysamstats_3opt_BaseqStrandPpHelper.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_10pysamstats_3opt_BaseqStrandPpHelper.tp_dict, __pyx_vtabptr_10pysamstats_3opt_BaseqStrandPpHelper) < 0) __PYX_ERR(0, 1188, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_BaseqStrandPpHelper, (PyObject *)&__pyx_type_10pysamstats_3opt_BaseqStrandPpHelper) < 0) __PYX_ERR(0, 1188, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_10pysamstats_3opt_BaseqStrandPpHelper) < 0) __PYX_ERR(0, 1188, __pyx_L1_error)
  __pyx_ptype_10pysamstats_3opt_BaseqStrandPpHelper = &__pyx_type_10pysamstats_3opt_BaseqStrandPpHelper;
  __pyx_vtabptr_10pysamstats_3opt_BaseqStrand = &__pyx_vtable_10pysamstats_3opt_BaseqStrand;
  __pyx_vtable_10pysamstats_3opt_BaseqStrand.__pyx_base = *__pyx_vtabptr_10pysamstats_3opt_PileupStat;
  __pyx_vtable_10pysamstats_3opt_BaseqStrand.__pyx_base.rec = (PyObject *(*)(struct __pyx_obj_10pysamstats_3opt_PileupStat *, PyObject *, PyObject *, struct __pyx_obj_5pysam_9libcfaidx_FastaFile *, PyObject *))__pyx_f_10pysamstats_3opt_11BaseqStrand_rec;
  __pyx_vtable_10pysamstats_3opt_BaseqStrand.__pyx_base.recv = (void (*)(struct __pyx_obj_10pysamstats_3opt_PileupStat *, bam_pileup1_t *, struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn *, PyObject *))__pyx_f_10pysamstats_3opt_11BaseqStrand_recv;
  __pyx_type_10pysamstats_3opt_BaseqStrand.tp_base = __pyx_ptype_10pysamstats_3opt_PileupStat;
  if (PyType_Ready(&__pyx_type_10pysamstats_3opt_BaseqStrand) < 0) __PYX_ERR(0, 1230, __pyx_L1_error)
  __pyx_type_10pysamstats_3opt_BaseqStrand.tp_print = 0;
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_10pysamstats_3opt_BaseqStrand.tp_dictoffset && __pyx_type_10pysamstats_3opt_BaseqStrand.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_10pysamstats_3opt_BaseqStrand.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_10pysamstats_3opt_BaseqStrand.tp_dict, __pyx_vtabptr_10pysamstats_3opt_BaseqStrand) < 0) __PYX_ERR(0, 1230, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_BaseqStrand, (PyObject *)&__pyx_type_10pysamstats_3opt_BaseqStrand) < 0) __PYX_ERR(0, 1230, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_10pysamstats_3opt_BaseqStrand) < 0) __PYX_ERR(0, 1230, __pyx_L1_error)
  __pyx_ptype_10pysamstats_3opt_BaseqStrand = &__pyx_type_10pysamstats_3opt_BaseqStrand;
  __pyx_vtabptr_10pysamstats_3opt_BaseqExt = &__pyx_vtable_10pysamstats_3opt_BaseqExt;
  __pyx_vtable_10pysamstats_3opt_BaseqExt.__pyx_base = *__pyx_vtabptr_10pysamstats_3opt_PileupStat;
  __pyx_vtable_10pysamstats_3opt_BaseqExt.__pyx_base.rec = (PyObject *(*)(struct __pyx_obj_10pysamstats_3opt_PileupStat *, PyObject *, PyObject *, struct __pyx_obj_5pysam_9libcfaidx_FastaFile *, PyObject *))__pyx_f_10pysamstats_3opt_8BaseqExt_rec;
  __pyx_vtable_10pysamstats_3opt_BaseqExt.__pyx_base.recv = (void (*)(struct __pyx_obj_10pysamstats_3opt_PileupStat *, bam_pileup1_t *, struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn *, PyObject *))__pyx_f_10pysamstats_3opt_8BaseqExt_recv;
  __pyx_type_10pysamstats_3opt_BaseqExt.tp_base = __pyx_ptype_10pysamstats_3opt_PileupStat;
  if (PyType_Ready(&__pyx_type_10pysamstats_3opt_BaseqExt) < 0) __PYX_ERR(0, 1292, __pyx_L1_error)
  __pyx_type_10pysamstats_3opt_BaseqExt.tp_print = 0;
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_10pysamstats_3opt_BaseqExt.tp_dictoffset && __pyx_type_10pysamstats_3opt_BaseqExt.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_10pysamstats_3opt_BaseqExt.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_10pysamstats_3opt_BaseqExt.tp_dict, __pyx_vtabptr_10pysamstats_3opt_BaseqExt) < 0) __PYX_ERR(0, 1292, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_BaseqExt, (PyObject *)&__pyx_type_10pysamstats_3opt_BaseqExt) < 0) __PYX_ERR(0, 1292, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_10pysamstats_3opt_BaseqExt) < 0) __PYX_ERR(0, 1292, __pyx_L1_error)
  __pyx_ptype_10pysamstats_3opt_BaseqExt = &__pyx_type_10pysamstats_3opt_BaseqExt;
  __pyx_vtabptr_10pysamstats_3opt_BaseqExtStrand = &__pyx_vtable_10pysamstats_3opt_BaseqExtStrand;
  __pyx_vtable_10pysamstats_3opt_BaseqExtStrand.__pyx_base = *__pyx_vtabptr_10pysamstats_3opt_PileupStat;
  __pyx_vtable_10pysamstats_3opt_BaseqExtStrand.__pyx_base.rec = (PyObject *(*)(struct __pyx_obj_10pysamstats_3opt_PileupStat *, PyObject *, PyObject *, struct __pyx_obj_5pysam_9libcfaidx_FastaFile *, PyObject *))__pyx_f_10pysamstats_3opt_14BaseqExtStrand_rec;
  __pyx_vtable_10pysamstats_3opt_BaseqExtStrand.__pyx_base.recv = (void (*)(struct __pyx_obj_10pysamstats_3opt_PileupStat *, bam_pileup1_t *, struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn *, PyObject *))__pyx_f_10pysamstats_3opt_14BaseqExtStrand_recv;
  __pyx_type_10pysamstats_3opt_BaseqExtStrand.tp_base = __pyx_ptype_10pysamstats_3opt_PileupStat;
  if (PyType_Ready(&__pyx_type_10pysamstats_3opt_BaseqExtStrand) < 0) __PYX_ERR(0, 1367, __pyx_L1_error)
  __pyx_type_10pysamstats_3opt_BaseqExtStrand.tp_print = 0;
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_10pysamstats_3opt_BaseqExtStrand.tp_dictoffset && __pyx_type_10pysamstats_3opt_BaseqExtStrand.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_10pysamstats_3opt_BaseqExtStrand.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_10pysamstats_3opt_BaseqExtStrand.tp_dict, __pyx_vtabptr_10pysamstats_3opt_BaseqExtStrand) < 0) __PYX_ERR(0, 1367, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_BaseqExtStrand, (PyObject *)&__pyx_type_10pysamstats_3opt_BaseqExtStrand) < 0) __PYX_ERR(0, 1367, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_10pysamstats_3opt_BaseqExtStrand) < 0) __PYX_ERR(0, 1367, __pyx_L1_error)
  __pyx_ptype_10pysamstats_3opt_BaseqExtStrand = &__pyx_type_10pysamstats_3opt_BaseqExtStrand;
  __pyx_vtabptr_10pysamstats_3opt_CoverageGC = &__pyx_vtable_10pysamstats_3opt_CoverageGC;
  __pyx_vtable_10pysamstats_3opt_CoverageGC.__pyx_base = *__pyx_vtabptr_10pysamstats_3opt_PileupStat;
  __pyx_vtable_10pysamstats_3opt_CoverageGC.__pyx_base.rec = (PyObject *(*)(struct __pyx_obj_10pysamstats_3opt_PileupStat *, PyObject *, PyObject *, struct __pyx_obj_5pysam_9libcfaidx_FastaFile *, PyObject *))__pyx_f_10pysamstats_3opt_10CoverageGC_rec;
  __pyx_vtable_10pysamstats_3opt_CoverageGC.__pyx_base.recv = (void (*)(struct __pyx_obj_10pysamstats_3opt_PileupStat *, bam_pileup1_t *, struct __pyx_obj_5pysam_18libcalignedsegment_PileupColumn *, PyObject *))__pyx_f_10pysamstats_3opt_10CoverageGC_recv;
  __pyx_type_10pysamstats_3opt_CoverageGC.tp_base = __pyx_ptype_10pysamstats_3opt_PileupStat;
  if (PyType_Ready(&__pyx_type_10pysamstats_3opt_CoverageGC) < 0) __PYX_ERR(0, 1471, __pyx_L1_error)
  __pyx_type_10pysamstats_3opt_CoverageGC.tp_print = 0;
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_10pysamstats_3opt_CoverageGC.tp_dictoffset && __pyx_type_10pysamstats_3opt_CoverageGC.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_10pysamstats_3opt_CoverageGC.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_10pysamstats_3opt_CoverageGC.tp_dict, __pyx_vtabptr_10pysamstats_3opt_CoverageGC) < 0) __PYX_ERR(0, 1471, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_CoverageGC, (PyObject *)&__pyx_type_10pysamstats_3opt_CoverageGC) < 0) __PYX_ERR(0, 1471, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_10pysamstats_3opt_CoverageGC) < 0) __PYX_ERR(0, 1471, __pyx_L1_error)
  __pyx_ptype_10pysamstats_3opt_CoverageGC = &__pyx_type_10pysamstats_3opt_CoverageGC;
  __pyx_vtabptr_10pysamstats_3opt_BinnedStat = &__pyx_vtable_10pysamstats_3opt_BinnedStat;
  __pyx_vtable_10pysamstats_3opt_BinnedStat.rec = (PyObject *(*)(struct __pyx_obj_10pysamstats_3opt_BinnedStat *, PyObject *, PyObject *, PyObject *, struct __pyx_obj_5pysam_9libcfaidx_FastaFile *))__pyx_f_10pysamstats_3opt_10BinnedStat_rec;
  __pyx_vtable_10pysamstats_3opt_BinnedStat.recv = (void (*)(struct __pyx_obj_10pysamstats_3opt_BinnedStat *, bam1_t *))__pyx_f_10pysamstats_3opt_10BinnedStat_recv;
  if (PyType_Ready(&__pyx_type_10pysamstats_3opt_BinnedStat) < 0) __PYX_ERR(0, 1542, __pyx_L1_error)
  __pyx_type_10pysamstats_3opt_BinnedStat.tp_print = 0;
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_10pysamstats_3opt_BinnedStat.tp_dictoffset && __pyx_type_10pysamstats_3opt_BinnedStat.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_10pysamstats_3opt_BinnedStat.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_10pysamstats_3opt_BinnedStat.tp_dict, __pyx_vtabptr_10pysamstats_3opt_BinnedStat) < 0) __PYX_ERR(0, 1542, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_BinnedStat, (PyObject *)&__pyx_type_10pysamstats_3opt_BinnedStat) < 0) __PYX_ERR(0, 1542, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_10pysamstats_3opt_BinnedStat) < 0) __PYX_ERR(0, 1542, __pyx_L1_error)
  __pyx_ptype_10pysamstats_3opt_BinnedStat = &__pyx_type_10pysamstats_3opt_BinnedStat;
  __pyx_vtabptr_10pysamstats_3opt_CoverageBinned = &__pyx_vtable_10pysamstats_3opt_CoverageBinned;
  __pyx_vtable_10pysamstats_3opt_CoverageBinned.__pyx_base = *__pyx_vtabptr_10pysamstats_3opt_BinnedStat;
  __pyx_vtable_10pysamstats_3opt_CoverageBinned.__pyx_base.rec = (PyObject *(*)(struct __pyx_obj_10pysamstats_3opt_BinnedStat *, PyObject *, PyObject *, PyObject *, struct __pyx_obj_5pysam_9libcfaidx_FastaFile *))__pyx_f_10pysamstats_3opt_14CoverageBinned_rec;
  __pyx_vtable_10pysamstats_3opt_CoverageBinned.__pyx_base.recv = (void (*)(struct __pyx_obj_10pysamstats_3opt_BinnedStat *, bam1_t *))__pyx_f_10pysamstats_3opt_14CoverageBinned_recv;
  __pyx_type_10pysamstats_3opt_CoverageBinned.tp_base = __pyx_ptype_10pysamstats_3opt_BinnedStat;
  if (PyType_Ready(&__pyx_type_10pysamstats_3opt_CoverageBinned) < 0) __PYX_ERR(0, 1551, __pyx_L1_error)
  __pyx_type_10pysamstats_3opt_CoverageBinned.tp_print = 0;
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_10pysamstats_3opt_CoverageBinned.tp_dictoffset && __pyx_type_10pysamstats_3opt_CoverageBinned.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_10pysamstats_3opt_CoverageBinned.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_10pysamstats_3opt_CoverageBinned.tp_dict, __pyx_vtabptr_10pysamstats_3opt_CoverageBinned) < 0) __PYX_ERR(0, 1551, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_CoverageBinned, (PyObject *)&__pyx_type_10pysamstats_3opt_CoverageBinned) < 0) __PYX_ERR(0, 1551, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_10pysamstats_3opt_CoverageBinned) < 0) __PYX_ERR(0, 1551, __pyx_L1_error)
  __pyx_ptype_10pysamstats_3opt_CoverageBinned = &__pyx_type_10pysamstats_3opt_CoverageBinned;
  __pyx_vtabptr_10pysamstats_3opt_CoverageExtBinned = &__pyx_vtable_10pysamstats_3opt_CoverageExtBinned;
  __pyx_vtable_10pysamstats_3opt_CoverageExtBinned.__pyx_base = *__pyx_vtabptr_10pysamstats_3opt_BinnedStat;
  __pyx_vtable_10pysamstats_3opt_CoverageExtBinned.__pyx_base.rec = (PyObject *(*)(struct __pyx_obj_10pysamstats_3opt_BinnedStat *, PyObject *, PyObject *, PyObject *, struct __pyx_obj_5pysam_9libcfaidx_FastaFile *))__pyx_f_10pysamstats_3opt_17CoverageExtBinned_rec;
  __pyx_vtable_10pysamstats_3opt_CoverageExtBinned.__pyx_base.recv = (void (*)(struct __pyx_obj_10pysamstats_3opt_BinnedStat *, bam1_t *))__pyx_f_10pysamstats_3opt_17CoverageExtBinned_recv;
  __pyx_type_10pysamstats_3opt_CoverageExtBinned.tp_base = __pyx_ptype_10pysamstats_3opt_BinnedStat;
  if (PyType_Ready(&__pyx_type_10pysamstats_3opt_CoverageExtBinned) < 0) __PYX_ERR(0, 1592, __pyx_L1_error)
  __pyx_type_10pysamstats_3opt_CoverageExtBinned.tp_print = 0;
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_10pysamstats_3opt_CoverageExtBinned.tp_dictoffset && __pyx_type_10pysamstats_3opt_CoverageExtBinned.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_10pysamstats_3opt_CoverageExtBinned.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_10pysamstats_3opt_CoverageExtBinned.tp_dict, __pyx_vtabptr_10pysamstats_3opt_CoverageExtBinned) < 0) __PYX_ERR(0, 1592, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_CoverageExtBinned, (PyObject *)&__pyx_type_10pysamstats_3opt_CoverageExtBinned) < 0) __PYX_ERR(0, 1592, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_10pysamstats_3opt_CoverageExtBinned) < 0) __PYX_ERR(0, 1592, __pyx_L1_error)
  __pyx_ptype_10pysamstats_3opt_CoverageExtBinned = &__pyx_type_10pysamstats_3opt_CoverageExtBinned;
  __pyx_vtabptr_10pysamstats_3opt_MapqBinned = &__pyx_vtable_10pysamstats_3opt_MapqBinned;
  __pyx_vtable_10pysamstats_3opt_MapqBinned.__pyx_base = *__pyx_vtabptr_10pysamstats_3opt_BinnedStat;
  __pyx_vtable_10pysamstats_3opt_MapqBinned.__pyx_base.rec = (PyObject *(*)(struct __pyx_obj_10pysamstats_3opt_BinnedStat *, PyObject *, PyObject *, PyObject *, struct __pyx_obj_5pysam_9libcfaidx_FastaFile *))__pyx_f_10pysamstats_3opt_10MapqBinned_rec;
  __pyx_vtable_10pysamstats_3opt_MapqBinned.__pyx_base.recv = (void (*)(struct __pyx_obj_10pysamstats_3opt_BinnedStat *, bam1_t *))__pyx_f_10pysamstats_3opt_10MapqBinned_recv;
  __pyx_type_10pysamstats_3opt_MapqBinned.tp_base = __pyx_ptype_10pysamstats_3opt_BinnedStat;
  if (PyType_Ready(&__pyx_type_10pysamstats_3opt_MapqBinned) < 0) __PYX_ERR(0, 1670, __pyx_L1_error)
  __pyx_type_10pysamstats_3opt_MapqBinned.tp_print = 0;
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_10pysamstats_3opt_MapqBinned.tp_dictoffset && __pyx_type_10pysamstats_3opt_MapqBinned.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_10pysamstats_3opt_MapqBinned.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_10pysamstats_3opt_MapqBinned.tp_dict, __pyx_vtabptr_10pysamstats_3opt_MapqBinned) < 0) __PYX_ERR(0, 1670, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_MapqBinned, (PyObject *)&__pyx_type_10pysamstats_3opt_MapqBinned) < 0) __PYX_ERR(0, 1670, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_10pysamstats_3opt_MapqBinned) < 0) __PYX_ERR(0, 1670, __pyx_L1_error)
  __pyx_ptype_10pysamstats_3opt_MapqBinned = &__pyx_type_10pysamstats_3opt_MapqBinned;
  __pyx_vtabptr_10pysamstats_3opt_AlignmentBinned = &__pyx_vtable_10pysamstats_3opt_AlignmentBinned;
  __pyx_vtable_10pysamstats_3opt_AlignmentBinned.__pyx_base = *__pyx_vtabptr_10pysamstats_3opt_BinnedStat;
  __pyx_vtable_10pysamstats_3opt_AlignmentBinned.__pyx_base.rec = (PyObject *(*)(struct __pyx_obj_10pysamstats_3opt_BinnedStat *, PyObject *, PyObject *, PyObject *, struct __pyx_obj_5pysam_9libcfaidx_FastaFile *))__pyx_f_10pysamstats_3opt_15AlignmentBinned_rec;
  __pyx_vtable_10pysamstats_3opt_AlignmentBinned.__pyx_base.recv = (void (*)(struct __pyx_obj_10pysamstats_3opt_BinnedStat *, bam1_t *))__pyx_f_10pysamstats_3opt_15AlignmentBinned_recv;
  __pyx_type_10pysamstats_3opt_AlignmentBinned.tp_base = __pyx_ptype_10pysamstats_3opt_BinnedStat;
  if (PyType_Ready(&__pyx_type_10pysamstats_3opt_AlignmentBinned) < 0) __PYX_ERR(0, 1711, __pyx_L1_error)
  __pyx_type_10pysamstats_3opt_AlignmentBinned.tp_print = 0;
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_10pysamstats_3opt_AlignmentBinned.tp_dictoffset && __pyx_type_10pysamstats_3opt_AlignmentBinned.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_10pysamstats_3opt_AlignmentBinned.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_10pysamstats_3opt_AlignmentBinned.tp_dict, __pyx_vtabptr_10pysamstats_3opt_AlignmentBinned) < 0) __PYX_ERR(0, 1711, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_AlignmentBinned, (PyObject *)&__pyx_type_10pysamstats_3opt_AlignmentBinned) < 0) __PYX_ERR(0, 1711, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_10pysamstats_3opt_AlignmentBinned) < 0) __PYX_ERR(0, 1711, __pyx_L1_error)
  __pyx_ptype_10pysamstats_3opt_AlignmentBinned = &__pyx_type_10pysamstats_3opt_AlignmentBinned;
  __pyx_vtabptr_10pysamstats_3opt_TlenBinned = &__pyx_vtable_10pysamstats_3opt_TlenBinned;
  __pyx_vtable_10pysamstats_3opt_TlenBinned.__pyx_base = *__pyx_vtabptr_10pysamstats_3opt_BinnedStat;
  __pyx_vtable_10pysamstats_3opt_TlenBinned.__pyx_base.rec = (PyObject *(*)(struct __pyx_obj_10pysamstats_3opt_BinnedStat *, PyObject *, PyObject *, PyObject *, struct __pyx_obj_5pysam_9libcfaidx_FastaFile *))__pyx_f_10pysamstats_3opt_10TlenBinned_rec;
  __pyx_vtable_10pysamstats_3opt_TlenBinned.__pyx_base.recv = (void (*)(struct __pyx_obj_10pysamstats_3opt_BinnedStat *, bam1_t *))__pyx_f_10pysamstats_3opt_10TlenBinned_recv;
  __pyx_type_10pysamstats_3opt_TlenBinned.tp_base = __pyx_ptype_10pysamstats_3opt_BinnedStat;
  if (PyType_Ready(&__pyx_type_10pysamstats_3opt_TlenBinned) < 0) __PYX_ERR(0, 1772, __pyx_L1_error)
  __pyx_type_10pysamstats_3opt_TlenBinned.tp_print = 0;
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_10pysamstats_3opt_TlenBinned.tp_dictoffset && __pyx_type_10pysamstats_3opt_TlenBinned.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_10pysamstats_3opt_TlenBinned.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_10pysamstats_3opt_TlenBinned.tp_dict, __pyx_vtabptr_10pysamstats_3opt_TlenBinned) < 0) __PYX_ERR(0, 1772, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_TlenBinned, (PyObject *)&__pyx_type_10pysamstats_3opt_TlenBinned) < 0) __PYX_ERR(0, 1772, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_10pysamstats_3opt_TlenBinned) < 0) __PYX_ERR(0, 1772, __pyx_L1_error)
  __pyx_ptype_10pysamstats_3opt_TlenBinned = &__pyx_type_10pysamstats_3opt_TlenBinned;
  if (PyType_Ready(&__pyx_type_10pysamstats_3opt___pyx_scope_struct__iter_pileup_default) < 0) __PYX_ERR(0, 1846, __pyx_L1_error)
  __pyx_type_10pysamstats_3opt___pyx_scope_struct__iter_pileup_default.tp_print = 0;
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_10pysamstats_3opt___pyx_scope_struct__iter_pileup_default.tp_dictoffset && __pyx_type_10pysamstats_3opt___pyx_scope_struct__iter_pileup_default.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_10pysamstats_3opt___pyx_scope_struct__iter_pileup_default.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_10pysamstats_3opt___pyx_scope_struct__iter_pileup_default = &__pyx_type_10pysamstats_3opt___pyx_scope_struct__iter_pileup_default;
  if (PyType_Ready(&__pyx_type_10pysamstats_3opt___pyx_scope_struct_1_iter_pileup_padded_chrom) < 0) __PYX_ERR(0, 1936, __pyx_L1_error)
  __pyx_type_10pysamstats_3opt___pyx_scope_struct_1_iter_pileup_padded_chrom.tp_print = 0;
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_10pysamstats_3opt___pyx_scope_struct_1_iter_pileup_padded_chrom.tp_dictoffset && __pyx_type_10pysamstats_3opt___pyx_scope_struct_1_iter_pileup_padded_chrom.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_10pysamstats_3opt___pyx_scope_struct_1_iter_pileup_padded_chrom.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_10pysamstats_3opt___pyx_scope_struct_1_iter_pileup_padded_chrom = &__pyx_type_10pysamstats_3opt___pyx_scope_struct_1_iter_pileup_padded_chrom;
  if (PyType_Ready(&__pyx_type_10pysamstats_3opt___pyx_scope_struct_2_iter_binned_chrom) < 0) __PYX_ERR(0, 2026, __pyx_L1_error)
  __pyx_type_10pysamstats_3opt___pyx_scope_struct_2_iter_binned_chrom.tp_print = 0;
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_10pysamstats_3opt___pyx_scope_struct_2_iter_binned_chrom.tp_dictoffset && __pyx_type_10pysamstats_3opt___pyx_scope_struct_2_iter_binned_chrom.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_10pysamstats_3opt___pyx_scope_struct_2_iter_binned_chrom.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_10pysamstats_3opt___pyx_scope_struct_2_iter_binned_chrom = &__pyx_type_10pysamstats_3opt___pyx_scope_struct_2_iter_binned_chrom;
  __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;
  __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(3, 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(3, 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(4, 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(4, 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(5, 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(5, 15, __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(6, 2590, __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(6, 2590, __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(6, 2590, __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(2, 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(2, 58, __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(7, 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(7, 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(7, 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(7, 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(7, 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(7, 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(7, 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(7, 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(7, 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(7, 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(7, 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(7, 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(7, 78, __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(8, 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(8, 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(8, 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(8, 66, __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(8, 76, __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(9, 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(9, 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(9, 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(9, 44, __pyx_L1_error)
  __pyx_ptype_5pysam_17libcalignmentfile_PileupColumn = __Pyx_ImportType(__pyx_t_1, "pysam.libcalignmentfile", "PileupColumn", sizeof(struct __pyx_obj_5pysam_17libcalignmentfile_PileupColumn), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5pysam_17libcalignmentfile_PileupColumn) __PYX_ERR(9, 61, __pyx_L1_error)
  __pyx_ptype_5pysam_17libcalignmentfile_PileupRead = __Pyx_ImportType(__pyx_t_1, "pysam.libcalignmentfile", "PileupRead", sizeof(struct __pyx_obj_5pysam_17libcalignmentfile_PileupRead), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5pysam_17libcalignmentfile_PileupRead) __PYX_ERR(9, 68, __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(9, 79, __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(9, 89, __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(9, 89, __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(9, 95, __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(9, 95, __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(9, 102, __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(9, 102, __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(9, 107, __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(9, 112, __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(9, 112, __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(9, 119, __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(9, 119, __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(9, 150, __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(9, 150, __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(9, 156, __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(9, 156, __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(9, 160, __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
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
  /*--- Function import code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}


#if PY_MAJOR_VERSION < 3
#ifdef CYTHON_NO_PYINIT_EXPORT
#define __Pyx_PyMODINIT_FUNC void
#else
#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
#endif
#else
#ifdef CYTHON_NO_PYINIT_EXPORT
#define __Pyx_PyMODINIT_FUNC PyObject *
#else
#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
#endif
#endif


#if PY_MAJOR_VERSION < 3
__Pyx_PyMODINIT_FUNC initopt(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC initopt(void)
#else
__Pyx_PyMODINIT_FUNC PyInit_opt(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC PyInit_opt(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_opt(PyObject *__pyx_pyinit_module)
#endif
#endif
{
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannyDeclarations
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  if (__pyx_m) {
    if (__pyx_m == __pyx_pyinit_module) return 0;
    PyErr_SetString(PyExc_RuntimeError, "Module 'opt' 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_opt(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(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  #ifdef WITH_THREAD /* Python build with threading support? */
  PyEval_InitThreads();
  #endif
  #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("opt", __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)
  __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
  #if CYTHON_COMPILING_IN_PYPY
  Py_INCREF(__pyx_b);
  #endif
  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_pysamstats__opt) {
    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, "pysamstats.opt")) {
      if (unlikely(PyDict_SetItemString(modules, "pysamstats.opt", __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();
  (void)__Pyx_modinit_function_export_code();
  if (unlikely(__Pyx_modinit_type_init_code() != 0)) goto __pyx_L1_error;
  if (unlikely(__Pyx_modinit_type_import_code() != 0)) goto __pyx_L1_error;
  (void)__Pyx_modinit_variable_import_code();
  (void)__Pyx_modinit_function_import_code();
  /*--- Execution code ---*/
  #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
  if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif

  /* "pysamstats/opt.pyx":8
 * from libc.stdint cimport uint32_t, uint8_t, uint64_t, int64_t
 * from libc.math cimport sqrt
 * from numpy import around as round             # <<<<<<<<<<<<<<
 * from cpython cimport PyBytes_FromStringAndSize
 * from pysam.libchtslib cimport bam1_t, bam_pileup1_t
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_around);
  __Pyx_GIVEREF(__pyx_n_s_around);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_around);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_numpy, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 8, __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_around); 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_round, __pyx_t_1) < 0) __PYX_ERR(0, 8, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":17
 * 
 * 
 * import sys as _sys             # <<<<<<<<<<<<<<
 * import itertools
 * 
 */
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_sys, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys_2, __pyx_t_2) < 0) __PYX_ERR(0, 17, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":18
 * 
 * import sys as _sys
 * import itertools             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_itertools, 0, 0); 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_itertools, __pyx_t_2) < 0) __PYX_ERR(0, 18, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysamstats/opt.pyx":22
 * 
 * # PY2/3 compatibility
 * PY2 = _sys.version_info[0] == 2             # <<<<<<<<<<<<<<
 * if PY2:
 *     # noinspection PyUnresolvedReferences
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_sys_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_version_info); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 22, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_t_2, __pyx_int_2, 2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 22, __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_PY2, __pyx_t_1) < 0) __PYX_ERR(0, 22, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":23
 * # PY2/3 compatibility
 * PY2 = _sys.version_info[0] == 2
 * if PY2:             # <<<<<<<<<<<<<<
 *     # noinspection PyUnresolvedReferences
 *     _string_types = basestring,
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_PY2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 23, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_3) {

    /* "pysamstats/opt.pyx":25
 * if PY2:
 *     # noinspection PyUnresolvedReferences
 *     _string_types = basestring,             # <<<<<<<<<<<<<<
 * else:
 *     _string_types = str,
 */
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)(&PyBaseString_Type)));
    __Pyx_GIVEREF(((PyObject *)(&PyBaseString_Type)));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)(&PyBaseString_Type)));
    if (PyDict_SetItem(__pyx_d, __pyx_n_s_string_types, __pyx_t_1) < 0) __PYX_ERR(0, 25, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pysamstats/opt.pyx":23
 * # PY2/3 compatibility
 * PY2 = _sys.version_info[0] == 2
 * if PY2:             # <<<<<<<<<<<<<<
 *     # noinspection PyUnresolvedReferences
 *     _string_types = basestring,
 */
    goto __pyx_L2;
  }

  /* "pysamstats/opt.pyx":27
 *     _string_types = basestring,
 * else:
 *     _string_types = str,             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*else*/ {
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 27, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)(&PyString_Type)));
    __Pyx_GIVEREF(((PyObject *)(&PyString_Type)));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)(&PyString_Type)));
    if (PyDict_SetItem(__pyx_d, __pyx_n_s_string_types, __pyx_t_1) < 0) __PYX_ERR(0, 27, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __pyx_L2:;

  /* "pysamstats/opt.pyx":70
 * DEF BAM_CDIFF      = 8
 * 
 * cdef char* CODE2CIGAR= "MIDNSHP=X"             # <<<<<<<<<<<<<<
 * 
 * cdef char* bam_nt16_rev_table = "=ACMGRSVTWYHKDBN"
 */
  __pyx_v_10pysamstats_3opt_CODE2CIGAR = ((char *)"MIDNSHP=X");

  /* "pysamstats/opt.pyx":72
 * cdef char* CODE2CIGAR= "MIDNSHP=X"
 * 
 * cdef char* bam_nt16_rev_table = "=ACMGRSVTWYHKDBN"             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_v_10pysamstats_3opt_bam_nt16_rev_table = ((char *)"=ACMGRSVTWYHKDBN");

  /* "pysamstats/opt.pyx":1827
 * 
 * 
 * def iter_pileup(stat, alignmentfile, fafile, pad, **kwargs):             # <<<<<<<<<<<<<<
 *     """General purpose function to generate statistics, where one record is
 *     generated for each genome position in the selected range, based on a
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10pysamstats_3opt_1iter_pileup, NULL, __pyx_n_s_pysamstats_opt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1827, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_iter_pileup, __pyx_t_1) < 0) __PYX_ERR(0, 1827, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1846
 * 
 * 
 * def iter_pileup_default(stat, alignmentfile, fafile, chrom, start, end, one_based, truncate, stepper,             # <<<<<<<<<<<<<<
 *                         max_depth, int min_mapq, int min_baseq, bint no_del, bint no_dup):
 *     cdef:
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10pysamstats_3opt_3iter_pileup_default, NULL, __pyx_n_s_pysamstats_opt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1846, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_iter_pileup_default, __pyx_t_1) < 0) __PYX_ERR(0, 1846, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1866
 * 
 * 
 * def stat_pileup(PileupStat stat,             # <<<<<<<<<<<<<<
 *                 PileupColumn col,
 *                 AlignmentFile alignmentfile,
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10pysamstats_3opt_6stat_pileup, NULL, __pyx_n_s_pysamstats_opt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1866, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_stat_pileup, __pyx_t_1) < 0) __PYX_ERR(0, 1866, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1922
 * 
 * 
 * def iter_pileup_padded(stat, alignmentfile, fafile, chrom, **kwargs):             # <<<<<<<<<<<<<<
 *     if chrom is not None:
 *         it = iter_pileup_padded_chrom(stat, alignmentfile=alignmentfile, fafile=fafile,
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10pysamstats_3opt_8iter_pileup_padded, NULL, __pyx_n_s_pysamstats_opt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1922, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_iter_pileup_padded, __pyx_t_1) < 0) __PYX_ERR(0, 1922, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1936
 * 
 * 
 * def iter_pileup_padded_chrom(PileupStat stat, alignmentfile, fafile, chrom, start, end,             # <<<<<<<<<<<<<<
 *                              one_based, truncate, stepper, max_depth, min_mapq, min_baseq, no_del, no_dup):
 *     cdef:
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10pysamstats_3opt_10iter_pileup_padded_chrom, NULL, __pyx_n_s_pysamstats_opt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1936, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_iter_pileup_padded_chrom, __pyx_t_1) < 0) __PYX_ERR(0, 1936, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1987
 * 
 * 
 * def get_refbase(fafile, chrom, pos):             # <<<<<<<<<<<<<<
 *     if fafile is not None:
 *         refbase = fafile.fetch(reference=chrom, start=pos, end=pos+1).upper()
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10pysamstats_3opt_13get_refbase, NULL, __pyx_n_s_pysamstats_opt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1987, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_refbase, __pyx_t_1) < 0) __PYX_ERR(0, 1987, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1997
 * 
 * 
 * def iter_binned(stat, alignmentfile, fafile, chrom, window_size=300, window_offset=None,             # <<<<<<<<<<<<<<
 *                 **kwargs):
 * 
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10pysamstats_3opt_15iter_binned, NULL, __pyx_n_s_pysamstats_opt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1997, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_iter_binned, __pyx_t_1) < 0) __PYX_ERR(0, 1997, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":2026
 * 
 * 
 * def iter_binned_chrom(BinnedStat stat, AlignmentFile alignmentfile, FastaFile fafile,             # <<<<<<<<<<<<<<
 *                       chrom, start, end, one_based, int window_size, int window_offset,
 *                       int min_mapq, int no_dup):
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10pysamstats_3opt_17iter_binned_chrom, NULL, __pyx_n_s_pysamstats_opt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2026, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_iter_binned_chrom, __pyx_t_1) < 0) __PYX_ERR(0, 2026, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":2105
 * 
 * 
 * def normalise_coords(AlignmentFile alignmentfile, chrom, start, end, one_based):             # <<<<<<<<<<<<<<
 *     """Convert to zero-based coordinates and deal with unspecified start
 *     and/or end.
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10pysamstats_3opt_20normalise_coords, NULL, __pyx_n_s_pysamstats_opt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2105, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_normalise_coords, __pyx_t_1) < 0) __PYX_ERR(0, 2105, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":2159
 * 
 * 
 * def rootmean(uint64_t sqsum, int count):             # <<<<<<<<<<<<<<
 *     if count > 0:
 *         return int(round(sqrt(sqsum / count)))
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10pysamstats_3opt_22rootmean, NULL, __pyx_n_s_pysamstats_opt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2159, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_rootmean, __pyx_t_1) < 0) __PYX_ERR(0, 2159, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":2166
 * 
 * 
 * def mean(int64_t total, int count):             # <<<<<<<<<<<<<<
 *     if count > 0:
 *         return int(round(total / count))
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10pysamstats_3opt_24mean, NULL, __pyx_n_s_pysamstats_opt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2166, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_mean, __pyx_t_1) < 0) __PYX_ERR(0, 2166, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":2176
 * 
 * 
 * def count_reads(AlignmentFile alignmentfile, chrom=None, start=None, end=None):             # <<<<<<<<<<<<<<
 *     cdef IteratorRowRegion it
 *     cdef int n = 0
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10pysamstats_3opt_26count_reads, NULL, __pyx_n_s_pysamstats_opt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2176, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_count_reads, __pyx_t_1) < 0) __PYX_ERR(0, 2176, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_PileupStat(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10pysamstats_3opt_28__pyx_unpickle_PileupStat, NULL, __pyx_n_s_pysamstats_opt); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_PileupStat, __pyx_t_1) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":11
 *         __pyx_unpickle_PileupStat__set_state(<PileupStat> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_PileupStat__set_state(PileupStat __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10pysamstats_3opt_30__pyx_unpickle_CountPp, NULL, __pyx_n_s_pysamstats_opt); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_CountPp, __pyx_t_1) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_Coverage(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10pysamstats_3opt_32__pyx_unpickle_Coverage, NULL, __pyx_n_s_pysamstats_opt); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Coverage, __pyx_t_1) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":11
 *         __pyx_unpickle_Coverage__set_state(<Coverage> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_Coverage__set_state(Coverage __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.reads = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10pysamstats_3opt_34__pyx_unpickle_CountPpStrand, NULL, __pyx_n_s_pysamstats_opt); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_CountPpStrand, __pyx_t_1) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_CoverageStrand(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10pysamstats_3opt_36__pyx_unpickle_CoverageStrand, NULL, __pyx_n_s_pysamstats_opt); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_CoverageStrand, __pyx_t_1) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":11
 *         __pyx_unpickle_CoverageStrand__set_state(<CoverageStrand> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_CoverageStrand__set_state(CoverageStrand __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.reads = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10pysamstats_3opt_38__pyx_unpickle_CoverageExt, NULL, __pyx_n_s_pysamstats_opt); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_CoverageExt, __pyx_t_1) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_CountStrand(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10pysamstats_3opt_40__pyx_unpickle_CountStrand, NULL, __pyx_n_s_pysamstats_opt); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_CountStrand, __pyx_t_1) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":11
 *         __pyx_unpickle_CountStrand__set_state(<CountStrand> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_CountStrand__set_state(CountStrand __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.fwd = __pyx_state[1]; __pyx_result.rev = __pyx_state[2]
 *     if len(__pyx_state) > 3 and hasattr(__pyx_result, '__dict__'):
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10pysamstats_3opt_42__pyx_unpickle_CoverageExtStrand, NULL, __pyx_n_s_pysamstats_opt); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_CoverageExtStrand, __pyx_t_1) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_Variation(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10pysamstats_3opt_44__pyx_unpickle_Variation, NULL, __pyx_n_s_pysamstats_opt); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Variation, __pyx_t_1) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":11
 *         __pyx_unpickle_Variation__set_state(<Variation> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_Variation__set_state(Variation __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.A = __pyx_state[0]; __pyx_result.C = __pyx_state[1]; __pyx_result.G = __pyx_state[2]; __pyx_result.N = __pyx_state[3]; __pyx_result.T = __pyx_state[4]; __pyx_result.deletions = __pyx_state[5]; __pyx_result.insertions = __pyx_state[6]; __pyx_result.matches = __pyx_state[7]; __pyx_result.mismatches = __pyx_state[8]; __pyx_result.reads = __pyx_state[9]
 *     if len(__pyx_state) > 10 and hasattr(__pyx_result, '__dict__'):
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10pysamstats_3opt_46__pyx_unpickle_VariationStrand, NULL, __pyx_n_s_pysamstats_opt); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_VariationStrand, __pyx_t_1) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_TlenHelper(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10pysamstats_3opt_48__pyx_unpickle_TlenHelper, NULL, __pyx_n_s_pysamstats_opt); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_TlenHelper, __pyx_t_1) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":11
 *         __pyx_unpickle_TlenHelper__set_state(<TlenHelper> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_TlenHelper__set_state(TlenHelper __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.d = __pyx_state[0]; __pyx_result.d2 = __pyx_state[1]; __pyx_result.m = __pyx_state[2]; __pyx_result.m2 = __pyx_state[3]; __pyx_result.n = __pyx_state[4]; __pyx_result.s = __pyx_state[5]; __pyx_result.sq = __pyx_state[6]
 *     if len(__pyx_state) > 7 and hasattr(__pyx_result, '__dict__'):
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10pysamstats_3opt_50__pyx_unpickle_Tlen, NULL, __pyx_n_s_pysamstats_opt); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Tlen, __pyx_t_1) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_TlenStrand(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10pysamstats_3opt_52__pyx_unpickle_TlenStrand, NULL, __pyx_n_s_pysamstats_opt); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_TlenStrand, __pyx_t_1) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":11
 *         __pyx_unpickle_TlenStrand__set_state(<TlenStrand> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_TlenStrand__set_state(TlenStrand __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.reads_all = __pyx_state[0]; __pyx_result.reads_fwd = __pyx_state[1]; __pyx_result.reads_rev = __pyx_state[2]; __pyx_result.tlen = __pyx_state[3]; __pyx_result.tlen_fwd = __pyx_state[4]; __pyx_result.tlen_pp = __pyx_state[5]; __pyx_result.tlen_pp_fwd = __pyx_state[6]; __pyx_result.tlen_pp_rev = __pyx_state[7]; __pyx_result.tlen_rev = __pyx_state[8]
 *     if len(__pyx_state) > 9 and hasattr(__pyx_result, '__dict__'):
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10pysamstats_3opt_54__pyx_unpickle_MapqHelper, NULL, __pyx_n_s_pysamstats_opt); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_MapqHelper, __pyx_t_1) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_Mapq(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10pysamstats_3opt_56__pyx_unpickle_Mapq, NULL, __pyx_n_s_pysamstats_opt); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Mapq, __pyx_t_1) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":11
 *         __pyx_unpickle_Mapq__set_state(<Mapq> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_Mapq__set_state(Mapq __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.pp = __pyx_state[1]
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10pysamstats_3opt_58__pyx_unpickle_MapqStrand, NULL, __pyx_n_s_pysamstats_opt); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_MapqStrand, __pyx_t_1) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_BaseqHelper(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10pysamstats_3opt_60__pyx_unpickle_BaseqHelper, NULL, __pyx_n_s_pysamstats_opt); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_BaseqHelper, __pyx_t_1) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":11
 *         __pyx_unpickle_BaseqHelper__set_state(<BaseqHelper> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_BaseqHelper__set_state(BaseqHelper __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.n = __pyx_state[0]; __pyx_result.n_nodel = __pyx_state[1]; __pyx_result.sqsum = __pyx_state[2]
 *     if len(__pyx_state) > 3 and hasattr(__pyx_result, '__dict__'):
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10pysamstats_3opt_62__pyx_unpickle_BaseqPpHelper, NULL, __pyx_n_s_pysamstats_opt); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_BaseqPpHelper, __pyx_t_1) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_Baseq(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10pysamstats_3opt_64__pyx_unpickle_Baseq, NULL, __pyx_n_s_pysamstats_opt); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Baseq, __pyx_t_1) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":11
 *         __pyx_unpickle_Baseq__set_state(<Baseq> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_Baseq__set_state(Baseq __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.helper = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10pysamstats_3opt_66__pyx_unpickle_BaseqStrandPpHelper, NULL, __pyx_n_s_pysamstats_opt); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_BaseqStrandPpHelp, __pyx_t_1) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_BaseqStrand(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10pysamstats_3opt_68__pyx_unpickle_BaseqStrand, NULL, __pyx_n_s_pysamstats_opt); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_BaseqStrand, __pyx_t_1) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":11
 *         __pyx_unpickle_BaseqStrand__set_state(<BaseqStrand> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_BaseqStrand__set_state(BaseqStrand __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.helper = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10pysamstats_3opt_70__pyx_unpickle_BaseqExt, NULL, __pyx_n_s_pysamstats_opt); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_BaseqExt, __pyx_t_1) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_BaseqExtStrand(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10pysamstats_3opt_72__pyx_unpickle_BaseqExtStrand, NULL, __pyx_n_s_pysamstats_opt); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_BaseqExtStrand, __pyx_t_1) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":11
 *         __pyx_unpickle_BaseqExtStrand__set_state(<BaseqExtStrand> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_BaseqExtStrand__set_state(BaseqExtStrand __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.all = __pyx_state[0]; __pyx_result.matches = __pyx_state[1]; __pyx_result.mismatches = __pyx_state[2]
 *     if len(__pyx_state) > 3 and hasattr(__pyx_result, '__dict__'):
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10pysamstats_3opt_74__pyx_unpickle_CoverageGC, NULL, __pyx_n_s_pysamstats_opt); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_CoverageGC, __pyx_t_1) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_BinnedStat(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10pysamstats_3opt_76__pyx_unpickle_BinnedStat, NULL, __pyx_n_s_pysamstats_opt); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_BinnedStat, __pyx_t_1) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":11
 *         __pyx_unpickle_BinnedStat__set_state(<BinnedStat> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_BinnedStat__set_state(BinnedStat __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10pysamstats_3opt_78__pyx_unpickle_CoverageBinned, NULL, __pyx_n_s_pysamstats_opt); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_CoverageBinned, __pyx_t_1) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_CoverageExtBinned(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10pysamstats_3opt_80__pyx_unpickle_CoverageExtBinned, NULL, __pyx_n_s_pysamstats_opt); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_CoverageExtBinned, __pyx_t_1) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":11
 *         __pyx_unpickle_CoverageExtBinned__set_state(<CoverageExtBinned> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_CoverageExtBinned__set_state(CoverageExtBinned __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.reads_all = __pyx_state[0]; __pyx_result.reads_duplicate = __pyx_state[1]; __pyx_result.reads_faceaway = __pyx_state[2]; __pyx_result.reads_mate_other_chr = __pyx_state[3]; __pyx_result.reads_mate_same_strand = __pyx_state[4]; __pyx_result.reads_mate_unmapped = __pyx_state[5]; __pyx_result.reads_pp = __pyx_state[6]; __pyx_result.reads_softclipped = __pyx_state[7]
 *     if len(__pyx_state) > 8 and hasattr(__pyx_result, '__dict__'):
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10pysamstats_3opt_82__pyx_unpickle_MapqBinned, NULL, __pyx_n_s_pysamstats_opt); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_MapqBinned, __pyx_t_1) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_AlignmentBinned(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10pysamstats_3opt_84__pyx_unpickle_AlignmentBinned, NULL, __pyx_n_s_pysamstats_opt); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_AlignmentBinned, __pyx_t_1) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":11
 *         __pyx_unpickle_AlignmentBinned__set_state(<AlignmentBinned> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_AlignmentBinned__set_state(AlignmentBinned __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.D = __pyx_state[0]; __pyx_result.EQ = __pyx_state[1]; __pyx_result.H = __pyx_state[2]; __pyx_result.I = __pyx_state[3]; __pyx_result.M = __pyx_state[4]; __pyx_result.N = __pyx_state[5]; __pyx_result.P = __pyx_state[6]; __pyx_result.S = __pyx_state[7]; __pyx_result.X = __pyx_state[8]; __pyx_result.reads_all = __pyx_state[9]
 *     if len(__pyx_state) > 10 and hasattr(__pyx_result, '__dict__'):
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10pysamstats_3opt_86__pyx_unpickle_TlenBinned, NULL, __pyx_n_s_pysamstats_opt); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_TlenBinned, __pyx_t_1) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysamstats/opt.pyx":1
 * # cython: profile=False             # <<<<<<<<<<<<<<
 * # cython: embedsignature=True
 * from __future__ import print_function, division, absolute_import
 */
  __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 pysamstats.opt", __pyx_clineno, __pyx_lineno, __pyx_filename);
    }
    Py_CLEAR(__pyx_m);
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init pysamstats.opt");
  }
  __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;
}

/* PyErrExceptionMatches */
#if CYTHON_FAST_THREAD_STATE
static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
    Py_ssize_t i, n;
    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++) {
        if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
    }
    return 0;
}
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
    PyObject *exc_type = tstate->curexc_type;
    if (exc_type == err) return 1;
    if (unlikely(!exc_type)) return 0;
    if (unlikely(PyTuple_Check(err)))
        return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
    return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
}
#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

/* GetAttr */
static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
#if CYTHON_USE_TYPE_SLOTS
#if PY_MAJOR_VERSION >= 3
    if (likely(PyUnicode_Check(n)))
#else
    if (likely(PyString_Check(n)))
#endif
        return __Pyx_PyObject_GetAttrStr(o, n);
#endif
    return PyObject_GetAttr(o, n);
}

/* GetAttr3 */
static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
        return NULL;
    __Pyx_PyErr_Clear();
    Py_INCREF(d);
    return d;
}
static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
    PyObject *r = __Pyx_GetAttr(o, n);
    return (likely(r)) ? r : __Pyx_GetAttr3Default(d);
}

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

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

/* KeywordStringCheck */
static int __Pyx_CheckKeywordStrings(
    PyObject *kwdict,
    const char* function_name,
    int kw_allowed)
{
    PyObject* key = 0;
    Py_ssize_t pos = 0;
#if CYTHON_COMPILING_IN_PYPY
    if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0))
        goto invalid_keyword;
    return 1;
#else
    while (PyDict_Next(kwdict, &pos, &key, 0)) {
        #if PY_MAJOR_VERSION < 3
        if (unlikely(!PyString_Check(key)))
        #endif
            if (unlikely(!PyUnicode_Check(key)))
                goto invalid_keyword_type;
    }
    if ((!kw_allowed) && unlikely(key))
        goto invalid_keyword;
    return 1;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%.200s() keywords must be strings", function_name);
    return 0;
#endif
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
    return 0;
}

/* 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, int 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, nargs,
                               k, (int)nk,
                               d, (int)nd, kwdefs, closure);
#else
    result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
                               args, 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 = func->ob_type->tp_call;
    if (unlikely(!call))
        return PyObject_Call(func, arg, kw);
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
    result = (*call)(func, arg, kw);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

/* 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 (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
            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

/* 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_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
}

/* 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
}

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

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

/* PyIntBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_FloorDivideObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) {
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long x;
        long a = PyInt_AS_LONG(op1);
            if (unlikely(b == -1 && ((unsigned long)a) == 0-(unsigned long)a))
                return PyInt_Type.tp_as_number->nb_floor_divide(op1, op2);
            else {
                long q, r;
                q = a / b;
                r = a - q*b;
                q -= ((r != 0) & ((r ^ b) < 0));
                x = q;
            }
            return PyInt_FromLong(x);
    }
    #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_floor_divide(op1, op2);
            }
        }
                {
                    long q, r;
                    q = a / b;
                    r = a - q*b;
                    q -= ((r != 0) & ((r ^ b) < 0));
                    x = q;
                }
            return PyLong_FromLong(x);
#ifdef HAVE_LONG_LONG
        long_long:
                {
                    PY_LONG_LONG q, r;
                    q = lla / llb;
                    r = lla - q*llb;
                    q -= ((r != 0) & ((r ^ llb) < 0));
                    llx = q;
                }
            return PyLong_FromLongLong(llx);
#endif
        
        
    }
    #endif
    return (inplace ? PyNumber_InPlaceFloorDivide : PyNumber_FloorDivide)(op1, op2);
}
#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
}

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

/* PyObjectCallMethod0 */
static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) {
    PyObject *method = NULL, *result = NULL;
    int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
    if (likely(is_method)) {
        result = __Pyx_PyObject_CallOneArg(method, obj);
        Py_DECREF(method);
        return result;
    }
    if (unlikely(!method)) goto bad;
    result = __Pyx_PyObject_CallNoArg(method);
    Py_DECREF(method);
bad:
    return result;
}

/* 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");
}

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

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

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

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

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

/* dict_iter */
static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* iterable, int is_dict, PyObject* method_name,
                                                   Py_ssize_t* p_orig_length, int* p_source_is_dict) {
    is_dict = is_dict || likely(PyDict_CheckExact(iterable));
    *p_source_is_dict = is_dict;
    if (is_dict) {
#if !CYTHON_COMPILING_IN_PYPY
        *p_orig_length = PyDict_Size(iterable);
        Py_INCREF(iterable);
        return iterable;
#elif PY_MAJOR_VERSION >= 3
        static PyObject *py_items = NULL, *py_keys = NULL, *py_values = NULL;
        PyObject **pp = NULL;
        if (method_name) {
            const char *name = PyUnicode_AsUTF8(method_name);
            if (strcmp(name, "iteritems") == 0) pp = &py_items;
            else if (strcmp(name, "iterkeys") == 0) pp = &py_keys;
            else if (strcmp(name, "itervalues") == 0) pp = &py_values;
            if (pp) {
                if (!*pp) {
                    *pp = PyUnicode_FromString(name + 4);
                    if (!*pp)
                        return NULL;
                }
                method_name = *pp;
            }
        }
#endif
    }
    *p_orig_length = 0;
    if (method_name) {
        PyObject* iter;
        iterable = __Pyx_PyObject_CallMethod0(iterable, method_name);
        if (!iterable)
            return NULL;
#if !CYTHON_COMPILING_IN_PYPY
        if (PyTuple_CheckExact(iterable) || PyList_CheckExact(iterable))
            return iterable;
#endif
        iter = PyObject_GetIter(iterable);
        Py_DECREF(iterable);
        return iter;
    }
    return PyObject_GetIter(iterable);
}
static CYTHON_INLINE int __Pyx_dict_iter_next(
        PyObject* iter_obj, CYTHON_NCP_UNUSED Py_ssize_t orig_length, CYTHON_NCP_UNUSED Py_ssize_t* ppos,
        PyObject** pkey, PyObject** pvalue, PyObject** pitem, int source_is_dict) {
    PyObject* next_item;
#if !CYTHON_COMPILING_IN_PYPY
    if (source_is_dict) {
        PyObject *key, *value;
        if (unlikely(orig_length != PyDict_Size(iter_obj))) {
            PyErr_SetString(PyExc_RuntimeError, "dictionary changed size during iteration");
            return -1;
        }
        if (unlikely(!PyDict_Next(iter_obj, ppos, &key, &value))) {
            return 0;
        }
        if (pitem) {
            PyObject* tuple = PyTuple_New(2);
            if (unlikely(!tuple)) {
                return -1;
            }
            Py_INCREF(key);
            Py_INCREF(value);
            PyTuple_SET_ITEM(tuple, 0, key);
            PyTuple_SET_ITEM(tuple, 1, value);
            *pitem = tuple;
        } else {
            if (pkey) {
                Py_INCREF(key);
                *pkey = key;
            }
            if (pvalue) {
                Py_INCREF(value);
                *pvalue = value;
            }
        }
        return 1;
    } else if (PyTuple_CheckExact(iter_obj)) {
        Py_ssize_t pos = *ppos;
        if (unlikely(pos >= PyTuple_GET_SIZE(iter_obj))) return 0;
        *ppos = pos + 1;
        next_item = PyTuple_GET_ITEM(iter_obj, pos);
        Py_INCREF(next_item);
    } else if (PyList_CheckExact(iter_obj)) {
        Py_ssize_t pos = *ppos;
        if (unlikely(pos >= PyList_GET_SIZE(iter_obj))) return 0;
        *ppos = pos + 1;
        next_item = PyList_GET_ITEM(iter_obj, pos);
        Py_INCREF(next_item);
    } else
#endif
    {
        next_item = PyIter_Next(iter_obj);
        if (unlikely(!next_item)) {
            return __Pyx_IterFinish();
        }
    }
    if (pitem) {
        *pitem = next_item;
    } else if (pkey && pvalue) {
        if (__Pyx_unpack_tuple2(next_item, pkey, pvalue, source_is_dict, source_is_dict, 1))
            return -1;
    } else if (pkey) {
        *pkey = next_item;
    } else {
        *pvalue = next_item;
    }
    return 1;
}

/* MergeKeywords */
static int __Pyx_MergeKeywords(PyObject *kwdict, PyObject *source_mapping) {
    PyObject *iter, *key = NULL, *value = NULL;
    int source_is_dict, result;
    Py_ssize_t orig_length, ppos = 0;
    iter = __Pyx_dict_iterator(source_mapping, 0, __pyx_n_s_items, &orig_length, &source_is_dict);
    if (unlikely(!iter)) {
        PyObject *args;
        if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
        PyErr_Clear();
        args = PyTuple_Pack(1, source_mapping);
        if (likely(args)) {
            PyObject *fallback = PyObject_Call((PyObject*)&PyDict_Type, args, NULL);
            Py_DECREF(args);
            if (likely(fallback)) {
                iter = __Pyx_dict_iterator(fallback, 1, __pyx_n_s_items, &orig_length, &source_is_dict);
                Py_DECREF(fallback);
            }
        }
        if (unlikely(!iter)) goto bad;
    }
    while (1) {
        result = __Pyx_dict_iter_next(iter, orig_length, &ppos, &key, &value, NULL, source_is_dict);
        if (unlikely(result < 0)) goto bad;
        if (!result) break;
        if (unlikely(PyDict_Contains(kwdict, key))) {
            __Pyx_RaiseDoubleKeywordsError("function", key);
            result = -1;
        } else {
            result = PyDict_SetItem(kwdict, key, value);
        }
        Py_DECREF(key);
        Py_DECREF(value);
        if (unlikely(result < 0)) goto bad;
    }
    Py_XDECREF(iter);
    return 0;
bad:
    Py_XDECREF(iter);
    return -1;
}

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

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

/* PyIntBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) {
    #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

/* PyIntBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_TrueDivideObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) {
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long a = PyInt_AS_LONG(op1);
            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);
            }
        }
                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;
            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

/* PyIntBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) {
    #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

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

/* 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

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

/* None */
static CYTHON_INLINE long __Pyx_mod_long(long a, long b) {
    long r = a % b;
    r += ((r != 0) & ((r ^ b) < 0)) * b;
    return r;
}

/* 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 (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;
}

/* 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

/* HasAttr */
static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
    PyObject *r;
    if (unlikely(!__Pyx_PyBaseString_Check(n))) {
        PyErr_SetString(PyExc_TypeError,
                        "hasattr(): attribute name must be string");
        return -1;
    }
    r = __Pyx_GetAttr(o, n);
    if (unlikely(!r)) {
        PyErr_Clear();
        return 0;
    } else {
        Py_DECREF(r);
        return 1;
    }
}

/* CallNextTpTraverse */
static int __Pyx_call_next_tp_traverse(PyObject* obj, visitproc v, void *a, traverseproc current_tp_traverse) {
    PyTypeObject* type = Py_TYPE(obj);
    while (type && type->tp_traverse != current_tp_traverse)
        type = type->tp_base;
    while (type && type->tp_traverse == current_tp_traverse)
        type = type->tp_base;
    if (type && type->tp_traverse)
        return type->tp_traverse(obj, v, a);
    return 0;
}

/* CallNextTpClear */
static void __Pyx_call_next_tp_clear(PyObject* obj, inquiry current_tp_clear) {
    PyTypeObject* type = Py_TYPE(obj);
    while (type && type->tp_clear != current_tp_clear)
        type = type->tp_base;
    while (type && type->tp_clear == current_tp_clear)
        type = type->tp_base;
    if (type && type->tp_clear)
        type->tp_clear(obj);
}

/* 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

/* PyObject_GenericGetAttr */
#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
    if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
        return PyObject_GenericGetAttr(obj, attr_name);
    }
    return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
}
#endif

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

/* SetupReduce */
static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
  int ret;
  PyObject *name_attr;
  name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name);
  if (likely(name_attr)) {
      ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
  } else {
      ret = -1;
  }
  if (unlikely(ret < 0)) {
      PyErr_Clear();
      ret = 0;
  }
  Py_XDECREF(name_attr);
  return ret;
}
static int __Pyx_setup_reduce(PyObject* type_obj) {
    int ret = 0;
    PyObject *object_reduce = NULL;
    PyObject *object_reduce_ex = NULL;
    PyObject *reduce = NULL;
    PyObject *reduce_ex = NULL;
    PyObject *reduce_cython = NULL;
    PyObject *setstate = NULL;
    PyObject *setstate_cython = NULL;
#if CYTHON_USE_PYTYPE_LOOKUP
    if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto GOOD;
#else
    if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto GOOD;
#endif
#if CYTHON_USE_PYTYPE_LOOKUP
    object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto BAD;
#else
    object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto BAD;
#endif
    reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto BAD;
    if (reduce_ex == object_reduce_ex) {
#if CYTHON_USE_PYTYPE_LOOKUP
        object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto BAD;
#else
        object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto BAD;
#endif
        reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto BAD;
        if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
            reduce_cython = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_cython); if (unlikely(!reduce_cython)) goto BAD;
            ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto BAD;
            ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto BAD;
            setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
            if (!setstate) PyErr_Clear();
            if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
                setstate_cython = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate_cython); if (unlikely(!setstate_cython)) goto BAD;
                ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto BAD;
                ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto BAD;
            }
            PyType_Modified((PyTypeObject*)type_obj);
        }
    }
    goto GOOD;
BAD:
    if (!PyErr_Occurred())
        PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
    ret = -1;
GOOD:
#if !CYTHON_USE_PYTYPE_LOOKUP
    Py_XDECREF(object_reduce);
    Py_XDECREF(object_reduce_ex);
#endif
    Py_XDECREF(reduce);
    Py_XDECREF(reduce_ex);
    Py_XDECREF(reduce_cython);
    Py_XDECREF(setstate);
    Py_XDECREF(setstate_cython);
    return ret;
}

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

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

/* CLineInTraceback */
#ifndef CYTHON_CLINE_IN_TRACEBACK
static int __Pyx_CLineForTraceback(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;
        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"
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
            const char *funcname, int c_line,
            int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    #if PY_MAJOR_VERSION < 3
    py_srcfile = PyString_FromString(filename);
    #else
    py_srcfile = PyUnicode_FromString(filename);
    #endif
    if (!py_srcfile) goto bad;
    if (c_line) {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #else
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #endif
    }
    else {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromString(funcname);
        #else
        py_funcname = PyUnicode_FromString(funcname);
        #endif
    }
    if (!py_funcname) goto bad;
    py_code = __Pyx_PyCode_New(
        0,
        0,
        0,
        0,
        0,
        __pyx_empty_bytes, /*PyObject *code,*/
        __pyx_empty_tuple, /*PyObject *consts,*/
        __pyx_empty_tuple, /*PyObject *names,*/
        __pyx_empty_tuple, /*PyObject *varnames,*/
        __pyx_empty_tuple, /*PyObject *freevars,*/
        __pyx_empty_tuple, /*PyObject *cellvars,*/
        py_srcfile,   /*PyObject *filename,*/
        py_funcname,  /*PyObject *name,*/
        py_line,
        __pyx_empty_bytes  /*PyObject *lnotab*/
    );
    Py_DECREF(py_srcfile);
    Py_DECREF(py_funcname);
    return py_code;
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
    return NULL;
}
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyFrameObject *py_frame = 0;
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    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) {
        py_code = __Pyx_CreateCodeObjectForTraceback(
            funcname, c_line, py_line, filename);
        if (!py_code) goto bad;
        __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
    }
    py_frame = PyFrame_New(
        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);
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
    const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(int) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(int) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#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);
    }
}

/* 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;\
    }

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
    const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(long) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(long) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#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_int64_t(int64_t value) {
    const int64_t neg_one = (int64_t) ((int64_t) 0 - (int64_t) 1), const_zero = (int64_t) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(int64_t) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(int64_t) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int64_t) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(int64_t) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int64_t) <= 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(int64_t),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint64_t(uint64_t value) {
    const uint64_t neg_one = (uint64_t) ((uint64_t) 0 - (uint64_t) 1), const_zero = (uint64_t) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(uint64_t) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(uint64_t) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(uint64_t) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(uint64_t) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(uint64_t) <= 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(uint64_t),
                                     little, !is_unsigned);
    }
}

/* None */
static CYTHON_INLINE int64_t __Pyx_pow_int64_t(int64_t b, int64_t e) {
    int64_t t = b;
    switch (e) {
        case 3:
            t *= b;
        CYTHON_FALLTHROUGH;
        case 2:
            t *= b;
        CYTHON_FALLTHROUGH;
        case 1:
            return t;
        case 0:
            return 1;
    }
    #if 1
    if (unlikely(e<0)) return 0;
    #endif
    t = 1;
    while (likely(e)) {
        t *= (b * (e&1)) | ((~e)&1);
        b *= b;
        e >>= 1;
    }
    return t;
}

/* None */
static CYTHON_INLINE uint64_t __Pyx_pow_uint64_t(uint64_t b, uint64_t e) {
    uint64_t t = b;
    switch (e) {
        case 3:
            t *= b;
        CYTHON_FALLTHROUGH;
        case 2:
            t *= b;
        CYTHON_FALLTHROUGH;
        case 1:
            return t;
        case 0:
            return 1;
    }
    #if 0
    if (unlikely(e<0)) return 0;
    #endif
    t = 1;
    while (likely(e)) {
        t *= (b * (e&1)) | ((~e)&1);
        b *= b;
        e >>= 1;
    }
    return t;
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint32_t(uint32_t value) {
    const uint32_t neg_one = (uint32_t) ((uint32_t) 0 - (uint32_t) 1), const_zero = (uint32_t) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(uint32_t) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(uint32_t) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(uint32_t) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(uint32_t) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(uint32_t) <= 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(uint32_t),
                                     little, !is_unsigned);
    }
}

/* CIntFromPy */
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
    const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(int) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (int) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_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;
}

/* CIntFromPy */
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
    const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(long) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (long) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_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;
}

/* CIntFromPy */
static CYTHON_INLINE int64_t __Pyx_PyInt_As_int64_t(PyObject *x) {
    const int64_t neg_one = (int64_t) ((int64_t) 0 - (int64_t) 1), const_zero = (int64_t) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(int64_t) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(int64_t, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (int64_t) 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 (int64_t) 0;
                case  1: __PYX_VERIFY_RETURN_INT(int64_t, digit, digits[0])
                case 2:
                    if (8 * sizeof(int64_t) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int64_t) >= 2 * PyLong_SHIFT) {
                            return (int64_t) (((((int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int64_t) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int64_t) >= 3 * PyLong_SHIFT) {
                            return (int64_t) (((((((int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int64_t) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int64_t, 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(int64_t) >= 4 * PyLong_SHIFT) {
                            return (int64_t) (((((((((int64_t)digits[3]) << PyLong_SHIFT) | (int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)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 (int64_t) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(int64_t) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int64_t, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int64_t) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int64_t, 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 (int64_t) 0;
                case -1: __PYX_VERIFY_RETURN_INT(int64_t, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(int64_t,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(int64_t) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int64_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int64_t) - 1 > 2 * PyLong_SHIFT) {
                            return (int64_t) (((int64_t)-1)*(((((int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(int64_t) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int64_t) - 1 > 2 * PyLong_SHIFT) {
                            return (int64_t) ((((((int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(int64_t) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int64_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int64_t) - 1 > 3 * PyLong_SHIFT) {
                            return (int64_t) (((int64_t)-1)*(((((((int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int64_t) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int64_t) - 1 > 3 * PyLong_SHIFT) {
                            return (int64_t) ((((((((int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(int64_t) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int64_t, 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(int64_t) - 1 > 4 * PyLong_SHIFT) {
                            return (int64_t) (((int64_t)-1)*(((((((((int64_t)digits[3]) << PyLong_SHIFT) | (int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int64_t) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int64_t, 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(int64_t) - 1 > 4 * PyLong_SHIFT) {
                            return (int64_t) ((((((((((int64_t)digits[3]) << PyLong_SHIFT) | (int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(int64_t) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int64_t, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int64_t) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int64_t, 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
            int64_t 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 (int64_t) -1;
        }
    } else {
        int64_t val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (int64_t) -1;
        val = __Pyx_PyInt_As_int64_t(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to int64_t");
    return (int64_t) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to int64_t");
    return (int64_t) -1;
}

/* CIntFromPy */
static CYTHON_INLINE uint64_t __Pyx_PyInt_As_uint64_t(PyObject *x) {
    const uint64_t neg_one = (uint64_t) ((uint64_t) 0 - (uint64_t) 1), const_zero = (uint64_t) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(uint64_t) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(uint64_t, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (uint64_t) 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 (uint64_t) 0;
                case  1: __PYX_VERIFY_RETURN_INT(uint64_t, digit, digits[0])
                case 2:
                    if (8 * sizeof(uint64_t) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(uint64_t) >= 2 * PyLong_SHIFT) {
                            return (uint64_t) (((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(uint64_t) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(uint64_t) >= 3 * PyLong_SHIFT) {
                            return (uint64_t) (((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(uint64_t) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(uint64_t, 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(uint64_t) >= 4 * PyLong_SHIFT) {
                            return (uint64_t) (((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)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 (uint64_t) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(uint64_t) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(uint64_t, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(uint64_t) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(uint64_t, 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 (uint64_t) 0;
                case -1: __PYX_VERIFY_RETURN_INT(uint64_t, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(uint64_t,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(uint64_t) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT) {
                            return (uint64_t) (((uint64_t)-1)*(((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(uint64_t) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT) {
                            return (uint64_t) ((((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT) {
                            return (uint64_t) (((uint64_t)-1)*(((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(uint64_t) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT) {
                            return (uint64_t) ((((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(uint64_t, 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(uint64_t) - 1 > 4 * PyLong_SHIFT) {
                            return (uint64_t) (((uint64_t)-1)*(((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(uint64_t) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(uint64_t, 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(uint64_t) - 1 > 4 * PyLong_SHIFT) {
                            return (uint64_t) ((((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(uint64_t) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(uint64_t, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(uint64_t) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(uint64_t, 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
            uint64_t 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 (uint64_t) -1;
        }
    } else {
        uint64_t val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (uint64_t) -1;
        val = __Pyx_PyInt_As_uint64_t(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to uint64_t");
    return (uint64_t) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to uint64_t");
    return (uint64_t) -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

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

/* 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

/* 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

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

/* CoroutineBase */
#include <structmember.h>
#include <frameobject.h>
#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;
            Py_XINCREF(tstate->frame);
            assert(f->f_back == NULL);
            f->f_back = tstate->frame;
        }
        #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;
}
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 = _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 = _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 = _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_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 (self->ob_refcnt > 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);
    self->ob_refcnt = 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(self->ob_refcnt > 0);
    if (--self->ob_refcnt == 0) {
        return;
    }
    {
        Py_ssize_t refcnt = self->ob_refcnt;
        _Py_NewReference(self);
        self->ob_refcnt = refcnt;
    }
#if CYTHON_COMPILING_IN_CPYTHON
    assert(PyType_IS_GC(self->ob_type) &&
           _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 __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;
    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},
    {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
};
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[4], rtversion[4];
    PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
    PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
    if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
        char message[200];
        PyOS_snprintf(message, sizeof(message),
                      "compiletime version %s of module '%.100s' "
                      "does not match runtime version %s",
                      ctversion, __Pyx_MODULE_NAME, rtversion);
        return PyErr_WarnEx(NULL, message, 1);
    }
    return 0;
}

/* 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 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 */
