/* Generated by Cython 0.28.5 */

/* BEGIN: Cython Metadata
{
    "distutils": {
        "depends": [], 
        "libraries": [
            "opengl32"
        ], 
        "name": "punyverse._glgeom", 
        "sources": [
            "punyverse/_glgeom.pyx"
        ]
    }, 
    "module_name": "punyverse._glgeom"
}
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_28_5"
#define CYTHON_FUTURE_DIVISION 0
#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
#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
#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 (0 && PY_VERSION_HEX >= 0x03050000)
  #endif
  #ifndef CYTHON_USE_TP_FINALIZE
    #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
  #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
#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
#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)))))
#else
#define __Pyx_PyFastCFunction_Check(func) 0
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
  #define PyObject_Malloc(s)   PyMem_Malloc(s)
  #define PyObject_Free(p)     PyMem_Free(p)
  #define PyObject_Realloc(p)  PyMem_Realloc(p)
#endif
#if CYTHON_COMPILING_IN_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)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
#define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyString_Format(a, b)  PyUnicode_Format(a, b)
#else
  #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
#endif
#if PY_MAJOR_VERSION < 3 && !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__punyverse___glgeom
#define __PYX_HAVE_API__punyverse___glgeom
/* Early includes */
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include "windows.h"
#include "GL/gl.h"
#include "stddef.h"
#include "GL/glu.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)))  )
#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 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));
    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[] = {
  "punyverse\\_glgeom.pyx",
};
/* NoFastGil.proto */
#define __Pyx_PyGILState_Ensure PyGILState_Ensure
#define __Pyx_PyGILState_Release PyGILState_Release
#define __Pyx_FastGIL_Remember()
#define __Pyx_FastGIL_Forget()
#define __Pyx_FastGilFuncInit()

/* ForceInitThreads.proto */
#ifndef __PYX_FORCE_INIT_THREADS
  #define __PYX_FORCE_INIT_THREADS 0
#endif


/*--- Type declarations ---*/
struct __pyx_opt_args_9punyverse_7_glgeom_torus;
struct __pyx_opt_args_9punyverse_7_glgeom_bgr_to_rgb;

/* "punyverse/_cyopengl.pxi":458
 * 
 * 
 * cdef enum:             # <<<<<<<<<<<<<<
 *     GL_FALSE =                              0x0
 *     GL_TRUE =                               0x1
 */
enum  {
  __pyx_e_9punyverse_7_glgeom_GL_FALSE = 0x0,
  __pyx_e_9punyverse_7_glgeom_GL_TRUE = 0x1,
  __pyx_e_9punyverse_7_glgeom_GL_BYTE = 0x1400,
  __pyx_e_9punyverse_7_glgeom_GL_UNSIGNED_BYTE = 0x1401,
  __pyx_e_9punyverse_7_glgeom_GL_SHORT = 0x1402,
  __pyx_e_9punyverse_7_glgeom_GL_UNSIGNED_SHORT = 0x1403,
  __pyx_e_9punyverse_7_glgeom_GL_INT = 0x1404,
  __pyx_e_9punyverse_7_glgeom_GL_UNSIGNED_INT = 0x1405,
  __pyx_e_9punyverse_7_glgeom_GL_FLOAT = 0x1406,
  __pyx_e_9punyverse_7_glgeom_GL_DOUBLE = 0x140A,
  __pyx_e_9punyverse_7_glgeom_GL_2_BYTES = 0x1407,
  __pyx_e_9punyverse_7_glgeom_GL_3_BYTES = 0x1408,
  __pyx_e_9punyverse_7_glgeom_GL_4_BYTES = 0x1409,
  __pyx_e_9punyverse_7_glgeom_GL_POINTS = 0x0000,
  __pyx_e_9punyverse_7_glgeom_GL_LINES = 0x0001,
  __pyx_e_9punyverse_7_glgeom_GL_LINE_LOOP = 0x0002,
  __pyx_e_9punyverse_7_glgeom_GL_LINE_STRIP = 0x0003,
  __pyx_e_9punyverse_7_glgeom_GL_TRIANGLES = 0x0004,
  __pyx_e_9punyverse_7_glgeom_GL_TRIANGLE_STRIP = 0x0005,
  __pyx_e_9punyverse_7_glgeom_GL_TRIANGLE_FAN = 0x0006,
  __pyx_e_9punyverse_7_glgeom_GL_QUADS = 0x0007,
  __pyx_e_9punyverse_7_glgeom_GL_QUAD_STRIP = 0x0008,
  __pyx_e_9punyverse_7_glgeom_GL_POLYGON = 0x0009,
  __pyx_e_9punyverse_7_glgeom_GL_VERTEX_ARRAY = 0x8074,
  __pyx_e_9punyverse_7_glgeom_GL_NORMAL_ARRAY = 0x8075,
  __pyx_e_9punyverse_7_glgeom_GL_COLOR_ARRAY = 0x8076,
  __pyx_e_9punyverse_7_glgeom_GL_INDEX_ARRAY = 0x8077,
  __pyx_e_9punyverse_7_glgeom_GL_TEXTURE_COORD_ARRAY = 0x8078,
  __pyx_e_9punyverse_7_glgeom_GL_EDGE_FLAG_ARRAY = 0x8079,
  __pyx_e_9punyverse_7_glgeom_GL_VERTEX_ARRAY_SIZE = 0x807A,
  __pyx_e_9punyverse_7_glgeom_GL_VERTEX_ARRAY_TYPE = 0x807B,
  __pyx_e_9punyverse_7_glgeom_GL_VERTEX_ARRAY_STRIDE = 0x807C,
  __pyx_e_9punyverse_7_glgeom_GL_NORMAL_ARRAY_TYPE = 0x807E,
  __pyx_e_9punyverse_7_glgeom_GL_NORMAL_ARRAY_STRIDE = 0x807F,
  __pyx_e_9punyverse_7_glgeom_GL_COLOR_ARRAY_SIZE = 0x8081,
  __pyx_e_9punyverse_7_glgeom_GL_COLOR_ARRAY_TYPE = 0x8082,
  __pyx_e_9punyverse_7_glgeom_GL_COLOR_ARRAY_STRIDE = 0x8083,
  __pyx_e_9punyverse_7_glgeom_GL_INDEX_ARRAY_TYPE = 0x8085,
  __pyx_e_9punyverse_7_glgeom_GL_INDEX_ARRAY_STRIDE = 0x8086,
  __pyx_e_9punyverse_7_glgeom_GL_TEXTURE_COORD_ARRAY_SIZE = 0x8088,
  __pyx_e_9punyverse_7_glgeom_GL_TEXTURE_COORD_ARRAY_TYPE = 0x8089,
  __pyx_e_9punyverse_7_glgeom_GL_TEXTURE_COORD_ARRAY_STRIDE = 0x808A,
  __pyx_e_9punyverse_7_glgeom_GL_EDGE_FLAG_ARRAY_STRIDE = 0x808C,
  __pyx_e_9punyverse_7_glgeom_GL_VERTEX_ARRAY_POINTER = 0x808E,
  __pyx_e_9punyverse_7_glgeom_GL_NORMAL_ARRAY_POINTER = 0x808F,
  __pyx_e_9punyverse_7_glgeom_GL_COLOR_ARRAY_POINTER = 0x8090,
  __pyx_e_9punyverse_7_glgeom_GL_INDEX_ARRAY_POINTER = 0x8091,
  __pyx_e_9punyverse_7_glgeom_GL_TEXTURE_COORD_ARRAY_POINTER = 0x8092,
  __pyx_e_9punyverse_7_glgeom_GL_EDGE_FLAG_ARRAY_POINTER = 0x8093,
  __pyx_e_9punyverse_7_glgeom_GL_V2F = 0x2A20,
  __pyx_e_9punyverse_7_glgeom_GL_V3F = 0x2A21,
  __pyx_e_9punyverse_7_glgeom_GL_C4UB_V2F = 0x2A22,
  __pyx_e_9punyverse_7_glgeom_GL_C4UB_V3F = 0x2A23,
  __pyx_e_9punyverse_7_glgeom_GL_C3F_V3F = 0x2A24,
  __pyx_e_9punyverse_7_glgeom_GL_N3F_V3F = 0x2A25,
  __pyx_e_9punyverse_7_glgeom_GL_C4F_N3F_V3F = 0x2A26,
  __pyx_e_9punyverse_7_glgeom_GL_T2F_V3F = 0x2A27,
  __pyx_e_9punyverse_7_glgeom_GL_T4F_V4F = 0x2A28,
  __pyx_e_9punyverse_7_glgeom_GL_T2F_C4UB_V3F = 0x2A29,
  __pyx_e_9punyverse_7_glgeom_GL_T2F_C3F_V3F = 0x2A2A,
  __pyx_e_9punyverse_7_glgeom_GL_T2F_N3F_V3F = 0x2A2B,
  __pyx_e_9punyverse_7_glgeom_GL_T2F_C4F_N3F_V3F = 0x2A2C,
  __pyx_e_9punyverse_7_glgeom_GL_T4F_C4F_N3F_V4F = 0x2A2D,
  __pyx_e_9punyverse_7_glgeom_GL_MATRIX_MODE = 0x0BA0,
  __pyx_e_9punyverse_7_glgeom_GL_MODELVIEW = 0x1700,
  __pyx_e_9punyverse_7_glgeom_GL_PROJECTION = 0x1701,
  __pyx_e_9punyverse_7_glgeom_GL_TEXTURE = 0x1702,
  __pyx_e_9punyverse_7_glgeom_GL_POINT_SMOOTH = 0x0B10,
  __pyx_e_9punyverse_7_glgeom_GL_POINT_SIZE = 0x0B11,
  __pyx_e_9punyverse_7_glgeom_GL_POINT_SIZE_GRANULARITY = 0x0B13,
  __pyx_e_9punyverse_7_glgeom_GL_POINT_SIZE_RANGE = 0x0B12,
  __pyx_e_9punyverse_7_glgeom_GL_LINE_SMOOTH = 0x0B20,
  __pyx_e_9punyverse_7_glgeom_GL_LINE_STIPPLE = 0x0B24,
  __pyx_e_9punyverse_7_glgeom_GL_LINE_STIPPLE_PATTERN = 0x0B25,
  __pyx_e_9punyverse_7_glgeom_GL_LINE_STIPPLE_REPEAT = 0x0B26,
  __pyx_e_9punyverse_7_glgeom_GL_LINE_WIDTH = 0x0B21,
  __pyx_e_9punyverse_7_glgeom_GL_LINE_WIDTH_GRANULARITY = 0x0B23,
  __pyx_e_9punyverse_7_glgeom_GL_LINE_WIDTH_RANGE = 0x0B22,
  __pyx_e_9punyverse_7_glgeom_GL_POINT = 0x1B00,
  __pyx_e_9punyverse_7_glgeom_GL_LINE = 0x1B01,
  __pyx_e_9punyverse_7_glgeom_GL_FILL = 0x1B02,
  __pyx_e_9punyverse_7_glgeom_GL_CW = 0x0900,
  __pyx_e_9punyverse_7_glgeom_GL_CCW = 0x0901,
  __pyx_e_9punyverse_7_glgeom_GL_FRONT = 0x0404,
  __pyx_e_9punyverse_7_glgeom_GL_BACK = 0x0405,
  __pyx_e_9punyverse_7_glgeom_GL_POLYGON_MODE = 0x0B40,
  __pyx_e_9punyverse_7_glgeom_GL_POLYGON_SMOOTH = 0x0B41,
  __pyx_e_9punyverse_7_glgeom_GL_POLYGON_STIPPLE = 0x0B42,
  __pyx_e_9punyverse_7_glgeom_GL_EDGE_FLAG = 0x0B43,
  __pyx_e_9punyverse_7_glgeom_GL_CULL_FACE = 0x0B44,
  __pyx_e_9punyverse_7_glgeom_GL_CULL_FACE_MODE = 0x0B45,
  __pyx_e_9punyverse_7_glgeom_GL_FRONT_FACE = 0x0B46,
  __pyx_e_9punyverse_7_glgeom_GL_POLYGON_OFFSET_FACTOR = 0x8038,
  __pyx_e_9punyverse_7_glgeom_GL_POLYGON_OFFSET_UNITS = 0x2A00,
  __pyx_e_9punyverse_7_glgeom_GL_POLYGON_OFFSET_POINT = 0x2A01,
  __pyx_e_9punyverse_7_glgeom_GL_POLYGON_OFFSET_LINE = 0x2A02,
  __pyx_e_9punyverse_7_glgeom_GL_POLYGON_OFFSET_FILL = 0x8037,
  __pyx_e_9punyverse_7_glgeom_GL_COMPILE = 0x1300,
  __pyx_e_9punyverse_7_glgeom_GL_COMPILE_AND_EXECUTE = 0x1301,
  __pyx_e_9punyverse_7_glgeom_GL_LIST_BASE = 0x0B32,
  __pyx_e_9punyverse_7_glgeom_GL_LIST_INDEX = 0x0B33,
  __pyx_e_9punyverse_7_glgeom_GL_LIST_MODE = 0x0B30,
  __pyx_e_9punyverse_7_glgeom_GL_NEVER = 0x0200,
  __pyx_e_9punyverse_7_glgeom_GL_LESS = 0x0201,
  __pyx_e_9punyverse_7_glgeom_GL_EQUAL = 0x0202,
  __pyx_e_9punyverse_7_glgeom_GL_LEQUAL = 0x0203,
  __pyx_e_9punyverse_7_glgeom_GL_GREATER = 0x0204,
  __pyx_e_9punyverse_7_glgeom_GL_NOTEQUAL = 0x0205,
  __pyx_e_9punyverse_7_glgeom_GL_GEQUAL = 0x0206,
  __pyx_e_9punyverse_7_glgeom_GL_ALWAYS = 0x0207,
  __pyx_e_9punyverse_7_glgeom_GL_DEPTH_TEST = 0x0B71,
  __pyx_e_9punyverse_7_glgeom_GL_DEPTH_BITS = 0x0D56,
  __pyx_e_9punyverse_7_glgeom_GL_DEPTH_CLEAR_VALUE = 0x0B73,
  __pyx_e_9punyverse_7_glgeom_GL_DEPTH_FUNC = 0x0B74,
  __pyx_e_9punyverse_7_glgeom_GL_DEPTH_RANGE = 0x0B70,
  __pyx_e_9punyverse_7_glgeom_GL_DEPTH_WRITEMASK = 0x0B72,
  __pyx_e_9punyverse_7_glgeom_GL_DEPTH_COMPONENT = 0x1902,
  __pyx_e_9punyverse_7_glgeom_GL_LIGHTING = 0x0B50,
  __pyx_e_9punyverse_7_glgeom_GL_LIGHT0 = 0x4000,
  __pyx_e_9punyverse_7_glgeom_GL_LIGHT1 = 0x4001,
  __pyx_e_9punyverse_7_glgeom_GL_LIGHT2 = 0x4002,
  __pyx_e_9punyverse_7_glgeom_GL_LIGHT3 = 0x4003,
  __pyx_e_9punyverse_7_glgeom_GL_LIGHT4 = 0x4004,
  __pyx_e_9punyverse_7_glgeom_GL_LIGHT5 = 0x4005,
  __pyx_e_9punyverse_7_glgeom_GL_LIGHT6 = 0x4006,
  __pyx_e_9punyverse_7_glgeom_GL_LIGHT7 = 0x4007,
  __pyx_e_9punyverse_7_glgeom_GL_SPOT_EXPONENT = 0x1205,
  __pyx_e_9punyverse_7_glgeom_GL_SPOT_CUTOFF = 0x1206,
  __pyx_e_9punyverse_7_glgeom_GL_CONSTANT_ATTENUATION = 0x1207,
  __pyx_e_9punyverse_7_glgeom_GL_LINEAR_ATTENUATION = 0x1208,
  __pyx_e_9punyverse_7_glgeom_GL_QUADRATIC_ATTENUATION = 0x1209,
  __pyx_e_9punyverse_7_glgeom_GL_AMBIENT = 0x1200,
  __pyx_e_9punyverse_7_glgeom_GL_DIFFUSE = 0x1201,
  __pyx_e_9punyverse_7_glgeom_GL_SPECULAR = 0x1202,
  __pyx_e_9punyverse_7_glgeom_GL_SHININESS = 0x1601,
  __pyx_e_9punyverse_7_glgeom_GL_EMISSION = 0x1600,
  __pyx_e_9punyverse_7_glgeom_GL_POSITION = 0x1203,
  __pyx_e_9punyverse_7_glgeom_GL_SPOT_DIRECTION = 0x1204,
  __pyx_e_9punyverse_7_glgeom_GL_AMBIENT_AND_DIFFUSE = 0x1602,
  __pyx_e_9punyverse_7_glgeom_GL_COLOR_INDEXES = 0x1603,
  __pyx_e_9punyverse_7_glgeom_GL_LIGHT_MODEL_TWO_SIDE = 0x0B52,
  __pyx_e_9punyverse_7_glgeom_GL_LIGHT_MODEL_LOCAL_VIEWER = 0x0B51,
  __pyx_e_9punyverse_7_glgeom_GL_LIGHT_MODEL_AMBIENT = 0x0B53,
  __pyx_e_9punyverse_7_glgeom_GL_FRONT_AND_BACK = 0x0408,
  __pyx_e_9punyverse_7_glgeom_GL_SHADE_MODEL = 0x0B54,
  __pyx_e_9punyverse_7_glgeom_GL_FLAT = 0x1D00,
  __pyx_e_9punyverse_7_glgeom_GL_SMOOTH = 0x1D01,
  __pyx_e_9punyverse_7_glgeom_GL_COLOR_MATERIAL = 0x0B57,
  __pyx_e_9punyverse_7_glgeom_GL_COLOR_MATERIAL_FACE = 0x0B55,
  __pyx_e_9punyverse_7_glgeom_GL_COLOR_MATERIAL_PARAMETER = 0x0B56,
  __pyx_e_9punyverse_7_glgeom_GL_NORMALIZE = 0x0BA1,
  __pyx_e_9punyverse_7_glgeom_GL_CLIP_PLANE0 = 0x3000,
  __pyx_e_9punyverse_7_glgeom_GL_CLIP_PLANE1 = 0x3001,
  __pyx_e_9punyverse_7_glgeom_GL_CLIP_PLANE2 = 0x3002,
  __pyx_e_9punyverse_7_glgeom_GL_CLIP_PLANE3 = 0x3003,
  __pyx_e_9punyverse_7_glgeom_GL_CLIP_PLANE4 = 0x3004,
  __pyx_e_9punyverse_7_glgeom_GL_CLIP_PLANE5 = 0x3005,
  __pyx_e_9punyverse_7_glgeom_GL_ACCUM_RED_BITS = 0x0D58,
  __pyx_e_9punyverse_7_glgeom_GL_ACCUM_GREEN_BITS = 0x0D59,
  __pyx_e_9punyverse_7_glgeom_GL_ACCUM_BLUE_BITS = 0x0D5A,
  __pyx_e_9punyverse_7_glgeom_GL_ACCUM_ALPHA_BITS = 0x0D5B,
  __pyx_e_9punyverse_7_glgeom_GL_ACCUM_CLEAR_VALUE = 0x0B80,
  __pyx_e_9punyverse_7_glgeom_GL_ACCUM = 0x0100,
  __pyx_e_9punyverse_7_glgeom_GL_ADD = 0x0104,
  __pyx_e_9punyverse_7_glgeom_GL_LOAD = 0x0101,
  __pyx_e_9punyverse_7_glgeom_GL_MULT = 0x0103,
  __pyx_e_9punyverse_7_glgeom_GL_RETURN = 0x0102,
  __pyx_e_9punyverse_7_glgeom_GL_ALPHA_TEST = 0x0BC0,
  __pyx_e_9punyverse_7_glgeom_GL_ALPHA_TEST_REF = 0x0BC2,
  __pyx_e_9punyverse_7_glgeom_GL_ALPHA_TEST_FUNC = 0x0BC1,
  __pyx_e_9punyverse_7_glgeom_GL_BLEND = 0x0BE2,
  __pyx_e_9punyverse_7_glgeom_GL_BLEND_SRC = 0x0BE1,
  __pyx_e_9punyverse_7_glgeom_GL_BLEND_DST = 0x0BE0,
  __pyx_e_9punyverse_7_glgeom_GL_ZERO = 0x0,
  __pyx_e_9punyverse_7_glgeom_GL_ONE = 0x1,
  __pyx_e_9punyverse_7_glgeom_GL_SRC_COLOR = 0x0300,
  __pyx_e_9punyverse_7_glgeom_GL_ONE_MINUS_SRC_COLOR = 0x0301,
  __pyx_e_9punyverse_7_glgeom_GL_SRC_ALPHA = 0x0302,
  __pyx_e_9punyverse_7_glgeom_GL_ONE_MINUS_SRC_ALPHA = 0x0303,
  __pyx_e_9punyverse_7_glgeom_GL_DST_ALPHA = 0x0304,
  __pyx_e_9punyverse_7_glgeom_GL_ONE_MINUS_DST_ALPHA = 0x0305,
  __pyx_e_9punyverse_7_glgeom_GL_DST_COLOR = 0x0306,
  __pyx_e_9punyverse_7_glgeom_GL_ONE_MINUS_DST_COLOR = 0x0307,
  __pyx_e_9punyverse_7_glgeom_GL_SRC_ALPHA_SATURATE = 0x0308,
  __pyx_e_9punyverse_7_glgeom_GL_CONSTANT_COLOR = 0x8001,
  __pyx_e_9punyverse_7_glgeom_GL_ONE_MINUS_CONSTANT_COLOR = 0x8002,
  __pyx_e_9punyverse_7_glgeom_GL_CONSTANT_ALPHA = 0x8003,
  __pyx_e_9punyverse_7_glgeom_GL_ONE_MINUS_CONSTANT_ALPHA = 0x8004,
  __pyx_e_9punyverse_7_glgeom_GL_FEEDBACK = 0x1C01,
  __pyx_e_9punyverse_7_glgeom_GL_RENDER = 0x1C00,
  __pyx_e_9punyverse_7_glgeom_GL_SELECT = 0x1C02,
  __pyx_e_9punyverse_7_glgeom_GL_2D = 0x0600,
  __pyx_e_9punyverse_7_glgeom_GL_3D = 0x0601,
  __pyx_e_9punyverse_7_glgeom_GL_3D_COLOR = 0x0602,
  __pyx_e_9punyverse_7_glgeom_GL_3D_COLOR_TEXTURE = 0x0603,
  __pyx_e_9punyverse_7_glgeom_GL_4D_COLOR_TEXTURE = 0x0604,
  __pyx_e_9punyverse_7_glgeom_GL_POINT_TOKEN = 0x0701,
  __pyx_e_9punyverse_7_glgeom_GL_LINE_TOKEN = 0x0702,
  __pyx_e_9punyverse_7_glgeom_GL_LINE_RESET_TOKEN = 0x0707,
  __pyx_e_9punyverse_7_glgeom_GL_POLYGON_TOKEN = 0x0703,
  __pyx_e_9punyverse_7_glgeom_GL_BITMAP_TOKEN = 0x0704,
  __pyx_e_9punyverse_7_glgeom_GL_DRAW_PIXEL_TOKEN = 0x0705,
  __pyx_e_9punyverse_7_glgeom_GL_COPY_PIXEL_TOKEN = 0x0706,
  __pyx_e_9punyverse_7_glgeom_GL_PASS_THROUGH_TOKEN = 0x0700,
  __pyx_e_9punyverse_7_glgeom_GL_FEEDBACK_BUFFER_POINTER = 0x0DF0,
  __pyx_e_9punyverse_7_glgeom_GL_FEEDBACK_BUFFER_SIZE = 0x0DF1,
  __pyx_e_9punyverse_7_glgeom_GL_FEEDBACK_BUFFER_TYPE = 0x0DF2,
  __pyx_e_9punyverse_7_glgeom_GL_SELECTION_BUFFER_POINTER = 0x0DF3,
  __pyx_e_9punyverse_7_glgeom_GL_SELECTION_BUFFER_SIZE = 0x0DF4,
  __pyx_e_9punyverse_7_glgeom_GL_FOG = 0x0B60,
  __pyx_e_9punyverse_7_glgeom_GL_FOG_MODE = 0x0B65,
  __pyx_e_9punyverse_7_glgeom_GL_FOG_DENSITY = 0x0B62,
  __pyx_e_9punyverse_7_glgeom_GL_FOG_COLOR = 0x0B66,
  __pyx_e_9punyverse_7_glgeom_GL_FOG_INDEX = 0x0B61,
  __pyx_e_9punyverse_7_glgeom_GL_FOG_START = 0x0B63,
  __pyx_e_9punyverse_7_glgeom_GL_FOG_END = 0x0B64,
  __pyx_e_9punyverse_7_glgeom_GL_LINEAR = 0x2601,
  __pyx_e_9punyverse_7_glgeom_GL_EXP = 0x0800,
  __pyx_e_9punyverse_7_glgeom_GL_EXP2 = 0x0801,
  __pyx_e_9punyverse_7_glgeom_GL_LOGIC_OP = 0x0BF1,
  __pyx_e_9punyverse_7_glgeom_GL_INDEX_LOGIC_OP = 0x0BF1,
  __pyx_e_9punyverse_7_glgeom_GL_COLOR_LOGIC_OP = 0x0BF2,
  __pyx_e_9punyverse_7_glgeom_GL_LOGIC_OP_MODE = 0x0BF0,
  __pyx_e_9punyverse_7_glgeom_GL_CLEAR = 0x1500,
  __pyx_e_9punyverse_7_glgeom_GL_SET = 0x150F,
  __pyx_e_9punyverse_7_glgeom_GL_COPY = 0x1503,
  __pyx_e_9punyverse_7_glgeom_GL_COPY_INVERTED = 0x150C,
  __pyx_e_9punyverse_7_glgeom_GL_NOOP = 0x1505,
  __pyx_e_9punyverse_7_glgeom_GL_INVERT = 0x150A,
  __pyx_e_9punyverse_7_glgeom_GL_AND = 0x1501,
  __pyx_e_9punyverse_7_glgeom_GL_NAND = 0x150E,
  __pyx_e_9punyverse_7_glgeom_GL_OR = 0x1507,
  __pyx_e_9punyverse_7_glgeom_GL_NOR = 0x1508,
  __pyx_e_9punyverse_7_glgeom_GL_XOR = 0x1506,
  __pyx_e_9punyverse_7_glgeom_GL_EQUIV = 0x1509,
  __pyx_e_9punyverse_7_glgeom_GL_AND_REVERSE = 0x1502,
  __pyx_e_9punyverse_7_glgeom_GL_AND_INVERTED = 0x1504,
  __pyx_e_9punyverse_7_glgeom_GL_OR_REVERSE = 0x150B,
  __pyx_e_9punyverse_7_glgeom_GL_OR_INVERTED = 0x150D,
  __pyx_e_9punyverse_7_glgeom_GL_STENCIL_TEST = 0x0B90,
  __pyx_e_9punyverse_7_glgeom_GL_STENCIL_WRITEMASK = 0x0B98,
  __pyx_e_9punyverse_7_glgeom_GL_STENCIL_BITS = 0x0D57,
  __pyx_e_9punyverse_7_glgeom_GL_STENCIL_FUNC = 0x0B92,
  __pyx_e_9punyverse_7_glgeom_GL_STENCIL_VALUE_MASK = 0x0B93,
  __pyx_e_9punyverse_7_glgeom_GL_STENCIL_REF = 0x0B97,
  __pyx_e_9punyverse_7_glgeom_GL_STENCIL_FAIL = 0x0B94,
  __pyx_e_9punyverse_7_glgeom_GL_STENCIL_PASS_DEPTH_PASS = 0x0B96,
  __pyx_e_9punyverse_7_glgeom_GL_STENCIL_PASS_DEPTH_FAIL = 0x0B95,
  __pyx_e_9punyverse_7_glgeom_GL_STENCIL_CLEAR_VALUE = 0x0B91,
  __pyx_e_9punyverse_7_glgeom_GL_STENCIL_INDEX = 0x1901,
  __pyx_e_9punyverse_7_glgeom_GL_KEEP = 0x1E00,
  __pyx_e_9punyverse_7_glgeom_GL_REPLACE = 0x1E01,
  __pyx_e_9punyverse_7_glgeom_GL_INCR = 0x1E02,
  __pyx_e_9punyverse_7_glgeom_GL_DECR = 0x1E03,
  __pyx_e_9punyverse_7_glgeom_GL_NONE = 0x0,
  __pyx_e_9punyverse_7_glgeom_GL_LEFT = 0x0406,
  __pyx_e_9punyverse_7_glgeom_GL_RIGHT = 0x0407,
  __pyx_e_9punyverse_7_glgeom_GL_FRONT_LEFT = 0x0400,
  __pyx_e_9punyverse_7_glgeom_GL_FRONT_RIGHT = 0x0401,
  __pyx_e_9punyverse_7_glgeom_GL_BACK_LEFT = 0x0402,
  __pyx_e_9punyverse_7_glgeom_GL_BACK_RIGHT = 0x0403,
  __pyx_e_9punyverse_7_glgeom_GL_AUX0 = 0x0409,
  __pyx_e_9punyverse_7_glgeom_GL_AUX1 = 0x040A,
  __pyx_e_9punyverse_7_glgeom_GL_AUX2 = 0x040B,
  __pyx_e_9punyverse_7_glgeom_GL_AUX3 = 0x040C,
  __pyx_e_9punyverse_7_glgeom_GL_COLOR_INDEX = 0x1900,
  __pyx_e_9punyverse_7_glgeom_GL_RED = 0x1903,
  __pyx_e_9punyverse_7_glgeom_GL_GREEN = 0x1904,
  __pyx_e_9punyverse_7_glgeom_GL_BLUE = 0x1905,
  __pyx_e_9punyverse_7_glgeom_GL_ALPHA = 0x1906,
  __pyx_e_9punyverse_7_glgeom_GL_LUMINANCE = 0x1909,
  __pyx_e_9punyverse_7_glgeom_GL_LUMINANCE_ALPHA = 0x190A,
  __pyx_e_9punyverse_7_glgeom_GL_ALPHA_BITS = 0x0D55,
  __pyx_e_9punyverse_7_glgeom_GL_RED_BITS = 0x0D52,
  __pyx_e_9punyverse_7_glgeom_GL_GREEN_BITS = 0x0D53,
  __pyx_e_9punyverse_7_glgeom_GL_BLUE_BITS = 0x0D54,
  __pyx_e_9punyverse_7_glgeom_GL_INDEX_BITS = 0x0D51,
  __pyx_e_9punyverse_7_glgeom_GL_SUBPIXEL_BITS = 0x0D50,
  __pyx_e_9punyverse_7_glgeom_GL_AUX_BUFFERS = 0x0C00,
  __pyx_e_9punyverse_7_glgeom_GL_READ_BUFFER = 0x0C02,
  __pyx_e_9punyverse_7_glgeom_GL_DRAW_BUFFER = 0x0C01,
  __pyx_e_9punyverse_7_glgeom_GL_DOUBLEBUFFER = 0x0C32,
  __pyx_e_9punyverse_7_glgeom_GL_STEREO = 0x0C33,
  __pyx_e_9punyverse_7_glgeom_GL_BITMAP = 0x1A00,
  __pyx_e_9punyverse_7_glgeom_GL_COLOR = 0x1800,
  __pyx_e_9punyverse_7_glgeom_GL_DEPTH = 0x1801,
  __pyx_e_9punyverse_7_glgeom_GL_STENCIL = 0x1802,
  __pyx_e_9punyverse_7_glgeom_GL_DITHER = 0x0BD0,
  __pyx_e_9punyverse_7_glgeom_GL_RGB = 0x1907,
  __pyx_e_9punyverse_7_glgeom_GL_RGBA = 0x1908,
  __pyx_e_9punyverse_7_glgeom_GL_MAX_LIST_NESTING = 0x0B31,
  __pyx_e_9punyverse_7_glgeom_GL_MAX_ATTRIB_STACK_DEPTH = 0x0D35,
  __pyx_e_9punyverse_7_glgeom_GL_MAX_MODELVIEW_STACK_DEPTH = 0x0D36,
  __pyx_e_9punyverse_7_glgeom_GL_MAX_NAME_STACK_DEPTH = 0x0D37,
  __pyx_e_9punyverse_7_glgeom_GL_MAX_PROJECTION_STACK_DEPTH = 0x0D38,
  __pyx_e_9punyverse_7_glgeom_GL_MAX_TEXTURE_STACK_DEPTH = 0x0D39,
  __pyx_e_9punyverse_7_glgeom_GL_MAX_EVAL_ORDER = 0x0D30,
  __pyx_e_9punyverse_7_glgeom_GL_MAX_LIGHTS = 0x0D31,
  __pyx_e_9punyverse_7_glgeom_GL_MAX_CLIP_PLANES = 0x0D32,
  __pyx_e_9punyverse_7_glgeom_GL_MAX_TEXTURE_SIZE = 0x0D33,
  __pyx_e_9punyverse_7_glgeom_GL_MAX_PIXEL_MAP_TABLE = 0x0D34,
  __pyx_e_9punyverse_7_glgeom_GL_MAX_VIEWPORT_DIMS = 0x0D3A,
  __pyx_e_9punyverse_7_glgeom_GL_MAX_CLIENT_ATTRIB_STACK_DEPTH = 0x0D3B,
  __pyx_e_9punyverse_7_glgeom_GL_ATTRIB_STACK_DEPTH = 0x0BB0,
  __pyx_e_9punyverse_7_glgeom_GL_CLIENT_ATTRIB_STACK_DEPTH = 0x0BB1,
  __pyx_e_9punyverse_7_glgeom_GL_COLOR_CLEAR_VALUE = 0x0C22,
  __pyx_e_9punyverse_7_glgeom_GL_COLOR_WRITEMASK = 0x0C23,
  __pyx_e_9punyverse_7_glgeom_GL_CURRENT_INDEX = 0x0B01,
  __pyx_e_9punyverse_7_glgeom_GL_CURRENT_COLOR = 0x0B00,
  __pyx_e_9punyverse_7_glgeom_GL_CURRENT_NORMAL = 0x0B02,
  __pyx_e_9punyverse_7_glgeom_GL_CURRENT_RASTER_COLOR = 0x0B04,
  __pyx_e_9punyverse_7_glgeom_GL_CURRENT_RASTER_DISTANCE = 0x0B09,
  __pyx_e_9punyverse_7_glgeom_GL_CURRENT_RASTER_INDEX = 0x0B05,
  __pyx_e_9punyverse_7_glgeom_GL_CURRENT_RASTER_POSITION = 0x0B07,
  __pyx_e_9punyverse_7_glgeom_GL_CURRENT_RASTER_TEXTURE_COORDS = 0x0B06,
  __pyx_e_9punyverse_7_glgeom_GL_CURRENT_RASTER_POSITION_VALID = 0x0B08,
  __pyx_e_9punyverse_7_glgeom_GL_CURRENT_TEXTURE_COORDS = 0x0B03,
  __pyx_e_9punyverse_7_glgeom_GL_INDEX_CLEAR_VALUE = 0x0C20,
  __pyx_e_9punyverse_7_glgeom_GL_INDEX_MODE = 0x0C30,
  __pyx_e_9punyverse_7_glgeom_GL_INDEX_WRITEMASK = 0x0C21,
  __pyx_e_9punyverse_7_glgeom_GL_MODELVIEW_MATRIX = 0x0BA6,
  __pyx_e_9punyverse_7_glgeom_GL_MODELVIEW_STACK_DEPTH = 0x0BA3,
  __pyx_e_9punyverse_7_glgeom_GL_NAME_STACK_DEPTH = 0x0D70,
  __pyx_e_9punyverse_7_glgeom_GL_PROJECTION_MATRIX = 0x0BA7,
  __pyx_e_9punyverse_7_glgeom_GL_PROJECTION_STACK_DEPTH = 0x0BA4,
  __pyx_e_9punyverse_7_glgeom_GL_RENDER_MODE = 0x0C40,
  __pyx_e_9punyverse_7_glgeom_GL_RGBA_MODE = 0x0C31,
  __pyx_e_9punyverse_7_glgeom_GL_TEXTURE_MATRIX = 0x0BA8,
  __pyx_e_9punyverse_7_glgeom_GL_TEXTURE_STACK_DEPTH = 0x0BA5,
  __pyx_e_9punyverse_7_glgeom_GL_VIEWPORT = 0x0BA2,
  __pyx_e_9punyverse_7_glgeom_GL_AUTO_NORMAL = 0x0D80,
  __pyx_e_9punyverse_7_glgeom_GL_MAP1_COLOR_4 = 0x0D90,
  __pyx_e_9punyverse_7_glgeom_GL_MAP1_GRID_DOMAIN = 0x0DD0,
  __pyx_e_9punyverse_7_glgeom_GL_MAP1_GRID_SEGMENTS = 0x0DD1,
  __pyx_e_9punyverse_7_glgeom_GL_MAP1_INDEX = 0x0D91,
  __pyx_e_9punyverse_7_glgeom_GL_MAP1_NORMAL = 0x0D92,
  __pyx_e_9punyverse_7_glgeom_GL_MAP1_TEXTURE_COORD_1 = 0x0D93,
  __pyx_e_9punyverse_7_glgeom_GL_MAP1_TEXTURE_COORD_2 = 0x0D94,
  __pyx_e_9punyverse_7_glgeom_GL_MAP1_TEXTURE_COORD_3 = 0x0D95,
  __pyx_e_9punyverse_7_glgeom_GL_MAP1_TEXTURE_COORD_4 = 0x0D96,
  __pyx_e_9punyverse_7_glgeom_GL_MAP1_VERTEX_3 = 0x0D97,
  __pyx_e_9punyverse_7_glgeom_GL_MAP1_VERTEX_4 = 0x0D98,
  __pyx_e_9punyverse_7_glgeom_GL_MAP2_COLOR_4 = 0x0DB0,
  __pyx_e_9punyverse_7_glgeom_GL_MAP2_GRID_DOMAIN = 0x0DD2,
  __pyx_e_9punyverse_7_glgeom_GL_MAP2_GRID_SEGMENTS = 0x0DD3,
  __pyx_e_9punyverse_7_glgeom_GL_MAP2_INDEX = 0x0DB1,
  __pyx_e_9punyverse_7_glgeom_GL_MAP2_NORMAL = 0x0DB2,
  __pyx_e_9punyverse_7_glgeom_GL_MAP2_TEXTURE_COORD_1 = 0x0DB3,
  __pyx_e_9punyverse_7_glgeom_GL_MAP2_TEXTURE_COORD_2 = 0x0DB4,
  __pyx_e_9punyverse_7_glgeom_GL_MAP2_TEXTURE_COORD_3 = 0x0DB5,
  __pyx_e_9punyverse_7_glgeom_GL_MAP2_TEXTURE_COORD_4 = 0x0DB6,
  __pyx_e_9punyverse_7_glgeom_GL_MAP2_VERTEX_3 = 0x0DB7,
  __pyx_e_9punyverse_7_glgeom_GL_MAP2_VERTEX_4 = 0x0DB8,
  __pyx_e_9punyverse_7_glgeom_GL_COEFF = 0x0A00,
  __pyx_e_9punyverse_7_glgeom_GL_DOMAIN = 0x0A02,
  __pyx_e_9punyverse_7_glgeom_GL_ORDER = 0x0A01,
  __pyx_e_9punyverse_7_glgeom_GL_FOG_HINT = 0x0C54,
  __pyx_e_9punyverse_7_glgeom_GL_LINE_SMOOTH_HINT = 0x0C52,
  __pyx_e_9punyverse_7_glgeom_GL_PERSPECTIVE_CORRECTION_HINT = 0x0C50,
  __pyx_e_9punyverse_7_glgeom_GL_POINT_SMOOTH_HINT = 0x0C51,
  __pyx_e_9punyverse_7_glgeom_GL_POLYGON_SMOOTH_HINT = 0x0C53,
  __pyx_e_9punyverse_7_glgeom_GL_DONT_CARE = 0x1100,
  __pyx_e_9punyverse_7_glgeom_GL_FASTEST = 0x1101,
  __pyx_e_9punyverse_7_glgeom_GL_NICEST = 0x1102,
  __pyx_e_9punyverse_7_glgeom_GL_SCISSOR_TEST = 0x0C11,
  __pyx_e_9punyverse_7_glgeom_GL_SCISSOR_BOX = 0x0C10,
  __pyx_e_9punyverse_7_glgeom_GL_MAP_COLOR = 0x0D10,
  __pyx_e_9punyverse_7_glgeom_GL_MAP_STENCIL = 0x0D11,
  __pyx_e_9punyverse_7_glgeom_GL_INDEX_SHIFT = 0x0D12,
  __pyx_e_9punyverse_7_glgeom_GL_INDEX_OFFSET = 0x0D13,
  __pyx_e_9punyverse_7_glgeom_GL_RED_SCALE = 0x0D14,
  __pyx_e_9punyverse_7_glgeom_GL_RED_BIAS = 0x0D15,
  __pyx_e_9punyverse_7_glgeom_GL_GREEN_SCALE = 0x0D18,
  __pyx_e_9punyverse_7_glgeom_GL_GREEN_BIAS = 0x0D19,
  __pyx_e_9punyverse_7_glgeom_GL_BLUE_SCALE = 0x0D1A,
  __pyx_e_9punyverse_7_glgeom_GL_BLUE_BIAS = 0x0D1B,
  __pyx_e_9punyverse_7_glgeom_GL_ALPHA_SCALE = 0x0D1C,
  __pyx_e_9punyverse_7_glgeom_GL_ALPHA_BIAS = 0x0D1D,
  __pyx_e_9punyverse_7_glgeom_GL_DEPTH_SCALE = 0x0D1E,
  __pyx_e_9punyverse_7_glgeom_GL_DEPTH_BIAS = 0x0D1F,
  __pyx_e_9punyverse_7_glgeom_GL_PIXEL_MAP_S_TO_S_SIZE = 0x0CB1,
  __pyx_e_9punyverse_7_glgeom_GL_PIXEL_MAP_I_TO_I_SIZE = 0x0CB0,
  __pyx_e_9punyverse_7_glgeom_GL_PIXEL_MAP_I_TO_R_SIZE = 0x0CB2,
  __pyx_e_9punyverse_7_glgeom_GL_PIXEL_MAP_I_TO_G_SIZE = 0x0CB3,
  __pyx_e_9punyverse_7_glgeom_GL_PIXEL_MAP_I_TO_B_SIZE = 0x0CB4,
  __pyx_e_9punyverse_7_glgeom_GL_PIXEL_MAP_I_TO_A_SIZE = 0x0CB5,
  __pyx_e_9punyverse_7_glgeom_GL_PIXEL_MAP_R_TO_R_SIZE = 0x0CB6,
  __pyx_e_9punyverse_7_glgeom_GL_PIXEL_MAP_G_TO_G_SIZE = 0x0CB7,
  __pyx_e_9punyverse_7_glgeom_GL_PIXEL_MAP_B_TO_B_SIZE = 0x0CB8,
  __pyx_e_9punyverse_7_glgeom_GL_PIXEL_MAP_A_TO_A_SIZE = 0x0CB9,
  __pyx_e_9punyverse_7_glgeom_GL_PIXEL_MAP_S_TO_S = 0x0C71,
  __pyx_e_9punyverse_7_glgeom_GL_PIXEL_MAP_I_TO_I = 0x0C70,
  __pyx_e_9punyverse_7_glgeom_GL_PIXEL_MAP_I_TO_R = 0x0C72,
  __pyx_e_9punyverse_7_glgeom_GL_PIXEL_MAP_I_TO_G = 0x0C73,
  __pyx_e_9punyverse_7_glgeom_GL_PIXEL_MAP_I_TO_B = 0x0C74,
  __pyx_e_9punyverse_7_glgeom_GL_PIXEL_MAP_I_TO_A = 0x0C75,
  __pyx_e_9punyverse_7_glgeom_GL_PIXEL_MAP_R_TO_R = 0x0C76,
  __pyx_e_9punyverse_7_glgeom_GL_PIXEL_MAP_G_TO_G = 0x0C77,
  __pyx_e_9punyverse_7_glgeom_GL_PIXEL_MAP_B_TO_B = 0x0C78,
  __pyx_e_9punyverse_7_glgeom_GL_PIXEL_MAP_A_TO_A = 0x0C79,
  __pyx_e_9punyverse_7_glgeom_GL_PACK_ALIGNMENT = 0x0D05,
  __pyx_e_9punyverse_7_glgeom_GL_PACK_LSB_FIRST = 0x0D01,
  __pyx_e_9punyverse_7_glgeom_GL_PACK_ROW_LENGTH = 0x0D02,
  __pyx_e_9punyverse_7_glgeom_GL_PACK_SKIP_PIXELS = 0x0D04,
  __pyx_e_9punyverse_7_glgeom_GL_PACK_SKIP_ROWS = 0x0D03,
  __pyx_e_9punyverse_7_glgeom_GL_PACK_SWAP_BYTES = 0x0D00,
  __pyx_e_9punyverse_7_glgeom_GL_UNPACK_ALIGNMENT = 0x0CF5,
  __pyx_e_9punyverse_7_glgeom_GL_UNPACK_LSB_FIRST = 0x0CF1,
  __pyx_e_9punyverse_7_glgeom_GL_UNPACK_ROW_LENGTH = 0x0CF2,
  __pyx_e_9punyverse_7_glgeom_GL_UNPACK_SKIP_PIXELS = 0x0CF4,
  __pyx_e_9punyverse_7_glgeom_GL_UNPACK_SKIP_ROWS = 0x0CF3,
  __pyx_e_9punyverse_7_glgeom_GL_UNPACK_SWAP_BYTES = 0x0CF0,
  __pyx_e_9punyverse_7_glgeom_GL_ZOOM_X = 0x0D16,
  __pyx_e_9punyverse_7_glgeom_GL_ZOOM_Y = 0x0D17,
  __pyx_e_9punyverse_7_glgeom_GL_TEXTURE_ENV = 0x2300,
  __pyx_e_9punyverse_7_glgeom_GL_TEXTURE_ENV_MODE = 0x2200,
  __pyx_e_9punyverse_7_glgeom_GL_TEXTURE_1D = 0x0DE0,
  __pyx_e_9punyverse_7_glgeom_GL_TEXTURE_2D = 0x0DE1,
  __pyx_e_9punyverse_7_glgeom_GL_TEXTURE_WRAP_S = 0x2802,
  __pyx_e_9punyverse_7_glgeom_GL_TEXTURE_WRAP_T = 0x2803,
  __pyx_e_9punyverse_7_glgeom_GL_TEXTURE_MAG_FILTER = 0x2800,
  __pyx_e_9punyverse_7_glgeom_GL_TEXTURE_MIN_FILTER = 0x2801,
  __pyx_e_9punyverse_7_glgeom_GL_TEXTURE_ENV_COLOR = 0x2201,
  __pyx_e_9punyverse_7_glgeom_GL_TEXTURE_GEN_S = 0x0C60,
  __pyx_e_9punyverse_7_glgeom_GL_TEXTURE_GEN_T = 0x0C61,
  __pyx_e_9punyverse_7_glgeom_GL_TEXTURE_GEN_MODE = 0x2500,
  __pyx_e_9punyverse_7_glgeom_GL_TEXTURE_BORDER_COLOR = 0x1004,
  __pyx_e_9punyverse_7_glgeom_GL_TEXTURE_WIDTH = 0x1000,
  __pyx_e_9punyverse_7_glgeom_GL_TEXTURE_HEIGHT = 0x1001,
  __pyx_e_9punyverse_7_glgeom_GL_TEXTURE_BORDER = 0x1005,
  __pyx_e_9punyverse_7_glgeom_GL_TEXTURE_COMPONENTS = 0x1003,
  __pyx_e_9punyverse_7_glgeom_GL_TEXTURE_RED_SIZE = 0x805C,
  __pyx_e_9punyverse_7_glgeom_GL_TEXTURE_GREEN_SIZE = 0x805D,
  __pyx_e_9punyverse_7_glgeom_GL_TEXTURE_BLUE_SIZE = 0x805E,
  __pyx_e_9punyverse_7_glgeom_GL_TEXTURE_ALPHA_SIZE = 0x805F,
  __pyx_e_9punyverse_7_glgeom_GL_TEXTURE_LUMINANCE_SIZE = 0x8060,
  __pyx_e_9punyverse_7_glgeom_GL_TEXTURE_INTENSITY_SIZE = 0x8061,
  __pyx_e_9punyverse_7_glgeom_GL_NEAREST_MIPMAP_NEAREST = 0x2700,
  __pyx_e_9punyverse_7_glgeom_GL_NEAREST_MIPMAP_LINEAR = 0x2702,
  __pyx_e_9punyverse_7_glgeom_GL_LINEAR_MIPMAP_NEAREST = 0x2701,
  __pyx_e_9punyverse_7_glgeom_GL_LINEAR_MIPMAP_LINEAR = 0x2703,
  __pyx_e_9punyverse_7_glgeom_GL_OBJECT_LINEAR = 0x2401,
  __pyx_e_9punyverse_7_glgeom_GL_OBJECT_PLANE = 0x2501,
  __pyx_e_9punyverse_7_glgeom_GL_EYE_LINEAR = 0x2400,
  __pyx_e_9punyverse_7_glgeom_GL_EYE_PLANE = 0x2502,
  __pyx_e_9punyverse_7_glgeom_GL_SPHERE_MAP = 0x2402,
  __pyx_e_9punyverse_7_glgeom_GL_DECAL = 0x2101,
  __pyx_e_9punyverse_7_glgeom_GL_MODULATE = 0x2100,
  __pyx_e_9punyverse_7_glgeom_GL_NEAREST = 0x2600,
  __pyx_e_9punyverse_7_glgeom_GL_REPEAT = 0x2901,
  __pyx_e_9punyverse_7_glgeom_GL_CLAMP = 0x2900,
  __pyx_e_9punyverse_7_glgeom_GL_S = 0x2000,
  __pyx_e_9punyverse_7_glgeom_GL_T = 0x2001,
  __pyx_e_9punyverse_7_glgeom_GL_R = 0x2002,
  __pyx_e_9punyverse_7_glgeom_GL_Q = 0x2003,
  __pyx_e_9punyverse_7_glgeom_GL_TEXTURE_GEN_R = 0x0C62,
  __pyx_e_9punyverse_7_glgeom_GL_TEXTURE_GEN_Q = 0x0C63,
  __pyx_e_9punyverse_7_glgeom_GL_VENDOR = 0x1F00,
  __pyx_e_9punyverse_7_glgeom_GL_RENDERER = 0x1F01,
  __pyx_e_9punyverse_7_glgeom_GL_VERSION = 0x1F02,
  __pyx_e_9punyverse_7_glgeom_GL_EXTENSIONS = 0x1F03,
  __pyx_e_9punyverse_7_glgeom_GL_NO_ERROR = 0x0,
  __pyx_e_9punyverse_7_glgeom_GL_INVALID_VALUE = 0x0501,
  __pyx_e_9punyverse_7_glgeom_GL_INVALID_ENUM = 0x0500,
  __pyx_e_9punyverse_7_glgeom_GL_INVALID_OPERATION = 0x0502,
  __pyx_e_9punyverse_7_glgeom_GL_STACK_OVERFLOW = 0x0503,
  __pyx_e_9punyverse_7_glgeom_GL_STACK_UNDERFLOW = 0x0504,
  __pyx_e_9punyverse_7_glgeom_GL_OUT_OF_MEMORY = 0x0505,
  __pyx_e_9punyverse_7_glgeom_GL_CURRENT_BIT = 0x00000001,
  __pyx_e_9punyverse_7_glgeom_GL_POINT_BIT = 0x00000002,
  __pyx_e_9punyverse_7_glgeom_GL_LINE_BIT = 0x00000004,
  __pyx_e_9punyverse_7_glgeom_GL_POLYGON_BIT = 0x00000008,
  __pyx_e_9punyverse_7_glgeom_GL_POLYGON_STIPPLE_BIT = 0x00000010,
  __pyx_e_9punyverse_7_glgeom_GL_PIXEL_MODE_BIT = 0x00000020,
  __pyx_e_9punyverse_7_glgeom_GL_LIGHTING_BIT = 0x00000040,
  __pyx_e_9punyverse_7_glgeom_GL_FOG_BIT = 0x00000080,
  __pyx_e_9punyverse_7_glgeom_GL_DEPTH_BUFFER_BIT = 0x00000100,
  __pyx_e_9punyverse_7_glgeom_GL_ACCUM_BUFFER_BIT = 0x00000200,
  __pyx_e_9punyverse_7_glgeom_GL_STENCIL_BUFFER_BIT = 0x00000400,
  __pyx_e_9punyverse_7_glgeom_GL_VIEWPORT_BIT = 0x00000800,
  __pyx_e_9punyverse_7_glgeom_GL_TRANSFORM_BIT = 0x00001000,
  __pyx_e_9punyverse_7_glgeom_GL_ENABLE_BIT = 0x00002000,
  __pyx_e_9punyverse_7_glgeom_GL_COLOR_BUFFER_BIT = 0x00004000,
  __pyx_e_9punyverse_7_glgeom_GL_HINT_BIT = 0x00008000,
  __pyx_e_9punyverse_7_glgeom_GL_EVAL_BIT = 0x00010000,
  __pyx_e_9punyverse_7_glgeom_GL_LIST_BIT = 0x00020000,
  __pyx_e_9punyverse_7_glgeom_GL_TEXTURE_BIT = 0x00040000,
  __pyx_e_9punyverse_7_glgeom_GL_SCISSOR_BIT = 0x00080000,
  __pyx_e_9punyverse_7_glgeom_GL_ALL_ATTRIB_BITS = 0x000FFFFF,
  __pyx_e_9punyverse_7_glgeom_GL_PROXY_TEXTURE_1D = 0x8063,
  __pyx_e_9punyverse_7_glgeom_GL_PROXY_TEXTURE_2D = 0x8064,
  __pyx_e_9punyverse_7_glgeom_GL_TEXTURE_PRIORITY = 0x8066,
  __pyx_e_9punyverse_7_glgeom_GL_TEXTURE_RESIDENT = 0x8067,
  __pyx_e_9punyverse_7_glgeom_GL_TEXTURE_BINDING_1D = 0x8068,
  __pyx_e_9punyverse_7_glgeom_GL_TEXTURE_BINDING_2D = 0x8069,
  __pyx_e_9punyverse_7_glgeom_GL_TEXTURE_INTERNAL_FORMAT = 0x1003,
  __pyx_e_9punyverse_7_glgeom_GL_ALPHA4 = 0x803B,
  __pyx_e_9punyverse_7_glgeom_GL_ALPHA8 = 0x803C,
  __pyx_e_9punyverse_7_glgeom_GL_ALPHA12 = 0x803D,
  __pyx_e_9punyverse_7_glgeom_GL_ALPHA16 = 0x803E,
  __pyx_e_9punyverse_7_glgeom_GL_LUMINANCE4 = 0x803F,
  __pyx_e_9punyverse_7_glgeom_GL_LUMINANCE8 = 0x8040,
  __pyx_e_9punyverse_7_glgeom_GL_LUMINANCE12 = 0x8041,
  __pyx_e_9punyverse_7_glgeom_GL_LUMINANCE16 = 0x8042,
  __pyx_e_9punyverse_7_glgeom_GL_LUMINANCE4_ALPHA4 = 0x8043,
  __pyx_e_9punyverse_7_glgeom_GL_LUMINANCE6_ALPHA2 = 0x8044,
  __pyx_e_9punyverse_7_glgeom_GL_LUMINANCE8_ALPHA8 = 0x8045,
  __pyx_e_9punyverse_7_glgeom_GL_LUMINANCE12_ALPHA4 = 0x8046,
  __pyx_e_9punyverse_7_glgeom_GL_LUMINANCE12_ALPHA12 = 0x8047,
  __pyx_e_9punyverse_7_glgeom_GL_LUMINANCE16_ALPHA16 = 0x8048,
  __pyx_e_9punyverse_7_glgeom_GL_INTENSITY = 0x8049,
  __pyx_e_9punyverse_7_glgeom_GL_INTENSITY4 = 0x804A,
  __pyx_e_9punyverse_7_glgeom_GL_INTENSITY8 = 0x804B,
  __pyx_e_9punyverse_7_glgeom_GL_INTENSITY12 = 0x804C,
  __pyx_e_9punyverse_7_glgeom_GL_INTENSITY16 = 0x804D,
  __pyx_e_9punyverse_7_glgeom_GL_R3_G3_B2 = 0x2A10,
  __pyx_e_9punyverse_7_glgeom_GL_RGB4 = 0x804F,
  __pyx_e_9punyverse_7_glgeom_GL_RGB5 = 0x8050,
  __pyx_e_9punyverse_7_glgeom_GL_RGB8 = 0x8051,
  __pyx_e_9punyverse_7_glgeom_GL_RGB10 = 0x8052,
  __pyx_e_9punyverse_7_glgeom_GL_RGB12 = 0x8053,
  __pyx_e_9punyverse_7_glgeom_GL_RGB16 = 0x8054,
  __pyx_e_9punyverse_7_glgeom_GL_RGBA2 = 0x8055,
  __pyx_e_9punyverse_7_glgeom_GL_RGBA4 = 0x8056,
  __pyx_e_9punyverse_7_glgeom_GL_RGB5_A1 = 0x8057,
  __pyx_e_9punyverse_7_glgeom_GL_RGBA8 = 0x8058,
  __pyx_e_9punyverse_7_glgeom_GL_RGB10_A2 = 0x8059,
  __pyx_e_9punyverse_7_glgeom_GL_RGBA12 = 0x805A,
  __pyx_e_9punyverse_7_glgeom_GL_RGBA16 = 0x805B,
  __pyx_e_9punyverse_7_glgeom_GL_CLIENT_PIXEL_STORE_BIT = 0x00000001,
  __pyx_e_9punyverse_7_glgeom_GL_CLIENT_VERTEX_ARRAY_BIT = 0x00000002,
  __pyx_e_9punyverse_7_glgeom_GL_ALL_CLIENT_ATTRIB_BITS = 0xFFFFFFFF,
  __pyx_e_9punyverse_7_glgeom_GL_CLIENT_ALL_ATTRIB_BITS = 0xFFFFFFFF,
  __pyx_e_9punyverse_7_glgeom_GLU_FALSE = 0,
  __pyx_e_9punyverse_7_glgeom_GLU_TRUE = 1,
  __pyx_e_9punyverse_7_glgeom_GLU_VERSION = 0x189C0,
  __pyx_e_9punyverse_7_glgeom_GLU_EXTENSIONS = 0x189C1,
  __pyx_e_9punyverse_7_glgeom_GLU_INVALID_ENUM = 0x18A24,
  __pyx_e_9punyverse_7_glgeom_GLU_INVALID_VALUE = 0x18A25,
  __pyx_e_9punyverse_7_glgeom_GLU_OUT_OF_MEMORY = 0x18A26,
  __pyx_e_9punyverse_7_glgeom_GLU_INVALID_OPERATION = 0x18A28,
  __pyx_e_9punyverse_7_glgeom_GLU_OUTLINE_POLYGON = 0x18790,
  __pyx_e_9punyverse_7_glgeom_GLU_OUTLINE_PATCH = 0x18791,
  __pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR1 = 0x1879B,
  __pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR2 = 0x1879C,
  __pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR3 = 0x1879D,
  __pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR4 = 0x1879E,
  __pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR5 = 0x1879F,
  __pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR6 = 0x187A0,
  __pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR7 = 0x187A1,
  __pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR8 = 0x187A2,
  __pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR9 = 0x187A3,
  __pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR10 = 0x187A4,
  __pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR11 = 0x187A5,
  __pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR12 = 0x187A6,
  __pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR13 = 0x187A7,
  __pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR14 = 0x187A8,
  __pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR15 = 0x187A9,
  __pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR16 = 0x187AA,
  __pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR17 = 0x187AB,
  __pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR18 = 0x187AC,
  __pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR19 = 0x187AD,
  __pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR20 = 0x187AE,
  __pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR21 = 0x187AF,
  __pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR22 = 0x187B0,
  __pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR23 = 0x187B1,
  __pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR24 = 0x187B2,
  __pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR25 = 0x187B3,
  __pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR26 = 0x187B4,
  __pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR27 = 0x187B5,
  __pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR28 = 0x187B6,
  __pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR29 = 0x187B7,
  __pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR30 = 0x187B8,
  __pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR31 = 0x187B9,
  __pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR32 = 0x187BA,
  __pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR33 = 0x187BB,
  __pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR34 = 0x187BC,
  __pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR35 = 0x187BD,
  __pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR36 = 0x187BE,
  __pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR37 = 0x187BF,
  __pyx_e_9punyverse_7_glgeom_GLU_AUTO_LOAD_MATRIX = 0x18768,
  __pyx_e_9punyverse_7_glgeom_GLU_CULLING = 0x18769,
  __pyx_e_9punyverse_7_glgeom_GLU_SAMPLING_TOLERANCE = 0x1876B,
  __pyx_e_9punyverse_7_glgeom_GLU_DISPLAY_MODE = 0x1876C,
  __pyx_e_9punyverse_7_glgeom_GLU_PARAMETRIC_TOLERANCE = 0x1876A,
  __pyx_e_9punyverse_7_glgeom_GLU_SAMPLING_METHOD = 0x1876D,
  __pyx_e_9punyverse_7_glgeom_GLU_U_STEP = 0x1876E,
  __pyx_e_9punyverse_7_glgeom_GLU_V_STEP = 0x1876F,
  __pyx_e_9punyverse_7_glgeom_GLU_PATH_LENGTH = 0x18777,
  __pyx_e_9punyverse_7_glgeom_GLU_PARAMETRIC_ERROR = 0x18778,
  __pyx_e_9punyverse_7_glgeom_GLU_DOMAIN_DISTANCE = 0x18779,
  __pyx_e_9punyverse_7_glgeom_GLU_MAP1_TRIM_2 = 0x18772,
  __pyx_e_9punyverse_7_glgeom_GLU_MAP1_TRIM_3 = 0x18773,
  __pyx_e_9punyverse_7_glgeom_GLU_POINT = 0x186AA,
  __pyx_e_9punyverse_7_glgeom_GLU_LINE = 0x186AB,
  __pyx_e_9punyverse_7_glgeom_GLU_FILL = 0x186AC,
  __pyx_e_9punyverse_7_glgeom_GLU_SILHOUETTE = 0x186AD,
  __pyx_e_9punyverse_7_glgeom_GLU_ERROR = 0x18707,
  __pyx_e_9punyverse_7_glgeom_GLU_SMOOTH = 0x186A0,
  __pyx_e_9punyverse_7_glgeom_GLU_FLAT = 0x186A1,
  __pyx_e_9punyverse_7_glgeom_GLU_NONE = 0x186A2,
  __pyx_e_9punyverse_7_glgeom_GLU_OUTSIDE = 0x186B4,
  __pyx_e_9punyverse_7_glgeom_GLU_INSIDE = 0x186B5,
  __pyx_e_9punyverse_7_glgeom_GLU_TESS_BEGIN = 0x18704,
  __pyx_e_9punyverse_7_glgeom_GLU_BEGIN = 0x18704,
  __pyx_e_9punyverse_7_glgeom_GLU_TESS_VERTEX = 0x18705,
  __pyx_e_9punyverse_7_glgeom_GLU_VERTEX = 0x18705,
  __pyx_e_9punyverse_7_glgeom_GLU_TESS_END = 0x18706,
  __pyx_e_9punyverse_7_glgeom_GLU_END = 0x18706,
  __pyx_e_9punyverse_7_glgeom_GLU_TESS_ERROR = 0x18707,
  __pyx_e_9punyverse_7_glgeom_GLU_TESS_EDGE_FLAG = 0x18708,
  __pyx_e_9punyverse_7_glgeom_GLU_EDGE_FLAG = 0x18708,
  __pyx_e_9punyverse_7_glgeom_GLU_TESS_COMBINE = 0x18709,
  __pyx_e_9punyverse_7_glgeom_GLU_TESS_BEGIN_DATA = 0x1870A,
  __pyx_e_9punyverse_7_glgeom_GLU_TESS_VERTEX_DATA = 0x1870B,
  __pyx_e_9punyverse_7_glgeom_GLU_TESS_END_DATA = 0x1870C,
  __pyx_e_9punyverse_7_glgeom_GLU_TESS_ERROR_DATA = 0x1870D,
  __pyx_e_9punyverse_7_glgeom_GLU_TESS_EDGE_FLAG_DATA = 0x1870E,
  __pyx_e_9punyverse_7_glgeom_GLU_TESS_COMBINE_DATA = 0x1870F,
  __pyx_e_9punyverse_7_glgeom_GLU_CW = 0x18718,
  __pyx_e_9punyverse_7_glgeom_GLU_CCW = 0x18719,
  __pyx_e_9punyverse_7_glgeom_GLU_INTERIOR = 0x1871A,
  __pyx_e_9punyverse_7_glgeom_GLU_EXTERIOR = 0x1871B,
  __pyx_e_9punyverse_7_glgeom_GLU_UNKNOWN = 0x1871C,
  __pyx_e_9punyverse_7_glgeom_GLU_TESS_WINDING_RULE = 0x1872C,
  __pyx_e_9punyverse_7_glgeom_GLU_TESS_BOUNDARY_ONLY = 0x1872D,
  __pyx_e_9punyverse_7_glgeom_GLU_TESS_TOLERANCE = 0x1872E,
  __pyx_e_9punyverse_7_glgeom_GLU_TESS_ERROR1 = 0x18737,
  __pyx_e_9punyverse_7_glgeom_GLU_TESS_ERROR2 = 0x18738,
  __pyx_e_9punyverse_7_glgeom_GLU_TESS_ERROR3 = 0x18739,
  __pyx_e_9punyverse_7_glgeom_GLU_TESS_ERROR4 = 0x1873A,
  __pyx_e_9punyverse_7_glgeom_GLU_TESS_ERROR5 = 0x1873B,
  __pyx_e_9punyverse_7_glgeom_GLU_TESS_ERROR6 = 0x1873C,
  __pyx_e_9punyverse_7_glgeom_GLU_TESS_ERROR7 = 0x1873D,
  __pyx_e_9punyverse_7_glgeom_GLU_TESS_ERROR8 = 0x1873E,
  __pyx_e_9punyverse_7_glgeom_GLU_TESS_MISSING_BEGIN_POLYGON = 0x18737,
  __pyx_e_9punyverse_7_glgeom_GLU_TESS_MISSING_BEGIN_CONTOUR = 0x18738,
  __pyx_e_9punyverse_7_glgeom_GLU_TESS_MISSING_END_POLYGON = 0x18739,
  __pyx_e_9punyverse_7_glgeom_GLU_TESS_MISSING_END_CONTOUR = 0x1873A,
  __pyx_e_9punyverse_7_glgeom_GLU_TESS_COORD_TOO_LARGE = 0x1873B,
  __pyx_e_9punyverse_7_glgeom_GLU_TESS_NEED_COMBINE_CALLBACK = 0x1873C,
  __pyx_e_9punyverse_7_glgeom_GLU_TESS_WINDING_ODD = 0x18722,
  __pyx_e_9punyverse_7_glgeom_GLU_TESS_WINDING_NONZERO = 0x18723,
  __pyx_e_9punyverse_7_glgeom_GLU_TESS_WINDING_POSITIVE = 0x18724,
  __pyx_e_9punyverse_7_glgeom_GLU_TESS_WINDING_NEGATIVE = 0x18725,
  __pyx_e_9punyverse_7_glgeom_GLU_TESS_WINDING_ABS_GEQ_TWO = 0x18726
};

/* "punyverse/_glgeom.pyx":16
 * 
 * @cython.cdivision(True)
 * cpdef torus(float major_radius, float minor_radius, int n_major, int n_minor, tuple material, int shininess=125):             # <<<<<<<<<<<<<<
 *     """
 *         Torus function from the OpenGL red book.
 */
struct __pyx_opt_args_9punyverse_7_glgeom_torus {
  int __pyx_n;
  int shininess;
};

/* "punyverse/_glgeom.pyx":69
 * 
 * 
 * cpdef bytes bgr_to_rgb(bytes buffer, int width, int height, bint alpha=0):             # <<<<<<<<<<<<<<
 *     cdef int length = len(buffer)
 *     cdef int depth = length / (width * height)
 */
struct __pyx_opt_args_9punyverse_7_glgeom_bgr_to_rgb {
  int __pyx_n;
  int alpha;
};

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

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

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

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

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

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

/* None.proto */
static CYTHON_INLINE int __Pyx_div_int(int, int);

/* UnaryNegOverflows.proto */
#define UNARY_NEG_WOULD_OVERFLOW(x)\
        (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x)))

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

/* 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_long(long value);

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

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

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

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

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

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


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

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

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

/* Module declarations from 'cython' */

/* Module declarations from 'punyverse._glgeom' */
static float __pyx_v_9punyverse_7_glgeom_GLU_TESS_MAX_COORD;
static float __pyx_v_9punyverse_7_glgeom_PI;
static float __pyx_v_9punyverse_7_glgeom_TWOPI;
static PyObject *__pyx_f_9punyverse_7_glgeom_torus(float, float, int, int, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_9punyverse_7_glgeom_torus *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_9punyverse_7_glgeom_bgr_to_rgb(PyObject *, int, int, int __pyx_skip_dispatch, struct __pyx_opt_args_9punyverse_7_glgeom_bgr_to_rgb *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_9punyverse_7_glgeom_flip_vertical(PyObject *, int, int, int __pyx_skip_dispatch); /*proto*/
#define __Pyx_MODULE_NAME "punyverse._glgeom"
extern int __pyx_module_is_main_punyverse___glgeom;
int __pyx_module_is_main_punyverse___glgeom = 0;

/* Implementation of 'punyverse._glgeom' */
static PyObject *__pyx_builtin_xrange;
static const char __pyx_k_main[] = "__main__";
static const char __pyx_k_test[] = "__test__";
static const char __pyx_k_alpha[] = "alpha";
static const char __pyx_k_range[] = "range";
static const char __pyx_k_width[] = "width";
static const char __pyx_k_buffer[] = "buffer";
static const char __pyx_k_height[] = "height";
static const char __pyx_k_xrange[] = "xrange";
static const char __pyx_k_n_major[] = "n_major";
static const char __pyx_k_n_minor[] = "n_minor";
static const char __pyx_k_material[] = "material";
static const char __pyx_k_shininess[] = "shininess";
static const char __pyx_k_major_radius[] = "major_radius";
static const char __pyx_k_minor_radius[] = "minor_radius";
static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
static PyObject *__pyx_n_s_alpha;
static PyObject *__pyx_n_s_buffer;
static PyObject *__pyx_n_s_cline_in_traceback;
static PyObject *__pyx_n_s_height;
static PyObject *__pyx_n_s_main;
static PyObject *__pyx_n_s_major_radius;
static PyObject *__pyx_n_s_material;
static PyObject *__pyx_n_s_minor_radius;
static PyObject *__pyx_n_s_n_major;
static PyObject *__pyx_n_s_n_minor;
static PyObject *__pyx_n_s_range;
static PyObject *__pyx_n_s_shininess;
static PyObject *__pyx_n_s_test;
static PyObject *__pyx_n_s_width;
static PyObject *__pyx_n_s_xrange;
static PyObject *__pyx_pf_9punyverse_7_glgeom_torus(CYTHON_UNUSED PyObject *__pyx_self, float __pyx_v_major_radius, float __pyx_v_minor_radius, int __pyx_v_n_major, int __pyx_v_n_minor, PyObject *__pyx_v_material, int __pyx_v_shininess); /* proto */
static PyObject *__pyx_pf_9punyverse_7_glgeom_2bgr_to_rgb(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buffer, int __pyx_v_width, int __pyx_v_height, int __pyx_v_alpha); /* proto */
static PyObject *__pyx_pf_9punyverse_7_glgeom_4flip_vertical(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buffer, int __pyx_v_width, int __pyx_v_height); /* proto */
/* Late includes */

/* "punyverse/_glgeom.pyx":16
 * 
 * @cython.cdivision(True)
 * cpdef torus(float major_radius, float minor_radius, int n_major, int n_minor, tuple material, int shininess=125):             # <<<<<<<<<<<<<<
 *     """
 *         Torus function from the OpenGL red book.
 */

static PyObject *__pyx_pw_9punyverse_7_glgeom_1torus(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_9punyverse_7_glgeom_torus(float __pyx_v_major_radius, float __pyx_v_minor_radius, int __pyx_v_n_major, int __pyx_v_n_minor, PyObject *__pyx_v_material, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_9punyverse_7_glgeom_torus *__pyx_optional_args) {
  int __pyx_v_shininess = ((int)0x7D);
  float __pyx_v_major_s;
  float __pyx_v_minor_s;
  float __pyx_v_a0;
  float __pyx_v_a1;
  float __pyx_v_x0;
  float __pyx_v_y0;
  float __pyx_v_x1;
  float __pyx_v_y1;
  float __pyx_v_b;
  float __pyx_v_c;
  float __pyx_v_r;
  float __pyx_v_z;
  float __pyx_v_m;
  float __pyx_v_x;
  float __pyx_v_y;
  float __pyx_v_z2;
  int __pyx_v_i;
  int __pyx_v_j;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  GLfloat __pyx_t_2;
  GLfloat __pyx_t_3;
  GLfloat __pyx_t_4;
  GLfloat __pyx_t_5;
  GLfloat __pyx_t_6[4];
  GLfloat __pyx_t_7[4];
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_t_12;
  long __pyx_t_13;
  long __pyx_t_14;
  int __pyx_t_15;
  __Pyx_RefNannySetupContext("torus", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_shininess = __pyx_optional_args->shininess;
    }
  }

  /* "punyverse/_glgeom.pyx":20
 *         Torus function from the OpenGL red book.
 *     """
 *     glPushAttrib(GL_CURRENT_BIT)             # <<<<<<<<<<<<<<
 *     glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, [material[0], material[1], material[2], material[3]])
 *     glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, [1, 1, 1, 1])
 */
  glPushAttrib(__pyx_e_9punyverse_7_glgeom_GL_CURRENT_BIT);

  /* "punyverse/_glgeom.pyx":21
 *     """
 *     glPushAttrib(GL_CURRENT_BIT)
 *     glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, [material[0], material[1], material[2], material[3]])             # <<<<<<<<<<<<<<
 *     glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, [1, 1, 1, 1])
 *     glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, shininess)
 */
  if (unlikely(__pyx_v_material == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 21, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v_material, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 21, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_2 == ((GLfloat)-1)) && PyErr_Occurred())) __PYX_ERR(0, 21, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(__pyx_v_material == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 21, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v_material, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 21, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_3 == ((GLfloat)-1)) && PyErr_Occurred())) __PYX_ERR(0, 21, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(__pyx_v_material == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 21, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v_material, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 21, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_4 == ((GLfloat)-1)) && PyErr_Occurred())) __PYX_ERR(0, 21, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(__pyx_v_material == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 21, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v_material, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 21, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_5 == ((GLfloat)-1)) && PyErr_Occurred())) __PYX_ERR(0, 21, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_6[0] = __pyx_t_2;
  __pyx_t_6[1] = __pyx_t_3;
  __pyx_t_6[2] = __pyx_t_4;
  __pyx_t_6[3] = __pyx_t_5;
  glMaterialfv(__pyx_e_9punyverse_7_glgeom_GL_FRONT_AND_BACK, __pyx_e_9punyverse_7_glgeom_GL_AMBIENT_AND_DIFFUSE, __pyx_t_6);

  /* "punyverse/_glgeom.pyx":22
 *     glPushAttrib(GL_CURRENT_BIT)
 *     glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, [material[0], material[1], material[2], material[3]])
 *     glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, [1, 1, 1, 1])             # <<<<<<<<<<<<<<
 *     glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, shininess)
 * 
 */
  __pyx_t_7[0] = 1.0;
  __pyx_t_7[1] = 1.0;
  __pyx_t_7[2] = 1.0;
  __pyx_t_7[3] = 1.0;
  glMaterialfv(__pyx_e_9punyverse_7_glgeom_GL_FRONT_AND_BACK, __pyx_e_9punyverse_7_glgeom_GL_SPECULAR, __pyx_t_7);

  /* "punyverse/_glgeom.pyx":23
 *     glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, [material[0], material[1], material[2], material[3]])
 *     glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, [1, 1, 1, 1])
 *     glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, shininess)             # <<<<<<<<<<<<<<
 * 
 *     assert n_major > 0 and n_minor > 0
 */
  glMaterialf(__pyx_e_9punyverse_7_glgeom_GL_FRONT_AND_BACK, __pyx_e_9punyverse_7_glgeom_GL_SHININESS, __pyx_v_shininess);

  /* "punyverse/_glgeom.pyx":25
 *     glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, shininess)
 * 
 *     assert n_major > 0 and n_minor > 0             # <<<<<<<<<<<<<<
 *     assert minor_radius > 0 and major_radius > 0
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_9 = ((__pyx_v_n_major > 0) != 0);
    if (__pyx_t_9) {
    } else {
      __pyx_t_8 = __pyx_t_9;
      goto __pyx_L3_bool_binop_done;
    }
    __pyx_t_9 = ((__pyx_v_n_minor > 0) != 0);
    __pyx_t_8 = __pyx_t_9;
    __pyx_L3_bool_binop_done:;
    if (unlikely(!__pyx_t_8)) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(0, 25, __pyx_L1_error)
    }
  }
  #endif

  /* "punyverse/_glgeom.pyx":26
 * 
 *     assert n_major > 0 and n_minor > 0
 *     assert minor_radius > 0 and major_radius > 0             # <<<<<<<<<<<<<<
 * 
 *     cdef float major_s, minor_s
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_9 = ((__pyx_v_minor_radius > 0.0) != 0);
    if (__pyx_t_9) {
    } else {
      __pyx_t_8 = __pyx_t_9;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_9 = ((__pyx_v_major_radius > 0.0) != 0);
    __pyx_t_8 = __pyx_t_9;
    __pyx_L5_bool_binop_done:;
    if (unlikely(!__pyx_t_8)) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(0, 26, __pyx_L1_error)
    }
  }
  #endif

  /* "punyverse/_glgeom.pyx":32
 *     cdef int i, j
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         major_s = TWOPI / n_major
 *         minor_s = TWOPI / n_minor
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "punyverse/_glgeom.pyx":33
 * 
 *     with nogil:
 *         major_s = TWOPI / n_major             # <<<<<<<<<<<<<<
 *         minor_s = TWOPI / n_minor
 * 
 */
        __pyx_v_major_s = (__pyx_v_9punyverse_7_glgeom_TWOPI / __pyx_v_n_major);

        /* "punyverse/_glgeom.pyx":34
 *     with nogil:
 *         major_s = TWOPI / n_major
 *         minor_s = TWOPI / n_minor             # <<<<<<<<<<<<<<
 * 
 *         for i in xrange(n_major):
 */
        __pyx_v_minor_s = (__pyx_v_9punyverse_7_glgeom_TWOPI / __pyx_v_n_minor);

        /* "punyverse/_glgeom.pyx":36
 *         minor_s = TWOPI / n_minor
 * 
 *         for i in xrange(n_major):             # <<<<<<<<<<<<<<
 *             a0 = i * major_s
 *             a1 = a0 + major_s
 */
        __pyx_t_10 = __pyx_v_n_major;
        __pyx_t_11 = __pyx_t_10;
        for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
          __pyx_v_i = __pyx_t_12;

          /* "punyverse/_glgeom.pyx":37
 * 
 *         for i in xrange(n_major):
 *             a0 = i * major_s             # <<<<<<<<<<<<<<
 *             a1 = a0 + major_s
 *             x0 = cos(a0)
 */
          __pyx_v_a0 = (__pyx_v_i * __pyx_v_major_s);

          /* "punyverse/_glgeom.pyx":38
 *         for i in xrange(n_major):
 *             a0 = i * major_s
 *             a1 = a0 + major_s             # <<<<<<<<<<<<<<
 *             x0 = cos(a0)
 *             y0 = sin(a0)
 */
          __pyx_v_a1 = (__pyx_v_a0 + __pyx_v_major_s);

          /* "punyverse/_glgeom.pyx":39
 *             a0 = i * major_s
 *             a1 = a0 + major_s
 *             x0 = cos(a0)             # <<<<<<<<<<<<<<
 *             y0 = sin(a0)
 *             x1 = cos(a1)
 */
          __pyx_v_x0 = cos(__pyx_v_a0);

          /* "punyverse/_glgeom.pyx":40
 *             a1 = a0 + major_s
 *             x0 = cos(a0)
 *             y0 = sin(a0)             # <<<<<<<<<<<<<<
 *             x1 = cos(a1)
 *             y1 = sin(a1)
 */
          __pyx_v_y0 = sin(__pyx_v_a0);

          /* "punyverse/_glgeom.pyx":41
 *             x0 = cos(a0)
 *             y0 = sin(a0)
 *             x1 = cos(a1)             # <<<<<<<<<<<<<<
 *             y1 = sin(a1)
 * 
 */
          __pyx_v_x1 = cos(__pyx_v_a1);

          /* "punyverse/_glgeom.pyx":42
 *             y0 = sin(a0)
 *             x1 = cos(a1)
 *             y1 = sin(a1)             # <<<<<<<<<<<<<<
 * 
 *             glBegin(GL_TRIANGLE_STRIP)
 */
          __pyx_v_y1 = sin(__pyx_v_a1);

          /* "punyverse/_glgeom.pyx":44
 *             y1 = sin(a1)
 * 
 *             glBegin(GL_TRIANGLE_STRIP)             # <<<<<<<<<<<<<<
 * 
 *             for j in xrange(n_minor + 1):
 */
          glBegin(__pyx_e_9punyverse_7_glgeom_GL_TRIANGLE_STRIP);

          /* "punyverse/_glgeom.pyx":46
 *             glBegin(GL_TRIANGLE_STRIP)
 * 
 *             for j in xrange(n_minor + 1):             # <<<<<<<<<<<<<<
 *                 b = j * minor_s
 *                 c = cos(b)
 */
          __pyx_t_13 = (__pyx_v_n_minor + 1);
          __pyx_t_14 = __pyx_t_13;
          for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) {
            __pyx_v_j = __pyx_t_15;

            /* "punyverse/_glgeom.pyx":47
 * 
 *             for j in xrange(n_minor + 1):
 *                 b = j * minor_s             # <<<<<<<<<<<<<<
 *                 c = cos(b)
 *                 r = minor_radius * c + major_radius
 */
            __pyx_v_b = (__pyx_v_j * __pyx_v_minor_s);

            /* "punyverse/_glgeom.pyx":48
 *             for j in xrange(n_minor + 1):
 *                 b = j * minor_s
 *                 c = cos(b)             # <<<<<<<<<<<<<<
 *                 r = minor_radius * c + major_radius
 *                 z = minor_radius * sin(b)
 */
            __pyx_v_c = cos(__pyx_v_b);

            /* "punyverse/_glgeom.pyx":49
 *                 b = j * minor_s
 *                 c = cos(b)
 *                 r = minor_radius * c + major_radius             # <<<<<<<<<<<<<<
 *                 z = minor_radius * sin(b)
 * 
 */
            __pyx_v_r = ((__pyx_v_minor_radius * __pyx_v_c) + __pyx_v_major_radius);

            /* "punyverse/_glgeom.pyx":50
 *                 c = cos(b)
 *                 r = minor_radius * c + major_radius
 *                 z = minor_radius * sin(b)             # <<<<<<<<<<<<<<
 * 
 *                 x = x0 * c
 */
            __pyx_v_z = (__pyx_v_minor_radius * sin(__pyx_v_b));

            /* "punyverse/_glgeom.pyx":52
 *                 z = minor_radius * sin(b)
 * 
 *                 x = x0 * c             # <<<<<<<<<<<<<<
 *                 y = y0 * c
 *                 z2 = z / minor_radius
 */
            __pyx_v_x = (__pyx_v_x0 * __pyx_v_c);

            /* "punyverse/_glgeom.pyx":53
 * 
 *                 x = x0 * c
 *                 y = y0 * c             # <<<<<<<<<<<<<<
 *                 z2 = z / minor_radius
 *                 m = 1.0 / sqrt(x * x + y * y + z2 * z2)
 */
            __pyx_v_y = (__pyx_v_y0 * __pyx_v_c);

            /* "punyverse/_glgeom.pyx":54
 *                 x = x0 * c
 *                 y = y0 * c
 *                 z2 = z / minor_radius             # <<<<<<<<<<<<<<
 *                 m = 1.0 / sqrt(x * x + y * y + z2 * z2)
 *                 glNormal3f(x * m, y * z, z2 * m)
 */
            __pyx_v_z2 = (__pyx_v_z / __pyx_v_minor_radius);

            /* "punyverse/_glgeom.pyx":55
 *                 y = y0 * c
 *                 z2 = z / minor_radius
 *                 m = 1.0 / sqrt(x * x + y * y + z2 * z2)             # <<<<<<<<<<<<<<
 *                 glNormal3f(x * m, y * z, z2 * m)
 *                 glVertex3f(x0 * r, y0 * r, z)
 */
            __pyx_v_m = (1.0 / sqrt((((__pyx_v_x * __pyx_v_x) + (__pyx_v_y * __pyx_v_y)) + (__pyx_v_z2 * __pyx_v_z2))));

            /* "punyverse/_glgeom.pyx":56
 *                 z2 = z / minor_radius
 *                 m = 1.0 / sqrt(x * x + y * y + z2 * z2)
 *                 glNormal3f(x * m, y * z, z2 * m)             # <<<<<<<<<<<<<<
 *                 glVertex3f(x0 * r, y0 * r, z)
 * 
 */
            glNormal3f((__pyx_v_x * __pyx_v_m), (__pyx_v_y * __pyx_v_z), (__pyx_v_z2 * __pyx_v_m));

            /* "punyverse/_glgeom.pyx":57
 *                 m = 1.0 / sqrt(x * x + y * y + z2 * z2)
 *                 glNormal3f(x * m, y * z, z2 * m)
 *                 glVertex3f(x0 * r, y0 * r, z)             # <<<<<<<<<<<<<<
 * 
 *                 x = x1 * c
 */
            glVertex3f((__pyx_v_x0 * __pyx_v_r), (__pyx_v_y0 * __pyx_v_r), __pyx_v_z);

            /* "punyverse/_glgeom.pyx":59
 *                 glVertex3f(x0 * r, y0 * r, z)
 * 
 *                 x = x1 * c             # <<<<<<<<<<<<<<
 *                 y = y1 * c
 *                 m = 1.0 / sqrt(x * x + y * y + z2 * z2)
 */
            __pyx_v_x = (__pyx_v_x1 * __pyx_v_c);

            /* "punyverse/_glgeom.pyx":60
 * 
 *                 x = x1 * c
 *                 y = y1 * c             # <<<<<<<<<<<<<<
 *                 m = 1.0 / sqrt(x * x + y * y + z2 * z2)
 *                 glNormal3f(x * m, y * z, z2 * m)
 */
            __pyx_v_y = (__pyx_v_y1 * __pyx_v_c);

            /* "punyverse/_glgeom.pyx":61
 *                 x = x1 * c
 *                 y = y1 * c
 *                 m = 1.0 / sqrt(x * x + y * y + z2 * z2)             # <<<<<<<<<<<<<<
 *                 glNormal3f(x * m, y * z, z2 * m)
 *                 glVertex3f(x1 * r, y1 * r, z)
 */
            __pyx_v_m = (1.0 / sqrt((((__pyx_v_x * __pyx_v_x) + (__pyx_v_y * __pyx_v_y)) + (__pyx_v_z2 * __pyx_v_z2))));

            /* "punyverse/_glgeom.pyx":62
 *                 y = y1 * c
 *                 m = 1.0 / sqrt(x * x + y * y + z2 * z2)
 *                 glNormal3f(x * m, y * z, z2 * m)             # <<<<<<<<<<<<<<
 *                 glVertex3f(x1 * r, y1 * r, z)
 * 
 */
            glNormal3f((__pyx_v_x * __pyx_v_m), (__pyx_v_y * __pyx_v_z), (__pyx_v_z2 * __pyx_v_m));

            /* "punyverse/_glgeom.pyx":63
 *                 m = 1.0 / sqrt(x * x + y * y + z2 * z2)
 *                 glNormal3f(x * m, y * z, z2 * m)
 *                 glVertex3f(x1 * r, y1 * r, z)             # <<<<<<<<<<<<<<
 * 
 *             glEnd()
 */
            glVertex3f((__pyx_v_x1 * __pyx_v_r), (__pyx_v_y1 * __pyx_v_r), __pyx_v_z);
          }

          /* "punyverse/_glgeom.pyx":65
 *                 glVertex3f(x1 * r, y1 * r, z)
 * 
 *             glEnd()             # <<<<<<<<<<<<<<
 *         glPopAttrib()
 * 
 */
          glEnd();
        }

        /* "punyverse/_glgeom.pyx":66
 * 
 *             glEnd()
 *         glPopAttrib()             # <<<<<<<<<<<<<<
 * 
 * 
 */
        glPopAttrib();
      }

      /* "punyverse/_glgeom.pyx":32
 *     cdef int i, j
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         major_s = TWOPI / n_major
 *         minor_s = TWOPI / n_minor
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L9;
        }
        __pyx_L9:;
      }
  }

  /* "punyverse/_glgeom.pyx":16
 * 
 * @cython.cdivision(True)
 * cpdef torus(float major_radius, float minor_radius, int n_major, int n_minor, tuple material, int shininess=125):             # <<<<<<<<<<<<<<
 *     """
 *         Torus function from the OpenGL red book.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("punyverse._glgeom.torus", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_9punyverse_7_glgeom_1torus(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9punyverse_7_glgeom_torus[] = "\n        Torus function from the OpenGL red book.\n    ";
static PyObject *__pyx_pw_9punyverse_7_glgeom_1torus(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  float __pyx_v_major_radius;
  float __pyx_v_minor_radius;
  int __pyx_v_n_major;
  int __pyx_v_n_minor;
  PyObject *__pyx_v_material = 0;
  int __pyx_v_shininess;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("torus (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_major_radius,&__pyx_n_s_minor_radius,&__pyx_n_s_n_major,&__pyx_n_s_n_minor,&__pyx_n_s_material,&__pyx_n_s_shininess,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_major_radius)) != 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_minor_radius)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("torus", 0, 5, 6, 1); __PYX_ERR(0, 16, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n_major)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("torus", 0, 5, 6, 2); __PYX_ERR(0, 16, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n_minor)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("torus", 0, 5, 6, 3); __PYX_ERR(0, 16, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("torus", 0, 5, 6, 4); __PYX_ERR(0, 16, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shininess);
          if (value) { values[5] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "torus") < 0)) __PYX_ERR(0, 16, __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);
        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_major_radius = __pyx_PyFloat_AsFloat(values[0]); if (unlikely((__pyx_v_major_radius == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 16, __pyx_L3_error)
    __pyx_v_minor_radius = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_minor_radius == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 16, __pyx_L3_error)
    __pyx_v_n_major = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_n_major == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 16, __pyx_L3_error)
    __pyx_v_n_minor = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_n_minor == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 16, __pyx_L3_error)
    __pyx_v_material = ((PyObject*)values[4]);
    if (values[5]) {
      __pyx_v_shininess = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_shininess == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 16, __pyx_L3_error)
    } else {
      __pyx_v_shininess = ((int)0x7D);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("torus", 0, 5, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 16, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("punyverse._glgeom.torus", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material), (&PyTuple_Type), 1, "material", 1))) __PYX_ERR(0, 16, __pyx_L1_error)
  __pyx_r = __pyx_pf_9punyverse_7_glgeom_torus(__pyx_self, __pyx_v_major_radius, __pyx_v_minor_radius, __pyx_v_n_major, __pyx_v_n_minor, __pyx_v_material, __pyx_v_shininess);

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

static PyObject *__pyx_pf_9punyverse_7_glgeom_torus(CYTHON_UNUSED PyObject *__pyx_self, float __pyx_v_major_radius, float __pyx_v_minor_radius, int __pyx_v_n_major, int __pyx_v_n_minor, PyObject *__pyx_v_material, int __pyx_v_shininess) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_9punyverse_7_glgeom_torus __pyx_t_2;
  __Pyx_RefNannySetupContext("torus", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.shininess = __pyx_v_shininess;
  __pyx_t_1 = __pyx_f_9punyverse_7_glgeom_torus(__pyx_v_major_radius, __pyx_v_minor_radius, __pyx_v_n_major, __pyx_v_n_minor, __pyx_v_material, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

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

/* "punyverse/_glgeom.pyx":69
 * 
 * 
 * cpdef bytes bgr_to_rgb(bytes buffer, int width, int height, bint alpha=0):             # <<<<<<<<<<<<<<
 *     cdef int length = len(buffer)
 *     cdef int depth = length / (width * height)
 */

static PyObject *__pyx_pw_9punyverse_7_glgeom_3bgr_to_rgb(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_9punyverse_7_glgeom_bgr_to_rgb(PyObject *__pyx_v_buffer, int __pyx_v_width, int __pyx_v_height, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_9punyverse_7_glgeom_bgr_to_rgb *__pyx_optional_args) {
  int __pyx_v_alpha = ((int)0);
  int __pyx_v_length;
  int __pyx_v_depth;
  int __pyx_v_depth2;
  PyObject *__pyx_v_final = 0;
  char *__pyx_v_result;
  char const *__pyx_v_source;
  int __pyx_v_x;
  int __pyx_v_y;
  int __pyx_v_offset;
  int __pyx_v_i;
  int __pyx_v_row;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_t_12;
  __Pyx_RefNannySetupContext("bgr_to_rgb", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_alpha = __pyx_optional_args->alpha;
    }
  }

  /* "punyverse/_glgeom.pyx":70
 * 
 * cpdef bytes bgr_to_rgb(bytes buffer, int width, int height, bint alpha=0):
 *     cdef int length = len(buffer)             # <<<<<<<<<<<<<<
 *     cdef int depth = length / (width * height)
 *     cdef int depth2 = depth - alpha
 */
  if (unlikely(__pyx_v_buffer == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 70, __pyx_L1_error)
  }
  __pyx_t_1 = PyBytes_GET_SIZE(__pyx_v_buffer); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 70, __pyx_L1_error)
  __pyx_v_length = __pyx_t_1;

  /* "punyverse/_glgeom.pyx":71
 * cpdef bytes bgr_to_rgb(bytes buffer, int width, int height, bint alpha=0):
 *     cdef int length = len(buffer)
 *     cdef int depth = length / (width * height)             # <<<<<<<<<<<<<<
 *     cdef int depth2 = depth - alpha
 *     cdef object final = PyBytes_FromStringAndSize(NULL, length)
 */
  __pyx_t_2 = (__pyx_v_width * __pyx_v_height);
  if (unlikely(__pyx_t_2 == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
    __PYX_ERR(0, 71, __pyx_L1_error)
  }
  else if (sizeof(int) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(__pyx_t_2 == (int)-1)  && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_length))) {
    PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
    __PYX_ERR(0, 71, __pyx_L1_error)
  }
  __pyx_v_depth = __Pyx_div_int(__pyx_v_length, __pyx_t_2);

  /* "punyverse/_glgeom.pyx":72
 *     cdef int length = len(buffer)
 *     cdef int depth = length / (width * height)
 *     cdef int depth2 = depth - alpha             # <<<<<<<<<<<<<<
 *     cdef object final = PyBytes_FromStringAndSize(NULL, length)
 *     cdef char *result = PyBytes_AsString(final)
 */
  __pyx_v_depth2 = (__pyx_v_depth - __pyx_v_alpha);

  /* "punyverse/_glgeom.pyx":73
 *     cdef int depth = length / (width * height)
 *     cdef int depth2 = depth - alpha
 *     cdef object final = PyBytes_FromStringAndSize(NULL, length)             # <<<<<<<<<<<<<<
 *     cdef char *result = PyBytes_AsString(final)
 *     cdef const char *source = PyBytes_AsString(buffer)
 */
  __pyx_t_3 = PyBytes_FromStringAndSize(NULL, __pyx_v_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 73, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_final = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "punyverse/_glgeom.pyx":74
 *     cdef int depth2 = depth - alpha
 *     cdef object final = PyBytes_FromStringAndSize(NULL, length)
 *     cdef char *result = PyBytes_AsString(final)             # <<<<<<<<<<<<<<
 *     cdef const char *source = PyBytes_AsString(buffer)
 *     cdef int x, y, offset, i, row = width * depth
 */
  if (!(likely(PyBytes_CheckExact(__pyx_v_final))||((__pyx_v_final) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_final)->tp_name), 0))) __PYX_ERR(0, 74, __pyx_L1_error)
  __pyx_v_result = PyBytes_AsString(((PyObject*)__pyx_v_final));

  /* "punyverse/_glgeom.pyx":75
 *     cdef object final = PyBytes_FromStringAndSize(NULL, length)
 *     cdef char *result = PyBytes_AsString(final)
 *     cdef const char *source = PyBytes_AsString(buffer)             # <<<<<<<<<<<<<<
 *     cdef int x, y, offset, i, row = width * depth
 *     for y in xrange(height):
 */
  __pyx_v_source = PyBytes_AsString(__pyx_v_buffer);

  /* "punyverse/_glgeom.pyx":76
 *     cdef char *result = PyBytes_AsString(final)
 *     cdef const char *source = PyBytes_AsString(buffer)
 *     cdef int x, y, offset, i, row = width * depth             # <<<<<<<<<<<<<<
 *     for y in xrange(height):
 *         for x in xrange(width):
 */
  __pyx_v_row = (__pyx_v_width * __pyx_v_depth);

  /* "punyverse/_glgeom.pyx":77
 *     cdef const char *source = PyBytes_AsString(buffer)
 *     cdef int x, y, offset, i, row = width * depth
 *     for y in xrange(height):             # <<<<<<<<<<<<<<
 *         for x in xrange(width):
 *             offset = y * row + x * depth
 */
  __pyx_t_2 = __pyx_v_height;
  __pyx_t_4 = __pyx_t_2;
  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
    __pyx_v_y = __pyx_t_5;

    /* "punyverse/_glgeom.pyx":78
 *     cdef int x, y, offset, i, row = width * depth
 *     for y in xrange(height):
 *         for x in xrange(width):             # <<<<<<<<<<<<<<
 *             offset = y * row + x * depth
 *             for i in xrange(depth2):
 */
    __pyx_t_6 = __pyx_v_width;
    __pyx_t_7 = __pyx_t_6;
    for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
      __pyx_v_x = __pyx_t_8;

      /* "punyverse/_glgeom.pyx":79
 *     for y in xrange(height):
 *         for x in xrange(width):
 *             offset = y * row + x * depth             # <<<<<<<<<<<<<<
 *             for i in xrange(depth2):
 *                 result[offset+i] = source[offset+depth2-i-1]
 */
      __pyx_v_offset = ((__pyx_v_y * __pyx_v_row) + (__pyx_v_x * __pyx_v_depth));

      /* "punyverse/_glgeom.pyx":80
 *         for x in xrange(width):
 *             offset = y * row + x * depth
 *             for i in xrange(depth2):             # <<<<<<<<<<<<<<
 *                 result[offset+i] = source[offset+depth2-i-1]
 *             if alpha:
 */
      __pyx_t_9 = __pyx_v_depth2;
      __pyx_t_10 = __pyx_t_9;
      for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
        __pyx_v_i = __pyx_t_11;

        /* "punyverse/_glgeom.pyx":81
 *             offset = y * row + x * depth
 *             for i in xrange(depth2):
 *                 result[offset+i] = source[offset+depth2-i-1]             # <<<<<<<<<<<<<<
 *             if alpha:
 *                 result[offset+depth2] = source[offset+depth2]
 */
        (__pyx_v_result[(__pyx_v_offset + __pyx_v_i)]) = (__pyx_v_source[(((__pyx_v_offset + __pyx_v_depth2) - __pyx_v_i) - 1)]);
      }

      /* "punyverse/_glgeom.pyx":82
 *             for i in xrange(depth2):
 *                 result[offset+i] = source[offset+depth2-i-1]
 *             if alpha:             # <<<<<<<<<<<<<<
 *                 result[offset+depth2] = source[offset+depth2]
 *     return final
 */
      __pyx_t_12 = (__pyx_v_alpha != 0);
      if (__pyx_t_12) {

        /* "punyverse/_glgeom.pyx":83
 *                 result[offset+i] = source[offset+depth2-i-1]
 *             if alpha:
 *                 result[offset+depth2] = source[offset+depth2]             # <<<<<<<<<<<<<<
 *     return final
 * 
 */
        (__pyx_v_result[(__pyx_v_offset + __pyx_v_depth2)]) = (__pyx_v_source[(__pyx_v_offset + __pyx_v_depth2)]);

        /* "punyverse/_glgeom.pyx":82
 *             for i in xrange(depth2):
 *                 result[offset+i] = source[offset+depth2-i-1]
 *             if alpha:             # <<<<<<<<<<<<<<
 *                 result[offset+depth2] = source[offset+depth2]
 *     return final
 */
      }
    }
  }

  /* "punyverse/_glgeom.pyx":84
 *             if alpha:
 *                 result[offset+depth2] = source[offset+depth2]
 *     return final             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  if (!(likely(PyBytes_CheckExact(__pyx_v_final))||((__pyx_v_final) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_final)->tp_name), 0))) __PYX_ERR(0, 84, __pyx_L1_error)
  __Pyx_INCREF(__pyx_v_final);
  __pyx_r = ((PyObject*)__pyx_v_final);
  goto __pyx_L0;

  /* "punyverse/_glgeom.pyx":69
 * 
 * 
 * cpdef bytes bgr_to_rgb(bytes buffer, int width, int height, bint alpha=0):             # <<<<<<<<<<<<<<
 *     cdef int length = len(buffer)
 *     cdef int depth = length / (width * height)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("punyverse._glgeom.bgr_to_rgb", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_final);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_9punyverse_7_glgeom_3bgr_to_rgb(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_9punyverse_7_glgeom_3bgr_to_rgb(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_buffer = 0;
  int __pyx_v_width;
  int __pyx_v_height;
  int __pyx_v_alpha;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bgr_to_rgb (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_buffer,&__pyx_n_s_width,&__pyx_n_s_height,&__pyx_n_s_alpha,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_buffer)) != 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_width)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("bgr_to_rgb", 0, 3, 4, 1); __PYX_ERR(0, 69, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_height)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("bgr_to_rgb", 0, 3, 4, 2); __PYX_ERR(0, 69, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alpha);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bgr_to_rgb") < 0)) __PYX_ERR(0, 69, __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);
        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_buffer = ((PyObject*)values[0]);
    __pyx_v_width = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_width == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 69, __pyx_L3_error)
    __pyx_v_height = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_height == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 69, __pyx_L3_error)
    if (values[3]) {
      __pyx_v_alpha = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_alpha == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 69, __pyx_L3_error)
    } else {
      __pyx_v_alpha = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bgr_to_rgb", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 69, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("punyverse._glgeom.bgr_to_rgb", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_buffer), (&PyBytes_Type), 1, "buffer", 1))) __PYX_ERR(0, 69, __pyx_L1_error)
  __pyx_r = __pyx_pf_9punyverse_7_glgeom_2bgr_to_rgb(__pyx_self, __pyx_v_buffer, __pyx_v_width, __pyx_v_height, __pyx_v_alpha);

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

static PyObject *__pyx_pf_9punyverse_7_glgeom_2bgr_to_rgb(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buffer, int __pyx_v_width, int __pyx_v_height, int __pyx_v_alpha) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_9punyverse_7_glgeom_bgr_to_rgb __pyx_t_2;
  __Pyx_RefNannySetupContext("bgr_to_rgb", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.alpha = __pyx_v_alpha;
  __pyx_t_1 = __pyx_f_9punyverse_7_glgeom_bgr_to_rgb(__pyx_v_buffer, __pyx_v_width, __pyx_v_height, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

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

/* "punyverse/_glgeom.pyx":87
 * 
 * 
 * cpdef bytes flip_vertical(bytes buffer, int width, int height):             # <<<<<<<<<<<<<<
 *     cdef int length = len(buffer)
 *     cdef object final = PyBytes_FromStringAndSize(NULL, length)
 */

static PyObject *__pyx_pw_9punyverse_7_glgeom_5flip_vertical(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_9punyverse_7_glgeom_flip_vertical(PyObject *__pyx_v_buffer, CYTHON_UNUSED int __pyx_v_width, int __pyx_v_height, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_length;
  PyObject *__pyx_v_final = 0;
  char *__pyx_v_result;
  char const *__pyx_v_source;
  int __pyx_v_y1;
  int __pyx_v_y2;
  int __pyx_v_row;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("flip_vertical", 0);

  /* "punyverse/_glgeom.pyx":88
 * 
 * cpdef bytes flip_vertical(bytes buffer, int width, int height):
 *     cdef int length = len(buffer)             # <<<<<<<<<<<<<<
 *     cdef object final = PyBytes_FromStringAndSize(NULL, length)
 *     cdef char *result = PyBytes_AsString(final)
 */
  if (unlikely(__pyx_v_buffer == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 88, __pyx_L1_error)
  }
  __pyx_t_1 = PyBytes_GET_SIZE(__pyx_v_buffer); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 88, __pyx_L1_error)
  __pyx_v_length = __pyx_t_1;

  /* "punyverse/_glgeom.pyx":89
 * cpdef bytes flip_vertical(bytes buffer, int width, int height):
 *     cdef int length = len(buffer)
 *     cdef object final = PyBytes_FromStringAndSize(NULL, length)             # <<<<<<<<<<<<<<
 *     cdef char *result = PyBytes_AsString(final)
 *     cdef const char *source = PyBytes_AsString(buffer)
 */
  __pyx_t_2 = PyBytes_FromStringAndSize(NULL, __pyx_v_length); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 89, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_final = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "punyverse/_glgeom.pyx":90
 *     cdef int length = len(buffer)
 *     cdef object final = PyBytes_FromStringAndSize(NULL, length)
 *     cdef char *result = PyBytes_AsString(final)             # <<<<<<<<<<<<<<
 *     cdef const char *source = PyBytes_AsString(buffer)
 *     cdef int y1, y2, row = length / height
 */
  if (!(likely(PyBytes_CheckExact(__pyx_v_final))||((__pyx_v_final) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_final)->tp_name), 0))) __PYX_ERR(0, 90, __pyx_L1_error)
  __pyx_v_result = PyBytes_AsString(((PyObject*)__pyx_v_final));

  /* "punyverse/_glgeom.pyx":91
 *     cdef object final = PyBytes_FromStringAndSize(NULL, length)
 *     cdef char *result = PyBytes_AsString(final)
 *     cdef const char *source = PyBytes_AsString(buffer)             # <<<<<<<<<<<<<<
 *     cdef int y1, y2, row = length / height
 *     for y1 in xrange(height):
 */
  __pyx_v_source = PyBytes_AsString(__pyx_v_buffer);

  /* "punyverse/_glgeom.pyx":92
 *     cdef char *result = PyBytes_AsString(final)
 *     cdef const char *source = PyBytes_AsString(buffer)
 *     cdef int y1, y2, row = length / height             # <<<<<<<<<<<<<<
 *     for y1 in xrange(height):
 *         y2 = height - y1 - 1
 */
  if (unlikely(__pyx_v_height == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
    __PYX_ERR(0, 92, __pyx_L1_error)
  }
  else if (sizeof(int) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(__pyx_v_height == (int)-1)  && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_length))) {
    PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
    __PYX_ERR(0, 92, __pyx_L1_error)
  }
  __pyx_v_row = __Pyx_div_int(__pyx_v_length, __pyx_v_height);

  /* "punyverse/_glgeom.pyx":93
 *     cdef const char *source = PyBytes_AsString(buffer)
 *     cdef int y1, y2, row = length / height
 *     for y1 in xrange(height):             # <<<<<<<<<<<<<<
 *         y2 = height - y1 - 1
 *         memcpy(result + y1 * row, source + y2 * row, row)
 */
  __pyx_t_3 = __pyx_v_height;
  __pyx_t_4 = __pyx_t_3;
  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
    __pyx_v_y1 = __pyx_t_5;

    /* "punyverse/_glgeom.pyx":94
 *     cdef int y1, y2, row = length / height
 *     for y1 in xrange(height):
 *         y2 = height - y1 - 1             # <<<<<<<<<<<<<<
 *         memcpy(result + y1 * row, source + y2 * row, row)
 *     return final
 */
    __pyx_v_y2 = ((__pyx_v_height - __pyx_v_y1) - 1);

    /* "punyverse/_glgeom.pyx":95
 *     for y1 in xrange(height):
 *         y2 = height - y1 - 1
 *         memcpy(result + y1 * row, source + y2 * row, row)             # <<<<<<<<<<<<<<
 *     return final
 */
    (void)(memcpy((__pyx_v_result + (__pyx_v_y1 * __pyx_v_row)), (__pyx_v_source + (__pyx_v_y2 * __pyx_v_row)), __pyx_v_row));
  }

  /* "punyverse/_glgeom.pyx":96
 *         y2 = height - y1 - 1
 *         memcpy(result + y1 * row, source + y2 * row, row)
 *     return final             # <<<<<<<<<<<<<<
 */
  __Pyx_XDECREF(__pyx_r);
  if (!(likely(PyBytes_CheckExact(__pyx_v_final))||((__pyx_v_final) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_final)->tp_name), 0))) __PYX_ERR(0, 96, __pyx_L1_error)
  __Pyx_INCREF(__pyx_v_final);
  __pyx_r = ((PyObject*)__pyx_v_final);
  goto __pyx_L0;

  /* "punyverse/_glgeom.pyx":87
 * 
 * 
 * cpdef bytes flip_vertical(bytes buffer, int width, int height):             # <<<<<<<<<<<<<<
 *     cdef int length = len(buffer)
 *     cdef object final = PyBytes_FromStringAndSize(NULL, length)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("punyverse._glgeom.flip_vertical", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_final);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_9punyverse_7_glgeom_5flip_vertical(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_9punyverse_7_glgeom_5flip_vertical(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_buffer = 0;
  int __pyx_v_width;
  int __pyx_v_height;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("flip_vertical (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_buffer,&__pyx_n_s_width,&__pyx_n_s_height,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_buffer)) != 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_width)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("flip_vertical", 1, 3, 3, 1); __PYX_ERR(0, 87, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_height)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("flip_vertical", 1, 3, 3, 2); __PYX_ERR(0, 87, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "flip_vertical") < 0)) __PYX_ERR(0, 87, __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_buffer = ((PyObject*)values[0]);
    __pyx_v_width = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_width == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 87, __pyx_L3_error)
    __pyx_v_height = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_height == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 87, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("flip_vertical", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 87, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("punyverse._glgeom.flip_vertical", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_buffer), (&PyBytes_Type), 1, "buffer", 1))) __PYX_ERR(0, 87, __pyx_L1_error)
  __pyx_r = __pyx_pf_9punyverse_7_glgeom_4flip_vertical(__pyx_self, __pyx_v_buffer, __pyx_v_width, __pyx_v_height);

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

static PyObject *__pyx_pf_9punyverse_7_glgeom_4flip_vertical(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buffer, int __pyx_v_width, int __pyx_v_height) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("flip_vertical", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_9punyverse_7_glgeom_flip_vertical(__pyx_v_buffer, __pyx_v_width, __pyx_v_height, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 87, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

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

static PyMethodDef __pyx_methods[] = {
  {"torus", (PyCFunction)__pyx_pw_9punyverse_7_glgeom_1torus, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9punyverse_7_glgeom_torus},
  {"bgr_to_rgb", (PyCFunction)__pyx_pw_9punyverse_7_glgeom_3bgr_to_rgb, METH_VARARGS|METH_KEYWORDS, 0},
  {"flip_vertical", (PyCFunction)__pyx_pw_9punyverse_7_glgeom_5flip_vertical, METH_VARARGS|METH_KEYWORDS, 0},
  {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__glgeom(PyObject* module); /*proto*/
static PyModuleDef_Slot __pyx_moduledef_slots[] = {
  {Py_mod_create, (void*)__pyx_pymod_create},
  {Py_mod_exec, (void*)__pyx_pymod_exec__glgeom},
  {0, NULL}
};
#endif

static struct PyModuleDef __pyx_moduledef = {
    PyModuleDef_HEAD_INIT,
    "_glgeom",
    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

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_n_s_alpha, __pyx_k_alpha, sizeof(__pyx_k_alpha), 0, 0, 1, 1},
  {&__pyx_n_s_buffer, __pyx_k_buffer, sizeof(__pyx_k_buffer), 0, 0, 1, 1},
  {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
  {&__pyx_n_s_height, __pyx_k_height, sizeof(__pyx_k_height), 0, 0, 1, 1},
  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
  {&__pyx_n_s_major_radius, __pyx_k_major_radius, sizeof(__pyx_k_major_radius), 0, 0, 1, 1},
  {&__pyx_n_s_material, __pyx_k_material, sizeof(__pyx_k_material), 0, 0, 1, 1},
  {&__pyx_n_s_minor_radius, __pyx_k_minor_radius, sizeof(__pyx_k_minor_radius), 0, 0, 1, 1},
  {&__pyx_n_s_n_major, __pyx_k_n_major, sizeof(__pyx_k_n_major), 0, 0, 1, 1},
  {&__pyx_n_s_n_minor, __pyx_k_n_minor, sizeof(__pyx_k_n_minor), 0, 0, 1, 1},
  {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
  {&__pyx_n_s_shininess, __pyx_k_shininess, sizeof(__pyx_k_shininess), 0, 0, 1, 1},
  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
  {&__pyx_n_s_width, __pyx_k_width, sizeof(__pyx_k_width), 0, 0, 1, 1},
  {&__pyx_n_s_xrange, __pyx_k_xrange, sizeof(__pyx_k_xrange), 0, 0, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
  #if PY_MAJOR_VERSION >= 3
  __pyx_builtin_xrange = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_xrange) __PYX_ERR(0, 36, __pyx_L1_error)
  #else
  __pyx_builtin_xrange = __Pyx_GetBuiltinName(__pyx_n_s_xrange); if (!__pyx_builtin_xrange) __PYX_ERR(0, 36, __pyx_L1_error)
  #endif
  return 0;
  __pyx_L1_error:;
  return -1;
}

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

static int __Pyx_InitGlobals(void) {
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  return 0;
  __pyx_L1_error:;
  return -1;
}

static int __Pyx_modinit_global_init_code(void); /*proto*/
static int __Pyx_modinit_variable_export_code(void); /*proto*/
static int __Pyx_modinit_function_export_code(void); /*proto*/
static int __Pyx_modinit_type_init_code(void); /*proto*/
static int __Pyx_modinit_type_import_code(void); /*proto*/
static int __Pyx_modinit_variable_import_code(void); /*proto*/
static 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_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_type_import_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
  /*--- Type import code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

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
#ifndef CYTHON_SMALL_CODE
#if defined(__clang__)
    #define CYTHON_SMALL_CODE
#elif defined(__GNUC__) && (!(defined(__cplusplus)) || (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 4)))
    #define CYTHON_SMALL_CODE __attribute__((cold))
#else
    #define CYTHON_SMALL_CODE
#endif
#endif


#if PY_MAJOR_VERSION < 3
__Pyx_PyMODINIT_FUNC init_glgeom(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC init_glgeom(void)
#else
__Pyx_PyMODINIT_FUNC PyInit__glgeom(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC PyInit__glgeom(void)
#if CYTHON_PEP489_MULTI_PHASE_INIT
{
  return PyModuleDef_Init(&__pyx_moduledef);
}
static int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name) {
    PyObject *value = PyObject_GetAttrString(spec, from_name);
    int result = 0;
    if (likely(value)) {
        result = PyDict_SetItemString(moddict, to_name, value);
        Py_DECREF(value);
    } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
        PyErr_Clear();
    } else {
        result = -1;
    }
    return result;
}
static PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
    PyObject *module = NULL, *moddict, *modname;
    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__") < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__") < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__") < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__") < 0)) goto bad;
    return module;
bad:
    Py_XDECREF(module);
    return NULL;
}


static int __pyx_pymod_exec__glgeom(PyObject *__pyx_pyinit_module)
#endif
#endif
{
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannyDeclarations
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  if (__pyx_m && __pyx_m == __pyx_pyinit_module) return 0;
  #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__glgeom(void)", 0);
  if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __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("_glgeom", __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_punyverse___glgeom) {
    if (PyObject_SetAttrString(__pyx_m, "__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, "punyverse._glgeom")) {
      if (unlikely(PyDict_SetItemString(modules, "punyverse._glgeom", __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();
  (void)__Pyx_modinit_type_init_code();
  (void)__Pyx_modinit_type_import_code();
  (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

  /* "punyverse/_cyopengl.pxi":1209
 *     GLU_TESS_WINDING_ABS_GEQ_TWO =     100134
 * 
 * cdef float GLU_TESS_MAX_COORD = 1.0e150             # <<<<<<<<<<<<<<
 */
  __pyx_v_9punyverse_7_glgeom_GLU_TESS_MAX_COORD = 1.0e150;

  /* "punyverse/_glgeom.pyx":7
 * 
 * include "_cyopengl.pxi"
 * cdef float PI = 3.1415926535897932324626             # <<<<<<<<<<<<<<
 * cdef float TWOPI = PI * 2
 * 
 */
  __pyx_v_9punyverse_7_glgeom_PI = 3.1415926535897932324626;

  /* "punyverse/_glgeom.pyx":8
 * include "_cyopengl.pxi"
 * cdef float PI = 3.1415926535897932324626
 * cdef float TWOPI = PI * 2             # <<<<<<<<<<<<<<
 * 
 * cdef extern from "Python.h":
 */
  __pyx_v_9punyverse_7_glgeom_TWOPI = (__pyx_v_9punyverse_7_glgeom_PI * 2.0);

  /* "punyverse/_glgeom.pyx":1
 * from libc.math cimport sin, cos, sqrt             # <<<<<<<<<<<<<<
 * from libc.stdlib cimport malloc, free
 * from libc.string cimport memcpy
 */
  __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;

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

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  if (__pyx_m) {
    if (__pyx_d) {
      __Pyx_AddTraceback("init punyverse._glgeom", 0, __pyx_lineno, __pyx_filename);
    }
    Py_DECREF(__pyx_m); __pyx_m = 0;
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init punyverse._glgeom");
  }
  __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((char *)modname);
    if (!m) goto end;
    p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
    if (!p) goto end;
    r = PyLong_AsVoidPtr(p);
end:
    Py_XDECREF(p);
    Py_XDECREF(m);
    return (__Pyx_RefNannyAPIStruct *)r;
}
#endif

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

/* 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((0 <= wrapped_i) & (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((0 <= wrapped_i) & (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((n >= 0) & (n < PyList_GET_SIZE(o))))) {
            PyObject *r = PyList_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    }
    else if (PyTuple_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
        if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
            PyObject *r = PyTuple_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    } else {
        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
        if (likely(m && m->sq_item)) {
            if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
                Py_ssize_t l = m->sq_length(o);
                if (likely(l >= 0)) {
                    i += l;
                } else {
                    if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                        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));
}

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

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

/* ParseKeywords */
static int __Pyx_ParseOptionalKeywords(
    PyObject *kwds,
    PyObject **argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    const char* function_name)
{
    PyObject *key = 0, *value = 0;
    Py_ssize_t pos = 0;
    PyObject*** name;
    PyObject*** first_kw_arg = argnames + num_pos_args;
    while (PyDict_Next(kwds, &pos, &key, &value)) {
        name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (*name) {
            values[name-argnames] = value;
            continue;
        }
        name = first_kw_arg;
        #if PY_MAJOR_VERSION < 3
        if (likely(PyString_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;
}

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

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

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

/* CLineInTraceback */
#ifndef CYTHON_CLINE_IN_TRACEBACK
static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_line) {
    PyObject *use_cline;
    PyObject *ptype, *pvalue, *ptraceback;
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject **cython_runtime_dict;
#endif
    if (unlikely(!__pyx_cython_runtime)) {
        return c_line;
    }
    __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
#if CYTHON_COMPILING_IN_CPYTHON
    cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
    if (likely(cython_runtime_dict)) {
      use_cline = __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 (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);
}

/* 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) -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_int(int value) {
    const int neg_one = (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);
    }
}

/* CIntFromPy */
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
    const int neg_one = (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) -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;
}

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

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